Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a lexer for emails #1567

Merged
merged 7 commits into from
Oct 13, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unnecessary /ms.
  • Loading branch information
smokris committed Jul 22, 2020
commit ce9d9802699ae1a3ee0c6a6e27ede1b07f600d6f
10 changes: 5 additions & 5 deletions lib/rouge/lexers/email.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ def self.detect?(text)
rule %r/^Date:\s/, Keyword, :date
rule %r/^Subject:\s/, Keyword, :subject
rule %r/^[A-Z][A-Za-z0-9-]+:\s/, Keyword, :other_header
rule %r/\n/m, Text::Whitespace, :pop!
rule %r/\n/, Text::Whitespace, :pop!
end

state :root do
rule %r/\n/m, Text::Whitespace
rule %r/\n/, Text::Whitespace
rule %r/^>.*$/, Comment
rule %r/^--\s\n/m, Comment::Doc, :signature
rule %r/^--\s\n/, Comment::Doc, :signature
rule %r/.*$/, Text
end

state :header_line_and_continuation do
rule %r/\n(?=[^ \t])/m, Text::Whitespace, :pop!
rule %r/\n/m, Text::Whitespace
rule %r/\n(?=[^ \t])/, Text::Whitespace, :pop!
rule %r/\n/, Text::Whitespace
end

state :address do
Expand Down