@asciidoctor/reveal.js
Version:
A reveal.js converter for Asciidoctor.js. Write your slides in AsciiDoc!
1,106 lines (873 loc) • 264 kB
JavaScript
(function (Opal) {
function initialize (Opal) {
Opal.modules["json"] = function(Opal) {/* Generated by Opal 1.7.3 */
var $module = Opal.module, $klass = Opal.klass, $send = Opal.send, $Object = Opal.Object, $hash2 = Opal.hash2, $eqeqeq = Opal.eqeqeq, $defs = Opal.defs, $truthy = Opal.truthy, $def = Opal.def, $return_val = Opal.return_val, $nesting = [], nil = Opal.nil, $$$ = Opal.$$$;
Opal.add_stubs('raise,new,push,[]=,[],create_id,json_create,const_get,attr_accessor,create_id=,===,parse,generate,from_object,merge,to_json,responds_to?,to_io,write,to_s,to_a,strftime');
(function($base, $parent_nesting) {
var self = $module($base, 'JSON');
var $a, $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
$klass($nesting[0], $$('StandardError'), 'JSONError');
$klass($nesting[0], $$('JSONError'), 'ParserError');
var $hasOwn = Opal.hasOwnProperty;
function $parse(source) {
try {
return JSON.parse(source);
} catch (e) {
self.$raise($$$($$('JSON'), 'ParserError'), e.message);
}
};
function to_opal(value, options) {
var klass, arr, hash, i, ii, k;
switch (typeof value) {
case 'string':
return value;
case 'number':
return value;
case 'boolean':
return !!value;
case 'undefined':
return nil;
case 'object':
if (!value) return nil;
if (value.$$is_array) {
arr = (options.array_class).$new();
for (i = 0, ii = value.length; i < ii; i++) {
(arr).$push(to_opal(value[i], options));
}
return arr;
}
else {
hash = (options.object_class).$new();
for (k in value) {
if ($hasOwn.call(value, k)) {
($a = [k, to_opal(value[k], options)], $send((hash), '[]=', $a), $a[$a.length - 1]);
}
}
if (!options.parse && (klass = (hash)['$[]']($$('JSON').$create_id())) != nil) {
return $Object.$const_get(klass).$json_create(hash);
}
else {
return hash;
}
}
}
};
;
(function(self, $parent_nesting) {
return self.$attr_accessor("create_id")
})(Opal.get_singleton_class(self), $nesting);
self['$create_id=']("json_class");
$defs(self, '$[]', function $JSON_$$$1(value, options) {
var self = this;
if (options == null) options = $hash2([], {});
if ($eqeqeq($$('String'), value)) {
return self.$parse(value, options)
} else {
return self.$generate(value, options)
};
}, -2);
$defs(self, '$parse', function $$parse(source, options) {
var self = this;
if (options == null) options = $hash2([], {});
return self.$from_object($parse(source), options.$merge($hash2(["parse"], {"parse": true})));
}, -2);
$defs(self, '$parse!', function $JSON_parse$excl$2(source, options) {
var self = this;
if (options == null) options = $hash2([], {});
return self.$parse(source, options);
}, -2);
$defs(self, '$load', function $$load(source, options) {
var self = this;
if (options == null) options = $hash2([], {});
return self.$from_object($parse(source), options);
}, -2);
$defs(self, '$from_object', function $$from_object(js_object, options) {
var $ret_or_1 = nil;
if (options == null) options = $hash2([], {});
if ($truthy(($ret_or_1 = options['$[]']("object_class")))) {
$ret_or_1
} else {
options['$[]=']("object_class", $$('Hash'))
};
if ($truthy(($ret_or_1 = options['$[]']("array_class")))) {
$ret_or_1
} else {
options['$[]=']("array_class", $$('Array'))
};
return to_opal(js_object, options.$$smap);;
}, -2);
$defs(self, '$generate', function $$generate(obj, options) {
if (options == null) options = $hash2([], {});
return obj.$to_json(options);
}, -2);
return $defs(self, '$dump', function $$dump(obj, io, limit) {
var self = this, string = nil;
if (io == null) io = nil;
if (limit == null) limit = nil;
string = self.$generate(obj);
if ($truthy(io)) {
if ($truthy(io['$responds_to?']("to_io"))) {
io = io.$to_io()
};
io.$write(string);
return io;
} else {
return string
};
}, -2);
})($nesting[0], $nesting);
(function($base, $super) {
var self = $klass($base, $super, 'Object');
return $def(self, '$to_json', function $$to_json() {
var self = this;
return self.$to_s().$to_json()
})
})($nesting[0], null);
(function($base) {
var self = $module($base, 'Enumerable');
return $def(self, '$to_json', function $$to_json() {
var self = this;
return self.$to_a().$to_json()
})
})($nesting[0]);
(function($base, $super) {
var self = $klass($base, $super, 'Array');
return $def(self, '$to_json', function $$to_json() {
var self = this;
var result = [];
for (var i = 0, length = self.length; i < length; i++) {
result.push((self[i]).$to_json());
}
return '[' + result.join(',') + ']';
})
})($nesting[0], null);
(function($base, $super) {
var self = $klass($base, $super, 'Boolean');
return $def(self, '$to_json', function $$to_json() {
var self = this;
return (self == true) ? 'true' : 'false';
})
})($nesting[0], null);
(function($base, $super) {
var self = $klass($base, $super, 'Hash');
return $def(self, '$to_json', function $$to_json() {
var self = this;
var result = [];
for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
key = keys[i];
if (key.$$is_string) {
value = self.$$smap[key];
} else {
value = key.value;
key = key.key;
}
result.push((key).$to_s().$to_json() + ':' + (value).$to_json());
}
return '{' + result.join(',') + '}';
})
})($nesting[0], null);
(function($base, $super) {
var self = $klass($base, $super, 'NilClass');
return $def(self, '$to_json', $return_val("null"))
})($nesting[0], null);
(function($base, $super) {
var self = $klass($base, $super, 'Numeric');
return $def(self, '$to_json', function $$to_json() {
var self = this;
return self.toString();
})
})($nesting[0], null);
(function($base, $super) {
var self = $klass($base, $super, 'String');
return $def(self, '$to_json', function $$to_json() {
var self = this;
return JSON.stringify(self);
})
})($nesting[0], null);
(function($base, $super) {
var self = $klass($base, $super, 'Time');
return $def(self, '$to_json', function $$to_json() {
var self = this;
return self.$strftime("%FT%T%z").$to_json()
})
})($nesting[0], null);
return (function($base, $super) {
var self = $klass($base, $super, 'Date');
$def(self, '$to_json', function $$to_json() {
var self = this;
return self.$to_s().$to_json()
});
return $def(self, '$as_json', function $$as_json() {
var self = this;
return self.$to_s()
});
})($nesting[0], null);
};
Opal.modules["asciidoctor-revealjs/converter"] = function(Opal) {/* Generated by Opal 1.7.3 */
var $module = Opal.module, $klass = Opal.klass, $const_set = Opal.const_set, $truthy = Opal.truthy, $send = Opal.send, $def = Opal.def, $eqeq = Opal.eqeq, $hash2 = Opal.hash2, $to_ary = Opal.to_ary, $not = Opal.not, $rb_plus = Opal.rb_plus, $class_variable_set = Opal.class_variable_set, $class_variable_get = Opal.class_variable_get, $neqeq = Opal.neqeq, $rb_le = Opal.rb_le, $slice = Opal.slice, $rb_lt = Opal.rb_lt, $send2 = Opal.send2, $find_super = Opal.find_super, $eqeqeq = Opal.eqeqeq, $rb_times = Opal.rb_times, $rb_minus = Opal.rb_minus, $rb_ge = Opal.rb_ge, $to_a = Opal.to_a, $nesting = [], $$ = Opal.$r($nesting), nil = Opal.nil, $$$ = Opal.$$$;
Opal.add_stubs('require,include?,option?,nil?,join,map,split,!=,to_s,attr?,==,attr,downcase,inject,!,nil_or_empty?,is_a?,compact,<<,empty?,+,select,to_h,start_with?,data_attrs,role,roles,html_tag,merge,special,level,parent,instance_of?,object_id,[],length,attributes,new,context,text,id,[]=,index,values,to_i,document,<=,caption,numbered,sectnum,captioned_title,instance_variable_get,converter,target,type,icon_uri,encode_attribute_value,alt,img_tag,img_link,has_role?,<,safe,read_svg_contents,html5_converter,image_uri,bool_data_attr,append_link_constraint_attrs,content,lambda,key?,fetch,delete,call,gsub,authors,format_author,first,each,in_context,sub_replacements,name,email,sub_macros,push,pop,generate,constants,const_set,const_get,register_for,respond_to?,basebackend,outfilesuffix,filetype,supports_templates,create,backend_info,node_name,send,extend,instance_eval,set_local_variables,media_uri,===,flatten,map!,to_proc,reject!,reject,subtitle?,doctitle,slice_text,title,header,subtitle,find_by,generate_authors,convert_inline_image,title?,resolve_content,has_header?,notitle,footnotes?,footnotes,*,style,list_marker_keyword,items,blocks?,slide_footnote,each_with_index,syntax_highlighter,to_sym,highlight?,format,zero?,colspan,rowspan,content_for,noheader,docinfo,header?,extname,slice,normalize_web_path,generate_stem,docinfo?,yield_content,to_boolean,to_valid_slidenumber,revealjs_dependencies,sections,section_level,section_title,convert,tr_s,references,strip,sub_specialcharacters,end_with?,size,convert_image,doctype,puts,blocks,slide_footnotes,-,chomp,clear_slide_footnotes,>=,inline_text_container,text?,last,local_variable_set');
(function($base, $parent_nesting) {
var self = $module($base, 'Asciidoctor');
var $nesting = [self].concat($parent_nesting);
return ($module($nesting[0], 'Revealjs'), nil)
})($nesting[0], $nesting);
return (function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'Converter');
var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting), $proto = self.$$prototype;
$proto.delegate_converter = nil;
nil;
self.$require("json");
(function($base, $parent_nesting) {
var self = $module($base, 'Helpers');
var $nesting = [self].concat($parent_nesting), $$ = Opal.$r($nesting);
$const_set($nesting[0], 'EOL', "\n");
$const_set($nesting[0], 'SliceHintRx', / +/);
$def(self, '$slice_text', function $$slice_text(str, active) {
var self = this;
if (active == null) active = nil;
if ((($truthy(active) || (($truthy(active['$nil?']()) && ($truthy(self['$option?']("slice")))))) && ($truthy(str['$include?'](" "))))) {
return $send(str.$split($$('SliceHintRx')), 'map', [], function $$1(line){
if (line == null) line = nil;
return "<span class=\"line\">" + (line) + "</span>";}).$join($$('EOL'))
} else {
return str
};
}, -2);
$def(self, '$to_boolean', function $$to_boolean(val) {
var $ret_or_1 = nil, $ret_or_2 = nil, $ret_or_3 = nil;
if ($truthy(($ret_or_1 = ($truthy(($ret_or_2 = ($truthy(($ret_or_3 = val)) ? (val['$!=']("false")) : ($ret_or_3)))) ? (val.$to_s()['$!=']("0")) : ($ret_or_2))))) {
return $ret_or_1
} else {
return false
}
});
$def(self, '$bool_data_attr', function $$bool_data_attr(val) {
var self = this;
if (!$truthy(self['$attr?'](val))) {
return false
};
if (($eqeq(self.$attr(val).$downcase(), "false") || ($eqeq(self.$attr(val), "0")))) {
return "false"
} else {
return true
};
});
$def(self, '$to_valid_slidenumber', function $$to_valid_slidenumber(val) {
if ($eqeq(val, "")) {
return true
};
if ($eqeq(val.$to_s(), "false")) {
return false
} else {
return "'" + (val) + "'"
};
});
$const_set($nesting[0], 'DEFAULT_TOCLEVELS', 2);
$const_set($nesting[0], 'DEFAULT_SECTNUMLEVELS', 3);
$const_set($nesting[0], 'VOID_ELEMENTS', ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
$def(self, '$html_tag', function $$html_tag(name, attributes, content) {
var $yield = $$html_tag.$$p || nil, attrs = nil, attrs_str = nil, $ret_or_1 = nil;
$$html_tag.$$p = null;
if (attributes == null) attributes = $hash2([], {});
if (content == null) content = nil;
attrs = $send(attributes, 'inject', [[]], function $$2(attrs, $mlhs_tmp1){var $a, $b, k = nil, v = nil;
if (attrs == null) attrs = nil;
if ($mlhs_tmp1 == null) $mlhs_tmp1 = nil;
$b = $mlhs_tmp1, $a = $to_ary($b), (k = ($a[0] == null ? nil : $a[0])), (v = ($a[1] == null ? nil : $a[1])), $b;
if (!($truthy(v) && (($eqeq(v, true) || ($not(v['$nil_or_empty?']())))))) {
return attrs
};
if ($truthy(v['$is_a?']($$('Array')))) {
v = v.$compact().$join(" ")
};
return attrs['$<<'](($eqeq(v, true) ? (k) : ("" + (k) + "=\"" + (v) + "\"")));}, {$$has_top_level_mlhs_arg: true});
attrs_str = ($truthy(attrs['$empty?']()) ? ("") : ($rb_plus(" ", attrs.$join(" "))));
if ($truthy($$('VOID_ELEMENTS')['$include?'](name.$to_s()))) {
return "<" + (name) + (attrs_str) + ">"
} else {
content = ($truthy(($ret_or_1 = content)) ? ($ret_or_1) : ((($yield !== nil) ? (Opal.yieldX($yield, [])) : nil)));
return "<" + (name) + (attrs_str) + ">" + (content) + "</" + (name) + ">";
};
}, -2);
$def(self, '$data_attrs', function $$data_attrs(attributes) {
return $send($send(attributes, 'map', [], function $$3(key, value){
if (key == null) key = nil;
if (value == null) value = nil;
if ($eqeq(key, "step")) {
return ["data-fragment-index", value]
} else {
return [key, value]
};}).$to_h(), 'select', [], function $$4(key, _){
if (key == null) key = nil;
if (_ == null) _ = nil;
return key.$to_s()['$start_with?']("data-");})
});
$def(self, '$inline_text_container', function $$inline_text_container(content) {
var $yield = $$inline_text_container.$$p || nil, self = this, data_attrs = nil, classes = nil, $ret_or_1 = nil;
if (self.attributes == null) self.attributes = nil;
if (self.id == null) self.id = nil;
$$inline_text_container.$$p = null;
if (content == null) content = nil;
data_attrs = self.$data_attrs(self.attributes);
classes = [self.$role(), ((($truthy(self['$option?']("step")) || ($truthy(self['$attr?']("step")))) || ($truthy(self.$roles()['$include?']("step")))) ? ("fragment") : nil)].$compact();
if ((($not(self.$roles()['$empty?']()) || ($not(data_attrs['$empty?']()))) || ($not(self.id['$nil?']())))) {
return self.$html_tag("span", $hash2(["id", "class"], {"id": self.id, "class": classes}).$merge(data_attrs), ($truthy(($ret_or_1 = content)) ? ($ret_or_1) : ((($yield !== nil) ? (Opal.yieldX($yield, [])) : nil))))
} else if ($truthy(($ret_or_1 = content))) {
return $ret_or_1
} else {
if (($yield !== nil)) {
return Opal.yieldX($yield, []);
} else {
return nil
};
};
}, -1);
$def(self, '$section_level', function $$section_level(sec) {
var self = this, $ret_or_1 = nil;
if (self._section_level == null) self._section_level = nil;
if (sec == null) sec = self;
return (self._section_level = ($truthy(($ret_or_1 = self._section_level)) ? ($ret_or_1) : (($eqeq(sec.$level(), 0) && ($truthy(sec.$special()))) ? (1) : (sec.$level()))));
}, -1);
$class_variable_set($nesting[0], '@@slide_footnotes', $hash2([], {}));
$class_variable_set($nesting[0], '@@section_footnotes', $hash2([], {}));
$def(self, '$slide_footnote', function $$slide_footnote(footnote) {
var footnote_parent = nil, footnote_parent_object_id = nil, section_footnotes = nil, $ret_or_1 = nil, footnote_index = nil, attributes = nil, inline_footnote = nil, parent = nil, initial_index = nil, slide_index = nil, existing_footnote = nil;
footnote_parent = footnote.$parent();
if ($truthy(footnote_parent['$instance_of?']($$$($$$('Asciidoctor'), 'Section')))) {
footnote_parent_object_id = footnote_parent.$object_id();
section_footnotes = ($truthy(($ret_or_1 = $class_variable_get($nesting[0], '@@section_footnotes', false)['$[]'](footnote_parent_object_id))) ? ($ret_or_1) : ([]));
footnote_index = $rb_plus(section_footnotes.$length(), 1);
attributes = footnote.$attributes().$merge($hash2(["index"], {"index": footnote_index}));
inline_footnote = $$$($$('Asciidoctor'), 'Inline').$new(footnote_parent, footnote.$context(), footnote.$text(), $hash2(["attributes"], {"attributes": attributes}));
section_footnotes['$<<']($$$($$$($$('Asciidoctor'), 'Document'), 'Footnote').$new(inline_footnote.$attr("index"), inline_footnote.$id(), inline_footnote.$text()));
$class_variable_get($nesting[0], '@@section_footnotes', false)['$[]='](footnote_parent_object_id, section_footnotes);
return inline_footnote;
} else {
parent = footnote.$parent();
while (!($truthy(($truthy(($ret_or_1 = parent['$=='](nil))) ? ($ret_or_1) : (parent['$instance_of?']($$$($$$('Asciidoctor'), 'Section'))))))) {
parent = parent.$parent()
};
section_footnotes = ($neqeq(parent, nil) ? (($truthy(($ret_or_1 = $class_variable_get($nesting[0], '@@section_footnotes', false)['$[]'](parent.$object_id()))) ? ($ret_or_1) : ([]))) : ([]));
initial_index = footnote.$attr("index");
slide_index = ($truthy((existing_footnote = $class_variable_get($nesting[0], '@@slide_footnotes', false)['$[]'](initial_index))) ? (existing_footnote.$index()) : ($rb_plus($rb_plus($class_variable_get($nesting[0], '@@slide_footnotes', false).$length(), section_footnotes.$length()), 1)));
attributes = footnote.$attributes().$merge($hash2(["index"], {"index": slide_index}));
inline_footnote = $$$($$('Asciidoctor'), 'Inline').$new(footnote_parent, footnote.$context(), footnote.$text(), $hash2(["attributes"], {"attributes": attributes}));
$class_variable_get($nesting[0], '@@slide_footnotes', false)['$[]='](initial_index, $$$($$$($$('Asciidoctor'), 'Document'), 'Footnote').$new(inline_footnote.$attr("index"), inline_footnote.$id(), inline_footnote.$text()));
return inline_footnote;
};
});
$def(self, '$clear_slide_footnotes', function $$clear_slide_footnotes() {
return $class_variable_set($nesting[0], '@@slide_footnotes', $hash2([], {}))
});
$def(self, '$slide_footnotes', function $$slide_footnotes(section) {
var section_object_id = nil, section_footnotes = nil, $ret_or_1 = nil;
section_object_id = section.$object_id();
section_footnotes = ($truthy(($ret_or_1 = $class_variable_get($nesting[0], '@@section_footnotes', false)['$[]'](section_object_id))) ? ($ret_or_1) : ([]));
return $rb_plus(section_footnotes, $class_variable_get($nesting[0], '@@slide_footnotes', false).$values());
});
$def(self, '$section_title', function $$section_title(sec) {
var self = this, sectnumlevels = nil;
if (sec == null) sec = self;
sectnumlevels = self.$document().$attr("sectnumlevels", $$('DEFAULT_SECTNUMLEVELS')).$to_i();
if ((($truthy(sec.$numbered()) && ($not(sec.$caption()))) && ($truthy($rb_le(sec.$level(), sectnumlevels))))) {
return [sec.$sectnum(), sec.$captioned_title()].$join(" ")
} else {
return sec.$captioned_title()
};
}, -1);
$def(self, '$html5_converter', function $$html5_converter() {
var self = this;
return self.$converter().$instance_variable_get("@delegate_converter")
});
$def(self, '$convert_inline_image', function $$convert_inline_image(node) {
var $a, $b, self = this, target = nil, $ret_or_1 = nil, icons = nil, i_class_attr_val = nil, attrs = nil, img = nil, src = nil, html_attrs = nil;
if (node == null) node = self;
target = node.$target();
if ($eqeq(($truthy(($ret_or_1 = node.$type())) ? ($ret_or_1) : ("image")), "icon")) {
if ($eqeq((icons = node.$document().$attr("icons")), "font")) {
i_class_attr_val = "" + (node.$attr("set", "fa")) + " fa-" + (target);
if ($truthy(node['$attr?']("size"))) {
i_class_attr_val = "" + (i_class_attr_val) + " fa-" + (node.$attr("size"))
};
if ($truthy(node['$attr?']("flip"))) {
i_class_attr_val = "" + (i_class_attr_val) + " fa-flip-" + (node.$attr("flip"))
} else if ($truthy(node['$attr?']("rotate"))) {
i_class_attr_val = "" + (i_class_attr_val) + " fa-rotate-" + (node.$attr("rotate"))
};
attrs = ($truthy(node['$attr?']("title")) ? (" title=\"" + (node.$attr("title")) + "\"") : (""));
img = "<i class=\"" + (i_class_attr_val) + "\"" + (attrs) + "></i>";
} else if ($truthy(icons)) {
attrs = ($truthy(node['$attr?']("width")) ? (" width=\"" + (node.$attr("width")) + "\"") : (""));
if ($truthy(node['$attr?']("height"))) {
attrs = "" + (attrs) + " height=\"" + (node.$attr("height")) + "\""
};
if ($truthy(node['$attr?']("title"))) {
attrs = "" + (attrs) + " title=\"" + (node.$attr("title")) + "\""
};
img = "<img src=\"" + ((src = node.$icon_uri(target))) + "\" alt=\"" + (self.$encode_attribute_value(node.$alt())) + "\"" + (attrs) + ">";
} else {
img = "[" + (node.$alt()) + "]"
}
} else {
html_attrs = ($truthy(node['$attr?']("width")) ? (" width=\"" + (node.$attr("width")) + "\"") : (""));
if ($truthy(node['$attr?']("height"))) {
html_attrs = "" + (html_attrs) + " height=\"" + (node.$attr("height")) + "\""
};
if ($truthy(node['$attr?']("title"))) {
html_attrs = "" + (html_attrs) + " title=\"" + (node.$attr("title")) + "\""
};
$b = self.$img_tag(node, target, html_attrs), $a = $to_ary($b), (img = ($a[0] == null ? nil : $a[0])), (src = ($a[1] == null ? nil : $a[1])), $b;
};
return self.$img_link(node, src, img);
}, -1);
$def(self, '$convert_image', function $$convert_image(node) {
var $a, $b, self = this, $ret_or_1 = nil, height_value = nil, html_attrs = nil, img = nil, src = nil;
if (node == null) node = self;
if (($truthy(node['$has_role?']("stretch")) && ($not(($truthy(($ret_or_1 = node['$attr?']("width"))) ? ($ret_or_1) : (node['$attr?']("height"))))))) {
height_value = "100%"
} else if ($truthy(node['$attr?']("height"))) {
height_value = node.$attr("height")
} else {
height_value = nil
};
html_attrs = ($truthy(node['$attr?']("width")) ? (" width=\"" + (node.$attr("width")) + "\"") : (""));
if ($truthy(height_value)) {
html_attrs = "" + (html_attrs) + " height=\"" + (height_value) + "\""
};
if ($truthy(node['$attr?']("title"))) {
html_attrs = "" + (html_attrs) + " title=\"" + (node.$attr("title")) + "\""
};
if ($truthy(node['$attr?']("background"))) {
html_attrs = "" + (html_attrs) + " style=\"background: " + (node.$attr("background")) + "\""
};
$b = self.$img_tag(node, node.$attr("target"), html_attrs), $a = $to_ary($b), (img = ($a[0] == null ? nil : $a[0])), (src = ($a[1] == null ? nil : $a[1])), $b;
return self.$img_link(node, src, img);
}, -1);
$def(self, '$img_tag', function $$img_tag($a, $b, $c) {
var $post_args, node, target, html_attrs, self = this, img = nil, $ret_or_1 = nil, fallback = nil, src = nil;
$post_args = $slice(arguments);
if ($post_args.length > 2) node = $post_args.shift();if (node == null) node = self;
target = $post_args.shift();if (target == null) target = nil;
html_attrs = $post_args.shift();if (html_attrs == null) html_attrs = nil;
if ((($truthy(node['$attr?']("format", "svg")) || ($truthy(target['$include?'](".svg")))) && ($truthy($rb_lt(node.$document().$safe(), $$$($$$($$$('Asciidoctor'), 'SafeMode'), 'SECURE')))))) {
if ($truthy(node['$option?']("inline"))) {
img = ($truthy(($ret_or_1 = self.$html5_converter().$read_svg_contents(node, target))) ? ($ret_or_1) : ("<span class=\"alt\">" + (node.$alt()) + "</span>"))
} else if ($truthy(node['$option?']("interactive"))) {
fallback = ($truthy(node['$attr?']("fallback")) ? ("<img src=\"" + (node.$image_uri(node.$attr("fallback"))) + "\" alt=\"" + (self.$encode_attribute_value(node.$alt())) + "\"" + (html_attrs) + ">") : ("<span class=\"alt\">" + (node.$alt()) + "</span>"));
img = "<object type=\"image/svg+xml\" data=\"" + ((src = node.$image_uri(target))) + "\"" + (html_attrs) + ">" + (fallback) + "</object>";
} else {
img = "<img src=\"" + ((src = node.$image_uri(target))) + "\" alt=\"" + (self.$encode_attribute_value(node.$alt())) + "\"" + (html_attrs) + ">"
}
} else {
img = "<img src=\"" + ((src = node.$image_uri(target))) + "\" alt=\"" + (self.$encode_attribute_value(node.$alt())) + "\"" + (html_attrs) + ">"
};
return [img, src];
}, -3);
$def(self, '$img_link', function $$img_link($a, $b, $c) {
var $post_args, node, src, content, self = this, href_attr_val = nil, link_preview_value = nil, data_preview_attr = nil;
$post_args = $slice(arguments);
if ($post_args.length > 2) node = $post_args.shift();if (node == null) node = self;
src = $post_args.shift();if (src == null) src = nil;
content = $post_args.shift();if (content == null) content = nil;
if (($truthy(node['$attr?']("link")) && (($neqeq((href_attr_val = node.$attr("link")), "self") || ($truthy((href_attr_val = src))))))) {
if ($truthy((link_preview_value = self.$bool_data_attr("link_preview")))) {
data_preview_attr = " data-preview-link=\"" + (($eqeq(link_preview_value, true) ? ("") : (link_preview_value))) + "\""
};
return "<a class=\"image\" href=\"" + (href_attr_val) + "\"" + (self.$append_link_constraint_attrs(node).$join()) + (data_preview_attr) + ">" + (content) + "</a>";
};
return content;
}, -3);
$def(self, '$revealjs_dependencies', function $$revealjs_dependencies(document, node, revealjsdir) {
var dependencies = nil;
dependencies = [];
if (!$truthy(node['$attr?']("revealjs_plugin_zoom", "disabled"))) {
dependencies['$<<']("{ src: '" + (revealjsdir) + "/plugin/zoom/zoom.js', async: true, callback: function () { Reveal.registerPlugin(RevealZoom) } }")
};
if (!$truthy(node['$attr?']("revealjs_plugin_notes", "disabled"))) {
dependencies['$<<']("{ src: '" + (revealjsdir) + "/plugin/notes/notes.js', async: true, callback: function () { Reveal.registerPlugin(RevealNotes) } }")
};
if ($truthy(node['$attr?']("revealjs_plugin_search", "enabled"))) {
dependencies['$<<']("{ src: '" + (revealjsdir) + "/plugin/search/search.js', async: true, callback: function () { Reveal.registerPlugin(RevealSearch) } }")
};
return dependencies.$join(",\n ");
});
$def(self, '$resolve_content', function $$resolve_content() {
var self = this;
if (self.content_model == null) self.content_model = nil;
if ($eqeq(self.content_model, "simple")) {
return "<p>" + (self.$content()) + "</p>"
} else {
return self.$content()
}
});
$def(self, '$content_for', function $$content_for(key, opts) {
var block = $$content_for.$$p || nil, $a, $b, self = this, $ret_or_1 = nil;
if (self.content == null) self.content = nil;
$$content_for.$$p = null;
;
if (opts == null) opts = $hash2([], {});
if (!$truthy((($a = self['content'], $a != null && $a !== nil) ? 'instance-variable' : nil))) {
self.content = $hash2([], {})
};
($truthy(opts['$[]']("append")) ? (($truthy(($ret_or_1 = self.content['$[]'](key))) ? ($ret_or_1) : (($b = [key, []], $send(self.content, '[]=', $b), $b[$b.length - 1])))) : (($b = [key, []], $send(self.content, '[]=', $b), $b[$b.length - 1])))['$<<'](((block !== nil) ? (block) : ($send(self, 'lambda', [], function $$5(){
return opts['$[]']("content")}))));
return nil;
}, -2);
$def(self, '$content_for?', function $Helpers_content_for$ques$6(key) {
var $a, self = this, $ret_or_1 = nil;
if (self.content == null) self.content = nil;
if ($truthy(($ret_or_1 = (($a = self['content'], $a != null && $a !== nil) ? 'instance-variable' : nil)))) {
return self.content['$key?'](key);
} else {
return $ret_or_1
}
});
$def(self, '$yield_content', function $$yield_content(key, opts) {
var $a, self = this, blks = nil;
if (self.content == null) self.content = nil;
if (opts == null) opts = $hash2([], {});
if (($truthy((($a = self['content'], $a != null && $a !== nil) ? 'instance-variable' : nil)) && ($truthy((blks = ($truthy(opts.$fetch("drain", true)) ? (self.content.$delete(key)) : (self.content['$[]'](key)))))))) {
$send(blks, 'map', [], function $$7(b){
if (b == null) b = nil;
return b.$call();}).$join()
};
return nil;
}, -2);
$def(self, '$append_link_constraint_attrs', function $$append_link_constraint_attrs(node, attrs) {
var rel = nil, window = nil;
if (attrs == null) attrs = [];
if ($truthy(node['$option?']("nofollow"))) {
rel = "nofollow"
};
if ($truthy((window = node.$attributes()['$[]']("window")))) {
attrs['$<<'](" target=\"" + (window) + "\"");
if (($eqeq(window, "_blank") || ($truthy(node['$option?']("noopener"))))) {
attrs['$<<'](($truthy(rel) ? (" rel=\"" + (rel) + " noopener\"") : (" rel=\"noopener\"")))
};
} else if ($truthy(rel)) {
attrs['$<<'](" rel=\"" + (rel) + "\"")
};
return attrs;
}, -2);
$def(self, '$encode_attribute_value', function $$encode_attribute_value(val) {
if ($truthy(val['$include?']("\""))) {
return val.$gsub("\"", """);
} else {
return val
}
});
$def(self, '$generate_authors', function $$generate_authors(node) {
var self = this, result = nil;
if ($truthy(node.$authors()['$empty?']())) {
return nil
};
if ($eqeq(node.$authors().$length(), 1)) {
return "<p class=\"byline\">\n" + " " + (self.$format_author(node, node.$authors().$first())) + "\n" + " </p>"
} else {
result = ["<ul class=\"byline\">"];
$send(node.$authors(), 'each', [], function $$8(author){var self = $$8.$$s == null ? this : $$8.$$s;
if (author == null) author = nil;
return result['$<<']("<li>" + (self.$format_author(node, author)) + "</li>");}, {$$s: self});
result['$<<']("</ul>");
return result.$join($$$($$('Asciidoctor'), 'LF'));
};
});
$def(self, '$format_author', function $$format_author(node, author) {
var self = this;
return $send(self, 'in_context', ["author"], function $$9(){
return "<span class=\"author\">" + (node.$sub_replacements(author.$name())) + (($truthy(author.$email()) ? (" " + (node.$sub_macros(author.$email()))) : (""))) + "</span>"})
});
$def(self, '$in_context', function $$in_context(name) {
var $yield = $$in_context.$$p || nil, self = this, $ret_or_1 = nil, result = nil;
if (self.convert_context == null) self.convert_context = nil;
$$in_context.$$p = null;
(self.convert_context = ($truthy(($ret_or_1 = self.convert_context)) ? ($ret_or_1) : ([]))).$push(name);
result = Opal.yieldX($yield, []);
self.convert_context.$pop();
return result;
});
$const_set($nesting[0], 'STEM_EQNUMS_AMS', "ams");
$const_set($nesting[0], 'STEM_EQNUMS_NONE', "none");
$const_set($nesting[0], 'STEM_EQNUMS_VALID_VALUES', [$$('STEM_EQNUMS_NONE'), $$('STEM_EQNUMS_AMS'), "all"]);
$const_set($nesting[0], 'MATHJAX_VERSION', "3.2.0");
return $def(self, '$generate_stem', function $$generate_stem(cdn_base) {
var self = this, eqnums_val = nil, mathjax_configuration = nil, mathjaxdir = nil;
if ($truthy(self['$attr?']("stem"))) {
eqnums_val = self.$attr("eqnums", $$('STEM_EQNUMS_NONE')).$downcase();
if (!$truthy($$('STEM_EQNUMS_VALID_VALUES')['$include?'](eqnums_val))) {
eqnums_val = $$('STEM_EQNUMS_AMS')
};
mathjax_configuration = $hash2(["tex", "options", "asciimath", "loader"], {"tex": $hash2(["inlineMath", "displayMath", "processEscapes", "tags"], {"inlineMath": [$$$($$('Asciidoctor'), 'INLINE_MATH_DELIMITERS')['$[]']("latexmath")], "displayMath": [$$$($$('Asciidoctor'), 'BLOCK_MATH_DELIMITERS')['$[]']("latexmath")], "processEscapes": false, "tags": eqnums_val}), "options": $hash2(["ignoreHtmlClass"], {"ignoreHtmlClass": "nostem|nolatexmath"}), "asciimath": $hash2(["delimiters"], {"delimiters": [$$$($$('Asciidoctor'), 'BLOCK_MATH_DELIMITERS')['$[]']("asciimath")]}), "loader": $hash2(["load"], {"load": ["input/asciimath", "output/chtml", "ui/menu"]})});
mathjaxdir = self.$attr("mathjaxdir", "" + (cdn_base) + "/mathjax/" + ($$('MATHJAX_VERSION')) + "/es5");
return $rb_plus("<script>window.MathJax = " + ($$('JSON').$generate(mathjax_configuration)) + ";</script>", "<script async src=\"" + (mathjaxdir) + "/tex-mml-chtml.js\"></script>");
} else {
return nil
}
});
})($nesting[0], $nesting);
$send($$('Helpers').$constants(), 'each', [], function $Converter$10(const$){var self = $Converter$10.$$s == null ? this : $Converter$10.$$s;
if (const$ == null) const$ = nil;
return self.$const_set(const$, $$('Helpers').$const_get(const$));}, {$$s: self});
self.$register_for("revealjs", "reveal.js");
$def(self, '$initialize', function $$initialize(backend, opts) {
var $yield = $$initialize.$$p || nil, self = this, delegate_backend = nil, $ret_or_1 = nil, factory = nil, converter = nil;
$$initialize.$$p = null;
if (opts == null) opts = $hash2([], {});
$send2(self, $find_super(self, 'initialize', $$initialize, false, true), 'initialize', [backend, opts], $yield);
if ($truthy(self['$respond_to?']("basebackend"))) {
self.$basebackend("html")
};
if ($truthy(self['$respond_to?']("outfilesuffix"))) {
self.$outfilesuffix(".html")
};
if ($truthy(self['$respond_to?']("filetype"))) {
self.$filetype("html")
};
if ($truthy(self['$respond_to?']("supports_templates"))) {
self.$supports_templates()
};
delegate_backend = ($truthy(($ret_or_1 = opts['$[]']("delegate_backend"))) ? ($ret_or_1) : ("html5")).$to_s();
factory = $$$($$$($$$('Asciidoctor'), 'Converter'), 'Factory');
converter = factory.$create(delegate_backend, self.$backend_info());
return (self.delegate_converter = ($eqeq(converter, self) ? (factory.$new().$create(delegate_backend, self.$backend_info())) : (converter)));
}, -2);
$def(self, '$convert', function $$convert(node, transform, opts) {
var self = this, meth_name = nil, $ret_or_1 = nil, converter = nil;
if (transform == null) transform = nil;
if (opts == null) opts = $hash2([], {});
meth_name = "convert_" + (($truthy(($ret_or_1 = transform)) ? ($ret_or_1) : (node.$node_name())));
opts = ($truthy(($ret_or_1 = opts)) ? ($ret_or_1) : ($hash2([], {})));
converter = ($truthy(self['$respond_to?'](meth_name)) ? (self) : (self.delegate_converter));
if ($truthy(opts['$empty?']())) {
return converter.$send(meth_name, node)
} else {
return converter.$send(meth_name, node, opts)
};
}, -2);
$def(self, '$convert_title_slide', function $$convert_title_slide(node, opts) {
var self = this;
if (opts == null) opts = $hash2([], {});
node.$extend($$('Helpers'));
return $send(node, 'instance_eval', [], function $$11(){var self = $$11.$$s == null ? this : $$11.$$s, _buf = nil, bg_image = nil, bg_video = nil, _temple_html_attributeremover1 = nil, _temple_html_attributemerger1 = nil, _slim_codeattributes1 = nil, _slim_codeattributes2 = nil, _slim_codeattributes3 = nil, _slim_codeattributes4 = nil, _slim_codeattributes5 = nil, _slim_codeattributes6 = nil, _slim_codeattributes7 = nil, _slim_codeattributes8 = nil, _slim_codeattributes9 = nil, _slim_codeattributes10 = nil, _slim_codeattributes11 = nil, _slim_codeattributes12 = nil, _slim_codeattributes13 = nil, _slim_codeattributes14 = nil, _slim_codeattributes15 = nil, _title_obj = nil, _slice = nil, preamble = nil;
if (self.header == null) self.header = nil;
if (self.document == null) self.document = nil;
if (!$truthy(opts['$empty?']())) {
self.$converter().$set_local_variables(Opal.Binding.$new( function($code) { return eval($code); }, ["node", "opts"], self, ['asciidoctor-revealjs/converter.rb', 521]), opts)
};
_buf = [];
bg_image = ($truthy(self['$attr?']("title-slide-background-image")) ? (self.$image_uri(self.$attr("title-slide-background-image"))) : (nil));
bg_video = ($truthy(self['$attr?']("title-slide-background-video")) ? (self.$media_uri(self.$attr("title-slide-background-video"))) : (nil));
_buf['$<<']("<section");
_temple_html_attributeremover1 = [];
_temple_html_attributemerger1 = [];
_temple_html_attributemerger1['$[]='](0, "title");
_temple_html_attributemerger1['$[]='](1, []);
_slim_codeattributes1 = self.$role();
if ($eqeqeq($$('Array'), _slim_codeattributes1)) {
_slim_codeattributes1 = _slim_codeattributes1.$flatten();
$send(_slim_codeattributes1, 'map!', [], "to_s".$to_proc());
$send(_slim_codeattributes1, 'reject!', [], "empty?".$to_proc());
_temple_html_attributemerger1['$[]'](1)['$<<'](_slim_codeattributes1.$join(" "));
} else {
_temple_html_attributemerger1['$[]'](1)['$<<'](_slim_codeattributes1)
};
_temple_html_attributemerger1['$[]='](1, _temple_html_attributemerger1['$[]'](1).$join(""));
_temple_html_attributeremover1['$<<']($send(_temple_html_attributemerger1, 'reject', [], "empty?".$to_proc()).$join(" "));
_temple_html_attributeremover1 = _temple_html_attributeremover1.$join("");
if ($not(_temple_html_attributeremover1['$empty?']())) {
_buf['$<<'](" class=\"");
_buf['$<<'](_temple_html_attributeremover1);
_buf['$<<']("\"");
};
_buf['$<<'](" data-state=\"title\"");
_slim_codeattributes2 = self.$attr("title-slide-transition");
if ($truthy(_slim_codeattributes2)) {
if ($eqeq(_slim_codeattributes2, true)) {
_buf['$<<'](" data-transition")
} else {
_buf['$<<'](" data-transition=\"");
_buf['$<<'](_slim_codeattributes2);
_buf['$<<']("\"");
}
};
_slim_codeattributes3 = self.$attr("title-slide-transition-speed");
if ($truthy(_slim_codeattributes3)) {
if ($eqeq(_slim_codeattributes3, true)) {
_buf['$<<'](" data-transition-speed")
} else {
_buf['$<<'](" data-transition-speed=\"");
_buf['$<<'](_slim_codeattributes3);
_buf['$<<']("\"");
}
};
_slim_codeattributes4 = self.$attr("title-slide-background");
if ($truthy(_slim_codeattributes4)) {
if ($eqeq(_slim_codeattributes4, true)) {
_buf['$<<'](" data-background")
} else {
_buf['$<<'](" data-background=\"");
_buf['$<<'](_slim_codeattributes4);
_buf['$<<']("\"");
}
};
_slim_codeattributes5 = self.$attr("title-slide-background-size");
if ($truthy(_slim_codeattributes5)) {
if ($eqeq(_slim_codeattributes5, true)) {
_buf['$<<'](" data-background-size")
} else {
_buf['$<<'](" data-background-size=\"");
_buf['$<<'](_slim_codeattributes5);
_buf['$<<']("\"");
}
};
_slim_codeattributes6 = bg_image;
if ($truthy(_slim_codeattributes6)) {
if ($eqeq(_slim_codeattributes6, true)) {
_buf['$<<'](" data-background-image")
} else {
_buf['$<<'](" data-background-image=\"");
_buf['$<<'](_slim_codeattributes6);
_buf['$<<']("\"");
}
};
_slim_codeattributes7 = bg_video;
if ($truthy(_slim_codeattributes7)) {
if ($eqeq(_slim_codeattributes7, true)) {
_buf['$<<'](" data-background-video")
} else {
_buf['$<<'](" data-background-video=\"");
_buf['$<<'](_slim_codeattributes7);
_buf['$<<']("\"");
}
};
_slim_codeattributes8 = self.$attr("title-slide-background-video-loop");
if ($truthy(_slim_codeattributes8)) {
if ($eqeq(_slim_codeattributes8, true)) {
_buf['$<<'](" data-background-video-loop")
} else {
_buf['$<<'](" data-background-video-loop=\"");
_buf['$<<'](_slim_codeattributes8);
_buf['$<<']("\"");
}
};
_slim_codeattributes9 = self.$attr("title-slide-background-video-muted");
if ($truthy(_slim_codeattributes9)) {
if ($eqeq(_slim_codeattributes9, true)) {
_buf['$<<'](" data-background-video-muted")
} else {
_buf['$<<'](" data-background-video-muted=\"");
_buf['$<<'](_slim_codeattributes9);
_buf['$<<']("\"");
}
};
_slim_codeattributes10 = self.$attr("title-slide-background-opacity");
if ($truthy(_slim_codeattributes10)) {
if ($eqeq(_slim_codeattributes10, true)) {
_buf['$<<'](" data-background-opacity")
} else {
_buf['$<<'](" data-background-opacity=\"");
_buf['$<<'](_slim_codeattributes10);
_buf['$<<']("\"");
}
};
_slim_codeattributes11 = self.$attr("title-slide-background-iframe");
if ($truthy(_slim_codeattributes11)) {
if ($eqeq(_slim_codeattributes11, true)) {
_buf['$<<'](" data-background-iframe")
} else {
_buf['$<<'](" data-background-iframe=\"");
_buf['$<<'](_slim_codeattributes11);
_buf['$<<']("\"");
}
};
_slim_codeattributes12 = self.$attr("title-slide-background-color");
if ($truthy(_slim_codeattributes12)) {
if ($eqeq(_slim_codeattributes12, true)) {
_buf['$<<'](" data-background-color")
} else {
_buf['$<<'](" data-background-color=\"");
_buf['$<<'](_slim_codeattributes12);
_buf['$<<']("\"");
}
};
_slim_codeattributes13 = self.$attr("title-slide-background-repeat");
if ($truthy(_slim_codeattributes13)) {
if ($eqeq(_slim_codeattributes13, true)) {
_buf['$<<'](" data-background-repeat")
} else {
_buf['$<<'](" data-background-repeat=\"");
_buf['$<<'](_slim_codeattributes13);
_buf['$<<']("\"");
}
};
_slim_codeattributes14 = self.$attr("title-slide-background-position");
if ($truthy(_slim_codeattributes14)) {
if ($eqeq(_slim_codeattributes14, true)) {
_buf['$<<'](" data-background-position")
} else {
_buf['$<<'](" data-background-position=\"");
_buf['$<<'](_slim_codeattributes14);
_buf['$<<']("\"");
}
};
_slim_codeattributes15 = self.$attr("title-slide-background-transition");
if ($truthy(_slim_codeattributes15)) {
if ($eqeq(_slim_codeattributes15, true)) {
_buf['$<<'](" data-background-transition")
} else {
_buf['$<<'](" data-background-transition=\"");
_buf['$<<'](_slim_codeattributes15);
_buf['$<<']("\"");
}
};
_buf['$<<'](">");
if ($truthy((_title_obj = self.$doctitle($hash2(["partition", "use_fallback"], {"partition": true, "use_fallback": true})))['$subtitle?']())) {
_buf['$<<']("<h1>");
_buf['$<<'](self.$slice_text(_title_obj.$title(), (_slice = self.$header()['$option?']("slice"))));
_buf['$<<']("</h1><h2>");
_buf['$<<'](self.$slice_text(_title_obj.$subtitle(), _slice));
_buf['$<<']("</h2>");
} else {
_buf['$<<']("<h1>");
_buf['$<<'](self.header.$title());
_buf['$<<']("</h1>");
};
preamble = self.document.$find_by($hash2(["context"], {"context": "preamble"}));
if (!($truthy(preamble['$nil?']()) || ($eqeq(preamble.$length(), 0)))) {
_buf['$<<']("<div class=\"preamble\">");
_buf['$<<'](preamble.$pop().$content());
_buf['$<<']("</div>");
};
_buf['$<<'](self.$generate_authors(self.document));
_buf['$<<']("</section>");
return (_buf = _buf.$join(""));}, {$$s: self});
}, -2);
$def(self, '$convert_inline_image', function $$convert_inline_image(node, opts) {
var self = this;
if (opts == null) opts = $hash2([], {});
node.$extend($$('Helpers'));
return $send(node, 'instance_eval', [], function $$12(){var self = $$12.$$s == null ? this : $$12.$$s, _buf = nil, _slim_controls1 = nil;
if (self.type == null) self.type = nil;
if (self.attributes == null) self.attributes = nil;
if (!$truthy(opts['$empty?']())) {
self.$converter().$set_local_variables(Opal.Binding.$new( function($code) { return eval($code); }, ["node", "opts"], self, ['asciidoctor-revealjs/converter.rb', 556]), opts)
};
_buf = [];
_slim_controls1 = $send(self, 'html_tag', ["span", $hash2(["class", "style"], {"class": [self.type, self.$role(), (($truthy(self['$option?']("step")) || ($truthy(self['$attr?']("step")))) ? ("fragment") : nil)], "style": ($truthy(self['$attr?']("float")) ? ("float: " + (self.$attr("float"))) : nil)}).$merge(self.$data_attrs(self.attributes))], function $$13(){var self = $$13.$$s == null ? this : $$13.$$s, _slim_controls2 = nil;
_slim_controls2 = [];
_slim_controls2['$<<'](self.$convert_inline_image());
return (_slim_controls2 = _slim_controls2.$join(""));}, {$$s: self});
_buf['$<<'](_slim_controls1);
return (_buf = _buf.$join(""));}, {$$s: self});
}, -2);
$def(self, '$convert_literal', function $$convert_literal(node, opts) {
var self = this;
if (opts == null) opts = $hash2([], {});
node.$extend($$('Helpers'));
return $send(node, 'instance_eval', [], function $$14(){var self = $$14.$$s == null ? this : $$14.$$s, _buf = nil, _slim_controls1 = nil;
if (self.attributes == null) self.attributes = nil;
if (!$truthy(opts['$empty?']())) {
self.$converter().$set_local_variables(Opal.Binding.$new( function($code) { return eval($code); }, ["node", "opts"], self, ['asciidoctor-revealjs/converter.rb', 566]), opts)
};
_buf = [];
_slim_controls1 = $send(self, 'html_tag', ["div", $hash2(["id", "class"], {"id": self.$id(), "class": ["literalblock", self.$role(), (($truthy(self['$o