Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Exporting from Tinderbox >> Hierarchical bullet-point list
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1300748039

Message started by Manuel Richard on Mar 21st, 2011, 6:53pm

Title: Hierarchical bullet-point list
Post by Manuel Richard on Mar 21st, 2011, 6:53pm

Hello all,


I have managed some mildly challenging exports before (LaTeX, iCal..), but am struggling with a simple bullet point text export. What I want is to maintain parent/children hierarchy (using tabs) and have a hyphen before each note, like so:

- A
  - B
  - C
- D
  - E
      - F


My incorrect template is such:

"
- ^title^
     ^children(BulletListTemplate)^

"

any thoughts?

Thanks,
Manuel

Title: Re: Hierarchical bullet-point list
Post by Mark Bernstein on Mar 21st, 2011, 11:29pm

You might be better off with HTML export -- much easier than LaTeX!  But for what you want, ^indent is you friend.

Take a lok at the help; if you need more, ask and we'll walk it through.

Title: Re: Hierarchical bullet-point list
Post by Mark Anderson on Mar 22nd, 2011, 5:29am

Mark's recommendation re HTML is one I'd concur but happily in this scenario, a template for Nakakoji export in the style you describe is possible. Starting assumption: notes A and D are at outline root level ($OutlineDepth of 1).

Code:
^indent("\t",($OutlineDepth-1))^- ^title^^if($ChildCount)^
^children(/Templates/BulletListTemplate)^^endIf^
 IMPORTANT!  Code ends on line after line ending ^endIf^, i.e. add a line return after the latter.

This still means exporting A's tree and D's tree separately, so we want to move all the content inside a container (assumed for now at root level). The container uses this template:

Code:
^children(/Templates/BulletListTemplate)^


As the exported notes now all have an $OutlineDepth one higher than previously, we must tweak the main template like so:

Code:
^indent("\t",($OutlineDepth-2))^- ^title^^if($ChildCount)^
^children(/Templates/BulletListTemplate)^^endIf^

See how that in order to make A have no indent tabs we now need to subtract 2 from its $OutlineDepth, it now beingone level deeper  ($OutlineDepth is now 2) by being inside a root level container (for which $OutlineDepth is 1).

Notes:
  • I'm using an internal template so the full path to the template must be specified or the template doesn't work. For external templates you just use the filename of the template).
  • If the longer syntax of ^indent^ is used, the indent character must be cited as a quoted string. \t is how a Tab character is designated.
  • The outline depth argument to ^indent^ may need adjusting if A & D are not root level.
  • N.B the line return inside the ^if^ statement is deliberate. Otherwise, items with no children would be followed by a blank line. I find this aspect - controlling whitespace
  • ^indent^ code syntax.

Title: Re: Hierarchical bullet-point list
Post by Manuel Richard on Mar 22nd, 2011, 8:36am

Thanks for the pointer to ^indent^, it works a treat.

Mark B: my mention of LaTeX refers to me tweaking a preexisting HTML->MMD->LaTeX export workflow that has been posted on this forum before.

Mark A: Thank you very much for the detailed explanation, it is most appreciated!

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.