Query On "Insertion Point Location" in single file TW

136 views
Skip to first unread message

TiddlyTweeter

unread,
Jan 28, 2020, 4:17:47 AM1/28/20
to TiddlyWiki
I have been looking at regular expression tools that can parse TW single file format and directly INSERT Tiddlers in a raw format. 
The raw TW (tid div container) format looks quite simple.

My Question: Is there a marker in the file indicating ... "Normal tiddlers you insert here"? Does it matter where they are inserted?

Hope this clear! I'm simply seeking a reliable insertion point.

Best wishes
TT

TiddlyTweeter

unread,
Jan 28, 2020, 4:18:31 AM1/28/20
to TiddlyWiki
Repeat for email ...

Ton Gerner

unread,
Jan 28, 2020, 5:27:35 AM1/28/20
to TiddlyWiki
Hi Josiah,

In an empty TW5 create a tiddler with a title of xxxxx
Search for xxxxx in the source code

You wil see the tiddler with title xxxxx is inserted just before

<!--~~ Library modules ~~-->

(In TW 5.1.21 at line# 9460)

Cheers,

Ton
 

PMario

unread,
Jan 28, 2020, 6:13:43 AM1/28/20
to tiddl...@googlegroups.com
Hi,

The TW5 file template is: $:/core/templates/tiddlywiki5.html

As Ton pointed out you can search for the library marker and put all your tiddlers ABOVE it.



<noscript>
<div id="splashArea">
`{{$:/core/templates/static.area}}`
</div>
</noscript>
<!--~~ Ordinary tiddlers ~~-->                                 
`{{$:/core/templates/store.area.template.html}}`      <------- This filter produces the tiddler store in the HTML file.
<!--~~ Library modules ~~-->
<div id="libraryModules" style="display:none;">
`{{{ [is[system]type[application/javascript]library[yes]] ||$:/core/templates/javascript-tiddler}}}`
</div>


As you can see above. There is no special marker for the tiddler store. So use the id="libraryModules" and place your tiddlers in front of it. That's safe.
You could also use the </noscript> marker and place your tiddlers after it. Almost the same thing.

Be aware: The filter will _not_ be part of a tiddlywiki.html file. It's only visible in the template!

Do NOT use the HTML comment. Comments can and will be changed at will.

have fun!
mario

TiddlyTweeter

unread,
Jan 28, 2020, 6:25:00 AM1/28/20
to TiddlyWiki
Ton Gerner wrote:
You wil see the tiddler with title xxxxx is inserted just before

<!--~~ Library modules ~~-->

(In TW 5.1.21 at line# 9460)
 
Many thanks!  

TT

Jeremy Ruston

unread,
Jan 28, 2020, 7:44:14 AM1/28/20
to tiddl...@googlegroups.com
Hi Josiah

When the TW5 core code needs to read the tiddlers from a TW HTML file, it looks for the string:

<div id="storeArea" style="display:none;">

The individual tiddler DIVs immediately follow, terminated by </div>.

You can use the same marker for inserting tiddlers but they will be overridden by any other tiddlers with the same title already in the file.

To put your tiddlers after any existing tiddlers, you’d have to search back from <!--~~ Library modules ~~--> to find the preceding </div>, and insert your tiddlers immediately before it.

Another point to notice is that the attribute values and tiddler content are HTML encoded. You may want to make sure you test with tiddlers called things like “Tom & Jerry” to test.

Best wishes

Jeremy.


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/4d6e9d79-a7dd-4395-83f9-a215fd54d992%40googlegroups.com.

Message has been deleted

TiddlyTweeter

unread,
Jan 28, 2020, 10:04:40 AM1/28/20
to TiddlyWiki
Thanks Jeremy for the details. Very useful! I particularly will look at attribute values which I was intending to include.

Best wishes
Josiah


On Tuesday, 28 January 2020 13:44:14 UTC+1, Jeremy Ruston wrote:
Hi Josiah

When the TW5 core code needs to read the tiddlers from a TW HTML file, it looks for the string:

<div id="storeArea" style="display:none;">

The individual tiddler DIVs immediately follow, terminated by </div>.

You can use the same marker for inserting tiddlers but they will be overridden by any other tiddlers with the same title already in the file.

To put your tiddlers after any existing tiddlers, you’d have to search back from <!--~~ Library modules ~~--> to find the preceding </div>, and insert your tiddlers immediately before it.

Another point to notice is that the attribute values and tiddler content are HTML encoded. You may want to make sure you test with tiddlers called things like “Tom & Jerry” to test.

Best wishes

Jeremy.

On 28 Jan 2020, at 11:25, TiddlyTweeter <Tiddly...@assays.tv> wrote:

Ton Gerner wrote:
You wil see the tiddler with title xxxxx is inserted just before

<!--~~ Library modules ~~-->

(In TW 5.1.21 at line# 9460)
 
Many thanks!  

TT

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.

TiddlyTweeter

unread,
Feb 12, 2020, 9:27:52 AM2/12/20
to TiddlyWiki
PMario wrote:

... There is no special marker for the tiddler store. So use the id="libraryModules" and place your tiddlers in front of it. That's safe.
You could also use the </noscript> marker and place your tiddlers after it. Almost the same thing.

Tx! 

I did this after "<div id="storeArea" style="display:none;">" following JR's comment.

<!--~~ Ordinary tiddlers ~~-->

<div id="storeArea" style="display:none;">
<div title="Perry Mason (1957) s05e23 - The Case of the Absent Artist 0002" tags="" modified="20200211194930568" created="19570101000000000">
Lash out with heavy blows. A true artist must first be an anarchist. Like him? Otto Gervaert? A yogi. But, Glovatski, have you seen his last painting, Day's Catch? Everybody says it's a masterpiece. I repudiate him. Fiona! Fiona! Come quickly. Do hurry, dear. Otto is back.
</div>
<div title="Perry Mason (1957) s05e23 - The Case of the Absent Artist 0003" tags="" modified="20200211194930568" created="19570101000000000">
I heard him moving around down there. He must have just got in. Maybe it's a bat flying around. The poor boy must be starved. Come along, Fiona. Otto, dear boy, welcome home. Oh, dear. He's gone again. This time he's not coming back. Nonsense. Of course he'll be back.
</div>
<div created="20160204225047445" modified="20160204225307847" tags="Articles" title="&quot;A free, open source wiki revisited&quot; by Mark Gibbs, NetworkWorld" type="text/vnd.tiddlywiki" url="http://www.networkworld.com/article/3028098/open-source-tools/tiddlywiki-a-free-open-source-wiki-revisited.
html">

etc ...


Yes?

Do NOT use the HTML comment. Comments can and will be changed at will.

Okay! Why is that? Is it that the store would move them around?

My original idea was to insert a comment before and after inserted raw tiddlers so I could find them later. 
But your comment indicates that can't work? Right?

Just wondering!
TT

PMario

unread,
Feb 12, 2020, 7:07:27 PM2/12/20
to TiddlyWiki
On Wednesday, February 12, 2020 at 3:27:52 PM UTC+1, TiddlyTweeter wrote:


Do NOT use the HTML comment. Comments can and will be changed at will.

Okay! Why is that? Is it that the store would move them around?

It's just that comments are comments. They can be changed at will, without breaking something. You should not rely on them, if you can do it in a different way.
 
My original idea was to insert a comment before and after inserted raw tiddlers so I could find them later. 

You can do what ever you want with your code but don't rely on someone else's comments.
 
But your comment indicates that can't work? Right?

It can work, but it wouldn't be best practice.
 
-m

TiddlyTweeter

unread,
Feb 13, 2020, 2:59:36 AM2/13/20
to TiddlyWiki
Tx!

I now understand what you meant! Yeah, I'd only insert after the store div, not comments.

My comments are purely whilst doing sequential insertions. They are stripped out on completion.

Best wishes
TT

Jeremy Ruston

unread,
Feb 13, 2020, 11:45:28 AM2/13/20
to TiddlyWiki
Hi Josiah

Just a thought, but in order to test the validity of the generated HTML file you might try importing it into another wiki as well as just loading it into a browser. The tiddlers are ready by two different mechansms in those cases, so it will help to shake out any incompatibilities.

Best wishes

Jeremy.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5c1f238f-60ab-4f2a-bf03-22bd7d89e771%40googlegroups.com.

TiddlyTweeter

unread,
Feb 13, 2020, 1:14:00 PM2/13/20
to TiddlyWiki
Tx Jeremy

FYI  I been playing with Powershell to encode attributes automatically.

I think you are right that at start it is a good idea to look at the output in more than one context.

At first I was a bit over confident. There is a lot to get "right" to ensure direct insertion works properly.

Best wishes
TT


On Thursday, 13 February 2020 17:45:28 UTC+1, Jeremy Ruston wrote:
Hi Josiah

Just a thought, but in order to test the validity of the generated HTML file you might try importing it into another wiki as well as just loading it into a browser. The tiddlers are ready by two different mechansms in those cases, so it will help to shake out any incompatibilities.

Best wishes

Jeremy.

On 13 Feb 2020, at 07:59, TiddlyTweeter <Tiddly...@assays.tv> wrote:

Tx!

I now understand what you meant! Yeah, I'd only insert after the store div, not comments.

My comments are purely whilst doing sequential insertions. They are stripped out on completion.

Best wishes
TT

On Thursday, 13 February 2020 01:07:27 UTC+1, PMario wrote:

You can do what ever you want with your code but don't rely on someone else's comments.
 
But your comment indicates that can't work? Right?

It can work, but it wouldn't be best practice.

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.

TiddlyTweeter

unread,
Feb 23, 2020, 5:43:33 AM2/23/20
to TiddlyWiki
Ciao PMario

A report back.

In experiments I discovered that standard HTML comments inserted between "raw" tiddlers are stripped out by TW on open (as far as I can see!). For me that is GOOD news as I just use them for assembly so this means *I* don't need to remove them. TW does it.

TT

On Thursday, 13 February 2020 01:07:27 UTC+1, PMario wrote:

TiddlyTweeter

unread,
Feb 23, 2020, 5:49:23 AM2/23/20
to TiddlyWiki
Ciao Jeremy

Just a report back.

Insertion after <div id="storeArea" style="display:none;"> works well.

I notice they get moved when TW runs. No problem. Actually its quite useful as you can do more additions later in a way that its clear what has been inserted.

Regarding attribute encoding, so far so good just getting Powershell to do it.

Best wishes
TT


On Tuesday, 28 January 2020 13:44:14 UTC+1, Jeremy Ruston wrote:
Hi Josiah

When the TW5 core code needs to read the tiddlers from a TW HTML file, it looks for the string:

<div id="storeArea" style="display:none;">

The individual tiddler DIVs immediately follow, terminated by </div>.

You can use the same marker for inserting tiddlers but they will be overridden by any other tiddlers with the same title already in the file.

To put your tiddlers after any existing tiddlers, you’d have to search back from <!--~~ Library modules ~~--> to find the preceding </div>, and insert your tiddlers immediately before it.

Another point to notice is that the attribute values and tiddler content are HTML encoded. You may want to make sure you test with tiddlers called things like “Tom & Jerry” to test.

Best wishes

Jeremy.

On 28 Jan 2020, at 11:25, TiddlyTweeter <Tiddly...@assays.tv> wrote:

Ton Gerner wrote:
You wil see the tiddler with title xxxxx is inserted just before

<!--~~ Library modules ~~-->

(In TW 5.1.21 at line# 9460)
 
Many thanks!  

TT

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddl...@googlegroups.com.

TiddlyTweeter

unread,
Feb 23, 2020, 5:54:37 AM2/23/20
to TiddlyWiki
I'm wondering how much demand there might be for better understanding "direct insertion" of "raw tids" into TW?

It is something I'm willing to document if there is a need.

Best wishes
TT
Reply all
Reply to author
Forward
0 new messages