From 510b3c8287817db66b5cc52d4532763c113e341d Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Tue, 7 Mar 2017 13:28:02 +0000 Subject: [PATCH] fix spacing after empty .Fl --- mdoc_markdown.c | 14 ++++++++++++-- regress/mdoc/Fl/Makefile | 2 +- regress/mdoc/Fl/noarg.out_markdown | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/mdoc_markdown.c b/mdoc_markdown.c index 79d1f3dc..f6fb7fdf 100644 --- a/mdoc_markdown.c +++ b/mdoc_markdown.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_markdown.c,v 1.5 2017/03/07 13:09:27 schwarze Exp $ */ +/* $Id: mdoc_markdown.c,v 1.6 2017/03/07 13:28:02 schwarze Exp $ */ /* * Copyright (c) 2017 Ingo Schwarze * @@ -90,6 +90,7 @@ static void md_post_En(struct roff_node *); static void md_post_Eo(struct roff_node *); static void md_post_Fa(struct roff_node *); static void md_post_Fd(struct roff_node *); +static void md_post_Fl(struct roff_node *); static void md_post_Fn(struct roff_node *); static void md_post_Fo(struct roff_node *); static void md_post_In(struct roff_node *); @@ -126,7 +127,7 @@ static const struct md_act md_acts[MDOC_MAX + 1] = { { NULL, NULL, NULL, NULL, NULL }, /* Ex */ { NULL, md_pre_Fa, md_post_Fa, NULL, NULL }, /* Fa */ { NULL, md_pre_Fd, md_post_Fd, "**", "**" }, /* Fd */ - { NULL, md_pre_raw, md_post_raw, "**-", "**" }, /* Fl */ + { NULL, md_pre_raw, md_post_Fl, "**-", "**" }, /* Fl */ { NULL, md_pre_Fn, md_post_Fn, NULL, NULL }, /* Fn */ { NULL, md_pre_Fd, md_post_raw, "*", "*" }, /* Ft */ { NULL, md_pre_raw, md_post_raw, "**", "**" }, /* Ic */ @@ -1018,6 +1019,15 @@ md_post_Fd(struct roff_node *n) outflags |= MD_br; } +static void +md_post_Fl(struct roff_node *n) +{ + md_post_raw(n); + if (n->child == NULL && n->next != NULL && + n->next->type != ROFFT_TEXT && !(n->next->flags & NODE_LINE)) + outflags &= ~MD_spc; +} + static int md_pre_Fn(struct roff_node *n) { diff --git a/regress/mdoc/Fl/Makefile b/regress/mdoc/Fl/Makefile index b024856e..df24f7c0 100644 --- a/regress/mdoc/Fl/Makefile +++ b/regress/mdoc/Fl/Makefile @@ -1,6 +1,6 @@ # $OpenBSD: Makefile,v 1.8 2014/08/21 12:56:24 schwarze Exp $ REGRESS_TARGETS = noarg multiarg parsed punct font -MARKDOWN_TARGETS = noarg multiarg punct font +MARKDOWN_TARGETS = noarg multiarg parsed punct font .include diff --git a/regress/mdoc/Fl/noarg.out_markdown b/regress/mdoc/Fl/noarg.out_markdown index 9edc191d..7c023597 100644 --- a/regress/mdoc/Fl/noarg.out_markdown +++ b/regress/mdoc/Fl/noarg.out_markdown @@ -16,7 +16,7 @@ trailing punctuation **-**. Following macros -**-** \[flag] +**-**\[flag] follow without white space. OpenBSD - August 21, 2014 -- 2.47.1