version 1.11, 2009/01/17 16:47:02 |
version 1.13, 2009/01/20 12:51:28 |
|
|
|
|
/* Per-macro action routines. */ |
/* Per-macro action routines. */ |
|
|
static int post_sh(struct mdoc *); |
static int post_sh(struct mdoc *); |
static int post_os(struct mdoc *); |
static int post_os(struct mdoc *); |
static int post_dt(struct mdoc *); |
static int post_dt(struct mdoc *); |
static int post_dd(struct mdoc *); |
static int post_dd(struct mdoc *); |
static int post_nm(struct mdoc *); |
static int post_nm(struct mdoc *); |
|
|
|
static int post_prologue(struct mdoc *); |
|
|
/* Array of macro action routines. */ |
/* Array of macro action routines. */ |
|
|
const struct actions mdoc_actions[MDOC_MAX] = { |
const struct actions mdoc_actions[MDOC_MAX] = { |
Line 226 post_dt(struct mdoc *mdoc) |
|
Line 228 post_dt(struct mdoc *mdoc) |
|
|
|
if (NULL == mdoc->meta.title) |
if (NULL == mdoc->meta.title) |
mdoc->meta.title = xstrdup("untitled"); |
mdoc->meta.title = xstrdup("untitled"); |
return(1); |
|
|
return(post_prologue(mdoc)); |
} |
} |
|
|
|
|
Line 244 post_os(struct mdoc *mdoc) |
|
Line 247 post_os(struct mdoc *mdoc) |
|
|
|
mdoc->meta.os = xstrdup(buf[0] ? buf : "local"); |
mdoc->meta.os = xstrdup(buf[0] ? buf : "local"); |
mdoc->sec_lastn = mdoc->sec_last = SEC_BODY; |
mdoc->sec_lastn = mdoc->sec_last = SEC_BODY; |
return(1); |
mdoc->flags |= MDOC_BODYPARSE; |
|
|
|
return(post_prologue(mdoc)); |
} |
} |
|
|
|
|
Line 285 post_dd(struct mdoc *mdoc) |
|
Line 290 post_dd(struct mdoc *mdoc) |
|
} |
} |
|
|
if (mdoc->meta.date && NULL == n) |
if (mdoc->meta.date && NULL == n) |
return(1); |
return(post_prologue(mdoc)); |
else if (n) |
else if (n) |
return(mdoc_err(mdoc, "invalid parameter syntax")); |
return(mdoc_err(mdoc, "invalid parameter syntax")); |
if ((mdoc->meta.date = mdoc_atotime(date))) |
if ((mdoc->meta.date = mdoc_atotime(date))) |
return(1); |
return(post_prologue(mdoc)); |
return(mdoc_err(mdoc, "invalid parameter syntax")); |
return(mdoc_err(mdoc, "invalid parameter syntax")); |
} |
} |
|
|
|
|
|
static int |
|
post_prologue(struct mdoc *mdoc) |
|
{ |
|
struct mdoc_node *n; |
|
|
|
if (mdoc->last->parent->child == mdoc->last) |
|
mdoc->last->parent->child = mdoc->last->prev; |
|
if (mdoc->last->prev) |
|
mdoc->last->prev->next = NULL; |
|
|
|
n = mdoc->last; |
|
assert(NULL == mdoc->last->next); |
|
|
|
if (mdoc->last->prev) { |
|
mdoc->last = mdoc->last->prev; |
|
mdoc->next = MDOC_NEXT_SIBLING; |
|
} else { |
|
mdoc->last = mdoc->last->parent; |
|
mdoc->next = MDOC_NEXT_CHILD; |
|
} |
|
|
|
mdoc_node_freelist(n); |
|
return(1); |
|
} |
|
|
|
|
int |
int |
mdoc_action_post(struct mdoc *mdoc) |
mdoc_action_post(struct mdoc *mdoc) |
{ |
{ |
|
|
|
if (MDOC_ACTED & mdoc->last->flags) |
|
return(1); |
|
mdoc->last->flags |= MDOC_ACTED; |
|
|
if (MDOC_TEXT == mdoc->last->type) |
if (MDOC_TEXT == mdoc->last->type) |
return(1); |
return(1); |