* mdocml: Fix the implementation and documentation of \c (continue text
@ 2014-12-02 10:08 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-12-02 10:08 UTC (permalink / raw)
To: source
Log Message:
-----------
Fix the implementation and documentation of \c (continue text input line).
In particular, make it work in no-fill mode, too.
Reminded by Carsten dot Kunze at arcor dot de (Heirloom roff).
Modified Files:
--------------
mdocml:
TODO
html.c
html.h
man_html.c
man_term.c
mdoc_html.c
mdoc_term.c
roff.7
term.c
term.h
Revision Data
-------------
Index: html.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/html.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -Lhtml.h -Lhtml.h -u -p -r1.69 -r1.70
--- html.h
+++ html.h
@@ -126,6 +126,7 @@ struct html {
#define HTML_SKIPCHAR (1 << 6) /* skip the next character */
#define HTML_NOSPLIT (1 << 7) /* do not break line before .An */
#define HTML_SPLIT (1 << 8) /* break line before .An */
+#define HTML_NONEWLINE (1 << 9) /* No line break in nofill mode. */
struct tagq tags; /* stack of open tags */
struct rofftbl tbl; /* current table */
struct tag *tblt; /* current open table scope */
Index: man_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_html.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -Lman_html.c -Lman_html.c -u -p -r1.105 -r1.106
--- man_html.c
+++ man_html.c
@@ -212,21 +212,14 @@ print_man_node(MAN_ARGS)
man_root_pre(man, n, mh, h);
break;
case MAN_TEXT:
- /*
- * If we have a blank line, output a vertical space.
- * If we have a space as the first character, break
- * before printing the line's data.
- */
if ('\0' == *n->string) {
print_paragraph(h);
return;
}
-
- if (' ' == *n->string && MAN_LINE & n->flags)
+ if (n->flags & MAN_LINE && (*n->string == ' ' ||
+ (n->prev != NULL && mh->fl & MANH_LITERAL &&
+ ! (h->flags & HTML_NONEWLINE))))
print_otag(h, TAG_BR, 0, NULL);
- else if (MANH_LITERAL & mh->fl && n->prev)
- print_otag(h, TAG_BR, 0, NULL);
-
print_text(h, n->string);
return;
case MAN_EQN:
Index: term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term.c,v
retrieving revision 1.236
retrieving revision 1.237
diff -Lterm.c -Lterm.c -u -p -r1.236 -r1.237
--- term.c
+++ term.c
@@ -417,7 +417,7 @@ term_word(struct termp *p, const char *w
else
p->flags |= TERMP_NOSPACE;
- p->flags &= ~TERMP_SENTENCE;
+ p->flags &= ~(TERMP_SENTENCE | TERMP_NONEWLINE);
while ('\0' != *word) {
if ('\\' != *word) {
@@ -487,7 +487,7 @@ term_word(struct termp *p, const char *w
if (TERMP_SKIPCHAR & p->flags)
p->flags &= ~TERMP_SKIPCHAR;
else if ('\0' == *word)
- p->flags |= TERMP_NOSPACE;
+ p->flags |= (TERMP_NOSPACE | TERMP_NONEWLINE);
continue;
case ESCAPE_SKIPCHAR:
p->flags |= TERMP_SKIPCHAR;
Index: mdoc_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v
retrieving revision 1.298
retrieving revision 1.299
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.298 -r1.299
--- mdoc_term.c
+++ mdoc_term.c
@@ -1632,7 +1632,8 @@ termp_bd_pre(DECL_ARGS)
default:
break;
}
- if (nn->next && nn->next->line == nn->line)
+ if (p->flags & TERMP_NONEWLINE ||
+ (nn->next && ! (nn->next->flags & MDOC_LINE)))
continue;
term_flushln(p);
p->flags |= TERMP_NOSPACE;
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.215
retrieving revision 1.216
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.215 -r1.216
--- mdoc_html.c
+++ mdoc_html.c
@@ -1201,7 +1201,8 @@ mdoc_bd_pre(MDOC_ARGS)
default:
break;
}
- if (nn->next && nn->next->line == nn->line)
+ if (h->flags & HTML_NONEWLINE ||
+ (nn->next && ! (nn->next->flags & MDOC_LINE)))
continue;
else if (nn->next)
print_text(h, "\n");
Index: man_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_term.c,v
retrieving revision 1.156
retrieving revision 1.157
diff -Lman_term.c -Lman_term.c -u -p -r1.156 -r1.157
--- man_term.c
+++ man_term.c
@@ -1018,13 +1018,14 @@ out:
* -man doesn't have nested macros, we don't need to be
* more specific than this.
*/
- if (MANT_LITERAL & mt->fl && ! (TERMP_NOBREAK & p->flags) &&
- (NULL == n->next || MAN_LINE & n->next->flags)) {
+ if (mt->fl & MANT_LITERAL &&
+ ! (p->flags & (TERMP_NOBREAK | TERMP_NONEWLINE)) &&
+ (n->next == NULL || n->next->flags & MAN_LINE)) {
rm = p->rmargin;
rmax = p->maxrmargin;
p->rmargin = p->maxrmargin = TERM_MAXMARGIN;
p->flags |= TERMP_NOSPACE;
- if (NULL != n->string && '\0' != *n->string)
+ if (n->string != NULL && *n->string != '\0')
term_flushln(p);
else
term_newln(p);
Index: TODO
===================================================================
RCS file: /home/cvs/mdocml/mdocml/TODO,v
retrieving revision 1.189
retrieving revision 1.190
diff -LTODO -LTODO -u -p -r1.189 -r1.190
--- TODO
+++ TODO
@@ -83,11 +83,6 @@ are mere guesses, and some may be wrong.
found by jca@ in ratpoison(1) Sun, 30 Jun 2013 12:01:09 +0200
loc * exist ** algo ** size ** imp **
-- \c (interrupted text) should prevent the line break
- even inside .Bd literal; that occurs in chat(8)
- also found in cclive(1) - DocBook output
- loc ** exist *** algo ** size * imp *
-
- \h horizontal move
found in cclive(1) DocBook output
Anthony J. Bentley on discuss@ Sat, 21 Sep 2013 22:29:34 -0600
Index: html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/html.c,v
retrieving revision 1.182
retrieving revision 1.183
diff -Lhtml.c -Lhtml.c -u -p -r1.182 -r1.183
--- html.c
+++ html.c
@@ -562,8 +562,9 @@ print_text(struct html *h, const char *w
if ( ! print_encode(h, word, 0)) {
if ( ! (h->flags & HTML_NONOSPACE))
h->flags &= ~HTML_NOSPACE;
+ h->flags &= ~HTML_NONEWLINE;
} else
- h->flags |= HTML_NOSPACE;
+ h->flags |= HTML_NOSPACE | HTML_NONEWLINE;
if (h->metaf) {
print_tagq(h, h->metaf);
Index: roff.7
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.7,v
retrieving revision 1.59
retrieving revision 1.60
diff -Lroff.7 -Lroff.7 -u -p -r1.59 -r1.60
--- roff.7
+++ roff.7
@@ -1196,8 +1196,10 @@ Bracket building function; ignored by
.Sx Special Characters
with names of arbitrary length.
.Ss \ec
-Interrupt text processing to insert requests or macros; ignored by
-.Xr mandoc 1 .
+When encountered at the end of an input text line,
+the next input text line is considered to continue that line,
+even if there are request or macro lines in between.
+No whitespace is inserted.
.Ss \eD\(aq Ns Ar string Ns \(aq
Draw graphics function; ignored by
.Xr mandoc 1 .
Index: term.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/term.h,v
retrieving revision 1.107
retrieving revision 1.108
diff -Lterm.h -Lterm.h -u -p -r1.107 -r1.108
--- term.h
+++ term.h
@@ -79,6 +79,7 @@ struct termp {
#define TERMP_HANG (1 << 11) /* See term_flushln(). */
#define TERMP_NOSPLIT (1 << 12) /* Do not break line before .An. */
#define TERMP_SPLIT (1 << 13) /* Break line before .An. */
+#define TERMP_NONEWLINE (1 << 14) /* No line break in nofill mode. */
int *buf; /* Output buffer. */
enum termenc enc; /* Type of encoding. */
const struct mchars *symtab; /* Character table. */
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-02 10:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-02 10:08 mdocml: Fix the implementation and documentation of \c (continue text schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).