openbsd-ports/x11/kde/base3/patches/patch-kioslave_man_man2html_cpp
espie 48a09b1a37 slightly better mandoc support.
Punctuation after .Nm  now shows up (though with an extra space yet)
Recognizes .Ux.
Handles : and .  in .Xr
2002-04-16 21:24:40 +00:00

109 lines
3.5 KiB
Plaintext

$OpenBSD: patch-kioslave_man_man2html_cpp,v 1.4 2002/04/16 21:24:40 espie Exp $
--- kioslave/man/man2html.cpp.orig Fri Mar 8 02:16:51 2002
+++ kioslave/man/man2html.cpp Tue Apr 16 22:51:20 2002
@@ -1681,6 +1681,7 @@ static const char *section_list[] = {
"3L", "Lightweight Processes Library",
"3M", "Mathematical Library",
"3N", "Network Functions",
+ "3p", "Perl Functions",
"3R", "RPC Services Library",
"3S", "Standard I/O Functions",
"3V", "C Library Functions",
@@ -2218,8 +2219,8 @@ static char *scan_request(char *c)
} else if (i<words-1) out_html(", ");
}
if (mandoc_synopsis) {
- if (!inFdMode) out_html(")");
- out_html(";<br>");
+ if (!inFdMode) out_html(");");
+ out_html("<br>");
};
out_html(change_to_font('R'));
out_html(NEWLINE);
@@ -2715,6 +2716,38 @@ static char *scan_request(char *c)
out_html(" is currently in beta test.");
if (fillout) curpos++; else curpos=0;
break;
+ case V('A','t'): /* BSD mandoc */
+ trans_char(c,'"','\a');
+ c=c+j;
+ if (*c=='\n') c++;
+ out_html("AT&amp;T Unix ");
+ c=scan_troff_mandoc(c, 1, NULL);
+ if (fillout) curpos++; else curpos=0;
+ break;
+ case V('F','x'): /* BSD mandoc */
+ trans_char(c,'"','\a');
+ c=c+j;
+ if (*c=='\n') c++;
+ out_html("FreeBSD ");
+ c=scan_troff_mandoc(c, 1, NULL);
+ if (fillout) curpos++; else curpos=0;
+ break;
+ case V('N','x'): /* BSD mandoc */
+ trans_char(c,'"','\a');
+ c=c+j;
+ if (*c=='\n') c++;
+ out_html("NetBSD ");
+ c=scan_troff_mandoc(c, 1, NULL);
+ if (fillout) curpos++; else curpos=0;
+ break;
+ case V('O','x'): /* BSD mandoc */
+ trans_char(c,'"','\a');
+ c=c+j;
+ if (*c=='\n') c++;
+ out_html("OpenBSD ");
+ c=scan_troff_mandoc(c, 1, NULL);
+ if (fillout) curpos++; else curpos=0;
+ break;
case V('B','x'): /* BSD mandoc */
trans_char(c,'"','\a');
c=c+j;
@@ -2723,6 +2756,14 @@ static char *scan_request(char *c)
c=scan_troff_mandoc(c, 1, NULL);
if (fillout) curpos++; else curpos=0;
break;
+ case V('U','x'): /* BSD mandoc */
+ trans_char(c,'"','\a');
+ c=c+j;
+ if (*c=='\n') c++;
+ out_html("UNIX ");
+ c=scan_troff_mandoc(c, 1, NULL);
+ if (fillout) curpos++; else curpos=0;
+ break;
case V('D','l'): /* BSD mandoc */
c=c+j;
out_html(NEWLINE);
@@ -2797,7 +2838,7 @@ static char *scan_request(char *c)
c = c+j;
if (*c == '\n') c++; /* Skip spaces */
while (isspace(*c) && *c != '\n') c++;
- while (isalnum(*c)) { /* Copy the xyz part */
+ while (isalnum(*c) || *c == '.' || *c == ':' || *c == '_' || *c == '-') { /* Copy the xyz part */
*bufptr = *c;
bufptr++; if (bufptr >= buff + MED_STR_MAX) break;
c++;
@@ -3355,16 +3396,17 @@ static char *scan_troff_mandoc(char *c,
end++;
}
- if (end > c + 2
+ if (end >= c + 2
&& ispunct(*(end - 1))
&& isspace(*(end - 2)) && *(end - 2) != '\n') {
/* Don't format lonely punctuation E.g. in "xyz ," format
* the xyz and then append the comma removing the space.
*/
- *(end - 2) = '\n';
- ret = scan_troff(c, san, result);
- *(end - 2) = *(end - 1);
- *(end - 1) = ' ';
+ *(end - 2) = 0;
+ (void)scan_troff(c, 0, result);
+ ret = end-2;
+ *(end-2)=*(end-1);
+ *(end-1)=' ';
}
else {
ret = scan_troff(c, san, result);