diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2008-12-07 16:41:04 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2008-12-07 16:41:04 +0000 |
commit | 8fd8d3e8c36a0ca787a81071a2847668e8e91619 (patch) | |
tree | 2f42ddfeedf477ff6a19d6d826a49b71763001f3 /mlg.c | |
parent | d36e26f3c71aeedde9cd92250bb5d09348e58fe5 (diff) | |
download | mandoc-8fd8d3e8c36a0ca787a81071a2847668e8e91619.tar.gz |
*** empty log message ***
Diffstat (limited to 'mlg.c')
-rw-r--r-- | mlg.c | 55 |
1 files changed, 53 insertions, 2 deletions
@@ -234,6 +234,8 @@ mlg_fmt(int tok) "is returned and the global variable " "<span class=\"inline-Va\">errno</span> " "is set to indicate the error."); + case (ROFF_In): + return("#include <%s>"); default: break; } @@ -614,6 +616,52 @@ mlg_roffspecial(void *arg, int tok, const char *start, break; } + /* + * Handle macros put into different-token tags. + */ + + switch (tok) { + case (ROFF_Fn): + assert(*more); + if ( ! mlg_begintag(p, MD_NS_INLINE, tok, NULL, more)) + return(0); + if ( ! ml_putstring(p->mbuf, *more++, &p->pos)) + return(0); + if ( ! mlg_endtag(p, MD_NS_INLINE, tok)) + return(0); + if (*more) { + if ( ! ml_nputs(p->mbuf, "(", 1, &p->pos)) + return(0); + p->flags |= ML_OVERRIDE_ONE; + if ( ! mlg_begintag(p, MD_NS_INLINE, + ROFF_Fa, NULL, more)) + return(0); + if ( ! ml_putstring(p->mbuf, *more++, &p->pos)) + return(0); + if ( ! mlg_endtag(p, MD_NS_INLINE, ROFF_Fa)) + return(0); + while (*more) { + if ( ! ml_nputs(p->mbuf, ", ", 2, &p->pos)) + return(0); + if ( ! mlg_begintag(p, MD_NS_INLINE, ROFF_Fa, NULL, more)) + return(0); + if ( ! ml_putstring(p->mbuf, *more++, &p->pos)) + return(0); + if ( ! mlg_endtag(p, MD_NS_INLINE, ROFF_Fa)) + return(0); + } + if ( ! ml_nputs(p->mbuf, ")", 1, &p->pos)) + return(0); + } + return(1); + default: + break; + } + + /* + * Now handle macros in their environments. + */ + if ( ! mlg_begintag(p, MD_NS_INLINE, tok, NULL, more)) return(0); @@ -656,15 +704,18 @@ mlg_roffspecial(void *arg, int tok, const char *start, /* FALLTHROUGH */ case (ROFF_Nm): assert(*more); - if ( ! ml_puts(p->mbuf, *more++, &p->pos)) + if ( ! ml_putstring(p->mbuf, *more++, &p->pos)) return(0); assert(NULL == *more); break; - + + case (ROFF_In): + /* NOTREACHED */ case (ROFF_Ex): /* NOTREACHED */ case (ROFF_Rv): assert(*more); + /* FIXME: *more must be ml-filtered. */ (void)snprintf(buf, sizeof(buf), mlg_fmt(tok), *more++); if ( ! ml_puts(p->mbuf, buf, &p->pos)) |