aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_action.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-07-12 20:50:08 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-07-12 20:50:08 +0000
commitdad3c2117152071099f857651e99f8673aa988dd (patch)
treed92f0e68755d6a0f98801ea7e6572bcb5f107761 /mdoc_action.c
parent9d568b7d9d058612eaec8cbbc8a2161cd895aa1a (diff)
downloadmandoc-dad3c2117152071099f857651e99f8673aa988dd.tar.gz
mandoc-dad3c2117152071099f857651e99f8673aa988dd.tar.zst
mandoc-dad3c2117152071099f857651e99f8673aa988dd.zip
Replacement of `Lb' in mdoc_action.c.
Added warning against bogus `Lb' (like groff does). Added proper quotes around `Lb' in mdoc_term.c. Moved mdoc_a2lib -> libmdoc (where it belongs).
Diffstat (limited to 'mdoc_action.c')
-rw-r--r--mdoc_action.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/mdoc_action.c b/mdoc_action.c
index 30a75852..dcb938e5 100644
--- a/mdoc_action.c
+++ b/mdoc_action.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_action.c,v 1.26 2009/07/12 20:30:35 kristaps Exp $ */
+/* $Id: mdoc_action.c,v 1.27 2009/07/12 20:50:08 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -41,6 +41,7 @@ static int post_bl_width(POST_ARGS);
static int post_dd(POST_ARGS);
static int post_display(POST_ARGS);
static int post_dt(POST_ARGS);
+static int post_lb(POST_ARGS);
static int post_lk(POST_ARGS);
static int post_nm(POST_ARGS);
static int post_os(POST_ARGS);
@@ -159,7 +160,7 @@ const struct actions mdoc_actions[MDOC_MAX] = {
{ NULL, NULL }, /* Hf */
{ NULL, NULL }, /* Fr */
{ NULL, NULL }, /* Ud */
- { NULL, NULL }, /* Lb */
+ { NULL, post_lb }, /* Lb */
{ NULL, NULL }, /* Lp */
{ NULL, post_lk }, /* Lk */
{ NULL, NULL }, /* Mt */
@@ -291,6 +292,36 @@ post_nm(POST_ARGS)
static int
+post_lb(POST_ARGS)
+{
+ const char *p;
+ char *buf;
+ size_t sz;
+
+ assert(MDOC_TEXT == m->last->child->type);
+ p = mdoc_a2lib(m->last->child->string);
+ if (NULL == p) {
+ sz = strlen(m->last->child->string) +
+ 2 + strlen("\\(lqlibrary\\(rq");
+ buf = malloc(sz);
+ if (NULL == buf)
+ return(mdoc_nerr(m, m->last, EMALLOC));
+ (void)snprintf(buf, sz, "library \\(lq%s\\(rq",
+ m->last->child->string);
+ free(m->last->child->string);
+ m->last->child->string = buf;
+ return(1);
+ }
+
+ free(m->last->child->string);
+ m->last->child->string = strdup(p);
+ if (NULL == m->last->child->string)
+ return(mdoc_nerr(m, m->last, EMALLOC));
+ return(1);
+}
+
+
+static int
post_st(POST_ARGS)
{
const char *p;