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 | d6db890aaed1f31787d501e6a425098d9054943b (patch) | |
tree | 416f7dad5b2086272af4a26ae586c6dc79074ca8 /mlg.c | |
parent | f4797a3b5c98a4a87c333409e15ed2ad5478e8b8 (diff) | |
download | mandoc-d6db890aaed1f31787d501e6a425098d9054943b.tar.gz mandoc-d6db890aaed1f31787d501e6a425098d9054943b.tar.zst mandoc-d6db890aaed1f31787d501e6a425098d9054943b.zip |
*** empty log message ***
Diffstat (limited to 'mlg.c')
-rw-r--r-- | mlg.c | 57 |
1 files changed, 54 insertions, 3 deletions
@@ -1,4 +1,4 @@ -/* $Id: mlg.c,v 1.17 2008/12/07 14:38:57 kristaps Exp $ */ +/* $Id: mlg.c,v 1.18 2008/12/07 16:41:04 kristaps Exp $ */ /* * Copyright (c) 2008 Kristaps Dzonsons <kristaps@kth.se> * @@ -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)) |