Summarizing outlines in $Text - working with relative $OutlineDepth

@PaulWalters I think I figured out why you’ve got surprised with the approach described. After reading some posts in the forum (particularly this one), I realized I was underestimating the power of the “Preview” panel (perhaps because its name is quite misleading, what it does is really a “rendering” of notes, not necessarily previewing how they’d look like if exported from Tinderbox).

Apparently I can have a much simpler setup creating an HTML “export” template appropriate for “previewing” (sic) those notes, and using <li> tags (which don’t require indenting anyway) for sub-sub-items. Then there’s no need to mess with $Text contents.

/Templates/HTML Annotations page:

<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8">
	<title>^title^</title>
</head>
<body>

<h1>^title^</h1>
^text^
^children(/Templates/HTML Annotations page/HTML item)
</body>
</html>

/Templates/HTML Annotations page/HTML item:

<p>^if($Prototype=="Quote")^<blockquote>^endif^^title^^if($loc)^ (p. ^value($loc)^)^endif^^if($Prototype=="Quote")^</blockquote>^endif^
</p>
^if($Text)^<ul><li>^text^^endif^
^if(ChildCount)^
<ul>
^children(/Templates/HTML Annotations page/HTML list item)^
</ul>
^endif^
^if($Text)^</li></ul>^endif^

/Templates/HTML Annotations page/HTML list item:

<li>^if($Prototype=="Quote")^“^endif^^title^^if($Prototype=="Quote")^”^endif^^if($loc)^ (p. ^value($loc)^)^endif^
^if($Text)^<ul><li>^text^^endif^
^if(ChildCount)^
<ul>
^children(/Templates/HTML Annotations page/HTML list item)^
</ul>
^endif^
^if($Text)^</li></ul>^endif^
</li>

I guess I could also build a very generic HTML template, testing for $Prototype=="Annotation" or ^if($Text=="")^, but simply assigning the special template in those notes’ prototype should be sufficient by now.

1 Like