diff --git a/core/wiki/macros/toc.tid b/core/wiki/macros/toc.tid index f99d9523a..ca5df085b 100644 --- a/core/wiki/macros/toc.tid +++ b/core/wiki/macros/toc.tid @@ -17,26 +17,31 @@ The very first toc macro is _not_ reused. So it can be used as a simple referenc \whitespace trim + +\procedure _hasItemTemplate() [!is[blank]then[text]] +\procedure _hasCaptionField() [get!is[blank]then] +\procedure _hasCaption() [has[caption]then[caption]] + + \procedure toc-defaultItemTemplate() -] }}}> -<$let tv-wikilinks="no"> - <$transclude $tiddler={{{ [!is[blank]thenelse] }}} - $field={{{ [!is[blank]then[text]] - :else[!is[blank]then] }}} +<$let tv-wikilinks="no" + field={{{ [] :cascade[<_hasItemTemplate>append<_hasCaptionField>append<_hasCaption>append[title]] }}} +> + ] }}} > - <$transclude $field={{{ [{!!caption}!is[blank]then[caption]else[title]] }}}> - <$view field="title"/> - - - <$log/> + <$transclude $field=<>/> + - \end - -\function tf.toc-getItemTemplateTitle() [!is[blank]then] :else[get[toc-itemTemplate]] + +\function tf.toc-getItemTemplateTitle() [get[toc-itemTemplate]] :filter[has[text]] :else[has[text]then] - \procedure _itemTemplate() <$transclude $tiddler=<> > <>