Here's a version that wraps in <div> only the nodes that have line breaks
in them; there's certainly a cleaner way to do this, but here it is as
inspiration/proof-of-concept.

wikitext output below code; the screen capture sent previously is unchanged.

\define print-row()
\whitespace trim
     <$vars lb="
">
<$set name="depth"
filter="[<currentTiddler>get-stream-root:includeall[]count[]]">
<$set name="prefix" filter="[[*]pad<depth>,[*]removesuffix[*]]" select="0">
    <$set name="prewrap"
filter="[<currentTiddler>regexp:text[\n]then[<div>]]" select="0">
    <$set name="postwrap"
filter="[<currentTiddler>regexp:text[\n]then[</div>]]" select="0">
      <$list
filter="[<currentTiddler>get[text]addprefix<prewrap>addprefix<prefix>addsuffix<postwrap>addsuffix<lb>]"
select="0" variable="nodetext">
<$text text=<<nodetext>> />
<$list filter="[<currentTiddler>has[stream-list]]" variable="_NULL">
<$list filter="[enlist{!!stream-list}is[tiddler]]">
<<print-row>>
</$list>
</$list>
      </$list>
</$set>
</$set>
</$set>
</$set>
    </$vars>
\end

\define print-stream()
\whitespace trim
<$list filter="[enlist{!!stream-list}is[tiddler]]">
<<print-row>>
</$list>
\end

<$button> export
<$wikify name="flat" text=<<print-stream>> >
<$action-setfield $tiddler="report" text=<<flat>>/>
</$wikify>
</$button>

-------------

*''Version 1.0''
**Add affordance to collapse/expand all nodes of a  stream
**''CSS''
***Update css to respect color palette
**''Settings''
***''Configuration settings for context menu items''
****Include other menu items like demote/promote that are disabled by
default
****Config screen for enabling/disabling context menu items
****Allow specifying that a contextmenu item should be displayed on narrow
screens (mobile) only?
***Config tiddler for node content template
*Have an option to detach a bullet from a list.
*''Version 1.1''
**//Provide a better UI to rename bullets while editing//
**<div>UI ideas re: modals

https://getbootstrap.com/docs/3.4/javascript/#popovers

http://www.uxforthemasses.com/wp-content/uploads/2015/08/LinkedIn-edit-example.jpg
</div>
*''Other Ideas''
**drag and drop considerations
***copy/transclude via modifier keys to another tiddler doesnt include
nested children
**option to flatten a bullet list to one tiddler, for publishing/export
**context menu that applies to entire stream
**Consider different styling for default bullet
*''Version 2.0''
**''templating for list row items and row controls''
***Allow for different kinds of stream tiddlers (todo, comments, etc)
**Use draft mechanism for editing
***navigator.js L266



On Fri, 16 Jul 2021 at 23:20, Frédéric Demers <fred.dem...@gmail.com> wrote:

> Greetings all,
>
> Using bits and pieces I cobbled together (like a plumber), I found a way
> to flatten a stream of nodes into another tiddler and preserve the
> hierarchy of the nodes.
>
> The key was to 1) use the recursive macro provide by Saq, 2) use the
> get-stream-root[]count[] filter to determine depth of the node, and 3)
> use the pad[]operator to turn said depth in the correct number of *
> characters.
> I had to work a bit to extract the wikitext correctly. I wrapped each node
> in a <div> tag pair to allow multi-line nodes... though a smarter filter
> set could do that only if line feeds are present in the node text.
>
> rendered preview enclosed, wikitext output below the sample code.
>
> \define print-row()
> \whitespace trim
> <$set name="depth"
> filter="[<currentTiddler>get-stream-root:includeall[]count[]]">
> <$set name="prefix" filter="[[*]pad<depth>,[*]removesuffix[*]]" select="0">
> <$vars lb="</div>
> ">
>      <$list
> filter="[<currentTiddler>get[text]addprefix[<div>]addprefix<prefix>addsuffix<lb>]"
> select="0" variable="nodetext">
> <$text text=<<nodetext>> />
> <$list filter="[<currentTiddler>has[stream-list]]" variable="_NULL">
> <$list filter="[enlist{!!stream-list}is[tiddler]]">
> <<print-row>>
> </$list>
> </$list>
>
> </$list>
> </$vars>
> </$set>
> </$set>
> \end
>
> \define print-stream()
> \whitespace trim
> <$list filter="[enlist{!!stream-list}is[tiddler]]">
> <<print-row>>
> </$list>
> \end
>
> <$button> export
> <$wikify name="flat" text=<<print-stream>> >
> <$action-setfield $tiddler="report" text=<<flat>>/>
> </$wikify>
> </$button>
>
>
> --------------------------------------------------------------------------------------------------
>
> *<div>''Version 1.0''</div>
> **<div>Add affordance to collapse/expand all nodes of a  stream</div>
> **<div>''CSS''</div>
> ***<div>Update css to respect color palette</div>
> **<div>''Settings''</div>
> ***<div>''Configuration settings for context menu items''</div>
> ****<div>Include other menu items like demote/promote that are disabled by
> default</div>
> ****<div>Config screen for enabling/disabling context menu items</div>
> ****<div>Allow specifying that a contextmenu item should be displayed on
> narrow screens (mobile) only?</div>
> ***<div>Config tiddler for node content template</div>
> *<div>Have an option to detach a bullet from a list.</div>
> *<div>''Version 1.1''</div>
> **<div>//Provide a better UI to rename bullets while editing//</div>
> **<div>UI ideas re: modals
>
> https://getbootstrap.com/docs/3.4/javascript/#popovers
>
>
> http://www.uxforthemasses.com/wp-content/uploads/2015/08/LinkedIn-edit-example.jpg
> </div>
> *<div>''Other Ideas''</div>
> **<div>drag and drop considerations</div>
> ***<div>copy/transclude via modifier keys to another tiddler doesnt
> include nested children</div>
> **<div>option to flatten a bullet list to one tiddler, for
> publishing/export</div>
> **<div>context menu that applies to entire stream</div>
> **<div>Consider different styling for default bullet</div>
> *<div>''Version 2.0''</div>
> **<div>''templating for list row items and row controls''</div>
> ***<div>Allow for different kinds of stream tiddlers (todo, comments,
> etc)</div>
> **<div>Use draft mechanism for editing</div>
> ***<div>navigator.js L266</div>
>
>
>
> On Thursday, 15 July 2021 at 14:34:58 UTC-4 saq.i...@gmail.com wrote:
>
>> My previous two rather lengthy replies to this thread seem not have been
>> published. I am hoping I've accidentally hit "reply to author". If not,
>> I'll find the time to try again over the weekend.
>>
>> Saq
>>
> --
> 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/e2ab027b-2f6d-4d30-9221-c496a02f19a5n%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/e2ab027b-2f6d-4d30-9221-c496a02f19a5n%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/CAAY2DnNEmYt6f%2B%3DFtR9NBdQkBxywh9XiqPW%3DdJx1Vjj4hrpFWw%40mail.gmail.com.

Reply via email to