Or, don't blow up on an unfortunate series of bad events.
1. If a file has a copyright header starting with /// and delimited with
**** and JAVADOC_AUTOBRIEF is set to ON, Doxygen treats the first ***
line as a brief documentation, which then made m.css fail because it
doesn't expect stuff like <para><hruler/></para> inside
<briefdescriptions>. The <hruler/> is still not implemented yet,
though.
2. Who would have thought that
/// A brief docs.
/// @{
/// Some detailed docs.
would be understood as a two-paragraph brief?!
3. And who would have thought that
/// ============
/// The Thing
/// ============
would create a brief containing some === characters and a <heading>
inside?! Here I just give up and ignore the whole thing.
# Brief description always needs to be single paragraph because we're
# sending it out without enclosing <p>.
if element.tag == 'briefdescription':
- assert not has_block_elements and paragraph_count <= 1
- if paragraph_count == 1:
- assert out.parsed.startswith('<p>') and out.parsed.endswith('</p>')
- out.parsed = out.parsed[3:-4]
+ # JAVADOC_AUTOBRIEF is *bad*
+ if state.doxyfile.get('JAVADOC_AUTOBRIEF', False):
+ # See the contents_brief_heading test for details
+ if has_block_elements:
+ logging.warning("{}: JAVADOC_AUTOBRIEF produced a brief description with block elements. That's not supported, ignoring the whole contents of {}".format(state.current, out.parsed))
+ out.parsed = ''
+
+ # See the contents_brief_multiline test for details
+ elif paragraph_count > 1:
+ logging.warning("{}: JAVADOC_AUTOBRIEF produced a multi-line brief description. That's not supported, using just the first paragraph of {}".format(state.current, out.parsed))
+
+ end = out.parsed.find('</p>')
+ assert out.parsed.startswith('<p>') and end != -1
+ out.parsed = out.parsed[3:end]
+
+ # See contents_brief_hr for why I need to check for out.parsed
+ elif paragraph_count == 1 and out.parsed:
+ assert out.parsed.startswith('<p>') and out.parsed.endswith('</p>')
+ out.parsed = out.parsed[3:-4]
+
+ # Sane behavior otherwise
+ else:
+ assert not has_block_elements and paragraph_count <= 1
+
+ if paragraph_count == 1:
+ assert out.parsed.startswith('<p>') and out.parsed.endswith('</p>')
+ out.parsed = out.parsed[3:-4]
# Strip superfluous <p> for simple elments (list items, parameter and
# return value description, table cells), but only if there is just a
# Boolean values that we want
for i in ['CREATE_SUBDIRS',
+ 'JAVADOC_AUTOBRIEF',
'M_EXPAND_INNER_TYPES',
'M_SEARCH_DISABLED',
'M_SEARCH_DOWNLOAD_BINARY']:
--- /dev/null
+INPUT = File.h
+QUIET = YES
+GENERATE_HTML = NO
+GENERATE_LATEX = NO
+GENERATE_XML = YES
+XML_PROGRAMLISTING = NO
+
+M_PAGE_FINE_PRINT =
+M_THEME_COLOR =
+M_LINKS_NAVBAR1 =
+M_LINKS_NAVBAR2 =
+M_SEARCH_DISABLED = YES
+
+# So the ==== is treated as brief. Ugh.
+JAVADOC_AUTOBRIEF = YES
--- /dev/null
+/// ===============
+/// The Thing
+/// ===============
+namespace Namespace {}
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Namespace namespace | My Project</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+ <link rel="stylesheet" href="m-dark+doxygen.compiled.css" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+ </div>
+ </div>
+</nav></header>
+<main><article>
+ <div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-l-10 m-push-l-1">
+ <h1>Namespace <span class="m-thin">namespace</span></h1>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+INPUT = File.h
+QUIET = YES
+GENERATE_HTML = NO
+GENERATE_LATEX = NO
+GENERATE_XML = YES
+XML_PROGRAMLISTING = NO
+
+M_PAGE_FINE_PRINT =
+M_THEME_COLOR =
+M_LINKS_NAVBAR1 =
+M_LINKS_NAVBAR2 =
+M_SEARCH_DISABLED = YES
+
+# So the comment on top is treated as a brief
+JAVADOC_AUTOBRIEF = YES
--- /dev/null
+/// **************
+///
+/// SOME HEAVY LICENSE HEADER WITH SOME HEAVY WORDS
+///
+/// **************
+
+namespace Namespace {
+
+/// Some normal brief documentation
+void foo();
+
+}
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Namespace namespace | My Project</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+ <link rel="stylesheet" href="m-dark+doxygen.compiled.css" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+ </div>
+ </div>
+</nav></header>
+<main><article>
+ <div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-l-10 m-push-l-1">
+ <h1>Namespace <span class="m-thin">namespace</span></h1>
+ <div class="m-block m-default">
+ <h3>Contents</h3>
+ <ul>
+ <li>
+ Reference
+ <ul>
+ <li><a href="#func-members">Functions</a></li>
+ </ul>
+ </li>
+ </ul>
+ </div>
+<p>SOME HEAVY LICENSE HEADER WITH SOME HEAVY WORDS</p>
+ <section id="func-members">
+ <h2><a href="#func-members">Functions</a></h2>
+ <dl class="m-dox">
+ <dt>
+ <span class="m-dox-wrap-bumper">void <a href="#a0f1fe1a972c7c4196988a1bdde63ec77" class="m-dox-self" name="a0f1fe1a972c7c4196988a1bdde63ec77">foo</a>(</span><span class="m-dox-wrap">)</span>
+ </dt>
+ <dd>Some normal brief documentation.</dd>
+ </dl>
+ </section>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
--- /dev/null
+INPUT = File.h
+QUIET = YES
+GENERATE_HTML = NO
+GENERATE_LATEX = NO
+GENERATE_XML = YES
+XML_PROGRAMLISTING = NO
+
+M_PAGE_FINE_PRINT =
+M_THEME_COLOR =
+M_LINKS_NAVBAR1 =
+M_LINKS_NAVBAR2 =
+M_SEARCH_DISABLED = YES
+
+# So the two lines on top are treated as brief. Wtf.
+JAVADOC_AUTOBRIEF = YES
--- /dev/null
+/// First line of a brief output
+/// @{
+/// Second line of a brief output gets ignored with a warning
+namespace Namespace {}
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <meta charset="UTF-8" />
+ <title>Namespace namespace | My Project</title>
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600" />
+ <link rel="stylesheet" href="m-dark+doxygen.compiled.css" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+</head>
+<body>
+<header><nav id="navigation">
+ <div class="m-container">
+ <div class="m-row">
+ <a href="index.html" id="m-navbar-brand" class="m-col-t-8 m-col-m-none m-left-m">My Project</a>
+ </div>
+ </div>
+</nav></header>
+<main><article>
+ <div class="m-container m-container-inflatable">
+ <div class="m-row">
+ <div class="m-col-l-10 m-push-l-1">
+ <h1>Namespace <span class="m-thin">namespace</span></h1>
+ <p>First line of a brief output</p>
+ </div>
+ </div>
+ </div>
+</article></main>
+</body>
+</html>
# The index file should be generated, no abort
self.assertTrue(os.path.exists(os.path.join(self.path, 'html', 'index.html')))
+
+# JAVADOC_AUTOBRIEF should be nuked from orbit. Or implemented from scratch,
+# properly.
+
+class AutobriefHr(IntegrationTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'autobrief_hr', *args, **kwargs)
+
+ def test(self):
+ self.run_dox2html5(wildcard='namespaceNamespace.xml')
+ self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html'))
+
+class AutobriefMultiline(IntegrationTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'autobrief_multiline', *args, **kwargs)
+
+ def test(self):
+ self.run_dox2html5(wildcard='namespaceNamespace.xml')
+ self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html'))
+
+class AutobriefHeading(IntegrationTestCase):
+ def __init__(self, *args, **kwargs):
+ super().__init__(__file__, 'autobrief_heading', *args, **kwargs)
+
+ def test(self):
+ self.run_dox2html5(wildcard='namespaceNamespace.xml')
+ self.assertEqual(*self.actual_expected_contents('namespaceNamespace.html'))