diff options
author | wlemb <wlemb> | 2001-02-16 22:33:32 +0000 |
---|---|---|
committer | wlemb <wlemb> | 2001-02-16 22:33:32 +0000 |
commit | e3dd1745c2e7ced9ae4eac532d2a726c7cc95207 (patch) | |
tree | 54ab08acb1c021862f6569ce6adba816da6283f8 | |
parent | 7cc890e04f5191a59c8c9baf9e9802fbc9debe67 (diff) | |
download | groff-e3dd1745c2e7ced9ae4eac532d2a726c7cc95207.tar.gz |
Fixing a bug which prevented proper end-of-sentence recognition
between an `unformatted' box and the following text. As a
consequence, vertical line distances are no longer preserved in
boxes after a call to `.unformat' -- because boxes aren't
line-oriented (contrary to diversions), this doesn't make sense
anyway.
* src/roff/troff/node.cc (*node::set_unformat_flag): Add return
value.
(vertical_size_node::set_unformat_flag): New method.
* src/roff/troff/node.hh: Updated.
* src/roff/troff/input.cc (word_space_node::reread,
hmotion_node::reread): Reset `unformat' flag after usage.
(unformat_macro): Append only if `set_unformat_flag()' returns
non-zero.
* src/roff/troff/troff.man: Updated.
* src/roff/troff/troff.man, NEWS, man/groff.man: Improved
documentation of `asciify' and `unformat' requests.
-rw-r--r-- | ChangeLog | 24 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | man/groff.man | 4 | ||||
-rw-r--r-- | src/roff/troff/input.cc | 6 | ||||
-rw-r--r-- | src/roff/troff/node.cc | 14 | ||||
-rw-r--r-- | src/roff/troff/node.h | 7 | ||||
-rw-r--r-- | src/roff/troff/troff.man | 18 |
7 files changed, 62 insertions, 17 deletions
@@ -1,3 +1,27 @@ +2001-02-16 Werner LEMBERG <wl@gnu.org> + + Fixing a bug which prevented proper end-of-sentence recognition + between an `unformatted' box and the following text. As a + consequence, vertical line distances are no longer preserved in + boxes after a call to `.unformat' -- because boxes aren't + line-oriented (contrary to diversions), this doesn't make sense + anyway. + + * src/roff/troff/node.cc (*node::set_unformat_flag): Add return + value. + (vertical_size_node::set_unformat_flag): New method. + * src/roff/troff/node.hh: Updated. + * src/roff/troff/input.cc (word_space_node::reread, + hmotion_node::reread): Reset `unformat' flag after usage. + (unformat_macro): Append only if `set_unformat_flag()' returns + non-zero. + * src/roff/troff/troff.man: Updated. + +2001-02-15 Werner LEMBERG <wl@gnu.org> + + * src/roff/troff/troff.man, NEWS, man/groff.man: Improved + documentation of `asciify' and `unformat' requests. + 2001-02-13 Werner LEMBERG <wl@gnu.org> Redesigned the `unformat' request. It is no longer connected with @@ -43,13 +43,13 @@ o `box' and `boxa' are two new requests which behave similarly to `di' and ending the diversion). o The `asciify' request has been extended to `unformat' space characters - also. + and some other escape sequences also. `\ ' will no longer be unformatted as a space but remains an unpaddable, unbreakable space character. -o The new `unformat' request is similar to `asciify' but only converts - (formatted) horizontal space back to its input form, retaining font +o The new `unformat' request is similar to `asciify' but only handles space + characters and tabs specially if the diversion is reread, retaining font information. This makes it possible to reformat diversions; for example the following diff --git a/man/groff.man b/man/groff.man index 15332a5a..7b23cba4 100644 --- a/man/groff.man +++ b/man/groff.man @@ -873,7 +873,7 @@ to .argument stringvar . . .REQ .asciify diversion -Unformat ASCII characters and spaces in +Unformat ASCII characters, spaces, and some escape sequences in .argument diversion . . .REQ .backtrace @@ -1714,7 +1714,7 @@ Underline (italicize in troff) input lines. . .REQ .unformat diversion -Unformat horizontal space (no glyphs) in +Unformat space characters and tabs, preserving font information in .argument diversion . .REQ .vpt n Enable vertical position traps if diff --git a/src/roff/troff/input.cc b/src/roff/troff/input.cc index a1673855..85bf4735 100644 --- a/src/roff/troff/input.cc +++ b/src/roff/troff/input.cc @@ -2136,6 +2136,7 @@ int word_space_node::reread(int *bolp) if (unformat) { for (width_list *w = orig_width; w; w = w->next) curenv->space(w->width, w->sentence_width); + unformat = 0; return 1; } return 0; @@ -2150,6 +2151,7 @@ int hmotion_node::reread(int *bolp) { if (unformat && was_tab) { curenv->handle_tab(0); + unformat = 0; return 1; } return 0; @@ -3748,8 +3750,8 @@ void unformat_macro() if (c != 0) am.append(c); else { - nd->set_unformat_flag(); - am.append(nd); + if (nd->set_unformat_flag()) + am.append(nd); } } *m = am; diff --git a/src/roff/troff/node.cc b/src/roff/troff/node.cc index 02db5b56..e3e37777 100644 --- a/src/roff/troff/node.cc +++ b/src/roff/troff/node.cc @@ -2849,8 +2849,9 @@ vunits vmotion_node::vertical_width() return n; } -void node::set_unformat_flag() +int node::set_unformat_flag() { + return 1; } int node::character_type() @@ -3733,9 +3734,10 @@ node *word_space_node::copy() return new word_space_node(n, set, w_new, unformat); } -void word_space_node::set_unformat_flag() +int word_space_node::set_unformat_flag() { unformat = 1; + return 1; } void word_space_node::tprint(troff_output_file *out) @@ -4396,6 +4398,11 @@ const char *vertical_size_node::type() return "vertical_size_node"; } +int vertical_size_node::set_unformat_flag() +{ + return 0; +} + int vertical_size_node::force_tprint() { return 0; @@ -4411,9 +4418,10 @@ const char *hmotion_node::type() return "hmotion_node"; } -void hmotion_node::set_unformat_flag() +int hmotion_node::set_unformat_flag() { unformat = 1; + return 1; } int hmotion_node::force_tprint() diff --git a/src/roff/troff/node.h b/src/roff/troff/node.h index ac80b967..77076e7b 100644 --- a/src/roff/troff/node.h +++ b/src/roff/troff/node.h @@ -57,7 +57,7 @@ struct node { virtual ~node(); virtual node *copy() = 0; - virtual void set_unformat_flag(); + virtual int set_unformat_flag(); virtual int force_tprint() = 0; virtual hunits width(); virtual hunits subscript_correction(); @@ -197,7 +197,7 @@ public: ~word_space_node(); node *copy(); int reread(int *); - void set_unformat_flag(); + int set_unformat_flag(); void tprint(troff_output_file *); int same(node *); void asciify(macro *); @@ -267,6 +267,7 @@ public: void set_vertical_size(vertical_size *); void asciify(macro *); node *copy(); + int set_unformat_flag(); int same(node *); const char *type(); int force_tprint(); @@ -284,7 +285,7 @@ public: : node(next), n(i), was_tab(flag1), unformat(flag2) {} node *copy(); int reread(int *); - void set_unformat_flag(); + int set_unformat_flag(); void asciify(macro *); void tprint(troff_output_file *); hunits width(); diff --git a/src/roff/troff/troff.man b/src/roff/troff/troff.man index 548533d1..7b57ee08 100644 --- a/src/roff/troff/troff.man +++ b/src/roff/troff/troff.man @@ -744,7 +744,8 @@ This request `unformats' the diversion .I xx in such a way that .SM ASCII -and space characters that were formatted and diverted into +and space characters (and some escape sequences) that were formatted and +diverted into .I xx will be treated like ordinary input characters when .I xx @@ -1553,9 +1554,18 @@ request. .TP .BI .unformat\ xx This request `unformats' the diversion -.IR xx , -converting all horizontal space back into input characters. -Glyph information (font, font size, etc.) is retained. +.IR xx . +Contrary to the +.B .asciify +request, which tries to convert formatted elements of the diversion back +to input tokens as much as possible, +.B .unformat +will only handle tabs and spaces between words (usually caused by spaces +or newlines in the input) specially. +The former are treated as if they were input tokens, and the latter are +stretchable again. +Note that the vertical size of lines is not preserved. +Glyph information (font, font size, space width, etc.) is retained. Useful in conjunction with the .B .box and |