From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: URIs need different escaping; reported by reyk@
Date: Mon, 6 Mar 2017 09:58:43 -0500 (EST) [thread overview]
Message-ID: <17582693521364594518.enqueue@fantadrom.bsd.lv> (raw)
Log Message:
-----------
URIs need different escaping; reported by reyk@
Modified Files:
--------------
mdocml:
mdoc_markdown.c
mdocml/regress/mdoc/Rs:
allch.out_markdown
Revision Data
-------------
Index: mdoc_markdown.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_markdown.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lmdoc_markdown.c -Lmdoc_markdown.c -u -p -r1.2 -r1.3
--- mdoc_markdown.c
+++ mdoc_markdown.c
@@ -220,7 +220,7 @@ static const struct md_act md_acts[MDOC_
{ NULL, NULL, md_post_pc, NULL, NULL }, /* %Q */
{ NULL, md_pre_br, NULL, NULL, NULL }, /* br */
{ NULL, md_pre_Pp, NULL, NULL, NULL }, /* sp */
- { NULL, NULL, md_post_pc, NULL, NULL }, /* %U */
+ { NULL, md_pre_Lk, md_post_pc, NULL, NULL }, /* %U */
{ NULL, NULL, NULL, NULL, NULL }, /* Ta */
{ NULL, NULL, NULL, NULL, NULL }, /* ll */
{ NULL, NULL, NULL, NULL, NULL }, /* ROOT */
@@ -1235,6 +1235,7 @@ static int
md_pre_Lk(struct roff_node *n)
{
const struct roff_node *link, *descr;
+ const unsigned char *s;
if ((link = n->child) == NULL)
return 0;
@@ -1251,8 +1252,16 @@ md_pre_Lk(struct roff_node *n)
} else
md_rawword("<");
- outflags &= ~MD_spc;
- md_word(link->string);
+ for (s = link->string; *s != '\0'; s++) {
+ if (strchr("%)<>", *s) != NULL) {
+ printf("%%%2.2hhX", *s);
+ outcount += 3;
+ } else {
+ putchar(*s);
+ outcount++;
+ }
+ }
+
outflags &= ~MD_spc;
md_rawword(link->next == NULL ? ">" : ")");
return 0;
Index: allch.out_markdown
===================================================================
RCS file: /home/cvs/mdocml/mdocml/regress/mdoc/Rs/allch.out_markdown,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lregress/mdoc/Rs/allch.out_markdown -Lregress/mdoc/Rs/allch.out_markdown -u -p -r1.1 -r1.2
--- regress/mdoc/Rs/allch.out_markdown
+++ regress/mdoc/Rs/allch.out_markdown
@@ -18,7 +18,7 @@ author name,
report name,
number of journal,
volume number,
-uniform resource locator,
+<uniform resource locator>,
page number,
institutional author,
city name,
@@ -40,7 +40,7 @@ author name,
report name,
number of journal,
volume number,
-uniform resource locator,
+<uniform resource locator>,
page number,
institutional author,
city name,
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
reply other threads:[~2017-03-06 14:58 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=17582693521364594518.enqueue@fantadrom.bsd.lv \
--to=schwarze@mdocml.bsd.lv \
--cc=source@mdocml.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).