From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from scc-mailout-kit-02.scc.kit.edu (scc-mailout-kit-02.scc.kit.edu [129.13.231.82]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTP id b10ec291 for ; Thu, 25 Apr 2019 13:03:25 -0500 (EST) Received: from asta-nat.asta.uni-karlsruhe.de ([172.22.63.82] helo=hekate.usta.de) by scc-mailout-kit-02.scc.kit.edu with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (envelope-from ) id 1hJiiS-0004Sg-6x; Thu, 25 Apr 2019 20:03:25 +0200 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1hJiiR-00036g-Ji; Thu, 25 Apr 2019 20:03:23 +0200 Received: from athene.usta.de ([172.24.96.10]) by donnerwolke.usta.de with esmtp (Exim 4.84_2) (envelope-from ) id 1hJiiR-0004gB-E2; Thu, 25 Apr 2019 20:03:23 +0200 Received: from localhost (athene.usta.de [local]) by athene.usta.de (OpenSMTPD) with ESMTPA id 32a1b968; Thu, 25 Apr 2019 20:03:23 +0200 (CEST) Date: Thu, 25 Apr 2019 20:03:23 +0200 From: Ingo Schwarze To: Stephen Gregoratto Cc: discuss@mandoc.bsd.lv Subject: Re: Converting the Xenocara manpages Message-ID: <20190425180323.GA58311@athene.usta.de> References: <20190420124345.22eynr3sxzu4ybgd@BlackBox> <20190420144357.GC45166@athene.usta.de> X-Mailinglist: mandoc-discuss Reply-To: discuss@mandoc.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190420144357.GC45166@athene.usta.de> User-Agent: Mutt/1.8.0 (2017-02-23) Hi Stephen, Ingo Schwarze wrote on Sat, Apr 20, 2019 at 04:43:57PM +0200: > Stephen Gregoratto wrote on Sat, Apr 20, 2019 at 10:43:45PM +1000: >> One particularly bad case is lib/libXcomposite/man/Xcomposite.xml. >> It starts as a , a collection of 's. This is >> strange considering that it only has one: Xcomposite(3). docbook2mdoc >> renders this as one big, bold string. > Right, i should fix that. What happens here is that the document (= top > level) element is unknown, so it gets ignored, and the first > element within, , becomes the document element. Then the > <refentry> is *after* the document element, so it gets included *into* > the title because an XML file cannot have two top-level elements. > But an isolated <title> - i.e. one that isn't in a <section> or a > similar element - is converted to bold text, which isn't what we want > here. You can see the misparsing with > > $ docbook2mdoc -T tree /usr/xenocara/lib/libXcomposite/man/Xcomposite.xml \ > | head -n 3 > /usr/xenocara/lib/libXcomposite/man/Xcomposite.xml:4:1: \ > ERROR: unknown element <reference> > /usr/xenocara/lib/libXcomposite/man/Xcomposite.xml:74:4: \ > ERROR: unknown element <void> > > title > (t) X Composite Extension Library > refentry id='Xcomposite.man' The below commit is an easy fix for this issue. Given the rarity of <reference>, i refrained from writing a full-blown handler for it, at least for now. Yours, Ingo Log Message: ----------- Make <reference> an alias for <section>. This is not perfect because if <reference> starts with a <title>, that title is still printed before the NAME section. But at least the <refentry>s no longer get lumped *into* the <title>. Issue found by Stephen Gregoratto <dev at sgregoratto dot me> in Xcomposite(3). Modified Files: -------------- docbook2mdoc: parse.c statistics.c Revision Data ------------- Index: parse.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v retrieving revision 1.51 retrieving revision 1.52 diff -Lparse.c -Lparse.c -u -p -r1.51 -r1.52 --- parse.c +++ parse.c @@ -104,6 +104,7 @@ static const struct alias aliases[] = { { "phrase", NODE_IGNORE }, { "primary", NODE_DELETE }, { "property", NODE_PARAMETER }, + { "reference", NODE_SECTION }, { "refsect1", NODE_SECTION }, { "refsect2", NODE_SECTION }, { "refsect3", NODE_SECTION }, Index: statistics.c =================================================================== RCS file: /home/cvs/mdocml/docbook2mdoc/statistics.c,v retrieving revision 1.35 retrieving revision 1.36 diff -Lstatistics.c -Lstatistics.c -u -p -r1.35 -r1.36 --- statistics.c +++ statistics.c @@ -368,6 +368,7 @@ main(int argc, char *argv[]) table_add("ROOT", "part"); table_add("ROOT", "preface"); table_add("ROOT", "refentry"); + table_add("ROOT", "reference"); table_add("ROOT", "sect1"); table_add("ROOT", "sect2"); table_add("acronym", "TEXT"); @@ -527,6 +528,7 @@ main(int argc, char *argv[]) table_add("refentryinfo", "date"); table_add("refentryinfo", "productname"); table_add("refentrytitle", "TEXT"); + table_add("reference", "refentry"); table_add("refmeta", "manvolnum"); table_add("refmeta", "refentrytitle"); table_add("refmeta", "refmiscinfo"); -- To unsubscribe send an email to discuss+unsubscribe@mandoc.bsd.lv