a quick update to everyone;

I am making steady progress on packaging this merging solution, hoping to
release as a Streams plugin addon. I have repurposed the button from
https://szen.io/stream/. I now have it also working as a Streams context
menu, with keyboard shortcuts, and it can export sub-trees correctly by
adjusting the depth levels of the bulleted/numbered lists.

A few ideas I am going to try to roll in and release a beta by the end of
this week....

Cheers

On Sat, 17 Jul 2021 at 09:06, Frédéric Demers <fred.dem...@gmail.com> wrote:

> with capture:
>
> On Sat, 17 Jul 2021 at 09:05, Frédéric Demers <fred.dem...@gmail.com>
> wrote:
>
>> nevermind, I think I solved it.... at least, significant progress
>>
>> here's the wikitext for the challenging nodes; renders pretty well:
>>
>> * <div>
>>
>> ''Streams'' uses the following tiddler fields to maintain the structure
>> of a stream:
>>
>> * each node tiddler has a field `stream-type`
>> * each node that has children, contains their titles in a list in the
>> field `stream-list`
>> * each node that has a parent, contains the parent's title in the field
>> `parent`
>>
>> ''You can manipulate these tiddlers just as you would any other tiddlers,
>> with filters and list and action widgets''
>>
>> </div>
>> * To make it easier to work with Streams tiddlers and their nodes, two
>> filters have been introduced. See [[Streams 0.2 improvements/Filters]]
>> * <div>
>>
>> This is an example of a button that can export the content of the nodes
>> of a tiddler whose title is in the variable `myTiddler` and save the
>> combined text to a single tiddler:
>>
>> ```
>> <$button> save to a single tiddler
>> <$vars lb="
>>
>> ">
>> <$action-setfield $tiddler="report" text={{{
>> [<myTiddler>get-stream-nodes[]]
>>  :reduce[get[text]addprefix<lb>addprefix<accumulator>] }}}/>
>> </$vars>
>> </$button>
>> ```
>> Note that this disregards the node hierarchy.</div>
>> * <div>
>>
>> Similarly to export the combined text of the nodes as HTML you can use
>> the `<$wikify>` widget:
>>
>> ```
>> <$button> export as HTML
>> <$wikify name="text" text="""<$list
>> filter="[<myTiddler>get-stream-nodes[]]">
>> <$transclude mode=block/>
>> </$list>""" output="html">
>> <$action-setfield $tiddler="report" text=<<text>>/>
>> </$wikify>
>> </$button>
>> ```
>>
>> </div>
>> * <div>
>>
>> Here is an example of a macro that can be used to export a stream using a
>> custom HTML structure:
>>
>> ```
>> \define print-row()
>> \whitespace trim
>> <$(innerTag)$>{{!!text}}
>> <$list filter="[<currentTiddler>has[stream-list]]" variable="_NULL">
>> <$(outerTag)$>
>> <$list filter="[enlist{!!stream-list}is[tiddler]]">
>> <<print-row>>
>> </$list>
>> </$(outerTag)$>
>> </$list>
>> </$(innerTag)$>
>> \end
>>
>> \define print-stream()
>> \whitespace trim
>> <$(outerTag)$>
>> <$list filter="[enlist{!!stream-list}is[tiddler]]">
>> <<print-row>>
>> </$list>
>> </$(outerTag)$>
>> \end
>>
>> \define export-stream(tiddler:"" outerTag:"article" innerTag:"section")
>> \whitespace trim
>> <$vars outerTag="$outerTag$" innerTag="$innerTag$"
>> currentTiddler="$tiddler$">
>> <<print-stream>>
>> </$vars>
>> \end
>>
>> ```
>>
>> Try the following:
>>
>> * `<<export-stream tiddler:Roadmap>>` to export using article and section
>> tags
>> * `<<export-stream tiddler:Roadmap outerTag:ul innerTag:li>>` to export
>> as a list in HTML
>>
>> If you need a copy to clipboard button it would look something like this:
>>
>> ```
>> <$button>
>> <$wikify name="stream-html" text=<<export-stream tiddler:Roadmap>>
>> output="html" >
>> <$action-sendmessage $message="tm-copy-to-clipboard"
>> $param=<<stream-html>>/>
>> </$wikify>
>> Copy stream to clipboard as HTML
>> </$button>
>> ```
>>
>> Similarly you can write recursive macros to output as just flat text
>> (with no structure or hierarchy) or wiki text list syntax (assuming you
>> have no multi-line content).</div>
>>
>> On Sat, 17 Jul 2021 at 09:01, Saq Imtiaz <saq.imt...@gmail.com> wrote:
>>
>>> @fred
>>>
>>>
>>>> I noticed my solution does not work so well for complex node content,
>>>> as those in:
>>>> https://saqimtiaz.github.io/streams/#Working%20with%20streams%20tiddlers
>>>>
>>>>
>>>> The reason is that wrapping in <div> tags mangles them badly; I tried a
>>>> few alternatives (<span>, more white space, ..), no success yet. Any
>>>> suggestions?
>>>>
>>>
>>> This is actually the real challenge and why there currently isn't a
>>> default export option from Streams. Depending on the nature of the content,
>>> it seems difficult to generalize a single export format that will work and
>>> one of the common pitfalls is to think of Streams nodes as a list,*
>>> which they are not.*
>>>
>>> A stream node is a tiddler which can contain any kind of content, and
>>> not all kinds of content can be mapped to a list item. It might be easier
>>> to set limitations in one's usage as to what to put inside of a node and
>>> have an export format that works accordingly, rather than trying to come up
>>> with a universal export format that works for all content. Hence my
>>> suggestion of gathering real world user data to drive the process.
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "TiddlyWiki" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/tiddlywiki/-xTFWPwzq6g/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> tiddlywiki+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/tiddlywiki/a0431024-302d-4433-95f0-021234984ab0n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tiddlywiki/a0431024-302d-4433-95f0-021234984ab0n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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/CAAY2DnO9EigHrv8d3OyAx6POdP4_ecT-Jp%3DkubjYUT1FR3gnkQ%40mail.gmail.com.

Reply via email to