Skip to content

Commit

Permalink
Allow to use rouge-style as alias for rouge-theme
Browse files Browse the repository at this point in the history
Fixes #3
  • Loading branch information
jirutka committed Jan 3, 2018
1 parent 54999c4 commit 20f0b74
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ Metrics/AbcSize:
Max: 36

Metrics/CyclomaticComplexity:
Max: 8
Max: 10

Metrics/LineLength:
Max: 100

Metrics/MethodLength:
Max: 30
Max: 32

Metrics/PerceivedComplexity:
Max: 10

Style/Next:
Enabled: false
Expand Down
3 changes: 3 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ rouge-theme::
Look into https://github.com/jneen/rouge/tree/master/lib/rouge/themes[lib/rouge/themes] in the Rouge repository for a list of available themes.
Default is `github`.

rouge-style::
Alternative name for the `rouge-theme` for compatibility with _asciidoctor-pdf_ (see https://github.com/{gh-name}/issues/3[#3]).


== License

Expand Down
6 changes: 5 additions & 1 deletion lib/asciidoctor/rouge/treeprocessor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ def process_listing(block)
block.set_attr('language', lexer.tag)

if document.attr?('rouge-css', 'style')
opts[:inline_theme] = document.attr('rouge-theme', DEFAULT_THEME)
# 'rouge-style' is alternative name for compatibility with
# asciidoctor-pdf (see #3).
opts[:inline_theme] = document.attr('rouge-theme') \
|| document.attr('rouge-style') \
|| DEFAULT_THEME
end

if block.attr?('highlight', nil, false)
Expand Down

0 comments on commit 20f0b74

Please sign in to comment.