source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Wrap text and phrasing elements in paragraphs unless already
Date: Tue, 3 Sep 2019 13:08:32 -0500 (EST)	[thread overview]
Message-ID: <862a95dd3fd16554@mandoc.bsd.lv> (raw)

Log Message:
-----------
Wrap text and phrasing elements in paragraphs unless already 
contained in flow containers; never put them directly into sections.
This helps to format paragraphs with the CSS class selector .Pp.

Suggested by bentley@ and also by Colin Watson <cjwatson at debian>         
via Michael Stapelberg <stapelberg at debian>,
see https://github.com/Debian/debiman/issues/116

Modified Files:
--------------
    mandoc:
        html.c

Revision Data
-------------
Index: html.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/html.c,v
retrieving revision 1.259
retrieving revision 1.260
diff -Lhtml.c -Lhtml.c -u -p -r1.259 -r1.260
--- html.c
+++ html.c
@@ -590,7 +590,15 @@ print_otag(struct html *h, enum htmltag 
 			assert((htmltags[t->tag].flags & HTML_TOPHRASE) == 0);
 			break;
 		}
-	}
+
+	/*
+	 * Always wrap phrasing elements in a paragraph
+	 * unless already contained in some flow container;
+	 * never put them directly into a section.
+	 */
+
+	} else if (tflags & HTML_TOPHRASE && h->tag->tag == TAG_SECTION)
+		print_otag(h, TAG_P, "c", "Pp");
 
 	/* Push this tag onto the stack of open scopes. */
 
@@ -796,6 +804,16 @@ print_gen_comment(struct html *h, struct
 void
 print_text(struct html *h, const char *word)
 {
+	/*
+	 * Always wrap text in a paragraph unless already contained in
+	 * some flow container; never put it directly into a section.
+	 */
+
+	if (h->tag->tag == TAG_SECTION)
+		print_otag(h, TAG_P, "c", "Pp");
+
+	/* Output whitespace before this text? */
+
 	if (h->col && (h->flags & HTML_NOSPACE) == 0) {
 		if ( ! (HTML_KEEP & h->flags)) {
 			if (HTML_PREKEEP & h->flags)
@@ -804,6 +822,11 @@ print_text(struct html *h, const char *w
 		} else
 			print_word(h, "&#x00A0;");
 	}
+
+	/*
+	 * Print the text, optionally surrounded by HTML whitespace,
+	 * optionally manually switching fonts before and after.
+	 */
 
 	assert(h->metaf == NULL);
 	print_metaf(h);
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

                 reply	other threads:[~2019-09-03 18:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=862a95dd3fd16554@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).