tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Is there any reason not to use <EM> for items emphasized with .Em?
@ 2014-08-12 22:44 Guy Harris
  2014-08-13  1:15 ` Ingo Schwarze
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Guy Harris @ 2014-08-12 22:44 UTC (permalink / raw)
  To: tech

.Em is documented in the groff_mdoc man page as

  Emphasis Macro
    Text may be stressed or emphasized with the `.Em' macro.  The usual font
    for emphasis is italic.

That sounds like the <EM> HTML tag - the HTML 4.01 spec says

	EM:
	Indicates emphasis.

		...

	The presentation of phrase elements depends on the user agent. Generally, visual user agents present EM text in italics and STRONG text in bold font. Speech synthesizer user agents may change the synthesis parameters, such as volume, pitch and rate accordingly.

Is there any reason not to use that tag for text emphasized with .Em?

If not, here's a patch:
 
diff -Nup ../mdocml-1.13.1/example.style.css ./example.style.css
--- ../mdocml-1.13.1/example.style.css	2014-08-10 10:26:46.000000000 -0700
+++ ./example.style.css	2014-08-12 14:04:22.000000000 -0700
@@ -30,7 +30,7 @@ div.mandoc .list		{ } /* All Bl. */
 div.mandoc i			{ } /* Italic: BI, IB, I, (implicit). */
 div.mandoc b			{ } /* Bold: SB, BI, IB, BR, RB, B, (implicit). */
 div.mandoc small		{ } /* Small: SB, SM. */
-div.mandoc .emph		{ font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */
+div.mandoc em			{ font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */
 div.mandoc .symb		{ font-style: normal; font-weight: bold; } /* Symbolic: Sy, Ms, Bf -symbolic. */
 div.mandoc .lit			{ font-style: normal; font-weight: normal; font-family: monospace; } /* Literal: Dl, Li, Ql, Bf -literal, Bl -literal, Bl -unfilled. */
 div.mandoc i.addr		{ font-weight: normal; } /* Address (Ad). */
diff -Nup ../mdocml-1.13.1/html.c ./html.c
--- ../mdocml-1.13.1/html.c	2014-08-10 10:26:46.000000000 -0700
+++ ./html.c	2014-08-12 14:04:22.000000000 -0700
@@ -76,6 +76,7 @@ static	const struct htmldata htmltags[TA
 	{"i",		0 }, /* TAG_I */
 	{"code",	0 }, /* TAG_CODE */
 	{"small",	0 }, /* TAG_SMALL */
+	{"em",		0 }, /* TAG_EM */
 };
 
 static	const char	*const htmlattrs[ATTR_MAX] = {
diff -Nup ../mdocml-1.13.1/html.h ./html.h
--- ../mdocml-1.13.1/html.h	2014-08-10 10:26:46.000000000 -0700
+++ ./html.h	2014-08-12 14:04:22.000000000 -0700
@@ -50,6 +50,7 @@ enum	htmltag {
 	TAG_I,
 	TAG_CODE,
 	TAG_SMALL,
+	TAG_EM,
 	TAG_MAX
 };
 
diff -Nup ../mdocml-1.13.1/mdoc_html.c ./mdoc_html.c
--- ../mdocml-1.13.1/mdoc_html.c	2014-08-10 10:26:46.000000000 -0700
+++ ./mdoc_html.c	2014-08-12 15:40:03.000000000 -0700
@@ -1085,10 +1085,7 @@ mdoc_ex_pre(MDOC_ARGS)
 static int
 mdoc_em_pre(MDOC_ARGS)
 {
-	struct htmlpair	tag;
-
-	PAIR_CLASS_INIT(&tag, "emph");
-	print_otag(h, TAG_SPAN, 1, &tag);
+	print_otag(h, TAG_EM, 0, NULL);
 	return(1);
 }
 
@@ -1824,9 +1821,7 @@ mdoc_bf_pre(MDOC_ARGS)
 	else if (MDOC_BODY != n->type)
 		return(1);
 
-	if (FONT_Em == n->norm->Bf.font)
-		PAIR_CLASS_INIT(&tag[0], "emph");
-	else if (FONT_Sy == n->norm->Bf.font)
+	if (FONT_Sy == n->norm->Bf.font)
 		PAIR_CLASS_INIT(&tag[0], "symb");
 	else if (FONT_Li == n->norm->Bf.font)
 		PAIR_CLASS_INIT(&tag[0], "lit");
@@ -1844,6 +1839,10 @@ mdoc_bf_pre(MDOC_ARGS)
 	bufcat_su(h, "margin-left", &su);
 	PAIR_STYLE_INIT(&tag[1], h);
 	print_otag(h, TAG_DIV, 2, tag);
+	if (FONT_Em == n->norm->Bf.font) {
+		/* Tag this with <EM>. */
+		print_otag(h, TAG_EM, 0, NULL);
+	}
 	return(1);
 }
 
diff -Nup ../mdocml-1.13.1/style.css ./style.css
--- ../mdocml-1.13.1/style.css	2014-08-10 10:26:46.000000000 -0700
+++ ./style.css	2014-08-12 14:04:22.000000000 -0700
@@ -34,7 +34,7 @@ td.head-rtitle	{ width: 10%; text-align:
 /* General font modes. */
 
 i		{ } /* Italic: BI, IB, I, (implicit). */
-.emph		{ font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */
+em		{ font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */
 b		{ } /* Bold: SB, BI, IB, BR, RB, B, (implicit). */
 .symb		{ font-style: normal; font-weight: bold; } /* Symbolic: Sy, Ms, Bf -symbolic. */
 small		{ } /* Small: SB, SM. */


--
 To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] 13+ messages in thread
* Is there any reason not to use <EM> for items emphasized with .Em?
@ 2012-12-21  0:30 Guy Harris
  0 siblings, 0 replies; 13+ messages in thread
From: Guy Harris @ 2012-12-21  0:30 UTC (permalink / raw)
  To: tech

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

.Em is documented in the groff_mdoc man page as

   Emphasis Macro
     Text may be stressed or emphasized with the `.Em' macro.  The usual font
     for emphasis is italic.

That sounds like the <EM> HTML tag - the HTML 4.01 spec says

	EM:
	Indicates emphasis.

		...

	The presentation of phrase elements depends on the user agent. Generally, visual user agents present EM text in italics and STRONG text in bold font. Speech synthesizer user agents may change the synthesis parameters, such as volume, pitch and rate accordingly.

Is there any reason not to use that tag for text emphasized with .Em?

If not, see the attached patch.

(BTW, is there anonymous CVS access to the source repository?  I got the top-of-trunk source with a pile of curl calls from the cvsweb site, but that's kind of a pain.)


[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 2733 bytes --]

--- example.style.css.dist	2012-12-18 19:40:25.000000000 -0800
+++ example.style.css	2012-12-20 16:25:33.000000000 -0800
@@ -30,7 +30,7 @@
 div.mandoc i			{ } /* Italic: BI, IB, I, (implicit). */
 div.mandoc b			{ } /* Bold: SB, BI, IB, BR, RB, B, (implicit). */
 div.mandoc small		{ } /* Small: SB, SM. */
-div.mandoc .emph		{ font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */
+div.mandoc em			{ font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */
 div.mandoc .symb		{ font-style: normal; font-weight: bold; } /* Symbolic: Sy, Ms, Bf -symbolic. */
 div.mandoc .lit			{ font-style: normal; font-weight: normal; font-family: monospace; } /* Literal: Dl, Li, Ql, Bf -literal, Bl -literal, Bl -unfilled. */
 div.mandoc i.addr		{ font-weight: normal; } /* Address (Ad). */
--- html.c.dist	2012-12-18 19:40:27.000000000 -0800
+++ html.c	2012-12-20 14:40:51.000000000 -0800
@@ -75,6 +75,7 @@
 	{"i",		0 }, /* TAG_I */
 	{"code",	0 }, /* TAG_CODE */
 	{"small",	0 }, /* TAG_SMALL */
+	{"em",		0 }, /* TAG_EM */
 };
 
 static	const char	*const htmlattrs[ATTR_MAX] = {
--- html.h.dist	2012-12-18 19:40:27.000000000 -0800
+++ html.h	2012-12-20 14:41:05.000000000 -0800
@@ -50,6 +50,7 @@
 	TAG_I,
 	TAG_CODE,
 	TAG_SMALL,
+	TAG_EM,
 	TAG_MAX
 };
 
--- mdoc_html.c.dist	2012-12-18 19:40:51.000000000 -0800
+++ mdoc_html.c	2012-12-20 16:26:52.000000000 -0800
@@ -1112,10 +1112,7 @@
 static int
 mdoc_em_pre(MDOC_ARGS)
 {
-	struct htmlpair	tag;
-
-	PAIR_CLASS_INIT(&tag, "emph");
-	print_otag(h, TAG_SPAN, 1, &tag);
+	print_otag(h, TAG_EM, 0, NULL);
 	return(1);
 }
 
@@ -1892,9 +1889,7 @@
 	else if (MDOC_BODY != n->type)
 		return(1);
 
-	if (FONT_Em == n->norm->Bf.font) 
-		PAIR_CLASS_INIT(&tag[0], "emph");
-	else if (FONT_Sy == n->norm->Bf.font) 
+	if (FONT_Sy == n->norm->Bf.font) 
 		PAIR_CLASS_INIT(&tag[0], "symb");
 	else if (FONT_Li == n->norm->Bf.font) 
 		PAIR_CLASS_INIT(&tag[0], "lit");
@@ -1912,6 +1907,10 @@
 	bufcat_su(h, "margin-left", &su);
 	PAIR_STYLE_INIT(&tag[1], h);
 	print_otag(h, TAG_DIV, 2, tag);
+	if (FONT_Em == n->norm->Bf.font) {
+		/* Tag this with <EM>. */
+		print_otag(h, TAG_EM, 0, NULL);
+	}
 	return(1);
 }
 
--- style.css.dist	2012-12-18 19:41:01.000000000 -0800
+++ style.css	2012-12-20 16:24:17.000000000 -0800
@@ -34,7 +34,7 @@
 /* General font modes. */
 
 i		{ } /* Italic: BI, IB, I, (implicit). */
-.emph		{ font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */
+em		{ font-style: italic; font-weight: normal; } /* Emphasis: Em, Bl -emphasis. */
 b		{ } /* Bold: SB, BI, IB, BR, RB, B, (implicit). */
 .symb		{ font-style: normal; font-weight: bold; } /* Symbolic: Sy, Ms, Bf -symbolic. */
 small		{ } /* Small: SB, SM. */

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-08-14  0:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-12 22:44 Is there any reason not to use <EM> for items emphasized with .Em? Guy Harris
2014-08-13  1:15 ` Ingo Schwarze
2014-08-13  2:06   ` Anthony J. Bentley
2014-08-13 14:51     ` Ingo Schwarze
2014-08-13 15:17       ` Anthony J. Bentley
2014-08-13 17:49         ` Ingo Schwarze
2014-08-13  1:44 ` Joerg Sonnenberger
2014-08-13 15:30   ` Ingo Schwarze
2014-08-13 17:20 ` Ingo Schwarze
2014-08-13 18:53   ` Guy Harris
2014-08-13 23:24   ` Kristaps Dzonsons
2014-08-14  0:46     ` Ingo Schwarze
  -- strict thread matches above, loose matches on Subject: below --
2012-12-21  0:30 Guy Harris

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).