Actually, if you change the first one to "path: /^\/static.html$/", it
would work fine too.
-Arlen

On Tue, Dec 9, 2014 at 4:48 PM, Arlen Beiler <[email protected]> wrote:

> Thank you.
>
> Here is the result of my exploring today. In order to generate static
> pages dynamically (!!!???), this code gets inserted into server.js. The
> only other change was to clone the $:/core/templates/static.template.html
> tiddler and change the link you mentioned to remove the static/ prefix. So
> here's the code. It comes right after the GET request for the root of the
> site.
>
>     this.server.addRoute({
>         method: "GET",
>         path: /^\/static\/$/,
>         handler: function(request,response,state) {
>             response.writeHead(200, {"Content-Type":
> state.server.get("serveType")});
>             var text =
> state.wiki.renderTiddler("text/plain","$:/arlen/static.template.html")
>             response.end(text,"utf8");
>         }
>     });
>     this.server.addRoute({
>         method: "GET",
>         path: /^\/static\/static.css$/,
>         handler: function(request,response,state) {
>             response.writeHead(200, {"Content-Type": "text/css"});
>             var text =
> state.wiki.renderTiddler("text/plain","$:/core/templates/static.template.css");
>             response.end(text,"utf8");
>         }
>     });
>     this.server.addRoute({
>         method: "GET",
>         path: /^\/static\/(.+).html$/,
>         handler: function(request,response,state) {
>             var title =
> decodeURIComponent(decodeURIComponent(state.params[0])),
>                 tiddler = state.wiki.getTiddler(title);
>             if(tiddler) {
>                 response.writeHead(200, {"Content-Type":
> state.server.get("serveType")});
>                 var text =
> state.wiki.renderTiddler("text/plain","$:/core/templates/static.tiddler.html",{
> variables: { currentTiddler: title }})
>                 response.end(text,"utf8");
>             } else {
>                 response.writeHead(404);
>                 response.end();
>             }
>         }
>     });
>
> *Now to put it in a plugin...*
>
> *And make the tabs work...*
>
> *And add a static sidebar...*
>
> *And add the supporting libraries...*
>
>
> *And...and...and...*
> But I like the idea of having a clean, fast interface that does most of
> it's processing on the server.
>
> Enjoy!
> -Arlen
>
> On Tue, Dec 9, 2014 at 3:35 PM, Jeremy Ruston <[email protected]>
> wrote:
>
>> Hi Arlen
>>
>> The default static templates reconfigure the way that links are rendered
>> so as to convert internal tiddler links into file links.
>>
>> At the top of "$:/core/templates/static.template.html" you'll see:
>>
>> \define tv-wikilink-template() static/$uri_doubleencoded$.html
>>
>> The docs for the link widget explain how the tv-wikilink-template macro
>> is used:
>>
>> http://tiddlywiki.com/#LinkWidget
>>
>> Best wishes
>>
>> Jeremy.
>>
>>
>>
>>
>>
>>
>> On Tue, Dec 9, 2014 at 8:30 PM, Arlen Beiler <[email protected]> wrote:
>>
>>> To explain in more detail, I am working on adding single page views to
>>> tiddlywiki that use the static mechanism but are generated on request. I
>>> think if I would put the title through decodeURIcomponent twice it would be
>>> fine, but I wanted to make sure that this is according to design.
>>> -Arlen
>>> On Dec 9, 2014 2:42 PM, "Arlen Beiler" <[email protected]> wrote:
>>>
>>>> Hi all,
>>>> I am working with the renderTiddler command and the tiddlywiki server,
>>>> and the renderTiddler command seems to URI encode links to other tiddly
>>>> documents. I am referring to the commands in this tiddler:
>>>> http://tiddlywiki.com/#Generating%20Static%20Sites%20with%20TiddlyWiki
>>>>
>>>> For instance, the command
>>>>
>>>> --rendertiddler $:/core/templates/static.template.html static.html
>>>> text/plain
>>>>
>>>> renders internal links as
>>>>
>>>> static/Ten%2520reasons%2520to%2520switch%2520to%2520TiddlyWiki.html
>>>>
>>>> "$:/core/templates/static.tiddler.html" does the same thing, except
>>>> without the static folder prefix.
>>>>
>>>> Thanks, Arlen
>>>>
>>>  --
>>> 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.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jeremy Ruston
>> mailto:[email protected]
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to