Skip to content

Commit

Permalink
Don't allow URLs to be hyphenated
Browse files Browse the repository at this point in the history
  • Loading branch information
apjanke committed Jan 8, 2019
1 parent 49b9a08 commit 74a1321
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions lib/ronn/roff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ def inline_filter(node)
inline_filter(node.children)
elsif node.has_attribute?('data-bare-link')
write '\fI'
inline_filter(node.children)
write '\%' + escape(node.attributes['href'].content)
write '\fR'
else
inline_filter(node.children)
write ' '
write '\fI'
write escape(node.attributes['href'].content)
write '\%' + escape(node.attributes['href'].content)
write '\fR'
end

Expand Down
12 changes: 6 additions & 6 deletions test/markdown_syntax.roff
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Inline markup like _italics_, **bold**, and `code()`\.
.SS "Philosophy"
Markdown is intended to be as easy\-to\-read and easy\-to\-write as is feasible\.
.P
Readability, however, is emphasized above all else\. A Markdown\-formatted document should be publishable as\-is, as plain text, without looking like it\'s been marked up with tags or formatting instructions\. While Markdown\'s syntax has been influenced by several existing text\-to\-HTML filters \-\- including Setext \fIhttp://docutils\.sourceforge\.net/mirror/setext\.html\fR, atx \fIhttp://www\.aaronsw\.com/2002/atx/\fR, Textile \fIhttp://textism\.com/tools/textile/\fR, reStructuredText \fIhttp://docutils\.sourceforge\.net/rst\.html\fR, Grutatext \fIhttp://www\.triptico\.com/software/grutatxt\.html\fR, and EtText \fIhttp://ettext\.taint\.org/doc/\fR \-\- the single biggest source of inspiration for Markdown\'s syntax is the format of plain text email\.
Readability, however, is emphasized above all else\. A Markdown\-formatted document should be publishable as\-is, as plain text, without looking like it\'s been marked up with tags or formatting instructions\. While Markdown\'s syntax has been influenced by several existing text\-to\-HTML filters \-\- including Setext \fI\%http://docutils\.sourceforge\.net/mirror/setext\.html\fR, atx \fI\%http://www\.aaronsw\.com/2002/atx/\fR, Textile \fI\%http://textism\.com/tools/textile/\fR, reStructuredText \fI\%http://docutils\.sourceforge\.net/rst\.html\fR, Grutatext \fI\%http://www\.triptico\.com/software/grutatxt\.html\fR, and EtText \fI\%http://ettext\.taint\.org/doc/\fR \-\- the single biggest source of inspiration for Markdown\'s syntax is the format of plain text email\.
.P
To this end, Markdown\'s syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like what they mean\. E\.g\., asterisks around a word actually look like *emphasis*\. Markdown lists look like, well, lists\. Even blockquotes look like quoted passages of text, assuming you\'ve ever used email\.
.SS "Inline HTML"
Expand Down Expand Up @@ -111,7 +111,7 @@ AT&T
.fi
.IP "" 0
.P
Similarly, because Markdown supports \fIinline HTML\fR, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such\. But if you write:
Similarly, because Markdown supports \fI\%#html\fR, if you use angle brackets as delimiters for HTML tags, Markdown will treat them as such\. But if you write:
.IP "" 4
.nf
4 < 5
Expand All @@ -134,9 +134,9 @@ The implication of the "one or more consecutive lines of text" rule is that Mark
.P
When you \fIdo\fR want to insert a \fB<br />\fR break tag using Markdown, you end a line with two or more spaces, then type return\.
.P
Yes, this takes a tad more effort to create a \fB<br />\fR, but a simplistic "every line break is a \fB<br />\fR" rule wouldn\'t work for Markdown\. Markdown\'s email\-style \fIblockquoting\fR and multi\-paragraph \fIlist items\fR work best \-\- and look better \-\- when you format them with hard breaks\.
Yes, this takes a tad more effort to create a \fB<br />\fR, but a simplistic "every line break is a \fB<br />\fR" rule wouldn\'t work for Markdown\. Markdown\'s email\-style \fI\%#blockquote\fR and multi\-paragraph \fI\%#list\fR work best \-\- and look better \-\- when you format them with hard breaks\.
.SS "Headers"
Markdown supports two styles of headers, Setext \fIhttp://docutils\.sourceforge\.net/mirror/setext\.html\fR and atx \fIhttp://www\.aaronsw\.com/2002/atx/\fR\.
Markdown supports two styles of headers, Setext \fI\%http://docutils\.sourceforge\.net/mirror/setext\.html\fR and atx \fI\%http://www\.aaronsw\.com/2002/atx/\fR\.
.P
Setext\-style headers are "underlined" using equal signs (for first\-level headers) and dashes (for second\-level headers)\. For example:
.IP "" 4
Expand Down Expand Up @@ -900,8 +900,8 @@ _ underscore
.SH "AUTHOR"
Markdown was created by John Gruber\.
.P
Manual page by Ryan Tomayko\. It\'s pretty much a direct copy of the Markdown Syntax Reference \fIhttp://daringfireball\.net/projects/markdown/syntax\fR, also by John Gruber\.
Manual page by Ryan Tomayko\. It\'s pretty much a direct copy of the Markdown Syntax Reference \fI\%http://daringfireball\.net/projects/markdown/syntax\fR, also by John Gruber\.
.SH "SEE ALSO"
ronn(5)
.br
\fIhttp://daringfireball\.net/projects/markdown/\fR
\fI\%http://daringfireball\.net/projects/markdown/\fR
2 changes: 1 addition & 1 deletion test/section_reference_links.roff
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
.SH "SECTION 1"
See the following section\.
.SH "SECTION 2"
See \fISECTION 1\fR or \fIto put it another way\fR or even \fIlike this\fR
See \fI\%#SECTION\-1\fR or \fI\%#SECTION\-1\fR or even \fI\%#SECTION\-1\fR
3 changes: 3 additions & 0 deletions test/url_formatting.ronn
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# URL formatting

Documentation of the Emily programming language can be found at <http://emilylang.org> or <http://bitbucket.org/runhello/emily>.

0 comments on commit 74a1321

Please sign in to comment.