public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: newlib@sourceware.org
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH] Fix warning during manpage generaton
Date: Fri, 28 Oct 2022 09:53:26 +0100	[thread overview]
Message-ID: <20221028085326.11792-1-jon.turney@dronecode.org.uk> (raw)

> ERROR: xref linking to Stubs has no generated link text.
> Error: no ID for constraint linkend: Stubs.

(Despite saying "ERROR", this is actaully a warning and manpages are
still generated)

Improve chapter-texi2docbook so it generates elements for texinfo
sections as well, so that a cross-reference to the "Stubs" section
contains a valid element ID.
---
 newlib/doc/chapter-texi2docbook.py | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/newlib/doc/chapter-texi2docbook.py b/newlib/doc/chapter-texi2docbook.py
index 834a14e7c..70ab3c04f 100755
--- a/newlib/doc/chapter-texi2docbook.py
+++ b/newlib/doc/chapter-texi2docbook.py
@@ -14,6 +14,7 @@ import re
 
 def main():
     first_node = True
+    prev_sect = False
 
     print ('<?xml version="1.0" encoding="UTF-8"?>')
     print ('<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">')
@@ -27,18 +28,27 @@ def main():
         if l.startswith("@node"):
             l = l.replace("@node", "", 1)
             l = l.strip()
-            l = l.lower()
             if first_node:
-                print ('<chapter id="%s_chapter" xmlns:xi="http://www.w3.org/2001/XInclude">' % l.replace(' ', '_'))
+                print ('<chapter id="%s_chapter" xmlns:xi="http://www.w3.org/2001/XInclude">' % l.lower().replace(' ', '_'))
                 first_node = False
+            else:
+                if prev_sect:
+                    print ('</section>')
+                print ('<section id="%s">' % l)
+                prev_sect = True
         elif l.startswith("@chapter "):
             l = l.replace("@chapter ", "", 1)
             print ('<title>%s</title>' % l)
+        elif l.startswith("@section "):
+            l = l.replace("@section ", "", 1)
+            print ('<title>%s</title>' % l)
         elif l.startswith("@include "):
             l = l.replace("@include ", "", 1)
             l = l.replace(".def", ".xml", 1)
             print ('<xi:include href="%s"/>' % l.strip())
 
+    if prev_sect:
+        print ('</section>')
     print ('</chapter>')
 
 if __name__ == "__main__" :
-- 
2.38.1


             reply	other threads:[~2022-10-28  8:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28  8:53 Jon Turney [this message]
2022-10-28  9:18 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221028085326.11792-1-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).