From 19004b3ed92ec6c9efc278753786f5a604096b6f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 1 Jan 2018 21:08:23 +0100 Subject: [PATCH] m.dox: render the link as code only if there's no custom title. And properly test this case. --- pelican-plugins/m/dox.py | 8 ++++++-- pelican-plugins/m/test/dox/page.html | 2 ++ pelican-plugins/m/test/dox/page.rst | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pelican-plugins/m/dox.py b/pelican-plugins/m/dox.py index 73a82283..083ddb02 100644 --- a/pelican-plugins/m/dox.py +++ b/pelican-plugins/m/dox.py @@ -117,8 +117,12 @@ def dox(name, rawtext, text, lineno, inliner: Inliner, options={}, content=[]): #msg = inliner.reporter.warning( #'Doxygen symbol %s not found' % target, line=lineno) #prb = inliner.problematic(rawtext, rawtext, msg) - logger.warning('Doxygen symbol `%s` not found, rendering as monospace' % target) - node = nodes.literal(rawtext, title if title else target, **options) + if title: + logger.warning("Doxygen symbol `{}` not found, rendering just link title".format(target)) + node = nodes.inline(rawtext, title, **options) + else: + logger.warning("Doxygen symbol `{}` not found, rendering as monospace".format(target)) + node = nodes.literal(rawtext, target, **options) return [node], [] def register(): diff --git a/pelican-plugins/m/test/dox/page.html b/pelican-plugins/m/test/dox/page.html index f691e5d0..a30bf77a 100644 --- a/pelican-plugins/m/test/dox/page.html +++ b/pelican-plugins/m/test/dox/page.html @@ -32,6 +32,8 @@

These should produce warnings:

diff --git a/pelican-plugins/m/test/dox/page.rst b/pelican-plugins/m/test/dox/page.rst index c27f2f2b..74b32710 100644 --- a/pelican-plugins/m/test/dox/page.rst +++ b/pelican-plugins/m/test/dox/page.rst @@ -9,5 +9,7 @@ m.dox These should produce warnings: +- Link to nonexistent name will be rendered as code: :dox:`nonExistent()` +- :dox:`Link to nonexistent name with custom title will be just text ` - Link to a section that doesn't have a title will keep the ID (this *may* break on tagfile update, watch out): :dox:`corrade-cmake-add-test` -- 2.30.2