Skip to content

Commit

Permalink
Use the new syntax highligther API to resolve stylesheets
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Apr 10, 2019
1 parent 16e8809 commit 6f94920
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions templates/document.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
- unless (asset_uri_scheme = (attr 'asset-uri-scheme', 'https')).empty?
- asset_uri_scheme = %(#{asset_uri_scheme}:)
- cdn_base = %(#{asset_uri_scheme}//cdnjs.cloudflare.com/ajax/libs)
- linkcss = attr? 'linkcss'
- [:description, :keywords, :author, :copyright].each do |key|
- if attr? key
meta name=key content=(attr key)
Expand Down Expand Up @@ -46,19 +47,8 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
TeX: {#{eqnums_opt}}
});
script src='#{cdn_base}/mathjax/2.4.0/MathJax.js?config=TeX-MML-AM_HTMLorMML'
- case document.attr 'source-highlighter'
- when 'coderay'
- if (attr 'coderay-css', 'class') == 'class'
- if @safe >= Asciidoctor::SafeMode::SECURE || (attr? :linkcss)
link rel='stylesheet' href=normalize_web_path('asciidoctor-coderay.css', (attr :stylesdir, ''))
- else
style=Asciidoctor::Stylesheets.instance.coderay_stylesheet_data
- when 'pygments'
- if (attr 'pygments-css', 'class') == 'class'
- if @safe >= Asciidoctor::SafeMode::SECURE || (attr? :linkcss)
link rel='stylesheet' href=normalize_web_path('asciidoctor-pygments.css', (attr :stylesdir, ''))
- else
style=Asciidoctor::Stylesheets.instance.pygments_stylesheet_data(attr 'pygments-style')
- if (syntax_hl = document.syntax_highlighter) && (syntax_hl.docinfo? :head)
=(syntax_hl.docinfo :head, node, linkcss: linkcss)
/ For syntax highlighting
- if attr? 'highlightjs-theme'
link href=(attr 'highlightjs-theme') rel="stylesheet"
Expand Down Expand Up @@ -246,3 +236,5 @@ html lang=(attr :lang, 'en' unless attr? :nolang)
});
- unless (docinfo_content = (docinfo :footer, '.html')).empty?
=docinfo_content
- if syntax_hl && (syntax_hl.docinfo? :footer)
=(syntax_hl.docinfo :footer, node, cdn_base_url: cdn_base, linkcss: linkcss, self_closing_tag_slash: '')

0 comments on commit 6f94920

Please sign in to comment.