From 674cfb5f4f4ed5a7e8df0fe330120784df889bbf Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 24 Mar 2004 19:23:21 +0000 Subject: Cleanups to complete the man page backend. Also, an additional new markup feature: a \c line in a code paragraph can now be followed by an optional \e line indicating emphasised bits of its preceding \c. This allows discretionary bolding and (italic/underline) emphasis within code paragraphs, but without introducing an escape character or breaking any existing input files. Users are warned that not all backends are required to actually render these hints, and so they should avoid depending on them 100% to convey semantic information unless they know they're writing for a restricted range of backends. [originally from svn r3965] --- input.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index 6cad0f7..0535495 100644 --- a/input.c +++ b/input.c @@ -569,11 +569,13 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) { * Parse code paragraphs separately. */ if (t.type == tok_cmd && t.cmd == c_c && !isbrace(in)) { + int wtype = word_WeakCode; + par.type = para_Code; par.fpos = t.pos; while (1) { dtor(t), t = get_codepar_token(in); - wd.type = word_WeakCode; + wd.type = wtype; wd.breaks = FALSE; /* shouldn't need this... */ wd.text = ustrdup(t.text); wd.alt = NULL; @@ -588,7 +590,12 @@ static void read_file(paragraph ***ret, input *in, indexdata *idx) { } if (t.type == tok_eop || t.type == tok_eof) break; - else if (t.type != tok_cmd || t.cmd != c_c) { + else if (t.type == tok_cmd && t.cmd == c_c) + wtype = word_WeakCode; + else if (t.type == tok_cmd && t.cmd == c_e && + wtype == word_WeakCode) + wtype = word_Emph; + else { error(err_brokencodepara, &t.pos); prev_para_type = par.type; addpara(par, ret); -- cgit v1.1