[gtk-doc] mkhtml: warn on linkends that don't go anywhere.
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] mkhtml: warn on linkends that don't go anywhere.
- Date: Sun, 13 May 2018 16:47:50 +0000 (UTC)
commit a078d5009813e0a1b81b022370c0c10b2a7be538
Author: Stefan Sauer <ensonic users sf net>
Date: Sun May 13 14:21:42 2018 +0200
mkhtml: warn on linkends that don't go anywhere.
gtkdoc/mkhtml2.py | 32 ++++++++++++++++++--------------
1 files changed, 18 insertions(+), 14 deletions(-)
---
diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py
index 9a6c80b..a524dbd 100644
--- a/gtkdoc/mkhtml2.py
+++ b/gtkdoc/mkhtml2.py
@@ -1048,22 +1048,26 @@ def convert_varlistentry(ctx, xml):
def convert_xref(ctx, xml):
+ result = []
linkend = xml.attrib['linkend']
(tid, href) = fixxref.GetXRef(linkend)
- title = titles.get(tid)
- # all sectN need to become 'section
- tag = title['tag']
- tag = {
- 'sect1': 'section',
- 'sect2': 'section',
- 'sect3': 'section',
- 'sect4': 'section',
- 'sect5': 'section',
- }.get(tag, tag)
- result = [
- '<a class="xref" href="%s" title="%s">the %s called ā%sā</a>' %
- (href, title['title'], tag, ''.join(convert_title(ctx, title['xml'])))
- ]
+ try:
+ title = titles[tid]
+ # all sectN need to become 'section
+ tag = title['tag']
+ tag = {
+ 'sect1': 'section',
+ 'sect2': 'section',
+ 'sect3': 'section',
+ 'sect4': 'section',
+ 'sect5': 'section',
+ }.get(tag, tag)
+ result = [
+ '<a class="xref" href="%s" title="%s">the %s called ā%sā</a>' %
+ (href, title['title'], tag, ''.join(convert_title(ctx, title['xml'])))
+ ]
+ except KeyError:
+ logging.warning('invalid linkend "%s"', tid)
append_text(ctx, xml.tail, result)
return result
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]