From a5ff8649247c2d79c04f068e91987aecbf01c05b Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 16 Oct 2020 13:04:53 +0200 Subject: Miscounting in respect to lists in markdown When having examples like: ``` Steps 1. \aa2 2. \aa3 3. \aa4 \aa5 ``` and ``` Steps - \bb2 - \bb3 - \bb4 \aa5 ``` we get warnings like: ``` .../aa_list.md:3: warning: Found unknown command '\aa2' .../aa_list.md:4: warning: Found unknown command '\aa3' .../aa_list.md:5: warning: Found unknown command '\aa4' .../aa_list.md:6: warning: Found unknown command '\aa5' .../bb_list.md:3: warning: Found unknown command '\bb2' .../bb_list.md:4: warning: Found unknown command '\bb3' .../bb_list.md:5: warning: Found unknown command '\bb4' .../bb_list.md:6: warning: Found unknown command '\aa5' ``` instead off: ``` .../aa_list.md:2: warning: Found unknown command '\aa2' .../aa_list.md:3: warning: Found unknown command '\aa3' .../aa_list.md:4: warning: Found unknown command '\aa4' .../aa_list.md:5: warning: Found unknown command '\aa5' .../bb_list.md:2: warning: Found unknown command '\bb2' .../bb_list.md:3: warning: Found unknown command '\bb3' .../bb_list.md:4: warning: Found unknown command '\bb4' .../bb_list.md:5: warning: Found unknown command '\aa5' ``` this is due to the fact that there is a line le counting. In case of REJECT no lineCount should be performed and otherwise just once. --- src/doctokenizer.l | 1 - 1 file changed, 1 deletion(-) diff --git a/src/doctokenizer.l b/src/doctokenizer.l index 1774788..5b72b77 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -568,7 +568,6 @@ RCSID "$"("Author"|"Date"|"Header"|"Id"|"Locker"|"Log"|"Name"|"RCSfile"|"Revisio } } {BLANK}*(\n|"\\ilinebr"){OLISTITEM} { /* list item on next line */ - lineCount(yytext,yyleng); if (!g_markdownSupport || g_insidePre) { REJECT; -- cgit v0.12 From 927af4b61fc3bac384aeca0d04ef321c854b3ef0 Mon Sep 17 00:00:00 2001 From: albert-github Date: Fri, 16 Oct 2020 15:52:24 +0200 Subject: Miscounting in case of markdown links When we have simple input files like: ``` Chrome's trace viewer (Catapult) following the [instructions]( https://chromium.googlesource.com/catapult/+/refs/heads/master/tracing/docs/embedding-trace-viewer.md). This directory contains the helper files to embed Chrome's trace viewer. The current resources were generated/copied from [`Catapult@9508452e18f130c98499cb4c4f1e1efaedee8962` ]( https://chromium.googlesource.com/catapult/+/9508452e18f130c98499cb4c4f1e1efaedee8962). \aa11 ``` or ``` Add new exported module Text.Pandoc.Writers.AnnotatedTable [API change] (#6655, Christian Despres). This module (which should generally \bb3 ``` one gets (in the current master version, a5ac10888f6c0b0fc00678f67aa49036b33aa4cf): ``` .../aa.md:8: warning: Found unknown command '\aa11' .../bb.md:3: warning: Found unknown command '\bb4' ``` instead of ``` .../aa.md:11: warning: Found unknown command '\aa11' .../bb.md:4: warning: Found unknown command '\bb4' ``` this is due to the fact that the newlines inside the links are not taken into consideration during the conversion. We can add the extra newlines but have to do this inside the `<...>` as than they are handled correctly later on: - when adding them before the `<` doxygen sees a newline and will start a new paragraph starting with the link instead of keeping it in its place. - when adding them after the `>` we can get a warning about `warning: End of list marker found without any preceding list items` when after the closing `)` of the link there is directly a `.` --- src/markdown.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/markdown.cpp b/src/markdown.cpp index 15e18bc..c72537b 100644 --- a/src/markdown.cpp +++ b/src/markdown.cpp @@ -808,6 +808,7 @@ int Markdown::processLink(const char *data,int,int size) } contentStart=i; int level=1; + int nlTotal=0; int nl=0; // find the matching ] while (i=size) return 0; // premature end of comment -> no link contentEnd=i; convertStringFragment(content,data+contentStart,contentEnd-contentStart); @@ -843,9 +846,12 @@ int Markdown::processLink(const char *data,int,int size) if (i0) { @@ -876,6 +881,8 @@ int Markdown::processLink(const char *data,int,int size) i++; } } + nlTotal += nl; + nl = 0; if (i>=size || data[i]=='\n') return 0; convertStringFragment(link,data+linkStart,i-linkStart); link = link.stripWhiteSpace(); @@ -985,6 +992,8 @@ int Markdown::processLink(const char *data,int,int size) { return 0; } + nlTotal += nl; + nl = 0; if (isToc) // special case for [TOC] { int toc_level = Config_getInt(TOC_INCLUDE_HEADINGS); @@ -1066,6 +1075,7 @@ int Markdown::processLink(const char *data,int,int size) m_out.addStr("