I've managed to get it in a single command.

tiddlywiki --verbose --load "./index--private.html" --deletetiddlers 
"[tag[private]]" --setfield "[has:field[name--public]]" "title" 
"publify--name--template-2" "text/plain" --setfield 
"[has:field[name--public]]" "name--public" "" "text/plain" --deletetiddlers 
"[[index--public]] 
[[quick--public]] [[license--public]]" --output "./" --rendertiddler 
"$:/core/save/all" "index.html" "text/plain"

So the reason --setfield didn't work before was because when you --load a 
standalone wiki, its *custom *modules *aren't* loaded. Given you don't need 
to use --load for a node wiki, then its custom modules *are *loaded. 

"publify--name--template" used a custom JavaScript macro to fix the name, 
so that wasn't loading. "publify--name--template-2" sets the title as a 
field that the relevant tiddlers have, so it doesn't need a custom 
JavaScript module. That field is then deleted using the --setfield command 
again, because it isn't necessary anymore.

Here is the "publify--name--template-2" tiddler:
\define publify--name()
<$view field="name--public" />
\end
<!--page-created: 2020-05-27-05-20-47-->
<<publify--name>>

Kalcifer

On Wednesday, May 27, 2020 at 3:09:53 AM UTC+1, Kalcifer Kandari wrote:
>
> I'll have a look at an innerwiki solution now. You can mess with it from a 
> module, so I'll have to create a fake browser to save, *I think *anyway. 
> This is brutal without documentation, but the API is not that bad once you 
> get an idea of where everything is, as long as you have an IDE like 
> netbeans to jump to declarations easily.
>
> I thought maybe the setfield command 
> <https://tiddlywiki.com/#SetFieldCommand> was doing something special to 
> save, so I learnt how to use it. As predicted, no, it doesn't save. So I 
> have no idea what use it is, it seems to be pointless. UNLESS that's what 
> the --build command is for! You run a few command WHILE THE SAME WIKI IS 
> LOADED, so you make changes to the loaded wiki THEN build! Or maybe you can 
> string arguments together? YOU CAN. WE DID IT!
>
> Check this out.
>
>    - So I have a file called local/index--private.html, which is a 
>    standalone TiddlyWiki.
>    - I then convert that to a node.js wiki using --savewikifolder.
>    - Then I run --setfield to fix the names of some tiddlers, but that 
>    duplicates them for some reason, so
>    - I then delete the duplicates using --deletetiddlers.
>    - Then I set the output location using --output.
>    - Then I render the whole thing back to a standalone TiddlyWiki using 
>    --rendertiddler.
>    - Later I will add the rest of the script, that does all the 
>    robocopying and delete the temporary node.js wiki.
>
> tiddlywiki --verbose --load "./local/index--private.html" --savewikifolder 
> ./temp "[all[]]-[tag[private]]"
>
> tiddlywiki temp --verbose --setfield "[[index--public]] [[quick--public]] 
> [[license--public]]" "title" "publify--name--template" "text/plain" 
> --deletetiddlers 
> "[[index--public]] [[quick--public]] [[license--public]]" --output ./local 
> --rendertiddler "$:/core/save/all" "index.html"
>
> I did try to use the following command, to avoid the node.js part, but 
> --setfield didn't work.
> tiddlywiki --verbose --load "./index--private.html" --deletetiddlers 
> "[tag[private]]" --setfield "[[index--public]] [[quick--public]] 
> [[license--public]]" "title" "publify--name--template" "text/plain" 
> --deletetiddlers 
> "[[index--public]] [[quick--public]] [[license--public]]" --output ./ 
> --rendertiddler 
> "$:/core/save/all" "index.html" "text/plain"
>
> Well I learnt how to make a command macro for nothing. Oh well! I'll make 
> a proper tutorial for all of this later. We need documentation. That should 
> have taken me half an hour, but it took *days*!
>
> Kalcifer
>
> On Wednesday, May 27, 2020 at 1:20:39 AM UTC+1, TonyM wrote:
>>
>> Kalcifer Kandari
>>
>> In the innerwiki plugin I mentioned there are some command line tips to 
>> capture an image of the resulting iFrame to generate documentation. But 
>> this is only an interesting fact that may lead you somewhere
>>
>> By passing the appropriate tiddlers to the innerwiki you may be able to 
>> trigger an automatic save of that wiki to a set filename. You also get to 
>> preview it.
>>
>> Others can help you with node or JS solutions, I do things in TW5 single 
>> files mostly, to keep them interactive, and independant of the server if 
>> possible.
>>
>> Regards
>> Tony
>>
>>
>> On Tuesday, May 26, 2020 at 10:28:08 PM UTC+10, Kalcifer Kandari wrote:
>>>
>>> I'm confused on many levels.
>>>
>>>    - Is there even a saver for the command line? SaverHandler 
>>>    
>>> <https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/saver-handler.js>needs
>>>  
>>>    to initialise a 'saver' from $:core/modules/savers 
>>>    
>>> <https://github.com/Jermolene/TiddlyWiki5/tree/master/core/modules/savers>, 
>>>    but none of them seems to work.
>>>    - If there is no way to save from the command line, what does the 
>>> setfield 
>>>    <https://tiddlywiki.com/#SetFieldCommand>command even do? I'm 
>>>    looking at the source code 
>>>    
>>> <https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/commands/setfield.js>
>>>  
>>>    and it doesn't look like it saves.
>>>    - If there is no saver, does that mean innerwiki needs to be used to 
>>>    create a 'fake' browser and then save?
>>>
>>> I'm going to look at this tomorrow.
>>>
>>> Kalcifer
>>>
>>> On Tuesday, May 26, 2020 at 10:10:11 AM UTC+1, Kalcifer Kandari wrote:
>>>>
>>>> I've found SaveHandler.saveWiki("save"), but not sure how to get to it 
>>>> from a command module.
>>>>
>>>> Kalcifer
>>>>
>>>> On Tuesday, May 26, 2020 at 9:42:56 AM UTC+1, Kalcifer Kandari wrote:
>>>>>
>>>>> Does anyone know how to save a node.js wiki using a JavaScript module? 
>>>>> There's a thousand matches for 'save' in the source code, aaaa.
>>>>>
>>>>> Kalcifer
>>>>>
>>>>> On Monday, May 25, 2020 at 11:58:49 PM UTC+1, Kalcifer Kandari wrote:
>>>>>>
>>>>>> It's interesting, but not perfectly suited to this problem. Part of 
>>>>>> the exercise here isn't just making a new wiki from another one, it's 
>>>>>> also 
>>>>>> pushing it to a server, all with just one command. I am planning on 
>>>>>> updating and publishing this wiki everyday. Laziness is serious business.
>>>>>>
>>>>>> Kalcifer
>>>>>>
>>>>>> On Monday, May 25, 2020 at 11:47:40 PM UTC+1, TonyM wrote:
>>>>>>>
>>>>>>> Kalcifer,
>>>>>>>
>>>>>>> Consider using the Innerwiki plugin, you can generate a new wiki 
>>>>>>> inside an iframe with the core and tiddlers you specify. You can then 
>>>>>>> save 
>>>>>>> the generated wiki all in single file.
>>>>>>>
>>>>>>> Regards
>>>>>>> Tony
>>>>>>>
>>>>>>> On Monday, May 25, 2020 at 3:35:32 PM UTC+10, Kalcifer Kandari wrote:
>>>>>>>>
>>>>>>>> Please have a look here:
>>>>>>>>>
>>>>>>>>> https://tiddlywiki.com/prerelease/#Generating%20Static%20Sites%20with%20TiddlyWiki
>>>>>>>>>
>>>>>>>>
>>>>>>>> I'm not trying to generate a static site, rather export part of a 
>>>>>>>> standalone site to another standalone site, then do some renaming.
>>>>>>>>
>>>>>>>> I get the impression that, with the command line, you can convert a 
>>>>>>>> standalone wiki to a node.js wiki, but not the other way around, or 
>>>>>>>> from 
>>>>>>>> standalon to standalone.
>>>>>>>>
>>>>>>>> Kalcifer
>>>>>>>>
>>>>>>>> On Monday, May 25, 2020 at 6:28:14 AM UTC+1, Mohammad wrote:
>>>>>>>>>
>>>>>>>>> Please have a look here:
>>>>>>>>>
>>>>>>>>> https://tiddlywiki.com/prerelease/#Generating%20Static%20Sites%20with%20TiddlyWiki
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Best wishes
>>>>>>>>> Mohammad
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Mon, May 25, 2020 at 9:11 AM Kalcifer Kandari <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Thanks, but that still give a similar error:
>>>>>>>>>>
>>>>>>>>>> Error: ENOENT: no such file or directory, open 
>>>>>>>>>> 'E:\path\local\output\$:\boot\boot.css.html'
>>>>>>>>>>
>>>>>>>>>> Kalcifer
>>>>>>>>>>
>>>>>>>>>> On Monday, May 25, 2020 at 4:21:27 AM UTC+1, Mohammad wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Use
>>>>>>>>>>> tiddlywiki mywiki --render "[all[]]-[tag[private]]"
>>>>>>>>>>>
>>>>>>>>>>> change mywiki with your wiki folder name. This is when you run 
>>>>>>>>>>> the command from a parent folder
>>>>>>>>>>> if not give the correct wiki folder path, if you run from inside 
>>>>>>>>>>> the wiki folder just issue
>>>>>>>>>>> tiddlywiki  --render "[all[]]-[tag[private]]"  
>>>>>>>>>>>
>>>>>>>>>>> Best wishes
>>>>>>>>>>> Mohammad
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On Mon, May 25, 2020 at 7:30 AM Kalcifer Kandari <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> So, I'm working on a fancy script to publish my site by just 
>>>>>>>>>>>> running a single command. I want to do this because the working 
>>>>>>>>>>>> wiki is a 
>>>>>>>>>>>> mix of public and private tiddlers, which is much easier to work 
>>>>>>>>>>>> with that 
>>>>>>>>>>>> 2 separate wikis, given they share a lot of tiddlers. I'm using 
>>>>>>>>>>>> the 
>>>>>>>>>>>> standalone wiki, because far as I know, exposing the node.js 
>>>>>>>>>>>> version to the 
>>>>>>>>>>>> internet is not viable as visitors could edit the site.
>>>>>>>>>>>>
>>>>>>>>>>>> The command will do something like this:
>>>>>>>>>>>>
>>>>>>>>>>>>    1. robocopy /mir the local folder to a staging folder.
>>>>>>>>>>>>    2. In the staging folder, from the original HTML file 
>>>>>>>>>>>>    export some tiddlers based on this filter
>>>>>>>>>>>>    [all[]]-[tag[private]] to a new HTML file, then delete the 
>>>>>>>>>>>>    original HTML file.
>>>>>>>>>>>>    3. Then rename a few tiddlers, such as index--public to 
>>>>>>>>>>>>    index.
>>>>>>>>>>>>    4. robocopy /mir the staging folder to the server, and 
>>>>>>>>>>>>    delete the staging folder.
>>>>>>>>>>>>    
>>>>>>>>>>>> So 2 and 3 are where I'm at.
>>>>>>>>>>>>
>>>>>>>>>>>> *For 2: *I'm trying to use tiddlywiki wiki.html --render 
>>>>>>>>>>>> "[all[]]-[tag[private]]", but it's just throwing an error:
>>>>>>>>>>>>
>>>>>>>>>>>> Error: ENOENT: no such file or directory, open 
>>>>>>>>>>>> 'E:\path\wiki.html\output\$:\boot\boot.css.html'
>>>>>>>>>>>>
>>>>>>>>>>>> My suspicion is that the tiddlywiki command only works for 
>>>>>>>>>>>> node.js wikis?
>>>>>>>>>>>>
>>>>>>>>>>>> *For 3:* I've looked at the tiddlywiki wiki.html --setField 
>>>>>>>>>>>> documentation 
>>>>>>>>>>>> <https://tiddlywiki.com/static/SetFieldCommand.html>, and it 
>>>>>>>>>>>> says "*templatetitle* - the tiddler to wikify into the 
>>>>>>>>>>>> specified field. If blank or missing then the specified field is 
>>>>>>>>>>>> deleted", 
>>>>>>>>>>>> I'm not clear on what that means. I would expect to be able to run 
>>>>>>>>>>>> tiddlywiki 
>>>>>>>>>>>> wiki.html --setField "[title[index--public]]" "title" "index", 
>>>>>>>>>>>> although I haven't got so far to be able to try that out yet.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks,
>>>>>>>>>>>>
>>>>>>>>>>>> Kalcifer
>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> 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 view this discussion on the web visit 
>>>>>>>>>>>> https://groups.google.com/d/msgid/tiddlywikidev/5cf4d25b-5d4e-42ed-b9c9-1429c0030ed9%40googlegroups.com
>>>>>>>>>>>>  
>>>>>>>>>>>> <https://groups.google.com/d/msgid/tiddlywikidev/5cf4d25b-5d4e-42ed-b9c9-1429c0030ed9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>>>> .
>>>>>>>>>>>>
>>>>>>>>>>> -- 
>>>>>>>>>> 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 view this discussion on the web visit 
>>>>>>>>>> https://groups.google.com/d/msgid/tiddlywikidev/2b94bea4-5d7b-4734-a75f-f118ccb3b5c4%40googlegroups.com
>>>>>>>>>>  
>>>>>>>>>> <https://groups.google.com/d/msgid/tiddlywikidev/2b94bea4-5d7b-4734-a75f-f118ccb3b5c4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>> .
>>>>>>>>>>
>>>>>>>>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/532052a7-c150-4914-ad75-6447a82a695c%40googlegroups.com.

Reply via email to