From: Rocco Rutte Date: Mon, 21 Jul 2008 09:42:27 +0000 (+0200) Subject: makedoc: Add ".ie" and ".il" to support itemized lists. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce3b2b07bc0b931572056f08a4ff6fa933067cbb;p=mutt makedoc: Add ".ie" and ".il" to support itemized lists. Some settings docs use verbatim screen environments to print lists while support for real lists will make it look nicer: for docbook use , \(hy for roff and '-' for text. --- diff --git a/doc/makedoc.c b/doc/makedoc.c index 528d372a..32a1f4da 100644 --- a/doc/makedoc.c +++ b/doc/makedoc.c @@ -76,6 +76,7 @@ enum output_formats_t #define D_DT (1 << 7) #define D_DD (1 << 8) #define D_PA (1 << 9) +#define D_IL (1 << 10) enum { @@ -93,6 +94,8 @@ enum SP_DD, SP_END_DD, SP_END_DL, + SP_START_IL, + SP_END_IL, SP_END_SECT, SP_REFER }; @@ -733,6 +736,9 @@ static void print_confline (const char *varname, int type, const char *val, FILE ** - .dt starts a term in a definition list. ** - .dd starts a definition in a definition list. ** - .de on a line finishes a definition list. + ** - .il on a line starts an itemzied list + ** - .dd starts an item in an itemized list + ** - .ie on a line finishes an itemized list ** - .ts on a line starts a "tscreen" environment (name taken from SGML). ** - .te on a line finishes this environment. ** - .pp on a line starts a paragraph. @@ -850,6 +856,8 @@ static int print_it (int special, char *str, FILE *out, int docstat) } case SP_DD: { + if (docstat & D_IL) + fputs ("- ", out); Continuation = 0; break; } @@ -859,6 +867,17 @@ static int print_it (int special, char *str, FILE *out, int docstat) docstat &= ~D_DL; break; } + case SP_START_IL: + { + docstat |= D_IL; + break; + } + case SP_END_IL: + { + Continuation = 0; + docstat &= ~D_IL; + break; + } case SP_STR: { if (Continuation) @@ -959,7 +978,10 @@ static int print_it (int special, char *str, FILE *out, int docstat) } case SP_DD: { - fputs ("\n", out); + if (docstat & D_IL) + fputs (".TP\n\\(hy ", out); + else + fputs ("\n", out); break; } case SP_END_DL: @@ -968,6 +990,18 @@ static int print_it (int special, char *str, FILE *out, int docstat) docstat &= ~D_DL; break; } + case SP_START_IL: + { + fputs (".RS\n.PD 0\n", out); + docstat |= D_IL; + break; + } + case SP_END_IL: + { + fputs (".RE\n.PD 1", out); + docstat &= ~D_DL; + break; + } case SP_STR: { while (*str) @@ -1087,13 +1121,17 @@ static int print_it (int special, char *str, FILE *out, int docstat) case SP_DD: { docstat |= D_DD; - fputs ("\n", out); + if (docstat & D_DL) + fputs("\n", out); + fputs ("", out); break; } case SP_END_DD: { docstat &= ~D_DD; - fputs ("\n", out); + fputs ("", out); + if (docstat & D_DL) + fputs("\n", out); break; } case SP_END_DL: @@ -1102,6 +1140,18 @@ static int print_it (int special, char *str, FILE *out, int docstat) docstat &= ~(D_DD|D_DL); break; } + case SP_START_IL: + { + fputs ("\n\n", out); + docstat |= D_IL; + break; + } + case SP_END_IL: + { + fputs ("\n", out); + docstat &= ~(D_DD|D_DL); + break; + } case SP_END_SECT: { fputs ("", out); @@ -1183,6 +1233,10 @@ static int handle_docline (char *l, FILE *out, int docstat) return print_it (SP_START_DL, NULL, out, docstat); else if (!strncmp (l, ".de", 3)) return print_it (SP_END_DL, NULL, out, docstat); + else if (!strncmp (l, ".il", 3)) + return print_it (SP_START_IL, NULL, out, docstat); + else if (!strncmp (l, ".ie", 3)) + return print_it (SP_END_IL, NULL, out, docstat); else if (!strncmp (l, ". ", 2)) *l = ' '; @@ -1229,6 +1283,11 @@ static int handle_docline (char *l, FILE *out, int docstat) } else if (!strncmp (s, ".dd", 3)) { + if ((docstat & D_IL) && (docstat & D_DD)) + { + docstat = commit_buff (buff, &d, out, docstat); + docstat = print_it (SP_END_DD, NULL, out, docstat); + } docstat = commit_buff (buff, &d, out, docstat); docstat = print_it (SP_DD, NULL, out, docstat); s += 3;