src/doc_down: save headlines from InlineDecorator
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 1 Jun 2018 16:04:32 +0000 (12:04 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Sun, 10 Jun 2018 17:25:06 +0000 (13:25 -0400)
So it can be used to generate Markdown summaries

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/doc/doc_down.nit

index 7bb330b..f02b1fd 100644 (file)
@@ -204,6 +204,14 @@ private class InlineDecorator
        end
 
        redef fun add_headline(v, block) do
+               # save headline
+               var line = block.block.first_line
+               if line == null then return
+               var txt = line.value
+               var id = strip_id(txt)
+               var lvl = block.depth
+               headlines[id] = new HeadLine(id, txt, lvl)
+
                v.emit_in block
        end