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
[Rouge 2] use Rouge::Formatters::HTMLLegacy
and fix tests
#6150
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,16 +4,16 @@ module Rouge | |
|
||
def self.html_formatter(*args) | ||
Jekyll::External.require_with_graceful_fail("rouge") | ||
html_formatter = ::Rouge::Formatters::HTML.new(*args) | ||
return html_formatter if old_api? | ||
|
||
::Rouge::Formatters::HTMLPygments.new(html_formatter) | ||
if old_api? | ||
::Rouge::Formatters::HTML.new(*args) | ||
else | ||
::Rouge::Formatters::HTMLLegacy.new(*args) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does the new API look like? is this just a wrapper around the new functionality with the old API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly. It produces (almost) the same output as rouge 1.11 while receiving the same arguments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here are all default formatters listed. IMHO line numbers (which we rely on in a couple of tests) would also be present in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does HTMLLegacy not have those features? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, sorry, this was unclear: HTMLLegacy also has line numbers and all features we currently use. |
||
end | ||
end | ||
|
||
def self.old_api? | ||
::Rouge.version.to_s < "2" | ||
end | ||
|
||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work with 2.0 & 2.2, or is only 2.1.x compatible? Usually we'd just use 2 digits here, e.g. 2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 It should also work with any 2.x version, i'll update!