Thank you for sharing your thoughts! Including php in the tiddlywiki itself 
was an intriguing idea

Another idea that comes to mind is to detect if the tiddlywiki has been 
changed since you opened it and merge the to files instead of overwriting. 
I guess it should be trivial to make the tw-receiver script compare the 
versions and make new tiddlers with a specific tag where there is conflic, 
and then we can use a plugin in the wiki to compare the conflicts when they 
exist

Anders
mandag 23. november 2020 kl. 07:06:00 UTC+1 skrev TW Tones:

> 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 digit...@gmail.com 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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b1658aa2-4767-4415-bfd8-1420d651894bn%40googlegroups.com.

Reply via email to