Skip to content

Commit 43f3d71

Browse files
committed
Fix spelling. Ensure PERIOD in "%PDF-x.y". Comment added
1 parent 2f803a3 commit 43f3d71

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/rouge/lexers/pdf.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# per ISO 32000-2:2020 clause 12.7.8.
1010
#
1111
# This is a token-based parser ONLY! It is intended to syntax highlight full or partial fragments
12-
# of nicely written hand-writteen PDF syntax in documentation such as ISO specifications. It is NOT
12+
# of nicely written hand-written PDF syntax in documentation such as ISO specifications. It is NOT
1313
# intended to cope with real-world PDFs that will contain arbitrary binary data (that form invalid
1414
# UTF-8 sequences and generate "ArgumentError: invalid byte sequence in UTF-8" Ruby errors) and
1515
# other types of malformations or syntax errors.
@@ -28,8 +28,9 @@ class Pdf < RegexLexer
2828

2929
# PDF and FDF files must start with "%PDF-x.y" or "%FDF-x.y"
3030
# where x is the single digit major version and y is the single digit minor version.
31+
# For simplicity as a syntax highlighter, assumes occurs at start of a line.
3132
def self.detect?(text)
32-
return true if /\A%(P|F)DF-\d.\d/.match?(text)
33+
return true if /\A%(P|F)DF-\d\.\d/.match?(text)
3334
end
3435

3536
# PDF Delimiters (ISO 32000-2:2020, Table 1 and Table 2).

0 commit comments

Comments
 (0)