From: Vladimír Vondruš Date: Mon, 1 Jan 2018 20:22:48 +0000 (+0100) Subject: m.dox: not just pages can have sections. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=c18a029782cdedf5d0e98586efc5abbdfbdf45d5;p=blog.git m.dox: not just pages can have sections. --- 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: