tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* [PATCH docbook2mdoc] Add NODE_SIMPARA
@ 2019-04-06  9:33 Stephen Gregoratto
  2019-04-06 13:51 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Gregoratto @ 2019-04-06  9:33 UTC (permalink / raw)
  To: tech

From the spec:

> A simpara is a "simple paragraph," one that may contain only
> character data and inline elements.

  <simpara>
  Just the text, ma'am.
  </simpara>

Since we don't care about validation, treat it the same as <para>.

Index: docbook2mdoc.c
===================================================================
RCS file: /cvs/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.91
diff -u -p -r1.91 docbook2mdoc.c
--- docbook2mdoc.c	3 Apr 2019 18:52:40 -0000	1.91
+++ docbook2mdoc.c	6 Apr 2019 09:24:49 -0000
@@ -764,6 +764,7 @@ pnode_print(struct format *p, struct pno
 		pnode_printlist(p, pn);
 		break;
 	case NODE_PARA:
+	case NODE_SIMPARA:
 		pnode_printpara(p, pn);
 		break;
 	case NODE_PARAMDEF:
Index: node.h
===================================================================
RCS file: /cvs/docbook2mdoc/node.h,v
retrieving revision 1.9
diff -u -p -r1.9 node.h
--- node.h	3 Apr 2019 17:53:02 -0000	1.9
+++ node.h	6 Apr 2019 09:24:49 -0000
@@ -121,6 +121,7 @@ enum	nodeid {
 	NODE_SCREEN,
 	NODE_SECTION,
 	NODE_SGMLTAG,
+	NODE_SIMPARA,
 	NODE_SIMPLELIST,
 	NODE_SPANSPEC,
 	NODE_SUBTITLE,
Index: parse.c
===================================================================
RCS file: /cvs/docbook2mdoc/parse.c,v
retrieving revision 1.14
diff -u -p -r1.14 parse.c
--- parse.c	5 Apr 2019 14:37:36 -0000	1.14
+++ parse.c	6 Apr 2019 09:24:49 -0000
@@ -170,6 +170,7 @@ static	const struct element elements[] =
 	{ "sect2",		NODE_SECTION },
 	{ "section",		NODE_SECTION },
 	{ "sgmltag",		NODE_SGMLTAG },
+	{ "simpara",		NODE_SIMPARA },
 	{ "simplelist",		NODE_SIMPLELIST },
 	{ "spanspec",		NODE_SPANSPEC },
 	{ "structfield",	NODE_PARAMETER },
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH docbook2mdoc] Add NODE_SIMPARA
  2019-04-06  9:33 [PATCH docbook2mdoc] Add NODE_SIMPARA Stephen Gregoratto
@ 2019-04-06 13:51 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2019-04-06 13:51 UTC (permalink / raw)
  To: Stephen Gregoratto; +Cc: tech

Hi Stephen,

Stephen Gregoratto wrote on Sat, Apr 06, 2019 at 08:33:40PM +1100:

> From the spec:

>> A simpara is a "simple paragraph," one that may contain only
>> character data and inline elements.

>   <simpara>
>   Just the text, ma'am.
>   </simpara>
> 
> Since we don't care about validation, treat it the same as <para>.

That argument makes sense.

I simplified your patch before commit, though; no separate enum
constant is needed in such a case.  Also, since <simpara> is fully
handled with your patch, exclude it from the statistics; see the
committed patch below.

Thanks,
  Ingo


Log Message:
-----------
treat <simpara> just like <para>; simplified version
of a patch from Stephen Gregoratto <dev at sgregoratto dot me>

Modified Files:
--------------
    docbook2mdoc:
        parse.c
        statistics.c

Revision Data
-------------
Index: parse.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -Lparse.c -Lparse.c -u -p -r1.14 -r1.15
--- parse.c
+++ parse.c
@@ -170,6 +170,7 @@ static	const struct element elements[] =
 	{ "sect2",		NODE_SECTION },
 	{ "section",		NODE_SECTION },
 	{ "sgmltag",		NODE_SGMLTAG },
+	{ "simpara",		NODE_PARA },
 	{ "simplelist",		NODE_SIMPLELIST },
 	{ "spanspec",		NODE_SPANSPEC },
 	{ "structfield",	NODE_PARAMETER },
Index: statistics.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/statistics.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -Lstatistics.c -Lstatistics.c -u -p -r1.13 -r1.14
--- statistics.c
+++ statistics.c
@@ -402,6 +402,7 @@ main(int argc, char *argv[])
 		table_add("sect3", NULL);
 		table_add("sect4", NULL);
 		table_add("sgmltag", "TEXT");
+		table_add("simpara", NULL);
 		table_add("simplelist", "member");
 		table_add("structfield", "TEXT");

--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-06 13:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-06  9:33 [PATCH docbook2mdoc] Add NODE_SIMPARA Stephen Gregoratto
2019-04-06 13:51 ` Ingo Schwarze

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 NNTP newsgroup(s).