* mdocml: Add support for .AT.
@ 2010-05-17 10:50 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-05-17 10:50 UTC (permalink / raw)
To: source
Log Message:
-----------
Add support for .AT. Properly implement .UC. Add regress tests.
Modified Files:
--------------
mdocml:
man.c
man.h
man_action.c
man_html.c
man_macro.c
man_term.c
man_validate.c
Added Files:
-----------
mdocml/regress/man/AT:
AT-3.in
AT-4.in
AT-5-2.in
AT-5.in
AT-crap.in
AT.in
mdocml/regress/man/UC:
UC-3.in
UC-4.in
UC-5.in
UC-6.in
UC-7.in
UC-crap.in
UC.in
Revision Data
-------------
Index: man_term.c
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/man_term.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -Lman_term.c -Lman_term.c -u -p -r1.69 -r1.70
--- man_term.c
+++ man_term.c
@@ -142,6 +142,7 @@ static const struct termact termacts[MAN
{ pre_sp, NULL, MAN_NOTEXT }, /* Sp */
{ pre_nf, NULL, 0 }, /* Vb */
{ pre_fi, NULL, 0 }, /* Ve */
+ { pre_ign, NULL, 0 }, /* AT */
};
Index: man_html.c
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/man_html.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -Lman_html.c -Lman_html.c -u -p -r1.33 -r1.34
--- man_html.c
+++ man_html.c
@@ -106,6 +106,7 @@ static const struct htmlman mans[MAN_MAX
{ man_br_pre, NULL }, /* Sp */
{ man_ign_pre, NULL }, /* Vb */
{ NULL, NULL }, /* Ve */
+ { man_ign_pre, NULL }, /* AT */
};
Index: man.h
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/man.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -Lman.h -Lman.h -u -p -r1.33 -r1.34
--- man.h
+++ man.h
@@ -55,6 +55,7 @@ enum mant {
MAN_Sp,
MAN_Vb,
MAN_Ve,
+ MAN_AT,
MAN_MAX
};
Index: man_action.c
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/man_action.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -Lman_action.c -Lman_action.c -u -p -r1.34 -r1.35
--- man_action.c
+++ man_action.c
@@ -32,6 +32,8 @@ struct actions {
static int post_TH(struct man *);
static int post_fi(struct man *);
static int post_nf(struct man *);
+static int post_AT(struct man *);
+static int post_UC(struct man *);
const struct actions man_actions[MAN_MAX] = {
{ NULL }, /* br */
@@ -64,11 +66,12 @@ const struct actions man_actions[MAN_MAX
{ NULL }, /* RE */
{ NULL }, /* RS */
{ NULL }, /* DT */
- { NULL }, /* UC */
+ { post_UC }, /* UC */
{ NULL }, /* PD */
{ NULL }, /* Sp */
{ post_nf }, /* Vb */
{ post_fi }, /* Ve */
+ { post_AT }, /* AT */
};
@@ -178,5 +181,84 @@ post_TH(struct man *m)
* meta-data.
*/
man_node_delete(m, m->last);
+ return(1);
+}
+
+
+static int
+post_AT(struct man *m)
+{
+ static const char * const unix_versions[] = {
+ "7th Edition",
+ "System III",
+ "System V",
+ "System V Release 2",
+ };
+
+ const char *p, *s;
+ struct man_node *n, *nn;
+
+ n = m->last->child;
+
+ if (NULL == n || MAN_TEXT != n->type)
+ p = unix_versions[0];
+ else {
+ s = n->string;
+ if (0 == strcmp(s, "3"))
+ p = unix_versions[0];
+ else if (0 == strcmp(s, "4"))
+ p = unix_versions[1];
+ else if (0 == strcmp(s, "5")) {
+ nn = n->next;
+ if (nn && MAN_TEXT == nn->type && nn->string[0])
+ p = unix_versions[3];
+ else
+ p = unix_versions[2];
+ } else
+ p = unix_versions[0];
+ }
+
+ m->meta.source = mandoc_strdup(p);
+
+ return(1);
+}
+
+
+static int
+post_UC(struct man *m)
+{
+ static const char * const bsd_versions[] = {
+ "3rd Berkeley Distribution",
+ "4th Berkeley Distribution",
+ "4.2 Berkeley Distribution",
+ "4.3 Berkeley Distribution",
+ "4.4 Berkeley Distribution",
+ };
+
+ const char *p, *s;
+ struct man_node *n;
+
+ n = m->last->child;
+
+ if (NULL == n || MAN_TEXT != n->type)
+ p = bsd_versions[0];
+ else {
+ s = n->string;
+ if (0 == strcmp(s, "3"))
+ p = bsd_versions[0];
+ else if (0 == strcmp(s, "4"))
+ p = bsd_versions[1];
+ else if (0 == strcmp(s, "5"))
+ p = bsd_versions[2];
+ else if (0 == strcmp(s, "6"))
+ p = bsd_versions[3];
+ else if (0 == strcmp(s, "7"))
+ p = bsd_versions[4];
+ else
+ p = bsd_versions[0];
+ }
+
+ m->meta.source = mandoc_strdup(p);
+
return(1);
}
Index: man.c
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/man.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -Lman.c -Lman.c -u -p -r1.72 -r1.73
--- man.c
+++ man.c
@@ -62,7 +62,7 @@ const char *const __man_macronames[MAN_M
"RI", "na", "i", "sp",
"nf", "fi", "r", "RE",
"RS", "DT", "UC", "PD",
- "Sp", "Vb", "Ve",
+ "Sp", "Vb", "Ve", "AT",
};
const char * const *man_macronames = __man_macronames;
Index: man_validate.c
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/man_validate.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -Lman_validate.c -Lman_validate.c -u -p -r1.39 -r1.40
--- man_validate.c
+++ man_validate.c
@@ -95,6 +95,7 @@ static const struct man_valid man_valids
{ NULL, posts_le1 }, /* Sp */
{ pres_bline, posts_le1 }, /* Vb */
{ pres_bline, posts_eq0 }, /* Ve */
+ { NULL, NULL }, /* AT */
};
Index: man_macro.c
===================================================================
RCS file: /home/joerg/cvsroot/mdocml/man_macro.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -Lman_macro.c -Lman_macro.c -u -p -r1.44 -r1.45
--- man_macro.c
+++ man_macro.c
@@ -81,6 +81,7 @@ const struct man_macro __man_macros[MAN_
{ in_line_eoln, MAN_NSCOPED }, /* Sp */
{ in_line_eoln, 0 }, /* Vb */
{ in_line_eoln, 0 }, /* Ve */
+ { in_line_eoln, 0 }, /* AT */
};
const struct man_macro * const man_macros = __man_macros;
--- /dev/null
+++ regress/man/AT/AT.in
@@ -0,0 +1,5 @@
+.TH AT 1 "2010-05-17" "MANDOC"
+.AT
+.SH DESCRIPTION
+.SS Test case for AT
+foo
--- /dev/null
+++ regress/man/AT/AT-5-2.in
@@ -0,0 +1,7 @@
+.TH AT-5-2 1 "2010-05-17" "MANDOC"
+.SH TEST FOR VSPACE
+.AT 5 2
+.SH DESCRIPTION
+.SS foo
+.SS Test case for AT
+foo
--- /dev/null
+++ regress/man/AT/AT-4.in
@@ -0,0 +1,5 @@
+.TH AT-4 1 "2010-05-17" "MANDOC"
+.AT 4
+.SH DESCRIPTION
+.SS Test case for AT
+foo
--- /dev/null
+++ regress/man/AT/AT-3.in
@@ -0,0 +1,5 @@
+.TH AT-3 1 "2010-05-17" "MANDOC"
+.AT 3
+.SH DESCRIPTION
+.SS Test case for AT
+foo
--- /dev/null
+++ regress/man/AT/AT-crap.in
@@ -0,0 +1,5 @@
+.TH AT-CRAP 1 "2010-05-17" "MANDOC"
+.AT crap
+.SH DESCRIPTION
+.SS Test case for AT
+foo
--- /dev/null
+++ regress/man/AT/AT-5.in
@@ -0,0 +1,5 @@
+.TH AT-5 1 "2010-05-17" "MANDOC"
+.AT 5
+.SH DESCRIPTION
+.SS Test case for AT
+foo
--- /dev/null
+++ regress/man/UC/UC-6.in
@@ -0,0 +1,5 @@
+.TH UC-6 1 "2010-05-17" "MANDOC"
+.UC 6
+.SH DESCRIPTION
+.SS Test case for UC
+foo
--- /dev/null
+++ regress/man/UC/UC-crap.in
@@ -0,0 +1,5 @@
+.TH UC-CRAP 1 "2010-05-17" "MANDOC"
+.UC crap
+.SH DESCRIPTION
+.SS Test case for UC
+foo
--- /dev/null
+++ regress/man/UC/UC-4.in
@@ -0,0 +1,5 @@
+.TH UC-4 1 "2010-05-17" "MANDOC"
+.UC 4
+.SH DESCRIPTION
+.SS Test case for UC
+foo
--- /dev/null
+++ regress/man/UC/UC-3.in
@@ -0,0 +1,5 @@
+.TH UC-3 1 "2010-05-17" "MANDOC"
+.UC 3
+.SH DESCRIPTION
+.SS Test case for UC
+foo
--- /dev/null
+++ regress/man/UC/UC-5.in
@@ -0,0 +1,5 @@
+.TH UC-5 1 "2010-05-17" "MANDOC"
+.UC 5
+.SH DESCRIPTION
+.SS Test case for UC
+foo
--- /dev/null
+++ regress/man/UC/UC.in
@@ -0,0 +1,5 @@
+.TH UC 1 "2010-05-17" "MANDOC"
+.UC
+.SH DESCRIPTION
+.SS Test case for UC
+foo
--- /dev/null
+++ regress/man/UC/UC-7.in
@@ -0,0 +1,5 @@
+.TH UC-7 1 "2010-05-17" "MANDOC"
+.UC 7
+.SH DESCRIPTION
+.SS Test case for UC
+foo
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-05-17 10:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-17 10:50 mdocml: Add support for .AT kristaps
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).