aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-01-25 15:46:05 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-01-25 15:46:05 +0000
commit01ab75c7a0975692f32fd806b8eb8fc5d07b312e (patch)
tree301157f3ab9ed67219f7e3e21e7f2a8579a64287
parent5429c6324d2969b17da51f6de9f445e7bb44294b (diff)
downloadmandoc-01ab75c7a0975692f32fd806b8eb8fc5d07b312e.tar.gz
mandoc-01ab75c7a0975692f32fd806b8eb8fc5d07b312e.tar.zst
mandoc-01ab75c7a0975692f32fd806b8eb8fc5d07b312e.zip
Push capitalisation of `Bx' second argument into validator, where it belongs.
-rw-r--r--mdoc_html.c11
-rw-r--r--mdoc_term.c11
-rw-r--r--mdoc_validate.c24
3 files changed, 28 insertions, 18 deletions
diff --git a/mdoc_html.c b/mdoc_html.c
index 6501b830..0641d32e 100644
--- a/mdoc_html.c
+++ b/mdoc_html.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_html.c,v 1.146 2011/01/25 15:28:56 kristaps Exp $ */
+/* $Id: mdoc_html.c,v 1.147 2011/01/25 15:46:05 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -833,7 +833,6 @@ static int
mdoc_bx_pre(MDOC_ARGS)
{
struct htmlpair tag;
- char buf[3];
PAIR_CLASS_INIT(&tag, "unix");
print_otag(h, TAG_SPAN, 1, &tag);
@@ -848,14 +847,10 @@ mdoc_bx_pre(MDOC_ARGS)
}
if (NULL != (n = n->next)) {
- buf[0] = '-';
- buf[1] = toupper((unsigned char)*n->string);
- buf[2] = '\0';
-
h->flags |= HTML_NOSPACE;
- print_text(h, buf);
+ print_text(h, "-");
h->flags |= HTML_NOSPACE;
- print_text(h, n->string + 1);
+ print_text(h, n->string);
}
return(0);
diff --git a/mdoc_term.c b/mdoc_term.c
index 3d48b453..e1b43e46 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.212 2011/01/25 15:28:56 kristaps Exp $ */
+/* $Id: mdoc_term.c,v 1.213 2011/01/25 15:46:05 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -1677,7 +1677,6 @@ termp_bd_post(DECL_ARGS)
static int
termp_bx_pre(DECL_ARGS)
{
- char buf[3];
if (NULL != (n = n->child)) {
term_word(p, n->string);
@@ -1689,14 +1688,10 @@ termp_bx_pre(DECL_ARGS)
}
if (NULL != (n = n->next)) {
- buf[0] = '-';
- buf[1] = toupper((unsigned char)*n->string);
- buf[2] = '\0';
-
p->flags |= TERMP_NOSPACE;
- term_word(p, buf);
+ term_word(p, "-");
p->flags |= TERMP_NOSPACE;
- term_word(p, n->string + 1);
+ term_word(p, n->string);
}
return(0);
diff --git a/mdoc_validate.c b/mdoc_validate.c
index 1f43817c..fc00b93a 100644
--- a/mdoc_validate.c
+++ b/mdoc_validate.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_validate.c,v 1.153 2011/01/25 10:37:49 kristaps Exp $ */
+/* $Id: mdoc_validate.c,v 1.154 2011/01/25 15:46:05 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -95,6 +95,7 @@ static int post_bl_block(POST_ARGS);
static int post_bl_block_width(POST_ARGS);
static int post_bl_block_tag(POST_ARGS);
static int post_bl_head(POST_ARGS);
+static int post_bx(POST_ARGS);
static int post_dd(POST_ARGS);
static int post_dt(POST_ARGS);
static int post_defaults(POST_ARGS);
@@ -134,6 +135,7 @@ static v_post posts_bd[] = { post_literal, hwarn_eq0, bwarn_ge1, NULL };
static v_post posts_bf[] = { hwarn_le1, post_bf, NULL };
static v_post posts_bk[] = { hwarn_eq0, bwarn_ge1, NULL };
static v_post posts_bl[] = { bwarn_ge1, post_bl, NULL };
+static v_post posts_bx[] = { post_bx, NULL };
static v_post posts_bool[] = { ebool, NULL };
static v_post posts_eoln[] = { post_eoln, NULL };
static v_post posts_defaults[] = { post_defaults, NULL };
@@ -235,7 +237,7 @@ const struct valids mdoc_valids[MDOC_MAX] = {
{ NULL, NULL }, /* Bo */
{ NULL, NULL }, /* Bq */
{ NULL, NULL }, /* Bsx */
- { NULL, NULL }, /* Bx */
+ { NULL, posts_bx }, /* Bx */
{ NULL, posts_bool }, /* Db */
{ NULL, NULL }, /* Dc */
{ NULL, NULL }, /* Do */
@@ -2100,6 +2102,24 @@ post_prol(POST_ARGS)
}
static int
+post_bx(POST_ARGS)
+{
+ struct mdoc_node *n;
+
+ /*
+ * Make `Bx's second argument always start with an uppercase
+ * letter. Groff checks if it's an "accepted" term, but we just
+ * uppercase blindly.
+ */
+
+ n = mdoc->last->child;
+ if (n && NULL != (n = n->next))
+ *n->string = toupper((unsigned char)*n->string);
+
+ return(1);
+}
+
+static int
post_os(POST_ARGS)
{
struct mdoc_node *n;