id = element.attrib['refid']
if element.attrib['kindref'] == 'compound':
+ # TODO Unlike below, where the filename is dropped if it matches the
+ # current compound URL, here I don't really know what to do because
+ # <a> with empty href="" gets treated as a non-link by browsers.
url = id + '.html'
elif element.attrib['kindref'] == 'member':
i = id.rindex('_1')
- url = id[:i] + '.html' + '#' + id[i+2:]
+ url = id[:i] + '.html'
+ # There's no point in including the filename itself if linking to an
+ # anchor on the same page.
+ if url == state.current_compound_url:
+ url = ''
+ url += '#' + id[i+2:]
else: # pragma: no cover
logging.critical("{}: unknown <ref> kind {}".format(state.current, element.attrib['kindref']))
assert False
@section Class-section2 Section 2
+@ref Size "Link to this page shouldn't contain the filename" while
+@ref Directory::Var "link to another page should". Same with
+@ref Class-section "section references" vs @ref section-notoc "external pages".
*/
class Class {
public:
</li>
</ul>
</nav>
-<section id="Class-section"><h2><a href="#Class-section">A section</a></h2><p>Text.</p><section id="Class-sub-section"><h3><a href="#Class-sub-section">Subsection</a></h3></section><section id="Class-sub-section2"><h3><a href="#Class-sub-section2">Subsection 2</a></h3><section id="Class-sub-section3"><h4><a href="#Class-sub-section3">Subsection 3</a></h4></section></section></section><section id="Class-section2"><h2><a href="#Class-section2">Section 2</a></h2></section>
+<section id="Class-section"><h2><a href="#Class-section">A section</a></h2><p>Text.</p><section id="Class-sub-section"><h3><a href="#Class-sub-section">Subsection</a></h3></section><section id="Class-sub-section2"><h3><a href="#Class-sub-section2">Subsection 2</a></h3><section id="Class-sub-section3"><h4><a href="#Class-sub-section3">Subsection 3</a></h4></section></section></section><section id="Class-section2"><h2><a href="#Class-section2">Section 2</a></h2><p><a href="#a912d8f1390853f90e0a9f19ec98771e6" class="m-doc">Link to this page shouldn't contain the filename</a> while <a href="namespaceRoot_1_1Directory.html#acdc29819d61c01eed9c74242010a7601" class="m-doc">link to another page should</a>. Same with <a href="#Class-section" class="m-doc">section references</a> vs <a href="page-no-toc.html#section-notoc" class="m-doc">external pages</a>.</p></section>
<section id="pub-types">
<h2><a href="#pub-types">Public types</a></h2>
<dl class="m-doc">
<span class="m-doc-wrap-bumper">void </span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#ga809d062bb88fcd3bd6cf38be250aa348" class="m-doc-self">bar</a>(</span><span class="m-doc-wrap">)</span></span>
</h3>
<p>Bar.</p>
-<p><a name="this_anchor"></a> <a href="group__fizzbuzz.html#this_anchor" class="m-doc">More details</a></p>
+<p><a name="this_anchor"></a> <a href="#this_anchor" class="m-doc">More details</a></p>
</div></section>
</section>
</div>
<h1>
My Project
</h1>
-<section id="section"><h2><a href="#section">Page section</a></h2><p>Text.</p><section id="subsection"><h3><a href="#subsection">Page subsection</a></h3><p>Text!</p><section id="subsubsection"><h4><a href="#subsubsection">Sub-sub section</a></h4><p>Reference to <a href="index.html#subsection" class="m-doc">a page subsection</a> and <a href="index.html#subsubsection" class="m-doc">Sub-sub section</a>.</p></section></section></section>
+<section id="section"><h2><a href="#section">Page section</a></h2><p>Text.</p><section id="subsection"><h3><a href="#subsection">Page subsection</a></h3><p>Text!</p><section id="subsubsection"><h4><a href="#subsubsection">Sub-sub section</a></h4><p>Reference to <a href="#subsection" class="m-doc">a page subsection</a> and <a href="#subsubsection" class="m-doc">Sub-sub section</a>.</p></section></section></section>
</div>
</div>
</div>
<blockquote><p>A blockquote.</p></blockquote><p>Paragraph<br />with<br />explicit<br />line<br />breaks.</p><pre>Preformatted text.
</pre><section id="section"><h2><a href="#section">Page section</a></h2><pre>Differently
preformatted
-text.</pre><ul><li>Unordered</li><li>list</li><li>of<ul><li>nested</li><li>items</li></ul></li><li>and back</li></ul><ol><li>Ordered</li><li>list</li><li>of<ol><li>nested</li><li>items</li></ol></li><li>and back</li></ol><p><a name="an-anchor"></a> This is a <code>typewriter text</code>, <em>emphasis</em>, <strong>bold</strong>. <em>Emphasis with <code>typewriter</code> and <strong>bold</strong> nested.</em> <a href="http://google.com">http:/<wbr />/<wbr />google.com</a> and <a href="http://google.com">URL</a>. <small>Small <em>text</em>.</small> En-dash – and em-dash —. Reference to a <a href="index.html#section" class="m-doc">Page section</a>. Named reference with special characters in title: <a href="index.html#section" class="m-doc">» Warnings «</a>. Reference with escaped characters in title: <a href="index.html#an-anchor" class="m-doc"><anchor></a>.</p><p>2<sup>nd</sup> is L<sub>∞</sub> ∀ ∇ π ℜ ℑ This costs no $, €, £, ¥ or ¤.</p><p>Empty elements:</p><pre></pre><hr/><p>Above is a horizontal line.</p></section>
+text.</pre><ul><li>Unordered</li><li>list</li><li>of<ul><li>nested</li><li>items</li></ul></li><li>and back</li></ul><ol><li>Ordered</li><li>list</li><li>of<ol><li>nested</li><li>items</li></ol></li><li>and back</li></ol><p><a name="an-anchor"></a> This is a <code>typewriter text</code>, <em>emphasis</em>, <strong>bold</strong>. <em>Emphasis with <code>typewriter</code> and <strong>bold</strong> nested.</em> <a href="http://google.com">http:/<wbr />/<wbr />google.com</a> and <a href="http://google.com">URL</a>. <small>Small <em>text</em>.</small> En-dash – and em-dash —. Reference to a <a href="#section" class="m-doc">Page section</a>. Named reference with special characters in title: <a href="#section" class="m-doc">» Warnings «</a>. Reference with escaped characters in title: <a href="#an-anchor" class="m-doc"><anchor></a>.</p><p>2<sup>nd</sup> is L<sub>∞</sub> ∀ ∇ π ℜ ℑ This costs no $, €, £, ¥ or ¤.</p><p>Empty elements:</p><pre></pre><hr/><p>Above is a horizontal line.</p></section>
</div>
</div>
</div>
<h2><a href="#typedef-members">Typedefs</a></h2>
<dl class="m-doc">
<dt id="ab3c402cbc128c888732541f75dbd3952">
- using <a href="#ab3c402cbc128c888732541f75dbd3952" class="m-doc-self">Bar</a> = <a href="File_8h.html#aa621f6f849ec2327dabfc4392fd59a70" class="m-doc">Foo</a>
+ using <a href="#ab3c402cbc128c888732541f75dbd3952" class="m-doc-self">Bar</a> = <a href="#aa621f6f849ec2327dabfc4392fd59a70" class="m-doc">Foo</a>
</dt>
<dd>A typedef.</dd>
</dl>