source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Add support for `Sm' in -T[x]html -mdoc.
@ 2010-07-23  0:08 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-07-23  0:08 UTC (permalink / raw)
  To: source

Log Message:
-----------
Add support for `Sm' in -T[x]html -mdoc.

Modified Files:
--------------
    mdocml:
        html.c
        html.h
        mdoc_html.c

Revision Data
-------------
Index: html.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lhtml.h -Lhtml.h -u -p -r1.26 -r1.27
--- html.h
+++ html.h
@@ -113,6 +113,7 @@ struct	html {
 #define	HTML_IGNDELIM	 (1 << 1)
 #define	HTML_KEEP	 (1 << 2)
 #define	HTML_PREKEEP	 (1 << 3)
+#define	HTML_NONOSPACE	 (1 << 4)
 	struct tagq	  tags;
 	struct ordq	  ords;
 	void		 *symtab;
Index: html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/html.c,v
retrieving revision 1.108
retrieving revision 1.109
diff -Lhtml.c -Lhtml.c -u -p -r1.108 -r1.109
--- html.c
+++ html.c
@@ -417,6 +417,9 @@ print_otag(struct html *h, enum htmltag 
 				printf("&#160;");
 		}
 
+	if ( ! (h->flags & HTML_NONOSPACE))
+		h->flags &= ~HTML_NOSPACE;
+
 	/* Print out the tag name and attributes. */
 
 	printf("<%s", htmltags[tag].name);
@@ -544,7 +547,8 @@ print_text(struct html *h, const char *w
 
 	assert(word);
 	if ( ! print_encode(h, word, 0))
-		h->flags &= ~HTML_NOSPACE;
+		if ( ! (h->flags & HTML_NONOSPACE))
+			h->flags &= ~HTML_NOSPACE;
 
 	/* 
 	 * Note that we don't process the pipe: the parser sees it as
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.98 -r1.99
--- mdoc_html.c
+++ mdoc_html.c
@@ -125,6 +125,7 @@ static	int		  mdoc_pq_pre(MDOC_ARGS);
 static	int		  mdoc_rs_pre(MDOC_ARGS);
 static	int		  mdoc_rv_pre(MDOC_ARGS);
 static	int		  mdoc_sh_pre(MDOC_ARGS);
+static	int		  mdoc_sm_pre(MDOC_ARGS);
 static	int		  mdoc_sp_pre(MDOC_ARGS);
 static	void		  mdoc_sq_post(MDOC_ARGS);
 static	int		  mdoc_sq_pre(MDOC_ARGS);
@@ -227,7 +228,7 @@ static	const struct htmlmdoc mdocs[MDOC_
 	{NULL, NULL}, /* Sc */
 	{mdoc_sq_pre, mdoc_sq_post}, /* So */
 	{mdoc_sq_pre, mdoc_sq_post}, /* Sq */
-	{NULL, NULL}, /* Sm */ /* FIXME - no idea. */
+	{mdoc_sm_pre, NULL}, /* Sm */ 
 	{mdoc_sx_pre, NULL}, /* Sx */
 	{mdoc_sy_pre, NULL}, /* Sy */
 	{NULL, NULL}, /* Tn */
@@ -1715,6 +1716,23 @@ mdoc_fn_pre(MDOC_ARGS)
 	print_text(h, ")");
 	if (MDOC_SYNPRETTY & n->flags)
 		print_text(h, ";");
+
+	return(0);
+}
+
+
+/* ARGSUSED */
+static int
+mdoc_sm_pre(MDOC_ARGS)
+{
+
+	assert(n->child && MDOC_TEXT == n->child->type);
+	if (0 == strcmp("on", n->child->string)) {
+		/* FIXME: no p->col to check... */
+		h->flags &= ~HTML_NOSPACE;
+		h->flags &= ~HTML_NONOSPACE;
+	} else
+		h->flags |= HTML_NONOSPACE;
 
 	return(0);
 }
--
 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:[~2010-07-23  0:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-23  0:08 mdocml: Add support for `Sm' in -T[x]html -mdoc kristaps

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