Anders,
I am interested in the idea you suggest and have explored this space before.
Some quick notes;
- You can use the separate local storage plugin to do the reverse, keep
the public on disk and the private in memory
- Providing a way to export/save the local storage.
- You can separately encrypt tiddlers.
- A solution could be built on top of multiple wikis with a variation in
permissions for functional reasons and name based files.
- HTML can be published in tiddlywiki but operate on a PHP host, ie has
other file dependencies like javascript and PHP.
Tones
On Sunday, 22 November 2020 at 15:51:35 UTC+11 [email protected] wrote:
> I absolutely love tw-receiver it is so incredibly useful. This looks
> really interesting I will definitely give it a try. There are so many php
> enabled hosts out there I hope folks will look further into this method of
> hosting and saving as they look for alternatives to tiddlyspot.
>
> On Friday, November 20, 2020 at 8:59:08 AM UTC-5 Anjar wrote:
>
>> Hi all,
>>
>> I know there has been some discussions on how to manage to have both
>> public and private tiddlers, so here is my take on the problem:
>>
>> If we use tw-receiver as the saving mechanism, we can post-process the
>> html file after saving with PHP. The most brutal form would be to simply add
>>
>> // make a public version
>> $doc = new DOMDocument();
>> $doc->loadHTML(file_get_contents($destinationfile));
>> $selector = new DOMXPath($doc);
>>
>> // search for private tiddlers
>> $result = $selector->query('//div[contains(@tags, "Private")]');
>>
>> // loop through all private tiddlers
>> $titletext = array();
>> foreach($result as $item) {
>> $titletext[] = $item->getAttribute("title"); //save the title
>> for later
>> $item->parentNode->removeChild($item); // remove the tiddler
>> }
>> $str_doc = $doc->saveHTML(); // convert to string
>> $str_doc = str_replace($titletext, '%%%', $str_doc); // remove all
>> mentions of the private tiddler
>> $doc->loadHTML($str_doc); //convert back
>> $doc->saveHTMLFile("./public.html"); // save public version
>>
>> to tw-receiver-server.php (see https://github.com/andjar/tw-receiver).
>> This would create a third output file called public.html and remove all the
>> tiddlers tagged with Private and also replace all mentions of it with %%%
>> (tags, text, links, field etc.). I will try to refine it so that a private
>> tiddler called "link" would not mess up all the html link attributes and so
>> on. Maybe it would be enough to replace in-text links only (and the
>> occurence in the tiddler list in the beginning of the html)?
>>
>> So one can have an admin wiki protected by basic http auth with drafts
>> and so on, and each time one saves, the public version is updated as well.
>> Then it may be useful to have the tw-receiver password hard coded so that
>> one authentication is enough
>>
>> Best,
>> Anders
>>
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/260736db-56da-4af6-a4a7-40e8a6ce0172n%40googlegroups.com.