diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-08-08 04:06:17 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-08-08 04:06:17 -0600 |
| commit | cb6608eaca44e41b82d70c935852c2f1dcda1763 (patch) | |
| tree | c73c9c571de096110469984d7e53c7f4a05683bc /test/syntax_highlighter_test.rb | |
| parent | fe99ec60bd7adc60a5d7037aaa008a5abbc34b60 (diff) | |
remove unnamespaced selectors in Pygments stylesheet
Diffstat (limited to 'test/syntax_highlighter_test.rb')
| -rw-r--r-- | test/syntax_highlighter_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/syntax_highlighter_test.rb b/test/syntax_highlighter_test.rb index 16356260..93f462f9 100644 --- a/test/syntax_highlighter_test.rb +++ b/test/syntax_highlighter_test.rb @@ -1126,6 +1126,30 @@ context 'Syntax Highlighter' do assert_equal 'head', style_node.parent.name end + test 'should embed stylesheet for pygments style' do + input = <<~'EOS' + :source-highlighter: pygments + :pygments-style: monokai + + [source,python] + ---- + from pygments import highlight + from pygments.lexers import PythonLexer + from pygments.formatters import HtmlFormatter + + source = 'print "Hello World"' + print(highlight(source, PythonLexer(), HtmlFormatter())) + ---- + EOS + output = convert_string input, safe: :safe, linkcss_default: false + assert_css 'style', output, 2 + style_nodes = xmlnodes_at_xpath '//style[contains(text(), "pre.pygments")]', output + assert_equal 2, style_nodes.size + pygments_styles = style_nodes[1].to_s + assert_match %r/^pre\.pygments *\{/, pygments_styles + refute_match %r/^pre *\{/, pygments_styles + end + test 'should gracefully fallback to default style if specified style not recognized' do input = <<~'EOS' :source-highlighter: pygments |
