Skip to content

Commit

Permalink
rename attribute env-idea to kroki-force-png as this attribute name i…
Browse files Browse the repository at this point in the history
…s leaking an implementation details from an early version of this plugin
  • Loading branch information
ahus1 committed Jan 23, 2021
1 parent 1372acb commit aa135f4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ def get_role(format, role)

def get_format(doc, attrs, diagram_type)
format = attrs['format'] || 'svg'
# The JavaFX preview doesn't support SVG well, therefore we'll use PNG format...
if doc.attr?('env-idea') && format == 'svg'
# If the media we're preparing for doesn't support SVG well, use PNG instead...
if doc.attr?('kroki-force-png') && format == 'svg'
# ... unless the diagram library does not support PNG as output format!
# Currently, mermaid, nomnoml, svgbob, wavedrom only support SVG as output format.
svg_only_diagram_types = %w[:mermaid :nomnoml :svgbob :wavedrom]
Expand Down
6 changes: 3 additions & 3 deletions ruby/spec/asciidoctor_kroki_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
</div>
</div>)
end
it 'should use png if env-idea is defined' do
it 'should use png if kroki-force-png is defined' do
input = <<~'ADOC'
[plantuml]
....
alice -> bob: hello
....
ADOC
output = Asciidoctor.convert(input, attributes: { 'env-idea' => '' }, standalone: false)
output = Asciidoctor.convert(input, attributes: { 'kroki-force-png' => '' }, standalone: false)
(expect output).to eql %(<div class="imageblock kroki">
<div class="content">
<img src="https://kroki.io/plantuml/png/eNpLzMlMTlXQtVNIyk-yUshIzcnJBwA9iwZL" alt="Diagram">
Expand All @@ -41,7 +41,7 @@
alice -> bob: hello
....
ADOC
output = Asciidoctor.convert(input, attributes: { 'env-idea' => '', 'kroki-plantuml-include' => 'spec/fixtures/config.puml' }, standalone: false)
output = Asciidoctor.convert(input, attributes: { 'kroki-force-png' => '', 'kroki-plantuml-include' => 'spec/fixtures/config.puml' }, standalone: false)
(expect output).to eql %(<div class="imageblock kroki">
<div class="content">
<img src="https://kroki.io/plantuml/png/eNorzs7MK0gsSsxVyM3Py0_OKMrPTVUoKSpN5eJKzMlMTlXQtVNIyk-yUshIzcnJBwCT9xBc" alt="Diagram">
Expand Down

0 comments on commit aa135f4

Please sign in to comment.