I've been using Tiddlywiki to view pdf files. I include the pdf file by
viewing it in an embedded iframe (if anyone knows a better way let me know) and
then I copy the content into a hidden area (i.e. /%hidden content%/) in the
tiddler so that it is searchable. I discovered that since I had alot of
content, it was causing my tiddlywiki to grow drastically and this actually
slowed it down. To try to reduce the searchable content I created a
textboxthat would remove the spaces from the hidden content. Then I
copy it and
paste it as one long word into the hidden content area of my pdf tiddler.
Here is what I have so far:
[[textboxtoTextarea]]
/%
!show
<html><nowiki><form style="display:inline">
<input type="text" name="toggleT" value="$1" onkeypress="
return !(window.event && window.event.keyCode == 13);" onchange="
var newtext=toggleT.value.replace(/ /g,'');
toggleT.value=newtext;
document.myform.outputtext.value += newtext;
return false;
">
</form></html>
!end
%/<<tiddler {{var src='textboxtoTextarea'; src+(tiddler&&tiddler.title==src
?'##info':'##show')}}
with: {{'$1'!='$'+'1'?'$1':'textboxtoTextarea'}}
{{'$2'!='$'+'2'?'$2':'clicking this link will copy this text into the
textarea'}}
>>[[My form]] <<tiddler textboxtoTextarea with: "this is a text">> <html> <form name="myform"> <table border="0" cellspacing="0" cellpadding="5"><tr> <td><textarea name="outputtext" cols="40" rows="10"></textarea></td> </tr></table> </form> </html> Then I thought this could be even better to compress it even more so I started trying to figure out what I would need to do to make it better. The steps I think I would need to take are: 1. Remove the characters ) and ( altogether. Not sure why but it sounded good. 2. Replace all non-alphanumeric characters with a space. Maybe this could be done using regular expression syntax \W and \s. 3. Change everything to lower case letters since my search box is not case sensitive. Maybe using .toLowerCase() or :%s/.*/\L&/g but not sure how that works. 4. The next step is so complex I don't even know where to start. I want to remove all duplicates and partial duplicates. I think I have to start by sorting the words by length smallest to largest which after searching all over I only found one place that can do this which was on a web page called sortmylist.com. I'm still trying to figure out how they do it. I'm lost. But then I think I would take each word and search through the entire content with it and if it is anywhere, not add it to the results. 5. Then finally remove all spaces. Can anyone offer any words of wisdom, help, or advise? Maybe if someone knows that it wont work in future versions of Tiddlywiki? Sometimes when you work on something to long, you find out in the end you've either reinvented the wheel or created a giant monstrosity. -- You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/tiddlywikidev?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
