From c18a029782cdedf5d0e98586efc5abbdfbdf45d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Jan 2018 21:22:48 +0100 Subject: [PATCH] m.dox: not just pages can have sections. --- pelican-plugins/m/dox.py | 8 ++++---- pelican-plugins/m/test/dox/page.html | 1 + pelican-plugins/m/test/dox/page.rst | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pelican-plugins/m/dox.py b/pelican-plugins/m/dox.py index f3c35d9e..aad2de1c 100644 --- a/pelican-plugins/m/dox.py +++ b/pelican-plugins/m/dox.py @@ -58,10 +58,6 @@ def init(pelicanobj): link = path + child.find('filename').text + '.html' symbol_mapping[child.find('name').text] = (child.find('title').text, link) - # Page sections - for section in child.findall('docanchor'): - symbol_mapping[section.text] = (section.attrib.get('title', ''), link + '#' + section.text) - # Linking to files if child.attrib['kind'] == 'file': link = path + child.find('filename').text + ".html" @@ -98,6 +94,10 @@ def init(pelicanobj): for value in member.findall('enumvalue'): symbol_mapping[enumeration + '::' + value.text] = (None, link + '#' + value.attrib['anchor']) + # Sections + for section in child.findall('docanchor'): + symbol_mapping[section.text] = (section.attrib.get('title', ''), link + '#' + section.text) + def dox(name, rawtext, text, lineno, inliner: Inliner, options={}, content=[]): title, target = parse_link(text) diff --git a/pelican-plugins/m/test/dox/page.html b/pelican-plugins/m/test/dox/page.html index fc0d953a..87415d1c 100644 --- a/pelican-plugins/m/test/dox/page.html +++ b/pelican-plugins/m/test/dox/page.html @@ -30,6 +30,7 @@
  • Custom link title
  • Page link with custom title
  • Link to index page
  • +
  • Link to class documentation section
  • These should produce warnings: