[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: [PATCH]: kio_man: render pages with .Fd, .Fn, .Fa, .Fo, .Ft, .Fc correctly
From:       aleXXX <alexander.neundorf () gmx ! net>
Date:       2002-03-03 23:36:25
[Download RAW message or body]

On Saturday 02 March 2002 17:33, Michael Matz wrote:
> Hi,
>
> On Sat, 2 Mar 2002, aleXXX wrote:
> > > Could you send me a .man file, where these are used?  The point is,
> > > that there might simply be another error in man2html preventing it from
> > > work.
> >
> > I don't think so.
> > In scan_request() all the ".??" tags are evaluated,
>
> I know, but some of those requests might have been defined in the manpage
> itself, i.e. are not standard requests of any kind.  This doesn't seem to
> apply here though.  But anyway your patch was broken (edited afterwards?),

Ok, this time an unedited patch, with coding style as in the rest of the file 
:-/

Bye
Alex

["man2html.cpp.diff" (text/x-diff)]

Index: man2html.cpp
===================================================================
RCS file: /home/kde/kdebase/kioslave/man/man2html.cpp,v
retrieving revision 1.17
diff -c -b -u -p -r1.17 man2html.cpp
--- man2html.cpp	2002/02/11 00:54:40	1.17
+++ man2html.cpp	2002/03/03 23:31:22
@@ -2186,6 +2186,47 @@ static char *scan_request(char *c)
 	    out_html(NEWLINE);
 	    if (fillout) curpos++; else curpos=0;
 	    break;
+   case V('F','d'):                //for "Function definitions", mdoc package
+   case V('F','n'):                //for "Function calls": brackets and commas have \
to be inserted automatically +   case V('F','o'):
+   case V('F','c'):
+      {
+         bool inFdMode=(c[1]=='d');
+         char font[2] ;
+         font[0] = 'B';
+         font[1] = 'B';
+         c=c+j;
+         if (*c=='\n') c++;
+         char *eol=strchr(c,'\n');
+         char *semicolon=strchr(c,';');
+         if ((semicolon!=0) && (semicolon<eol)) *semicolon=' ';
+
+         sl=fill_words(c, wordlist, &words);
+         c=sl+1;
+         /* .BR name (section)
+          ** indicates a link. It will be added in the output routine.
+          */
+         for (i=0; i<words; i++) {
+            wordlist[i][-1]=' ';
+            out_html(change_to_font(font[i&1]));
+            scan_troff(wordlist[i],1,NULL);
+            if (inFdMode) continue;
+            if (i==0) {
+               out_html(" (");
+               if (!mandoc_synopsis)
+                  out_html(") ");
+            } else if (i<words-1) out_html(", ");
+         }
+         if (mandoc_synopsis) {
+            if (!inFdMode) out_html(")");
+            out_html(";<br>");
+         };
+         out_html(change_to_font('R'));
+         out_html(NEWLINE);
+         if (!fillout) curpos=0;
+         else curpos++;
+      };
+      break;
 	case V('O','P'):  /* groff manpages use this construction */
             /* .OP a b : [ <B>a</B> <I>b</I> ] */
 	    mode=1;
@@ -2193,6 +2234,8 @@ static char *scan_request(char *c)
 	    out_html(change_to_font('R'));
 	    out_html("[");
 	    curpos++;
+   case V('F','t'):       //perhaps "Function return type"
+   case V('F','a'):       //"Function argument"
 	case V('B','R'):
 	case V('B','I'):
 	case V('I','B'):
@@ -2200,8 +2243,14 @@ static char *scan_request(char *c)
 	case V('R','B'):
 	case V('R','I'):
 	    {
+         bool inFMode=(c[0]=='F');
+         if (inFMode) {
+            c[0]='B';
+            c[1]='I';
+         };
 		char font[2] ;
-		font[0] = c[0]; font[1] = c[1];
+         font[0] = c[0];
+         font[1] = c[1];
 		c=c+j;
 		if (*c=='\n') c++;
 		sl=fill_words(c, wordlist, &words);
@@ -2210,14 +2259,22 @@ static char *scan_request(char *c)
 		** indicates a link. It will be added in the output routine.
 		*/
 		for (i=0; i<words; i++) {
-		    if (mode) { out_html(" "); curpos++; }
+            if ((mode) || (inFMode)) {
+               out_html(" ");
+               curpos++;
+            }
 		    wordlist[i][-1]=' ';
 		    out_html(change_to_font(font[i&1]));
 		    scan_troff(wordlist[i],1,NULL);
 		}
 		out_html(change_to_font('R'));
-		if (mode) { out_html(" ]"); curpos++;}
-		out_html(NEWLINE); if (!fillout) curpos=0; else curpos++;
+         if (mode) {
+            out_html(" ]");
+            curpos++;
+         }
+         out_html(NEWLINE);
+         if (!fillout) curpos=0;
+         else curpos++;
 	    }
 	    break;
 	case V('D','T'):



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic