544c191c34
--- MAJOR NEW FEATURES --- * apropos(1): improve POSIX compliance by accepting case-insensitive extended regular expressions by default * new -O tag[=term] output option (open a page at the definition of a term) * tbl(7) -T html: spanning and horizontal and vertical alignment of cells * tbl(7) -T html: draw lines on the edges of table cells * tbl(7) -T utf8: render lines with the Unicode box drawing characters * mandoc is now able to handle the manual pages of the groff package. --- MINOR NEW FEATURES --- * -T html: new option -O toc (table of contents) * -T html: second argument to -O man to support local and remote links * mdoc(7) .Bd -centered now fills the text contained in it * man-ext .SY and .YS macros (synopsis block) * man-ext .TQ macro (tagged paragraph without vertical space before it) * tbl(7) \& explicit alignment indicator * roff(7) .shift, .while, and .return requests * roff(7) .char request (output glyph definition) * roff(7) .nop request (no operation) * roff(7) .ft request: handle the CB, CI, and CR fonts * roff(7) .if c conditional (character available) * roff(7) \\$@ escape sequence (insert all macro arguments, quoted) * roff(7) \*(.T predefined string (interpolate output device name) * roff(7) \[charNNN] escape sequence (for printable ASCII characters) * roff(7) \# escape sequence (line continuation with comment) --- HTML OUTPUT SYNTAX CORRECTIONS --- * Render .br and \p as <br/>, not as an empty <div>. * Render .Pp and .PP as <p> and automatically close it when needed. * Stop writing empty list elements for non-compact .Bl -tag lists. * Do not put <p> inside <a> if .UR or .MT contain .PP. * Implement tooltips purely in CSS rather than abusing title= attributes. --- MINOR FUNCTIONAL IMPROVEMENTS --- * many improvements to the handling of fill and no-fill mode * tbl(7): better column widths in the presence of horizontal spans * several minor improvements to escape sequence handling * several minor improvements to manual font handling * portability: autodetect need for _GNU_SOURCE or _OPENBSD_SOURCE * portability: autodetect whether less(1) supports the -T option * large numbers of bugfixes of diverse kinds --- STRUCTURAL IMPROVEMENTS --- * Disentangle eqn(7) and tbl(7) from other parser header files, and clean up some parser data structures. * Substantially simplify error and warning message infrastructure. --- THANKS TO --- * John Gardner for crucial help implementing tooltips in CSS. * Alexander Bluhm, Raphael Graf, Ted Unangst (OpenBSD) and Daniel Sabogal (Alpine Linux) for patches. * Anthony Bentley and Jason McIntyre (OpenBSD) for documentation patches, suggesting new features, bug reports, and useful discussions. * Kyle Evans and Baptiste Daroussin (FreeBSD) for minor patches. * Pali Rohar for suggesting multiple new features and for reporting several bugs and missing features. * Klemens Nanni (OpenBSD) for suggesting multiple new features. * Kristaps Dzonsons (bsd.lv), Marc Espie (OpenBSD), Adam Kalisz, and Laura Morales for suggesting new features. * Wolfram Schneider and Yuri Pankov (FreeBSD) for reporting missing features. * Edward Tomasz Napierala (FreeBSD) for suggesting a feature improvement. * Thomas Klausner (NetBSD) and Sevan Janiyan (SmartOS) for bug reports and release testing. * Bryan Steele, Janne Johansson, Kurt Mosiejczuk, Mike Belopuhov, Theo Buehler, Todd Miller (OpenBSD), Andreas Gustafsson, Christos Zoulas, Robert Elz (NetBSD), Kurt Jaeger (FreeBSD), Fabio Scotoni, Kelvin Sherlock, Mark Harris, Orestis Ioannou, Raf Czlonka, and Sean Farrell for bug reports. * Ulrich Spoerlein (FreeBSD), Leah Neukirchen (Void Linux), Matej Cepl (openSUSE), and Jan Stary (MacOS X) for release testing. * Brian Callahan and Stuart Henderson (OpenBSD) for help with the OpenBSD groff port. * Bertrand Garrigues, Branden Robinson, Ralph Corderoy, and Werner Lemberg (GNU troff) for checking groff patches. * Scott Cheloha, Theo de Raadt (OpenBSD) and Natanael Copa (Alpine Linux) for useful discussions.
123 lines
4.4 KiB
C
123 lines
4.4 KiB
C
/* Id: tbl.h,v 1.1 2018/12/12 21:54:35 schwarze Exp */
|
|
/*
|
|
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
|
|
* Copyright (c) 2014, 2015, 2017, 2018 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
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS 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.
|
|
*/
|
|
|
|
struct tbl_opts {
|
|
int opts;
|
|
#define TBL_OPT_ALLBOX (1 << 0) /* Option "allbox". */
|
|
#define TBL_OPT_BOX (1 << 1) /* Option "box". */
|
|
#define TBL_OPT_CENTRE (1 << 2) /* Option "center". */
|
|
#define TBL_OPT_DBOX (1 << 3) /* Option "doublebox". */
|
|
#define TBL_OPT_EXPAND (1 << 4) /* Option "expand". */
|
|
#define TBL_OPT_NOKEEP (1 << 5) /* Option "nokeep". */
|
|
#define TBL_OPT_NOSPACE (1 << 6) /* Option "nospaces". */
|
|
#define TBL_OPT_NOWARN (1 << 7) /* Option "nowarn". */
|
|
int cols; /* Number of columns. */
|
|
int lvert; /* Width of left vertical line. */
|
|
int rvert; /* Width of right vertical line. */
|
|
char tab; /* Option "tab": cell separator. */
|
|
char decimal; /* Option "decimalpoint". */
|
|
};
|
|
|
|
enum tbl_cellt {
|
|
TBL_CELL_CENTRE, /* c, C */
|
|
TBL_CELL_RIGHT, /* r, R */
|
|
TBL_CELL_LEFT, /* l, L */
|
|
TBL_CELL_NUMBER, /* n, N */
|
|
TBL_CELL_SPAN, /* s, S */
|
|
TBL_CELL_LONG, /* a, A */
|
|
TBL_CELL_DOWN, /* ^ */
|
|
TBL_CELL_HORIZ, /* _, - */
|
|
TBL_CELL_DHORIZ, /* = */
|
|
TBL_CELL_MAX
|
|
};
|
|
|
|
/*
|
|
* A cell in a layout row.
|
|
*/
|
|
struct tbl_cell {
|
|
struct tbl_cell *next; /* Layout cell to the right. */
|
|
char *wstr; /* Min width represented as a string. */
|
|
size_t width; /* Minimum column width. */
|
|
size_t spacing; /* To the right of the column. */
|
|
int vert; /* Width of subsequent vertical line. */
|
|
int col; /* Column number, starting from 0. */
|
|
int flags;
|
|
#define TBL_CELL_BOLD (1 << 0) /* b, B, fB */
|
|
#define TBL_CELL_ITALIC (1 << 1) /* i, I, fI */
|
|
#define TBL_CELL_TALIGN (1 << 2) /* t, T */
|
|
#define TBL_CELL_UP (1 << 3) /* u, U */
|
|
#define TBL_CELL_BALIGN (1 << 4) /* d, D */
|
|
#define TBL_CELL_WIGN (1 << 5) /* z, Z */
|
|
#define TBL_CELL_EQUAL (1 << 6) /* e, E */
|
|
#define TBL_CELL_WMAX (1 << 7) /* x, X */
|
|
enum tbl_cellt pos;
|
|
};
|
|
|
|
/*
|
|
* A layout row.
|
|
*/
|
|
struct tbl_row {
|
|
struct tbl_row *next; /* Layout row below. */
|
|
struct tbl_cell *first; /* Leftmost layout cell. */
|
|
struct tbl_cell *last; /* Rightmost layout cell. */
|
|
int vert; /* Width of left vertical line. */
|
|
};
|
|
|
|
enum tbl_datt {
|
|
TBL_DATA_NONE, /* Uninitialized row. */
|
|
TBL_DATA_DATA, /* Contains data rather than a line. */
|
|
TBL_DATA_HORIZ, /* _: connecting horizontal line. */
|
|
TBL_DATA_DHORIZ, /* =: connecting double horizontal line. */
|
|
TBL_DATA_NHORIZ, /* \_: isolated horizontal line. */
|
|
TBL_DATA_NDHORIZ /* \=: isolated double horizontal line. */
|
|
};
|
|
|
|
/*
|
|
* A cell within a row of data. The "string" field contains the
|
|
* actual string value that's in the cell. The rest is layout.
|
|
*/
|
|
struct tbl_dat {
|
|
struct tbl_dat *next; /* Data cell to the right. */
|
|
struct tbl_cell *layout; /* Associated layout cell. */
|
|
char *string; /* Data, or NULL if not TBL_DATA_DATA. */
|
|
int hspans; /* How many horizontal spans follow. */
|
|
int vspans; /* How many vertical spans follow. */
|
|
int block; /* T{ text block T} */
|
|
enum tbl_datt pos;
|
|
};
|
|
|
|
enum tbl_spant {
|
|
TBL_SPAN_DATA, /* Contains data rather than a line. */
|
|
TBL_SPAN_HORIZ, /* _: horizontal line. */
|
|
TBL_SPAN_DHORIZ /* =: double horizontal line. */
|
|
};
|
|
|
|
/*
|
|
* A row of data in a table.
|
|
*/
|
|
struct tbl_span {
|
|
struct tbl_opts *opts; /* Options for the table as a whole. */
|
|
struct tbl_span *prev; /* Data row above. */
|
|
struct tbl_span *next; /* Data row below. */
|
|
struct tbl_row *layout; /* Associated layout row. */
|
|
struct tbl_dat *first; /* Leftmost data cell. */
|
|
struct tbl_dat *last; /* Rightmost data cell. */
|
|
int line; /* Input file line number. */
|
|
enum tbl_spant pos;
|
|
};
|