Fixes to makechap.py to detect ill-formed headers

This commit is contained in:
William S Fulton 2018-05-24 18:32:53 +01:00
commit 62814e4ab7
2 changed files with 8 additions and 6 deletions

View file

@ -197,7 +197,7 @@ Translation of Doxygen comments is influenced by the following <a
href="Customization.html#Customization_features">%feature directives</a>:
</p>
<h4>doxygen:notranslate</h4>
<h4><a name="Doxygen_notranslate"></a>doxygen:notranslate</h4>
<p>
Turns off translation of Doxygen comments to the target language syntax: the
@ -208,7 +208,7 @@ instead of the corresponding language tool (<tt>javadoc</tt>, <tt>sphinx</tt>,
</p>
<h4>doxygen:alias:&lt;command-name&gt;</h4>
<h4><a name="Doxygen_alias"></a>doxygen:alias:&lt;command-name&gt;</h4>
<p>
Specify an alias for a Doxygen command with the given name. This can be useful
@ -254,7 +254,7 @@ wrappers of the C++ API.
</p>
<h4>doxygen:ignore:&lt;command-name&gt;</h4>
<h4><a name="Doxygen_ignore"></a>doxygen:ignore:&lt;command-name&gt;</h4>
<p>
This feature makes it possible to just ignore an unknown Doxygen command, instead of
@ -404,14 +404,14 @@ def func():
</pre></div>
<h4>doxygen:nolinktranslate (Java-only currently)</h4>
<h4><a name="Doxygen_nolinktranslate"></a>doxygen:nolinktranslate (Java-only currently)</h4>
<p>
Turn off automatic link-objects translation.
</p>
<h4>doxygen:nostripparams (Java-only currently)</h4>
<h4><a name="Doxygen_nostripparams"></a>doxygen:nostripparams (Java-only currently)</h4>
<p>
Turn off stripping of <tt>@param</tt> and <tt>@tparam</tt>

View file

@ -44,6 +44,8 @@ def getheadingname(m):
def getheadingtext(m, s):
prevheadingtext_newstyle = m.group(2)
prevheadingtext_oldstyle = m.group(3)
if prevheadingtext_oldstyle is None or prevheadingtext_newstyle is None:
raise RuntimeError("Ill-formed heading in line:\n%s" % s)
if len(prevheadingtext_oldstyle) == 0 and len(prevheadingtext_newstyle) == 0:
raise RuntimeError("No heading text in line:\n%s" % s)
if len(prevheadingtext_oldstyle) > 0 and len(prevheadingtext_newstyle) > 0:
@ -72,7 +74,7 @@ name = ""
# Regexs for <h1>,... <h5> sections
h1 = re.compile(r".*?<H1>(<a.*?>\s*[\d\s]*(.*?)</a>)*[\d\s]*(.*?)</H1>", re.IGNORECASE)
h1 = re.compile(r".*?<H1>(<a.*?>\s*[\d\.\s]*(.*?)</a>)*[\d\.\s]*(.*?)</H1>", re.IGNORECASE)
h2 = re.compile(r".*?<H2>(<a.*?>\s*[\d\.\s]*(.*?)</a>)*[\d\.\s]*(.*?)</H2>", re.IGNORECASE)
h3 = re.compile(r".*?<H3>(<a.*?>\s*[\d\.\s]*(.*?)</a>)*[\d\.\s]*(.*?)</H3>", re.IGNORECASE)
h4 = re.compile(r".*?<H4>(<a.*?>\s*[\d\.\s]*(.*?)</a>)*[\d\.\s]*(.*?)</H4>", re.IGNORECASE)