Yes, I understand that process. My point was that a more "correct" (which I know is not always a good thing) way to do would be to * read the file * shove it into the innerHTML of a (not in document) dom node X * use getElementByID to find the storearea div * set the innerHTML of that div * pull the innerHTML out of X * write that string to the file I wondered about the rationale for using the existing, more fragile method that relies on a particular comment marker not being disturbed in the document.
On Jan 5, 8:09 pm, Eric Shulman <[email protected]> wrote: > > Sorry, regex may have been misleading. I meant that it works by > > string matching rather than dom matching, using javascript's indexOf > > method. Function locateStoreArea from Saving.js starts with > > var posOpeningDiv = original.indexOf(startSaveArea); > > var limitClosingDiv = original.indexOf("<"+"!--POST- > > STOREAREA--"+">"); > > Perhaps this summary explanation of the 'saveChanges()' processing > will help make things a bit more understandable: > > When *saving* a TW file, the core first needs to read in the saved > file content as a text string (to get the *unparsed* source code). > Then, it locates the storeArea DIV within that text (using indexOf > (startSaveArea)) and replaces the existing storeArea with a new one > generated from the current tiddler data. After a tweaking few more > bits and pieces of the source to insert the content of the Markup* > tiddlers (if any) and update the <title>...</title> block, the entire > updated block of text is then written to the file. > > HTH, > -e > Eric Shulman > TiddlyTools / ELS Design Studios --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/TiddlyWikiDev?hl=en -~----------~----~----~----~------~----~------~--~---
