From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: Rudimentary implementation of <imagedata> by printing the
Date: Sun, 14 Apr 2019 17:38:26 -0500 (EST) [thread overview]
Message-ID: <e3fdd65dea2d2208@fantadrom.bsd.lv> (raw)
Log Message:
-----------
Rudimentary implementation of <imagedata> by printing the filename.
Ignore the wrappers <caption>, <figure>, <imageobject>, <mediaobject>.
Modified Files:
--------------
docbook2mdoc:
docbook2mdoc.c
node.c
node.h
parse.c
statistics.c
Revision Data
-------------
Index: node.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -Lnode.c -Lnode.c -u -p -r1.17 -r1.18
--- node.c
+++ node.c
@@ -66,6 +66,7 @@ static const struct nodeprop properties[
{ "function", CLASS_LINE },
{ "glossterm", CLASS_LINE },
{ "group", CLASS_ENCL },
+ { "imagedata", CLASS_TEXT },
{ "xi:include", CLASS_VOID },
{ "index", CLASS_TRANS },
{ "info", CLASS_TRANS },
@@ -154,6 +155,8 @@ static const char *const attrkeys[ATTRKE
"cols",
"DEFINITION",
"endterm",
+ "entityref",
+ "fileref",
"href",
"id",
"linkend",
Index: node.h
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/node.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lnode.h -Lnode.h -u -p -r1.26 -r1.27
--- node.h
+++ node.h
@@ -74,6 +74,7 @@ enum nodeid {
NODE_FUNCTION,
NODE_GLOSSTERM,
NODE_GROUP,
+ NODE_IMAGEDATA,
NODE_INCLUDE,
NODE_INDEX,
NODE_INFO,
@@ -170,6 +171,8 @@ enum attrkey {
ATTRKEY_COLS,
ATTRKEY_DEFINITION,
ATTRKEY_ENDTERM,
+ ATTRKEY_ENTITYREF,
+ ATTRKEY_FILEREF,
ATTRKEY_HREF,
ATTRKEY_ID,
ATTRKEY_LINKEND,
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.125 -r1.126
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -126,6 +126,21 @@ pnode_printtext(struct format *f, struct
}
static void
+pnode_printimagedata(struct format *f, struct pnode *n)
+{
+ const char *cp;
+
+ if ((cp = pnode_getattr_raw(n, ATTRKEY_FILEREF, NULL)) == NULL)
+ cp = pnode_getattr_raw(n, ATTRKEY_ENTITYREF, NULL);
+ if (cp != NULL) {
+ print_text(f, "[image:", ARG_SPACE);
+ print_text(f, cp, ARG_SPACE);
+ print_text(f, "]", 0);
+ } else
+ print_text(f, "[image]", ARG_SPACE);
+}
+
+static void
pnode_printpara(struct format *f, struct pnode *n)
{
struct pnode *np;
@@ -1108,6 +1123,9 @@ pnode_print(struct format *f, struct pno
break;
case NODE_FUNCSYNOPSISINFO:
macro_open(f, "Fd");
+ break;
+ case NODE_IMAGEDATA:
+ pnode_printimagedata(f, n);
break;
case NODE_INFORMALEQUATION:
macro_line(f, "Bd -ragged -offset indent");
Index: statistics.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/statistics.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -Lstatistics.c -Lstatistics.c -u -p -r1.31 -r1.32
--- statistics.c
+++ statistics.c
@@ -399,6 +399,7 @@ main(int argc, char *argv[])
table_add("bookinfo", "releaseinfo");
table_add("bookinfo", "subtitle");
table_add("bookinfo", "title");
+ table_add("caption", "TEXT");
table_add("chapter", NULL);
table_add("citerefentry", "manvolnum");
table_add("citerefentry", "refentrytitle");
@@ -423,6 +424,7 @@ main(int argc, char *argv[])
table_add("emphasis", "TEXT");
table_add("entry", NULL);
table_add("errorname", "TEXT");
+ table_add("figure", "mediaobject");
table_add("filename", "TEXT");
table_add("firstname", "TEXT");
table_add("firstterm", "TEXT");
@@ -447,6 +449,7 @@ main(int argc, char *argv[])
table_add("glossterm", "TEXT");
table_add("group", "arg");
table_add("holder", "TEXT");
+ table_add("imageobject", "imagedata");
table_add("indexterm", "primary");
table_add("indexterm", "secondary");
table_add("informaltable", "tgroup");
@@ -461,6 +464,8 @@ main(int argc, char *argv[])
table_add("literallayout", NULL);
table_add("manvolnum", "TEXT");
table_add("markup", "TEXT");
+ table_add("mediaobject", "caption");
+ table_add("mediaobject", "imageobject");
table_add("member", "constant");
table_add("member", "emphasis");
table_add("member", "function");
Index: parse.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/parse.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -Lparse.c -Lparse.c -u -p -r1.43 -r1.44
--- parse.c
+++ parse.c
@@ -77,9 +77,11 @@ static const struct alias aliases[] = {
{ "articleinfo", NODE_BOOKINFO },
{ "book", NODE_SECTION },
{ "chapter", NODE_SECTION },
+ { "caption", NODE_IGNORE },
{ "code", NODE_LITERAL },
{ "computeroutput", NODE_LITERAL },
{ "!doctype", NODE_DOCTYPE },
+ { "figure", NODE_IGNORE },
{ "firstname", NODE_PERSONNAME },
{ "glossary", NODE_VARIABLELIST },
{ "glossdef", NODE_IGNORE },
@@ -87,10 +89,12 @@ static const struct alias aliases[] = {
{ "glossentry", NODE_VARLISTENTRY },
{ "glosslist", NODE_VARIABLELIST },
{ "holder", NODE_IGNORE },
+ { "imageobject", NODE_IGNORE },
{ "indexterm", NODE_DELETE },
{ "informaltable", NODE_TABLE },
{ "keycap", NODE_KEYSYM },
{ "keycode", NODE_IGNORE },
+ { "mediaobject", NODE_BLOCKQUOTE },
{ "orgname", NODE_IGNORE },
{ "othercredit", NODE_AUTHOR },
{ "othername", NODE_PERSONNAME },
--
To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv
reply other threads:[~2019-04-14 22:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=e3fdd65dea2d2208@fantadrom.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.bsd.lv \
/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 NNTP newsgroup(s).