summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-09-24 23:54:43 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-09-24 23:54:43 +0000
commit916a2db50757b20a937523dec30a3d21e0dbf32f (patch)
tree95a620a278992a1211051fa4b759a2897f51dbcc
parentebd4be96b56a3d4e04046b081170572db14b80a8 (diff)
downloadmandoc-916a2db50757b20a937523dec30a3d21e0dbf32f.tar.gz
-Tascii correctly prints `%T' in `Rs' with quotes.
-Thtml behaves like -Tascii for printing. Printing of `Rs' elements cross-checked with new groff.
-rw-r--r--example.style.css13
-rw-r--r--mdoc_html.c106
-rw-r--r--mdoc_term.c25
3 files changed, 128 insertions, 16 deletions
diff --git a/example.style.css b/example.style.css
index ad54850b..1867d4fe 100644
--- a/example.style.css
+++ b/example.style.css
@@ -34,6 +34,19 @@ span.macro { font-weight: bold; } /* Macro-ish thing (Fd). */
span.name { font-weight: bold; } /* Name of utility (Nm). */
span.opt { } /* Options (Op, Oo/Oc). */
span.ref { } /* Citations (Rs). */
+span.ref-auth { } /* Reference author (%A). */
+span.ref-book { font-style: italic; } /* Reference book (%B). */
+span.ref-city { } /* Reference city (%C). */
+span.ref-date { } /* Reference date (%D). */
+span.ref-issue { font-style: italic; } /* Reference issuer/publisher (%I). */
+span.ref-jrnl { font-style: italic; } /* Reference journal (%J). */
+span.ref-num { } /* Reference number (%N). */
+span.ref-opt { } /* Reference optionals (%O). */
+span.ref-page { } /* Reference page (%P). */
+span.ref-corp { } /* Reference corporate/foreign author (%Q). */
+span.ref-rep { } /* Reference report (%R). */
+span.ref-title { } /* Reference title (%T). */
+span.ref-vol { } /* Reference volume (%V). */
span.symb { font-weight: bold; } /* Symbols. */
span.type { font-style: italic; } /* Variable types (Vt). */
span.unix { } /* Unices (Ux, Ox, Nx, Fx, Bx, Bsx, Dx). */
diff --git a/mdoc_html.c b/mdoc_html.c
index 9e1e89c6..12ba8adf 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -60,6 +60,8 @@ static int mdoc_tbl_block_pre(MDOC_ARGS, int, int, int, int);
static int mdoc_tbl_body_pre(MDOC_ARGS, int, int);
static int mdoc_tbl_head_pre(MDOC_ARGS, int, int);
+static void mdoc__x_post(MDOC_ARGS);
+static int mdoc__x_pre(MDOC_ARGS);
static int mdoc_ad_pre(MDOC_ARGS);
static int mdoc_an_pre(MDOC_ARGS);
static int mdoc_ap_pre(MDOC_ARGS);
@@ -172,17 +174,17 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_va_pre, NULL}, /* Va */
{mdoc_vt_pre, NULL}, /* Vt */
{mdoc_xr_pre, NULL}, /* Xr */
- {NULL, NULL}, /* %A */
- {NULL, NULL}, /* %B */
- {NULL, NULL}, /* %D */
- {NULL, NULL}, /* %I */
- {NULL, NULL}, /* %J */
- {NULL, NULL}, /* %N */
- {NULL, NULL}, /* %O */
- {NULL, NULL}, /* %P */
- {NULL, NULL}, /* %R */
- {NULL, NULL}, /* %T */
- {NULL, NULL}, /* %V */
+ {mdoc__x_pre, mdoc__x_post}, /* %A */
+ {mdoc__x_pre, mdoc__x_post}, /* %B */
+ {mdoc__x_pre, mdoc__x_post}, /* %D */
+ {mdoc__x_pre, mdoc__x_post}, /* %I */
+ {mdoc__x_pre, mdoc__x_post}, /* %J */
+ {mdoc__x_pre, mdoc__x_post}, /* %N */
+ {mdoc__x_pre, mdoc__x_post}, /* %O */
+ {mdoc__x_pre, mdoc__x_post}, /* %P */
+ {mdoc__x_pre, mdoc__x_post}, /* %R */
+ {mdoc__x_pre, mdoc__x_post}, /* %T */
+ {mdoc__x_pre, mdoc__x_post}, /* %V */
{NULL, NULL}, /* Ac */
{mdoc_aq_pre, mdoc_aq_post}, /* Ao */
{mdoc_aq_pre, mdoc_aq_post}, /* Aq */
@@ -244,11 +246,11 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{mdoc_brq_pre, mdoc_brq_post}, /* Brq */
{mdoc_brq_pre, mdoc_brq_post}, /* Bro */
{NULL, NULL}, /* Brc */
- {NULL, NULL}, /* %C */
+ {mdoc__x_pre, mdoc__x_post}, /* %C */
{NULL, NULL}, /* Es */ /* TODO */
{NULL, NULL}, /* En */ /* TODO */
{mdoc_xx_pre, NULL}, /* Dx */
- {NULL, NULL}, /* %Q */
+ {mdoc__x_pre, mdoc__x_post}, /* %Q */
{mdoc_sp_pre, NULL}, /* br */
{mdoc_sp_pre, NULL}, /* sp */
};
@@ -2097,3 +2099,81 @@ mdoc_lb_pre(MDOC_ARGS)
print_otag(h, TAG_SPAN, 1, &tag);
return(1);
}
+
+
+/* ARGSUSED */
+static int
+mdoc__x_pre(MDOC_ARGS)
+{
+ struct htmlpair tag;
+
+ tag.key = ATTR_CLASS;
+
+ switch (n->tok) {
+ case(MDOC__A):
+ tag.val = "ref-auth";
+ break;
+ case(MDOC__B):
+ tag.val = "ref-book";
+ break;
+ case(MDOC__C):
+ tag.val = "ref-city";
+ break;
+ case(MDOC__D):
+ tag.val = "ref-date";
+ break;
+ case(MDOC__I):
+ tag.val = "ref-issue";
+ break;
+ case(MDOC__J):
+ tag.val = "ref-jrnl";
+ break;
+ case(MDOC__N):
+ tag.val = "ref-num";
+ break;
+ case(MDOC__O):
+ tag.val = "ref-opt";
+ break;
+ case(MDOC__P):
+ tag.val = "ref-page";
+ break;
+ case(MDOC__Q):
+ tag.val = "ref-corp";
+ break;
+ case(MDOC__R):
+ tag.val = "ref-rep";
+ break;
+ case(MDOC__T):
+ print_text(h, "\\(lq");
+ h->flags |= HTML_NOSPACE;
+ tag.val = "ref-title";
+ break;
+ case(MDOC__V):
+ tag.val = "ref-vol";
+ break;
+ default:
+ abort();
+ /* NOTREACHED */
+ }
+
+ print_otag(h, TAG_SPAN, 1, &tag);
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+mdoc__x_post(MDOC_ARGS)
+{
+
+ h->flags |= HTML_NOSPACE;
+ switch (n->tok) {
+ case (MDOC__T):
+ print_text(h, "\\(rq");
+ h->flags |= HTML_NOSPACE;
+ break;
+ default:
+ break;
+ }
+ print_text(h, n->next ? "," : ".");
+}
diff --git a/mdoc_term.c b/mdoc_term.c
index f5db6681..01ee3ab0 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -106,6 +106,7 @@ static void termp_sq_post(DECL_ARGS);
static void termp_ss_post(DECL_ARGS);
static void termp_vt_post(DECL_ARGS);
+static int termp__t_pre(DECL_ARGS);
static int termp_an_pre(DECL_ARGS);
static int termp_ap_pre(DECL_ARGS);
static int termp_aq_pre(DECL_ARGS);
@@ -189,15 +190,15 @@ static const struct termact termacts[MDOC_MAX] = {
{ termp_under_pre, termp_vt_post }, /* Vt */
{ termp_xr_pre, NULL }, /* Xr */
{ NULL, termp____post }, /* %A */
- { NULL, termp____post }, /* %B */
+ { termp_under_pre, termp____post }, /* %B */
{ NULL, termp____post }, /* %D */
- { NULL, termp____post }, /* %I */
+ { termp_under_pre, termp____post }, /* %I */
{ termp_under_pre, termp____post }, /* %J */
{ NULL, termp____post }, /* %N */
{ NULL, termp____post }, /* %O */
{ NULL, termp____post }, /* %P */
{ NULL, termp____post }, /* %R */
- { termp_under_pre, termp____post }, /* %T */
+ { termp__t_pre, termp____post }, /* %T */
{ NULL, termp____post }, /* %V */
{ NULL, NULL }, /* Ac */
{ termp_aq_pre, termp_aq_post }, /* Ao */
@@ -2065,6 +2066,14 @@ termp____post(DECL_ARGS)
{
p->flags |= TERMP_NOSPACE;
+ switch (node->tok) {
+ case (MDOC__T):
+ term_word(p, "\\(rq");
+ p->flags |= TERMP_NOSPACE;
+ break;
+ default:
+ break;
+ }
term_word(p, node->next ? "," : ".");
}
@@ -2107,3 +2116,13 @@ termp_under_pre(DECL_ARGS)
return(1);
}
+
+/* ARGSUSED */
+static int
+termp__t_pre(DECL_ARGS)
+{
+
+ term_word(p, "\\(lq");
+ p->flags |= TERMP_NOSPACE;
+ return(1);
+}