Skip to content

Commit

Permalink
roffit: detect RFC better by a leading non-word or start of line
Browse files Browse the repository at this point in the history
Amend the test accordingly

Ref: curl/curl#11381
  • Loading branch information
bagder committed Jun 24, 2023
1 parent 9f030f3 commit 26d34eb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion roffit
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ sub linkfile {
$field =~ s/(^|\W)((https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=]+)/$1<a href=\"$2\">$2<\/a>/gi;

# convert (uppercase only) "RFC [number]" to a link
$field =~ s/(^|[\"\s])RFC ?(\d+)/$1<a href=\"http:\/\/www.ietf.org\/rfc\/rfc$2.txt\">RFC $2<\/a>/g;
$field =~ s/(^|\W)RFC ?(\d+)/$1<a href=\"http:\/\/www.ietf.org\/rfc\/rfc$2.txt\">RFC $2<\/a>/g;

$processed .= $field . $tail;
}
Expand Down
4 changes: 3 additions & 1 deletion testpage.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ converts the \fIinputfile\fP to \fIoutputfile\fP. The \fIinputfile\fP must be
an nroff formatted man page, and the \fIoutputfile\fP will be an HTML
document.

RFC 959 is FTP
(RFC 959) is FTP

but ARFC 959 is a fake

RFC3986 is URI syntax

Expand Down
3 changes: 2 additions & 1 deletion testpage.output
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
<p class="level0">testpage - test input nroff man page for roffit testing <a name="SYNOPSIS"></a><h2 class="nroffsh">Synopsis</h2>
<p class="level0"><span Class="bold">roffit</span> [<span Class="emphasis">options</span>] &lt; inputfile &gt; outputfile <a name="DESCRIPTION"></a><h2 class="nroffsh">Description</h2>
<p class="level0"><span Class="bold">roffit</span> converts the <span Class="emphasis">inputfile</span> to <span Class="emphasis">outputfile</span>. The <span Class="emphasis">inputfile</span> must be an nroff formatted man page, and the <span Class="emphasis">outputfile</span> will be an HTML document.
<p class="level0"><a href="http://www.ietf.org/rfc/rfc959.txt">RFC 959</a> is FTP
<p class="level0">(<a href="http://www.ietf.org/rfc/rfc959.txt">RFC 959</a>) is FTP
<p class="level0">but ARFC 959 is a fake
<p class="level0"><a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a> is URI syntax
<p class="level0">Also, we must support <span class="emphasis">style staring on one line and ending on another that may</span> be multiple lines off. <a name="OPTIONS"></a><h2 class="nroffsh">Options</h2>
<p class="level0">
Expand Down

0 comments on commit 26d34eb

Please sign in to comment.