Merge for mdocml-1.10.9
This commit is contained in:
parent
c0d9444af1
commit
f494eb95a3
281
external/bsd/mdocml/dist/man_action.c
vendored
281
external/bsd/mdocml/dist/man_action.c
vendored
@ -1,281 +0,0 @@
|
||||
/* $Vendor-Id: man_action.c,v 1.40 2010/07/22 23:03:15 kristaps Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "mandoc.h"
|
||||
#include "libman.h"
|
||||
#include "libmandoc.h"
|
||||
|
||||
struct actions {
|
||||
int (*post)(struct man *);
|
||||
};
|
||||
|
||||
static int post_TH(struct man *);
|
||||
static int post_fi(struct man *);
|
||||
static int post_nf(struct man *);
|
||||
static int post_AT(struct man *);
|
||||
static int post_UC(struct man *);
|
||||
|
||||
const struct actions man_actions[MAN_MAX] = {
|
||||
{ NULL }, /* br */
|
||||
{ post_TH }, /* TH */
|
||||
{ NULL }, /* SH */
|
||||
{ NULL }, /* SS */
|
||||
{ NULL }, /* TP */
|
||||
{ NULL }, /* LP */
|
||||
{ NULL }, /* PP */
|
||||
{ NULL }, /* P */
|
||||
{ NULL }, /* IP */
|
||||
{ NULL }, /* HP */
|
||||
{ NULL }, /* SM */
|
||||
{ NULL }, /* SB */
|
||||
{ NULL }, /* BI */
|
||||
{ NULL }, /* IB */
|
||||
{ NULL }, /* BR */
|
||||
{ NULL }, /* RB */
|
||||
{ NULL }, /* R */
|
||||
{ NULL }, /* B */
|
||||
{ NULL }, /* I */
|
||||
{ NULL }, /* IR */
|
||||
{ NULL }, /* RI */
|
||||
{ NULL }, /* na */
|
||||
{ NULL }, /* i */
|
||||
{ NULL }, /* sp */
|
||||
{ post_nf }, /* nf */
|
||||
{ post_fi }, /* fi */
|
||||
{ NULL }, /* r */
|
||||
{ NULL }, /* RE */
|
||||
{ NULL }, /* RS */
|
||||
{ NULL }, /* DT */
|
||||
{ post_UC }, /* UC */
|
||||
{ NULL }, /* PD */
|
||||
{ NULL }, /* Sp */
|
||||
{ post_nf }, /* Vb */
|
||||
{ post_fi }, /* Ve */
|
||||
{ post_AT }, /* AT */
|
||||
{ NULL }, /* in */
|
||||
};
|
||||
|
||||
|
||||
int
|
||||
man_action_post(struct man *m)
|
||||
{
|
||||
|
||||
if (MAN_ACTED & m->last->flags)
|
||||
return(1);
|
||||
m->last->flags |= MAN_ACTED;
|
||||
|
||||
switch (m->last->type) {
|
||||
case (MAN_TEXT):
|
||||
/* FALLTHROUGH */
|
||||
case (MAN_ROOT):
|
||||
return(1);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (NULL == man_actions[m->last->tok].post)
|
||||
return(1);
|
||||
return((*man_actions[m->last->tok].post)(m));
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
post_fi(struct man *m)
|
||||
{
|
||||
|
||||
if ( ! (MAN_LITERAL & m->flags))
|
||||
if ( ! man_nmsg(m, m->last, MANDOCERR_NOSCOPE))
|
||||
return(0);
|
||||
m->flags &= ~MAN_LITERAL;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
post_nf(struct man *m)
|
||||
{
|
||||
|
||||
if (MAN_LITERAL & m->flags)
|
||||
if ( ! man_nmsg(m, m->last, MANDOCERR_SCOPEREP))
|
||||
return(0);
|
||||
m->flags |= MAN_LITERAL;
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
post_TH(struct man *m)
|
||||
{
|
||||
struct man_node *n;
|
||||
|
||||
if (m->meta.title)
|
||||
free(m->meta.title);
|
||||
if (m->meta.vol)
|
||||
free(m->meta.vol);
|
||||
if (m->meta.source)
|
||||
free(m->meta.source);
|
||||
if (m->meta.msec)
|
||||
free(m->meta.msec);
|
||||
if (m->meta.rawdate)
|
||||
free(m->meta.rawdate);
|
||||
|
||||
m->meta.title = m->meta.vol = m->meta.rawdate =
|
||||
m->meta.msec = m->meta.source = NULL;
|
||||
m->meta.date = 0;
|
||||
|
||||
/* ->TITLE<- MSEC DATE SOURCE VOL */
|
||||
|
||||
n = m->last->child;
|
||||
assert(n);
|
||||
m->meta.title = mandoc_strdup(n->string);
|
||||
|
||||
/* TITLE ->MSEC<- DATE SOURCE VOL */
|
||||
|
||||
n = n->next;
|
||||
assert(n);
|
||||
m->meta.msec = mandoc_strdup(n->string);
|
||||
|
||||
/* TITLE MSEC ->DATE<- SOURCE VOL */
|
||||
|
||||
/*
|
||||
* Try to parse the date. If this works, stash the epoch (this
|
||||
* is optimal because we can reformat it in the canonical form).
|
||||
* If it doesn't parse, isn't specified at all, or is an empty
|
||||
* string, then use the current date.
|
||||
*/
|
||||
|
||||
n = n->next;
|
||||
if (n && n->string && *n->string) {
|
||||
m->meta.date = mandoc_a2time
|
||||
(MTIME_ISO_8601, n->string);
|
||||
if (0 == m->meta.date) {
|
||||
if ( ! man_nmsg(m, n, MANDOCERR_BADDATE))
|
||||
return(0);
|
||||
m->meta.rawdate = mandoc_strdup(n->string);
|
||||
}
|
||||
} else
|
||||
m->meta.date = time(NULL);
|
||||
|
||||
/* TITLE MSEC DATE ->SOURCE<- VOL */
|
||||
|
||||
if (n && (n = n->next))
|
||||
m->meta.source = mandoc_strdup(n->string);
|
||||
|
||||
/* TITLE MSEC DATE SOURCE ->VOL<- */
|
||||
|
||||
if (n && (n = n->next))
|
||||
m->meta.vol = mandoc_strdup(n->string);
|
||||
|
||||
/*
|
||||
* Remove the `TH' node after we've processed it for our
|
||||
* meta-data.
|
||||
*/
|
||||
man_node_delete(m, m->last);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
post_AT(struct man *m)
|
||||
{
|
||||
static const char * const unix_versions[] = {
|
||||
"7th Edition",
|
||||
"System III",
|
||||
"System V",
|
||||
"System V Release 2",
|
||||
};
|
||||
|
||||
const char *p, *s;
|
||||
struct man_node *n, *nn;
|
||||
|
||||
n = m->last->child;
|
||||
|
||||
if (NULL == n || MAN_TEXT != n->type)
|
||||
p = unix_versions[0];
|
||||
else {
|
||||
s = n->string;
|
||||
if (0 == strcmp(s, "3"))
|
||||
p = unix_versions[0];
|
||||
else if (0 == strcmp(s, "4"))
|
||||
p = unix_versions[1];
|
||||
else if (0 == strcmp(s, "5")) {
|
||||
nn = n->next;
|
||||
if (nn && MAN_TEXT == nn->type && nn->string[0])
|
||||
p = unix_versions[3];
|
||||
else
|
||||
p = unix_versions[2];
|
||||
} else
|
||||
p = unix_versions[0];
|
||||
}
|
||||
|
||||
if (m->meta.source)
|
||||
free(m->meta.source);
|
||||
|
||||
m->meta.source = mandoc_strdup(p);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
post_UC(struct man *m)
|
||||
{
|
||||
static const char * const bsd_versions[] = {
|
||||
"3rd Berkeley Distribution",
|
||||
"4th Berkeley Distribution",
|
||||
"4.2 Berkeley Distribution",
|
||||
"4.3 Berkeley Distribution",
|
||||
"4.4 Berkeley Distribution",
|
||||
};
|
||||
|
||||
const char *p, *s;
|
||||
struct man_node *n;
|
||||
|
||||
n = m->last->child;
|
||||
|
||||
if (NULL == n || MAN_TEXT != n->type)
|
||||
p = bsd_versions[0];
|
||||
else {
|
||||
s = n->string;
|
||||
if (0 == strcmp(s, "3"))
|
||||
p = bsd_versions[0];
|
||||
else if (0 == strcmp(s, "4"))
|
||||
p = bsd_versions[1];
|
||||
else if (0 == strcmp(s, "5"))
|
||||
p = bsd_versions[2];
|
||||
else if (0 == strcmp(s, "6"))
|
||||
p = bsd_versions[3];
|
||||
else if (0 == strcmp(s, "7"))
|
||||
p = bsd_versions[4];
|
||||
else
|
||||
p = bsd_versions[0];
|
||||
}
|
||||
|
||||
if (m->meta.source)
|
||||
free(m->meta.source);
|
||||
|
||||
m->meta.source = mandoc_strdup(p);
|
||||
|
||||
return(1);
|
||||
}
|
244
external/bsd/mdocml/dist/man_term.c
vendored
244
external/bsd/mdocml/dist/man_term.c
vendored
@ -1,6 +1,7 @@
|
||||
/* $Vendor-Id: man_term.c,v 1.84 2010/07/23 13:22:35 kristaps Exp $ */
|
||||
/* $Vendor-Id: man_term.c,v 1.94 2011/01/04 01:23:18 schwarze Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2008, 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv>
|
||||
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@ -80,14 +81,12 @@ static void print_man_foot(struct termp *, const void *);
|
||||
static void print_bvspace(struct termp *,
|
||||
const struct man_node *);
|
||||
|
||||
static int pre_alternate(DECL_ARGS);
|
||||
static int pre_B(DECL_ARGS);
|
||||
static int pre_BI(DECL_ARGS);
|
||||
static int pre_HP(DECL_ARGS);
|
||||
static int pre_I(DECL_ARGS);
|
||||
static int pre_IP(DECL_ARGS);
|
||||
static int pre_PP(DECL_ARGS);
|
||||
static int pre_RB(DECL_ARGS);
|
||||
static int pre_RI(DECL_ARGS);
|
||||
static int pre_RS(DECL_ARGS);
|
||||
static int pre_SH(DECL_ARGS);
|
||||
static int pre_SS(DECL_ARGS);
|
||||
@ -96,6 +95,7 @@ static int pre_ign(DECL_ARGS);
|
||||
static int pre_in(DECL_ARGS);
|
||||
static int pre_literal(DECL_ARGS);
|
||||
static int pre_sp(DECL_ARGS);
|
||||
static int pre_ft(DECL_ARGS);
|
||||
|
||||
static void post_IP(DECL_ARGS);
|
||||
static void post_HP(DECL_ARGS);
|
||||
@ -117,31 +117,27 @@ static const struct termact termacts[MAN_MAX] = {
|
||||
{ pre_HP, post_HP, 0 }, /* HP */
|
||||
{ NULL, NULL, 0 }, /* SM */
|
||||
{ pre_B, NULL, 0 }, /* SB */
|
||||
{ pre_BI, NULL, 0 }, /* BI */
|
||||
{ pre_BI, NULL, 0 }, /* IB */
|
||||
{ pre_RB, NULL, 0 }, /* BR */
|
||||
{ pre_RB, NULL, 0 }, /* RB */
|
||||
{ pre_alternate, NULL, 0 }, /* BI */
|
||||
{ pre_alternate, NULL, 0 }, /* IB */
|
||||
{ pre_alternate, NULL, 0 }, /* BR */
|
||||
{ pre_alternate, NULL, 0 }, /* RB */
|
||||
{ NULL, NULL, 0 }, /* R */
|
||||
{ pre_B, NULL, 0 }, /* B */
|
||||
{ pre_I, NULL, 0 }, /* I */
|
||||
{ pre_RI, NULL, 0 }, /* IR */
|
||||
{ pre_RI, NULL, 0 }, /* RI */
|
||||
{ pre_alternate, NULL, 0 }, /* IR */
|
||||
{ pre_alternate, NULL, 0 }, /* RI */
|
||||
{ NULL, NULL, MAN_NOTEXT }, /* na */
|
||||
{ pre_I, NULL, 0 }, /* i */
|
||||
{ pre_sp, NULL, MAN_NOTEXT }, /* sp */
|
||||
{ pre_literal, NULL, 0 }, /* nf */
|
||||
{ pre_literal, NULL, 0 }, /* fi */
|
||||
{ NULL, NULL, 0 }, /* r */
|
||||
{ NULL, NULL, 0 }, /* RE */
|
||||
{ pre_RS, post_RS, 0 }, /* RS */
|
||||
{ pre_ign, NULL, 0 }, /* DT */
|
||||
{ pre_ign, NULL, 0 }, /* UC */
|
||||
{ pre_ign, NULL, 0 }, /* PD */
|
||||
{ pre_sp, NULL, MAN_NOTEXT }, /* Sp */
|
||||
{ pre_literal, NULL, 0 }, /* Vb */
|
||||
{ pre_literal, NULL, 0 }, /* Ve */
|
||||
{ pre_ign, NULL, 0 }, /* AT */
|
||||
{ pre_in, NULL, MAN_NOTEXT }, /* in */
|
||||
{ pre_ft, NULL, MAN_NOTEXT }, /* ft */
|
||||
};
|
||||
|
||||
|
||||
@ -253,96 +249,67 @@ pre_literal(DECL_ARGS)
|
||||
{
|
||||
|
||||
term_newln(p);
|
||||
switch (n->tok) {
|
||||
case (MAN_Vb):
|
||||
/* FALLTHROUGH */
|
||||
case (MAN_nf):
|
||||
|
||||
if (MAN_nf == n->tok)
|
||||
mt->fl |= MANT_LITERAL;
|
||||
return(MAN_Vb != n->tok);
|
||||
default:
|
||||
else
|
||||
mt->fl &= ~MANT_LITERAL;
|
||||
break;
|
||||
}
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
pre_RB(DECL_ARGS)
|
||||
{
|
||||
const struct man_node *nn;
|
||||
int i;
|
||||
|
||||
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
|
||||
if (i % 2 && MAN_RB == n->tok)
|
||||
term_fontrepl(p, TERMFONT_BOLD);
|
||||
else if ( ! (i % 2) && MAN_RB != n->tok)
|
||||
term_fontrepl(p, TERMFONT_BOLD);
|
||||
else
|
||||
term_fontrepl(p, TERMFONT_NONE);
|
||||
|
||||
if (i > 0)
|
||||
p->flags |= TERMP_NOSPACE;
|
||||
|
||||
print_man_node(p, mt, nn, m);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
pre_RI(DECL_ARGS)
|
||||
{
|
||||
const struct man_node *nn;
|
||||
int i;
|
||||
|
||||
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
|
||||
if (i % 2 && MAN_RI == n->tok)
|
||||
term_fontrepl(p, TERMFONT_UNDER);
|
||||
else if ( ! (i % 2) && MAN_RI != n->tok)
|
||||
term_fontrepl(p, TERMFONT_UNDER);
|
||||
else
|
||||
term_fontrepl(p, TERMFONT_NONE);
|
||||
|
||||
if (i > 0)
|
||||
p->flags |= TERMP_NOSPACE;
|
||||
|
||||
print_man_node(p, mt, nn, m);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
pre_BI(DECL_ARGS)
|
||||
pre_alternate(DECL_ARGS)
|
||||
{
|
||||
enum termfont font[2];
|
||||
const struct man_node *nn;
|
||||
int i;
|
||||
int savelit, i;
|
||||
|
||||
for (i = 0, nn = n->child; nn; nn = nn->next, i++) {
|
||||
if (i % 2 && MAN_BI == n->tok)
|
||||
term_fontrepl(p, TERMFONT_UNDER);
|
||||
else if (i % 2)
|
||||
term_fontrepl(p, TERMFONT_BOLD);
|
||||
else if (MAN_BI == n->tok)
|
||||
term_fontrepl(p, TERMFONT_BOLD);
|
||||
else
|
||||
term_fontrepl(p, TERMFONT_UNDER);
|
||||
|
||||
if (i)
|
||||
p->flags |= TERMP_NOSPACE;
|
||||
|
||||
print_man_node(p, mt, nn, m);
|
||||
switch (n->tok) {
|
||||
case (MAN_RB):
|
||||
font[0] = TERMFONT_NONE;
|
||||
font[1] = TERMFONT_BOLD;
|
||||
break;
|
||||
case (MAN_RI):
|
||||
font[0] = TERMFONT_NONE;
|
||||
font[1] = TERMFONT_UNDER;
|
||||
break;
|
||||
case (MAN_BR):
|
||||
font[0] = TERMFONT_BOLD;
|
||||
font[1] = TERMFONT_NONE;
|
||||
break;
|
||||
case (MAN_BI):
|
||||
font[0] = TERMFONT_BOLD;
|
||||
font[1] = TERMFONT_UNDER;
|
||||
break;
|
||||
case (MAN_IR):
|
||||
font[0] = TERMFONT_UNDER;
|
||||
font[1] = TERMFONT_NONE;
|
||||
break;
|
||||
case (MAN_IB):
|
||||
font[0] = TERMFONT_UNDER;
|
||||
font[1] = TERMFONT_BOLD;
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
savelit = MANT_LITERAL & mt->fl;
|
||||
mt->fl &= ~MANT_LITERAL;
|
||||
|
||||
for (i = 0, nn = n->child; nn; nn = nn->next, i = 1 - i) {
|
||||
term_fontrepl(p, font[i]);
|
||||
if (savelit && NULL == nn->next)
|
||||
mt->fl |= MANT_LITERAL;
|
||||
print_man_node(p, mt, nn, m);
|
||||
if (nn->next)
|
||||
p->flags |= TERMP_NOSPACE;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
pre_B(DECL_ARGS)
|
||||
@ -352,6 +319,46 @@ pre_B(DECL_ARGS)
|
||||
return(1);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
pre_ft(DECL_ARGS)
|
||||
{
|
||||
const char *cp;
|
||||
|
||||
if (NULL == n->child) {
|
||||
term_fontlast(p);
|
||||
return(0);
|
||||
}
|
||||
|
||||
cp = n->child->string;
|
||||
switch (*cp) {
|
||||
case ('4'):
|
||||
/* FALLTHROUGH */
|
||||
case ('3'):
|
||||
/* FALLTHROUGH */
|
||||
case ('B'):
|
||||
term_fontrepl(p, TERMFONT_BOLD);
|
||||
break;
|
||||
case ('2'):
|
||||
/* FALLTHROUGH */
|
||||
case ('I'):
|
||||
term_fontrepl(p, TERMFONT_UNDER);
|
||||
break;
|
||||
case ('P'):
|
||||
term_fontlast(p);
|
||||
break;
|
||||
case ('1'):
|
||||
/* FALLTHROUGH */
|
||||
case ('C'):
|
||||
/* FALLTHROUGH */
|
||||
case ('R'):
|
||||
term_fontrepl(p, TERMFONT_NONE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
@ -497,7 +504,7 @@ pre_PP(DECL_ARGS)
|
||||
break;
|
||||
}
|
||||
|
||||
return(1);
|
||||
return(MAN_HEAD != n->type);
|
||||
}
|
||||
|
||||
|
||||
@ -507,7 +514,7 @@ pre_IP(DECL_ARGS)
|
||||
{
|
||||
const struct man_node *nn;
|
||||
size_t len;
|
||||
int ival;
|
||||
int savelit, ival;
|
||||
|
||||
switch (n->type) {
|
||||
case (MAN_BODY):
|
||||
@ -527,15 +534,11 @@ pre_IP(DECL_ARGS)
|
||||
len = mt->lmargin;
|
||||
ival = -1;
|
||||
|
||||
/* Calculate offset. */
|
||||
|
||||
/* Calculate the offset from the optional second argument. */
|
||||
if (NULL != (nn = n->parent->head->child))
|
||||
if (NULL != (nn = nn->next)) {
|
||||
for ( ; nn->next; nn = nn->next)
|
||||
/* Do nothing. */ ;
|
||||
if (NULL != (nn = nn->next))
|
||||
if ((ival = a2width(p, nn->string)) >= 0)
|
||||
len = (size_t)ival;
|
||||
}
|
||||
|
||||
switch (n->type) {
|
||||
case (MAN_HEAD):
|
||||
@ -551,9 +554,15 @@ pre_IP(DECL_ARGS)
|
||||
/* Set the saved left-margin. */
|
||||
mt->lmargin = (size_t)ival;
|
||||
|
||||
/* Don't print the length value. */
|
||||
for (nn = n->child; nn->next; nn = nn->next)
|
||||
print_man_node(p, mt, nn, m);
|
||||
savelit = MANT_LITERAL & mt->fl;
|
||||
mt->fl &= ~MANT_LITERAL;
|
||||
|
||||
if (n->child)
|
||||
print_man_node(p, mt, n->child, m);
|
||||
|
||||
if (savelit)
|
||||
mt->fl |= MANT_LITERAL;
|
||||
|
||||
return(0);
|
||||
case (MAN_BODY):
|
||||
p->offset = mt->offset + len;
|
||||
@ -579,7 +588,7 @@ post_IP(DECL_ARGS)
|
||||
p->rmargin = p->maxrmargin;
|
||||
break;
|
||||
case (MAN_BODY):
|
||||
term_flushln(p);
|
||||
term_newln(p);
|
||||
p->flags &= ~TERMP_NOLPAD;
|
||||
break;
|
||||
default:
|
||||
@ -594,12 +603,11 @@ pre_TP(DECL_ARGS)
|
||||
{
|
||||
const struct man_node *nn;
|
||||
size_t len;
|
||||
int ival;
|
||||
int savelit, ival;
|
||||
|
||||
switch (n->type) {
|
||||
case (MAN_HEAD):
|
||||
p->flags |= TERMP_NOBREAK;
|
||||
p->flags |= TERMP_TWOSPACE;
|
||||
break;
|
||||
case (MAN_BODY):
|
||||
p->flags |= TERMP_NOLPAD;
|
||||
@ -634,11 +642,17 @@ pre_TP(DECL_ARGS)
|
||||
p->offset = mt->offset;
|
||||
p->rmargin = mt->offset + len;
|
||||
|
||||
savelit = MANT_LITERAL & mt->fl;
|
||||
mt->fl &= ~MANT_LITERAL;
|
||||
|
||||
/* Don't print same-line elements. */
|
||||
for (nn = n->child; nn; nn = nn->next)
|
||||
for (nn = n->child; nn; nn = nn->next)
|
||||
if (nn->line > n->line)
|
||||
print_man_node(p, mt, nn, m);
|
||||
|
||||
if (savelit)
|
||||
mt->fl |= MANT_LITERAL;
|
||||
|
||||
if (ival >= 0)
|
||||
mt->lmargin = (size_t)ival;
|
||||
|
||||
@ -668,7 +682,7 @@ post_TP(DECL_ARGS)
|
||||
p->rmargin = p->maxrmargin;
|
||||
break;
|
||||
case (MAN_BODY):
|
||||
term_flushln(p);
|
||||
term_newln(p);
|
||||
p->flags &= ~TERMP_NOLPAD;
|
||||
break;
|
||||
default:
|
||||
@ -855,10 +869,16 @@ print_man_node(DECL_ARGS)
|
||||
p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
|
||||
p->flags |= TERMP_NOSPACE;
|
||||
term_flushln(p);
|
||||
p->flags &= ~TERMP_NOLPAD;
|
||||
p->rmargin = rm;
|
||||
p->maxrmargin = rmax;
|
||||
}
|
||||
break;
|
||||
case (MAN_TBL):
|
||||
if (TBL_SPAN_FIRST & n->span->flags)
|
||||
term_newln(p);
|
||||
term_tbl(p, n->span);
|
||||
break;
|
||||
default:
|
||||
if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
|
||||
term_fontrepl(p, TERMFONT_NONE);
|
||||
@ -870,11 +890,17 @@ print_man_node(DECL_ARGS)
|
||||
if (c && n->child)
|
||||
print_man_nodelist(p, mt, n->child, m);
|
||||
|
||||
if (MAN_TEXT != n->type) {
|
||||
switch (n->type) {
|
||||
case (MAN_TEXT):
|
||||
/* FALLTHROUGH */
|
||||
case (MAN_TBL):
|
||||
break;
|
||||
default:
|
||||
if (termacts[n->tok].post)
|
||||
(*termacts[n->tok].post)(p, mt, n, m);
|
||||
if ( ! (MAN_NOTEXT & termacts[n->tok].flags))
|
||||
term_fontrepl(p, TERMFONT_NONE);
|
||||
break;
|
||||
}
|
||||
|
||||
if (MAN_EOS & n->flags)
|
||||
@ -916,6 +942,10 @@ print_man_foot(struct termp *p, const void *arg)
|
||||
p->rmargin = p->maxrmargin - term_strlen(p, buf);
|
||||
p->offset = 0;
|
||||
|
||||
/* term_strlen() can return zero. */
|
||||
if (p->rmargin == p->maxrmargin)
|
||||
p->rmargin--;
|
||||
|
||||
if (meta->source)
|
||||
term_word(p, meta->source);
|
||||
if (meta->source)
|
||||
|
1045
external/bsd/mdocml/dist/mdoc_action.c
vendored
1045
external/bsd/mdocml/dist/mdoc_action.c
vendored
File diff suppressed because it is too large
Load Diff
613
external/bsd/mdocml/dist/mdoc_term.c
vendored
613
external/bsd/mdocml/dist/mdoc_term.c
vendored
File diff suppressed because it is too large
Load Diff
77
external/bsd/mdocml/dist/style.css
vendored
77
external/bsd/mdocml/dist/style.css
vendored
@ -1,77 +0,0 @@
|
||||
div.body { color: #333333;
|
||||
max-width: 800px;
|
||||
padding-left: 10px;
|
||||
font-size: smaller;
|
||||
font-family: Verdana, Tahoma, Arial, sans-serif; }
|
||||
|
||||
div.sec-head { color: #000000;
|
||||
font-weight: bold; }
|
||||
div.sec-body { }
|
||||
div.sec-block { padding-bottom: 1em; }
|
||||
div.ssec-head { color: #000000;
|
||||
font-weight: bold; }
|
||||
div.ssec-body { }
|
||||
div.ssec-block { }
|
||||
|
||||
span.addr { } /* Address (Ad). */
|
||||
span.arg { font-style: italic; } /* Command argument (Ar). */
|
||||
span.author { } /* Author name (An). */
|
||||
span.cmd { font-weight: bold; } /* Command (Cm). */
|
||||
span.config { font-weight: bold; } /* Config statement (Cd). */
|
||||
span.define { } /* Defines (Dv). */
|
||||
span.desc { } /* Nd. After em-dash. */
|
||||
span.diag { font-weight: bold; } /* Diagnostic (Bl -diag). */
|
||||
span.emph { font-style: italic; } /* Emphasis (Em). */
|
||||
span.env { } /* Environment variables (Ev). */
|
||||
span.errno { } /* Error string (Er). */
|
||||
span.farg { font-style: italic; } /* Function argument (Fa, Fn). */
|
||||
span.file { font-style: italic; } /* File (Pa). */
|
||||
span.flag { font-weight: bold; } /* Flag (Fl, Cm). */
|
||||
span.fname { font-weight: bold; } /* Function name (Fa, Fn, Rv). */
|
||||
span.ftype { font-style: italic; } /* Function types (Ft, Fn). */
|
||||
span.includes { font-weight: bold; } /* Header includes (In). */
|
||||
span.lib { } /* Library (Lb). */
|
||||
span.lit { font-family: monospace; } /* Literals (Bf -literal). */
|
||||
span.macro { font-weight: bold; } /* Macro-ish thing (Fd). */
|
||||
span.name { color: #003333; font-weight: bold; } /* Name of utility (Nm). */
|
||||
span.opt { } /* Options (Op, Oo/Oc). */
|
||||
span.ref { } /* Citations (Rs). */
|
||||
span.ref-auth { } /* Reference author (%A). */
|
||||
span.ref-book { font-style: italic; } /* Reference book (%B). */
|
||||
span.ref-city { } /* Reference city (%C). */
|
||||
span.ref-date { } /* Reference date (%D). */
|
||||
span.ref-issue { font-style: italic; } /* Reference issuer/publisher (%I). */
|
||||
span.ref-jrnl { font-style: italic; } /* Reference journal (%J). */
|
||||
span.ref-num { } /* Reference number (%N). */
|
||||
span.ref-opt { } /* Reference optionals (%O). */
|
||||
span.ref-page { } /* Reference page (%P). */
|
||||
span.ref-corp { } /* Reference corporate/foreign author (%Q). */
|
||||
span.ref-rep { } /* Reference report (%R). */
|
||||
span.ref-title { } /* Reference title (%T). */
|
||||
span.ref-vol { } /* Reference volume (%V). */
|
||||
span.symb { font-weight: bold; } /* Symbols. */
|
||||
span.type { font-style: italic; } /* Variable types (Vt). */
|
||||
span.unix { } /* Unices (Ux, Ox, Nx, Fx, Bx, Bsx, Dx). */
|
||||
span.utility { font-weight: bold; } /* Name of utility (Ex). */
|
||||
span.var { font-weight: bold; } /* Variables (Rv). */
|
||||
|
||||
a.link-ext { background: transparent url(external.png) center right no-repeat; padding-right: 12px; }/* Off-site link (Lk). */
|
||||
a.link-includes { } /* Include-file link (In). */
|
||||
a.link-mail { background: transparent url(external.png) center right no-repeat; padding-right: 12px; }/* Mailto links (Mt). */
|
||||
a.link-man { } /* Manual links (Xr). */
|
||||
a.link-sec { text-decoration: none; border-bottom: 1px dotted #339999; } /* Section links (Sx). */
|
||||
|
||||
div.emph { font-style: italic; } /* Emphasis (Bl -emphasis). */
|
||||
div.lit { margin: 3px;
|
||||
padding: 3px;
|
||||
background-color: #EEEEEE;
|
||||
border: 1px solid #339999;
|
||||
color: #000000;
|
||||
font-family: monospace; }
|
||||
div.symb { font-weight: bold; } /* Symbols (Bl -symbolic). */
|
||||
|
||||
table.header { border-bottom: 1px dotted #dddddd;
|
||||
color: #999999; }
|
||||
table.footer { border-top: 1px dotted #dddddd;
|
||||
color: #999999; }
|
||||
|
Loading…
Reference in New Issue
Block a user