asciidoctor-html5s 0.1.0.beta.11 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9072cf9f64b3d874247c3d236eb74ea5373961c1a6d60e6cff310f60365d077
4
- data.tar.gz: 1f9e5a1e368753ec09b49007f06f0b74785b34db7d4f72061e9f7ca7290f7aa1
3
+ metadata.gz: af32231a91e01ff0a316159145979917985ca2e69c0f0775c6082fe2ddcc10f8
4
+ data.tar.gz: 6f87d67ef1d15e90c446732f3dc1844c88d9c0951fee91cfc2cfe131d44c2989
5
5
  SHA512:
6
- metadata.gz: 82170204752958af610a625c76fc0fb8f1ce1ac35219b46445f8c0c8dbed8530d07453e7fd7b0bd541ebf10bbb442ec8091c9f47c06fcf56bbbe93294f0edaca
7
- data.tar.gz: b96df671bc00d7aabeca8eea657d9e6d8b98d5b85d06064513f204fcd9d4895b35ec3574328323a9b2210be0d74b8311ec37b7bff761794582dc441e9812cbf4
6
+ metadata.gz: c8c055a99d80711ccc2e2bceb00206275cf586fadb4d9c61fb7a37cdfa7b6d77047ecb69cb8b7c2225b021c75d1731ccd2a94c7b71398bbc9a4c127e71495605
7
+ data.tar.gz: 35a1f226f415061c31d9afc188252d1075b9bd3c764bbf94280a6a98dfa0d0328de582175aa3be5af9c61892cb280abc80cac03068df7aa49d70c76e113ad40b
data/README.adoc CHANGED
@@ -110,10 +110,23 @@ When flanked by space characters (e.g. `+a -- b+` or `+a --- b+`), the normal sp
110
110
  |===
111
111
 
112
112
 
113
+ == Other Enhancements
114
+
115
+ === Image Block
116
+
117
+ The `link` attribute recognizes few special values:
118
+
119
+ link=self::
120
+ Make the image a link with URL of the image itself – to open it in full size.
121
+
122
+ link=none / link=false::
123
+ Suppress the effect of `:html5s-image-default-link: self`, i.e. remove the default image link.
124
+
125
+
113
126
  == Requirements
114
127
 
115
128
  * https://www.ruby-lang.org/[Ruby] 2.0+, http://jruby.org/[JRuby] 9.1+ or https://nodejs.org/[Node.js]
116
- * https://rubygems.org/gems/asciidoctor/[Asciidoctor] 1.5.5+ or https://www.npmjs.com/package/asciidoctor.js[asciidoctor.js] 1.5.5
129
+ * https://rubygems.org/gems/asciidoctor/[Asciidoctor] 1.5.5+ or https://www.npmjs.com/package/asciidoctor.js[asciidoctor.js] 1.5.6
117
130
  * https://rubygems.org/gems/thread_safe/[thread_safe] (not required, but recommended for Ruby MRI)
118
131
 
119
132
  Note: This converter consists of https://github.com/slim-template/slim/[Slim] templates, but they are precompiled into pure Ruby code using https://github.com/jirutka/asciidoctor-templates-compiler/[asciidoctor-templates-compiler], so you don’t need Slim to use it!
@@ -176,6 +189,13 @@ html5s-force-stem-type::
176
189
  Ignore declared (e.g. `:stem: asciimath`, `asciimath:[]`, ...) and default type of the stem macro/block and always use the one specified by this attribute. +
177
190
  Asciidoctor hard-codes the default stem type to “asciimath”, which is not supported by KaTeX.
178
191
 
192
+ html5s-image-default-link: self::
193
+ Make every block image a link with the image’s source URL (i.e. user can click on the image to open it in full size), unless the link attribute is defined and is not `none` or `false`.
194
+
195
+ html5s-image-self-link-label::
196
+ The link title and ARIA label for the block image link that points to the image file (i.e. `href` equals the image’s `src`).
197
+ Default is `Open the image in full size`.
198
+
179
199
 
180
200
  == License
181
201
 
@@ -25,7 +25,7 @@ EOF
25
25
  s.add_runtime_dependency 'thread_safe', '~> 0.3.4'
26
26
 
27
27
  s.add_development_dependency 'asciidoctor-doctest', '= 2.0.0.beta.4'
28
- s.add_development_dependency 'asciidoctor-templates-compiler', '~> 0.4.1'
28
+ s.add_development_dependency 'asciidoctor-templates-compiler', '~> 0.5.0'
29
29
  s.add_development_dependency 'bundler', '~> 1.6'
30
30
  s.add_development_dependency 'coderay', '~> 1.1'
31
31
  s.add_development_dependency 'rake', '~> 10.0'
@@ -422,6 +422,34 @@ module Slim::Helpers
422
422
  end
423
423
  end
424
424
 
425
+ #--------------------------------------------------------
426
+ # block_image
427
+ #
428
+
429
+ ##
430
+ # @return [String, nil] an URL for the image's link.
431
+ def image_link
432
+ @_html5s_image_link ||=
433
+ case (link = attr(:link))
434
+ when 'none', 'false'
435
+ return
436
+ when 'self'
437
+ image_uri(attr(:target))
438
+ when nil, ''
439
+ image_uri(attr(:target)) if document.attr?('html5s-image-default-link', 'self')
440
+ else
441
+ link
442
+ end
443
+ end
444
+
445
+ ##
446
+ # @return [String, nil] a label/title of the image link.
447
+ def image_link_label
448
+ if image_uri(attr(:target)) == image_link
449
+ document.attr('html5s-image-self-link-label', 'Open the image in full size')
450
+ end
451
+ end
452
+
425
453
  #--------------------------------------------------------
426
454
  # block_listing
427
455
  #
@@ -526,6 +554,7 @@ is book and it's a child of a book part. Excluding block content."
526
554
  "//www.youtube.com/embed/#{video_id}#{url_query params}"
527
555
  else
528
556
  anchor = [attr(:start), attr(:end)].join(',').chomp(',')
557
+ anchor = '' if anchor == ',' # XXX: https://github.com/opal/opal/issues/1902
529
558
  anchor = '#t=' + anchor unless anchor.empty?
530
559
  media_uri "#{attr :target}#{anchor}"
531
560
  end
@@ -1,3 +1,10 @@
1
1
  = block_with_caption(:bottom, :class=>'image-block', :style=>style_value(text_align: (attr :align), float: (attr :float)))
2
- = html_tag_if(attr?(:link), :a, :class=>'image', :href=>(attr :link), :target=>(attr :window), :rel=>link_rel)
3
- img src=image_uri(attr :target) alt=(attr :alt) width=(attr :width) height=(attr :height)
2
+ - target_url = image_uri(attr :target)
3
+ = html_tag_if(image_link, :a,
4
+ :class=>['image', ('bare' if image_link == target_url)],
5
+ :href=>image_link,
6
+ :title=>image_link_label,
7
+ 'aria-label'=>image_link_label,
8
+ :target=>(attr :window),
9
+ :rel=>link_rel)
10
+ img src=target_url alt=(attr :alt) width=(attr :width) height=(attr :height)
@@ -1,5 +1,6 @@
1
1
  - unless sections.empty?
2
- - toclevels ||= (document.attr 'toclevels', DEFAULT_TOCLEVELS).to_i
2
+ / XXX: opts[:toclevels] is workaround for Opal (see asciidoctor-templates-compiler)
3
+ - toclevels ||= opts[:toclevels] || (document.attr 'toclevels', DEFAULT_TOCLEVELS).to_i
3
4
  - slevel = section_level sections.first
4
5
  ol.toc-list class="level-#{slevel}"
5
6
  - sections.each do |sec|
@@ -429,6 +429,34 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
429
429
  end
430
430
  end
431
431
 
432
+ #--------------------------------------------------------
433
+ # block_image
434
+ #
435
+
436
+ ##
437
+ # @return [String, nil] an URL for the image's link.
438
+ def image_link
439
+ @_html5s_image_link ||=
440
+ case (link = attr(:link))
441
+ when 'none', 'false'
442
+ return
443
+ when 'self'
444
+ image_uri(attr(:target))
445
+ when nil, ''
446
+ image_uri(attr(:target)) if document.attr?('html5s-image-default-link', 'self')
447
+ else
448
+ link
449
+ end
450
+ end
451
+
452
+ ##
453
+ # @return [String, nil] a label/title of the image link.
454
+ def image_link_label
455
+ if image_uri(attr(:target)) == image_link
456
+ document.attr('html5s-image-self-link-label', 'Open the image in full size')
457
+ end
458
+ end
459
+
432
460
  #--------------------------------------------------------
433
461
  # block_listing
434
462
  #
@@ -533,6 +561,7 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
533
561
  "//www.youtube.com/embed/#{video_id}#{url_query params}"
534
562
  else
535
563
  anchor = [attr(:start), attr(:end)].join(',').chomp(',')
564
+ anchor = '' if anchor == ',' # XXX: https://github.com/opal/opal/issues/1902
536
565
  anchor = '#t=' + anchor unless anchor.empty?
537
566
  media_uri "#{attr :target}#{anchor}"
538
567
  end
@@ -745,7 +774,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
745
774
  def admonition(node, opts = {})
746
775
  node.extend(Helpers)
747
776
  node.instance_eval do
748
- converter.set_local_variables(binding, opts) unless opts.empty?
749
777
  _buf = []; capture do;
750
778
  ; _buf << ("<h6"); _temple_html_attributeremover1 = []; _temple_html_attributemerger1 = []; _temple_html_attributemerger1[0] = "block-title"; _temple_html_attributemerger1[1] = []; _slim_codeattributes1 = ('label-only' unless title?); if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributemerger1[1] << (_slim_codeattributes1.join(" ")); else; _temple_html_attributemerger1[1] << (_slim_codeattributes1); end; _temple_html_attributemerger1[1] = _temple_html_attributemerger1[1].join(""); _temple_html_attributeremover1 << (_temple_html_attributemerger1.reject(&:empty?).join(" ")); _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _buf << (" class=\""); _buf << (_temple_html_attributeremover1); _buf << ("\""); end; _buf << ("><span class=\"title-label\">");
751
779
  ; _buf << ("#{local_attr :textlabel}: ");
@@ -765,7 +793,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
765
793
  def audio(node, opts = {})
766
794
  node.extend(Helpers)
767
795
  node.instance_eval do
768
- converter.set_local_variables(binding, opts) unless opts.empty?
769
796
  _buf = []; _slim_controls1 = block_with_caption :bottom, :class=>'audio-block' do; _slim_controls2 = [];
770
797
  ;
771
798
  ;
@@ -780,7 +807,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
780
807
  def colist(node, opts = {})
781
808
  node.extend(Helpers)
782
809
  node.instance_eval do
783
- converter.set_local_variables(binding, opts) unless opts.empty?
784
810
  _buf = [];
785
811
  ; _buf << ("<ol"); _temple_html_attributeremover1 = []; _temple_html_attributemerger1 = []; _temple_html_attributemerger1[0] = "callout-list"; _temple_html_attributemerger1[1] = []; _slim_codeattributes1 = [style, role]; if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributemerger1[1] << (_slim_codeattributes1.join(" ")); else; _temple_html_attributemerger1[1] << (_slim_codeattributes1); end; _temple_html_attributemerger1[1] = _temple_html_attributemerger1[1].join(""); _temple_html_attributeremover1 << (_temple_html_attributemerger1.reject(&:empty?).join(" ")); _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _buf << (" class=\""); _buf << (_temple_html_attributeremover1); _buf << ("\""); end; _slim_codeattributes2 = id; if _slim_codeattributes2; if _slim_codeattributes2 == true; _buf << (" id"); else; _buf << (" id=\""); _buf << (_slim_codeattributes2); _buf << ("\""); end; end; _buf << (">");
786
812
  ; items.each do |item|;
@@ -792,7 +818,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
792
818
  def dlist(node, opts = {})
793
819
  node.extend(Helpers)
794
820
  node.instance_eval do
795
- converter.set_local_variables(binding, opts) unless opts.empty?
796
821
  _buf = []; case style;
797
822
  ; when 'qanda';
798
823
  ; _slim_controls1 = block_with_title :class=>'qlist qanda', :role=>'doc-qna' do; _slim_controls2 = [];
@@ -845,7 +870,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
845
870
  def document(node, opts = {})
846
871
  node.extend(Helpers)
847
872
  node.instance_eval do
848
- converter.set_local_variables(binding, opts) unless opts.empty?
849
873
  _buf = []; _buf << ("<!DOCTYPE html><html");
850
874
  ; _slim_codeattributes1 = (attr :lang, 'en' unless attr? :nolang); if _slim_codeattributes1; if _slim_codeattributes1 == true; _buf << (" lang"); else; _buf << (" lang=\""); _buf << (_slim_codeattributes1); _buf << ("\""); end; end; _buf << ("><head><meta");
851
875
  ;
@@ -933,7 +957,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
933
957
  def embedded(node, opts = {})
934
958
  node.extend(Helpers)
935
959
  node.instance_eval do
936
- converter.set_local_variables(binding, opts) unless opts.empty?
937
960
  _buf = []; if !notitle && has_header?;
938
961
  ; _buf << ("<h1"); _slim_codeattributes1 = id; if _slim_codeattributes1; if _slim_codeattributes1 == true; _buf << (" id"); else; _buf << (" id=\""); _buf << (_slim_codeattributes1); _buf << ("\""); end; end; _buf << (">"); _buf << (header.title);
939
962
  ; _buf << ("</h1>"); end; if node.sections? && (attr? :toc) && (attr 'toc-placement', 'auto') == 'auto';
@@ -963,7 +986,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
963
986
  def empty(node, opts = {})
964
987
  node.extend(Helpers)
965
988
  node.instance_eval do
966
- converter.set_local_variables(binding, opts) unless opts.empty?
967
989
  _buf = []; ; _buf = _buf.join("")
968
990
  end
969
991
  end
@@ -971,7 +993,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
971
993
  def example(node, opts = {})
972
994
  node.extend(Helpers)
973
995
  node.instance_eval do
974
- converter.set_local_variables(binding, opts) unless opts.empty?
975
996
  _buf = []; _slim_controls1 = block_with_caption :top, :class=>'example-block' do; _slim_controls2 = [];
976
997
  ; _slim_controls2 << ("<div class=\"example\">");
977
998
  ; _slim_controls2 << (content);
@@ -982,7 +1003,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
982
1003
  def floating_title(node, opts = {})
983
1004
  node.extend(Helpers)
984
1005
  node.instance_eval do
985
- converter.set_local_variables(binding, opts) unless opts.empty?
986
1006
  _buf = []; _slim_htag_filter1 = ((level + 1)).to_s; _buf << ("<h"); _buf << (_slim_htag_filter1); _slim_codeattributes1 = id; if _slim_codeattributes1; if _slim_codeattributes1 == true; _buf << (" id"); else; _buf << (" id=\""); _buf << (_slim_codeattributes1); _buf << ("\""); end; end; _temple_html_attributeremover1 = []; _slim_codeattributes2 = [style, role]; if Array === _slim_codeattributes2; _slim_codeattributes2 = _slim_codeattributes2.flatten; _slim_codeattributes2.map!(&:to_s); _slim_codeattributes2.reject!(&:empty?); _temple_html_attributeremover1 << (_slim_codeattributes2.join(" ")); else; _temple_html_attributeremover1 << (_slim_codeattributes2); end; _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _buf << (" class=\""); _buf << (_temple_html_attributeremover1); _buf << ("\""); end; _buf << (">");
987
1007
  ; _buf << (title);
988
1008
  ; _buf << ("</h"); _buf << (_slim_htag_filter1); _buf << (">"); _buf = _buf.join("")
@@ -992,10 +1012,16 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
992
1012
  def image(node, opts = {})
993
1013
  node.extend(Helpers)
994
1014
  node.instance_eval do
995
- converter.set_local_variables(binding, opts) unless opts.empty?
996
1015
  _buf = []; _slim_controls1 = block_with_caption(:bottom, :class=>'image-block', :style=>style_value(text_align: (attr :align), float: (attr :float))) do; _slim_controls2 = [];
997
- ; _slim_controls3 = html_tag_if(attr?(:link), :a, :class=>'image', :href=>(attr :link), :target=>(attr :window), :rel=>link_rel) do; _slim_controls4 = [];
998
- ; _slim_controls4 << ("<img"); _slim_codeattributes1 = image_uri(attr :target); if _slim_codeattributes1; if _slim_codeattributes1 == true; _slim_controls4 << (" src"); else; _slim_controls4 << (" src=\""); _slim_controls4 << (_slim_codeattributes1); _slim_controls4 << ("\""); end; end; _slim_codeattributes2 = (attr :alt); if _slim_codeattributes2; if _slim_codeattributes2 == true; _slim_controls4 << (" alt"); else; _slim_controls4 << (" alt=\""); _slim_controls4 << (_slim_codeattributes2); _slim_controls4 << ("\""); end; end; _slim_codeattributes3 = (attr :width); if _slim_codeattributes3; if _slim_codeattributes3 == true; _slim_controls4 << (" width"); else; _slim_controls4 << (" width=\""); _slim_controls4 << (_slim_codeattributes3); _slim_controls4 << ("\""); end; end; _slim_codeattributes4 = (attr :height); if _slim_codeattributes4; if _slim_codeattributes4 == true; _slim_controls4 << (" height"); else; _slim_controls4 << (" height=\""); _slim_controls4 << (_slim_codeattributes4); _slim_controls4 << ("\""); end; end; _slim_controls4 << (">");
1016
+ ; target_url = image_uri(attr :target);
1017
+ ; _slim_controls3 = html_tag_if(image_link, :a,
1018
+ :class=>['image', ('bare' if image_link == target_url)],
1019
+ :href=>image_link,
1020
+ :title=>image_link_label,
1021
+ 'aria-label'=>image_link_label,
1022
+ :target=>(attr :window),
1023
+ :rel=>link_rel) do; _slim_controls4 = [];
1024
+ ; _slim_controls4 << ("<img"); _slim_codeattributes1 = target_url; if _slim_codeattributes1; if _slim_codeattributes1 == true; _slim_controls4 << (" src"); else; _slim_controls4 << (" src=\""); _slim_controls4 << (_slim_codeattributes1); _slim_controls4 << ("\""); end; end; _slim_codeattributes2 = (attr :alt); if _slim_codeattributes2; if _slim_codeattributes2 == true; _slim_controls4 << (" alt"); else; _slim_controls4 << (" alt=\""); _slim_controls4 << (_slim_codeattributes2); _slim_controls4 << ("\""); end; end; _slim_codeattributes3 = (attr :width); if _slim_codeattributes3; if _slim_codeattributes3 == true; _slim_controls4 << (" width"); else; _slim_controls4 << (" width=\""); _slim_controls4 << (_slim_codeattributes3); _slim_controls4 << ("\""); end; end; _slim_codeattributes4 = (attr :height); if _slim_codeattributes4; if _slim_codeattributes4 == true; _slim_controls4 << (" height"); else; _slim_controls4 << (" height=\""); _slim_controls4 << (_slim_codeattributes4); _slim_controls4 << ("\""); end; end; _slim_controls4 << (">");
999
1025
  ; _slim_controls4 = _slim_controls4.join(""); end; _slim_controls2 << (_slim_controls3); _slim_controls2 = _slim_controls2.join(""); end; _buf << (_slim_controls1); _buf = _buf.join("")
1000
1026
  end
1001
1027
  end
@@ -1003,7 +1029,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1003
1029
  def inline_anchor(node, opts = {})
1004
1030
  node.extend(Helpers)
1005
1031
  node.instance_eval do
1006
- converter.set_local_variables(binding, opts) unless opts.empty?
1007
1032
  _buf = []; case type;
1008
1033
  ; when :xref;
1009
1034
  ; _buf << ("<a"); _slim_codeattributes1 = target; if _slim_codeattributes1; if _slim_codeattributes1 == true; _buf << (" href"); else; _buf << (" href=\""); _buf << (_slim_codeattributes1); _buf << ("\""); end; end; _buf << (">"); _buf << (xref_text);
@@ -1023,7 +1048,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1023
1048
  def inline_break(node, opts = {})
1024
1049
  node.extend(Helpers)
1025
1050
  node.instance_eval do
1026
- converter.set_local_variables(binding, opts) unless opts.empty?
1027
1051
  _buf = []; _buf << (text);
1028
1052
  ; _buf << ("<br>");
1029
1053
  ; _buf = _buf.join("")
@@ -1033,7 +1057,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1033
1057
  def inline_button(node, opts = {})
1034
1058
  node.extend(Helpers)
1035
1059
  node.instance_eval do
1036
- converter.set_local_variables(binding, opts) unless opts.empty?
1037
1060
  _buf = []; _buf << ("<b class=\"button\">"); _buf << (text);
1038
1061
  ; _buf << ("</b>"); _buf = _buf.join("")
1039
1062
  end
@@ -1042,7 +1065,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1042
1065
  def inline_callout(node, opts = {})
1043
1066
  node.extend(Helpers)
1044
1067
  node.instance_eval do
1045
- converter.set_local_variables(binding, opts) unless opts.empty?
1046
1068
  _buf = []; _buf << ("<b class=\"conum\">"); _buf << (text);
1047
1069
  ; _buf << ("</b>"); _buf = _buf.join("")
1048
1070
  end
@@ -1051,7 +1073,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1051
1073
  def inline_footnote(node, opts = {})
1052
1074
  node.extend(Helpers)
1053
1075
  node.instance_eval do
1054
- converter.set_local_variables(binding, opts) unless opts.empty?
1055
1076
  _buf = []; if (index = local_attr :index);
1056
1077
  ;
1057
1078
  ;
@@ -1068,7 +1089,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1068
1089
  def inline_image(node, opts = {})
1069
1090
  node.extend(Helpers)
1070
1091
  node.instance_eval do
1071
- converter.set_local_variables(binding, opts) unless opts.empty?
1072
1092
  _buf = []; _slim_controls1 = html_tag_if((attr? :link), :a, :class=>'image', :href=>(attr :link), :target=>(attr :window), :rel=>link_rel) do; _slim_controls2 = [];
1073
1093
  ; if type == 'icon' && (document.attr? :icons, 'font');
1074
1094
  ; _slim_controls2 << ("<i"); _temple_html_attributeremover1 = []; _slim_codeattributes1 = [*icon_fa_classes, role]; if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributeremover1 << (_slim_codeattributes1.join(" ")); else; _temple_html_attributeremover1 << (_slim_codeattributes1); end; _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _slim_controls2 << (" class=\""); _slim_controls2 << (_temple_html_attributeremover1); _slim_controls2 << ("\""); end; _slim_codeattributes2 = (attr :title); if _slim_codeattributes2; if _slim_codeattributes2 == true; _slim_controls2 << (" title"); else; _slim_controls2 << (" title=\""); _slim_controls2 << (_slim_codeattributes2); _slim_controls2 << ("\""); end; end; _slim_controls2 << ("></i>");
@@ -1086,7 +1106,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1086
1106
  def inline_indexterm(node, opts = {})
1087
1107
  node.extend(Helpers)
1088
1108
  node.instance_eval do
1089
- converter.set_local_variables(binding, opts) unless opts.empty?
1090
1109
  _buf = []; if type == :visible;
1091
1110
  ; _buf << (text);
1092
1111
  ; end; _buf = _buf.join("")
@@ -1096,7 +1115,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1096
1115
  def inline_kbd(node, opts = {})
1097
1116
  node.extend(Helpers)
1098
1117
  node.instance_eval do
1099
- converter.set_local_variables(binding, opts) unless opts.empty?
1100
1118
  _buf = []; if (keys = attr 'keys').size == 1;
1101
1119
  ; _buf << ("<kbd>"); _buf << (keys.first);
1102
1120
  ; _buf << ("</kbd>"); else;
@@ -1111,7 +1129,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1111
1129
  def inline_menu(node, opts = {})
1112
1130
  node.extend(Helpers)
1113
1131
  node.instance_eval do
1114
- converter.set_local_variables(binding, opts) unless opts.empty?
1115
1132
  _buf = []; if local_attr :menuitem;
1116
1133
  ; capture do;
1117
1134
  ; _buf << ("&#160;<b class=\"caret\">&#8250;</b>");
@@ -1134,7 +1151,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1134
1151
  def inline_quoted(node, opts = {})
1135
1152
  node.extend(Helpers)
1136
1153
  node.instance_eval do
1137
- converter.set_local_variables(binding, opts) unless opts.empty?
1138
1154
  _buf = []; unless id.nil?;
1139
1155
  ; _buf << ("<a"); _slim_codeattributes1 = id; if _slim_codeattributes1; if _slim_codeattributes1 == true; _buf << (" id"); else; _buf << (" id=\""); _buf << (_slim_codeattributes1); _buf << ("\""); end; end; _buf << (" aria-hidden=\"true\"></a>");
1140
1156
  ; end; case type;
@@ -1171,7 +1187,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1171
1187
  def listing(node, opts = {})
1172
1188
  node.extend(Helpers)
1173
1189
  node.instance_eval do
1174
- converter.set_local_variables(binding, opts) unless opts.empty?
1175
1190
  _buf = []; _slim_controls1 = block_with_caption :top, :class=>'listing-block' do; _slim_controls2 = [];
1176
1191
  ; if style == 'source';
1177
1192
  ; if highlighter == 'html-pipeline';
@@ -1194,7 +1209,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1194
1209
  def literal(node, opts = {})
1195
1210
  node.extend(Helpers)
1196
1211
  node.instance_eval do
1197
- converter.set_local_variables(binding, opts) unless opts.empty?
1198
1212
  _buf = []; _slim_controls1 = block_with_title :class=>'literal-block' do; _slim_controls2 = [];
1199
1213
  ; _slim_controls2 << ("<pre"); _temple_html_attributeremover1 = []; _slim_codeattributes1 = nowrap?; if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributeremover1 << (_slim_codeattributes1.join(" ")); else; _temple_html_attributeremover1 << (_slim_codeattributes1); end; _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _slim_controls2 << (" class=\""); _slim_controls2 << (_temple_html_attributeremover1); _slim_controls2 << ("\""); end; _slim_controls2 << (">"); _slim_controls2 << (content);
1200
1214
  ; _slim_controls2 << ("</pre>"); _slim_controls2 = _slim_controls2.join(""); end; _buf << (_slim_controls1); _buf = _buf.join("")
@@ -1204,7 +1218,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1204
1218
  def olist(node, opts = {})
1205
1219
  node.extend(Helpers)
1206
1220
  node.instance_eval do
1207
- converter.set_local_variables(binding, opts) unless opts.empty?
1208
1221
  _buf = []; _slim_controls1 = block_with_title :class=>['olist', style] do; _slim_controls2 = [];
1209
1222
  ; _slim_controls2 << ("<ol"); _temple_html_attributeremover1 = []; _slim_codeattributes1 = style; if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributeremover1 << (_slim_codeattributes1.join(" ")); else; _temple_html_attributeremover1 << (_slim_codeattributes1); end; _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _slim_controls2 << (" class=\""); _slim_controls2 << (_temple_html_attributeremover1); _slim_controls2 << ("\""); end; _slim_codeattributes2 = (attr :start); if _slim_codeattributes2; if _slim_codeattributes2 == true; _slim_controls2 << (" start"); else; _slim_controls2 << (" start=\""); _slim_controls2 << (_slim_codeattributes2); _slim_controls2 << ("\""); end; end; _slim_codeattributes3 = list_marker_keyword; if _slim_codeattributes3; if _slim_codeattributes3 == true; _slim_controls2 << (" type"); else; _slim_controls2 << (" type=\""); _slim_controls2 << (_slim_codeattributes3); _slim_controls2 << ("\""); end; end; _slim_codeattributes4 = (option? 'reversed'); if _slim_codeattributes4; if _slim_codeattributes4 == true; _slim_controls2 << (" reversed"); else; _slim_controls2 << (" reversed=\""); _slim_controls2 << (_slim_codeattributes4); _slim_controls2 << ("\""); end; end; _slim_controls2 << (">");
1210
1223
  ; items.each do |item|;
@@ -1216,7 +1229,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1216
1229
  def open(node, opts = {})
1217
1230
  node.extend(Helpers)
1218
1231
  node.instance_eval do
1219
- converter.set_local_variables(binding, opts) unless opts.empty?
1220
1232
  _buf = []; if style == 'abstract';
1221
1233
  ; if abstract_allowed?;
1222
1234
  ; _slim_controls1 = block_with_title :class=>'quote-block abstract' do; _slim_controls2 = [];
@@ -1231,9 +1243,9 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1231
1243
  def outline(node, opts = {})
1232
1244
  node.extend(Helpers)
1233
1245
  node.instance_eval do
1234
- converter.set_local_variables(binding, opts) unless opts.empty?
1235
1246
  _buf = []; unless sections.empty?;
1236
- ; toclevels ||= (document.attr 'toclevels', DEFAULT_TOCLEVELS).to_i;
1247
+ ;
1248
+ ; toclevels ||= opts[:toclevels] || (document.attr 'toclevels', DEFAULT_TOCLEVELS).to_i;
1237
1249
  ; slevel = section_level sections.first;
1238
1250
  ; _buf << ("<ol class=\"toc-list level-"); _buf << (slevel); _buf << ("\">");
1239
1251
  ; sections.each do |sec|;
@@ -1248,7 +1260,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1248
1260
  def page_break(node, opts = {})
1249
1261
  node.extend(Helpers)
1250
1262
  node.instance_eval do
1251
- converter.set_local_variables(binding, opts) unless opts.empty?
1252
1263
  _buf = []; _buf << ("<div role=\"doc-pagebreak\" style=\"page-break-after: always;\"></div>");
1253
1264
  ; _buf = _buf.join("")
1254
1265
  end
@@ -1257,7 +1268,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1257
1268
  def paragraph(node, opts = {})
1258
1269
  node.extend(Helpers)
1259
1270
  node.instance_eval do
1260
- converter.set_local_variables(binding, opts) unless opts.empty?
1261
1271
  _buf = []; if title?;
1262
1272
  ; _buf << ("<section class=\"paragraph\""); _slim_codeattributes1 = id; if _slim_codeattributes1; if _slim_codeattributes1 == true; _buf << (" id"); else; _buf << (" id=\""); _buf << (_slim_codeattributes1); _buf << ("\""); end; end; _buf << ("><h6 class=\"block-title\">");
1263
1273
  ; _buf << (title);
@@ -1271,7 +1281,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1271
1281
  def pass(node, opts = {})
1272
1282
  node.extend(Helpers)
1273
1283
  node.instance_eval do
1274
- converter.set_local_variables(binding, opts) unless opts.empty?
1275
1284
  _buf = []; _buf << (content);
1276
1285
  ; _buf = _buf.join("")
1277
1286
  end
@@ -1280,7 +1289,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1280
1289
  def preamble(node, opts = {})
1281
1290
  node.extend(Helpers)
1282
1291
  node.instance_eval do
1283
- converter.set_local_variables(binding, opts) unless opts.empty?
1284
1292
  _buf = []; _buf << ("<section id=\"preamble\" aria-label=\"Preamble\">");
1285
1293
  ; _buf << (content);
1286
1294
  ; _buf << ("</section>"); if (attr? :toc) && (attr? 'toc-placement', 'preamble');
@@ -1296,7 +1304,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1296
1304
  def quote(node, opts = {})
1297
1305
  node.extend(Helpers)
1298
1306
  node.instance_eval do
1299
- converter.set_local_variables(binding, opts) unless opts.empty?
1300
1307
  _buf = []; _slim_controls1 = block_with_title :class=>'quote-block' do; _slim_controls2 = [];
1301
1308
  ; _slim_controls2 << ("<blockquote>");
1302
1309
  ; _slim_controls3 = html_tag_if !blocks?, :p do; _slim_controls4 = [];
@@ -1314,7 +1321,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1314
1321
  def section(node, opts = {})
1315
1322
  node.extend(Helpers)
1316
1323
  node.instance_eval do
1317
- converter.set_local_variables(binding, opts) unless opts.empty?
1318
1324
  _buf = []; _buf << ("<section"); _temple_html_attributeremover1 = []; _temple_html_attributemerger1 = []; _temple_html_attributemerger1[0] = "doc-section"; _temple_html_attributemerger1[1] = []; _slim_codeattributes1 = ["level-#{section_level}", role]; if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributemerger1[1] << (_slim_codeattributes1.join(" ")); else; _temple_html_attributemerger1[1] << (_slim_codeattributes1); end; _temple_html_attributemerger1[1] = _temple_html_attributemerger1[1].join(""); _temple_html_attributeremover1 << (_temple_html_attributemerger1.reject(&:empty?).join(" ")); _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _buf << (" class=\""); _buf << (_temple_html_attributeremover1); _buf << ("\""); end; _buf << (">");
1319
1325
  ; _slim_htag_filter1 = ((section_level + 1)).to_s; _buf << ("<h"); _buf << (_slim_htag_filter1); _slim_codeattributes2 = id; if _slim_codeattributes2; if _slim_codeattributes2 == true; _buf << (" id"); else; _buf << (" id=\""); _buf << (_slim_codeattributes2); _buf << ("\""); end; end; _buf << (">");
1320
1326
  ; if id;
@@ -1334,7 +1340,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1334
1340
  def sidebar(node, opts = {})
1335
1341
  node.extend(Helpers)
1336
1342
  node.instance_eval do
1337
- converter.set_local_variables(binding, opts) unless opts.empty?
1338
1343
  _buf = []; _buf << ("<aside"); _temple_html_attributeremover1 = []; _temple_html_attributemerger1 = []; _temple_html_attributemerger1[0] = "sidebar"; _temple_html_attributemerger1[1] = []; _slim_codeattributes1 = role; if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributemerger1[1] << (_slim_codeattributes1.join(" ")); else; _temple_html_attributemerger1[1] << (_slim_codeattributes1); end; _temple_html_attributemerger1[1] = _temple_html_attributemerger1[1].join(""); _temple_html_attributeremover1 << (_temple_html_attributemerger1.reject(&:empty?).join(" ")); _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _buf << (" class=\""); _buf << (_temple_html_attributeremover1); _buf << ("\""); end; _slim_codeattributes2 = id; if _slim_codeattributes2; if _slim_codeattributes2 == true; _buf << (" id"); else; _buf << (" id=\""); _buf << (_slim_codeattributes2); _buf << ("\""); end; end; _buf << (">");
1339
1344
  ; if title?;
1340
1345
  ; _buf << ("<h6 class=\"block-title\">"); _buf << (title);
@@ -1346,7 +1351,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1346
1351
  def stem(node, opts = {})
1347
1352
  node.extend(Helpers)
1348
1353
  node.instance_eval do
1349
- converter.set_local_variables(binding, opts) unless opts.empty?
1350
1354
  _buf = []; _slim_controls1 = block_with_caption :top, :class=>'stem-block' do; _slim_controls2 = [];
1351
1355
  ; _slim_controls2 << ("<div class=\"math\""); _slim_codeattributes1 = stem_lang; if _slim_codeattributes1; if _slim_codeattributes1 == true; _slim_controls2 << (" data-lang"); else; _slim_controls2 << (" data-lang=\""); _slim_controls2 << (_slim_codeattributes1); _slim_controls2 << ("\""); end; end; _slim_controls2 << (">"); _slim_controls2 << ((delimit_stem content, style));
1352
1356
  ; _slim_controls2 << ("</div>"); _slim_controls2 = _slim_controls2.join(""); end; _buf << (_slim_controls1); _buf = _buf.join("")
@@ -1356,7 +1360,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1356
1360
  def table(node, opts = {})
1357
1361
  node.extend(Helpers)
1358
1362
  node.instance_eval do
1359
- converter.set_local_variables(binding, opts) unless opts.empty?
1360
1363
  _buf = []; _slim_controls1 = block_with_caption :top, :class=>'table-block' do; _slim_controls2 = [];
1361
1364
  ;
1362
1365
  ;
@@ -1403,7 +1406,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1403
1406
  def thematic_break(node, opts = {})
1404
1407
  node.extend(Helpers)
1405
1408
  node.instance_eval do
1406
- converter.set_local_variables(binding, opts) unless opts.empty?
1407
1409
  _buf = []; _buf << ("<hr>");
1408
1410
  ; _buf = _buf.join("")
1409
1411
  end
@@ -1412,7 +1414,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1412
1414
  def toc(node, opts = {})
1413
1415
  node.extend(Helpers)
1414
1416
  node.instance_eval do
1415
- converter.set_local_variables(binding, opts) unless opts.empty?
1416
1417
  _buf = [];
1417
1418
  ;
1418
1419
  ; if document.attr?(:toc) && document.sections?;
@@ -1431,7 +1432,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1431
1432
  def ulist(node, opts = {})
1432
1433
  node.extend(Helpers)
1433
1434
  node.instance_eval do
1434
- converter.set_local_variables(binding, opts) unless opts.empty?
1435
1435
  _buf = []; checklist = 'task-list' if option? 'checklist';
1436
1436
  ; _slim_controls1 = block_with_title :class=>['ulist', style] do; _slim_controls2 = [];
1437
1437
  ; _slim_controls2 << ("<ul"); _temple_html_attributeremover1 = []; _slim_codeattributes1 = (checklist || style); if Array === _slim_codeattributes1; _slim_codeattributes1 = _slim_codeattributes1.flatten; _slim_codeattributes1.map!(&:to_s); _slim_codeattributes1.reject!(&:empty?); _temple_html_attributeremover1 << (_slim_codeattributes1.join(" ")); else; _temple_html_attributeremover1 << (_slim_codeattributes1); end; _temple_html_attributeremover1 = _temple_html_attributeremover1.join(""); if !_temple_html_attributeremover1.empty?; _slim_controls2 << (" class=\""); _slim_controls2 << (_temple_html_attributeremover1); _slim_controls2 << ("\""); end; _slim_controls2 << (">");
@@ -1450,7 +1450,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1450
1450
  def verse(node, opts = {})
1451
1451
  node.extend(Helpers)
1452
1452
  node.instance_eval do
1453
- converter.set_local_variables(binding, opts) unless opts.empty?
1454
1453
  _buf = []; _slim_controls1 = block_with_title :class=>'verse-block' do; _slim_controls2 = [];
1455
1454
  ; if attr?(:attribution) || attr?(:citetitle);
1456
1455
  ; _slim_controls2 << ("<blockquote class=\"verse\"><pre class=\"verse\">");
@@ -1469,7 +1468,6 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1469
1468
  def video(node, opts = {})
1470
1469
  node.extend(Helpers)
1471
1470
  node.instance_eval do
1472
- converter.set_local_variables(binding, opts) unless opts.empty?
1473
1471
  _buf = []; _slim_controls1 = block_with_caption :bottom, :class=>'video-block' do; _slim_controls2 = [];
1474
1472
  ; if video_iframe?;
1475
1473
  ;
@@ -1493,10 +1491,5 @@ class Asciidoctor::Html5s::Converter < ::Asciidoctor::Converter::Base
1493
1491
  end
1494
1492
  #------------------ End of generated transformation methods ------------------#
1495
1493
 
1496
- def set_local_variables(binding, vars)
1497
- vars.each do |key, val|
1498
- binding.local_variable_set(key.to_sym, val)
1499
- end
1500
- end
1501
1494
 
1502
1495
  end
@@ -1,10 +1,6 @@
1
1
  require 'asciidoctor' unless RUBY_PLATFORM == 'opal'
2
2
 
3
3
  module Asciidoctor
4
- # XXX: Regexps escaping is kinda broken in Opal 0.11.x. This is a hack how to
5
- # make the third regexp work both in Ruby and Opal.
6
- _BACKSLASH = '\\\\'
7
-
8
4
  # XXX: Modifies constant defined in Asciidoctor.
9
5
  REPLACEMENTS.unshift(
10
6
  # foo --- bar -> &thinsp;&mdash;&thinsp;
@@ -14,7 +10,7 @@ module Asciidoctor
14
10
 
15
11
  # foo -- bar -> &thinksp;&ndash;&thinsp;
16
12
  # Note: The regexp is copied from Asciidoctor.
17
- [/(^|\n|#{_BACKSLASH}| )--( |\n|$)/, '&#8201;&#8211;&#8201;', :none],
13
+ [/(^|\n|\\| )--( |\n|$)/, '&#8201;&#8211;&#8201;', :none],
18
14
  # foo--bar -> &ndash;
19
15
  # Note: The regexp is copied from Asciidoctor.
20
16
  [/(#{CG_WORD})\\?--(?=#{CG_WORD})/, '&#8211;', :leading],
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module Html5s
5
- VERSION = '0.1.0.beta.11'
5
+ VERSION = '0.1.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-html5s
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.beta.11
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Jirutka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-25 00:00:00.000000000 Z
11
+ date: 2018-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.4.1
61
+ version: 0.5.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.4.1
68
+ version: 0.5.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -218,12 +218,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
218
218
  version: '2.0'
219
219
  required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  requirements:
221
- - - ">"
221
+ - - ">="
222
222
  - !ruby/object:Gem::Version
223
- version: 1.3.1
223
+ version: '0'
224
224
  requirements: []
225
225
  rubyforge_project:
226
- rubygems_version: 2.7.7
226
+ rubygems_version: 2.7.8
227
227
  signing_key:
228
228
  specification_version: 4
229
229
  summary: Semantic HTML5 backend (converter) for Asciidoctor