summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-09-21 23:12:08 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-09-21 23:12:08 +0000
commite91c8c858c8cdd999f3dda62d2c69dda0e5e1da1 (patch)
treec57f5709486ea1d4ef75ffeb5691b49e197f6a11
parente6ae656c7d56728d036a3015d4b74e792338231c (diff)
downloadmandoc-e91c8c858c8cdd999f3dda62d2c69dda0e5e1da1.tar.gz
A few more macros in -Thtml.
-rw-r--r--chars.in4
-rw-r--r--example.style.css6
-rw-r--r--mdoc_html.c105
-rw-r--r--style.css4
4 files changed, 103 insertions, 16 deletions
diff --git a/chars.in b/chars.in
index 9003aeaa..9f7e93ee 100644
--- a/chars.in
+++ b/chars.in
@@ -256,7 +256,7 @@ CHAR("hy", 2, "-", 1, "", 0)
CHAR("if", 2, "oo", 2, "", 0)
CHAR("lA", 2, "<=", 2, "", 0)
CHAR("lB", 2, "[", 1, "[", 1)
-CHAR("lC", 2, "{", 1, "", 0)
+CHAR("lC", 2, "{", 1, "{", 1)
CHAR("la", 2, "<", 1, "&lt;", 4)
CHAR("lh", 2, "<=", 2, "", 0)
CHAR("mo", 2, "E", 1, "", 0)
@@ -275,7 +275,7 @@ CHAR("r!", 2, "i", 1, "", 0)
CHAR("r?", 2, "c", 1, "", 0)
CHAR("rA", 2, "=>", 2, "", 0)
CHAR("rB", 2, "]", 1, "]", 1)
-CHAR("rC", 2, "}", 1, "", 0)
+CHAR("rC", 2, "}", 1, "}", 1)
CHAR("ra", 2, ">", 1, "&gt;", 4)
CHAR("rg", 2, "(R)", 3, "", 0)
CHAR("rh", 2, "=>", 2, "", 0)
diff --git a/example.style.css b/example.style.css
index ceb5cc74..df2a675e 100644
--- a/example.style.css
+++ b/example.style.css
@@ -20,18 +20,20 @@ span.diag { font-weight: bold; } /* Diagnostic (Bl -diag). */
span.emph { font-style: italic; } /* Emphasis (Em). */
span.env { } /* Environment variables (Ev). */
span.errno { } /* Error string (Er). */
-span.farg { font-style: underline; } /* Function argument (Fa, Fn). */
+span.farg { text-decoration: underline; } /* Function argument (Fa, Fn). */
span.file { font-style: italic; } /* File (Pa). */
span.flag { font-weight: bold; } /* Flag (Fl, Cm). */
span.macro { } /* Macro-ish thing (Fd). */
span.name { font-weight: bold; } /* Name of utility (Nm). */
span.opt { } /* Options (Op, Oo/Oc). */
-span.type { font-weight: italic; } /* Variable types (Vt, Ft, Fn). */
+span.type { font-style: italic; } /* Variable types (Vt, Ft, Fn). */
span.unix { } /* Unices (Ux, Ox, Nx, Fx, Bx, Bsx, Dx). */
span.utility { font-weight: bold; } /* Name of utility (Ex). */
a.link-man { } /* Manual links (Xr). */
a.link-sec { } /* Section links (Sx). */
+a.link-mail { } /* Mailto links (Mt). */
+a.link-ext { } /* Off-site link (Lk). */
div.lit-block { font-family: monospace; } /* Literal block (D1, Bd -literal, Dl). */
diff --git a/mdoc_html.c b/mdoc_html.c
index 404f1415..a0520b91 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -67,6 +67,8 @@ static int mdoc_ar_pre(MDOC_ARGS);
static int mdoc_bd_pre(MDOC_ARGS);
static void mdoc_bl_post(MDOC_ARGS);
static int mdoc_bl_pre(MDOC_ARGS);
+static void mdoc_brq_post(MDOC_ARGS);
+static int mdoc_brq_pre(MDOC_ARGS);
static int mdoc_cd_pre(MDOC_ARGS);
static int mdoc_d1_pre(MDOC_ARGS);
static void mdoc_dq_post(MDOC_ARGS);
@@ -82,6 +84,8 @@ static int mdoc_er_pre(MDOC_ARGS);
static int mdoc_ev_pre(MDOC_ARGS);
static int mdoc_ex_pre(MDOC_ARGS);
static int mdoc_it_pre(MDOC_ARGS);
+static int mdoc_lk_pre(MDOC_ARGS);
+static int mdoc_mt_pre(MDOC_ARGS);
static int mdoc_nd_pre(MDOC_ARGS);
static int mdoc_nm_pre(MDOC_ARGS);
static int mdoc_ns_pre(MDOC_ARGS);
@@ -216,14 +220,14 @@ static const struct htmlmdoc mdocs[MDOC_MAX] = {
{NULL, NULL}, /* Ud */
{NULL, NULL}, /* Lb */
{mdoc_sp_pre, NULL}, /* Lp */
- {NULL, NULL}, /* Lk */
- {NULL, NULL}, /* Mt */
- {NULL, NULL}, /* Brq */
- {NULL, NULL}, /* Bro */
+ {mdoc_lk_pre, NULL}, /* Lk */
+ {mdoc_mt_pre, NULL}, /* Mt */
+ {mdoc_brq_pre, mdoc_brq_post}, /* Brq */
+ {mdoc_brq_pre, mdoc_brq_post}, /* Bro */
{NULL, NULL}, /* Brc */
{NULL, NULL}, /* %C */
- {NULL, NULL}, /* Es */
- {NULL, NULL}, /* En */
+ {NULL, NULL}, /* Es */ /* TODO */
+ {NULL, NULL}, /* En */ /* TODO */
{mdoc_xx_pre, NULL}, /* Dx */
{NULL, NULL}, /* %Q */
{mdoc_sp_pre, NULL}, /* br */
@@ -502,19 +506,19 @@ mdoc_root_pre(MDOC_ARGS)
tag[0].key = ATTR_STYLE;
tag[0].val = "width: 33%;";
print_otag(h, TAG_TD, 1, tag);
- print_text(h, b);
+ print_text(h, title);
print_stagq(h, tt);
tag[0].key = ATTR_STYLE;
tag[0].val = "width: 33%; text-align: center;";
print_otag(h, TAG_TD, 1, tag);
- print_text(h, title);
+ print_text(h, b);
print_stagq(h, tt);
tag[0].key = ATTR_STYLE;
tag[0].val = "width: 33%; text-align: right;";
print_otag(h, TAG_TD, 1, tag);
- print_text(h, b);
+ print_text(h, title);
print_tagq(h, t);
return(1);
@@ -890,7 +894,8 @@ mdoc_tbl_head_pre(MDOC_ARGS, int t, int w)
default:
buffmt("margin-left: -%dem;", w);
bufcat("clear: left;");
- bufcat("float: left;");
+ if (n->next && n->next->child)
+ bufcat("float: left;");
bufcat("padding-right: 1em;");
tag.key = ATTR_STYLE;
tag.val = buf;
@@ -1521,6 +1526,7 @@ mdoc_vt_pre(MDOC_ARGS)
return(1);
}
+
/* ARGSUSED */
static int
mdoc_ft_pre(MDOC_ARGS)
@@ -1615,3 +1621,82 @@ mdoc_sp_pre(MDOC_ARGS)
return(1);
}
+
+
+/* ARGSUSED */
+static int
+mdoc_brq_pre(MDOC_ARGS)
+{
+
+ if (MDOC_BODY != n->type)
+ return(1);
+ print_text(h, "\\(lC");
+ h->flags |= HTML_NOSPACE;
+ return(1);
+}
+
+
+/* ARGSUSED */
+static void
+mdoc_brq_post(MDOC_ARGS)
+{
+
+ if (MDOC_BODY != n->type)
+ return;
+ h->flags |= HTML_NOSPACE;
+ print_text(h, "\\(rC");
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_lk_pre(MDOC_ARGS)
+{
+ const struct mdoc_node *nn;
+ struct htmlpair tag[2];
+
+ nn = n->child;
+
+ tag[0].key = ATTR_CLASS;
+ tag[0].val = "link-ext";
+ tag[1].key = ATTR_HREF;
+ tag[1].val = nn->string;
+
+ print_otag(h, TAG_A, 2, tag);
+
+ if (NULL == nn->next)
+ return(1);
+
+ for (nn = nn->next; nn; nn = nn->next)
+ print_text(h, nn->string);
+
+ return(0);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_mt_pre(MDOC_ARGS)
+{
+ struct htmlpair tag[2];
+ struct tag *t;
+ const struct mdoc_node *nn;
+
+ tag[0].key = ATTR_CLASS;
+ tag[0].val = "link-mail";
+
+ for (nn = n->child; nn; nn = nn->next) {
+ bufinit();
+ bufcat("mailto:");
+ bufcat(nn->string);
+
+ tag[1].key = ATTR_HREF;
+ tag[1].val = buf;
+
+ t = print_otag(h, TAG_A, 2, tag);
+ print_text(h, nn->string);
+ print_tagq(h, t);
+ }
+
+ return(0);
+}
diff --git a/style.css b/style.css
index 40c71590..ee7de835 100644
--- a/style.css
+++ b/style.css
@@ -10,11 +10,11 @@ span.arg { font-style: italic; }
span.config { font-weight: bold; }
span.diag { font-weight: bold; }
span.emph { font-style: italic; }
-span.farg { font-style: underline; }
+span.farg { text-decoration: underline; }
span.file { font-style: italic; }
span.flag { font-weight: bold; }
span.name { font-weight: bold; }
-span.type { font-weight: italic; }
+span.type { font-style: italic; }
span.utility { font-weight: bold; }
table.header { border-bottom: 1px dotted #cccccc; }
table.footer { border-top: 1px dotted #cccccc; }