From 6c46061340369c1aa1b353f44fb543a3e3a00ca1 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 30 Mar 2021 06:50:44 -0700 Subject: definition list cleanup. - Get rid of compact attribute from
. - RS now generates a
- IP generates
we can target with styling. - IP without argument doesn't start definition list. --- man2html/man2html.c | 48 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/man2html/man2html.c b/man2html/man2html.c index 825680b..ead4ac8 100644 --- a/man2html/man2html.c +++ b/man2html/man2html.c @@ -361,6 +361,19 @@ out_html(char *c) { } } +static void +out_htmlf(char *c, ...) +{ + va_list vl; + char buf[512]; + + va_start (vl, c); + vsnprintf(buf, sizeof buf, c, vl); + va_end (vl); + + out_html(buf); +} + /* --------------------------------------------------------------- */ /* All references to dl_set and itemdepth are here. */ /* --------------------------------------------------------------- */ @@ -370,10 +383,12 @@ static int dl_set[30]= { 0 }; #define DL 1 #define UL 2 #define OL 3 -static char *dl_open[4] = { "", "
\n", "
    ", "
      " }; +static char *dl_open[4] = { "", "
      \n", "
        ", "
          " }; +static char *dl_open_cls[4] = { "", "
          \n", + "
            ", "
              " }; static char *dl_close[4] = { "", "
          \n", "
      ", "
    " }; -static inline void +static void dl_begin(void) { if (itemdepth < SIZE(dl_set) && dl_set[itemdepth] == noDL) { out_html(dl_open[DL]); @@ -382,7 +397,16 @@ dl_begin(void) { out_html("
    "); } -static inline void +static void +dl_begin_class(const char *class) { + if (itemdepth < SIZE(dl_set) && dl_set[itemdepth] == noDL) { + out_htmlf(dl_open_cls[DL], class); + dl_set[itemdepth]=DL; + } + out_html("
    "); +} + +static void dl_end(void) { if (itemdepth < SIZE(dl_set)) { int type = dl_set[itemdepth]; @@ -393,19 +417,19 @@ dl_end(void) { } } -static inline void +static void dl_newlevel(void) { itemdepth++; if (itemdepth < SIZE(dl_set)) dl_set[itemdepth]=noDL; - out_html("
    "); + out_htmlf(dl_open_cls[DL], "indent"); } -static inline void +static void dl_endlevel(void) { if (itemdepth) { dl_end(); - out_html("
    \n"); + out_html("
"); itemdepth--; } } @@ -2101,11 +2125,13 @@ scan_request(char *c) { case V('I','P'): sl = fill_words(c+j, wordlist, SIZE(wordlist), &words, '\n'); c = sl+1; - dl_begin(); - if (words) { - scan_troff(wordlist[0], 1,NULL); + if (words) { + dl_begin_class("items"); + if (words) { + scan_troff(wordlist[0], 1,NULL); + } + out_html("
"); } - out_html("
"); curpos = 0; break; case V('T','P'): -- cgit v1.2.3