mirror of
https://github.com/michaelrsweet/mxml.git
synced 2025-07-03 17:12:08 +00:00
Add --footer, rename --heading to --header.
Update man page for mxmldoc.
This commit is contained in:
parent
ee8df0fe52
commit
1fed22b03c
@ -325,7 +325,7 @@ testmxml.o: mxml.h
|
|||||||
|
|
||||||
mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c)
|
mxml.xml: mxmldoc-static mxml.h $(PUBLIBOBJS:.o=.c)
|
||||||
$(RM) mxml.xml
|
$(RM) mxml.xml
|
||||||
./mxmldoc-static --heading doc/reference.heading mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/reference.html
|
./mxmldoc-static --header doc/reference.heading mxml.xml mxml.h $(PUBLIBOBJS:.o=.c) >doc/reference.html
|
||||||
|
|
||||||
valgrind: mxmldoc-static
|
valgrind: mxmldoc-static
|
||||||
$(RM) valgrind.xml
|
$(RM) valgrind.xml
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
.\" GNU General Public License for more details.
|
.\" GNU General Public License for more details.
|
||||||
.\"
|
.\"
|
||||||
.TH mxmldoc 1 "Mini-XML" "12 January 2008" "Michael Sweet"
|
.TH mxmldoc 1 "Mini-XML" "26 January 2008" "Michael Sweet"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
mxmldoc \- mini-xml documentation generator
|
mxmldoc \- mini-xml documentation generator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -27,7 +27,11 @@ mxmldoc \- mini-xml documentation generator
|
|||||||
]
|
]
|
||||||
.br
|
.br
|
||||||
.B mxmldoc
|
.B mxmldoc
|
||||||
[ \-\-intro
|
[ \-\-footer
|
||||||
|
.I footerfile
|
||||||
|
] [ \-\-header
|
||||||
|
.I headerfile
|
||||||
|
] [ \-\-intro
|
||||||
.I introfile
|
.I introfile
|
||||||
] [ \-\-section
|
] [ \-\-section
|
||||||
.I section
|
.I section
|
||||||
@ -41,9 +45,32 @@ mxmldoc \- mini-xml documentation generator
|
|||||||
.I filename.html
|
.I filename.html
|
||||||
.br
|
.br
|
||||||
.B mxmldoc
|
.B mxmldoc
|
||||||
|
[ \-\-footer
|
||||||
|
.I footerfile
|
||||||
|
] [ \-\-framed
|
||||||
|
.I basename
|
||||||
|
] [ \-\-header
|
||||||
|
.I headerfile
|
||||||
|
] [ \-\-intro
|
||||||
|
.I introfile
|
||||||
|
] [ \-\-section
|
||||||
|
.I section
|
||||||
|
] [ \-\-title
|
||||||
|
.I title
|
||||||
|
] [
|
||||||
|
.I filename.xml
|
||||||
|
] [
|
||||||
|
.I source file(s)
|
||||||
|
]
|
||||||
|
.br
|
||||||
|
.B mxmldoc
|
||||||
\-\-man
|
\-\-man
|
||||||
.I manpage
|
.I manpage
|
||||||
[ \-\-intro
|
[ \-\-footer
|
||||||
|
.I footerfile
|
||||||
|
] [ \-\-header
|
||||||
|
.I headerfile
|
||||||
|
] [ \-\-intro
|
||||||
.I introfile
|
.I introfile
|
||||||
] [ \-\-section
|
] [ \-\-section
|
||||||
.I section
|
.I section
|
||||||
@ -74,10 +101,23 @@ documentation that is formatted according to the CUPS Developer
|
|||||||
Guide which is available at "http://www.cups.org/documentation.php".
|
Guide which is available at "http://www.cups.org/documentation.php".
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP 5
|
.TP 5
|
||||||
\-\-intro introfile
|
\-\-footer footerfile
|
||||||
|
.br
|
||||||
|
Inserts the specified file at the bottom of the output documentation.
|
||||||
|
.TP 5
|
||||||
|
\-\-framed basename
|
||||||
|
.br
|
||||||
|
Created HTML documentation using frames - one for the table-of-contents and
|
||||||
|
one for the body.
|
||||||
|
.TP 5
|
||||||
|
\-\-header headerfile
|
||||||
.br
|
.br
|
||||||
Inserts the specified file at the top of the output documentation.
|
Inserts the specified file at the top of the output documentation.
|
||||||
.TP 5
|
.TP 5
|
||||||
|
\-\-intro introfile
|
||||||
|
.br
|
||||||
|
Inserts the specified file before the table of contents.
|
||||||
|
.TP 5
|
||||||
\-\-man manpage
|
\-\-man manpage
|
||||||
.br
|
.br
|
||||||
Generated a man page instead of HTML documentation.
|
Generated a man page instead of HTML documentation.
|
||||||
|
100
mxmldoc.c
100
mxmldoc.c
@ -176,14 +176,16 @@ static void write_file(FILE *out, const char *file);
|
|||||||
static void write_function(FILE *out, mxml_node_t *doc,
|
static void write_function(FILE *out, mxml_node_t *doc,
|
||||||
mxml_node_t *function, int level);
|
mxml_node_t *function, int level);
|
||||||
static void write_html(const char *section, const char *title,
|
static void write_html(const char *section, const char *title,
|
||||||
const char *headingfile,
|
const char *footerfile,
|
||||||
|
const char *headerfile,
|
||||||
const char *introfile, const char *cssfile,
|
const char *introfile, const char *cssfile,
|
||||||
const char *framefile, mxml_node_t *doc);
|
const char *framefile, mxml_node_t *doc);
|
||||||
static void write_html_head(FILE *out, const char *section,
|
static void write_html_head(FILE *out, const char *section,
|
||||||
const char *title, const char *cssfile);
|
const char *title, const char *cssfile);
|
||||||
static void write_man(const char *man_name, const char *section,
|
static void write_man(const char *man_name, const char *section,
|
||||||
const char *title, const char *headingfile,
|
const char *title, const char *headerfile,
|
||||||
const char *introfile, mxml_node_t *doc);
|
const char *footerfile, const char *introfile,
|
||||||
|
mxml_node_t *doc);
|
||||||
static void write_scu(FILE *out, mxml_node_t *doc,
|
static void write_scu(FILE *out, mxml_node_t *doc,
|
||||||
mxml_node_t *scut);
|
mxml_node_t *scut);
|
||||||
static void write_string(FILE *out, const char *s, int mode);
|
static void write_string(FILE *out, const char *s, int mode);
|
||||||
@ -208,8 +210,9 @@ main(int argc, /* I - Number of command-line args */
|
|||||||
const char *section; /* Section/keywords of documentation */
|
const char *section; /* Section/keywords of documentation */
|
||||||
const char *title; /* Title of documentation */
|
const char *title; /* Title of documentation */
|
||||||
const char *cssfile; /* CSS stylesheet file */
|
const char *cssfile; /* CSS stylesheet file */
|
||||||
|
const char *footerfile; /* Footer file */
|
||||||
const char *framefile; /* Framed HTML basename */
|
const char *framefile; /* Framed HTML basename */
|
||||||
const char *headingfile; /* Heading file */
|
const char *headerfile; /* Header file */
|
||||||
const char *introfile; /* Introduction file */
|
const char *introfile; /* Introduction file */
|
||||||
const char *xmlfile; /* XML file */
|
const char *xmlfile; /* XML file */
|
||||||
const char *name; /* Name of manpage */
|
const char *name; /* Name of manpage */
|
||||||
@ -224,8 +227,9 @@ main(int argc, /* I - Number of command-line args */
|
|||||||
section = NULL;
|
section = NULL;
|
||||||
title = NULL;
|
title = NULL;
|
||||||
cssfile = NULL;
|
cssfile = NULL;
|
||||||
|
footerfile = NULL;
|
||||||
framefile = NULL;
|
framefile = NULL;
|
||||||
headingfile = NULL;
|
headerfile = NULL;
|
||||||
introfile = NULL;
|
introfile = NULL;
|
||||||
xmlfile = NULL;
|
xmlfile = NULL;
|
||||||
update = 0;
|
update = 0;
|
||||||
@ -254,6 +258,18 @@ main(int argc, /* I - Number of command-line args */
|
|||||||
else
|
else
|
||||||
usage(NULL);
|
usage(NULL);
|
||||||
}
|
}
|
||||||
|
else if (!strcmp(argv[i], "--footer") && !footerfile)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Set footer file...
|
||||||
|
*/
|
||||||
|
|
||||||
|
i ++;
|
||||||
|
if (i < argc)
|
||||||
|
footerfile = argv[i];
|
||||||
|
else
|
||||||
|
usage(NULL);
|
||||||
|
}
|
||||||
else if (!strcmp(argv[i], "--framed") && !framefile)
|
else if (!strcmp(argv[i], "--framed") && !framefile)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -266,15 +282,15 @@ main(int argc, /* I - Number of command-line args */
|
|||||||
else
|
else
|
||||||
usage(NULL);
|
usage(NULL);
|
||||||
}
|
}
|
||||||
else if (!strcmp(argv[i], "--heading") && !headingfile)
|
else if (!strcmp(argv[i], "--header") && !headerfile)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Set heading file...
|
* Set header file...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
i ++;
|
i ++;
|
||||||
if (i < argc)
|
if (i < argc)
|
||||||
headingfile = argv[i];
|
headerfile = argv[i];
|
||||||
else
|
else
|
||||||
usage(NULL);
|
usage(NULL);
|
||||||
}
|
}
|
||||||
@ -468,8 +484,8 @@ main(int argc, /* I - Number of command-line args */
|
|||||||
* Write HTML documentation...
|
* Write HTML documentation...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
write_html(section, title ? title : "Documentation", headingfile,
|
write_html(section, title ? title : "Documentation", footerfile,
|
||||||
introfile, cssfile, framefile, mxmldoc);
|
headerfile, introfile, cssfile, framefile, mxmldoc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OUTPUT_MAN :
|
case OUTPUT_MAN :
|
||||||
@ -477,7 +493,8 @@ main(int argc, /* I - Number of command-line args */
|
|||||||
* Write manpage documentation...
|
* Write manpage documentation...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
write_man(name, section, title, headingfile, introfile, mxmldoc);
|
write_man(name, section, title, footerfile, headerfile, introfile,
|
||||||
|
mxmldoc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2648,7 +2665,8 @@ write_function(FILE *out, /* I - Output file */
|
|||||||
static void
|
static void
|
||||||
write_html(const char *section, /* I - Section */
|
write_html(const char *section, /* I - Section */
|
||||||
const char *title, /* I - Title */
|
const char *title, /* I - Title */
|
||||||
const char *headingfile, /* I - Heading file */
|
const char *footerfile, /* I - Footer file */
|
||||||
|
const char *headerfile, /* I - Header file */
|
||||||
const char *introfile, /* I - Intro file */
|
const char *introfile, /* I - Intro file */
|
||||||
const char *cssfile, /* I - Stylesheet file */
|
const char *cssfile, /* I - Stylesheet file */
|
||||||
const char *framefile, /* I - Framed HTML basename */
|
const char *framefile, /* I - Framed HTML basename */
|
||||||
@ -2683,21 +2701,21 @@ write_html(const char *section, /* I - Section */
|
|||||||
write_html_head(out, section, title, cssfile);
|
write_html_head(out, section, title, cssfile);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Heading...
|
* Header...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (headingfile)
|
if (headerfile)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Use custom heading...
|
* Use custom header...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
write_file(out, headingfile);
|
write_file(out, headerfile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Use standard heading...
|
* Use standard header...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
fputs("<h1>", out);
|
fputs("<h1>", out);
|
||||||
@ -2970,9 +2988,18 @@ write_html(const char *section, /* I - Section */
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Standard footer...
|
* Footer...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (footerfile)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Use custom footer...
|
||||||
|
*/
|
||||||
|
|
||||||
|
write_file(out, footerfile);
|
||||||
|
}
|
||||||
|
|
||||||
fputs("</body>\n"
|
fputs("</body>\n"
|
||||||
"</html>\n", out);
|
"</html>\n", out);
|
||||||
}
|
}
|
||||||
@ -3132,13 +3159,13 @@ write_html_head(FILE *out, /* I - Output file */
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_man(
|
write_man(const char *man_name, /* I - Name of manpage */
|
||||||
const char *man_name, /* I - Name of manpage */
|
const char *section, /* I - Section */
|
||||||
const char *section, /* I - Section */
|
const char *title, /* I - Title */
|
||||||
const char *title, /* I - Title */
|
const char *footerfile, /* I - Footer file */
|
||||||
const char *headingfile, /* I - Heading file */
|
const char *headerfile, /* I - Header file */
|
||||||
const char *introfile, /* I - Intro file */
|
const char *introfile, /* I - Intro file */
|
||||||
mxml_node_t *doc) /* I - XML documentation */
|
mxml_node_t *doc) /* I - XML documentation */
|
||||||
{
|
{
|
||||||
int i; /* Looping var */
|
int i; /* Looping var */
|
||||||
mxml_node_t *function, /* Current function */
|
mxml_node_t *function, /* Current function */
|
||||||
@ -3164,7 +3191,7 @@ write_man(
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Standard header...
|
* Standard man page...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
curtime = time(NULL);
|
curtime = time(NULL);
|
||||||
@ -3174,18 +3201,22 @@ write_man(
|
|||||||
printf(".TH %s %s \"%s\" \"%s\" \"%s\"\n", man_name, section ? section : "3",
|
printf(".TH %s %s \"%s\" \"%s\" \"%s\"\n", man_name, section ? section : "3",
|
||||||
title ? title : "", buffer, title ? title : "");
|
title ? title : "", buffer, title ? title : "");
|
||||||
|
|
||||||
if (headingfile)
|
/*
|
||||||
|
* Header...
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (headerfile)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Use custom heading...
|
* Use custom header...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
write_file(stdout, headingfile);
|
write_file(stdout, headerfile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Use standard heading...
|
* Use standard header...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
puts(".SH NAME");
|
puts(".SH NAME");
|
||||||
@ -3621,6 +3652,15 @@ write_man(
|
|||||||
write_description(stdout, description, NULL, 1);
|
write_description(stdout, description, NULL, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (footerfile)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Use custom footer...
|
||||||
|
*/
|
||||||
|
|
||||||
|
write_file(stdout, footerfile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user