Permalink
Browse files

Fix #42: Escape ellipses in roff

  • Loading branch information...
1 parent 7371f96 commit e038944e36890e2a59e4d78a86e6b2ba15c7b74b @sometimesfood sometimesfood committed Dec 1, 2010
View
@@ -248,6 +248,7 @@ def escape(text)
text.gsub!(/&#x([0-9A-Fa-f]+);/) { $1.to_i(16).chr } # hex entities
text.gsub!(/&#(\d+);/) { $1.to_i.chr } # dec entities
text.gsub!('\\', '\e') # backslash
+ text.gsub!('...', '\|.\|.\|.') # ellipses
text.gsub!(/['.-]/) { |m| "\\#{m}" } # control chars
text.gsub!(/(&[A-Za-z]+;)/) { ent[$1] || $1 } # named entities
text.gsub!('&', '&') # amps
@@ -7,4 +7,4 @@
There\'s a weird issue where dots at the beginning of a line generate troff warnings due to escaping\.
.
.P
-\&\.\.\. let\'s see what happens\.
+\&\.\. let\'s see what happens\.
@@ -1,4 +1,4 @@
There's a weird issue where dots at the beginning of a line
generate troff warnings due to escaping.
-... let's see what happens.
+.. let's see what happens.
View
@@ -0,0 +1,10 @@
+.TH "ELLIPSES" "7" "January 1979" "" ""
+.
+.SH "NAME"
+\fBellipses\fR \- testing ellipses
+.
+.P
+Ellipses should be replaced\|\.\|\.\|\.
+.
+.P
+\|\.\|\.\|\.also, they shouldn\'t interfere with regular dots at the beginning of a line\.
View
@@ -0,0 +1,7 @@
+ellipses(7) -- testing ellipses
+===============================
+
+Ellipses should be replaced...
+
+...also, they shouldn't interfere with regular dots at the beginning
+of a line.
@@ -7,7 +7,7 @@
Foo
.
.P
-Always use \fBattr_reader\fR, \fBattr_writer\fR or \fBattr_accessor\fR\. Do not use \fBfor\.\.\.in\fR; use each instead\. Do not use \fBand\fR/\fBor\fR; use \fB&&\fR/\fB||\fR instead\.
+Always use \fBattr_reader\fR, \fBattr_writer\fR or \fBattr_accessor\fR\. Do not use \fBfor\|\.\|\.\|\.in\fR; use each instead\. Do not use \fBand\fR/\fBor\fR; use \fB&&\fR/\fB||\fR instead\.
.
.P
Bar

0 comments on commit e038944

Please sign in to comment.