Annotation of docbook2mdoc/README, Revision 1.2
1.2 ! schwarze 1: $Id: README,v 1.1 2014/04/02 10:06:14 kristaps Exp $
1.1 kristaps 2:
3: Here's a quick note on how to add new DocBook elements.
4:
1.2 ! schwarze 5: First, look up the element in the DocBook reference.
! 6: For element <foo>, this is usually:
1.1 kristaps 7:
1.2 ! schwarze 8: https://tdg.docbook.org/tdg/5.1/foo.html
! 9:
! 10: Some elements are no longer defined in DocBook 5.
! 11: For these, you will have to look at 4.5 documentation instead:
! 12:
! 13: https://tdg.docbook.org/tdg/4.5/foo.html
1.1 kristaps 14:
15: Add the alpha-ordered node (NODE_FOO) to extern.h.
16:
17: Next, add rules.c isparent() rule. This is the hard part. First,
18: create a top-level switch statement for NODE_FOO. Create a white-list
19: of switch cases beneath that corresponding to each "These elements
20: contain foo":
21:
22: switch (parent) {
23: case (NODE_BAR):
24: case (NODE_BAZ):
25: return(1);
26: default:
27: break;
28: }
29: return(0);
30:
31: Next, go through the "The following elements occur in foo" and add a
32: "case (NODE_FOO)" to each of those elements' switches.
33:
34: Now the hard work is finished!
35:
36: Next, add the name and whether it admits text to docbook2mdoc.c's
37: "nodes" structure array.
38:
1.2 ! schwarze 39: Finally, modify pnode_print() with your new entry. Use similar nodes as
1.1 kristaps 40: a reference. (NOTE: if it's an inline like, say, NODE_EMPHASIS, then
41: remember to add the node to the postfix switch statement!)
CVSweb