From ba05fcfc68259fe63cf71c142f0571208385b046 Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Thu, 19 Jun 2014 15:00:51 +0200 Subject: [PATCH] Upgrade Asciidoctor to 1.5.0-preview.7 & Opal to 0.6.2 --- data/asciidoctor.js | 19781 ++++++++++++++++++++++++------------------ data/opal.js | 4651 +++++----- 2 files changed, 14066 insertions(+), 10366 deletions(-) diff --git a/data/asciidoctor.js b/data/asciidoctor.js index f43b5f6..d75c370 100644 --- a/data/asciidoctor.js +++ b/data/asciidoctor.js @@ -1,31 +1,36 @@ -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $module = $opal.module; + (function($base, $super) { function $Set(){}; var self = $Set = $klass($base, $super, 'Set', $Set); - var def = $Set._proto, $scope = $Set._scope, TMP_1, TMP_4, TMP_6; + var def = self._proto, $scope = self._scope, TMP_1, TMP_4, TMP_6; + def.hash = nil; self.$include($scope.Enumerable); $opal.defs(self, '$[]', function(ary) { var self = this; + ary = $slice.call(arguments, 0); return self.$new(ary); }); def.$initialize = TMP_1 = function(enum$) { var $a, $b, TMP_2, self = this, $iter = TMP_1._p, block = $iter || nil; + if (enum$ == null) { enum$ = nil } TMP_1._p = null; self.hash = $scope.Hash.$new(); - if (($a = enum$['$nil?']()) !== false && $a !== nil) { + if ((($a = enum$['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { return nil}; if (block !== false && block !== nil) { - return ($a = ($b = self).$do_with_enum, $a._p = (TMP_2 = function(o){var self = TMP_2._s || this;if (o == null) o = nil; + return ($a = ($b = self).$do_with_enum, $a._p = (TMP_2 = function(o){var self = TMP_2._s || this; +if (o == null) o = nil; return self.$add(block['$[]'](o))}, TMP_2._s = self, TMP_2), $a).call($b, enum$) } else { return self.$merge(enum$) @@ -34,11 +39,12 @@ def['$=='] = function(other) { var $a, $b, TMP_3, self = this; - if (($a = self['$equal?'](other)) !== false && $a !== nil) { + + if ((($a = self['$equal?'](other)) !== nil && (!$a._isBoolean || $a == true))) { return true - } else if (($a = other['$instance_of?'](self.$class())) !== false && $a !== nil) { + } else if ((($a = other['$instance_of?'](self.$class())) !== nil && (!$a._isBoolean || $a == true))) { return self.hash['$=='](other.$instance_variable_get("@hash")) - } else if (($a = ($b = other['$is_a?']($scope.Set), $b !== false && $b !== nil ?self.$size()['$=='](other.$size()) : $b)) !== false && $a !== nil) { + } else if ((($a = ($b = other['$is_a?']($scope.Set), $b !== false && $b !== nil ?self.$size()['$=='](other.$size()) : $b)) !== nil && (!$a._isBoolean || $a == true))) { return ($a = ($b = other)['$all?'], $a._p = (TMP_3 = function(o){var self = TMP_3._s || this; if (self.hash == null) self.hash = nil; if (o == null) o = nil; @@ -50,6 +56,7 @@ if (o == null) o = nil; def.$add = function(o) { var self = this; + self.hash['$[]='](o, true); return self; }; @@ -58,7 +65,8 @@ if (o == null) o = nil; def['$add?'] = function(o) { var $a, self = this; - if (($a = self['$include?'](o)) !== false && $a !== nil) { + + if ((($a = self['$include?'](o)) !== nil && (!$a._isBoolean || $a == true))) { return nil } else { return self.$add(o) @@ -67,26 +75,32 @@ if (o == null) o = nil; def.$each = TMP_4 = function() { var $a, $b, self = this, $iter = TMP_4._p, block = $iter || nil; + TMP_4._p = null; - if (block === nil) { - return self.$enum_for("each")}; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; ($a = ($b = self.hash).$each_key, $a._p = block.$to_proc(), $a).call($b); return self; }; def['$empty?'] = function() { var self = this; + return self.hash['$empty?'](); }; def.$clear = function() { var self = this; + self.hash.$clear(); return self; }; def['$include?'] = function(o) { var self = this; + return self.hash['$include?'](o); }; @@ -94,19 +108,23 @@ if (o == null) o = nil; def.$merge = function(enum$) { var $a, $b, TMP_5, self = this; - ($a = ($b = self).$do_with_enum, $a._p = (TMP_5 = function(o){var self = TMP_5._s || this;if (o == null) o = nil; + + ($a = ($b = self).$do_with_enum, $a._p = (TMP_5 = function(o){var self = TMP_5._s || this; +if (o == null) o = nil; return self.$add(o)}, TMP_5._s = self, TMP_5), $a).call($b, enum$); return self; }; def.$do_with_enum = TMP_6 = function(enum$) { var $a, $b, self = this, $iter = TMP_6._p, block = $iter || nil; + TMP_6._p = null; return ($a = ($b = enum$).$each, $a._p = block.$to_proc(), $a).call($b); }; def.$size = function() { var self = this; + return self.hash.$size(); }; @@ -114,15 +132,18 @@ if (o == null) o = nil; return (def.$to_a = function() { var self = this; + return self.hash.$keys(); - }, nil); + }, nil) && 'to_a'; })(self, null); return (function($base) { var self = $module($base, 'Enumerable'); var def = self._proto, $scope = self._scope, TMP_7; + def.$to_set = TMP_7 = function(klass, args) { var $a, $b, self = this, $iter = TMP_7._p, block = $iter || nil; + args = $slice.call(arguments, 1); if (klass == null) { klass = $scope.Set @@ -133,9003 +154,11761 @@ if (o == null) o = nil; ;$opal.donate(self, ["$to_set"]); })(self); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; - return (function($base, $super) { - function $StringScanner(){}; - var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner); + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; - var def = $StringScanner._proto, $scope = $StringScanner._scope; - def.pos = def.string = def.working = def.prev_pos = def.matched = def.match = nil; - self.$attr_reader("pos"); + return (function($base) { + var self = $module($base, 'Comparable'); - self.$attr_reader("matched"); + var def = self._proto, $scope = self._scope; - def.$initialize = function(string) { - var self = this; - self.string = string; - self.pos = 0; - self.matched = nil; - self.working = string; - return self.match = []; + $opal.defs(self, '$normalize', function(what) { + var $a, self = this; + + if ((($a = $scope.Integer['$==='](what)) !== nil && (!$a._isBoolean || $a == true))) { + return what}; + if (what['$>'](0)) { + return 1}; + if (what['$<'](0)) { + return -1}; + return 0; + }); + + def['$=='] = function(other) { + var $a, self = this, cmp = nil; + + try { + if ((($a = self['$equal?'](other)) !== nil && (!$a._isBoolean || $a == true))) { + return true}; + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; + return $scope.Comparable.$normalize(cmp)['$=='](0); + } catch ($err) {if ($opal.$rescue($err, [$scope.StandardError])) { + return false + }else { throw $err; } + }; }; - def['$bol?'] = function() { - var self = this; - return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n"; + def['$>'] = function(other) { + var $a, self = this, cmp = nil; + + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $scope.Comparable.$normalize(cmp)['$>'](0); }; - def.$scan = function(regex) { - var self = this; - - var regex = new RegExp('^' + regex.toString().substring(1, regex.toString().length - 1)), - result = regex.exec(self.working); + def['$>='] = function(other) { + var $a, self = this, cmp = nil; - if (result == null) { - return self.matched = nil; - } - else if (typeof(result) === 'object') { - self.prev_pos = self.pos; - self.pos += result[0].length; - self.working = self.working.substring(result[0].length); - self.matched = result[0]; - self.match = result; + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $scope.Comparable.$normalize(cmp)['$>='](0); + }; - return result[0]; - } - else if (typeof(result) === 'string') { - self.pos += result.length; - self.working = self.working.substring(result.length); + def['$<'] = function(other) { + var $a, self = this, cmp = nil; - return result; - } - else { - return nil; - } - ; + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $scope.Comparable.$normalize(cmp)['$<'](0); }; - def['$[]'] = function(idx) { + def['$<='] = function(other) { + var $a, self = this, cmp = nil; + + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; + return $scope.Comparable.$normalize(cmp)['$<='](0); + }; + + def['$between?'] = function(min, max) { var self = this; - - var match = self.match; - if (idx < 0) { - idx += match.length; - } + if (self['$<'](min)) { + return false}; + if (self['$>'](max)) { + return false}; + return true; + }; + ;$opal.donate(self, ["$==", "$>", "$>=", "$<", "$<=", "$between?"]); + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $gvars = $opal.gvars; - if (idx < 0 || idx >= match.length) { - return nil; + ; + (function($base, $super) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7; + + def.length = nil; + self.$include($scope.Comparable); + + def._isString = true; + + $opal.defs(self, '$try_convert', function(what) { + var self = this; + + try { + return what.$to_str() + } catch ($err) {if (true) { + return nil + }else { throw $err; } + }; + }); + + $opal.defs(self, '$new', function(str) { + var self = this; + + if (str == null) { + str = "" } + return new String(str); + }); - return match[idx]; - ; + def['$%'] = function(data) { + var $a, self = this; + + if ((($a = $scope.Array['$==='](data)) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = self).$format.apply($a, [self].concat(data)) + } else { + return self.$format(self, data) + }; }; - def.$check = function(regex) { + def['$*'] = function(count) { var self = this; + - var regexp = new RegExp('^' + regex.toString().substring(1, regex.toString().length - 1)), - result = regexp.exec(self.working); + if (count < 1) { + return ''; + } - if (result == null) { - return self.matched = nil; + var result = '', + pattern = self; + + while (count > 0) { + if (count & 1) { + result += pattern; + } + + count >>= 1; + pattern += pattern; } - return self.matched = result[0]; - ; + return result; + }; - def.$peek = function(length) { + def['$+'] = function(other) { var self = this; - return self.working.substring(0, length); + + other = $scope.Opal.$coerce_to(other, $scope.String, "to_str"); + return self + other.$to_s(); }; - def['$eos?'] = function() { - var self = this; - return self.working.length === 0; + def['$<=>'] = function(other) { + var $a, self = this; + + if ((($a = other['$respond_to?']("to_str")) !== nil && (!$a._isBoolean || $a == true))) { + other = other.$to_str().$to_s(); + return self > other ? 1 : (self < other ? -1 : 0); + } else { + + var cmp = other['$<=>'](self); + + if (cmp === nil) { + return nil; + } + else { + return cmp > 0 ? -1 : (cmp < 0 ? 1 : 0); + } + ; + }; }; - def.$skip = function(re) { + def['$=='] = function(other) { + var $a, self = this; + + if ((($a = $scope.String['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; + return self.$to_s() == other.$to_s(); + }; + + $opal.defn(self, '$eql?', def['$==']); + + $opal.defn(self, '$===', def['$==']); + + def['$=~'] = function(other) { var self = this; - - re = new RegExp('^' + re.source) - var result = re.exec(self.working); - if (result == null) { - return self.matched = nil; - } - else { - var match_str = result[0]; - var match_len = match_str.length; - self.matched = match_str; - self.prev_pos = self.pos; - self.pos += match_len; - self.working = self.working.substring(match_len); - return match_len; + + if (other._isString) { + self.$raise($scope.TypeError, "type mismatch: String given"); } + + return other['$=~'](self); ; }; - def.$get_byte = function() { + def['$[]'] = function(index, length) { var self = this; + - var result = nil; - if (self.pos < self.string.length) { - self.prev_pos = self.pos; - self.pos += 1; - result = self.matched = self.working.substring(0, 1); - self.working = self.working.substring(1); + var size = self.length; + + if (index._isRange) { + var exclude = index.exclude, + length = index.end, + index = index.begin; + + if (index < 0) { + index += size; + } + + if (length < 0) { + length += size; + } + + if (!exclude) { + length += 1; + } + + if (index > size) { + return nil; + } + + length = length - index; + + if (length < 0) { + length = 0; + } + + return self.substr(index, length); } - else { - self.matched = nil; + + if (index < 0) { + index += self.length; } - return result; - ; - }; + if (length == null) { + if (index >= self.length || index < 0) { + return nil; + } - $opal.defn(self, '$getch', def.$get_byte); + return self.substr(index, 1); + } - def['$pos='] = function(pos) { - var self = this; - - if (pos < 0) { - pos += self.string.$length(); + if (index > self.length || index < 0) { + return nil; } - ; - self.pos = pos; - return self.working = self.string.slice(pos); + + return self.substr(index, length); + }; - def.$rest = function() { + def.$capitalize = function() { var self = this; - return self.working; + + return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase(); }; - def.$terminate = function() { + def.$casecmp = function(other) { var self = this; - self.match = nil; - return self['$pos='](self.string.$length()); + + other = $scope.Opal.$coerce_to(other, $scope.String, "to_str").$to_s(); + return (self.toLowerCase())['$<=>'](other.toLowerCase()); }; - return (def.$unscan = function() { - var self = this; - self.pos = self.prev_pos; - self.prev_pos = nil; - self.match = nil; - return self; - }, nil); - })(self, null) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; - return (function($base, $super) { - function $Dir(){}; - var self = $Dir = $klass($base, $super, 'Dir', $Dir); + def.$center = function(width, padstr) { + var $a, self = this; - var def = $Dir._proto, $scope = $Dir._scope; - $opal.defs(self, '$pwd', function() { - var self = this; - return "."; - }); + if (padstr == null) { + padstr = " " + } + width = $scope.Opal.$coerce_to(width, $scope.Integer, "to_int"); + padstr = $scope.Opal.$coerce_to(padstr, $scope.String, "to_str").$to_s(); + if ((($a = padstr['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.$raise($scope.ArgumentError, "zero width padding")}; + if ((($a = width <= self.length) !== nil && (!$a._isBoolean || $a == true))) { + return self}; + + var ljustified = self.$ljust((width['$+'](self.length))['$/'](2).$ceil(), padstr), + rjustified = self.$rjust((width['$+'](self.length))['$/'](2).$floor(), padstr); - return ($opal.defs(self, '$home', function() { - var self = this; - return $scope.ENV['$[]']("HOME"); - }), nil); - })(self, null) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; - return (function($base, $super) { - function $SecurityError(){}; - var self = $SecurityError = $klass($base, $super, 'SecurityError', $SecurityError); + return rjustified + ljustified.slice(self.length); + ; + }; - var def = $SecurityError._proto, $scope = $SecurityError._scope; - return nil; - })(self, $scope.Exception) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $range = $opal.range; - return (function($base, $super) { - function $File(){}; - var self = $File = $klass($base, $super, 'File', $File); + def.$chars = TMP_1 = function() { + var $a, $b, self = this, $iter = TMP_1._p, block = $iter || nil; - var def = $File._proto, $scope = $File._scope; - $opal.cdecl($scope, 'SEPARATOR', "/"); + TMP_1._p = null; + if (block !== false && block !== nil) { + } else { + return self.$each_char().$to_a() + }; + return ($a = ($b = self).$each_char, $a._p = block.$to_proc(), $a).call($b); + }; - $opal.cdecl($scope, 'ALT_SEPARATOR', nil); + def.$chomp = function(separator) { + var $a, self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; - $opal.defs(self, '$expand_path', function(path) { + if (separator == null) { + separator = $gvars["/"] + } + if ((($a = separator === nil || self.length === 0) !== nil && (!$a._isBoolean || $a == true))) { + return self}; + separator = $scope.Opal['$coerce_to!'](separator, $scope.String, "to_str").$to_s(); + + if (separator === "\n") { + return self.replace(/\r?\n?$/, ''); + } + else if (separator === "") { + return self.replace(/(\r?\n)+$/, ''); + } + else if (self.length > separator.length) { + var tail = self.substr(self.length - separator.length, separator.length); + + if (tail === separator) { + return self.substr(0, self.length - separator.length); + } + } + + return self; + }; + + def.$chop = function() { var self = this; - return path; - }); - $opal.defs(self, '$join', function(paths) { + + var length = self.length; + + if (length <= 1) { + return ""; + } + + if (self.charAt(length - 1) === "\n" && self.charAt(length - 2) === "\r") { + return self.substr(0, length - 2); + } + else { + return self.substr(0, length - 1); + } + + }; + + def.$chr = function() { var self = this; - paths = $slice.call(arguments, 0); - return paths['$*']($scope.SEPARATOR); - }); - $opal.defs(self, '$basename', function(path) { - var $a, self = this; - return path['$[]']($range(((((($a = path.$rindex(($scope.File)._scope.SEPARATOR)) !== false && $a !== nil) ? $a : -1))['$+'](1)), -1, false)); - }); + return self.charAt(0); + }; - $opal.defs(self, '$dirname', function(path) { - var $a, self = this; - return path['$[]']($range(0, ((((($a = path.$rindex($scope.SEPARATOR)) !== false && $a !== nil) ? $a : 0))['$-'](1)), false)); - }); + def.$clone = function() { + var self = this, copy = nil; - return ($opal.defs(self, '$extname', function(path) { - var $a, self = this, last_dot_idx = nil; - if (($a = path.$to_s()['$empty?']()) !== false && $a !== nil) { - return ""}; - last_dot_idx = path['$[]']($range(1, -1, false)).$rindex("."); - if (($a = last_dot_idx['$nil?']()) !== false && $a !== nil) { - return "" - } else { - return path['$[]']($range((last_dot_idx['$+'](1)), -1, false)) - }; - }), nil); - })(self, null) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + copy = self.slice(); + copy.$initialize_clone(self); + return copy; + }; - var def = self._proto, $scope = self._scope; - (function($base) { - var self = $module($base, 'Debug'); + def.$dup = function() { + var self = this, copy = nil; - var def = self._proto, $scope = self._scope, TMP_1; - self.show_debug = nil; + copy = self.slice(); + copy.$initialize_dup(self); + return copy; + }; - $opal.defs(self, '$debug', TMP_1 = function() { - var $a, self = this, $iter = TMP_1._p, $yield = $iter || nil; - TMP_1._p = null; - if (($a = self['$show_debug_output?']()) !== false && $a !== nil) { - return self.$warn(((($a = $opal.$yieldX($yield, [])) === $breaker) ? $breaker.$v : $a)) - } else { - return nil - }; - }); + def.$count = function(str) { + var self = this; - $opal.defs(self, '$set_debug', function(value) { - var self = this; - return self.show_debug = value; - }); + return (self.length - self.replace(new RegExp(str, 'g'), '').length) / str.length; + }; - $opal.defs(self, '$show_debug_output?', function() { - var $a, $b, $c, self = this; - if (self.show_debug == null) self.show_debug = nil; + $opal.defn(self, '$dup', def.$clone); - return ((($a = self.show_debug) !== false && $a !== nil) ? $a : ((($b = $scope.ENV['$[]']("DEBUG")['$==']("true")) ? ($c = $scope.ENV['$[]']("SUPPRESS_DEBUG")['$==']("true"), ($c === nil || $c === false)) : $b))); - }); + def.$downcase = function() { + var self = this; - $opal.defs(self, '$puts_indented', function(level, args) { - var $a, $b, TMP_2, self = this, indentation = nil; - args = $slice.call(arguments, 1); - indentation = " "['$*'](level)['$*'](2); - return ($a = ($b = args).$each, $a._p = (TMP_2 = function(arg){var self = TMP_2._s || this, $a, $b, TMP_3;if (arg == null) arg = nil; - return ($a = ($b = self).$debug, $a._p = (TMP_3 = function(){var self = TMP_3._s || this; - return "" + (indentation) + (arg)}, TMP_3._s = self, TMP_3), $a).call($b)}, TMP_2._s = self, TMP_2), $a).call($b); - }); + return self.toLowerCase(); + }; + + def.$each_char = TMP_2 = function() { + var $a, self = this, $iter = TMP_2._p, block = $iter || nil; + + TMP_2._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("each_char") + }; - })(self) + for (var i = 0, length = self.length; i < length; i++) { + ((($a = $opal.$yield1(block, self.charAt(i))) === $breaker) ? $breaker.$v : $a); + } - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + return self; + }; - var def = self._proto, $scope = self._scope; - $opal.cdecl($scope, 'VERSION', "1.5.0.preview.1") - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $range = $opal.range, $gvars = $opal.gvars; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + def.$each_line = TMP_3 = function(separator) { + var $a, self = this, $iter = TMP_3._p, $yield = $iter || nil; + if ($gvars["/"] == null) $gvars["/"] = nil; - var def = self._proto, $scope = self._scope; - (function($base) { - var self = $module($base, 'Helpers'); + if (separator == null) { + separator = $gvars["/"] + } + TMP_3._p = null; + if (($yield !== nil)) { + } else { + return self.$split(separator) + }; + + var chomped = self.$chomp(), + trailing = self.length != chomped.length, + splitted = chomped.split(separator); - var def = self._proto, $scope = self._scope; - $opal.defs(self, '$require_library', function(name, gem) { - var $a, self = this, e = nil; - if (gem == null) { - gem = true + for (var i = 0, length = splitted.length; i < length; i++) { + if (i < length - 1 || trailing) { + ((($a = $opal.$yield1($yield, splitted[i] + separator)) === $breaker) ? $breaker.$v : $a); } - try { - return true - } catch ($err) {if ($scope.LoadError['$===']($err)) {e = $err; - if (gem !== false && gem !== nil) { - return self.$fail("asciidoctor: FAILED: required gem '" + ((function() {if (($a = gem['$==='](true)) !== false && $a !== nil) { - return name - } else { - return gem - }; return nil; })()) + "' is not installed. Processing aborted.") - } else { - return self.$fail("asciidoctor: FAILED: " + (e.$message().$chomp(".")) + ". Processing aborted.") - } - }else { throw $err; } - }; - }); + else { + ((($a = $opal.$yield1($yield, splitted[i])) === $breaker) ? $breaker.$v : $a); + } + } + ; + return self; + }; - $opal.defs(self, '$normalize_lines', function(data) { - var $a, self = this; - if (data.$class()['$==']((($a = $opal.Object._scope.String) == null ? $opal.cm('String') : $a))) { - return (self.$normalize_lines_from_string(data)) - } else { - return (self.$normalize_lines_array(data)) - }; - }); + def['$empty?'] = function() { + var self = this; - $opal.defs(self, '$normalize_lines_array', function(data) { - var $a, $b, TMP_1, $c, TMP_2, $d, TMP_3, $e, TMP_4, self = this, utf8 = nil, leading_bytes = nil, first_line = nil, leading_2_bytes = nil; - if (($a = data.$size()['$>'](0)) === false || $a === nil) { - return []}; - if (($a = $scope.COERCE_ENCODING) !== false && $a !== nil) { - utf8 = ((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8; - leading_bytes = (function() {if (($a = (first_line = data.$first())) !== false && $a !== nil) { - return first_line['$[]']($range(0, 2, false)).$bytes().$to_a() - } else { - return nil - }; return nil; })(); - if (((leading_2_bytes = leading_bytes['$[]']($range(0, 1, false))))['$==']($scope.BOM_BYTES_UTF_16LE)) { - return ($a = ($b = ((data.$join().$force_encoding(((($c = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $c))._scope.UTF_16LE))['$[]']($range(1, -1, false)).$encode(utf8)).$lines()).$map, $a._p = (TMP_1 = function(line){var self = TMP_1._s || this;if (line == null) line = nil; - return line.$rstrip()}, TMP_1._s = self, TMP_1), $a).call($b) - } else if (leading_2_bytes['$==']($scope.BOM_BYTES_UTF_16BE)) { - data['$[]='](0, (first_line.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_16BE))['$[]']($range(1, -1, false))); - return ($a = ($c = data).$map, $a._p = (TMP_2 = function(line){var self = TMP_2._s || this, $a;if (line == null) line = nil; - return "" + (((line.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_16BE)).$encode(utf8)).$rstrip())}, TMP_2._s = self, TMP_2), $a).call($c); - } else if (leading_bytes['$[]']($range(0, 2, false))['$==']($scope.BOM_BYTES_UTF_8)) { - data['$[]='](0, (first_line.$force_encoding(utf8))['$[]']($range(1, -1, false)))}; - return ($a = ($d = data).$map, $a._p = (TMP_3 = function(line){var self = TMP_3._s || this;if (line == null) line = nil; - if (line.$encoding()['$=='](utf8)) { - return line.$rstrip() - } else { - return (line.$force_encoding(utf8)).$rstrip() - }}, TMP_3._s = self, TMP_3), $a).call($d); - } else { - if (($a = ($e = (first_line = data.$first()), $e !== false && $e !== nil ?first_line['$[]']($range(0, 2, false)).$bytes().$to_a()['$==']($scope.BOM_BYTES_UTF_8) : $e)) !== false && $a !== nil) { - data['$[]='](0, first_line['$[]']($range(3, -1, false)))}; - return ($a = ($e = data).$map, $a._p = (TMP_4 = function(line){var self = TMP_4._s || this;if (line == null) line = nil; - return line.$rstrip()}, TMP_4._s = self, TMP_4), $a).call($e); - }; - }); + return self.length === 0; + }; - $opal.defs(self, '$normalize_lines_from_string', function(data) { - var $a, $b, TMP_5, self = this, utf8 = nil, leading_bytes = nil, leading_2_bytes = nil; - if (($a = ((($b = data['$nil?']()) !== false && $b !== nil) ? $b : data['$=='](""))) !== false && $a !== nil) { - return []}; - if (($a = $scope.COERCE_ENCODING) !== false && $a !== nil) { - utf8 = ((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8; - leading_bytes = data['$[]']($range(0, 2, false)).$bytes().$to_a(); - if (((leading_2_bytes = leading_bytes['$[]']($range(0, 1, false))))['$==']($scope.BOM_BYTES_UTF_16LE)) { - data = (data.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_16LE))['$[]']($range(1, -1, false)).$encode(utf8) - } else if (leading_2_bytes['$==']($scope.BOM_BYTES_UTF_16BE)) { - data = (data.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_16BE))['$[]']($range(1, -1, false)).$encode(utf8) - } else if (leading_bytes['$[]']($range(0, 2, false))['$==']($scope.BOM_BYTES_UTF_8)) { - data = (function() {if (data.$encoding()['$=='](utf8)) { - return data['$[]']($range(1, -1, false)) - } else { - return (data.$force_encoding(utf8))['$[]']($range(1, -1, false)) - }; return nil; })() - } else if (($a = data.$encoding()['$=='](utf8)) === false || $a === nil) { - data = data.$force_encoding(utf8)}; - } else if (data['$[]']($range(0, 2, false)).$bytes().$to_a()['$==']($scope.BOM_BYTES_UTF_8)) { - data = data['$[]']($range(3, -1, false))}; - return ($a = ($b = data.$each_line()).$map, $a._p = (TMP_5 = function(line){var self = TMP_5._s || this;if (line == null) line = nil; - return line.$rstrip()}, TMP_5._s = self, TMP_5), $a).call($b); - }); + def['$end_with?'] = function(suffixes) { + var self = this; - $opal.defs(self, '$encode_uri', function(str) { - var $a, $b, TMP_6, self = this; - return ($a = ($b = str).$gsub, $a._p = (TMP_6 = function(){var self = TMP_6._s || this, $a, $b, TMP_7; - return ($a = ($b = $gvars["&"].$each_byte()).$map, $a._p = (TMP_7 = function(c){var self = TMP_7._s || this;if (c == null) c = nil; - return self.$sprintf("%%%02X", c)}, TMP_7._s = self, TMP_7), $a).call($b).$join()}, TMP_6._s = self, TMP_6), $a).call($b, $scope.REGEXP['$[]']("uri_encode_chars")); - }); + suffixes = $slice.call(arguments, 0); + + for (var i = 0, length = suffixes.length; i < length; i++) { + var suffix = $scope.Opal.$coerce_to(suffixes[i], $scope.String, "to_str").$to_s(); - $opal.defs(self, '$rootname', function(file_name) { - var $a, self = this, ext = nil; - ext = $scope.File.$extname(file_name); - if (($a = ext['$empty?']()) !== false && $a !== nil) { - return file_name - } else { - return file_name['$[]']($range(0, ext.$length()['$-@'](), true)) - }; - }); + if (self.length >= suffix.length && + self.substr(self.length - suffix.length, suffix.length) == suffix) { + return true; + } + } + + return false; + }; - $opal.defs(self, '$mkdir_p', function(dir) { - var $a, $b, $c, self = this, parent_dir = nil; - if (($a = $scope.File['$directory?'](dir)) !== false && $a !== nil) { - return nil - } else { - parent_dir = $scope.File.$dirname(dir); - if (($a = ($b = ($c = $scope.File['$directory?'](parent_dir = $scope.File.$dirname(dir)), ($c === nil || $c === false)), $b !== false && $b !== nil ?($c = parent_dir['$==']("."), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - self.$mkdir_p(parent_dir)}; - return $scope.Dir.$mkdir(dir); - }; - }); + $opal.defn(self, '$eql?', def['$==']); - $opal.defs(self, '$clone_options', function(opts) { - var $a, self = this, clone = nil; - clone = opts.$dup(); - if (($a = opts['$has_key?']("attributes")) !== false && $a !== nil) { - clone['$[]=']("attributes", opts['$[]']("attributes").$dup())}; - return clone; - }); + $opal.defn(self, '$equal?', def['$===']); + + def.$gsub = TMP_4 = function(pattern, replace) { + var $a, $b, self = this, $iter = TMP_4._p, block = $iter || nil; + + TMP_4._p = null; + if ((($a = ((($b = $scope.String['$==='](pattern)) !== false && $b !== nil) ? $b : pattern['$respond_to?']("to_str"))) !== nil && (!$a._isBoolean || $a == true))) { + pattern = (new RegExp("" + $scope.Regexp.$escape(pattern.$to_str())))}; + if ((($a = $scope.Regexp['$==='](pattern)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; - })(self) + var pattern = pattern.toString(), + options = pattern.substr(pattern.lastIndexOf('/') + 1) + 'g', + regexp = pattern.substr(1, pattern.lastIndexOf('/') - 1); + + self.$sub._p = block; + return self.$sub(new RegExp(regexp, options), replace); - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $hash2 = $opal.hash2, $gvars = $opal.gvars, $range = $opal.range; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + }; - var def = self._proto, $scope = self._scope; - (function($base) { - var self = $module($base, 'Substitutors'); + def.$hash = function() { + var self = this; - var def = self._proto, $scope = self._scope; - $opal.cdecl($scope, 'SUBS', $hash2(["basic", "normal", "verbatim", "title", "header", "pass"], {"basic": ["specialcharacters"], "normal": ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"], "verbatim": ["specialcharacters", "callouts"], "title": ["specialcharacters", "quotes", "replacements", "macros", "attributes", "post_replacements"], "header": ["specialcharacters", "attributes"], "pass": []})); + return self.toString(); + }; - $opal.cdecl($scope, 'COMPOSITE_SUBS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": [], "normal": $scope.SUBS['$[]']("normal"), "verbatim": $scope.SUBS['$[]']("verbatim"), "specialchars": ["specialcharacters"]})); + def.$hex = function() { + var self = this; - $opal.cdecl($scope, 'SUB_SYMBOLS', $hash2(["a", "m", "n", "p", "q", "r", "c", "v"], {"a": "attributes", "m": "macros", "n": "normal", "p": "post_replacements", "q": "quotes", "r": "replacements", "c": "specialcharacters", "v": "verbatim"})); + return self.$to_i(16); + }; - $opal.cdecl($scope, 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $scope.COMPOSITE_SUBS.$keys()['$+']($scope.SUBS['$[]']("normal"))['$+'](["callouts"]), "inline": $scope.COMPOSITE_SUBS.$keys()['$+']($scope.SUBS['$[]']("normal"))})); + def['$include?'] = function(other) { + var $a, self = this; - self.$attr_reader("passthroughs"); + + if (other._isString) { + return self.indexOf(other) !== -1; + } + + if ((($a = other['$respond_to?']("to_str")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "no implicit conversion of " + (other.$class().$name()) + " into String") + }; + return self.indexOf(other.$to_str()) !== -1; + }; - def.$apply_subs = function(source, subs, expand) { - var $a, $b, TMP_1, $c, TMP_2, self = this, effective_subs = nil, multiline = nil, text = nil, has_passthroughs = nil; - if (subs == null) { - subs = "normal" - } - if (expand == null) { - expand = false + def.$index = function(what, offset) { + var $a, self = this, result = nil; + + if (offset == null) { + offset = nil + } + if ((($a = $scope.String['$==='](what)) !== nil && (!$a._isBoolean || $a == true))) { + what = what.$to_s() + } else if ((($a = what['$respond_to?']("to_str")) !== nil && (!$a._isBoolean || $a == true))) { + what = what.$to_str().$to_s() + } else if ((($a = $scope.Regexp['$==='](what)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + self.$raise($scope.TypeError, "type mismatch: " + (what.$class()) + " given")}; + result = -1; + if (offset !== false && offset !== nil) { + offset = $scope.Opal.$coerce_to(offset, $scope.Integer, "to_int"); + + var size = self.length; + + if (offset < 0) { + offset = offset + size; + } + + if (offset > size) { + return nil; } - if (subs['$==']("normal")) { - subs = $scope.SUBS['$[]']("normal") - } else if (($a = subs['$nil?']()) !== false && $a !== nil) { - return source - } else if (expand !== false && expand !== nil) { - if (($a = subs['$is_a?']($scope.Symbol)) !== false && $a !== nil) { - subs = ((($a = $scope.COMPOSITE_SUBS['$[]'](subs)) !== false && $a !== nil) ? $a : [subs]) - } else { - effective_subs = []; - ($a = ($b = subs).$each, $a._p = (TMP_1 = function(key){var self = TMP_1._s || this, $a;if (key == null) key = nil; - if (($a = $scope.COMPOSITE_SUBS['$has_key?'](key)) !== false && $a !== nil) { - return effective_subs = effective_subs['$+']($scope.COMPOSITE_SUBS['$[]'](key)) - } else { - return effective_subs['$<<'](key) - }}, TMP_1._s = self, TMP_1), $a).call($b); - subs = effective_subs; - }}; - if (($a = subs['$empty?']()) !== false && $a !== nil) { - return source}; - multiline = source['$is_a?']((($a = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $a)); - text = (function() {if (multiline !== false && multiline !== nil) { - return (source['$*']($scope.EOL)) - } else { - return source - }; return nil; })(); - if (($a = (has_passthroughs = subs['$include?']("macros"))) !== false && $a !== nil) { - text = self.$extract_passthroughs(text)}; - ($a = ($c = subs).$each, $a._p = (TMP_2 = function(type){var self = TMP_2._s || this, $a, $case = nil;if (type == null) type = nil; - return (function() {$case = type;if ("specialcharacters"['$===']($case)) {return text = self.$sub_specialcharacters(text)}else if ("quotes"['$===']($case)) {return text = self.$sub_quotes(text)}else if ("attributes"['$===']($case)) {return text = self.$sub_attributes(text.$split($scope.LINE_SPLIT))['$*']($scope.EOL)}else if ("replacements"['$===']($case)) {return text = self.$sub_replacements(text)}else if ("macros"['$===']($case)) {return text = self.$sub_macros(text)}else if ("highlight"['$===']($case)) {return text = self.$highlight_source(text, (subs['$include?']("callouts")))}else if ("callouts"['$===']($case)) {if (($a = subs['$include?']("highlight")) !== false && $a !== nil) { - return nil - } else { - return text = self.$sub_callouts(text) - }}else if ("post_replacements"['$===']($case)) {return text = self.$sub_post_replacements(text)}else {return self.$warn("asciidoctor: WARNING: unknown substitution type " + (type))}})()}, TMP_2._s = self, TMP_2), $a).call($c); - if (has_passthroughs !== false && has_passthroughs !== nil) { - text = self.$restore_passthroughs(text)}; - if (multiline !== false && multiline !== nil) { - return (text.$split($scope.LINE_SPLIT)) + + if ((($a = $scope.Regexp['$==='](what)) !== nil && (!$a._isBoolean || $a == true))) { + result = ((($a = (what['$=~'](self.substr(offset)))) !== false && $a !== nil) ? $a : -1) } else { - return text + result = self.substr(offset).indexOf(what) }; + + if (result !== -1) { + result += offset; + } + + } else if ((($a = $scope.Regexp['$==='](what)) !== nil && (!$a._isBoolean || $a == true))) { + result = ((($a = (what['$=~'](self))) !== false && $a !== nil) ? $a : -1) + } else { + result = self.indexOf(what) }; - - def.$apply_normal_subs = function(lines) { - var $a, $b, self = this; - return self.$apply_subs((function() {if (($a = lines['$is_a?']((($b = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $b))) !== false && $a !== nil) { - return (lines['$*']($scope.EOL)) - } else { - return lines - }; return nil; })()); + if ((($a = result === -1) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return result }; + }; - def.$apply_title_subs = function(title) { - var self = this; - return self.$apply_subs(title, $scope.SUBS['$[]']("title")); - }; + def.$inspect = function() { + var self = this; - def.$apply_header_subs = function(text) { - var self = this; - return self.$apply_subs(text, $scope.SUBS['$[]']("header")); - }; + + var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, + meta = { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '"' : '\\"', + '\\': '\\\\' + }; - def.$extract_passthroughs = function(text) { - var $a, $b, $c, TMP_3, TMP_4, $d, TMP_5, self = this; - if (($a = ((($b = ((($c = (text['$include?']("+++"))) !== false && $c !== nil) ? $c : (text['$include?']("$$")))) !== false && $b !== nil) ? $b : (text['$include?']("pass:")))) !== false && $a !== nil) { - text = ($a = ($b = text).$gsub, $a._p = (TMP_3 = function(){var self = TMP_3._s || this, $a, $b, m = nil, subslist = nil, subs = nil, index = nil; - if (self.passthroughs == null) self.passthroughs = nil; + escapable.lastIndex = 0; - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - if (($a = ($b = ((text = m['$[]'](4)))['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - text = self.$unescape_brackets(text); - if (($a = ($b = ((subslist = m['$[]'](3).$to_s()))['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - subs = self.$resolve_pass_subs(subslist) - } else { - subs = [] - }; - } else { - text = m['$[]'](2); - subs = ((function() {if (m['$[]'](1)['$==']("$$")) { - return ["specialcharacters"] - } else { - return [] - }; return nil; })()); - }; - self.passthroughs['$<<']($hash2(["text", "subs"], {"text": text, "subs": subs})); - index = self.passthroughs.$size()['$-'](1); - return "" + ($scope.PASS_PLACEHOLDER['$[]']("start")) + (index) + ($scope.PASS_PLACEHOLDER['$[]']("end"));}, TMP_3._s = self, TMP_3), $a).call($b, $scope.REGEXP['$[]']("pass_macro"))}; - if (($a = (text['$include?']("`"))) !== false && $a !== nil) { - text = ($a = ($c = text).$gsub, $a._p = (TMP_4 = function(){var self = TMP_4._s || this, $a, $b, $c, m = nil, unescaped_attrs = nil, attributes = nil, index = nil; - if (self.passthroughs == null) self.passthroughs = nil; + return escapable.test(self) ? '"' + self.replace(escapable, function(a) { + var c = meta[a]; - m = $gvars["~"]; - unescaped_attrs = nil; - if (($a = m['$[]'](3)['$start_with?']("\\")) !== false && $a !== nil) { - return (function() {if (($a = m['$[]'](2)['$nil?']()) !== false && $a !== nil) { - return "" + (m['$[]'](1)) + (m['$[]'](3)['$[]']($range(1, -1, false))) - } else { - return "" + (m['$[]'](1)) + "[" + (m['$[]'](2)) + "]" + (m['$[]'](3)['$[]']($range(1, -1, false))) - }; return nil; })(); - } else if (($a = (($b = m['$[]'](1)['$==']("\\")) ? ($c = m['$[]'](2)['$nil?'](), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - unescaped_attrs = "[" + (m['$[]'](2)) + "]"}; - if (($a = ($b = unescaped_attrs['$nil?'](), $b !== false && $b !== nil ?($c = m['$[]'](2)['$nil?'](), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - attributes = self.$parse_attributes(m['$[]'](2)) - } else { - attributes = $hash2([], {}) - }; - self.passthroughs['$<<']($hash2(["text", "subs", "attributes", "type"], {"text": m['$[]'](4), "subs": ["specialcharacters"], "attributes": attributes, "type": "monospaced"})); - index = self.passthroughs.$size()['$-'](1); - return "" + (((($a = unescaped_attrs) !== false && $a !== nil) ? $a : m['$[]'](1))) + ($scope.PASS_PLACEHOLDER['$[]']("start")) + (index) + ($scope.PASS_PLACEHOLDER['$[]']("end"));}, TMP_4._s = self, TMP_4), $a).call($c, $scope.REGEXP['$[]']("pass_lit"))}; - if (($a = (text['$include?']("math:"))) !== false && $a !== nil) { - text = ($a = ($d = text).$gsub, $a._p = (TMP_5 = function(){var self = TMP_5._s || this, $a, $b, m = nil, type = nil, default_type = nil, subslist = nil, subs = nil, index = nil; - if (self.document == null) self.document = nil; - if (self.passthroughs == null) self.passthroughs = nil; + return typeof c === 'string' ? c : + '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); + }) + '"' : '"' + self + '"'; + + }; - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - type = m['$[]'](1).$to_sym(); - if (type['$==']("math")) { - type = ((function() {if (((default_type = self.$document().$attributes()['$[]']("math").$to_s()))['$==']("")) { - return "asciimath" - } else { - return default_type - }; return nil; })()).$to_sym()}; - text = self.$unescape_brackets(m['$[]'](3)); - if (($a = ($b = ((subslist = m['$[]'](2).$to_s()))['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - subs = self.$resolve_pass_subs(subslist) - } else { - subs = (function() {if (($a = (self.document['$basebackend?']("html"))) !== false && $a !== nil) { - return ["specialcharacters"] - } else { - return [] - }; return nil; })() - }; - self.passthroughs['$<<']($hash2(["text", "subs", "type"], {"text": text, "subs": subs, "type": type})); - index = self.passthroughs.$size()['$-'](1); - return "" + ($scope.PASS_PLACEHOLDER['$[]']("start")) + (index) + ($scope.PASS_PLACEHOLDER['$[]']("end"));}, TMP_5._s = self, TMP_5), $a).call($d, $scope.REGEXP['$[]']("inline_math_macro"))}; - return text; - }; + def.$intern = function() { + var self = this; - def.$restore_passthroughs = function(text) { - var $a, $b, $c, TMP_6, self = this; - if (self.passthroughs == null) self.passthroughs = nil; + return self; + }; - if (($a = ((($b = ((($c = self.passthroughs['$nil?']()) !== false && $c !== nil) ? $c : self.passthroughs['$empty?']())) !== false && $b !== nil) ? $b : ($c = text['$include?']($scope.PASS_PLACEHOLDER['$[]']("start")), ($c === nil || $c === false)))) !== false && $a !== nil) { - return text}; - return ($a = ($b = text).$gsub, $a._p = (TMP_6 = function(){var self = TMP_6._s || this, $a, pass = nil, subbed_text = nil; - if (self.passthroughs == null) self.passthroughs = nil; + def.$lines = function(separator) { + var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; - pass = self.passthroughs['$[]']($gvars["~"]['$[]'](1).$to_i()); - subbed_text = self.$apply_subs(pass['$[]']("text"), pass.$fetch("subs", [])); - if (($a = pass['$[]']("type")) !== false && $a !== nil) { - return $scope.Inline.$new(self, "quoted", subbed_text, $hash2(["type", "attributes"], {"type": pass['$[]']("type"), "attributes": pass.$fetch("attributes", $hash2([], {}))})).$render() - } else { - return subbed_text - };}, TMP_6._s = self, TMP_6), $a).call($b, $scope.PASS_PLACEHOLDER['$[]']("match")); - }; + if (separator == null) { + separator = $gvars["/"] + } + return self.$each_line(separator).$to_a(); + }; - def.$sub_specialcharacters = function(text) { - var $a, $b, TMP_7, self = this; - return ($a = ($b = text).$gsub, $a._p = (TMP_7 = function(){var self = TMP_7._s || this; - return $scope.SPECIAL_CHARS['$[]']($gvars["&"])}, TMP_7._s = self, TMP_7), $a).call($b, $scope.SPECIAL_CHARS_PATTERN); - }; + def.$length = function() { + var self = this; - $opal.defn(self, '$sub_specialchars', def.$sub_specialcharacters); + return self.length; + }; - def.$sub_quotes = function(text) { - var $a, $b, TMP_8, $c, TMP_10, self = this, result = nil; - if (($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== false && $a !== nil) { - result = text; - ($a = ($b = $scope.QUOTE_SUBS).$each, $a._p = (TMP_8 = function(type, scope, pattern){var self = TMP_8._s || this, $a, $b, TMP_9;if (type == null) type = nil;if (scope == null) scope = nil;if (pattern == null) pattern = nil; - return result = ($a = ($b = result).$gsub, $a._p = (TMP_9 = function(){var self = TMP_9._s || this; - return self.$transform_quoted_text($gvars["~"], type, scope)}, TMP_9._s = self, TMP_9), $a).call($b, pattern)}, TMP_8._s = self, TMP_8), $a).call($b); - } else { - result = text.$dup(); - ($a = ($c = $scope.QUOTE_SUBS).$each, $a._p = (TMP_10 = function(type, scope, pattern){var self = TMP_10._s || this, $a, $b, TMP_11;if (type == null) type = nil;if (scope == null) scope = nil;if (pattern == null) pattern = nil; - return ($a = ($b = result)['$gsub!'], $a._p = (TMP_11 = function(){var self = TMP_11._s || this; - return self.$transform_quoted_text($gvars["~"], type, scope)}, TMP_11._s = self, TMP_11), $a).call($b, pattern)}, TMP_10._s = self, TMP_10), $a).call($c); - }; - return result; - }; + def.$ljust = function(width, padstr) { + var $a, self = this; - def.$sub_replacements = function(text) { - var $a, $b, TMP_12, $c, TMP_14, self = this, result = nil; - if (($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== false && $a !== nil) { - result = text; - ($a = ($b = $scope.REPLACEMENTS).$each, $a._p = (TMP_12 = function(pattern, replacement, restore){var self = TMP_12._s || this, $a, $b, TMP_13;if (pattern == null) pattern = nil;if (replacement == null) replacement = nil;if (restore == null) restore = nil; - return result = ($a = ($b = result).$gsub, $a._p = (TMP_13 = function(){var self = TMP_13._s || this; - return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_13._s = self, TMP_13), $a).call($b, pattern)}, TMP_12._s = self, TMP_12), $a).call($b); - } else { - result = text.$dup(); - ($a = ($c = $scope.REPLACEMENTS).$each, $a._p = (TMP_14 = function(pattern, replacement, restore){var self = TMP_14._s || this, $a, $b, TMP_15;if (pattern == null) pattern = nil;if (replacement == null) replacement = nil;if (restore == null) restore = nil; - return ($a = ($b = result)['$gsub!'], $a._p = (TMP_15 = function(){var self = TMP_15._s || this; - return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_15._s = self, TMP_15), $a).call($b, pattern)}, TMP_14._s = self, TMP_14), $a).call($c); - }; - return result; - }; + if (padstr == null) { + padstr = " " + } + width = $scope.Opal.$coerce_to(width, $scope.Integer, "to_int"); + padstr = $scope.Opal.$coerce_to(padstr, $scope.String, "to_str").$to_s(); + if ((($a = padstr['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.$raise($scope.ArgumentError, "zero width padding")}; + if ((($a = width <= self.length) !== nil && (!$a._isBoolean || $a == true))) { + return self}; + + var index = -1, + result = ""; - def.$do_replacement = function(m, replacement, restore) { - var $a, self = this, matched = nil, $case = nil; - if (($a = ((matched = m['$[]'](0)))['$include?']("\\")) !== false && $a !== nil) { - return matched.$tr("\\", "") - } else { - return (function() {$case = restore;if ("none"['$===']($case)) {return replacement}else if ("leading"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement)}else if ("bounding"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement) + (m['$[]'](2))}else { return nil }})() - }; - }; + width -= self.length; - def.$sub_attributes = function(data, opts) { - var $a, $b, TMP_16, self = this, string_data = nil, lines = nil, result = nil; - if (opts == null) { - opts = $hash2([], {}) - } - if (($a = ((($b = data['$nil?']()) !== false && $b !== nil) ? $b : data['$empty?']())) !== false && $a !== nil) { - return data}; - string_data = data['$is_a?']($scope.String); - lines = (function() {if (string_data !== false && string_data !== nil) { - return [data] - } else { - return data - }; return nil; })(); - result = []; - ($a = ($b = lines).$each, $a._p = (TMP_16 = function(line){var self = TMP_16._s || this, $a, $b, TMP_17, $c, $d, reject = nil, reject_if_empty = nil;if (line == null) line = nil; - reject = false; - reject_if_empty = false; - if (($a = line['$include?']("{")) !== false && $a !== nil) { - line = ($a = ($b = line).$gsub, $a._p = (TMP_17 = function(){var self = TMP_17._s || this, $a, $b, TMP_18, $c, TMP_19, m = nil, directive = nil, offset = nil, expr = nil, $case = nil, args = nil, _ = nil, value = nil, val = nil, key = nil; - if (self.document == null) self.document = nil; + while (++index < width) { + result += padstr; + } - m = $gvars["~"]; - if (($a = ((($b = m['$[]'](1)['$==']("\\")) !== false && $b !== nil) ? $b : m['$[]'](4)['$==']("\\"))) !== false && $a !== nil) { - return "{" + (m['$[]'](2)) + "}" - } else if (($a = ($b = ((directive = m['$[]'](3))).$to_s()['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - offset = directive.$length()['$+'](1); - expr = m['$[]'](2)['$[]']($range(offset, -1, false)); - return (function() {$case = directive;if ("set"['$===']($case)) {args = expr.$split(":"); - $a = $opal.to_ary($scope.Lexer.$store_attribute(args['$[]'](0), ((($b = args['$[]'](1)) !== false && $b !== nil) ? $b : ""), self.document)), _ = ($a[0] == null ? nil : $a[0]), value = ($a[1] == null ? nil : $a[1]); - if (($a = value['$nil?']()) !== false && $a !== nil) { - if (self.document.$attributes().$fetch("attribute-undefined", $scope.Compliance.$attribute_undefined())['$==']("drop-line")) { - ($a = ($b = $scope.Debug).$debug, $a._p = (TMP_18 = function(){var self = TMP_18._s || this; - return "Undefining attribute: " + (self.$key()) + ", line marked for removal"}, TMP_18._s = self, TMP_18), $a).call($b); - reject = true; - return ($breaker.$v = "", $breaker);}}; - reject_if_empty = true; - return "";}else if ("counter"['$===']($case) || "counter2"['$===']($case)) {args = expr.$split(":"); - val = self.document.$counter(args['$[]'](0), args['$[]'](1)); - if (directive['$==']("counter2")) { - reject_if_empty = true; - return ""; - } else { - return val - };}else {self.$warn("asciidoctor: WARNING: illegal attribute directive: " + (m['$[]'](2))); - return m['$[]'](0);}})(); - } else if (($a = ($c = (key = m['$[]'](2).$downcase()), $c !== false && $c !== nil ?(self.document.$attributes()['$has_key?'](key)) : $c)) !== false && $a !== nil) { - return self.document.$attributes()['$[]'](key) - } else if (($a = $scope.INTRINSICS['$has_key?'](key)) !== false && $a !== nil) { - return $scope.INTRINSICS['$[]'](key) - } else { - return (function() {$case = (((($a = opts['$[]']("attribute_missing")) !== false && $a !== nil) ? $a : self.document.$attributes().$fetch("attribute-missing", $scope.Compliance.$attribute_missing())));if ("skip"['$===']($case)) {return m['$[]'](0)}else if ("drop-line"['$===']($case)) {($a = ($c = $scope.Debug).$debug, $a._p = (TMP_19 = function(){var self = TMP_19._s || this; - return "Missing attribute: " + (key) + ", line marked for removal"}, TMP_19._s = self, TMP_19), $a).call($c); - reject = true; - return ($breaker.$v = "", $breaker);}else {reject_if_empty = true; - return "";}})() - };}, TMP_17._s = self, TMP_17), $a).call($b, $scope.REGEXP['$[]']("attr_ref"))}; - if (($a = ((($c = reject) !== false && $c !== nil) ? $c : ((($d = reject_if_empty !== false && reject_if_empty !== nil) ? line['$empty?']() : $d)))) !== false && $a !== nil) { - return nil - } else { - return result['$<<'](line) - };}, TMP_16._s = self, TMP_16), $a).call($b); - if (string_data !== false && string_data !== nil) { - return (result['$*']($scope.EOL)) - } else { - return result - }; + return self + result.slice(0, width); + + }; + + def.$lstrip = function() { + var self = this; + + return self.replace(/^\s*/, ''); + }; + + def.$match = TMP_5 = function(pattern, pos) { + var $a, $b, self = this, $iter = TMP_5._p, block = $iter || nil; + + TMP_5._p = null; + if ((($a = ((($b = $scope.String['$==='](pattern)) !== false && $b !== nil) ? $b : pattern['$respond_to?']("to_str"))) !== nil && (!$a._isBoolean || $a == true))) { + pattern = (new RegExp("" + $scope.Regexp.$escape(pattern.$to_str())))}; + if ((($a = $scope.Regexp['$==='](pattern)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "wrong argument type " + (pattern.$class()) + " (expected Regexp)") }; + return ($a = ($b = pattern).$match, $a._p = block.$to_proc(), $a).call($b, self, pos); + }; - def.$sub_macros = function(source) { - var $a, $b, $c, TMP_20, TMP_22, $d, TMP_23, $e, $f, TMP_24, $g, TMP_26, TMP_27, $h, TMP_28, $i, $j, TMP_29, TMP_30, $k, TMP_31, self = this, found = nil, use_link_attrs = nil, experimental = nil, result = nil, extensions = nil; - if (self.document == null) self.document = nil; + def.$next = function() { + var self = this; - if (($a = ((($b = source['$nil?']()) !== false && $b !== nil) ? $b : source['$empty?']())) !== false && $a !== nil) { - return source}; - found = $hash2([], {}); - found['$[]=']("square_bracket", source['$include?']("[")); - found['$[]=']("round_bracket", source['$include?']("(")); - found['$[]=']("colon", source['$include?'](":")); - found['$[]=']("macroish", (($a = found['$[]']("square_bracket"), $a !== false && $a !== nil ?found['$[]']("colon") : $a))); - found['$[]=']("macroish_short_form", (($a = ($b = found['$[]']("square_bracket"), $b !== false && $b !== nil ?found['$[]']("colon") : $b), $a !== false && $a !== nil ?source['$include?'](":[") : $a))); - use_link_attrs = self.document.$attributes()['$has_key?']("linkattrs"); - experimental = self.document.$attributes()['$has_key?']("experimental"); - result = source.$dup(); - if (experimental !== false && experimental !== nil) { - if (($a = ($b = found['$[]']("macroish_short_form"), $b !== false && $b !== nil ?(((($c = result['$include?']("kbd:")) !== false && $c !== nil) ? $c : result['$include?']("btn:"))) : $b)) !== false && $a !== nil) { - result = ($a = ($b = result).$gsub, $a._p = (TMP_20 = function(){var self = TMP_20._s || this, $a, $b, TMP_21, m = nil, captured = nil, keys = nil, label = nil; - m = $gvars["~"]; - if (($a = ((captured = m['$[]'](0)))['$start_with?']("\\")) !== false && $a !== nil) { - return captured['$[]']($range(1, -1, false));}; - if (($a = captured['$start_with?']("kbd")) !== false && $a !== nil) { - keys = self.$unescape_bracketed_text(m['$[]'](1)); - if (keys['$==']("+")) { - keys = ["+"] - } else { - keys = ($a = ($b = keys.$split($scope.REGEXP['$[]']("kbd_delim"))).$inject, $a._p = (TMP_21 = function(c, key){var self = TMP_21._s || this, $a;if (c == null) c = nil;if (key == null) key = nil; - if (($a = key['$end_with?']("++")) !== false && $a !== nil) { - c['$<<'](key['$[]']($range(0, -3, false)).$strip()); - c['$<<']("+"); - } else { - c['$<<'](key.$strip()) - }; - return c;}, TMP_21._s = self, TMP_21), $a).call($b, []) - }; - return $scope.Inline.$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$render(); - } else if (($a = captured['$start_with?']("btn")) !== false && $a !== nil) { - label = self.$unescape_bracketed_text(m['$[]'](1)); - return $scope.Inline.$new(self, "button", label).$render(); - } else { - return nil - };}, TMP_20._s = self, TMP_20), $a).call($b, $scope.REGEXP['$[]']("kbd_btn_macro"))}; - if (($a = ($c = found['$[]']("macroish"), $c !== false && $c !== nil ?result['$include?']("menu:") : $c)) !== false && $a !== nil) { - result = ($a = ($c = result).$gsub, $a._p = (TMP_22 = function(){var self = TMP_22._s || this, $a, $b, m = nil, captured = nil, menu = nil, items = nil, submenus = nil, menuitem = nil, delim = nil; - m = $gvars["~"]; - if (($a = ((captured = m['$[]'](0)))['$start_with?']("\\")) !== false && $a !== nil) { - return captured['$[]']($range(1, -1, false));}; - menu = m['$[]'](1); - items = m['$[]'](2); - if (($a = items['$nil?']()) !== false && $a !== nil) { - submenus = []; - menuitem = nil; - } else if (($a = (delim = (function() {if (($b = items['$include?'](">")) !== false && $b !== nil) { - return ">" - } else { - return ((function() {if (($b = items['$include?'](",")) !== false && $b !== nil) { - return "," - } else { - return nil - }; return nil; })()) - }; return nil; })())) !== false && $a !== nil) { - submenus = ($a = ($b = items.$split(delim)).$map, $a._p = "strip".$to_proc(), $a).call($b); - menuitem = submenus.$pop(); - } else { - submenus = []; - menuitem = items.$rstrip(); - }; - return $scope.Inline.$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$render();}, TMP_22._s = self, TMP_22), $a).call($c, $scope.REGEXP['$[]']("menu_macro"))}; - if (($a = ($d = result['$include?']("\""), $d !== false && $d !== nil ?result['$include?'](">") : $d)) !== false && $a !== nil) { - result = ($a = ($d = result).$gsub, $a._p = (TMP_23 = function(){var self = TMP_23._s || this, $a, $b, $c, m = nil, captured = nil, input = nil, menu = nil, submenus = nil, menuitem = nil; - m = $gvars["~"]; - if (($a = ((captured = m['$[]'](0)))['$start_with?']("\\")) !== false && $a !== nil) { - return captured['$[]']($range(1, -1, false));}; - input = m['$[]'](1); - $a = $opal.to_ary(($b = ($c = input.$split(">")).$map, $b._p = "strip".$to_proc(), $b).call($c)), menu = ($a[0] == null ? nil : $a[0]), submenus = $slice.call($a, 1); - menuitem = submenus.$pop(); - return $scope.Inline.$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$render();}, TMP_23._s = self, TMP_23), $a).call($d, $scope.REGEXP['$[]']("menu_inline_macro"))};}; - if (($a = ($e = ($f = (extensions = self.document.$extensions()), $f !== false && $f !== nil ?extensions['$inline_macros?']() : $f), $e !== false && $e !== nil ?found['$[]']("macroish") : $e)) !== false && $a !== nil) { - ($a = ($e = extensions.$load_inline_macro_processors(self.document)).$each, $a._p = (TMP_24 = function(processor){var self = TMP_24._s || this, $a, $b, TMP_25;if (processor == null) processor = nil; - return result = ($a = ($b = result).$gsub, $a._p = (TMP_25 = function(){var self = TMP_25._s || this, $a, m = nil, target = nil, attributes = nil, posattrs = nil; - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - target = m['$[]'](1); - if (($a = processor.$options()['$[]']("short_form")) !== false && $a !== nil) { - attributes = $hash2([], {}) - } else { - posattrs = processor.$options().$fetch("pos_attrs", []); - attributes = self.$parse_attributes(m['$[]'](2), posattrs, $hash2(["sub_input", "unescape_input"], {"sub_input": true, "unescape_input": true})); - }; - return processor.$process(self, target, attributes);}, TMP_25._s = self, TMP_25), $a).call($b, processor.$regexp())}, TMP_24._s = self, TMP_24), $a).call($e)}; - if (($a = ($f = found['$[]']("macroish"), $f !== false && $f !== nil ?(((($g = result['$include?']("image:")) !== false && $g !== nil) ? $g : result['$include?']("icon:"))) : $f)) !== false && $a !== nil) { - result = ($a = ($f = result).$gsub, $a._p = (TMP_26 = function(){var self = TMP_26._s || this, $a, $b, m = nil, raw_attrs = nil, type = nil, posattrs = nil, target = nil, attrs = nil; - if (self.document == null) self.document = nil; - - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - raw_attrs = self.$unescape_bracketed_text(m['$[]'](2)); - if (($a = m['$[]'](0)['$start_with?']("icon:")) !== false && $a !== nil) { - type = "icon"; - posattrs = ["size"]; - } else { - type = "image"; - posattrs = ["alt", "width", "height"]; - }; - target = self.$sub_attributes(m['$[]'](1)); - if (($a = type['$==']("icon")) === false || $a === nil) { - self.document.$register("images", target)}; - attrs = self.$parse_attributes(raw_attrs, posattrs); - if (($a = ($b = attrs['$[]']("alt"), ($b === nil || $b === false))) !== false && $a !== nil) { - attrs['$[]=']("alt", $scope.File.$basename(target, $scope.File.$extname(target)))}; - return $scope.Inline.$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$render();}, TMP_26._s = self, TMP_26), $a).call($f, $scope.REGEXP['$[]']("image_macro"))}; - if (($a = ((($g = found['$[]']("macroish_short_form")) !== false && $g !== nil) ? $g : found['$[]']("round_bracket"))) !== false && $a !== nil) { - result = ($a = ($g = result).$gsub, $a._p = (TMP_27 = function(){var self = TMP_27._s || this, $a, $b, m = nil, num_brackets = nil, text_in_brackets = nil, macro_name = nil, terms = nil, text = nil; - if (self.document == null) self.document = nil; + + if (self.length === 0) { + return ""; + } - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - num_brackets = 0; - text_in_brackets = nil; - if (($a = ((macro_name = m['$[]'](1)))['$nil?']()) !== false && $a !== nil) { - text_in_brackets = m['$[]'](3); - if (($a = ($b = (text_in_brackets['$start_with?']("(")), $b !== false && $b !== nil ?(text_in_brackets['$end_with?'](")")) : $b)) !== false && $a !== nil) { - text_in_brackets = text_in_brackets['$[]']($range(1, -1, true)); - num_brackets = 3; - } else { - num_brackets = 2 - };}; - if (($a = ((($b = macro_name['$==']("indexterm")) !== false && $b !== nil) ? $b : num_brackets['$=='](3))) !== false && $a !== nil) { - if (($a = macro_name['$nil?']()) !== false && $a !== nil) { - terms = self.$split_simple_csv(self.$normalize_string(text_in_brackets)) - } else { - terms = self.$split_simple_csv(self.$normalize_string(m['$[]'](2), true)) - }; - self.document.$register("indexterms", [].concat(terms)); - return $scope.Inline.$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$render(); - } else { - if (($a = macro_name['$nil?']()) !== false && $a !== nil) { - text = self.$normalize_string(text_in_brackets) - } else { - text = self.$normalize_string(m['$[]'](2), true) - }; - self.document.$register("indexterms", [text]); - return $scope.Inline.$new(self, "indexterm", text, $hash2(["type"], {"type": "visible"})).$render(); - };}, TMP_27._s = self, TMP_27), $a).call($g, $scope.REGEXP['$[]']("indexterm_macro"))}; - if (($a = result['$include?']("://")) !== false && $a !== nil) { - result = ($a = ($h = result).$gsub, $a._p = (TMP_28 = function(){var self = TMP_28._s || this, $a, $b, $c, m = nil, prefix = nil, target = nil, suffix = nil, attrs = nil, text = nil; - if (self.document == null) self.document = nil; + var initial = self.substr(0, self.length - 1); + var last = String.fromCharCode(self.charCodeAt(self.length - 1) + 1); - m = $gvars["~"]; - if (($a = m['$[]'](2)['$start_with?']("\\")) !== false && $a !== nil) { - return "" + (m['$[]'](1)) + (m['$[]'](2)['$[]']($range(1, -1, false))) + (m['$[]'](3)); - } else if (($a = (($b = m['$[]'](1)['$==']("link:")) ? m['$[]'](3)['$nil?']() : $b)) !== false && $a !== nil) { - return m['$[]'](0);}; - prefix = ((function() {if (($a = ($b = m['$[]'](1)['$==']("link:"), ($b === nil || $b === false))) !== false && $a !== nil) { - return m['$[]'](1) - } else { - return "" - }; return nil; })()); - target = m['$[]'](2); - suffix = ""; - if (($a = ($b = prefix['$start_with?']("<"), $b !== false && $b !== nil ?target['$end_with?'](">") : $b)) !== false && $a !== nil) { - prefix = prefix['$[]']($range(4, -1, false)); - target = target['$[]']($range(0, -5, false)); - } else if (($a = ($b = prefix['$start_with?']("("), $b !== false && $b !== nil ?target['$end_with?'](")") : $b)) !== false && $a !== nil) { - target = target['$[]']($range(0, -2, false)); - suffix = ")"; - } else if (($a = target['$end_with?']("):")) !== false && $a !== nil) { - target = target['$[]']($range(0, -3, false)); - suffix = "):";}; - self.document.$register("links", target); - attrs = nil; - if (($a = ($b = m['$[]'](3).$to_s()['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - if (($a = (($b = use_link_attrs !== false && use_link_attrs !== nil) ? (((($c = m['$[]'](3)['$start_with?']("\"")) !== false && $c !== nil) ? $c : m['$[]'](3)['$include?'](","))) : $b)) !== false && $a !== nil) { - attrs = self.$parse_attributes(self.$sub_attributes(m['$[]'](3).$gsub("]", "]")), []); - text = attrs['$[]'](1); - } else { - text = self.$sub_attributes(m['$[]'](3).$gsub("]", "]")) - }; - if (($a = text['$end_with?']("^")) !== false && $a !== nil) { - text = text.$chop(); - ((($a = attrs) !== false && $a !== nil) ? $a : attrs = $hash2([], {})); - if (($a = attrs['$has_key?']("window")) === false || $a === nil) { - attrs['$[]=']("window", "_blank")};}; - } else { - text = "" - }; - if (($a = text['$empty?']()) !== false && $a !== nil) { - if (($a = self.document['$attr?']("hide-uri-scheme")) !== false && $a !== nil) { - text = target.$sub($scope.REGEXP['$[]']("uri_sniff"), "") - } else { - text = target - }}; - return "" + (prefix) + ($scope.Inline.$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "link", "target": target, "attributes": attrs})).$render()) + (suffix);}, TMP_28._s = self, TMP_28), $a).call($h, $scope.REGEXP['$[]']("link_inline"))}; - if (($a = ((($i = ($j = found['$[]']("macroish"), $j !== false && $j !== nil ?(result['$include?']("link:")) : $j)) !== false && $i !== nil) ? $i : (result['$include?']("mailto:")))) !== false && $a !== nil) { - result = ($a = ($i = result).$gsub, $a._p = (TMP_29 = function(){var self = TMP_29._s || this, $a, $b, $c, m = nil, raw_target = nil, mailto = nil, target = nil, attrs = nil, text = nil; - if (self.document == null) self.document = nil; + return initial + last; + + }; - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - raw_target = m['$[]'](1); - mailto = m['$[]'](0)['$start_with?']("mailto:"); - target = (function() {if (mailto !== false && mailto !== nil) { - return "mailto:" + (raw_target) - } else { - return raw_target - }; return nil; })(); - attrs = nil; - if (($a = (($b = use_link_attrs !== false && use_link_attrs !== nil) ? (((($c = m['$[]'](2)['$start_with?']("\"")) !== false && $c !== nil) ? $c : m['$[]'](2)['$include?'](","))) : $b)) !== false && $a !== nil) { - attrs = self.$parse_attributes(self.$sub_attributes(m['$[]'](2).$gsub("]", "]")), []); - text = attrs['$[]'](1); - if (mailto !== false && mailto !== nil) { - if (($a = attrs['$has_key?'](2)) !== false && $a !== nil) { - target = "" + (target) + "?subject=" + ($scope.Helpers.$encode_uri(attrs['$[]'](2))); - if (($a = attrs['$has_key?'](3)) !== false && $a !== nil) { - target = "" + (target) + "&body=" + ($scope.Helpers.$encode_uri(attrs['$[]'](3)))};}}; - } else { - text = self.$sub_attributes(m['$[]'](2).$gsub("]", "]")) - }; - if (($a = text['$end_with?']("^")) !== false && $a !== nil) { - text = text.$chop(); - ((($a = attrs) !== false && $a !== nil) ? $a : attrs = $hash2([], {})); - if (($a = attrs['$has_key?']("window")) === false || $a === nil) { - attrs['$[]=']("window", "_blank")};}; - self.document.$register("links", target); - if (($a = text['$empty?']()) !== false && $a !== nil) { - if (($a = self.document['$attr?']("hide-uri-scheme")) !== false && $a !== nil) { - text = raw_target.$sub($scope.REGEXP['$[]']("uri_sniff"), "") - } else { - text = raw_target - }}; - return $scope.Inline.$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "link", "target": target, "attributes": attrs})).$render();}, TMP_29._s = self, TMP_29), $a).call($i, $scope.REGEXP['$[]']("link_macro"))}; - if (($a = result['$include?']("@")) !== false && $a !== nil) { - result = ($a = ($j = result).$gsub, $a._p = (TMP_30 = function(){var self = TMP_30._s || this, m = nil, address = nil, $case = nil, target = nil; - if (self.document == null) self.document = nil; + def.$ord = function() { + var self = this; - m = $gvars["~"]; - address = m['$[]'](0); - $case = address['$[]']($range(0, 0, false));if ("\\"['$===']($case)) {return address['$[]']($range(1, -1, false));}else if (">"['$===']($case) || ":"['$===']($case)) {return address;}; - target = "mailto:" + (address); - self.document.$register("links", target); - return $scope.Inline.$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$render();}, TMP_30._s = self, TMP_30), $a).call($j, $scope.REGEXP['$[]']("email_inline"))}; - if (($a = ($k = found['$[]']("macroish_short_form"), $k !== false && $k !== nil ?result['$include?']("footnote") : $k)) !== false && $a !== nil) { - result = ($a = ($k = result).$gsub, $a._p = (TMP_31 = function(){var self = TMP_31._s || this, $a, $b, TMP_32, m = nil, id = nil, text = nil, index = nil, type = nil, target = nil, footnote = nil; - if (self.document == null) self.document = nil; + return self.charCodeAt(0); + }; - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - if (m['$[]'](1)['$==']("footnote")) { - id = nil; - text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(m['$[]'](2), true)))); - index = self.document.$counter("footnote-number"); - self.document.$register("footnotes", ($scope.Document)._scope.Footnote.$new(index, id, text)); - type = nil; - target = nil; - } else { - $a = $opal.to_ary(m['$[]'](2).$split(",", 2)), id = ($a[0] == null ? nil : $a[0]), text = ($a[1] == null ? nil : $a[1]); - id = id.$strip(); - if (($a = ($b = text['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true)))); - index = self.document.$counter("footnote-number"); - self.document.$register("footnotes", ($scope.Document)._scope.Footnote.$new(index, id, text)); - type = "ref"; - target = nil; - } else { - footnote = ($a = ($b = self.document.$references()['$[]']("footnotes")).$find, $a._p = (TMP_32 = function(fn){var self = TMP_32._s || this;if (fn == null) fn = nil; - return fn.$id()['$=='](id)}, TMP_32._s = self, TMP_32), $a).call($b); - target = id; - id = nil; - index = footnote.$index(); - text = footnote.$text(); - type = "xref"; - }; - }; - return $scope.Inline.$new(self, "footnote", text, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$render();}, TMP_31._s = self, TMP_31), $a).call($k, $scope.REGEXP['$[]']("footnote_macro"))}; - return self.$sub_inline_xrefs(self.$sub_inline_anchors(result, found), found); - }; + def.$partition = function(str) { + var self = this; - def.$sub_inline_anchors = function(text, found) { - var $a, $b, $c, TMP_33, $d, $e, TMP_34, self = this; - if (found == null) { - found = nil - } - if (($a = ($b = (((($c = found['$nil?']()) !== false && $c !== nil) ? $c : found['$[]']("square_bracket"))), $b !== false && $b !== nil ?text['$include?']("[[[") : $b)) !== false && $a !== nil) { - text = ($a = ($b = text).$gsub, $a._p = (TMP_33 = function(){var self = TMP_33._s || this, $a, m = nil, id = nil, reftext = nil; - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - id = reftext = m['$[]'](1); - return $scope.Inline.$new(self, "anchor", reftext, $hash2(["type", "target"], {"type": "bibref", "target": id})).$render();}, TMP_33._s = self, TMP_33), $a).call($b, $scope.REGEXP['$[]']("biblio_macro"))}; - if (($a = ((($c = (($d = (((($e = found['$nil?']()) !== false && $e !== nil) ? $e : found['$[]']("square_bracket"))), $d !== false && $d !== nil ?text['$include?']("[[") : $d))) !== false && $c !== nil) ? $c : (($d = (((($e = found['$nil?']()) !== false && $e !== nil) ? $e : found['$[]']("macroish"))), $d !== false && $d !== nil ?text['$include?']("anchor:") : $d)))) !== false && $a !== nil) { - text = ($a = ($c = text).$gsub, $a._p = (TMP_34 = function(){var self = TMP_34._s || this, $a, $b, TMP_35, m = nil, id = nil, reftext = nil; - if (self.document == null) self.document = nil; + + var result = self.split(str); + var splitter = (result[0].length === self.length ? "" : str); - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - id = ((($a = m['$[]'](1)) !== false && $a !== nil) ? $a : m['$[]'](3)); - reftext = ((($a = m['$[]'](2)) !== false && $a !== nil) ? $a : m['$[]'](4)); - if (($a = reftext['$nil?']()) !== false && $a !== nil) { - reftext = "[" + (id) + "]"}; - if (($a = self.document.$references()['$[]']("ids")['$has_key?'](id)) === false || $a === nil) { - ($a = ($b = $scope.Debug).$debug, $a._p = (TMP_35 = function(){var self = TMP_35._s || this; - return "Missing reference for anchor " + (id)}, TMP_35._s = self, TMP_35), $a).call($b)}; - return $scope.Inline.$new(self, "anchor", reftext, $hash2(["type", "target"], {"type": "ref", "target": id})).$render();}, TMP_34._s = self, TMP_34), $a).call($c, $scope.REGEXP['$[]']("anchor_macro"))}; - return text; - }; + return [result[0], splitter, result.slice(1).join(str.toString())]; + + }; - def.$sub_inline_xrefs = function(text, found) { - var $a, $b, $c, TMP_36, self = this; - if (found == null) { - found = nil - } - if (($a = ((($b = (((($c = found['$nil?']()) !== false && $c !== nil) ? $c : found['$[]']("macroish")))) !== false && $b !== nil) ? $b : text['$include?']("<<"))) !== false && $a !== nil) { - text = ($a = ($b = text).$gsub, $a._p = (TMP_36 = function(){var self = TMP_36._s || this, $a, $b, $c, $d, m = nil, id = nil, reftext = nil, path = nil, fragment = nil, refid = nil, target = nil; - if (self.document == null) self.document = nil; + def.$reverse = function() { + var self = this; - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return m['$[]'](0)['$[]']($range(1, -1, false));}; - if (($a = ((($b = m['$[]'](1)['$nil?']()) !== false && $b !== nil) ? $b : (($c = (($d = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $d), $c !== false && $c !== nil ?m['$[]'](1).$to_s()['$==']("") : $c)))) !== false && $a !== nil) { - id = m['$[]'](2); - reftext = (function() {if (($a = ($b = m['$[]'](3)['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - return m['$[]'](3) - } else { - return nil - }; return nil; })(); - } else { - $a = $opal.to_ary(($b = ($c = m['$[]'](1).$split(",", 2)).$map, $b._p = "strip".$to_proc(), $b).call($c)), id = ($a[0] == null ? nil : $a[0]), reftext = ($a[1] == null ? nil : $a[1]); - id = id.$sub($scope.REGEXP['$[]']("dbl_quoted"), (function() {if (($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== false && $a !== nil) { - return "$2" - } else { - return "2" - }; return nil; })()); - if (($a = reftext['$nil?']()) === false || $a === nil) { - reftext = reftext.$sub($scope.REGEXP['$[]']("m_dbl_quoted"), (function() {if (($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== false && $a !== nil) { - return "$2" - } else { - return "2" - }; return nil; })())}; - }; - if (($a = id['$include?']("#")) !== false && $a !== nil) { - $a = $opal.to_ary(id.$split("#")), path = ($a[0] == null ? nil : $a[0]), fragment = ($a[1] == null ? nil : $a[1]) - } else { - path = nil; - fragment = id; - }; - if (($a = path['$nil?']()) !== false && $a !== nil) { - refid = fragment; - target = "#" + (fragment); - } else { - path = $scope.Helpers.$rootname(path); - if (($a = ((($b = self.document.$attributes()['$[]']("docname")['$=='](path)) !== false && $b !== nil) ? $b : self.document.$references()['$[]']("includes")['$include?'](path))) !== false && $a !== nil) { - refid = fragment; - path = nil; - target = "#" + (fragment); - } else { - refid = (function() {if (($a = fragment['$nil?']()) !== false && $a !== nil) { - return path - } else { - return "" + (path) + "#" + (fragment) - }; return nil; })(); - path = "" + (path) + (self.document.$attributes().$fetch("outfilesuffix", ".html")); - target = (function() {if (($a = fragment['$nil?']()) !== false && $a !== nil) { - return path - } else { - return "" + (path) + "#" + (fragment) - }; return nil; })(); - }; - }; - return $scope.Inline.$new(self, "anchor", reftext, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": $hash2(["path", "fragment", "refid"], {"path": path, "fragment": fragment, "refid": refid})})).$render();}, TMP_36._s = self, TMP_36), $a).call($b, $scope.REGEXP['$[]']("xref_macro"))}; - return text; - }; + return self.split('').reverse().join(''); + }; - def.$sub_callouts = function(text) { - var $a, $b, TMP_37, self = this; - return ($a = ($b = text).$gsub, $a._p = (TMP_37 = function(){var self = TMP_37._s || this, m = nil; - if (self.document == null) self.document = nil; + def.$rindex = function(search, offset) { + var self = this; - m = $gvars["~"]; - if (m['$[]'](1)['$==']("\\")) { - return m['$[]'](0).$sub("\\", "");}; - return $scope.Inline.$new(self, "callout", m['$[]'](3), $hash2(["id"], {"id": self.document.$callouts().$read_next_id()})).$render();}, TMP_37._s = self, TMP_37), $a).call($b, $scope.REGEXP['$[]']("callout_render")); - }; + + var search_type = (search == null ? Opal.NilClass : search.constructor); + if (search_type != String && search_type != RegExp) { + var msg = "type mismatch: " + search_type + " given"; + self.$raise($scope.TypeError.$new(msg)); + } - def.$sub_post_replacements = function(text) { - var $a, $b, TMP_38, $c, TMP_39, self = this, lines = nil, last = nil; - if (self.document == null) self.document = nil; - if (self.attributes == null) self.attributes = nil; + if (self.length == 0) { + return search.length == 0 ? 0 : nil; + } - if (($a = ((($b = (self.document.$attributes()['$has_key?']("hardbreaks"))) !== false && $b !== nil) ? $b : (self.attributes['$has_key?']("hardbreaks-option")))) !== false && $a !== nil) { - lines = (text.$split($scope.LINE_SPLIT)); - if (lines.$size()['$=='](1)) { - return text}; - last = lines.$pop(); - return ($a = ($b = lines).$map, $a._p = (TMP_38 = function(line){var self = TMP_38._s || this;if (line == null) line = nil; - return $scope.Inline.$new(self, "break", line.$rstrip().$chomp($scope.LINE_BREAK), $hash2(["type"], {"type": "line"})).$render()}, TMP_38._s = self, TMP_38), $a).call($b).$push(last)['$*']($scope.EOL); - } else { - return ($a = ($c = text).$gsub, $a._p = (TMP_39 = function(){var self = TMP_39._s || this; - return $scope.Inline.$new(self, "break", $gvars["~"]['$[]'](1), $hash2(["type"], {"type": "line"})).$render()}, TMP_39._s = self, TMP_39), $a).call($c, $scope.REGEXP['$[]']("line_break")) - }; - }; + var result = -1; + if (offset != null) { + if (offset < 0) { + offset = self.length + offset; + } - def.$transform_quoted_text = function(match, type, scope) { - var $a, $b, $c, self = this, unescaped_attrs = nil, attributes = nil, id = nil; - unescaped_attrs = nil; - if (($a = match['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - if (($a = (($b = scope['$==']("constrained")) ? ($c = match['$[]'](2)['$nil?'](), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - unescaped_attrs = "[" + (match['$[]'](2)) + "]" - } else { - return match['$[]'](0)['$[]']($range(1, -1, false)) - }}; - if (scope['$==']("constrained")) { - if (($a = unescaped_attrs['$nil?']()) !== false && $a !== nil) { - attributes = self.$parse_quoted_text_attributes(match['$[]'](2)); - id = (function() {if (($a = attributes['$nil?']()) !== false && $a !== nil) { - return nil - } else { - return attributes.$delete("id") - }; return nil; })(); - return "" + (match['$[]'](1)) + ($scope.Inline.$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$render()); - } else { - return "" + (unescaped_attrs) + ($scope.Inline.$new(self, "quoted", match['$[]'](3), $hash2(["type", "attributes"], {"type": type, "attributes": $hash2([], {})})).$render()) + if (search_type == String) { + result = self.lastIndexOf(search, offset); + } + else { + result = self.substr(0, offset + 1).$reverse().search(search); + if (result !== -1) { + result = offset - result; } - } else { - attributes = self.$parse_quoted_text_attributes(match['$[]'](1)); - id = (function() {if (($a = attributes['$nil?']()) !== false && $a !== nil) { - return nil - } else { - return attributes.$delete("id") - }; return nil; })(); - return $scope.Inline.$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$render(); - }; - }; + } + } + else { + if (search_type == String) { + result = self.lastIndexOf(search); + } + else { + result = self.$reverse().search(search); + if (result !== -1) { + result = self.length - 1 - result; + } + } + } - def.$parse_quoted_text_attributes = function(str) { - var $a, $b, self = this, _ = nil, segments = nil, id = nil, more_roles = nil, roles = nil, attrs = nil; - if (($a = str['$nil?']()) !== false && $a !== nil) { - return nil}; - if (($a = str['$empty?']()) !== false && $a !== nil) { - return $hash2([], {})}; - if (($a = str['$include?']("{")) !== false && $a !== nil) { - str = self.$sub_attributes(str)}; - str = str.$strip(); - if (($a = str['$include?'](",")) !== false && $a !== nil) { - $a = $opal.to_ary(str.$split(",", 2)), str = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1])}; - if (($a = str['$empty?']()) !== false && $a !== nil) { - return $hash2([], {}) - } else if (($a = ((($b = str['$start_with?'](".")) !== false && $b !== nil) ? $b : str['$start_with?']("#"))) !== false && $a !== nil) { - segments = str.$split("#", 2); - if (segments.$length()['$>'](1)) { - $a = $opal.to_ary(segments['$[]'](1).$split(".")), id = ($a[0] == null ? nil : $a[0]), more_roles = $slice.call($a, 1) - } else { - id = nil; - more_roles = []; - }; - roles = (function() {if (($a = segments['$[]'](0)['$empty?']()) !== false && $a !== nil) { - return [] - } else { - return segments['$[]'](0).$split(".") - }; return nil; })(); - if (roles.$length()['$>'](1)) { - roles.$shift()}; - if (more_roles.$length()['$>'](0)) { - roles.$concat(more_roles)}; - attrs = $hash2([], {}); - if (($a = id['$nil?']()) === false || $a === nil) { - attrs['$[]=']("id", id)}; - if (($a = roles['$empty?']()) === false || $a === nil) { - attrs['$[]=']("role", roles['$*'](" "))}; - return attrs; - } else { - return $hash2(["role"], {"role": str}) - }; - }; + return result === -1 ? nil : result; + + }; - def.$parse_attributes = function(attrline, posattrs, opts) { - var $a, self = this, block = nil; - if (self.document == null) self.document = nil; + def.$rjust = function(width, padstr) { + var $a, self = this; - if (posattrs == null) { - posattrs = ["role"] + if (padstr == null) { + padstr = " " + } + width = $scope.Opal.$coerce_to(width, $scope.Integer, "to_int"); + padstr = $scope.Opal.$coerce_to(padstr, $scope.String, "to_str").$to_s(); + if ((($a = padstr['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.$raise($scope.ArgumentError, "zero width padding")}; + if ((($a = width <= self.length) !== nil && (!$a._isBoolean || $a == true))) { + return self}; + + var chars = Math.floor(width - self.length), + patterns = Math.floor(chars / padstr.length), + result = Array(patterns + 1).join(padstr), + remaining = chars - result.length; + + return result + padstr.slice(0, remaining) + self; + + }; + + def.$rstrip = function() { + var self = this; + + return self.replace(/\s*$/, ''); + }; + + def.$scan = TMP_6 = function(pattern) { + var self = this, $iter = TMP_6._p, block = $iter || nil; + + TMP_6._p = null; + + if (pattern.global) { + // should we clear it afterwards too? + pattern.lastIndex = 0; + } + else { + // rewrite regular expression to add the global flag to capture pre/post match + pattern = new RegExp(pattern.source, 'g' + (pattern.multiline ? 'm' : '') + (pattern.ignoreCase ? 'i' : '')); + } + + var result = []; + var match; + + while ((match = pattern.exec(self)) != null) { + var match_data = $scope.MatchData.$new(pattern, match); + if (block === nil) { + match.length == 1 ? result.push(match[0]) : result.push(match.slice(1)); } - if (opts == null) { - opts = $hash2([], {}) + else { + match.length == 1 ? block(match[0]) : block.apply(self, match.slice(1)); } - if (($a = attrline['$nil?']()) !== false && $a !== nil) { - return nil}; - if (($a = attrline['$empty?']()) !== false && $a !== nil) { - return $hash2([], {})}; - if (($a = opts['$[]']("sub_input")) !== false && $a !== nil) { - attrline = self.document.$sub_attributes(attrline)}; - if (($a = opts['$[]']("unescape_input")) !== false && $a !== nil) { - attrline = self.$unescape_bracketed_text(attrline)}; - block = nil; - if (($a = opts.$fetch("sub_result", true)) !== false && $a !== nil) { - block = self}; - if (($a = opts['$has_key?']("into")) !== false && $a !== nil) { - return $scope.AttributeList.$new(attrline, block).$parse_into(opts['$[]']("into"), posattrs) - } else { - return $scope.AttributeList.$new(attrline, block).$parse(posattrs) - }; - }; + } - def.$unescape_bracketed_text = function(text) { - var $a, self = this; - if (($a = text['$empty?']()) !== false && $a !== nil) { - return ""}; - return text.$strip().$tr($scope.EOL, " ").$gsub("]", "]"); - }; + return (block !== nil ? self : result); + + }; - def.$normalize_string = function(str, unescape_brackets) { - var $a, self = this; - if (unescape_brackets == null) { - unescape_brackets = false + $opal.defn(self, '$size', def.$length); + + $opal.defn(self, '$slice', def['$[]']); + + def.$split = function(pattern, limit) { + var self = this, $a; + if ($gvars[";"] == null) $gvars[";"] = nil; + + if (pattern == null) { + pattern = ((($a = $gvars[";"]) !== false && $a !== nil) ? $a : " ") + } + + if (pattern === nil || pattern === undefined) { + pattern = $gvars[";"]; + } + + var result = []; + if (limit !== undefined) { + limit = $scope.Opal['$coerce_to!'](limit, $scope.Integer, "to_int"); + } + + if (self.length === 0) { + return []; + } + + if (limit === 1) { + return [self]; + } + + if (pattern && pattern._isRegexp) { + var pattern_str = pattern.toString(); + + /* Opal and JS's repr of an empty RE. */ + var blank_pattern = (pattern_str.substr(0, 3) == '/^/') || + (pattern_str.substr(0, 6) == '/(?:)/'); + + /* This is our fast path */ + if (limit === undefined || limit === 0) { + result = self.split(blank_pattern ? /(?:)/ : pattern); } - if (($a = str['$empty?']()) !== false && $a !== nil) { - return "" - } else if (unescape_brackets !== false && unescape_brackets !== nil) { - return self.$unescape_brackets(str.$strip().$tr($scope.EOL, " ")) - } else { - return str.$strip().$tr($scope.EOL, " ") - }; - }; + else { + /* RegExp.exec only has sane behavior with global flag */ + if (! pattern.global) { + pattern = eval(pattern_str + 'g'); + } - def.$unescape_brackets = function(str) { - var $a, self = this; - if (($a = str['$empty?']()) !== false && $a !== nil) { - return "" - } else { - return str.$gsub("]", "]") - }; - }; + var match_data; + var prev_index = 0; + pattern.lastIndex = 0; - def.$split_simple_csv = function(str) { - var $a, $b, TMP_40, $c, self = this, values = nil, current = nil, quote_open = nil; - if (($a = str['$empty?']()) !== false && $a !== nil) { - values = [] - } else if (($a = str['$include?']("\"")) !== false && $a !== nil) { - values = []; - current = []; - quote_open = false; - ($a = ($b = str).$each_char, $a._p = (TMP_40 = function(c){var self = TMP_40._s || this, $a, $case = nil;if (c == null) c = nil; - return (function() {$case = c;if (","['$===']($case)) {if (quote_open !== false && quote_open !== nil) { - return current.$push(c) - } else { - values['$<<'](current.$join().$strip()); - return current = []; - }}else if ("\""['$===']($case)) {return quote_open = ($a = quote_open, ($a === nil || $a === false))}else {return current.$push(c)}})()}, TMP_40._s = self, TMP_40), $a).call($b); - values['$<<'](current.$join().$strip()); - } else { - values = ($a = ($c = str.$split(",")).$map, $a._p = "strip".$to_proc(), $a).call($c) - }; - return values; - }; + while ((match_data = pattern.exec(self)) !== null) { + var segment = self.slice(prev_index, match_data.index); + result.push(segment); - def.$resolve_subs = function(subs, type, defaults, subject) { - var $a, $b, TMP_41, self = this, candidates = nil, modification_group = nil, resolved = nil, invalid = nil; - if (type == null) { - type = "block" + prev_index = pattern.lastIndex; + + if (match_data[0].length === 0) { + if (blank_pattern) { + /* explicitly split on JS's empty RE form.*/ + pattern = /(?:)/; + } + + result = self.split(pattern); + /* with "unlimited", ruby leaves a trail on blanks. */ + if (limit !== undefined && limit < 0 && blank_pattern) { + result.push(''); + } + + prev_index = undefined; + break; + } + + if (limit !== undefined && limit > 1 && result.length + 1 == limit) { + break; + } + } + + if (prev_index !== undefined) { + result.push(self.slice(prev_index, self.length)); + } } - if (defaults == null) { - defaults = nil + } + else { + var splitted = 0, start = 0, lim = 0; + + if (pattern === nil || pattern === undefined) { + pattern = ' ' + } else { + pattern = $scope.Opal.$try_convert(pattern, $scope.String, "to_str").$to_s(); } - if (subject == null) { - subject = nil + + var string = (pattern == ' ') ? self.replace(/[\r\n\t\v]\s+/g, ' ') + : self; + var cursor = -1; + while ((cursor = string.indexOf(pattern, start)) > -1 && cursor < string.length) { + if (splitted + 1 === limit) { + break; + } + + if (pattern == ' ' && cursor == start) { + start = cursor + 1; + continue; + } + + result.push(string.substr(start, pattern.length ? cursor - start : 1)); + splitted++; + + start = cursor + (pattern.length ? pattern.length : 1); } - if (($a = ((($b = subs['$nil?']()) !== false && $b !== nil) ? $b : subs['$empty?']())) !== false && $a !== nil) { - return []}; - candidates = []; - modification_group = (function() {if (($a = defaults['$nil?']()) !== false && $a !== nil) { - return false - } else { - return nil - }; return nil; })(); - ($a = ($b = subs.$split(",")).$each, $a._p = (TMP_41 = function(val){var self = TMP_41._s || this, $a, $b, $c, key = nil, first = nil, operation = nil, resolved_keys = nil, resolved_key = nil, $case = nil;if (val == null) val = nil; - key = val.$strip(); - if (($a = ($b = modification_group['$=='](false), ($b === nil || $b === false))) !== false && $a !== nil) { - if (((first = key['$[]']($range(0, 0, false))))['$==']("+")) { - operation = "append"; - key = key['$[]']($range(1, -1, false)); - } else if (first['$==']("-")) { - operation = "remove"; - key = key['$[]']($range(1, -1, false)); - } else if (($a = key['$end_with?']("+")) !== false && $a !== nil) { - operation = "prepend"; - key = key['$[]']($range(0, -1, true)); - } else if (modification_group !== false && modification_group !== nil) { - self.$warn("asciidoctor: WARNING: invalid entry in substitution modification group" + ((function() {if (subject !== false && subject !== nil) { - return " for " - } else { - return nil - }; return nil; })()) + (subject) + ": " + (key)); - return nil;; - } else { - operation = nil - }; - if (($a = modification_group['$nil?']()) !== false && $a !== nil) { - if (operation !== false && operation !== nil) { - candidates = defaults.$dup(); - modification_group = true; - } else { - modification_group = false - }};}; - key = key.$to_sym(); - if (($a = (($b = type['$==']("inline")) ? (((($c = key['$==']("verbatim")) !== false && $c !== nil) ? $c : key['$==']("v"))) : $b)) !== false && $a !== nil) { - resolved_keys = ["specialcharacters"] - } else if (($a = $scope.COMPOSITE_SUBS['$has_key?'](key)) !== false && $a !== nil) { - resolved_keys = $scope.COMPOSITE_SUBS['$[]'](key) - } else if (($a = ($b = (($c = type['$==']("inline")) ? key.$to_s().$length()['$=='](1) : $c), $b !== false && $b !== nil ?($scope.SUB_SYMBOLS['$has_key?'](key)) : $b)) !== false && $a !== nil) { - resolved_key = $scope.SUB_SYMBOLS['$[]'](key); - if (($a = $scope.COMPOSITE_SUBS['$has_key?'](resolved_key)) !== false && $a !== nil) { - resolved_keys = $scope.COMPOSITE_SUBS['$[]'](resolved_key) - } else { - resolved_keys = [resolved_key] - }; - } else { - resolved_keys = [key] - }; - if (modification_group !== false && modification_group !== nil) { - return (function() {$case = operation;if ("append"['$===']($case)) {return candidates = candidates['$+'](resolved_keys)}else if ("prepend"['$===']($case)) {return candidates = resolved_keys['$+'](candidates)}else if ("remove"['$===']($case)) {return candidates = candidates['$-'](resolved_keys)}else { return nil }})() - } else { - return candidates = candidates['$+'](resolved_keys) - };}, TMP_41._s = self, TMP_41), $a).call($b); - resolved = candidates['$&']($scope.SUB_OPTIONS['$[]'](type)); - if (((invalid = candidates['$-'](resolved))).$size()['$>'](0)) { - self.$warn("asciidoctor: WARNING: invalid substitution type" + ((function() {if (invalid.$size()['$>'](1)) { - return "s" - } else { - return "" - }; return nil; })()) + ((function() {if (subject !== false && subject !== nil) { - return " for " - } else { - return nil - }; return nil; })()) + (subject) + ": " + (invalid['$*'](", ")))}; - return resolved; - }; - def.$resolve_block_subs = function(subs, defaults, subject) { - var self = this; - return self.$resolve_subs(subs, "block", defaults, subject); - }; + if (string.length > 0 && (limit < 0 || string.length > start)) { + if (string.length == start) { + result.push(''); + } + else { + result.push(string.substr(start, string.length)); + } + } + } - def.$resolve_pass_subs = function(subs) { - var self = this; - return self.$resolve_subs(subs, "inline", nil, "passthrough macro"); - }; + if (limit === undefined || limit === 0) { + while (result[result.length-1] === '') { + result.length = result.length - 1; + } + } - def.$highlight_source = function(source, sub_callouts, highlighter) { - var $a, $b, TMP_42, $c, $d, TMP_44, self = this, callout_marks = nil, lineno = nil, callout_on_last = nil, last = nil, linenums_mode = nil, $case = nil, result = nil, lexer = nil, opts = nil, reached_code = nil; - if (self.document == null) self.document = nil; - if (self.passthroughs == null) self.passthroughs = nil; + if (limit > 0) { + var tail = result.slice(limit - 1).join(''); + result.splice(limit - 1, result.length - 1, tail); + } - if (highlighter == null) { - highlighter = nil + return result; + ; + }; + + def.$squeeze = function(sets) { + var self = this; + + sets = $slice.call(arguments, 0); + + if (sets.length === 0) { + return self.replace(/(.)\1+/g, '$1'); + } + + + var set = $scope.Opal.$coerce_to(sets[0], $scope.String, "to_str").$chars(); + + for (var i = 1, length = sets.length; i < length; i++) { + set = (set)['$&']($scope.Opal.$coerce_to(sets[i], $scope.String, "to_str").$chars()); + } + + if (set.length === 0) { + return self; + } + + return self.replace(new RegExp("([" + $scope.Regexp.$escape((set).$join()) + "])\\1+", "g"), "$1"); + ; + }; + + def['$start_with?'] = function(prefixes) { + var self = this; + + prefixes = $slice.call(arguments, 0); + + for (var i = 0, length = prefixes.length; i < length; i++) { + var prefix = $scope.Opal.$coerce_to(prefixes[i], $scope.String, "to_str").$to_s(); + + if (self.indexOf(prefix) === 0) { + return true; } - ((($a = highlighter) !== false && $a !== nil) ? $a : highlighter = self.document.$attributes()['$[]']("source-highlighter")); - $scope.Helpers.$require_library(highlighter, ((function() {if (highlighter['$==']("pygments")) { - return "pygments.rb" - } else { - return highlighter - }; return nil; })())); - callout_marks = $hash2([], {}); - lineno = 0; - callout_on_last = false; - if (sub_callouts !== false && sub_callouts !== nil) { - last = -1; - source = ($a = ($b = source.$split($scope.LINE_SPLIT)).$map, $a._p = (TMP_42 = function(line){var self = TMP_42._s || this, $a, $b, TMP_43;if (line == null) line = nil; - lineno = lineno['$+'](1); - return ($a = ($b = line).$gsub, $a._p = (TMP_43 = function(){var self = TMP_43._s || this, $a, $b, $c, m = nil; - m = $gvars["~"]; - if (m['$[]'](1)['$==']("\\")) { - return m['$[]'](0).$sub("\\", "") - } else { - (($a = lineno, $b = callout_marks, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, []))))['$<<'](m['$[]'](3)); - last = lineno; - return nil; - };}, TMP_43._s = self, TMP_43), $a).call($b, $scope.REGEXP['$[]']("callout_scan"));}, TMP_42._s = self, TMP_42), $a).call($b)['$*']($scope.EOL); - callout_on_last = (last['$=='](lineno));}; - linenums_mode = nil; - $case = highlighter;if ("coderay"['$===']($case)) {result = ((($a = $opal.Object._scope.CodeRay) == null ? $opal.cm('CodeRay') : $a))._scope.Duo['$[]'](self.$attr("language", "text").$to_sym(), "html", $hash2(["css", "line_numbers", "line_number_anchors"], {"css": self.document.$attributes().$fetch("coderay-css", "class").$to_sym(), "line_numbers": (linenums_mode = ((function() {if (($a = self['$attr?']("linenums")) !== false && $a !== nil) { - return self.document.$attributes().$fetch("coderay-linenums-mode", "table").$to_sym() - } else { - return nil - }; return nil; })())), "line_number_anchors": false})).$highlight(source)}else if ("pygments"['$===']($case)) {lexer = ((($a = $opal.Object._scope.Pygments) == null ? $opal.cm('Pygments') : $a))._scope.Lexer['$[]'](self.$attr("language")); - if (lexer !== false && lexer !== nil) { - opts = $hash2(["cssclass", "classprefix", "nobackground"], {"cssclass": "pyhl", "classprefix": "tok-", "nobackground": true}); - if (($a = self.document.$attributes().$fetch("pygments-css", "class")['$==']("class")) === false || $a === nil) { - opts['$[]=']("noclasses", true)}; - if (($a = self['$attr?']("linenums")) !== false && $a !== nil) { - opts['$[]=']("linenos", ((linenums_mode = self.document.$attributes().$fetch("pygments-linenums-mode", "table").$to_sym())).$to_s())}; - if (linenums_mode['$==']("table")) { - result = lexer.$highlight(source, $hash2(["options"], {"options": opts})).$sub(/
(.*)<\/div>/i, "1").$gsub(/]*>(.*?)<\/pre>\s*/i, "1") - } else { - result = lexer.$highlight(source, $hash2(["options"], {"options": opts})).$sub(/
]*>(.*?)<\/pre><\/div>/i, "1") - }; - } else { - result = source - };}; - if (($a = self.passthroughs['$empty?']()) === false || $a === nil) { - result = result.$gsub($scope.PASS_PLACEHOLDER['$[]']("match_syn"), "" + ($scope.PASS_PLACEHOLDER['$[]']("start")) + "\\1" + ($scope.PASS_PLACEHOLDER['$[]']("end")))}; - if (($a = ((($c = ($d = sub_callouts, ($d === nil || $d === false))) !== false && $c !== nil) ? $c : callout_marks['$empty?']())) !== false && $a !== nil) { - return result - } else { - lineno = 0; - reached_code = ($a = linenums_mode['$==']("table"), ($a === nil || $a === false)); - return ($a = ($c = result.$split($scope.LINE_SPLIT)).$map, $a._p = (TMP_44 = function(line){var self = TMP_44._s || this, $a, $b, $c, TMP_45, conums = nil, tail = nil, pos = nil, conums_markup = nil; - if (self.document == null) self.document = nil; -if (line == null) line = nil; - if (($a = reached_code) === false || $a === nil) { - if (($a = line['$include?']("")) === false || $a === nil) { - return line;}; - reached_code = true;}; - lineno = lineno['$+'](1); - if (($a = (conums = callout_marks.$delete(lineno))) !== false && $a !== nil) { - tail = nil; - if (($a = ($b = (($c = callout_on_last !== false && callout_on_last !== nil) ? callout_marks['$empty?']() : $c), $b !== false && $b !== nil ?(pos = line.$index("")) : $b)) !== false && $a !== nil) { - tail = line['$[]']($range(pos, -1, false)); - line = line['$[]']($range(0, pos, true));}; - if (conums.$size()['$=='](1)) { - return "" + (line) + ($scope.Inline.$new(self, "callout", conums.$first(), $hash2(["id"], {"id": self.document.$callouts().$read_next_id()})).$render()) + (tail) - } else { - conums_markup = ($a = ($b = conums).$map, $a._p = (TMP_45 = function(conum){var self = TMP_45._s || this; - if (self.document == null) self.document = nil; -if (conum == null) conum = nil; - return $scope.Inline.$new(self, "callout", conum, $hash2(["id"], {"id": self.document.$callouts().$read_next_id()})).$render()}, TMP_45._s = self, TMP_45), $a).call($b)['$*'](" "); - return "" + (line) + (conums_markup) + (tail); - }; - } else { - return line - };}, TMP_44._s = self, TMP_44), $a).call($c)['$*']($scope.EOL); - }; - }; - - def.$lock_in_subs = function() { - var $a, $b, $c, $d, $e, TMP_46, self = this, default_subs = nil, $case = nil, custom_subs = nil, highlighter = nil; - if (self.content_model == null) self.content_model = nil; - if (self.context == null) self.context = nil; - if (self.attributes == null) self.attributes = nil; - if (self.style == null) self.style = nil; - if (self.document == null) self.document = nil; - if (self.subs == null) self.subs = nil; + } - default_subs = []; - $case = self.content_model;if ("simple"['$===']($case)) {default_subs = $scope.SUBS['$[]']("normal")}else if ("verbatim"['$===']($case)) {if (($a = ((($b = self.context['$==']("listing")) !== false && $b !== nil) ? $b : ((($c = self.context['$==']("literal")) ? ($d = (self['$option?']("listparagraph")), ($d === nil || $d === false)) : $c)))) !== false && $a !== nil) { - default_subs = $scope.SUBS['$[]']("verbatim") - } else if (self.context['$==']("verse")) { - default_subs = $scope.SUBS['$[]']("normal") - } else { - default_subs = $scope.SUBS['$[]']("basic") - }}else if ("raw"['$===']($case)) {default_subs = $scope.SUBS['$[]']("pass")}else {return nil}; - if (($a = (custom_subs = self.attributes['$[]']("subs"))) !== false && $a !== nil) { - self.subs = self.$resolve_block_subs(custom_subs, default_subs, self.context) - } else { - self.subs = default_subs.$dup() - }; - if (($a = ($b = ($c = ($d = (($e = self.context['$==']("listing")) ? self.style['$==']("source") : $e), $d !== false && $d !== nil ?(self.document['$basebackend?']("html")) : $d), $c !== false && $c !== nil ?(((($d = ((highlighter = self.document.$attributes()['$[]']("source-highlighter")))['$==']("coderay")) !== false && $d !== nil) ? $d : highlighter['$==']("pygments"))) : $c), $b !== false && $b !== nil ?(self['$attr?']("language")) : $b)) !== false && $a !== nil) { - return self.subs = ($a = ($b = self.subs).$map, $a._p = (TMP_46 = function(sub){var self = TMP_46._s || this;if (sub == null) sub = nil; - if (sub['$==']("specialcharacters")) { - return "highlight" - } else { - return sub - }}, TMP_46._s = self, TMP_46), $a).call($b) - } else { - return nil - }; - }; - ;$opal.donate(self, ["$apply_subs", "$apply_normal_subs", "$apply_title_subs", "$apply_header_subs", "$extract_passthroughs", "$restore_passthroughs", "$sub_specialcharacters", "$sub_specialchars", "$sub_quotes", "$sub_replacements", "$do_replacement", "$sub_attributes", "$sub_macros", "$sub_inline_anchors", "$sub_inline_xrefs", "$sub_callouts", "$sub_post_replacements", "$transform_quoted_text", "$parse_quoted_text_attributes", "$parse_attributes", "$unescape_bracketed_text", "$normalize_string", "$unescape_brackets", "$split_simple_csv", "$resolve_subs", "$resolve_block_subs", "$resolve_pass_subs", "$highlight_source", "$lock_in_subs"]); - })(self) + return false; - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + }; - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $AbstractNode(){}; - var self = $AbstractNode = $klass($base, $super, 'AbstractNode', $AbstractNode); + def.$strip = function() { + var self = this; - var def = $AbstractNode._proto, $scope = $AbstractNode._scope; - def.document = def.attributes = def.style = nil; - self.$include($scope.Substitutors); + return self.replace(/^\s*/, '').replace(/\s*$/, ''); + }; - self.$attr_reader("parent"); + def.$sub = TMP_7 = function(pattern, replace) { + var self = this, $iter = TMP_7._p, block = $iter || nil; - self.$attr_reader("document"); + TMP_7._p = null; + + if (typeof(replace) === 'string') { + // convert Ruby back reference to JavaScript back reference + replace = replace.replace(/\\([1-9])/g, '$$$1') + return self.replace(pattern, replace); + } + if (block !== nil) { + return self.replace(pattern, function() { + // FIXME: this should be a formal MatchData object with all the goodies + var match_data = [] + for (var i = 0, len = arguments.length; i < len; i++) { + var arg = arguments[i]; + if (arg == undefined) { + match_data.push(nil); + } + else { + match_data.push(arg); + } + } - self.$attr_reader("context"); + var str = match_data.pop(); + var offset = match_data.pop(); + var match_len = match_data.length; + + // $1, $2, $3 not being parsed correctly in Ruby code + //for (var i = 1; i < match_len; i++) { + // __gvars[String(i)] = match_data[i]; + //} + $gvars["&"] = match_data[0]; + $gvars["~"] = match_data; + return block(match_data[0]); + }); + } + else if (replace !== undefined) { + if (replace['$is_a?']($scope.Hash)) { + return self.replace(pattern, function(str) { + var value = replace['$[]'](self.$str()); - self.$attr_accessor("id"); + return (value == null) ? nil : self.$value().$to_s(); + }); + } + else { + replace = $scope.String.$try_convert(replace); - self.$attr_reader("attributes"); + if (replace == null) { + self.$raise($scope.TypeError, "can't convert " + (replace.$class()) + " into String"); + } - def.$initialize = function(parent, context) { - var $a, self = this; - if (context['$==']("document")) { - self.parent = nil; - self.document = parent; - } else { - self.parent = parent; - self.document = ((function() {if (($a = parent['$nil?']()) !== false && $a !== nil) { - return nil - } else { - return parent.$document() - }; return nil; })()); - }; - self.context = context; - self.attributes = $hash2([], {}); - return self.passthroughs = []; - }; + return self.replace(pattern, replace); + } + } + else { + // convert Ruby back reference to JavaScript back reference + replace = replace.toString().replace(/\\([1-9])/g, '$$$1') + return self.replace(pattern, replace); + } + ; + }; - def['$parent='] = function(parent) { - var self = this; - self.parent = parent; - self.document = parent.$document(); - return nil; - }; + $opal.defn(self, '$succ', def.$next); - def.$attr = function(name, default_value, inherit) { - var $a, $b, self = this; - if (default_value == null) { - default_value = nil - } - if (inherit == null) { - inherit = true - } - if (($a = name['$is_a?']($scope.Symbol)) !== false && $a !== nil) { - name = name.$to_s()}; - if (self['$=='](self.document)) { - inherit = false}; - if (inherit !== false && inherit !== nil) { - return ((($a = ((($b = self.attributes['$[]'](name)) !== false && $b !== nil) ? $b : self.document.$attributes()['$[]'](name))) !== false && $a !== nil) ? $a : default_value) - } else { - return ((($a = self.attributes['$[]'](name)) !== false && $a !== nil) ? $a : default_value) - }; - }; + def.$sum = function(n) { + var self = this; - def['$attr?'] = function(name, expect, inherit) { - var $a, $b, self = this; - if (expect == null) { - expect = nil - } - if (inherit == null) { - inherit = true - } - if (($a = name['$is_a?']($scope.Symbol)) !== false && $a !== nil) { - name = name.$to_s()}; - if (self['$=='](self.document)) { - inherit = false}; - if (($a = expect['$nil?']()) !== false && $a !== nil) { - return ((($a = self.attributes['$has_key?'](name)) !== false && $a !== nil) ? $a : ((($b = inherit !== false && inherit !== nil) ? self.document.$attributes()['$has_key?'](name) : $b))) - } else if (inherit !== false && inherit !== nil) { - return expect['$==']((((($a = self.attributes['$[]'](name)) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]'](name)))) - } else { - return expect['$=='](self.attributes['$[]'](name)) - }; - }; + if (n == null) { + n = 16 + } + + var result = 0; - def.$set_attr = function(key, val, overwrite) { - var $a, $b, self = this; - if (overwrite == null) { - overwrite = nil - } - if (($a = overwrite['$nil?']()) !== false && $a !== nil) { - self.attributes['$[]='](key, val); - return true; - } else if (($a = ((($b = overwrite) !== false && $b !== nil) ? $b : self.attributes['$has_key?'](key))) !== false && $a !== nil) { - self.attributes['$[]='](key, val); - return true; - } else { - return false - }; - }; + for (var i = 0, length = self.length; i < length; i++) { + result += (self.charCodeAt(i) % ((1 << n) - 1)); + } - def.$set_option = function(name) { - var $a, self = this; - if (($a = self.attributes['$has_key?']("options")) !== false && $a !== nil) { - self.attributes['$[]=']("options", "" + (self.attributes['$[]']("options")) + "," + (name)) - } else { - self.attributes['$[]=']("options", name) - }; - return self.attributes['$[]=']("" + (name) + "-option", ""); - }; + return result; + + }; - def['$option?'] = function(name) { - var self = this; - return self.attributes['$has_key?']("" + (name) + "-option"); - }; + def.$swapcase = function() { + var self = this; - def.$get_binding = function(template) { - var self = this; - return self.$binding(); - }; + + var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) { + return $1 ? $0.toUpperCase() : $0.toLowerCase(); + }); - def.$update_attributes = function(attributes) { - var self = this; - self.attributes.$update(attributes); - return nil; - }; + if (self.constructor === String) { + return str; + } - def.$renderer = function() { - var self = this; - return self.document.$renderer(); - }; + return self.$class().$new(str); + + }; - def['$role?'] = function(expect) { - var $a, self = this; - if (expect == null) { - expect = nil - } - if (($a = expect['$nil?']()) !== false && $a !== nil) { - return ((($a = self.attributes['$has_key?']("role")) !== false && $a !== nil) ? $a : self.document.$attributes()['$has_key?']("role")) - } else { - return expect['$==']((((($a = self.attributes['$[]']("role")) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]']("role")))) - }; - }; + def.$to_f = function() { + var self = this; - def.$role = function() { - var $a, self = this; - return ((($a = self.attributes['$[]']("role")) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]']("role")); - }; + + if (self.charAt(0) === '_') { + return 0; + } - def['$has_role?'] = function(name) { - var $a, $b, self = this, val = nil; - if (($a = (val = (((($b = self.attributes['$[]']("role")) !== false && $b !== nil) ? $b : self.document.$attributes()['$[]']("role"))))) !== false && $a !== nil) { - return val.$split(" ")['$include?'](name) - } else { - return false - }; - }; + var result = parseFloat(self.replace(/_/g, '')); - def.$roles = function() { - var $a, $b, self = this, val = nil; - if (($a = (val = (((($b = self.attributes['$[]']("role")) !== false && $b !== nil) ? $b : self.document.$attributes()['$[]']("role"))))) !== false && $a !== nil) { - return val.$split(" ") - } else { - return [] - }; - }; + if (isNaN(result) || result == Infinity || result == -Infinity) { + return 0; + } + else { + return result; + } + + }; - def['$reftext?'] = function() { - var $a, self = this; - return ((($a = self.attributes['$has_key?']("reftext")) !== false && $a !== nil) ? $a : self.document.$attributes()['$has_key?']("reftext")); - }; + def.$to_i = function(base) { + var self = this; - def.$reftext = function() { - var $a, self = this; - return ((($a = self.attributes['$[]']("reftext")) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]']("reftext")); - }; + if (base == null) { + base = 10 + } + + var result = parseInt(self, base); - def.$short_tag_slash = function() { - var self = this; - if (self.document.$attributes()['$[]']("htmlsyntax")['$==']("xml")) { - return "/" - } else { - return nil - }; - }; + if (isNaN(result)) { + return 0; + } - def.$icon_uri = function(name) { - var $a, self = this; - if (($a = self['$attr?']("icon")) !== false && $a !== nil) { - return self.$image_uri(self.$attr("icon"), nil) - } else { - return self.$image_uri("" + (name) + "." + (self.document.$attr("icontype", "png")), "iconsdir") - }; - }; + return result; + + }; - def.$media_uri = function(target, asset_dir_key) { - var $a, $b, self = this; - if (asset_dir_key == null) { - asset_dir_key = "imagesdir" - } - if (($a = ($b = target['$include?'](":"), $b !== false && $b !== nil ?target.$match(($scope.Asciidoctor)._scope.REGEXP['$[]']("uri_sniff")) : $b)) !== false && $a !== nil) { - return target - } else if (($a = (($b = asset_dir_key !== false && asset_dir_key !== nil) ? self['$attr?'](asset_dir_key) : $b)) !== false && $a !== nil) { - return self.$normalize_web_path(target, self.document.$attr(asset_dir_key)) - } else { - return self.$normalize_web_path(target) - }; - }; + def.$to_proc = function() { + var $a, $b, TMP_8, self = this; - def.$image_uri = function(target_image, asset_dir_key) { - var $a, $b, self = this; - if (asset_dir_key == null) { - asset_dir_key = "imagesdir" + return ($a = ($b = self).$proc, $a._p = (TMP_8 = function(recv, args){var self = TMP_8._s || this, $a; +if (recv == null) recv = nil;args = $slice.call(arguments, 1); + return ($a = recv).$send.apply($a, [self].concat(args))}, TMP_8._s = self, TMP_8), $a).call($b); + }; + + def.$to_s = function() { + var self = this; + + return self.toString(); + }; + + $opal.defn(self, '$to_str', def.$to_s); + + $opal.defn(self, '$to_sym', def.$intern); + + def.$tr = function(from, to) { + var self = this; + + + if (from.length == 0 || from === to) { + return self; + } + + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^') { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + var in_range = false; + for (var i = 0; i < from_length; i++) { + var ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } } - if (($a = ($b = target_image['$include?'](":"), $b !== false && $b !== nil ?target_image.$match(($scope.Asciidoctor)._scope.REGEXP['$[]']("uri_sniff")) : $b)) !== false && $a !== nil) { - return target_image - } else if (($a = (($b = self.document.$safe()['$<']((($scope.Asciidoctor)._scope.SafeMode)._scope.SECURE)) ? self.document['$attr?']("data-uri") : $b)) !== false && $a !== nil) { - return self.$generate_data_uri(target_image, asset_dir_key) - } else if (($a = (($b = asset_dir_key !== false && asset_dir_key !== nil) ? self['$attr?'](asset_dir_key) : $b)) !== false && $a !== nil) { - return self.$normalize_web_path(target_image, self.document.$attr(asset_dir_key)) - } else { - return self.$normalize_web_path(target_image) - }; - }; + else if (in_range) { + var start = last_from.charCodeAt(0) + 1; + var end = ch.charCodeAt(0); + for (var c = start; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + from_chars_expanded.push(ch); + } + } - def.$generate_data_uri = function(target_image, asset_dir_key) { - var $a, $b, TMP_1, self = this, ext = nil, mimetype = nil, image_path = nil, bindata = nil; - if (asset_dir_key == null) { - asset_dir_key = nil + from_chars = from_chars_expanded; + from_length = from_chars.length; + + if (inverse) { + for (var i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; } - ext = $scope.File.$extname(target_image)['$[]']($range(1, -1, false)); - mimetype = "image/"['$+'](ext); - if (ext['$==']("svg")) { - mimetype = "" + (mimetype) + "+xml"}; - if (asset_dir_key !== false && asset_dir_key !== nil) { - image_path = self.$normalize_system_path(target_image, self.document.$attr(asset_dir_key), nil, $hash2(["target_name"], {"target_name": "image"})) - } else { - image_path = self.$normalize_system_path(target_image) - }; - if (($a = ($b = $scope.File['$readable?'](image_path), ($b === nil || $b === false))) !== false && $a !== nil) { - self.$warn("asciidoctor: WARNING: image to embed not found or not readable: " + (image_path)); - return "data:" + (mimetype) + ":base64,";}; - bindata = nil; - if (($a = $scope.IO['$respond_to?']("binread")) !== false && $a !== nil) { - bindata = $scope.IO.$binread(image_path) - } else { - bindata = ($a = ($b = $scope.File).$open, $a._p = (TMP_1 = function(file){var self = TMP_1._s || this;if (file == null) file = nil; - return file.$read()}, TMP_1._s = self, TMP_1), $a).call($b, image_path, "rb") - }; - return "data:" + (mimetype) + ";base64," + ($scope.Base64.$encode64(bindata).$delete("\n")); - }; + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + var in_range = false; + for (var i = 0; i < to_length; i++) { + var ch = to_chars[i]; + if (last_from == null) { + last_from = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + var start = last_from.charCodeAt(0) + 1; + var end = ch.charCodeAt(0); + for (var c = start; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + to_chars_expanded.push(ch); + } + } - def.$read_asset = function(path, warn_on_failure) { - var $a, self = this; - if (warn_on_failure == null) { - warn_on_failure = false + to_chars = to_chars_expanded; + to_length = to_chars.length; } - if (($a = $scope.File['$readable?'](path)) !== false && $a !== nil) { - return $scope.File.$read(path).$chomp() - } else { - if (warn_on_failure !== false && warn_on_failure !== nil) { - self.$warn("asciidoctor: WARNING: file does not exist or cannot be read: " + (path))}; - return nil; - }; - }; - def.$normalize_web_path = function(target, start) { - var self = this; - if (start == null) { - start = nil + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (var i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } } - return $scope.PathResolver.$new().$web_path(target, start); - }; - def.$normalize_system_path = function(target, start, jail, opts) { - var $a, $b, self = this; - if (start == null) { - start = nil + for (var i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; } - if (jail == null) { - jail = nil + } + + var new_str = '' + for (var i = 0, length = self.length; i < length; i++) { + var ch = self.charAt(i); + var sub = subs[ch]; + if (inverse) { + new_str += (sub == null ? global_sub : ch); } - if (opts == null) { - opts = $hash2([], {}) + else { + new_str += (sub != null ? sub : ch); } - if (($a = start['$nil?']()) !== false && $a !== nil) { - start = self.document.$base_dir()}; - if (($a = ($b = jail['$nil?'](), $b !== false && $b !== nil ?self.document.$safe()['$>='](($scope.SafeMode)._scope.SAFE) : $b)) !== false && $a !== nil) { - jail = self.document.$base_dir()}; - return $scope.PathResolver.$new().$system_path(target, start, jail, opts); - }; + } + return new_str; + + }; - def.$normalize_asset_path = function(asset_ref, asset_name, autocorrect) { - var self = this; - if (asset_name == null) { - asset_name = "path" + def.$tr_s = function(from, to) { + var self = this; + + + if (from.length == 0) { + return self; + } + + var subs = {}; + var from_chars = from.split(''); + var from_length = from_chars.length; + var to_chars = to.split(''); + var to_length = to_chars.length; + + var inverse = false; + var global_sub = null; + if (from_chars[0] === '^') { + inverse = true; + from_chars.shift(); + global_sub = to_chars[to_length - 1] + from_length -= 1; + } + + var from_chars_expanded = []; + var last_from = null; + var in_range = false; + for (var i = 0; i < from_length; i++) { + var ch = from_chars[i]; + if (last_from == null) { + last_from = ch; + from_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_from === '-') { + from_chars_expanded.push('-'); + from_chars_expanded.push('-'); + } + else if (i == from_length - 1) { + from_chars_expanded.push('-'); + } + else { + in_range = true; + } } - if (autocorrect == null) { - autocorrect = true + else if (in_range) { + var start = last_from.charCodeAt(0) + 1; + var end = ch.charCodeAt(0); + for (var c = start; c < end; c++) { + from_chars_expanded.push(String.fromCharCode(c)); + } + from_chars_expanded.push(ch); + in_range = null; + last_from = null; } - return self.$normalize_system_path(asset_ref, self.document.$base_dir(), nil, $hash2(["target_name", "recover"], {"target_name": asset_name, "recover": autocorrect})); - }; + else { + from_chars_expanded.push(ch); + } + } - def.$relative_path = function(filename) { - var self = this; - return $scope.PathResolver.$new().$relative_path(filename, self.document.$base_dir()); - }; + from_chars = from_chars_expanded; + from_length = from_chars.length; - return (def.$list_marker_keyword = function(list_type) { - var $a, self = this; - if (list_type == null) { - list_type = nil + if (inverse) { + for (var i = 0; i < from_length; i++) { + subs[from_chars[i]] = true; } - return $scope.ORDERED_LIST_KEYWORDS['$[]'](((($a = list_type) !== false && $a !== nil) ? $a : self.style)); - }, nil); - })(self, null) - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + } + else { + if (to_length > 0) { + var to_chars_expanded = []; + var last_to = null; + var in_range = false; + for (var i = 0; i < to_length; i++) { + var ch = to_chars[i]; + if (last_from == null) { + last_from = ch; + to_chars_expanded.push(ch); + } + else if (ch === '-') { + if (last_to === '-') { + to_chars_expanded.push('-'); + to_chars_expanded.push('-'); + } + else if (i == to_length - 1) { + to_chars_expanded.push('-'); + } + else { + in_range = true; + } + } + else if (in_range) { + var start = last_from.charCodeAt(0) + 1; + var end = ch.charCodeAt(0); + for (var c = start; c < end; c++) { + to_chars_expanded.push(String.fromCharCode(c)); + } + to_chars_expanded.push(ch); + in_range = null; + last_from = null; + } + else { + to_chars_expanded.push(ch); + } + } - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $AbstractBlock(){}; - var self = $AbstractBlock = $klass($base, $super, 'AbstractBlock', $AbstractBlock); + to_chars = to_chars_expanded; + to_length = to_chars.length; + } - var def = $AbstractBlock._proto, $scope = $AbstractBlock._scope, TMP_1; - def.context = def.document = def.attributes = def.template_name = def.blocks = def.subs = def.title = def.subbed_title = def.caption = def.next_section_index = def.next_section_number = nil; - self.$attr_accessor("content_model"); + var length_diff = from_length - to_length; + if (length_diff > 0) { + var pad_char = (to_length > 0 ? to_chars[to_length - 1] : ''); + for (var i = 0; i < length_diff; i++) { + to_chars.push(pad_char); + } + } - self.$attr_reader("subs"); + for (var i = 0; i < from_length; i++) { + subs[from_chars[i]] = to_chars[i]; + } + } + var new_str = '' + var last_substitute = null + for (var i = 0, length = self.length; i < length; i++) { + var ch = self.charAt(i); + var sub = subs[ch] + if (inverse) { + if (sub == null) { + if (last_substitute == null) { + new_str += global_sub; + last_substitute = true; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + else { + if (sub != null) { + if (last_substitute == null || last_substitute !== sub) { + new_str += sub; + last_substitute = sub; + } + } + else { + new_str += ch; + last_substitute = null; + } + } + } + return new_str; + + }; - self.$attr_accessor("template_name"); + def.$upcase = function() { + var self = this; - self.$attr_reader("blocks"); + return self.toUpperCase(); + }; - self.$attr_accessor("level"); + def.$freeze = function() { + var self = this; - self.$attr_writer("title"); + return self; + }; - self.$attr_accessor("style"); + return (def['$frozen?'] = function() { + var self = this; - self.$attr_accessor("caption"); + return true; + }, nil) && 'frozen?'; + })(self, null); + return $opal.cdecl($scope, 'Symbol', $scope.String); +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var $a, $b, TMP_4, $c, TMP_6, $d, TMP_8, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $hash2 = $opal.hash2; - def.$initialize = TMP_1 = function(parent, context) { - var $a, $b, $c, self = this, $iter = TMP_1._p, $yield = $iter || nil; - TMP_1._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, context]); - self.content_model = "compound"; - self.subs = []; - self.template_name = "block_" + (context); - self.blocks = []; - self.id = nil; - self.title = nil; - self.caption = nil; - self.style = nil; - if (context['$==']("document")) { - self.level = 0 - } else if (($a = ($b = ($c = parent['$nil?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?($c = self.context['$==']("section"), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - self.level = parent.$level() - } else { - self.level = nil - }; - self.next_section_index = 0; - return self.next_section_number = 1; - }; + ; + (function($base, $super) { + function $Encoding(){}; + var self = $Encoding = $klass($base, $super, 'Encoding', $Encoding); - def['$context='] = function(context) { - var self = this; - self.context = context; - return self.template_name = "block_" + (context); - }; + var def = self._proto, $scope = self._scope, TMP_1; - def.$render = function() { - var self = this; - self.document.$playback_attributes(self.attributes); - return self.$renderer().$render(self.template_name, self); - }; + def.ascii = def.dummy = def.name = nil; + $opal.defs(self, '$register', TMP_1 = function(name, options) { + var $a, $b, $c, TMP_2, self = this, $iter = TMP_1._p, block = $iter || nil, names = nil, encoding = nil; - def.$content = function() { - var $a, $b, TMP_2, self = this; - return ($a = ($b = self.blocks).$map, $a._p = (TMP_2 = function(b){var self = TMP_2._s || this;if (b == null) b = nil; - return b.$render()}, TMP_2._s = self, TMP_2), $a).call($b)['$*']($scope.EOL); - }; + if (options == null) { + options = $hash2([], {}) + } + TMP_1._p = null; + names = [name]['$+']((((($a = options['$[]']("aliases")) !== false && $a !== nil) ? $a : []))); + encoding = ($a = ($b = $scope.Class).$new, $a._p = block.$to_proc(), $a).call($b, self).$new(name, names, ((($a = options['$[]']("ascii")) !== false && $a !== nil) ? $a : false), ((($a = options['$[]']("dummy")) !== false && $a !== nil) ? $a : false)); + return ($a = ($c = names).$each, $a._p = (TMP_2 = function(name){var self = TMP_2._s || this; +if (name == null) name = nil; + return self.$const_set(name.$sub("-", "_"), encoding)}, TMP_2._s = self, TMP_2), $a).call($c); + }); - def['$sub?'] = function(name) { - var self = this; - return self.subs['$include?'](name); - }; + $opal.defs(self, '$find', function(name) {try { - def['$title?'] = function() { - var $a, self = this; - return ($a = self.title.$to_s()['$empty?'](), ($a === nil || $a === false)); - }; + var $a, $b, TMP_3, self = this; - def.$title = function() { - var $a, $b, self = this; - if (($a = (($b = self['subbed_title'], $b != null && $b !== nil) ? 'instance-variable' : nil)) !== false && $a !== nil) { - return self.subbed_title - } else if (($a = self.title) !== false && $a !== nil) { - return self.subbed_title = self.$apply_title_subs(self.title) + if ((($a = self['$==='](name)) !== nil && (!$a._isBoolean || $a == true))) { + return name}; + ($a = ($b = self.$constants()).$each, $a._p = (TMP_3 = function(const$){var self = TMP_3._s || this, $a, $b, encoding = nil; +if (const$ == null) const$ = nil; + encoding = self.$const_get(const$); + if ((($a = ((($b = encoding.$name()['$=='](name)) !== false && $b !== nil) ? $b : encoding.$names()['$include?'](name))) !== nil && (!$a._isBoolean || $a == true))) { + $opal.$return(encoding) } else { - return self.title - }; - }; + return nil + };}, TMP_3._s = self, TMP_3), $a).call($b); + return self.$raise($scope.ArgumentError, "unknown encoding name - " + (name)); + } catch ($returner) { if ($returner === $opal.returner) { return $returner.$v } throw $returner; } + }); - def.$captioned_title = function() { - var self = this; - return "" + (self.caption) + (self.$title()); - }; + (function(self) { + var $scope = self._scope, def = self._proto; - def['$blocks?'] = function() { - var $a, self = this; - return ($a = self.blocks['$empty?'](), ($a === nil || $a === false)); - }; + return self.$attr_accessor("default_external") + })(self.$singleton_class()); - def['$<<'] = function(block) { - var self = this; - return self.blocks['$<<'](block); - }; + self.$attr_reader("name", "names"); - def.$sections = function() { - var $a, $b, TMP_3, self = this; - return ($a = ($b = self.blocks).$inject, $a._p = (TMP_3 = function(collector, block){var self = TMP_3._s || this;if (collector == null) collector = nil;if (block == null) block = nil; - if (block.$context()['$==']("section")) { - collector['$<<'](block)}; - return collector;}, TMP_3._s = self, TMP_3), $a).call($b, []); - }; + def.$initialize = function(name, names, ascii, dummy) { + var self = this; - def.$remove_sub = function(sub) { - var self = this; - self.subs.$delete(sub); - return nil; - }; + self.name = name; + self.names = names; + self.ascii = ascii; + return self.dummy = dummy; + }; - def.$assign_caption = function(caption, key) { - var $a, $b, self = this, caption_key = nil, caption_title = nil, caption_num = nil; - if (caption == null) { - caption = nil - } - if (key == null) { - key = nil - } - if (($a = ((($b = self['$title?']()) !== false && $b !== nil) ? $b : self.caption['$nil?']())) === false || $a === nil) { - return nil}; - if (($a = caption['$nil?']()) !== false && $a !== nil) { - if (($a = self.document.$attributes()['$has_key?']("caption")) !== false && $a !== nil) { - self.caption = self.document.$attributes()['$[]']("caption") - } else if (($a = self['$title?']()) !== false && $a !== nil) { - ((($a = key) !== false && $a !== nil) ? $a : key = self.context.$to_s()); - caption_key = "" + (key) + "-caption"; - if (($a = self.document.$attributes()['$has_key?'](caption_key)) !== false && $a !== nil) { - caption_title = self.document.$attributes()['$[]']("" + (key) + "-caption"); - caption_num = self.document.$counter_increment("" + (key) + "-number", self); - self.caption = "" + (caption_title) + " " + (caption_num) + ". ";}; - } else { - self.caption = caption - } - } else { - self.caption = caption - }; - return nil; - }; + def['$ascii_compatible?'] = function() { + var self = this; - def.$assign_index = function(section) { - var $a, $b, $c, $d, self = this, appendix_number = nil, caption = nil; - section['$index='](self.next_section_index); - self.next_section_index = self.next_section_index['$+'](1); - if (section.$sectname()['$==']("appendix")) { - appendix_number = self.document.$counter("appendix-number", "A"); - if (($a = section.$numbered()) !== false && $a !== nil) { - section['$number='](appendix_number)}; - if (($a = ($b = ((caption = self.document.$attr("appendix-caption", "")))['$=='](""), ($b === nil || $b === false))) !== false && $a !== nil) { - return section['$caption=']("" + (caption) + " " + (appendix_number) + ": ") - } else { - return section['$caption=']("" + (appendix_number) + ". ") - }; - } else if (($a = section.$numbered()) !== false && $a !== nil) { - if (($a = ($b = (((($c = section.$level()['$=='](1)) !== false && $c !== nil) ? $c : ((($d = section.$level()['$=='](0)) ? section.$special() : $d)))), $b !== false && $b !== nil ?self.document.$doctype()['$==']("book") : $b)) !== false && $a !== nil) { - return section['$number='](self.document.$counter("chapter-number", 1)) - } else { - section['$number='](self.next_section_number); - return self.next_section_number = self.next_section_number['$+'](1); - } - } else { - return nil - }; - }; + return self.ascii; + }; - return (def.$reindex_sections = function() { - var $a, $b, TMP_4, self = this; - self.next_section_index = 0; - self.next_section_number = 0; - return ($a = ($b = self.blocks).$each, $a._p = (TMP_4 = function(block){var self = TMP_4._s || this;if (block == null) block = nil; - if (block.$context()['$==']("section")) { - self.$assign_index(block); - return block.$reindex_sections(); - } else { - return nil - }}, TMP_4._s = self, TMP_4), $a).call($b); - }, nil); - })(self, $scope.AbstractNode) - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + def['$dummy?'] = function() { + var self = this; - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $AttributeList(){}; - var self = $AttributeList = $klass($base, $super, 'AttributeList', $AttributeList); + return self.dummy; + }; - var def = $AttributeList._proto, $scope = $AttributeList._scope; - def.attributes = def.scanner = def.quotes = def.delimiter = def.block = def.escape_char = nil; - $opal.cdecl($scope, 'BOUNDARY_PATTERNS', $hash2(["\"", "'", ","], {"\"": /.*?[^\\](?=")/, "'": /.*?[^\\](?=')/, ",": /.*?(?=[ \t]*(,|$))/})); + def.$to_s = function() { + var self = this; - $opal.cdecl($scope, 'UNESCAPE_PATTERNS', $hash2(["\\\"", "\\'"], {"\\\"": /\\"/, "\\'": /\\'/})); + return self.name; + }; - $opal.cdecl($scope, 'SKIP_PATTERNS', $hash2(["blank", ","], {"blank": /[ \t]+/, ",": /[ \t]*(,|$)/})); + def.$inspect = function() { + var $a, self = this; - $opal.cdecl($scope, 'NAME_PATTERN', /[A-Za-z:_][A-Za-z:_\-\.]*/); + return "#"; + }; - def.$initialize = function(source, block, quotes, delimiter, escape_char) { - var $a, self = this; - if (block == null) { - block = nil - } - if (quotes == null) { - quotes = ["'", "\""] - } - if (delimiter == null) { - delimiter = "," - } - if (escape_char == null) { - escape_char = "\\" - } - self.scanner = (($a = $opal.Object._scope.StringScanner) == null ? $opal.cm('StringScanner') : $a).$new(source); - self.block = block; - self.quotes = quotes; - self.escape_char = escape_char; - self.delimiter = delimiter; - return self.attributes = nil; - }; + def.$each_byte = function() { + var self = this; - def.$parse_into = function(attributes, posattrs) { - var self = this; - if (posattrs == null) { - posattrs = [] - } - return attributes.$update(self.$parse(posattrs)); - }; + return self.$raise($scope.NotImplementedError); + }; - def.$parse = function(posattrs) { - var $a, $b, self = this, index = nil; - if (posattrs == null) { - posattrs = [] - } - if (($a = self.attributes['$nil?']()) === false || $a === nil) { - return self.attributes}; - self.attributes = $hash2([], {}); - index = 0; - while (($b = self.$parse_attribute(index, posattrs)) !== false && $b !== nil) { - if (($b = self.scanner['$eos?']()) !== false && $b !== nil) { - break;}; - self.$skip_delimiter(); - index = index['$+'](1);}; - return self.attributes; - }; + def.$getbyte = function() { + var self = this; - def.$rekey = function(posattrs) { - var self = this; - return $scope.AttributeList.$rekey(self.attributes, posattrs); - }; + return self.$raise($scope.NotImplementedError); + }; - $opal.defs(self, '$rekey', function(attributes, pos_attrs) { - var $a, $b, TMP_1, self = this; - ($a = ($b = pos_attrs).$each_with_index, $a._p = (TMP_1 = function(key, index){var self = TMP_1._s || this, $a, pos = nil, val = nil;if (key == null) key = nil;if (index == null) index = nil; - if (($a = key['$nil?']()) !== false && $a !== nil) { - return nil;}; - pos = index['$+'](1); - if (($a = ((val = attributes['$[]'](pos)))['$nil?']()) !== false && $a !== nil) { - return nil - } else { - return attributes['$[]='](key, val) - };}, TMP_1._s = self, TMP_1), $a).call($b); - return attributes; - }); + return (def.$bytesize = function() { + var self = this; - def.$parse_attribute = function(index, pos_attrs) { - var $a, $b, $c, TMP_2, $d, self = this, single_quoted_value = nil, first = nil, value = nil, name = nil, skipped = nil, c = nil, remainder = nil, resolved_name = nil, pos_name = nil, resolved_value = nil; - if (index == null) { - index = 0 + return self.$raise($scope.NotImplementedError); + }, nil) && 'bytesize'; + })(self, null); + ($a = ($b = $scope.Encoding).$register, $a._p = (TMP_4 = function(){var self = TMP_4._s || this, TMP_5; + + $opal.defn(self, '$each_byte', TMP_5 = function(string) { + var $a, self = this, $iter = TMP_5._p, block = $iter || nil; + + TMP_5._p = null; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); + + if (code <= 0x7f) { + ((($a = $opal.$yield1(block, code)) === $breaker) ? $breaker.$v : $a); } - if (pos_attrs == null) { - pos_attrs = [] + else { + var encoded = encodeURIComponent(string.charAt(i)).substr(1).split('%'); + + for (var j = 0, encoded_length = encoded.length; j < encoded_length; j++) { + ((($a = $opal.$yield1(block, parseInt(encoded[j], 16))) === $breaker) ? $breaker.$v : $a); + } } - single_quoted_value = false; - self.$skip_blank(); - first = self.scanner.$peek(1); - if (($a = self.quotes['$include?'](first)) !== false && $a !== nil) { - value = nil; - name = self.$parse_attribute_value(self.scanner.$get_byte()); - if (first['$==']("'")) { - single_quoted_value = true}; - } else { - name = self.$scan_name(); - skipped = 0; - c = nil; - if (($a = self.scanner['$eos?']()) !== false && $a !== nil) { - if (($a = name['$nil?']()) !== false && $a !== nil) { - return false} - } else { - skipped = ((($a = self.$skip_blank()) !== false && $a !== nil) ? $a : 0); - c = self.scanner.$get_byte(); - }; - if (($a = ((($b = c['$nil?']()) !== false && $b !== nil) ? $b : c['$=='](self.delimiter))) !== false && $a !== nil) { - value = nil - } else if (($a = ((($b = ($c = c['$==']("="), ($c === nil || $c === false))) !== false && $b !== nil) ? $b : name['$nil?']())) !== false && $a !== nil) { - remainder = self.$scan_to_delimiter(); - if (($a = name['$nil?']()) !== false && $a !== nil) { - name = ""}; - name = name['$+'](" "['$*'](skipped)['$+'](c)); - if (($a = remainder['$nil?']()) === false || $a === nil) { - name = name['$+'](remainder)}; - value = nil; - } else { - self.$skip_blank(); - if (self.scanner.$peek(1)['$=='](self.delimiter)) { - value = nil - } else { - c = self.scanner.$get_byte(); - if (($a = self.quotes['$include?'](c)) !== false && $a !== nil) { - value = self.$parse_attribute_value(c); - if (c['$==']("'")) { - single_quoted_value = true}; - } else if (($a = ($b = c['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - value = c['$+'](self.$scan_to_delimiter())}; - }; - }; - }; - if (($a = value['$nil?']()) !== false && $a !== nil) { - resolved_name = (function() {if (($a = (($b = single_quoted_value !== false && single_quoted_value !== nil) ? ($c = self.block['$nil?'](), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - return self.block.$apply_normal_subs(name) - } else { - return name - }; return nil; })(); - if (($a = ($b = ((pos_name = pos_attrs['$[]'](index)))['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - self.attributes['$[]='](pos_name, resolved_name)}; - self.attributes['$[]='](index['$+'](1), resolved_name); - } else { - resolved_value = value; - if (($a = ((($b = name['$==']("options")) !== false && $b !== nil) ? $b : name['$==']("opts"))) !== false && $a !== nil) { - name = "options"; - ($a = ($b = resolved_value.$split(",")).$each, $a._p = (TMP_2 = function(o){var self = TMP_2._s || this; - if (self.attributes == null) self.attributes = nil; -if (o == null) o = nil; - return self.attributes['$[]=']("" + (o.$strip()) + "-option", "")}, TMP_2._s = self, TMP_2), $a).call($b); - } else if (($a = (($c = single_quoted_value !== false && single_quoted_value !== nil) ? ($d = self.block['$nil?'](), ($d === nil || $d === false)) : $c)) !== false && $a !== nil) { - resolved_value = self.block.$apply_normal_subs(value)}; - self.attributes['$[]='](name, resolved_value); - }; - return true; - }; + } + + }); + return ($opal.defn(self, '$bytesize', function() { + var self = this; - def.$parse_attribute_value = function(quote) { - var $a, self = this, value = nil; - if (self.scanner.$peek(1)['$=='](quote)) { - self.scanner.$get_byte(); - return "";}; - value = self.$scan_to_quote(quote); - if (($a = value['$nil?']()) !== false && $a !== nil) { - return quote['$+'](self.$scan_to_delimiter()) - } else { - self.scanner.$get_byte(); - return value.$gsub($scope.UNESCAPE_PATTERNS['$[]'](self.escape_char['$+'](quote)), quote); - }; - }; + return self.$bytes().$length(); + }), nil) && 'bytesize';}, TMP_4._s = self, TMP_4), $a).call($b, "UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})); + ($a = ($c = $scope.Encoding).$register, $a._p = (TMP_6 = function(){var self = TMP_6._s || this, TMP_7; - def.$skip_blank = function() { - var self = this; - return self.scanner.$skip($scope.SKIP_PATTERNS['$[]']("blank")); - }; + $opal.defn(self, '$each_byte', TMP_7 = function(string) { + var $a, self = this, $iter = TMP_7._p, block = $iter || nil; - def.$skip_delimiter = function() { - var self = this; - return self.scanner.$skip($scope.SKIP_PATTERNS['$[]'](self.delimiter)); - }; + TMP_7._p = null; + + for (var i = 0, length = string.length; i < length; i++) { + var code = string.charCodeAt(i); - def.$scan_name = function() { - var self = this; - return self.scanner.$scan($scope.NAME_PATTERN); - }; + ((($a = $opal.$yield1(block, code & 0xff)) === $breaker) ? $breaker.$v : $a); + ((($a = $opal.$yield1(block, code >> 8)) === $breaker) ? $breaker.$v : $a); + } + + }); + return ($opal.defn(self, '$bytesize', function() { + var self = this; - def.$scan_to_delimiter = function() { - var self = this; - return self.scanner.$scan($scope.BOUNDARY_PATTERNS['$[]'](self.delimiter)); - }; + return self.$bytes().$length(); + }), nil) && 'bytesize';}, TMP_6._s = self, TMP_6), $a).call($c, "UTF-16LE"); + ($a = ($d = $scope.Encoding).$register, $a._p = (TMP_8 = function(){var self = TMP_8._s || this, TMP_9; - return (def.$scan_to_quote = function(quote) { - var self = this; - return self.scanner.$scan($scope.BOUNDARY_PATTERNS['$[]'](quote)); - }, nil); - })(self, null) + $opal.defn(self, '$each_byte', TMP_9 = function(string) { + var $a, self = this, $iter = TMP_9._p, block = $iter || nil; + + TMP_9._p = null; + + for (var i = 0, length = string.length; i < length; i++) { + ((($a = $opal.$yield1(block, string.charCodeAt(i) & 0xff)) === $breaker) ? $breaker.$v : $a); + } - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + }); + return ($opal.defn(self, '$bytesize', function() { + var self = this; - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $Block(){}; - var self = $Block = $klass($base, $super, 'Block', $Block); + return self.$bytes().$length(); + }), nil) && 'bytesize';}, TMP_8._s = self, TMP_8), $a).call($d, "ASCII-8BIT", $hash2(["aliases", "ascii"], {"aliases": ["BINARY"], "ascii": true})); + return (function($base, $super) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); - var def = $Block._proto, $scope = $Block._scope, TMP_1, TMP_2; - def.content_model = def.lines = def.subs = def.blocks = def.context = def.style = nil; - $opal.defn(self, '$blockname', def.$context); + var def = self._proto, $scope = self._scope, TMP_10; - self.$attr_accessor("lines"); + def.encoding = nil; + def.encoding = ($scope.Encoding)._scope.UTF_16LE; - def.$initialize = TMP_1 = function(parent, context, opts) { - var $a, self = this, $iter = TMP_1._p, $yield = $iter || nil, raw_source = nil; - if (opts == null) { - opts = $hash2([], {}) - } - TMP_1._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, context]); - self.content_model = ((($a = opts.$fetch("content_model", nil)) !== false && $a !== nil) ? $a : "simple"); - self.attributes = ((($a = opts.$fetch("attributes", nil)) !== false && $a !== nil) ? $a : $hash2([], {})); - if (($a = opts['$has_key?']("subs")) !== false && $a !== nil) { - self.subs = opts['$[]']("subs")}; - raw_source = ((($a = opts.$fetch("source", nil)) !== false && $a !== nil) ? $a : nil); - if (($a = raw_source['$nil?']()) !== false && $a !== nil) { - return self.lines = [] - } else if (raw_source.$class()['$==']((($a = $opal.Object._scope.String) == null ? $opal.cm('String') : $a))) { - return self.lines = $scope.Helpers.$normalize_lines_from_string(raw_source) - } else { - return self.lines = raw_source.$dup() - }; - }; + def.$bytes = function() { + var self = this; - def.$content = TMP_2 = function() {var $zuper = $slice.call(arguments, 0); - var $a, $b, $c, $d, self = this, $iter = TMP_2._p, $yield = $iter || nil, $case = nil, result = nil, first = nil, last = nil; - TMP_2._p = null; - return (function() {$case = self.content_model;if ("compound"['$===']($case)) {return $opal.find_super_dispatcher(self, 'content', TMP_2, $iter).apply(self, $zuper)}else if ("simple"['$===']($case)) {return self.$apply_subs(self.lines.$join($scope.EOL), self.subs)}else if ("verbatim"['$===']($case) || "raw"['$===']($case)) {result = self.$apply_subs(self.lines, self.subs); - if (result.$size()['$<'](2)) { - return ((($a = result.$first()) !== false && $a !== nil) ? $a : "") - } else { - while (($b = ($c = ($d = ((first = result.$first()))['$nil?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?first.$rstrip()['$empty?']() : $c)) !== false && $b !== nil) { - result.$shift()}; - while (($b = ($c = ($d = ((last = result.$last()))['$nil?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?last.$rstrip()['$empty?']() : $c)) !== false && $b !== nil) { - result.$pop()}; - return result.$join($scope.EOL); - };}else {if (($a = self.content_model['$==']("empty")) === false || $a === nil) { - self.$warn("Unknown content model '" + (self.content_model) + "' for block: " + (self.$to_s()))}; - return nil;}})(); - }; + return self.$each_byte().$to_a(); + }; - def.$source = function() { - var self = this; - return self.lines['$*']($scope.EOL); - }; + def.$bytesize = function() { + var self = this; - return (def.$to_s = function() { - var $a, self = this, content_summary = nil; - content_summary = (function() {if (self.content_model['$==']("compound")) { - return "# of blocks = " + (self.blocks.$size()) - } else { - return "# of lines = " + (self.lines.$size()) - }; return nil; })(); - return "Block[@context: :" + (self.context) + ", @content_model: :" + (self.content_model) + ", @style: " + (((($a = self.style) !== false && $a !== nil) ? $a : "nil")) + ", " + (content_summary) + "]"; - }, nil); - })(self, $scope.AbstractBlock) - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; - return (function($base) { - var self = $module($base, 'Asciidoctor'); - - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $Callouts(){}; - var self = $Callouts = $klass($base, $super, 'Callouts', $Callouts); + return self.encoding.$bytesize(self); + }; - var def = $Callouts._proto, $scope = $Callouts._scope; - def.co_index = def.lists = def.list_index = nil; - def.$initialize = function() { - var self = this; - self.lists = []; - self.list_index = 0; - return self.$next_list(); - }; + def.$each_byte = TMP_10 = function() { + var $a, $b, self = this, $iter = TMP_10._p, block = $iter || nil; - def.$register = function(li_ordinal) { - var self = this, id = nil; - self.$current_list()['$<<']($hash2(["ordinal", "id"], {"ordinal": li_ordinal.$to_i(), "id": (id = self.$generate_next_callout_id())})); - self.co_index = self.co_index['$+'](1); - return id; + TMP_10._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("each_byte") }; + ($a = ($b = self.encoding).$each_byte, $a._p = block.$to_proc(), $a).call($b, self); + return self; + }; - def.$read_next_id = function() { - var self = this, id = nil, list = nil; - id = nil; - list = self.$current_list(); - if (self.co_index['$<='](list.$size())) { - id = list['$[]'](self.co_index['$-'](1))['$[]']("id")}; - self.co_index = self.co_index['$+'](1); - return id; - }; + def.$encoding = function() { + var self = this; - def.$callout_ids = function(li_ordinal) { - var $a, $b, TMP_1, self = this; - return ($a = ($b = self.$current_list()).$inject, $a._p = (TMP_1 = function(collector, element){var self = TMP_1._s || this;if (collector == null) collector = nil;if (element == null) element = nil; - if (element['$[]']("ordinal")['$=='](li_ordinal)) { - collector['$<<'](element['$[]']("id"))}; - return collector;}, TMP_1._s = self, TMP_1), $a).call($b, [])['$*'](" "); - }; + return self.encoding; + }; - def.$current_list = function() { - var self = this; - return self.lists['$[]'](self.list_index['$-'](1)); - }; + def.$force_encoding = function(encoding) { + var self = this; - def.$next_list = function() { - var self = this; - self.list_index = self.list_index['$+'](1); - if (self.lists.$size()['$<'](self.list_index)) { - self.lists['$<<']([])}; - self.co_index = 1; - return nil; - }; + encoding = $scope.Encoding.$find(encoding); + if (encoding['$=='](self.encoding)) { + return self}; + + var result = new String(self); + result.encoding = encoding; - def.$rewind = function() { - var self = this; - self.list_index = 1; - self.co_index = 1; - return nil; - }; + return result; + + }; - def.$generate_next_callout_id = function() { - var self = this; - return self.$generate_callout_id(self.list_index, self.co_index); - }; + return (def.$getbyte = function(idx) { + var self = this; - return (def.$generate_callout_id = function(list_index, co_index) { - var self = this; - return "CO" + (list_index) + "-" + (co_index); - }, nil); - })(self, null) - - })(self) + return self.encoding.$getbyte(self, idx); + }, nil) && 'getbyte'; + })(self, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range, $gvars = $opal.gvars; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + return (function($base, $super) { + function $StringScanner(){}; + var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner); var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $Document(){}; - var self = $Document = $klass($base, $super, 'Document', $Document); - var def = $Document._proto, $scope = $Document._scope, TMP_1, TMP_9, TMP_14, TMP_15; - def.parent_document = def.safe = def.options = def.attributes = def.attribute_overrides = def.base_dir = def.extensions = def.reader = def.callouts = def.counters = def.references = def.header = def.blocks = def.attributes_modified = def.id = def.original_attributes = def.renderer = nil; - $opal.cdecl($scope, 'Footnote', $scope.Struct.$new("index", "id", "text")); + def.pos = def.string = def.working = def.prev_pos = def.matched = def.match = nil; + self.$attr_reader("pos"); - (function($base, $super) { - function $AttributeEntry(){}; - var self = $AttributeEntry = $klass($base, $super, 'AttributeEntry', $AttributeEntry); + self.$attr_reader("matched"); - var def = $AttributeEntry._proto, $scope = $AttributeEntry._scope; - self.$attr_reader("name", "value", "negate"); + def.$initialize = function(string) { + var self = this; - def.$initialize = function(name, value, negate) { - var $a, self = this; - if (negate == null) { - negate = nil - } - self.name = name; - self.value = value; - return self.negate = (function() {if (($a = negate['$nil?']()) !== false && $a !== nil) { - return value['$nil?']() - } else { - return negate - }; return nil; })(); - }; + self.string = string; + self.pos = 0; + self.matched = nil; + self.working = string; + return self.match = []; + }; - return (def.$save_to = function(block_attributes) { - var $a, $b, $c, self = this; - return (($a = "attribute_entries", $b = block_attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, []))))['$<<'](self); - }, nil); - })(self, null); + def['$bol?'] = function() { + var self = this; - self.$attr_reader("safe"); + return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n"; + }; - self.$attr_reader("references"); + def.$scan = function(regex) { + var self = this; - self.$attr_reader("counters"); + + var regex = new RegExp('^' + regex.toString().substring(1, regex.toString().length - 1)), + result = regex.exec(self.working); - self.$attr_reader("callouts"); + if (result == null) { + return self.matched = nil; + } + else if (typeof(result) === 'object') { + self.prev_pos = self.pos; + self.pos += result[0].length; + self.working = self.working.substring(result[0].length); + self.matched = result[0]; + self.match = result; - self.$attr_reader("header"); + return result[0]; + } + else if (typeof(result) === 'string') { + self.pos += result.length; + self.working = self.working.substring(result.length); - self.$attr_reader("base_dir"); + return result; + } + else { + return nil; + } + ; + }; - self.$attr_reader("parent_document"); + def['$[]'] = function(idx) { + var self = this; - self.$attr_reader("extensions"); + + var match = self.match; - def.$initialize = TMP_1 = function(data, options) { - var $a, $b, $c, TMP_2, TMP_3, $f, $g, TMP_4, $h, TMP_5, $i, TMP_6, $j, $k, TMP_7, self = this, $iter = TMP_1._p, $yield = $iter || nil, initialize_extensions = nil, safe_mode = nil, safe_mode_name = nil, now = nil; - if (data == null) { - data = [] - } - if (options == null) { - options = $hash2([], {}) - } - TMP_1._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [self, "document"]); - if (($a = options['$[]']("parent")) !== false && $a !== nil) { - self.parent_document = options.$delete("parent"); - ($a = "base_dir", $b = options, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, self.parent_document.$base_dir()))); - self.references = ($a = ($b = self.parent_document.$references()).$inject, $a._p = (TMP_2 = function(collector, $d){var self = TMP_2._s || this;if (collector == null) collector = nil;key = $d[0];ref = $d[1]; - if (key['$==']("footnotes")) { - collector['$[]=']("footnotes", []) - } else { - collector['$[]='](key, ref) - }; - return collector;}, TMP_2._s = self, TMP_2), $a).call($b, $hash2([], {})); - self.attribute_overrides = self.parent_document.$attributes().$dup(); - self.safe = self.parent_document.$safe(); - self.renderer = self.parent_document.$renderer(); - initialize_extensions = false; - self.extensions = self.parent_document.$extensions(); - } else { - self.parent_document = nil; - self.references = $hash2(["ids", "footnotes", "links", "images", "indexterms", "includes"], {"ids": $hash2([], {}), "footnotes": [], "links": [], "images": [], "indexterms": [], "includes": $scope.Set.$new()}); - self.attribute_overrides = ($a = ($c = (((($f = options['$[]']("attributes")) !== false && $f !== nil) ? $f : $hash2([], {})))).$inject, $a._p = (TMP_3 = function(collector, $e){var self = TMP_3._s || this, $a, key = nil, value = nil;if (collector == null) collector = nil;key = $e[0];value = $e[1]; - if (($a = key['$start_with?']("!")) !== false && $a !== nil) { - key = key['$[]']($range(1, -1, false)); - value = nil; - } else if (($a = key['$end_with?']("!")) !== false && $a !== nil) { - key = key['$[]']($range(0, -2, false)); - value = nil;}; - collector['$[]='](key.$downcase(), value); - return collector;}, TMP_3._s = self, TMP_3), $a).call($c, $hash2([], {})); - self.safe = nil; - self.renderer = nil; - initialize_extensions = ($a = $scope.Asciidoctor['$const_defined?']("Extensions"), $a !== false && $a !== nil ?$scope.Asciidoctor.$const_get("Extensions")['$=='](((($f = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $f))._scope.Extensions) : $a); - self.extensions = nil; - }; - self.header = nil; - self.counters = $hash2([], {}); - self.callouts = $scope.Callouts.$new(); - self.attributes_modified = $scope.Set.$new(); - self.options = options; - if (($a = self.parent_document) === false || $a === nil) { - if (($a = ($f = self.safe['$nil?'](), $f !== false && $f !== nil ?($g = (safe_mode = self.options['$[]']("safe")), ($g === nil || $g === false)) : $f)) !== false && $a !== nil) { - self.safe = ($scope.SafeMode)._scope.SECURE - } else if (($a = safe_mode['$is_a?']($scope.Fixnum)) !== false && $a !== nil) { - self.safe = safe_mode - } else { - try { - self.safe = $scope.SafeMode.$const_get(safe_mode.$to_s().$upcase()).$to_i() - } catch ($err) {if (true) { - self.safe = ($scope.SafeMode)._scope.SECURE.$to_i() - }else { throw $err; } - } - }}; - self.options['$[]=']("header_footer", self.options.$fetch("header_footer", false)); - self.attributes['$[]=']("encoding", "UTF-8"); - self.attributes['$[]=']("sectids", ""); - if (($a = self.options['$[]']("header_footer")) === false || $a === nil) { - self.attributes['$[]=']("notitle", "")}; - self.attributes['$[]=']("toc-placement", "auto"); - self.attributes['$[]=']("stylesheet", ""); - if (($a = self.options['$[]']("header_footer")) !== false && $a !== nil) { - self.attributes['$[]=']("copycss", "")}; - self.attributes['$[]=']("prewrap", ""); - self.attributes['$[]=']("attribute-undefined", $scope.Compliance.$attribute_undefined()); - self.attributes['$[]=']("attribute-missing", $scope.Compliance.$attribute_missing()); - self.attributes['$[]=']("caution-caption", "Caution"); - self.attributes['$[]=']("important-caption", "Important"); - self.attributes['$[]=']("note-caption", "Note"); - self.attributes['$[]=']("tip-caption", "Tip"); - self.attributes['$[]=']("warning-caption", "Warning"); - self.attributes['$[]=']("appendix-caption", "Appendix"); - self.attributes['$[]=']("example-caption", "Example"); - self.attributes['$[]=']("figure-caption", "Figure"); - self.attributes['$[]=']("table-caption", "Table"); - self.attributes['$[]=']("toc-title", "Table of Contents"); - self.attributes['$[]=']("manname-title", "NAME"); - self.attributes['$[]=']("untitled-label", "Untitled"); - self.attributes['$[]=']("version-label", "Version"); - self.attributes['$[]=']("last-update-label", "Last updated"); - self.attribute_overrides['$[]=']("asciidoctor", ""); - self.attribute_overrides['$[]=']("asciidoctor-version", $scope.VERSION); - safe_mode_name = ($a = ($f = $scope.SafeMode.$constants()).$detect, $a._p = (TMP_4 = function(l){var self = TMP_4._s || this; - if (self.safe == null) self.safe = nil; -if (l == null) l = nil; - return $scope.SafeMode.$const_get(l)['$=='](self.safe)}, TMP_4._s = self, TMP_4), $a).call($f).$to_s().$downcase(); - self.attribute_overrides['$[]=']("safe-mode-name", safe_mode_name); - self.attribute_overrides['$[]=']("safe-mode-" + (safe_mode_name), ""); - self.attribute_overrides['$[]=']("safe-mode-level", self.safe); - self.attribute_overrides['$[]=']("embedded", (function() {if (($a = self.options['$[]']("header_footer")) !== false && $a !== nil) { - return nil - } else { - return "" - }; return nil; })()); - ($a = "max-include-depth", $g = self.attribute_overrides, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, 64))); - if (($a = ($g = self.attribute_overrides['$[]']("allow-uri-read")['$nil?'](), ($g === nil || $g === false))) === false || $a === nil) { - self.attribute_overrides['$[]=']("allow-uri-read", nil)}; - self.attribute_overrides['$[]=']("user-home", $scope.USER_HOME); - if (($a = self.options['$[]']("base_dir")['$nil?']()) !== false && $a !== nil) { - if (($a = self.attribute_overrides['$[]']("docdir")) !== false && $a !== nil) { - self.base_dir = self.attribute_overrides['$[]=']("docdir", $scope.File.$expand_path(self.attribute_overrides['$[]']("docdir"))) - } else { - self.base_dir = self.attribute_overrides['$[]=']("docdir", $scope.File.$expand_path($scope.Dir.$pwd())) - } - } else { - self.base_dir = self.attribute_overrides['$[]=']("docdir", $scope.File.$expand_path(self.options['$[]']("base_dir"))) - }; - if (($a = self.options['$[]']("backend")['$nil?']()) === false || $a === nil) { - self.attribute_overrides['$[]=']("backend", self.options['$[]']("backend").$to_s())}; - if (($a = self.options['$[]']("doctype")['$nil?']()) === false || $a === nil) { - self.attribute_overrides['$[]=']("doctype", self.options['$[]']("doctype").$to_s())}; - if (self.safe['$>='](($scope.SafeMode)._scope.SERVER)) { - ($a = "copycss", $g = self.attribute_overrides, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, nil))); - ($a = "source-highlighter", $g = self.attribute_overrides, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, nil))); - ($a = "backend", $g = self.attribute_overrides, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, $scope.DEFAULT_BACKEND))); - if (($a = ($g = ($h = self.parent_document, ($h === nil || $h === false)), $g !== false && $g !== nil ?self.attribute_overrides['$has_key?']("docfile") : $g)) !== false && $a !== nil) { - self.attribute_overrides['$[]=']("docfile", self.attribute_overrides['$[]']("docfile")['$[]']($range((self.attribute_overrides['$[]']("docdir").$length()['$+'](1)), -1, false)))}; - self.attribute_overrides['$[]=']("docdir", ""); - self.attribute_overrides['$[]=']("user-home", "."); - if (self.safe['$>='](($scope.SafeMode)._scope.SECURE)) { - if (($a = self.attribute_overrides.$fetch("linkcss", "")['$nil?']()) === false || $a === nil) { - self.attribute_overrides['$[]=']("linkcss", "")}; - ($a = "icons", $g = self.attribute_overrides, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, nil)));};}; - ($a = ($g = self.attribute_overrides).$delete_if, $a._p = (TMP_5 = function(key, val){var self = TMP_5._s || this, $a, $b, verdict = nil; - if (self.attributes == null) self.attributes = nil; -if (key == null) key = nil;if (val == null) val = nil; - verdict = false; - if (($a = val['$nil?']()) !== false && $a !== nil) { - self.attributes.$delete(key) - } else { - if (($a = ($b = val['$is_a?']($scope.String), $b !== false && $b !== nil ?val['$end_with?']("@") : $b)) !== false && $a !== nil) { - val = val.$chop(); - verdict = true;}; - self.attributes['$[]='](key, val); - }; - return verdict;}, TMP_5._s = self, TMP_5), $a).call($g); - if (($a = ($h = self.parent_document, ($h === nil || $h === false))) !== false && $a !== nil) { - ($a = "backend", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, $scope.DEFAULT_BACKEND))); - ($a = "doctype", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, $scope.DEFAULT_DOCTYPE))); - self.$update_backend_attributes(); - now = $scope.Time.$new(); - ($a = "localdate", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, now.$strftime("%Y-%m-%d")))); - ($a = "localtime", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, now.$strftime("%H:%M:%S %Z")))); - ($a = "localdatetime", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, "" + (self.attributes['$[]']("localdate")) + " " + (self.attributes['$[]']("localtime"))))); - ($a = "docdate", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, self.attributes['$[]']("localdate")))); - ($a = "doctime", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, self.attributes['$[]']("localtime")))); - ($a = "docdatetime", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, self.attributes['$[]']("localdatetime")))); - ($a = "stylesdir", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, "."))); - ($a = "iconsdir", $h = self.attributes, ((($i = $h['$[]']($a)) !== false && $i !== nil) ? $i : $h['$[]=']($a, $scope.File.$join(self.attributes.$fetch("imagesdir", "./images"), "icons")))); - self.extensions = (function() {if (initialize_extensions !== false && initialize_extensions !== nil) { - return ($scope.Extensions)._scope.Registry.$new(self) - } else { - return nil - }; return nil; })(); - self.reader = $scope.PreprocessorReader.$new(self, data, (($scope.Asciidoctor)._scope.Reader)._scope.Cursor.$new(self.attributes['$[]']("docfile"), self.base_dir)); - if (($a = ($h = self.extensions, $h !== false && $h !== nil ?self.extensions['$preprocessors?']() : $h)) !== false && $a !== nil) { - ($a = ($h = self.extensions.$load_preprocessors(self)).$each, $a._p = (TMP_6 = function(processor){var self = TMP_6._s || this, $a; - if (self.reader == null) self.reader = nil; -if (processor == null) processor = nil; - return self.reader = ((($a = processor.$process(self.reader, self.reader.$lines())) !== false && $a !== nil) ? $a : self.reader)}, TMP_6._s = self, TMP_6), $a).call($h)}; - } else { - self.reader = $scope.Reader.$new(data, options['$[]']("cursor")) - }; - $scope.Lexer.$parse(self.reader, self, $hash2(["header_only"], {"header_only": self.options.$fetch("parse_header_only", false)})); - self.callouts.$rewind(); - if (($a = ($i = ($j = ($k = self.parent_document, ($k === nil || $k === false)), $j !== false && $j !== nil ?self.extensions : $j), $i !== false && $i !== nil ?self.extensions['$treeprocessors?']() : $i)) !== false && $a !== nil) { - return ($a = ($i = self.extensions.$load_treeprocessors(self)).$each, $a._p = (TMP_7 = function(processor){var self = TMP_7._s || this;if (processor == null) processor = nil; - return processor.$process()}, TMP_7._s = self, TMP_7), $a).call($i) - } else { - return nil - }; - }; + if (idx < 0) { + idx += match.length; + } - def.$counter = function(name, seed) { - var $a, $b, self = this; - if (seed == null) { - seed = nil - } - if (($a = ($b = self.counters['$has_key?'](name), ($b === nil || $b === false))) !== false && $a !== nil) { - if (($a = seed['$nil?']()) !== false && $a !== nil) { - seed = self.$nextval((function() {if (($a = self.attributes['$has_key?'](name)) !== false && $a !== nil) { - return self.attributes['$[]'](name) - } else { - return 0 - }; return nil; })()) - } else if (seed.$to_i().$to_s()['$=='](seed)) { - seed = seed.$to_i()}; - self.counters['$[]='](name, seed); - } else { - self.counters['$[]='](name, self.$nextval(self.counters['$[]'](name))) - }; - return (self.attributes['$[]='](name, self.counters['$[]'](name))); - }; + if (idx < 0 || idx >= match.length) { + return nil; + } - def.$counter_increment = function(counter_name, block) { - var self = this, val = nil; - val = self.$counter(counter_name); - $scope.AttributeEntry.$new(counter_name, val).$save_to(block.$attributes()); - return val; - }; + return match[idx]; + ; + }; - def.$nextval = function(current) { - var $a, $b, self = this, intval = nil; - if (($a = current['$is_a?']($scope.Integer)) !== false && $a !== nil) { - return current['$+'](1) - } else { - intval = current.$to_i(); - if (($a = ($b = intval.$to_s()['$=='](current.$to_s()), ($b === nil || $b === false))) !== false && $a !== nil) { - return (current['$[]'](0).$ord()['$+'](1)).$chr() - } else { - return intval['$+'](1) - }; - }; - }; + def.$check = function(regex) { + var self = this; - def.$register = function(type, value) { - var $a, self = this, $case = nil; - return (function() {$case = type;if ("ids"['$===']($case)) {if (($a = value['$is_a?']($scope.Array)) !== false && $a !== nil) { - return self.references['$[]']("ids")['$[]='](value['$[]'](0), (((($a = value['$[]'](1)) !== false && $a !== nil) ? $a : "["['$+'](value['$[]'](0))['$+']("]")))) - } else { - return self.references['$[]']("ids")['$[]='](value, "["['$+'](value)['$+']("]")) - }}else if ("footnotes"['$===']($case) || "indexterms"['$===']($case)) {return self.references['$[]'](type)['$<<'](value)}else {if (($a = self.options['$[]']("catalog_assets")) !== false && $a !== nil) { - return self.references['$[]'](type)['$<<'](value) - } else { - return nil - }}})(); - }; + + var regexp = new RegExp('^' + regex.toString().substring(1, regex.toString().length - 1)), + result = regexp.exec(self.working); - def['$footnotes?'] = function() { - var $a, self = this; - return ($a = self.references['$[]']("footnotes")['$empty?'](), ($a === nil || $a === false)); - }; + if (result == null) { + return self.matched = nil; + } - def.$footnotes = function() { - var self = this; - return self.references['$[]']("footnotes"); - }; + return self.matched = result[0]; + ; + }; - def['$nested?'] = function() { - var $a, self = this; - if (($a = self.parent_document) !== false && $a !== nil) { - return true - } else { - return false - }; - }; + def.$peek = function(length) { + var self = this; - def['$embedded?'] = function() { - var self = this; - return self.attributes['$has_key?']("embedded"); - }; + return self.working.substring(0, length); + }; - def['$extensions?'] = function() { - var $a, self = this; - if (($a = self.extensions) !== false && $a !== nil) { - return true - } else { - return false - }; - }; + def['$eos?'] = function() { + var self = this; - def.$source = function() { - var $a, self = this; - if (($a = self.reader) !== false && $a !== nil) { - return self.reader.$source() - } else { - return nil - }; - }; + return self.working.length === 0; + }; - def.$source_lines = function() { - var $a, self = this; - if (($a = self.reader) !== false && $a !== nil) { - return self.reader.$source_lines() - } else { - return nil - }; - }; + def.$skip = function(re) { + var self = this; - def.$doctype = function() { - var self = this; - return self.attributes['$[]']("doctype"); - }; + + re = new RegExp('^' + re.source) + var result = re.exec(self.working); - def.$backend = function() { - var self = this; - return self.attributes['$[]']("backend"); - }; + if (result == null) { + return self.matched = nil; + } + else { + var match_str = result[0]; + var match_len = match_str.length; + self.matched = match_str; + self.prev_pos = self.pos; + self.pos += match_len; + self.working = self.working.substring(match_len); + return match_len; + } + ; + }; - def['$basebackend?'] = function(base) { - var self = this; - return self.attributes['$[]']("basebackend")['$=='](base); - }; + def.$get_byte = function() { + var self = this; - def.$title = function() { - var self = this; - return self.attributes['$[]']("title"); - }; + + var result = nil; + if (self.pos < self.string.length) { + self.prev_pos = self.pos; + self.pos += 1; + result = self.matched = self.working.substring(0, 1); + self.working = self.working.substring(1); + } + else { + self.matched = nil; + } - def['$title='] = function(title) { - var $a, self = this; - ((($a = self.header) !== false && $a !== nil) ? $a : self.header = $scope.Section.$new(self, 0)); - return self.header['$title='](title); - }; + return result; + ; + }; - def.$doctitle = function(opts) { - var $a, $b, $c, self = this, val = nil, sect = nil; - if (opts == null) { - opts = $hash2([], {}) - } - if (($a = ($b = ((val = self.attributes.$fetch("title", "")))['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - val = self.$title() - } else if (($a = ($b = ($c = ((sect = self.$first_section()))['$nil?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?sect['$title?']() : $b)) !== false && $a !== nil) { - val = sect.$title() - } else { - return nil - }; - if (($a = ($b = opts['$[]']("sanitize"), $b !== false && $b !== nil ?val['$include?']("<") : $b)) !== false && $a !== nil) { - return val.$gsub(/<[^>]+>/, "").$tr_s(" ", " ").$strip() + $opal.defn(self, '$getch', def.$get_byte); + + def['$pos='] = function(pos) { + var self = this; + + + if (pos < 0) { + pos += self.string.$length(); + } + ; + self.pos = pos; + return self.working = self.string.slice(pos); + }; + + def.$rest = function() { + var self = this; + + return self.working; + }; + + def.$terminate = function() { + var self = this; + + self.match = nil; + return self['$pos='](self.string.$length()); + }; + + return (def.$unscan = function() { + var self = this; + + self.pos = self.prev_pos; + self.prev_pos = nil; + self.match = nil; + return self; + }, nil) && 'unscan'; + })(self, null) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; + + return (function($base) { + var self = $module($base, 'Comparable'); + + var def = self._proto, $scope = self._scope; + + def['$=='] = function(other) { + var $a, self = this, cmp = nil; + + try { + if ((($a = self['$equal?'](other)) !== nil && (!$a._isBoolean || $a == true))) { + return true}; + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { } else { - return val + return false }; + return cmp == 0; + } catch ($err) {if ($opal.$rescue($err, [$scope.StandardError])) { + return false + }else { throw $err; } }; + }; - $opal.defn(self, '$name', def.$doctitle); + def['$>'] = function(other) { + var $a, self = this, cmp = nil; - def.$author = function() { - var self = this; - return self.attributes['$[]']("author"); + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") }; + return cmp > 0; + }; - def.$revdate = function() { - var self = this; - return self.attributes['$[]']("revdate"); - }; + def['$>='] = function(other) { + var $a, self = this, cmp = nil; - def.$notitle = function() { - var $a, $b, self = this; - return ($a = ($b = self.attributes['$has_key?']("showtitle"), ($b === nil || $b === false)), $a !== false && $a !== nil ?self.attributes['$has_key?']("notitle") : $a); + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") }; + return cmp >= 0; + }; - def.$noheader = function() { - var self = this; - return self.attributes['$has_key?']("noheader"); - }; + def['$<'] = function(other) { + var $a, self = this, cmp = nil; - def.$nofooter = function() { - var self = this; - return self.attributes['$has_key?']("nofooter"); + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") }; + return cmp < 0; + }; - def.$first_section = function() { - var $a, $b, TMP_8, $c, self = this; - if (($a = self['$has_header?']()) !== false && $a !== nil) { - return self.header - } else { - return ($a = ($b = (((($c = self.blocks) !== false && $c !== nil) ? $c : []))).$detect, $a._p = (TMP_8 = function(e){var self = TMP_8._s || this;if (e == null) e = nil; - return e.$context()['$==']("section")}, TMP_8._s = self, TMP_8), $a).call($b) - }; - }; + def['$<='] = function(other) { + var $a, self = this, cmp = nil; - def['$has_header?'] = function() { - var $a, self = this; - if (($a = self.header) !== false && $a !== nil) { - return true - } else { - return false - }; + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") }; + return cmp <= 0; + }; + ;$opal.donate(self, ["$==", "$>", "$>=", "$<", "$<="]); + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; - def['$<<'] = TMP_9 = function(block) {var $zuper = $slice.call(arguments, 0); - var self = this, $iter = TMP_9._p, $yield = $iter || nil; - TMP_9._p = null; - $opal.find_super_dispatcher(self, '<<', TMP_9, $iter).apply(self, $zuper); - if (block.$context()['$==']("section")) { - return self.$assign_index(block) - } else { - return nil - }; - }; + return (function($base, $super) { + function $Dir(){}; + var self = $Dir = $klass($base, $super, 'Dir', $Dir); - def.$finalize_header = function(unrooted_attributes, header_valid) { - var $a, self = this; - if (header_valid == null) { - header_valid = true - } - self.$clear_playback_attributes(unrooted_attributes); - self.$save_attributes(); - if (($a = header_valid) === false || $a === nil) { - unrooted_attributes['$[]=']("invalid-header", true)}; - return unrooted_attributes; - }; + var def = self._proto, $scope = self._scope; - def.$save_attributes = function() { - var $a, $b, $c, $d, $e, TMP_10, TMP_11, self = this, val = nil, toc_val = nil, toc2_val = nil, toc_position_val = nil, default_toc_position = nil, default_toc_class = nil, position = nil, $case = nil; - if (self.attributes['$[]']("basebackend")['$==']("docbook")) { - if (($a = ((($b = self['$attribute_locked?']("toc")) !== false && $b !== nil) ? $b : self.attributes_modified['$include?']("toc"))) === false || $a === nil) { - self.attributes['$[]=']("toc", "")}; - if (($a = ((($b = self['$attribute_locked?']("numbered")) !== false && $b !== nil) ? $b : self.attributes_modified['$include?']("numbered"))) === false || $a === nil) { - self.attributes['$[]=']("numbered", "")};}; - if (($a = ((($b = self.attributes['$has_key?']("doctitle")) !== false && $b !== nil) ? $b : ((val = self.$doctitle()))['$nil?']())) === false || $a === nil) { - self.attributes['$[]=']("doctitle", val)}; - if (($a = ($b = ($c = self.id, ($c === nil || $c === false)), $b !== false && $b !== nil ?self.attributes['$has_key?']("css-signature") : $b)) !== false && $a !== nil) { - self.id = self.attributes['$[]']("css-signature")}; - toc_val = self.attributes['$[]']("toc"); - toc2_val = self.attributes['$[]']("toc2"); - toc_position_val = self.attributes['$[]']("toc-position"); - if (($a = ((($b = (($c = ($d = toc_val['$nil?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?(((($d = ($e = toc_val['$=='](""), ($e === nil || $e === false))) !== false && $d !== nil) ? $d : ($e = toc_position_val.$to_s()['$=='](""), ($e === nil || $e === false)))) : $c))) !== false && $b !== nil) ? $b : ($c = toc2_val['$nil?'](), ($c === nil || $c === false)))) !== false && $a !== nil) { - default_toc_position = "left"; - default_toc_class = "toc2"; - position = ($a = ($b = [toc_position_val, toc2_val, toc_val]).$find, $a._p = (TMP_10 = function(pos){var self = TMP_10._s || this, $a;if (pos == null) pos = nil; - return ($a = pos.$to_s()['$=='](""), ($a === nil || $a === false))}, TMP_10._s = self, TMP_10), $a).call($b); - if (($a = ($c = ($d = position, ($d === nil || $d === false)), $c !== false && $c !== nil ?($d = toc2_val['$nil?'](), ($d === nil || $d === false)) : $c)) !== false && $a !== nil) { - position = default_toc_position}; - self.attributes['$[]=']("toc", ""); - $case = position;if ("left"['$===']($case) || "<"['$===']($case) || "<"['$===']($case)) {self.attributes['$[]=']("toc-position", "left")}else if ("right"['$===']($case) || ">"['$===']($case) || ">"['$===']($case)) {self.attributes['$[]=']("toc-position", "right")}else if ("top"['$===']($case) || "^"['$===']($case)) {self.attributes['$[]=']("toc-position", "top")}else if ("bottom"['$===']($case) || "v"['$===']($case)) {self.attributes['$[]=']("toc-position", "bottom")}else if ("center"['$===']($case)) {self.attributes.$delete("toc2"); - default_toc_class = nil; - default_toc_position = "center";}; - if (default_toc_class !== false && default_toc_class !== nil) { - ($a = "toc-class", $c = self.attributes, ((($d = $c['$[]']($a)) !== false && $d !== nil) ? $d : $c['$[]=']($a, default_toc_class)))}; - if (default_toc_position !== false && default_toc_position !== nil) { - ($a = "toc-position", $c = self.attributes, ((($d = $c['$[]']($a)) !== false && $d !== nil) ? $d : $c['$[]=']($a, default_toc_position)))};}; - self.original_attributes = self.attributes.$dup(); - if (($a = self['$nested?']()) !== false && $a !== nil) { - return nil - } else { - return ($a = ($c = $scope.FLEXIBLE_ATTRIBUTES).$each, $a._p = (TMP_11 = function(name){var self = TMP_11._s || this, $a, $b, $c; - if (self.attribute_overrides == null) self.attribute_overrides = nil; -if (name == null) name = nil; - if (($a = ($b = self.attribute_overrides['$has_key?'](name), $b !== false && $b !== nil ?($c = self.attribute_overrides['$[]'](name)['$nil?'](), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - return self.attribute_overrides.$delete(name) - } else { - return nil - }}, TMP_11._s = self, TMP_11), $a).call($c) - }; - }; + $opal.defs(self, '$pwd', function() { + var $a, self = this; - def.$restore_attributes = function() { - var self = this; - return self.attributes = self.original_attributes; - }; + return ((($a = $scope.ENV['$[]']("PWD")) !== false && $a !== nil) ? $a : "."); + }); - def.$clear_playback_attributes = function(attributes) { - var self = this; - return attributes.$delete("attribute_entries"); - }; + $opal.defs(self, '$getwd', function() { + var $a, self = this; - def.$playback_attributes = function(block_attributes) { - var $a, $b, TMP_12, self = this; - if (($a = block_attributes['$has_key?']("attribute_entries")) !== false && $a !== nil) { - return ($a = ($b = block_attributes['$[]']("attribute_entries")).$each, $a._p = (TMP_12 = function(entry){var self = TMP_12._s || this, $a; - if (self.attributes == null) self.attributes = nil; -if (entry == null) entry = nil; - if (($a = entry.$negate()) !== false && $a !== nil) { - return self.attributes.$delete(entry.$name()) - } else { - return self.attributes['$[]='](entry.$name(), entry.$value()) - }}, TMP_12._s = self, TMP_12), $a).call($b) - } else { - return nil - }; - }; + return ((($a = $scope.ENV['$[]']("PWD")) !== false && $a !== nil) ? $a : "."); + }); - def.$set_attribute = function(name, value) { - var $a, self = this; - if (($a = self['$attribute_locked?'](name)) !== false && $a !== nil) { - return false - } else { - self.attributes['$[]='](name, self.$apply_attribute_value_subs(value)); - self.attributes_modified['$<<'](name); - if (name['$==']("backend")) { - self.$update_backend_attributes()}; - return true; - }; - }; + return ($opal.defs(self, '$home', function() { + var self = this; - def.$delete_attribute = function(name) { - var $a, self = this; - if (($a = self['$attribute_locked?'](name)) !== false && $a !== nil) { - return false - } else { - self.attributes.$delete(name); - self.attributes_modified['$<<'](name); - return true; - }; - }; + return $scope.ENV['$[]']("HOME"); + }), nil) && 'home'; + })(self, null) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; - def['$attribute_locked?'] = function(name) { - var self = this; - return self.attribute_overrides['$has_key?'](name); + return (function($base, $super) { + function $SecurityError(){}; + var self = $SecurityError = $klass($base, $super, 'SecurityError', $SecurityError); + + var def = self._proto, $scope = self._scope; + + return nil; + })(self, $scope.Exception) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $gvars = $opal.gvars, $range = $opal.range; + + (function($base, $super) { + function $Kernel(){}; + var self = $Kernel = $klass($base, $super, 'Kernel', $Kernel); + + var def = self._proto, $scope = self._scope, TMP_1; + + return (def.$open = TMP_1 = function(path, rest) { + var $a, $b, self = this, $iter = TMP_1._p, $yield = $iter || nil, file = nil; + + rest = $slice.call(arguments, 1); + TMP_1._p = null; + file = ($a = $scope.File).$new.apply($a, [path].concat(rest)); + if (($yield !== nil)) { + return $b = $opal.$yield1($yield, file), $b === $breaker ? $b : $b + } else { + return file }; + }, nil) && 'open' + })(self, null); + return (function($base, $super) { + function $File(){}; + var self = $File = $klass($base, $super, 'File', $File); - def.$apply_attribute_value_subs = function(value) { - var $a, $b, self = this, m = nil, subs = nil; - if (($a = value.$match($scope.REGEXP['$[]']("pass_macro_basic"))) !== false && $a !== nil) { - m = $gvars["~"]; - if (($a = ($b = m['$[]'](1)['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - subs = self.$resolve_pass_subs(m['$[]'](1)); - if (($a = subs['$empty?']()) !== false && $a !== nil) { - return m['$[]'](2) - } else { - return self.$apply_subs(m['$[]'](2), subs) - }; - } else { - return m['$[]'](2) - }; - } else { - return self.$apply_header_subs(value) - }; + var def = self._proto, $scope = self._scope, TMP_2; + + def.eof = def.path = nil; + $opal.cdecl($scope, 'SEPARATOR', "/"); + + $opal.cdecl($scope, 'ALT_SEPARATOR', nil); + + self.$attr_reader("eof"); + + self.$attr_reader("lineno"); + + self.$attr_reader("path"); + + def.$initialize = function(path, mode) { + var self = this; + + if (mode == null) { + mode = "r" + } + self.path = path; + self.contents = nil; + self.eof = false; + return self.lineno = 0; + }; + + def.$read = function() { + var $a, self = this, res = nil; + + if ((($a = self.eof) !== nil && (!$a._isBoolean || $a == true))) { + return "" + } else { + res = $scope.File.$read(self.path); + self.eof = true; + self.lineno = res.$size(); + return res; }; + }; - def.$update_backend_attributes = function() { - var $a, self = this, backend = nil, basebackend = nil, page_width = nil, ext = nil, file_type = nil; - backend = self.attributes['$[]']("backend"); - if (($a = backend['$start_with?']("xhtml")) !== false && $a !== nil) { - self.attributes['$[]=']("htmlsyntax", "xml"); - backend = self.attributes['$[]=']("backend", backend['$[]']($range(1, -1, false))); - } else if (($a = backend['$start_with?']("html")) !== false && $a !== nil) { - self.attributes['$[]=']("htmlsyntax", "html")}; - if (($a = $scope.BACKEND_ALIASES['$has_key?'](backend)) !== false && $a !== nil) { - backend = self.attributes['$[]=']("backend", $scope.BACKEND_ALIASES['$[]'](backend))}; - basebackend = backend.$sub($scope.REGEXP['$[]']("trailing_digit"), ""); - page_width = $scope.DEFAULT_PAGE_WIDTHS['$[]'](basebackend); - if (page_width !== false && page_width !== nil) { - self.attributes['$[]=']("pagewidth", page_width) - } else { - self.attributes.$delete("pagewidth") - }; - self.attributes['$[]=']("backend-" + (backend), ""); - self.attributes['$[]=']("basebackend", basebackend); - self.attributes['$[]=']("basebackend-" + (basebackend), ""); - self.attributes['$[]=']("" + (backend) + "-" + (self.attributes['$[]']("doctype")), ""); - self.attributes['$[]=']("" + (basebackend) + "-" + (self.attributes['$[]']("doctype")), ""); - ext = ((($a = $scope.DEFAULT_EXTENSIONS['$[]'](basebackend)) !== false && $a !== nil) ? $a : ".html"); - self.attributes['$[]=']("outfilesuffix", ext); - file_type = ext['$[]']($range(1, -1, false)); - self.attributes['$[]=']("filetype", file_type); - return self.attributes['$[]=']("filetype-" + (file_type), ""); - }; - - def.$renderer = function(opts) { - var $a, self = this, render_options = nil; - if (opts == null) { - opts = $hash2([], {}) - } - if (($a = self.renderer) !== false && $a !== nil) { - return self.renderer}; - render_options = $hash2([], {}); - if (($a = self.options['$has_key?']("template_dir")) !== false && $a !== nil) { - render_options['$[]=']("template_dirs", [self.options['$[]']("template_dir")]) - } else if (($a = self.options['$has_key?']("template_dirs")) !== false && $a !== nil) { - render_options['$[]=']("template_dirs", self.options['$[]']("template_dirs"))}; - render_options['$[]=']("template_cache", self.options.$fetch("template_cache", true)); - render_options['$[]=']("backend", self.attributes.$fetch("backend", "html5")); - render_options['$[]=']("htmlsyntax", self.attributes['$[]']("htmlsyntax")); - render_options['$[]=']("template_engine", self.options['$[]']("template_engine")); - render_options['$[]=']("eruby", self.options.$fetch("eruby", "erb")); - render_options['$[]=']("compact", self.options.$fetch("compact", false)); - render_options['$merge!'](opts); - return self.renderer = $scope.Renderer.$new(render_options); - }; - - def.$render = function(opts) { - var $a, $b, $c, TMP_13, self = this, r = nil, block = nil, output = nil; - if (opts == null) { - opts = $hash2([], {}) - } - self.$restore_attributes(); - r = self.$renderer(opts); - if (self.$doctype()['$==']("inline")) { - if (($a = ($b = ($c = ((block = self.blocks.$first()))['$nil?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?($c = block.$content_model()['$==']("compound"), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - output = block.$content() - } else { - output = "" + def.$each_line = TMP_2 = function(separator) { + var $a, self = this, $iter = TMP_2._p, block = $iter || nil, lines = nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + + if (separator == null) { + separator = $gvars["/"] + } + TMP_2._p = null; + if ((($a = self.eof) !== nil && (!$a._isBoolean || $a == true))) { + return (function() {if ((block !== nil)) { + return self + } else { + return [].$to_enum() + }; return nil; })()}; + if ((block !== nil)) { + lines = $scope.File.$read(self.path); + + self.eof = false; + self.lineno = 0; + var chomped = lines.$chomp(), + trailing = lines.length != chomped.length, + splitted = chomped.split(separator); + + for (var i = 0, length = splitted.length; i < length; i++) { + self.lineno += 1; + if (i < length - 1 || trailing) { + ((($a = $opal.$yield1(block, splitted[i] + separator)) === $breaker) ? $breaker.$v : $a); } - } else { - output = (function() {if (($a = self.options.$merge(opts)['$[]']("header_footer")) !== false && $a !== nil) { - return r.$render("document", self).$strip() - } else { - return r.$render("embedded", self) - }; return nil; })() - }; - if (($a = ($b = ($c = self.parent_document, ($c === nil || $c === false)), $b !== false && $b !== nil ?self.extensions : $b)) !== false && $a !== nil) { - if (($a = self.extensions['$postprocessors?']()) !== false && $a !== nil) { - ($a = ($b = self.extensions.$load_postprocessors(self)).$each, $a._p = (TMP_13 = function(processor){var self = TMP_13._s || this;if (processor == null) processor = nil; - return output = processor.$process(output)}, TMP_13._s = self, TMP_13), $a).call($b)}; - self.extensions.$reset();}; - return output; + else { + ((($a = $opal.$yield1(block, splitted[i])) === $breaker) ? $breaker.$v : $a); + } + } + self.eof = true; + + return self; + } else { + return self.$read().$each_line() }; + }; - def.$content = TMP_14 = function() {var $zuper = $slice.call(arguments, 0); - var self = this, $iter = TMP_14._p, $yield = $iter || nil; - TMP_14._p = null; - self.attributes.$delete("title"); - return $opal.find_super_dispatcher(self, 'content', TMP_14, $iter).apply(self, $zuper); + $opal.defs(self, '$expand_path', function(path) { + var self = this; + + return path; + }); + + $opal.defs(self, '$join', function(paths) { + var self = this; + + paths = $slice.call(arguments, 0); + return paths['$*']($scope.SEPARATOR); + }); + + $opal.defs(self, '$basename', function(path) { + var $a, self = this, offset = nil; + + if ((($a = (offset = path.$rindex($scope.SEPARATOR))) !== nil && (!$a._isBoolean || $a == true))) { + return path['$[]']($range((offset['$+'](1)), -1, false)) + } else { + return path }; + }); - def.$docinfo = function(pos, ext) { - var $a, $b, $c, self = this, $case = nil, qualifier = nil, content = nil, docinfo = nil, docinfo1 = nil, docinfo2 = nil, docinfo_filename = nil, docinfo_path = nil, content2 = nil; - if (pos == null) { - pos = "header" - } - if (ext == null) { - ext = nil - } - if (self.$safe()['$>='](($scope.SafeMode)._scope.SECURE)) { - return "" - } else { - $case = pos;if ("footer"['$===']($case)) {qualifier = "-footer"}else {qualifier = nil}; - if (($a = ext['$nil?']()) !== false && $a !== nil) { - ext = self.attributes['$[]']("outfilesuffix")}; - content = nil; - docinfo = self.attributes['$has_key?']("docinfo"); - docinfo1 = self.attributes['$has_key?']("docinfo1"); - docinfo2 = self.attributes['$has_key?']("docinfo2"); - docinfo_filename = "docinfo" + (qualifier) + (ext); - if (($a = ((($b = docinfo1) !== false && $b !== nil) ? $b : docinfo2)) !== false && $a !== nil) { - docinfo_path = self.$normalize_system_path(docinfo_filename); - content = self.$read_asset(docinfo_path); - if (($a = content['$nil?']()) === false || $a === nil) { - if (($a = $scope.FORCE_ENCODING) !== false && $a !== nil) { - content.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8)}; - content = self.$sub_attributes(content.$split($scope.LINE_SPLIT))['$*']($scope.EOL);};}; - if (($a = ($b = (((($c = docinfo) !== false && $c !== nil) ? $c : docinfo2)), $b !== false && $b !== nil ?self.attributes['$has_key?']("docname") : $b)) !== false && $a !== nil) { - docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_filename)); - content2 = self.$read_asset(docinfo_path); - if (($a = content2['$nil?']()) === false || $a === nil) { - if (($a = $scope.FORCE_ENCODING) !== false && $a !== nil) { - content2.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8)}; - content2 = self.$sub_attributes(content2.$split($scope.LINE_SPLIT))['$*']($scope.EOL); - content = (function() {if (($a = content['$nil?']()) !== false && $a !== nil) { - return content2 - } else { - return "" + (content) + ($scope.EOL) + (content2) - }; return nil; })();};}; - return content.$to_s(); - }; + $opal.defs(self, '$dirname', function(path) { + var $a, self = this, offset = nil; + + if ((($a = (offset = path.$rindex($scope.SEPARATOR))) !== nil && (!$a._isBoolean || $a == true))) { + return path['$[]']($range(0, (offset['$-'](1)), false)) + } else { + return "." }; + }); - return (def.$to_s = TMP_15 = function() {var $zuper = $slice.call(arguments, 0); - var self = this, $iter = TMP_15._p, $yield = $iter || nil; - TMP_15._p = null; - return "" + ($opal.find_super_dispatcher(self, 'to_s', TMP_15, $iter).apply(self, $zuper).$to_s()) + " - " + (self.$doctitle()); - }, nil); - })(self, $scope.AbstractBlock) + $opal.defs(self, '$extname', function(path) { + var $a, self = this, last_dot_idx = nil; + + if ((($a = path['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return ""}; + last_dot_idx = path['$[]']($range(1, -1, false)).$rindex("."); + if ((($a = last_dot_idx['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "" + } else { + return path['$[]']($range((last_dot_idx['$+'](1)), -1, false)) + }; + }); + + $opal.defs(self, '$file?', function(path) { + var self = this; + + return true; + }); + + return ($opal.defs(self, '$read', function(path) { + var self = this; + + + var data = '' + var status = -1; + try { + var xhr = new XMLHttpRequest(); + xhr.open('GET', path, false); + xhr.addEventListener('load', function() { + status = this.status; + // status is 0 for local file mode (i.e., file://) + if (status == 0 || status == 200) { + data = this.responseText; + } + }); + xhr.overrideMimeType('text/plain'); + xhr.send(); + } + catch (e) { + status = 0; + } + // assume that no data in local file mode means it doesn't exist + if (status == 404 || (status == 0 && data == '')) { + throw $scope.IOError.$new('No such file or directory: ' + path); + } - })(self) + return data; + }), nil) && 'read'; + })(self, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; + + ; + ; + ; + return true; +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; + return (function($base) { var self = $module($base, 'Asciidoctor'); var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $Inline(){}; - var self = $Inline = $klass($base, $super, 'Inline', $Inline); - var def = $Inline._proto, $scope = $Inline._scope, TMP_1; - def.template_name = nil; - self.$attr_accessor("template_name"); + (function($base) { + var self = $module($base, 'Debug'); - self.$attr_reader("text"); + var def = self._proto, $scope = self._scope, TMP_1; - self.$attr_reader("type"); + self.show_debug = nil; - self.$attr_accessor("target"); + $opal.defs(self, '$debug', TMP_1 = function() { + var $a, self = this, $iter = TMP_1._p, $yield = $iter || nil; - def.$initialize = TMP_1 = function(parent, context, text, opts) { - var $a, $b, self = this, $iter = TMP_1._p, $yield = $iter || nil, attributes = nil; - if (text == null) { - text = nil - } - if (opts == null) { - opts = $hash2([], {}) - } TMP_1._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, context]); - self.template_name = "inline_" + (context); - self.text = text; - self.id = opts['$[]']("id"); - self.type = opts['$[]']("type"); - self.target = opts['$[]']("target"); - if (($a = ($b = opts['$has_key?']("attributes"), $b !== false && $b !== nil ?((attributes = opts['$[]']("attributes")))['$is_a?']($scope.Hash) : $b)) !== false && $a !== nil) { - if (($a = attributes['$empty?']()) !== false && $a !== nil) { - return nil - } else { - return self.$update_attributes(opts['$[]']("attributes")) - } + if ((($a = self['$show_debug_output?']()) !== nil && (!$a._isBoolean || $a == true))) { + return self.$warn(((($a = $opal.$yieldX($yield, [])) === $breaker) ? $breaker.$v : $a)) } else { return nil }; - }; + }); - return (def.$render = function() { + $opal.defs(self, '$set_debug', function(value) { var self = this; - return self.$renderer().$render(self.template_name, self).$chomp(); - }, nil); - })(self, $scope.AbstractNode) + + return self.show_debug = value; + }); + + $opal.defs(self, '$show_debug_output?', function() { + var $a, $b, self = this; + if (self.show_debug == null) self.show_debug = nil; + + return ((($a = self.show_debug) !== false && $a !== nil) ? $a : ((($b = $scope.ENV['$[]']("DEBUG")['$==']("true")) ? $scope.ENV['$[]']("SUPPRESS_DEBUG")['$==']("true")['$!']() : $b))); + }); + + $opal.defs(self, '$puts_indented', function(level, args) { + var $a, $b, TMP_2, self = this, indentation = nil; + + args = $slice.call(arguments, 1); + indentation = " "['$*'](level)['$*'](2); + return ($a = ($b = args).$each, $a._p = (TMP_2 = function(arg){var self = TMP_2._s || this, $a, $b, TMP_3; +if (arg == null) arg = nil; + return ($a = ($b = self).$debug, $a._p = (TMP_3 = function(){var self = TMP_3._s || this; + + return "" + (indentation) + (arg)}, TMP_3._s = self, TMP_3), $a).call($b)}, TMP_2._s = self, TMP_2), $a).call($b); + }); + + })(self) })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range, $gvars = $opal.gvars; + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + $opal.cdecl($scope, 'VERSION', "1.5.0-preview.7") + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $gvars = $opal.gvars; + return (function($base) { var self = $module($base, 'Asciidoctor'); var def = self._proto, $scope = self._scope; + (function($base, $super) { - function $Lexer(){}; - var self = $Lexer = $klass($base, $super, 'Lexer', $Lexer); + function $Timings(){}; + var self = $Timings = $klass($base, $super, 'Timings', $Timings); - var def = $Lexer._proto, $scope = $Lexer._scope; - $opal.cdecl($scope, 'BlockMatchData', $scope.Struct.$new("context", "masq", "tip", "terminator")); + var def = self._proto, $scope = self._scope; + def.timers = def.log = nil; def.$initialize = function() { var self = this; - return self.$raise("Au contraire, mon frere. No lexer instances will be running around."); + + self.log = $hash2([], {}); + return self.timers = $hash2([], {}); }; - $opal.defs(self, '$parse', function(reader, document, options) { - var $a, $b, self = this, block_attributes = nil, new_section = nil; - if (options == null) { - options = $hash2([], {}) - } - block_attributes = self.$parse_document_header(reader, document); - if (($a = options['$[]']("header_only")) === false || $a === nil) { - while (($b = reader['$has_more_lines?']()) !== false && $b !== nil) { - $b = $opal.to_ary(self.$next_section(reader, document, block_attributes)), new_section = ($b[0] == null ? nil : $b[0]), block_attributes = ($b[1] == null ? nil : $b[1]); - if (($b = new_section['$nil?']()) === false || $b === nil) { - document['$<<'](new_section)};}}; - return document; - }); + def.$start = function(key) { + var $a, self = this; - $opal.defs(self, '$parse_document_header', function(reader, document) { - var $a, $b, $c, self = this, block_attributes = nil, assigned_doctitle = nil, val = nil, section_title = nil, _ = nil, doctitle = nil; - block_attributes = self.$parse_block_metadata_lines(reader, document); - if (($a = block_attributes['$has_key?']("title")) !== false && $a !== nil) { - return document.$finalize_header(block_attributes, false)}; - assigned_doctitle = nil; - if (($a = ((val = document.$attributes().$fetch("doctitle", "")))['$empty?']()) === false || $a === nil) { - document['$title='](val); - assigned_doctitle = val;}; - section_title = nil; - if (($a = self['$is_next_line_document_title?'](reader, block_attributes)) !== false && $a !== nil) { - $a = $opal.to_ary(self.$parse_section_title(reader, document)), document['$id='](($a[0] == null ? nil : $a[0])), _ = ($a[1] == null ? nil : $a[1]), doctitle = ($a[2] == null ? nil : $a[2]), _ = ($a[3] == null ? nil : $a[3]), _ = ($a[4] == null ? nil : $a[4]); - if (($a = assigned_doctitle) === false || $a === nil) { - document['$title='](doctitle); - assigned_doctitle = doctitle;}; - document.$attributes()['$[]=']("doctitle", section_title = doctitle); - if (($a = ($b = document.$id()['$nil?'](), $b !== false && $b !== nil ?block_attributes['$has_key?']("id") : $b)) !== false && $a !== nil) { - document['$id='](block_attributes.$delete("id"))}; - self.$parse_header_metadata(reader, document);}; - if (($a = ($b = ($c = ((val = document.$attributes().$fetch("doctitle", "")))['$empty?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?($c = val['$=='](section_title), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - document['$title='](val); - assigned_doctitle = val;}; - if (assigned_doctitle !== false && assigned_doctitle !== nil) { - document.$attributes()['$[]=']("doctitle", assigned_doctitle)}; - if (document.$doctype()['$==']("manpage")) { - self.$parse_manpage_header(reader, document)}; - return document.$finalize_header(block_attributes); - }); + return self.timers['$[]='](key, (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now()); + }; - $opal.defs(self, '$parse_manpage_header', function(reader, document) { - var $a, self = this, m = nil, name_section = nil, name_section_buffer = nil; - if (($a = (m = document.$attributes()['$[]']("doctitle").$match($scope.REGEXP['$[]']("mantitle_manvolnum")))) !== false && $a !== nil) { - document.$attributes()['$[]=']("mantitle", document.$sub_attributes(m['$[]'](1).$rstrip().$downcase())); - document.$attributes()['$[]=']("manvolnum", m['$[]'](2).$strip()); - } else { - self.$warn("asciidoctor: ERROR: " + (reader.$prev_line_info()) + ": malformed manpage title") - }; - reader.$skip_blank_lines(); - if (($a = self['$is_next_line_section?'](reader, $hash2([], {}))) !== false && $a !== nil) { - name_section = self.$initialize_section(reader, document, $hash2([], {})); - if (name_section.$level()['$=='](1)) { - name_section_buffer = reader.$read_lines_until($hash2(["break_on_blank_lines"], {"break_on_blank_lines": true})).$join(" ").$tr_s(" ", " "); - if (($a = (m = name_section_buffer.$match($scope.REGEXP['$[]']("manname_manpurpose")))) !== false && $a !== nil) { - document.$attributes()['$[]=']("manname", m['$[]'](1)); - document.$attributes()['$[]=']("manpurpose", m['$[]'](2)); - if (document.$backend()['$==']("manpage")) { - document.$attributes()['$[]=']("docname", document.$attributes()['$[]']("manname")); - return document.$attributes()['$[]=']("outfilesuffix", "." + (document.$attributes()['$[]']("manvolnum"))); - } else { - return nil - }; - } else { - return self.$warn("asciidoctor: ERROR: " + (reader.$prev_line_info()) + ": malformed name section body") - }; - } else { - return self.$warn("asciidoctor: ERROR: " + (reader.$prev_line_info()) + ": name section title must be at level 1") - }; - } else { - return self.$warn("asciidoctor: ERROR: " + (reader.$prev_line_info()) + ": name section expected") - }; - }); + def.$record = function(key) { + var $a, self = this; - $opal.defs(self, '$next_section', function(reader, parent, attributes) { - var $a, $b, $c, $d, TMP_1, $e, self = this, preamble = nil, part = nil, intro = nil, doctype = nil, section = nil, current_level = nil, expected_next_levels = nil, next_level = nil, new_section = nil, block_line_info = nil, new_block = nil, first_block = nil, document = nil, child_block = nil; - if (attributes == null) { - attributes = $hash2([], {}) - } - preamble = false; - part = false; - intro = false; - if (($a = ($b = (($c = parent.$context()['$==']("document")) ? parent.$blocks()['$empty?']() : $c), $b !== false && $b !== nil ?(((($c = ((($d = parent['$has_header?']()) !== false && $d !== nil) ? $d : attributes.$delete("invalid-header"))) !== false && $c !== nil) ? $c : ($d = self['$is_next_line_section?'](reader, attributes), ($d === nil || $d === false)))) : $b)) !== false && $a !== nil) { - doctype = parent.$doctype(); - if (($a = parent['$has_header?']()) !== false && $a !== nil) { - preamble = intro = $scope.Block.$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"})); - parent['$<<'](preamble);}; - section = parent; - current_level = 0; - if (($a = parent.$attributes()['$has_key?']("fragment")) !== false && $a !== nil) { - expected_next_levels = nil - } else if (doctype['$==']("book")) { - expected_next_levels = [0, 1] - } else { - expected_next_levels = [1] - }; + return self.log['$[]='](key, ((($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now()['$-']((self.timers.$delete(key))))); + }; + + def.$read_parse = function() { + var $a, self = this, time = nil; + + if (((time = (((($a = self.log['$[]']("read")) !== false && $a !== nil) ? $a : 0))['$+']((((($a = self.log['$[]']("parse")) !== false && $a !== nil) ? $a : 0)))))['$>'](0)) { + return time } else { - doctype = parent.$document().$doctype(); - section = self.$initialize_section(reader, parent, attributes); - attributes = ($a = ($b = attributes).$delete_if, $a._p = (TMP_1 = function(k, v){var self = TMP_1._s || this, $a;if (k == null) k = nil;if (v == null) v = nil; - return ($a = k['$==']("title"), ($a === nil || $a === false))}, TMP_1._s = self, TMP_1), $a).call($b); - current_level = section.$level(); - if (($a = (($c = current_level['$=='](0)) ? doctype['$==']("book") : $c)) !== false && $a !== nil) { - part = ($a = section.$special(), ($a === nil || $a === false)); - if (($a = ($c = section.$special(), $c !== false && $c !== nil ?(["preface", "appendix"]['$include?'](section.$sectname())) : $c)) !== false && $a !== nil) { - expected_next_levels = [current_level['$+'](2)] - } else { - expected_next_levels = [current_level['$+'](1)] - }; - } else { - expected_next_levels = [current_level['$+'](1)] - }; + return nil }; - reader.$skip_blank_lines(); - while (($c = reader['$has_more_lines?']()) !== false && $c !== nil) { - self.$parse_block_metadata_lines(reader, section, attributes); - next_level = self['$is_next_line_section?'](reader, attributes); - if (next_level !== false && next_level !== nil) { - next_level = next_level['$+'](section.$document().$attr("leveloffset", 0).$to_i()); - if (($c = ((($d = next_level['$>'](current_level)) !== false && $d !== nil) ? $d : ((($e = section.$context()['$==']("document")) ? next_level['$=='](0) : $e)))) !== false && $c !== nil) { - if (($c = (($d = next_level['$=='](0)) ? ($e = doctype['$==']("book"), ($e === nil || $e === false)) : $d)) !== false && $c !== nil) { - self.$warn("asciidoctor: ERROR: " + (reader.$line_info()) + ": only book doctypes can contain level 0 sections") - } else if (($c = ($d = ($e = expected_next_levels['$nil?'](), ($e === nil || $e === false)), $d !== false && $d !== nil ?($e = expected_next_levels['$include?'](next_level), ($e === nil || $e === false)) : $d)) !== false && $c !== nil) { - self.$warn(((("asciidoctor: WARNING: ") + (reader.$line_info())) + ": section title out of sequence: ")['$+']("expected " + ((function() {if (expected_next_levels.$size()['$>'](1)) { - return "levels" - } else { - return "level" - }; return nil; })()) + " " + (expected_next_levels['$*'](" or ")) + ", ")['$+']("got level " + (next_level)))}; - $c = $opal.to_ary(self.$next_section(reader, section, attributes)), new_section = ($c[0] == null ? nil : $c[0]), attributes = ($c[1] == null ? nil : $c[1]); - section['$<<'](new_section); - } else { - if (($c = (($d = next_level['$=='](0)) ? ($e = doctype['$==']("book"), ($e === nil || $e === false)) : $d)) !== false && $c !== nil) { - self.$warn("asciidoctor: ERROR: " + (reader.$line_info()) + ": only book doctypes can contain level 0 sections")}; - break;; - }; + }; + + def.$convert = function() { + var self = this; + + return self.log['$[]']("convert"); + }; + + def.$read_parse_convert = function() { + var $a, self = this, time = nil; + + if (((time = (((($a = self.log['$[]']("read")) !== false && $a !== nil) ? $a : 0))['$+']((((($a = self.log['$[]']("parse")) !== false && $a !== nil) ? $a : 0)))['$+']((((($a = self.log['$[]']("convert")) !== false && $a !== nil) ? $a : 0)))))['$>'](0)) { + return time } else { - block_line_info = reader.$line_info(); - new_block = self.$next_block(reader, (((($c = intro) !== false && $c !== nil) ? $c : section)), attributes, $hash2(["parse_metadata"], {"parse_metadata": false})); - if (($c = ($d = new_block['$nil?'](), ($d === nil || $d === false))) !== false && $c !== nil) { - if (part !== false && part !== nil) { - if (($c = ($d = section['$blocks?'](), ($d === nil || $d === false))) !== false && $c !== nil) { - if (($c = ($d = new_block.$style()['$==']("partintro"), ($d === nil || $d === false))) !== false && $c !== nil) { - if (new_block.$context()['$==']("paragraph")) { - new_block['$context=']("open"); - new_block['$style=']("partintro"); - } else { - intro = $scope.Block.$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})); - intro['$style=']("partintro"); - new_block['$parent='](intro); - section['$<<'](intro); - }} - } else if (section.$blocks().$size()['$=='](1)) { - first_block = section.$blocks().$first(); - if (($c = ($d = ($e = intro, ($e === nil || $e === false)), $d !== false && $d !== nil ?first_block.$content_model()['$==']("compound") : $d)) !== false && $c !== nil) { - self.$warn("asciidoctor: ERROR: " + (block_line_info) + ": illegal block content outside of partintro block") - } else if (($c = ($d = first_block.$content_model()['$==']("compound"), ($d === nil || $d === false))) !== false && $c !== nil) { - intro = $scope.Block.$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})); - intro['$style=']("partintro"); - section.$blocks().$shift(); - if (first_block.$style()['$==']("partintro")) { - first_block['$context=']("paragraph"); - first_block['$style='](nil);}; - first_block['$parent='](intro); - intro['$<<'](first_block); - new_block['$parent='](intro); - section['$<<'](intro);};}}; - (((($c = intro) !== false && $c !== nil) ? $c : section))['$<<'](new_block); - attributes = $hash2([], {});}; + return nil }; - reader.$skip_blank_lines();}; - if (part !== false && part !== nil) { - if (($a = ($c = section['$blocks?'](), $c !== false && $c !== nil ?section.$blocks().$last().$context()['$==']("section") : $c)) === false || $a === nil) { - self.$warn("asciidoctor: ERROR: " + (reader.$line_info()) + ": invalid part, must have at least one section (e.g., chapter, appendix, etc.)")} - } else if (preamble !== false && preamble !== nil) { - document = parent; - if (($a = preamble['$blocks?']()) !== false && $a !== nil) { - if (($a = ($c = ($d = $scope.Compliance.$unwrap_standalone_preamble(), $d !== false && $d !== nil ?document.$blocks().$size()['$=='](1) : $d), $c !== false && $c !== nil ?(((($d = ($e = doctype['$==']("book"), ($e === nil || $e === false))) !== false && $d !== nil) ? $d : ($e = preamble.$blocks().$first().$style()['$==']("abstract"), ($e === nil || $e === false)))) : $c)) !== false && $a !== nil) { - document.$blocks().$shift(); - while (($c = (child_block = preamble.$blocks().$shift())) !== false && $c !== nil) { - child_block['$parent='](document); - document['$<<'](child_block);};} - } else { - document.$blocks().$shift() - };}; - return [(function() {if (($a = ($c = section['$=='](parent), ($c === nil || $c === false))) !== false && $a !== nil) { - return section + }; + + def.$total = function() { + var $a, self = this, time = nil; + + if (((time = (((($a = self.log['$[]']("read")) !== false && $a !== nil) ? $a : 0))['$+']((((($a = self.log['$[]']("parse")) !== false && $a !== nil) ? $a : 0)))['$+']((((($a = self.log['$[]']("convert")) !== false && $a !== nil) ? $a : 0)))['$+']((((($a = self.log['$[]']("write")) !== false && $a !== nil) ? $a : 0)))))['$>'](0)) { + return time } else { return nil - }; return nil; })(), attributes.$dup()]; - }); + }; + }; - $opal.defs(self, '$next_block', function(reader, parent, attributes, options) { - var $a, $b, $c, $d, $e, $f, TMP_2, TMP_3, $g, TMP_4, TMP_5, $h, $i, $j, TMP_6, $k, $l, $m, TMP_7, TMP_8, self = this, skipped = nil, text_only = nil, parse_metadata = nil, document = nil, extensions = nil, block_extensions = nil, macro_extensions = nil, in_list = nil, block = nil, style = nil, explicit_style = nil, this_line = nil, delimited_block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_blk_match = nil, first_char = nil, match = nil, blk_ctx = nil, posattrs = nil, target = nil, name = nil, raw_attributes = nil, processor = nil, default_attrs = nil, expected_index = nil, list_item = nil, coids = nil, marker = nil, float_id = nil, float_reftext = nil, float_title = nil, float_level = nil, _ = nil, tmp_sect = nil, break_at_list = nil, lines = nil, first_line = nil, admonition_match = nil, admonition_name = nil, attribution = nil, citetitle = nil, first_line_shifted = nil, indent = nil, $case = nil, language = nil, linenums = nil, default_math_syntax = nil, cursor = nil, block_reader = nil, content_model = nil, pos_attrs = nil; - if (attributes == null) { - attributes = $hash2([], {}) + return (def.$print_report = function(to, subject) { + var self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + if (to == null) { + to = $gvars.stdout } - if (options == null) { - options = $hash2([], {}) + if (subject == null) { + subject = nil } - skipped = reader.$skip_blank_lines(); - if (($a = reader['$has_more_lines?']()) === false || $a === nil) { - return nil}; - text_only = options['$[]']("text"); - if (($a = (($b = text_only !== false && text_only !== nil) ? skipped['$>'](0) : $b)) !== false && $a !== nil) { - options.$delete("text"); - text_only = false;}; - parse_metadata = options.$fetch("parse_metadata", true); - document = parent.$document(); - if (($a = (extensions = document.$extensions())) !== false && $a !== nil) { - block_extensions = extensions['$blocks?'](); - macro_extensions = extensions['$block_macros?'](); - } else { - block_extensions = macro_extensions = false - }; - in_list = (parent['$is_a?']($scope.List)); - block = nil; - style = nil; - explicit_style = nil; - while (($b = ($c = reader['$has_more_lines?'](), $c !== false && $c !== nil ?block['$nil?']() : $c)) !== false && $b !== nil) { - if (($b = (($c = parse_metadata !== false && parse_metadata !== nil) ? self.$parse_block_metadata_line(reader, document, attributes, options) : $c)) !== false && $b !== nil) { - reader.$advance(); - continue;;}; - this_line = reader.$read_line(); - delimited_block = false; - block_context = nil; - cloaked_context = nil; - terminator = nil; - if (($b = attributes['$[]'](1)) !== false && $b !== nil) { - $b = $opal.to_ary(self.$parse_style_attribute(attributes, reader)), style = ($b[0] == null ? nil : $b[0]), explicit_style = ($b[1] == null ? nil : $b[1])}; - if (($b = delimited_blk_match = self['$is_delimited_block?'](this_line, true)) !== false && $b !== nil) { - delimited_block = true; - block_context = cloaked_context = delimited_blk_match.$context(); - terminator = delimited_blk_match.$terminator(); - if (($b = ($c = style, ($c === nil || $c === false))) !== false && $b !== nil) { - style = attributes['$[]=']("style", block_context.$to_s()) - } else if (($b = ($c = style['$=='](block_context.$to_s()), ($c === nil || $c === false))) !== false && $b !== nil) { - if (($b = delimited_blk_match.$masq()['$include?'](style)) !== false && $b !== nil) { - block_context = style.$to_sym() - } else if (($b = ($c = delimited_blk_match.$masq()['$include?']("admonition"), $c !== false && $c !== nil ?$scope.ADMONITION_STYLES['$include?'](style) : $c)) !== false && $b !== nil) { - block_context = "admonition" - } else if (($b = (($c = block_extensions !== false && block_extensions !== nil) ? extensions['$processor_registered_for_block?'](style, block_context) : $c)) !== false && $b !== nil) { - block_context = style.$to_sym() - } else { - self.$warn("asciidoctor: WARNING: " + (reader.$prev_line_info()) + ": invalid style for " + (block_context) + " block: " + (style)); - style = block_context.$to_s(); - }};}; - if (($b = ($c = delimited_block, ($c === nil || $c === false))) !== false && $b !== nil) { - while (($c = true) !== false && $c !== nil) { - if (($c = ($d = ($e = ($f = style['$nil?'](), ($f === nil || $f === false)), $e !== false && $e !== nil ?$scope.Compliance.$strict_verbatim_paragraphs() : $e), $d !== false && $d !== nil ?$scope.VERBATIM_STYLES['$include?'](style) : $d)) !== false && $c !== nil) { - block_context = style.$to_sym(); - reader.$unshift_line(this_line); - break;;}; - if (($c = text_only) === false || $c === nil) { - first_char = (function() {if (($c = $scope.Compliance.$markdown_syntax()) !== false && $c !== nil) { - return this_line.$lstrip()['$[]']($range(0, 0, false)) - } else { - return this_line['$[]']($range(0, 0, false)) - }; return nil; })(); - if (($c = ($d = ($e = ($scope.BREAK_LINES['$has_key?'](first_char)), $e !== false && $e !== nil ?this_line.$length()['$>='](3) : $e), $d !== false && $d !== nil ?(match = this_line.$match((function() {if (($e = $scope.Compliance.$markdown_syntax()) !== false && $e !== nil) { - return $scope.REGEXP['$[]']("break_line_plus") - } else { - return $scope.REGEXP['$[]']("break_line") - }; return nil; })())) : $d)) !== false && $c !== nil) { - block = $scope.Block.$new(parent, $scope.BREAK_LINES['$[]'](first_char), $hash2(["content_model"], {"content_model": "empty"})); - break;; - } else if (($c = (match = this_line.$match($scope.REGEXP['$[]']("media_blk_macro")))) !== false && $c !== nil) { - blk_ctx = match['$[]'](1).$to_sym(); - block = $scope.Block.$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"})); - if (blk_ctx['$==']("image")) { - posattrs = ["alt", "width", "height"] - } else if (blk_ctx['$==']("video")) { - posattrs = ["poster", "width", "height"] - } else { - posattrs = [] - }; - if (($c = ((($d = style['$nil?']()) !== false && $d !== nil) ? $d : explicit_style)) === false || $c === nil) { - if (blk_ctx['$==']("image")) { - attributes['$[]=']("alt", style)}; - attributes.$delete("style"); - style = nil;}; - block.$parse_attributes(match['$[]'](3), posattrs, $hash2(["unescape_input", "sub_input", "sub_result", "into"], {"unescape_input": (blk_ctx['$==']("image")), "sub_input": true, "sub_result": false, "into": attributes})); - target = block.$sub_attributes(match['$[]'](2), $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})); - if (($c = target['$empty?']()) !== false && $c !== nil) { - if (document.$attributes().$fetch("attribute-missing", $scope.Compliance.$attribute_missing())['$==']("skip")) { - return $scope.Block.$new(parent, "paragraph", $hash2(["source"], {"source": [this_line]})) - } else { - return nil - }}; - attributes['$[]=']("target", target); - if (($c = attributes['$has_key?']("title")) !== false && $c !== nil) { - block['$title='](attributes.$delete("title"))}; - if (blk_ctx['$==']("image")) { - if (($c = attributes['$has_key?']("scaledwidth")) !== false && $c !== nil) { - if (($c = ($range(48, 57, false))['$include?']((((($d = attributes['$[]']("scaledwidth")['$[]'](-1)) !== false && $d !== nil) ? $d : 0)).$ord())) !== false && $c !== nil) { - attributes['$[]=']("scaledwidth", "" + (attributes['$[]']("scaledwidth")) + "%")}}; - document.$register("images", target); - ($c = "alt", $d = attributes, ((($e = $d['$[]']($c)) !== false && $e !== nil) ? $e : $d['$[]=']($c, $scope.File.$basename(target, $scope.File.$extname(target)).$tr("_-", " ")))); - block.$assign_caption(attributes.$delete("caption"), "figure");}; - break;; - } else if (($c = (($d = first_char['$==']("t")) ? (match = this_line.$match($scope.REGEXP['$[]']("toc"))) : $d)) !== false && $c !== nil) { - block = $scope.Block.$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"})); - block.$parse_attributes(match['$[]'](1), [], $hash2(["sub_result", "into"], {"sub_result": false, "into": attributes})); - break;; - } else if (($c = ($d = (($e = macro_extensions !== false && macro_extensions !== nil) ? (match = this_line.$match($scope.REGEXP['$[]']("generic_blk_macro"))) : $e), $d !== false && $d !== nil ?extensions['$processor_registered_for_block_macro?'](match['$[]'](1)) : $d)) !== false && $c !== nil) { - name = match['$[]'](1); - target = match['$[]'](2); - raw_attributes = match['$[]'](3); - processor = extensions.$load_block_macro_processor(name, document); - if (($c = raw_attributes['$empty?']()) === false || $c === nil) { - document.$parse_attributes(raw_attributes, processor.$options().$fetch("pos_attrs", []), $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": false, "into": attributes}))}; - if (($c = ($d = ((default_attrs = processor.$options().$fetch("default_attrs", $hash2([], {}))))['$empty?'](), ($d === nil || $d === false))) !== false && $c !== nil) { - ($c = ($d = default_attrs).$each, $c._p = (TMP_2 = function(k, v){var self = TMP_2._s || this, $a, $b, $c;if (k == null) k = nil;if (v == null) v = nil; - return ($a = k, $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, v)))}, TMP_2._s = self, TMP_2), $c).call($d)}; - block = processor.$process(parent, target, attributes); - if (($c = block['$nil?']()) !== false && $c !== nil) { - return nil}; - break;;};}; - if (($c = (match = this_line.$match($scope.REGEXP['$[]']("colist")))) !== false && $c !== nil) { - block = $scope.List.$new(parent, "colist"); - attributes['$[]=']("style", "arabic"); - reader.$unshift_line(this_line); - expected_index = 1; - while (($e = ($f = reader['$has_more_lines?'](), $f !== false && $f !== nil ?match = reader.$peek_line().$match($scope.REGEXP['$[]']("colist")) : $f)) !== false && $e !== nil) { - if (($e = ($f = match['$[]'](1).$to_i()['$=='](expected_index), ($f === nil || $f === false))) !== false && $e !== nil) { - self.$warn("asciidoctor: WARNING: " + (reader.$path()) + ": line " + (reader.$lineno()['$-'](2)) + ": callout list item index: expected " + (expected_index) + " got " + (match['$[]'](1)))}; - list_item = self.$next_list_item(reader, block, match); - expected_index = expected_index['$+'](1); - if (($e = ($f = list_item['$nil?'](), ($f === nil || $f === false))) !== false && $e !== nil) { - block['$<<'](list_item); - coids = document.$callouts().$callout_ids(block.$items().$size()); - if (($e = ($f = coids['$empty?'](), ($f === nil || $f === false))) !== false && $e !== nil) { - list_item.$attributes()['$[]=']("coids", coids) - } else { - self.$warn("asciidoctor: WARNING: " + (reader.$path()) + ": line " + (reader.$lineno()['$-'](2)) + ": no callouts refer to list item " + (block.$items().$size())) - };};}; - document.$callouts().$next_list(); - break;; - } else if (($c = (match = this_line.$match($scope.REGEXP['$[]']("ulist")))) !== false && $c !== nil) { - reader.$unshift_line(this_line); - block = self.$next_outline_list(reader, "ulist", parent); - break;; - } else if (($c = (match = this_line.$match($scope.REGEXP['$[]']("olist")))) !== false && $c !== nil) { - reader.$unshift_line(this_line); - block = self.$next_outline_list(reader, "olist", parent); - if (($c = ($e = ($f = attributes['$[]']("style"), ($f === nil || $f === false)), $e !== false && $e !== nil ?($f = block.$attributes()['$[]']("style"), ($f === nil || $f === false)) : $e)) !== false && $c !== nil) { - marker = block.$items().$first().$marker(); - if (($c = marker['$start_with?'](".")) !== false && $c !== nil) { - attributes['$[]=']("style", (((($c = $scope.ORDERED_LIST_STYLES['$[]'](marker.$length()['$-'](1))) !== false && $c !== nil) ? $c : $scope.ORDERED_LIST_STYLES.$first())).$to_s()) - } else { - style = ($c = ($e = $scope.ORDERED_LIST_STYLES).$detect, $c._p = (TMP_3 = function(s){var self = TMP_3._s || this;if (s == null) s = nil; - return marker.$match($scope.ORDERED_LIST_MARKER_PATTERNS['$[]'](s))}, TMP_3._s = self, TMP_3), $c).call($e); - attributes['$[]=']("style", (((($c = style) !== false && $c !== nil) ? $c : $scope.ORDERED_LIST_STYLES.$first())).$to_s()); - };}; - break;; - } else if (($c = (match = this_line.$match($scope.REGEXP['$[]']("dlist")))) !== false && $c !== nil) { - reader.$unshift_line(this_line); - block = self.$next_labeled_list(reader, match, parent); - break;; - } else if (($c = ($f = (((($g = style['$==']("float")) !== false && $g !== nil) ? $g : style['$==']("discrete"))), $f !== false && $f !== nil ?self['$is_section_title?'](this_line, ((function() {if (($g = $scope.Compliance.$underline_style_section_titles()) !== false && $g !== nil) { - return reader.$peek_line(true) - } else { - return nil - }; return nil; })())) : $f)) !== false && $c !== nil) { - reader.$unshift_line(this_line); - $c = $opal.to_ary(self.$parse_section_title(reader, document)), float_id = ($c[0] == null ? nil : $c[0]), float_reftext = ($c[1] == null ? nil : $c[1]), float_title = ($c[2] == null ? nil : $c[2]), float_level = ($c[3] == null ? nil : $c[3]), _ = ($c[4] == null ? nil : $c[4]); - if (float_reftext !== false && float_reftext !== nil) { - attributes['$[]=']("reftext", float_reftext)}; - if (($c = attributes['$has_key?']("id")) !== false && $c !== nil) { - ((($c = float_id) !== false && $c !== nil) ? $c : float_id = attributes['$[]']("id"))}; - block = $scope.Block.$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"})); - if (($c = ((($f = float_id['$nil?']()) !== false && $f !== nil) ? $f : float_id['$empty?']())) !== false && $c !== nil) { - tmp_sect = $scope.Section.$new(parent); - tmp_sect['$title='](float_title); - block['$id='](tmp_sect.$generate_id()); - } else { - block['$id='](float_id) - }; - block['$level='](float_level); - block['$title='](float_title); - break;; - } else if (($c = ($f = ($g = style['$nil?'](), ($g === nil || $g === false)), $f !== false && $f !== nil ?($g = style['$==']("normal"), ($g === nil || $g === false)) : $f)) !== false && $c !== nil) { - if (($c = $scope.PARAGRAPH_STYLES['$include?'](style)) !== false && $c !== nil) { - block_context = style.$to_sym(); - cloaked_context = "paragraph"; - reader.$unshift_line(this_line); - break;; - } else if (($c = $scope.ADMONITION_STYLES['$include?'](style)) !== false && $c !== nil) { - block_context = "admonition"; - cloaked_context = "paragraph"; - reader.$unshift_line(this_line); - break;; - } else if (($c = (($f = block_extensions !== false && block_extensions !== nil) ? extensions['$processor_registered_for_block?'](style, "paragraph") : $f)) !== false && $c !== nil) { - block_context = style.$to_sym(); - cloaked_context = "paragraph"; - reader.$unshift_line(this_line); - break;; - } else { - self.$warn("asciidoctor: WARNING: " + (reader.$prev_line_info()) + ": invalid style for paragraph: " + (style)); - style = nil; - }}; - break_at_list = ((($c = skipped['$=='](0)) ? in_list : $c)); - if (($c = ($f = ($g = style['$==']("normal"), ($g === nil || $g === false)), $f !== false && $f !== nil ?this_line.$match($scope.REGEXP['$[]']("lit_par")) : $f)) !== false && $c !== nil) { - reader.$unshift_line(this_line); - lines = ($c = ($f = reader).$read_lines_until, $c._p = (TMP_4 = function(line){var self = TMP_4._s || this, $a, $b, $c;if (line == null) line = nil; - return ((($a = ((($b = break_at_list !== false && break_at_list !== nil) ? line.$match($scope.REGEXP['$[]']("any_list")) : $b))) !== false && $a !== nil) ? $a : (($b = $scope.Compliance.$block_terminates_paragraph(), $b !== false && $b !== nil ?(((($c = self['$is_delimited_block?'](line)) !== false && $c !== nil) ? $c : line.$match($scope.REGEXP['$[]']("attr_line")))) : $b)))}, TMP_4._s = self, TMP_4), $c).call($f, $hash2(["break_on_blank_lines", "break_on_list_continuation", "preserve_last_line"], {"break_on_blank_lines": true, "break_on_list_continuation": true, "preserve_last_line": true})); - self['$reset_block_indent!'](lines); - block = $scope.Block.$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes})); - if (in_list !== false && in_list !== nil) { - block.$set_option("listparagraph")}; - } else { - reader.$unshift_line(this_line); - lines = ($c = ($g = reader).$read_lines_until, $c._p = (TMP_5 = function(line){var self = TMP_5._s || this, $a, $b, $c;if (line == null) line = nil; - return ((($a = ((($b = break_at_list !== false && break_at_list !== nil) ? line.$match($scope.REGEXP['$[]']("any_list")) : $b))) !== false && $a !== nil) ? $a : (($b = $scope.Compliance.$block_terminates_paragraph(), $b !== false && $b !== nil ?(((($c = self['$is_delimited_block?'](line)) !== false && $c !== nil) ? $c : line.$match($scope.REGEXP['$[]']("attr_line")))) : $b)))}, TMP_5._s = self, TMP_5), $c).call($g, $hash2(["break_on_blank_lines", "break_on_list_continuation", "preserve_last_line", "skip_line_comments"], {"break_on_blank_lines": true, "break_on_list_continuation": true, "preserve_last_line": true, "skip_line_comments": true})); - if (($c = lines['$empty?']()) !== false && $c !== nil) { - reader.$advance(); - return nil;}; - self.$catalog_inline_anchors(lines.$join($scope.EOL), document); - first_line = lines.$first(); - if (($c = ($h = ($i = text_only, ($i === nil || $i === false)), $h !== false && $h !== nil ?(admonition_match = first_line.$match($scope.REGEXP['$[]']("admonition_inline"))) : $h)) !== false && $c !== nil) { - lines['$[]='](0, admonition_match.$post_match().$lstrip()); - attributes['$[]=']("style", admonition_match['$[]'](1)); - attributes['$[]=']("name", admonition_name = admonition_match['$[]'](1).$downcase()); - ($c = "caption", $h = attributes, ((($i = $h['$[]']($c)) !== false && $i !== nil) ? $i : $h['$[]=']($c, document.$attributes()['$[]']("" + (admonition_name) + "-caption")))); - block = $scope.Block.$new(parent, "admonition", $hash2(["source", "attributes"], {"source": lines, "attributes": attributes})); - } else if (($c = ($h = ($i = ($j = text_only, ($j === nil || $j === false)), $i !== false && $i !== nil ?$scope.Compliance.$markdown_syntax() : $i), $h !== false && $h !== nil ?first_line['$start_with?']("> ") : $h)) !== false && $c !== nil) { - ($c = ($h = lines)['$map!'], $c._p = (TMP_6 = function(line){var self = TMP_6._s || this, $a;if (line == null) line = nil; - if (line['$=='](">")) { - return line['$[]']($range(1, -1, false)) - } else if (($a = line['$start_with?']("> ")) !== false && $a !== nil) { - return line['$[]']($range(2, -1, false)) - } else { - return line - }}, TMP_6._s = self, TMP_6), $c).call($h); - if (($c = lines.$last()['$start_with?']("-- ")) !== false && $c !== nil) { - $c = $opal.to_ary(lines.$pop()['$[]']($range(3, -1, false)).$split(", ", 2)), attribution = ($c[0] == null ? nil : $c[0]), citetitle = ($c[1] == null ? nil : $c[1]); - while (($i = lines.$last()['$empty?']()) !== false && $i !== nil) { - lines.$pop()}; - } else { - $c = $opal.to_ary(nil), attribution = ($c[0] == null ? nil : $c[0]), citetitle = ($c[1] == null ? nil : $c[1]) - }; - attributes['$[]=']("style", "quote"); - if (($c = attribution['$nil?']()) === false || $c === nil) { - attributes['$[]=']("attribution", attribution)}; - if (($c = citetitle['$nil?']()) === false || $c === nil) { - attributes['$[]=']("citetitle", citetitle)}; - block = self.$build_block("quote", "compound", false, parent, $scope.Reader.$new(lines), attributes); - } else if (($c = ($i = ($j = ($k = ($l = ($m = text_only, ($m === nil || $m === false)), $l !== false && $l !== nil ?lines.$size()['$>'](1) : $l), $k !== false && $k !== nil ?first_line['$start_with?']("\"") : $k), $j !== false && $j !== nil ?lines.$last()['$start_with?']("-- ") : $j), $i !== false && $i !== nil ?lines['$[]'](-2)['$end_with?']("\"") : $i)) !== false && $c !== nil) { - lines['$[]='](0, first_line['$[]']($range(1, -1, false))); - $c = $opal.to_ary(lines.$pop()['$[]']($range(3, -1, false)).$split(", ", 2)), attribution = ($c[0] == null ? nil : $c[0]), citetitle = ($c[1] == null ? nil : $c[1]); - while (($i = lines.$last()['$empty?']()) !== false && $i !== nil) { - lines.$pop()}; - lines['$[]='](-1, lines.$last().$chop()); - attributes['$[]=']("style", "quote"); - if (($c = attribution['$nil?']()) === false || $c === nil) { - attributes['$[]=']("attribution", attribution)}; - if (($c = citetitle['$nil?']()) === false || $c === nil) { - attributes['$[]=']("citetitle", citetitle)}; - block = $scope.Block.$new(parent, "quote", $hash2(["source", "attributes"], {"source": lines, "attributes": attributes})); - } else { - if (($c = (($i = style['$==']("normal")) ? (((($j = ((first_char = lines.$first()['$[]']($range(0, 0, false))))['$=='](" ")) !== false && $j !== nil) ? $j : first_char['$==']("\t"))) : $i)) !== false && $c !== nil) { - first_line = lines.$first(); - first_line_shifted = first_line.$lstrip(); - indent = self.$line_length(first_line)['$-'](self.$line_length(first_line_shifted)); - lines['$[]='](0, first_line_shifted); - ($c = ($i = lines.$size()).$times, $c._p = (TMP_7 = function(i){var self = TMP_7._s || this;if (i == null) i = nil; - if (i['$>'](0)) { - return lines['$[]='](i, lines['$[]'](i)['$[]']($range(indent, -1, false))) - } else { - return nil - }}, TMP_7._s = self, TMP_7), $c).call($i);}; - block = $scope.Block.$new(parent, "paragraph", $hash2(["source", "attributes"], {"source": lines, "attributes": attributes})); - }; - }; - break;;}}; - if (($b = ($c = block['$nil?'](), $c !== false && $c !== nil ?($j = block_context['$nil?'](), ($j === nil || $j === false)) : $c)) !== false && $b !== nil) { - if (($b = ((($c = block_context['$==']("abstract")) !== false && $c !== nil) ? $c : block_context['$==']("partintro"))) !== false && $b !== nil) { - block_context = "open"}; - $case = block_context;if ("admonition"['$===']($case)) {attributes['$[]=']("name", admonition_name = style.$downcase()); - ($b = "caption", $c = attributes, ((($j = $c['$[]']($b)) !== false && $j !== nil) ? $j : $c['$[]=']($b, document.$attributes()['$[]']("" + (admonition_name) + "-caption")))); - block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);}else if ("comment"['$===']($case)) {self.$build_block(block_context, "skip", terminator, parent, reader, attributes); - return nil;}else if ("example"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes, $hash2(["supports_caption"], {"supports_caption": true}))}else if ("listing"['$===']($case) || "fenced_code"['$===']($case) || "source"['$===']($case)) {if (block_context['$==']("fenced_code")) { - style = attributes['$[]=']("style", "source"); - $b = $opal.to_ary(this_line['$[]']($range(3, -1, false)).$split(",", 2)), language = ($b[0] == null ? nil : $b[0]), linenums = ($b[1] == null ? nil : $b[1]); - if (($b = (($c = language !== false && language !== nil) ? ($j = ((language = language.$strip()))['$empty?'](), ($j === nil || $j === false)) : $c)) !== false && $b !== nil) { - attributes['$[]=']("language", language); - if (($b = (($c = linenums !== false && linenums !== nil) ? ($j = linenums.$strip()['$empty?'](), ($j === nil || $j === false)) : $c)) !== false && $b !== nil) { - attributes['$[]=']("linenums", "")};}; - terminator = terminator['$[]']($range(0, 2, false)); - } else if (block_context['$==']("source")) { - $scope.AttributeList.$rekey(attributes, [nil, "language", "linenums"])}; - block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes, $hash2(["supports_caption"], {"supports_caption": true}));}else if ("literal"['$===']($case)) {block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes)}else if ("pass"['$===']($case)) {block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes)}else if ("math"['$===']($case) || "latexmath"['$===']($case) || "asciimath"['$===']($case)) {if (block_context['$==']("math")) { - attributes['$[]=']("style", (function() {if (((default_math_syntax = document.$attributes()['$[]']("math").$to_s()))['$==']("")) { - return "asciimath" + if (subject !== false && subject !== nil) { + to.$puts("Input file: " + (subject))}; + to.$puts(" Time to read and parse source: " + ("%05.5f"['$%'](self.$read_parse()))); + to.$puts(" Time to convert document: " + ("%05.5f"['$%'](self.$convert()))); + return to.$puts(" Total time (read, parse and convert): " + ("%05.5f"['$%'](self.$read_parse_convert()))); + }, nil) && 'print_report'; + })(self, null) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + (function($base, $super) { + function $NilClass(){}; + var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); + + var def = self._proto, $scope = self._scope, $a; + + if ((($a = self['$respond_to?']("nil_or_empty?")) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return $opal.defn(self, '$nil_or_empty?', def['$nil?']) + } + })(self, null); + (function($base, $super) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self._proto, $scope = self._scope, $a; + + if ((($a = self['$respond_to?']("nil_or_empty?")) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return $opal.defn(self, '$nil_or_empty?', def['$empty?']) + } + })(self, null); + (function($base, $super) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self._proto, $scope = self._scope, $a; + + if ((($a = self['$respond_to?']("nil_or_empty?")) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return $opal.defn(self, '$nil_or_empty?', def['$empty?']) + } + })(self, null); + (function($base, $super) { + function $Hash(){}; + var self = $Hash = $klass($base, $super, 'Hash', $Hash); + + var def = self._proto, $scope = self._scope, $a; + + if ((($a = self['$respond_to?']("nil_or_empty?")) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return $opal.defn(self, '$nil_or_empty?', def['$empty?']) + } + })(self, null); + return (function($base, $super) { + function $Numeric(){}; + var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); + + var def = self._proto, $scope = self._scope, $a; + + if ((($a = self['$respond_to?']("nil_or_empty?")) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return $opal.defn(self, '$nil_or_empty?', def['$nil?']) + } + })(self, null); +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; + + ; + if ($scope.RUBY_ENGINE['$==']("opal")) { + return nil}; +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $range = $opal.range, $gvars = $opal.gvars; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base) { + var self = $module($base, 'Helpers'); + + var def = self._proto, $scope = self._scope; + + $opal.defs(self, '$require_library', function(name, gem) { + var $a, self = this, e = nil; + + if (gem == null) { + gem = true + } + try { + return true + } catch ($err) {if ($opal.$rescue($err, [(($a = $opal.Object._scope.LoadError) == null ? $opal.cm('LoadError') : $a)])) {e = $err; + if (gem !== false && gem !== nil) { + return self.$fail("asciidoctor: FAILED: required gem '" + ((function() {if (gem['$=='](true)) { + return name } else { - return default_math_syntax - }; return nil; })())}; - block = self.$build_block("math", "raw", terminator, parent, reader, attributes);}else if ("open"['$===']($case) || "sidebar"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)}else if ("table"['$===']($case)) {cursor = reader.$cursor(); - block_reader = $scope.Reader.$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments"], {"terminator": terminator, "skip_line_comments": true})), cursor); - $case = terminator['$[]']($range(0, 0, false));if (","['$===']($case)) {attributes['$[]=']("format", "csv")}else if (":"['$===']($case)) {attributes['$[]=']("format", "dsv")}; - block = self.$next_table(block_reader, parent, attributes);}else if ("quote"['$===']($case) || "verse"['$===']($case)) {$scope.AttributeList.$rekey(attributes, [nil, "attribution", "citetitle"]); - block = self.$build_block(block_context, ((function() {if (block_context['$==']("verse")) { - return "verbatim" - } else { - return "compound" - }; return nil; })()), terminator, parent, reader, attributes);}else {if (($b = (($c = block_extensions !== false && block_extensions !== nil) ? extensions['$processor_registered_for_block?'](block_context, cloaked_context) : $c)) !== false && $b !== nil) { - processor = extensions.$load_block_processor(block_context, document); - if (($b = ($c = ((content_model = processor.$options()['$[]']("content_model")))['$==']("skip"), ($c === nil || $c === false))) !== false && $b !== nil) { - if (($b = ($c = ((pos_attrs = processor.$options().$fetch("pos_attrs", [])))['$empty?'](), ($c === nil || $c === false))) !== false && $b !== nil) { - $scope.AttributeList.$rekey(attributes, [nil].$concat(pos_attrs))}; - if (($b = ($c = ((default_attrs = processor.$options().$fetch("default_attrs", $hash2([], {}))))['$empty?'](), ($c === nil || $c === false))) !== false && $b !== nil) { - ($b = ($c = default_attrs).$each, $b._p = (TMP_8 = function(k, v){var self = TMP_8._s || this, $a, $b, $c;if (k == null) k = nil;if (v == null) v = nil; - return ($a = k, $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, v)))}, TMP_8._s = self, TMP_8), $b).call($c)};}; - block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["processor"], {"processor": processor})); - if (($b = block['$nil?']()) !== false && $b !== nil) { - return nil}; + return gem + }; return nil; })()) + "' is not installed. Processing aborted.") } else { - self.$raise("Unsupported block type " + (block_context) + " at " + (reader.$line_info())) - }};};}; - if (($a = ($b = block['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - if (($a = attributes['$has_key?']("id")) !== false && $a !== nil) { - ($a = block, ((($b = $a.$id()) !== false && $b !== nil) ? $b : $a['$id='](attributes['$[]']("id"))))}; - if (($a = block['$title?']()) === false || $a === nil) { - block['$title='](attributes['$[]']("title"))}; - ($a = block, ((($b = $a.$caption()) !== false && $b !== nil) ? $b : $a['$caption='](attributes.$delete("caption")))); - block['$style='](attributes['$[]']("style")); - if (($a = block.$id()) !== false && $a !== nil) { - document.$register("ids", [block.$id(), (((($a = attributes['$[]']("reftext")) !== false && $a !== nil) ? $a : ((function() {if (($b = block['$title?']()) !== false && $b !== nil) { - return block.$title() - } else { - return nil - }; return nil; })())))])}; - block.$update_attributes(attributes); - block.$lock_in_subs(); - if (($a = block['$sub?']("callouts")) !== false && $a !== nil) { - if (($a = ($b = (self.$catalog_callouts(block.$source(), document)), ($b === nil || $b === false))) !== false && $a !== nil) { - block.$remove_sub("callouts")}};}; - return block; + return self.$fail("asciidoctor: FAILED: " + (e.$message().$chomp(".")) + ". Processing aborted.") + } + }else { throw $err; } + }; }); - $opal.defs(self, '$is_delimited_block?', function(line, return_match_data) { - var $a, $b, $c, self = this, line_len = nil, tip = nil, tl = nil, fenced_code = nil, tip_3 = nil, context = nil, masq = nil; - if (return_match_data == null) { - return_match_data = false - } - if (($a = (($b = ((line_len = line.$length()))['$>'](1)) ? ($scope.DELIMITED_BLOCK_LEADERS['$include?'](line['$[]']($range(0, 1, false)))) : $b)) === false || $a === nil) { - return nil}; - if (line_len['$=='](2)) { - tip = line; - tl = 2; + $opal.defs(self, '$normalize_lines', function(data) { + var $a, self = this; + + if (data.$class()['$==']((($a = $opal.Object._scope.String) == null ? $opal.cm('String') : $a))) { + return (self.$normalize_lines_from_string(data)) } else { - if (line_len['$<='](4)) { - tip = line; - tl = line_len; - } else { - tip = line['$[]']($range(0, 3, false)); - tl = 4; - }; - fenced_code = false; - if (($a = $scope.Compliance.$markdown_syntax()) !== false && $a !== nil) { - tip_3 = ((function() {if (tl['$=='](4)) { - return tip.$chop() - } else { - return tip - }; return nil; })()); - if (tip_3['$==']("```")) { - if (($a = (($b = tl['$=='](4)) ? (tip['$end_with?']("`")) : $b)) !== false && $a !== nil) { - return nil}; - tip = tip_3; - tl = 3; - fenced_code = true; - } else if (tip_3['$==']("~~~")) { - if (($a = (($b = tl['$=='](4)) ? (tip['$end_with?']("~")) : $b)) !== false && $a !== nil) { - return nil}; - tip = tip_3; - tl = 3; - fenced_code = true;};}; - if (($a = (($b = tl['$=='](3)) ? ($c = fenced_code, ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - return nil}; + return (self.$normalize_lines_array(data)) }; - if (($a = $scope.DELIMITED_BLOCKS['$has_key?'](tip)) !== false && $a !== nil) { - if (($a = ((($b = tl['$<'](4)) !== false && $b !== nil) ? $b : tl['$=='](line_len))) !== false && $a !== nil) { - if (return_match_data !== false && return_match_data !== nil) { - ($a = $scope.DELIMITED_BLOCKS['$[]'](tip))['$to_a'] ? ($a = $a['$to_a']()) : ($a)._isArray ? $a : ($a = [$a]), context = ($a[0] == null ? nil : $a[0]), masq = ($a[1] == null ? nil : $a[1]); - return $scope.BlockMatchData.$new(context, masq, tip, tip); - } else { - return true - } - } else if (((("") + (tip)) + (tip['$[]']($range(-1, -1, false))['$*']((line_len['$-'](tl)))))['$=='](line)) { - if (return_match_data !== false && return_match_data !== nil) { - ($a = $scope.DELIMITED_BLOCKS['$[]'](tip))['$to_a'] ? ($a = $a['$to_a']()) : ($a)._isArray ? $a : ($a = [$a]), context = ($a[0] == null ? nil : $a[0]), masq = ($a[1] == null ? nil : $a[1]); - return $scope.BlockMatchData.$new(context, masq, tip, line); + }); + + $opal.defs(self, '$normalize_lines_array', function(data) { + var $a, $b, TMP_1, $c, TMP_2, $d, TMP_3, $e, TMP_4, self = this, leading_bytes = nil, first_line = nil, utf8 = nil, leading_2_bytes = nil; + + if ((($a = data['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return []}; + leading_bytes = ((first_line = data['$[]'](0)))['$[]']($range(0, 2, false)).$bytes().$to_a(); + if ((($a = $scope.COERCE_ENCODING) !== nil && (!$a._isBoolean || $a == true))) { + utf8 = ((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8; + if (((leading_2_bytes = leading_bytes['$[]']($range(0, 1, false))))['$==']($scope.BOM_BYTES_UTF_16LE)) { + return ($a = ($b = ((data.$join().$force_encoding(((($c = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $c))._scope.UTF_16LE))['$[]']($range(1, -1, false)).$encode(utf8)).$lines()).$map, $a._p = (TMP_1 = function(line){var self = TMP_1._s || this; +if (line == null) line = nil; + return line.$rstrip()}, TMP_1._s = self, TMP_1), $a).call($b) + } else if (leading_2_bytes['$==']($scope.BOM_BYTES_UTF_16BE)) { + data['$[]='](0, (first_line.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_16BE))['$[]']($range(1, -1, false))); + return ($a = ($c = data).$map, $a._p = (TMP_2 = function(line){var self = TMP_2._s || this, $a; +if (line == null) line = nil; + return "" + (((line.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_16BE)).$encode(utf8)).$rstrip())}, TMP_2._s = self, TMP_2), $a).call($c); + } else if (leading_bytes['$[]']($range(0, 2, false))['$==']($scope.BOM_BYTES_UTF_8)) { + data['$[]='](0, (first_line.$force_encoding(utf8))['$[]']($range(1, -1, false)))}; + return ($a = ($d = data).$map, $a._p = (TMP_3 = function(line){var self = TMP_3._s || this; +if (line == null) line = nil; + if (line.$encoding()['$=='](utf8)) { + return line.$rstrip() } else { - return true - } - } else { - return nil - } + return (line.$force_encoding(utf8)).$rstrip() + }}, TMP_3._s = self, TMP_3), $a).call($d); } else { - return nil + if (leading_bytes['$==']($scope.BOM_BYTES_UTF_8)) { + data['$[]='](0, first_line['$[]']($range(3, -1, false)))}; + return ($a = ($e = data).$map, $a._p = (TMP_4 = function(line){var self = TMP_4._s || this; +if (line == null) line = nil; + return line.$rstrip()}, TMP_4._s = self, TMP_4), $a).call($e); }; }); - $opal.defs(self, '$build_block', function(block_context, content_model, terminator, parent, reader, attributes, options) { - var $a, $b, TMP_9, $c, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, cursor = nil, processor = nil, block = nil; - if (options == null) { - options = $hash2([], {}) - } - if (($a = ((($b = content_model['$==']("skip")) !== false && $b !== nil) ? $b : content_model['$==']("raw"))) !== false && $a !== nil) { - skip_processing = content_model['$==']("skip"); - parse_as_content_model = "simple"; - } else { - skip_processing = false; - parse_as_content_model = content_model; - }; - if (($a = terminator['$nil?']()) !== false && $a !== nil) { - if (parse_as_content_model['$==']("verbatim")) { - lines = reader.$read_lines_until($hash2(["break_on_blank_lines", "break_on_list_continuation"], {"break_on_blank_lines": true, "break_on_list_continuation": true})) + $opal.defs(self, '$normalize_lines_from_string', function(data) { + var $a, $b, TMP_5, self = this, utf8 = nil, leading_bytes = nil, leading_2_bytes = nil; + + if ((($a = data['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return []}; + if ((($a = $scope.COERCE_ENCODING) !== nil && (!$a._isBoolean || $a == true))) { + utf8 = ((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8; + leading_bytes = data['$[]']($range(0, 2, false)).$bytes().$to_a(); + if (((leading_2_bytes = leading_bytes['$[]']($range(0, 1, false))))['$==']($scope.BOM_BYTES_UTF_16LE)) { + data = (data.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_16LE))['$[]']($range(1, -1, false)).$encode(utf8) + } else if (leading_2_bytes['$==']($scope.BOM_BYTES_UTF_16BE)) { + data = (data.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_16BE))['$[]']($range(1, -1, false)).$encode(utf8) + } else if (leading_bytes['$[]']($range(0, 2, false))['$==']($scope.BOM_BYTES_UTF_8)) { + data = (function() {if (data.$encoding()['$=='](utf8)) { + return data['$[]']($range(1, -1, false)) + } else { + return (data.$force_encoding(utf8))['$[]']($range(1, -1, false)) + }; return nil; })() + } else if (data.$encoding()['$=='](utf8)) { } else { - if (content_model['$==']("compound")) { - content_model = "simple"}; - lines = ($a = ($b = reader).$read_lines_until, $a._p = (TMP_9 = function(line){var self = TMP_9._s || this, $a, $b;if (line == null) line = nil; - return ($a = $scope.Compliance.$block_terminates_paragraph(), $a !== false && $a !== nil ?(((($b = self['$is_delimited_block?'](line)) !== false && $b !== nil) ? $b : line.$match($scope.REGEXP['$[]']("attr_line")))) : $a)}, TMP_9._s = self, TMP_9), $a).call($b, $hash2(["break_on_blank_lines", "break_on_list_continuation", "preserve_last_line", "skip_line_comments", "skip_processing"], {"break_on_blank_lines": true, "break_on_list_continuation": true, "preserve_last_line": true, "skip_line_comments": true, "skip_processing": skip_processing})); + data = data.$force_encoding(utf8) }; - block_reader = nil; - } else if (($a = ($c = parse_as_content_model['$==']("compound"), ($c === nil || $c === false))) !== false && $a !== nil) { - lines = reader.$read_lines_until($hash2(["terminator", "skip_processing"], {"terminator": terminator, "skip_processing": skip_processing})); - block_reader = nil; - } else if (terminator['$=='](false)) { - lines = nil; - block_reader = reader; - } else { - lines = nil; - cursor = reader.$cursor(); - block_reader = $scope.Reader.$new(reader.$read_lines_until($hash2(["terminator", "skip_processing"], {"terminator": terminator, "skip_processing": skip_processing})), cursor); - }; - if (content_model['$==']("skip")) { - attributes.$clear(); - return lines;}; - if (($a = (($c = content_model['$==']("verbatim")) ? attributes['$has_key?']("indent") : $c)) !== false && $a !== nil) { - self['$reset_block_indent!'](lines, attributes['$[]']("indent").$to_i())}; - if (($a = (processor = options['$[]']("processor"))) !== false && $a !== nil) { - attributes.$delete("style"); - processor.$options()['$[]=']("content_model", content_model); - block = processor.$process(parent, ((($a = block_reader) !== false && $a !== nil) ? $a : $scope.Reader.$new(lines)), attributes); - } else { - block = $scope.Block.$new(parent, block_context, $hash2(["content_model", "attributes", "source"], {"content_model": content_model, "attributes": attributes, "source": lines})) - }; - if (($a = options.$fetch("supports_caption", false)) !== false && $a !== nil) { - if (($a = attributes['$has_key?']("title")) !== false && $a !== nil) { - block['$title='](attributes.$delete("title"))}; - block.$assign_caption(attributes.$delete("caption"));}; - if (content_model['$==']("compound")) { - self.$parse_blocks(block_reader, block)}; - return block; + } else if (data['$[]']($range(0, 2, false)).$bytes().$to_a()['$==']($scope.BOM_BYTES_UTF_8)) { + data = data['$[]']($range(3, -1, false))}; + return ($a = ($b = data.$each_line()).$map, $a._p = (TMP_5 = function(line){var self = TMP_5._s || this; +if (line == null) line = nil; + return line.$rstrip()}, TMP_5._s = self, TMP_5), $a).call($b); }); - $opal.defs(self, '$parse_blocks', function(reader, parent) { - var $a, $b, self = this, block = nil; - while (($b = reader['$has_more_lines?']()) !== false && $b !== nil) { - block = $scope.Lexer.$next_block(reader, parent); - if (($b = block['$nil?']()) === false || $b === nil) { - parent['$<<'](block)};}; + $opal.cdecl($scope, 'REGEXP_ENCODE_URI_CHARS', /[^\w\-.!~*';:@=+$,()\[\]]/); + + $opal.defs(self, '$encode_uri', function(str) { + var $a, $b, TMP_6, self = this; + + return ($a = ($b = str).$gsub, $a._p = (TMP_6 = function(){var self = TMP_6._s || this, $a, $b, TMP_7; + if ($gvars["&"] == null) $gvars["&"] = nil; + + return ($a = ($b = $gvars["&"].$each_byte()).$map, $a._p = (TMP_7 = function(c){var self = TMP_7._s || this; +if (c == null) c = nil; + return self.$sprintf("%%%02X", c)}, TMP_7._s = self, TMP_7), $a).call($b).$join()}, TMP_6._s = self, TMP_6), $a).call($b, $scope.REGEXP_ENCODE_URI_CHARS); }); - $opal.defs(self, '$next_outline_list', function(reader, list_type, parent) { - var $a, $b, $c, $d, self = this, list_block = nil, match = nil, marker = nil, this_item_level = nil, ancestor = nil, list_item = nil; - list_block = $scope.List.$new(parent, list_type); - if (parent.$context()['$=='](list_type)) { - list_block['$level='](parent.$level()['$+'](1)) + $opal.defs(self, '$rootname', function(file_name) { + var $a, $b, self = this, ext = nil; + + if ((($a = ((ext = (($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$extname(file_name)))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return file_name } else { - list_block['$level='](1) + return file_name['$[]']($range(0, ext.$length()['$-@'](), true)) }; - while (($b = ($c = reader['$has_more_lines?'](), $c !== false && $c !== nil ?(match = reader.$peek_line().$match($scope.REGEXP['$[]'](list_type))) : $c)) !== false && $b !== nil) { - marker = self.$resolve_list_marker(list_type, match['$[]'](1)); - if (($b = ($c = list_block['$items?'](), $c !== false && $c !== nil ?($d = marker['$=='](list_block.$items().$first().$marker()), ($d === nil || $d === false)) : $c)) !== false && $b !== nil) { - this_item_level = list_block.$level()['$+'](1); - ancestor = parent; - while (ancestor.$context()['$=='](list_type)) { - if (marker['$=='](ancestor.$items().$first().$marker())) { - this_item_level = ancestor.$level(); - break;;}; - ancestor = ancestor.$parent();}; + }); + + $opal.defs(self, '$mkdir_p', function(dir) { + var $a, $b, $c, self = this, parent_dir = nil; + + if ((($a = (($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b)['$directory?'](dir)) !== nil && (!$a._isBoolean || $a == true))) { + return nil } else { - this_item_level = list_block.$level() + parent_dir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(dir); + if ((($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)['$directory?'](parent_dir = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c).$dirname(dir))['$!'](), $b !== false && $b !== nil ?parent_dir['$=='](".")['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.$mkdir_p(parent_dir)}; + return (($a = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $a).$mkdir(dir); }; - if (($b = ((($c = ($d = list_block['$items?'](), ($d === nil || $d === false))) !== false && $c !== nil) ? $c : this_item_level['$=='](list_block.$level()))) !== false && $b !== nil) { - list_item = self.$next_list_item(reader, list_block, match) - } else if (this_item_level['$<'](list_block.$level())) { - break; - } else if (this_item_level['$>'](list_block.$level())) { - list_block.$items().$last()['$<<'](self.$next_block(reader, list_block))}; - if (($b = list_item['$nil?']()) === false || $b === nil) { - list_block['$<<'](list_item)}; - list_item = nil; - reader.$skip_blank_lines();}; - return list_block; }); + + })(self) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $hash2 = $opal.hash2, $gvars = $opal.gvars, $range = $opal.range; - $opal.defs(self, '$catalog_callouts', function(text, document) { - var $a, $b, TMP_10, self = this, found = nil; - found = false; - if (($a = text['$include?']("<")) !== false && $a !== nil) { - ($a = ($b = text).$scan, $a._p = (TMP_10 = function(){var self = TMP_10._s || this, $a, $b, m = nil; - m = $gvars["~"]; - if (($a = ($b = m['$[]'](0)['$[]']($range(0, 0, false))['$==']("\\"), ($b === nil || $b === false))) !== false && $a !== nil) { - document.$callouts().$register(m['$[]'](2))}; - return found = true;}, TMP_10._s = self, TMP_10), $a).call($b, $scope.REGEXP['$[]']("callout_quick_scan"))}; - return found; - }); + return (function($base) { + var self = $module($base, 'Asciidoctor'); - $opal.defs(self, '$catalog_inline_anchors', function(text, document) { - var $a, $b, TMP_11, self = this; - if (($a = text['$include?']("[")) !== false && $a !== nil) { - ($a = ($b = text).$scan, $a._p = (TMP_11 = function(){var self = TMP_11._s || this, $a, m = nil, id = nil, reftext = nil; - m = $gvars["~"]; - if (($a = m['$[]'](0)['$start_with?']("\\")) !== false && $a !== nil) { - return nil;}; - id = ((($a = m['$[]'](1)) !== false && $a !== nil) ? $a : m['$[]'](3)); - reftext = ((($a = m['$[]'](2)) !== false && $a !== nil) ? $a : m['$[]'](4)); - return document.$register("ids", [id, reftext]);}, TMP_11._s = self, TMP_11), $a).call($b, $scope.REGEXP['$[]']("anchor_macro"))}; - return nil; - }); + var def = self._proto, $scope = self._scope; - $opal.defs(self, '$next_labeled_list', function(reader, match, parent) { - var $a, $b, $c, $d, self = this, list_block = nil, previous_pair = nil, sibling_pattern = nil, term = nil, item = nil; - list_block = $scope.List.$new(parent, "dlist"); - previous_pair = nil; - sibling_pattern = $scope.REGEXP['$[]']("dlist_siblings")['$[]'](match['$[]'](2)); - while (($b = ($c = reader['$has_more_lines?'](), $c !== false && $c !== nil ?match = reader.$peek_line().$match(sibling_pattern) : $c)) !== false && $b !== nil) { - $b = $opal.to_ary(self.$next_list_item(reader, list_block, match, sibling_pattern)), term = ($b[0] == null ? nil : $b[0]), item = ($b[1] == null ? nil : $b[1]); - if (($b = ($c = ($d = previous_pair['$nil?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?previous_pair.$last()['$nil?']() : $c)) !== false && $b !== nil) { - previous_pair.$pop(); - previous_pair['$[]'](0)['$<<'](term); - previous_pair['$<<'](item); - } else { - list_block.$items()['$<<']((previous_pair = [[term], item])) - };}; - return list_block; - }); + (function($base) { + var self = $module($base, 'Substitutors'); - $opal.defs(self, '$next_list_item', function(reader, list_block, match, sibling_trait) { - var $a, $b, $c, self = this, list_type = nil, list_term = nil, list_item = nil, has_text = nil, text = nil, checkbox = nil, checked = nil, cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, continuation_connects_first_block = nil, content_adjacent = nil, options = nil, new_block = nil; - if (sibling_trait == null) { - sibling_trait = nil + var def = self._proto, $scope = self._scope; + + $opal.cdecl($scope, 'SPECIAL_CHARS', $hash2(["&", "<", ">"], {"&": "&", "<": "<", ">": ">"})); + + $opal.cdecl($scope, 'SPECIAL_CHARS_PATTERN', (new RegExp("[" + $scope.SPECIAL_CHARS.$keys().$join() + "]"))); + + $opal.cdecl($scope, 'SUBS', $hash2(["basic", "normal", "verbatim", "title", "header", "pass"], {"basic": ["specialcharacters"], "normal": ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"], "verbatim": ["specialcharacters", "callouts"], "title": ["specialcharacters", "quotes", "replacements", "macros", "attributes", "post_replacements"], "header": ["specialcharacters", "attributes"], "pass": []})); + + $opal.cdecl($scope, 'COMPOSITE_SUBS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": [], "normal": $scope.SUBS['$[]']("normal"), "verbatim": $scope.SUBS['$[]']("verbatim"), "specialchars": ["specialcharacters"]})); + + $opal.cdecl($scope, 'SUB_SYMBOLS', $hash2(["a", "m", "n", "p", "q", "r", "c", "v"], {"a": "attributes", "m": "macros", "n": "normal", "p": "post_replacements", "q": "quotes", "r": "replacements", "c": "specialcharacters", "v": "verbatim"})); + + $opal.cdecl($scope, 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $scope.COMPOSITE_SUBS.$keys()['$+']($scope.SUBS['$[]']("normal"))['$+'](["callouts"]), "inline": $scope.COMPOSITE_SUBS.$keys()['$+']($scope.SUBS['$[]']("normal"))})); + + $opal.cdecl($scope, 'PASS_START', "\u0096"); + + $opal.cdecl($scope, 'PASS_END', "\u0097"); + + $opal.cdecl($scope, 'PASS_MATCH', /\u0096(\d+)\u0097/); + + $opal.cdecl($scope, 'PASS_MATCH_HI', /]*>\u0096<\/span>[^\d]*(\d+)[^\d]*]*>\u0097<\/span>/); + + self.$attr_reader("passthroughs"); + + def.$apply_subs = function(source, subs, expand) { + var $a, $b, TMP_1, $c, TMP_2, self = this, effective_subs = nil, text = nil, multiline = nil, has_passthroughs = nil; + + if (subs == null) { + subs = "normal" } - list_type = list_block.$context(); - if (list_type['$==']("dlist")) { - list_term = $scope.ListItem.$new(list_block, match['$[]'](1)); - list_item = $scope.ListItem.$new(list_block, match['$[]'](3)); - has_text = ($a = match['$[]'](3).$to_s()['$empty?'](), ($a === nil || $a === false)); - } else { - text = match['$[]'](2); - checkbox = false; - if (($a = (($b = list_type['$==']("ulist")) ? text['$start_with?']("[") : $b)) !== false && $a !== nil) { - if (($a = text['$start_with?']("[ ] ")) !== false && $a !== nil) { - checkbox = true; - checked = false; - text = text['$[]']($range(3, -1, false)).$lstrip(); - } else if (($a = ((($b = text['$start_with?']("[*] ")) !== false && $b !== nil) ? $b : text['$start_with?']("[x] "))) !== false && $a !== nil) { - checkbox = true; - checked = true; - text = text['$[]']($range(3, -1, false)).$lstrip();}}; - list_item = $scope.ListItem.$new(list_block, text); - if (checkbox !== false && checkbox !== nil) { - list_block.$attributes()['$[]=']("checklist-option", ""); - list_item.$attributes()['$[]=']("checkbox", ""); - if (checked !== false && checked !== nil) { - list_item.$attributes()['$[]=']("checked", "")};}; - if (($a = ($b = sibling_trait, ($b === nil || $b === false))) !== false && $a !== nil) { - sibling_trait = self.$resolve_list_marker(list_type, match['$[]'](1), list_block.$items().$size(), true, reader)}; - list_item['$marker='](sibling_trait); - has_text = true; - }; - reader.$advance(); - cursor = reader.$cursor(); - list_item_reader = $scope.Reader.$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), cursor); - if (($a = list_item_reader['$has_more_lines?']()) !== false && $a !== nil) { - comment_lines = list_item_reader.$skip_line_comments(); - subsequent_line = list_item_reader.$peek_line(); - if (($a = comment_lines['$empty?']()) === false || $a === nil) { - list_item_reader.$unshift_lines(comment_lines)}; - if (($a = ($b = subsequent_line['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - continuation_connects_first_block = subsequent_line['$empty?'](); - if (($a = ($b = ($c = continuation_connects_first_block, ($c === nil || $c === false)), $b !== false && $b !== nil ?($c = list_type['$==']("dlist"), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - has_text = false}; - content_adjacent = ($a = ($b = continuation_connects_first_block, ($b === nil || $b === false)), $a !== false && $a !== nil ?($b = subsequent_line['$empty?'](), ($b === nil || $b === false)) : $a); + if (expand == null) { + expand = false + } + if ((($a = subs['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return source + } else if (subs['$==']("normal")) { + subs = $scope.SUBS['$[]']("normal") + } else if (expand !== false && expand !== nil) { + if ((($a = subs['$is_a?']((($b = $opal.Object._scope.Symbol) == null ? $opal.cm('Symbol') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + subs = ((($a = $scope.COMPOSITE_SUBS['$[]'](subs)) !== false && $a !== nil) ? $a : [subs]) } else { - continuation_connects_first_block = false; - content_adjacent = false; - }; - options = $hash2(["text"], {"text": ($a = has_text, ($a === nil || $a === false))}); - while (($b = list_item_reader['$has_more_lines?']()) !== false && $b !== nil) { - new_block = self.$next_block(list_item_reader, list_block, $hash2([], {}), options); - if (($b = new_block['$nil?']()) === false || $b === nil) { - list_item['$<<'](new_block)};}; - list_item.$fold_first(continuation_connects_first_block, content_adjacent);}; - if (list_type['$==']("dlist")) { - if (($a = ((($b = list_item['$text?']()) !== false && $b !== nil) ? $b : list_item['$blocks?']())) === false || $a === nil) { - list_item = nil}; - return [list_term, list_item]; - } else { - return list_item - }; - }); - - $opal.defs(self, '$read_lines_for_list_item', function(reader, list_type, sibling_trait, has_text) { - var $a, $b, $c, $d, $e, TMP_12, TMP_13, $f, TMP_14, TMP_15, $g, $h, TMP_16, $i, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, this_line = nil, prev_line = nil, match = nil, nested_list_type = nil; - if (sibling_trait == null) { - sibling_trait = nil - } - if (has_text == null) { - has_text = true - } - buffer = []; - continuation = "inactive"; - within_nested_list = false; - detached_continuation = nil; - while (($b = reader['$has_more_lines?']()) !== false && $b !== nil) { - this_line = reader.$read_line(); - if (($b = self['$is_sibling_list_item?'](this_line, list_type, sibling_trait)) !== false && $b !== nil) { - break;}; - prev_line = (function() {if (($b = buffer['$empty?']()) !== false && $b !== nil) { - return nil + effective_subs = []; + ($a = ($b = subs).$each, $a._p = (TMP_1 = function(key){var self = TMP_1._s || this, $a; +if (key == null) key = nil; + if ((($a = $scope.COMPOSITE_SUBS['$has_key?'](key)) !== nil && (!$a._isBoolean || $a == true))) { + return effective_subs = effective_subs['$+']($scope.COMPOSITE_SUBS['$[]'](key)) + } else { + return effective_subs['$<<'](key) + }}, TMP_1._s = self, TMP_1), $a).call($b); + subs = effective_subs; + }}; + if ((($a = subs['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return source}; + text = (function() {if ((($a = (multiline = source['$is_a?']((($c = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $c)))) !== nil && (!$a._isBoolean || $a == true))) { + return (source['$*']($scope.EOL)) } else { - return buffer.$last() + return source }; return nil; })(); - if (prev_line['$==']($scope.LIST_CONTINUATION)) { - if (continuation['$==']("inactive")) { - continuation = "active"; - has_text = true; - if (($b = within_nested_list) === false || $b === nil) { - buffer['$[]='](-1, "")};}; - if (this_line['$==']($scope.LIST_CONTINUATION)) { - if (($b = ($c = continuation['$==']("frozen"), ($c === nil || $c === false))) !== false && $b !== nil) { - continuation = "frozen"; - buffer['$<<'](this_line);}; - this_line = nil; - continue;;};}; - if (($b = match = self['$is_delimited_block?'](this_line, true)) !== false && $b !== nil) { - if (continuation['$==']("active")) { - buffer['$<<'](this_line); - buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line"], {"terminator": match.$terminator(), "read_last_line": true}))); - continuation = "inactive"; - } else { - break; - } - } else if (($b = ($c = (($d = list_type['$==']("dlist")) ? ($e = continuation['$==']("active"), ($e === nil || $e === false)) : $d), $c !== false && $c !== nil ?this_line.$match($scope.REGEXP['$[]']("attr_line")) : $c)) !== false && $b !== nil) { - break; - } else if (($b = (($c = continuation['$==']("active")) ? ($d = this_line['$empty?'](), ($d === nil || $d === false)) : $c)) !== false && $b !== nil) { - if (($b = this_line.$match($scope.REGEXP['$[]']("lit_par"))) !== false && $b !== nil) { - reader.$unshift_line(this_line); - buffer.$concat(($b = ($c = reader).$read_lines_until, $b._p = (TMP_12 = function(line){var self = TMP_12._s || this, $a;if (line == null) line = nil; - return (($a = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : $a)}, TMP_12._s = self, TMP_12), $b).call($c, $hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true}))); - continuation = "inactive"; - } else if (($b = ((($d = ((($e = this_line.$match($scope.REGEXP['$[]']("blk_title"))) !== false && $e !== nil) ? $e : this_line.$match($scope.REGEXP['$[]']("attr_line")))) !== false && $d !== nil) ? $d : this_line.$match($scope.REGEXP['$[]']("attr_entry")))) !== false && $b !== nil) { - buffer['$<<'](this_line) - } else { - if (($b = nested_list_type = ($d = ($e = ((function() {if (within_nested_list !== false && within_nested_list !== nil) { - return ["dlist"] - } else { - return $scope.NESTABLE_LIST_CONTEXTS - }; return nil; })())).$detect, $d._p = (TMP_13 = function(ctx){var self = TMP_13._s || this;if (ctx == null) ctx = nil; - return this_line.$match($scope.REGEXP['$[]'](ctx))}, TMP_13._s = self, TMP_13), $d).call($e)) !== false && $b !== nil) { - within_nested_list = true; - if (($b = (($d = nested_list_type['$==']("dlist")) ? $gvars["~"]['$[]'](3).$to_s()['$empty?']() : $d)) !== false && $b !== nil) { - has_text = false};}; - buffer['$<<'](this_line); - continuation = "inactive"; - } - } else if (($b = ($d = ($f = prev_line['$nil?'](), ($f === nil || $f === false)), $d !== false && $d !== nil ?prev_line['$empty?']() : $d)) !== false && $b !== nil) { - if (($b = this_line['$empty?']()) !== false && $b !== nil) { - reader.$skip_blank_lines(); - this_line = reader.$read_line(); - if (($b = ((($d = this_line['$nil?']()) !== false && $d !== nil) ? $d : self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) !== false && $b !== nil) { - break;};}; - if (this_line['$==']($scope.LIST_CONTINUATION)) { - detached_continuation = buffer.$size(); - buffer['$<<'](this_line); - } else if (has_text !== false && has_text !== nil) { - if (($b = self['$is_sibling_list_item?'](this_line, list_type, sibling_trait)) !== false && $b !== nil) { - break; - } else if (($b = nested_list_type = ($d = ($f = $scope.NESTABLE_LIST_CONTEXTS).$detect, $d._p = (TMP_14 = function(ctx){var self = TMP_14._s || this;if (ctx == null) ctx = nil; - return this_line.$match($scope.REGEXP['$[]'](ctx))}, TMP_14._s = self, TMP_14), $d).call($f)) !== false && $b !== nil) { - buffer['$<<'](this_line); - within_nested_list = true; - if (($b = (($d = nested_list_type['$==']("dlist")) ? $gvars["~"]['$[]'](3).$to_s()['$empty?']() : $d)) !== false && $b !== nil) { - has_text = false}; - } else if (($b = this_line.$match($scope.REGEXP['$[]']("lit_par"))) !== false && $b !== nil) { - reader.$unshift_line(this_line); - buffer.$concat(($b = ($d = reader).$read_lines_until, $b._p = (TMP_15 = function(line){var self = TMP_15._s || this, $a;if (line == null) line = nil; - return (($a = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : $a)}, TMP_15._s = self, TMP_15), $b).call($d, $hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true}))); - } else { - break; - } + if ((($a = (has_passthroughs = subs['$include?']("macros"))) !== nil && (!$a._isBoolean || $a == true))) { + text = self.$extract_passthroughs(text)}; + ($a = ($c = subs).$each, $a._p = (TMP_2 = function(type){var self = TMP_2._s || this, $a, $case = nil; +if (type == null) type = nil; + return (function() {$case = type;if ("specialcharacters"['$===']($case)) {return text = self.$sub_specialcharacters(text)}else if ("quotes"['$===']($case)) {return text = self.$sub_quotes(text)}else if ("attributes"['$===']($case)) {return text = self.$sub_attributes(text.$split($scope.EOL))['$*']($scope.EOL)}else if ("replacements"['$===']($case)) {return text = self.$sub_replacements(text)}else if ("macros"['$===']($case)) {return text = self.$sub_macros(text)}else if ("highlight"['$===']($case)) {return text = self.$highlight_source(text, (subs['$include?']("callouts")))}else if ("callouts"['$===']($case)) {if ((($a = subs['$include?']("highlight")) !== nil && (!$a._isBoolean || $a == true))) { + return nil } else { - if (($b = within_nested_list) === false || $b === nil) { - buffer.$pop()}; - buffer['$<<'](this_line); - has_text = true; - }; + return text = self.$sub_callouts(text) + }}else if ("post_replacements"['$===']($case)) {return text = self.$sub_post_replacements(text)}else {return self.$warn("asciidoctor: WARNING: unknown substitution type " + (type))}})()}, TMP_2._s = self, TMP_2), $a).call($c); + if (has_passthroughs !== false && has_passthroughs !== nil) { + text = self.$restore_passthroughs(text)}; + if (multiline !== false && multiline !== nil) { + return (text.$split($scope.EOL)) } else { - if (($b = ($g = this_line['$empty?'](), ($g === nil || $g === false))) !== false && $b !== nil) { - has_text = true}; - if (($b = nested_list_type = ($g = ($h = ((function() {if (within_nested_list !== false && within_nested_list !== nil) { - return ["dlist"] - } else { - return $scope.NESTABLE_LIST_CONTEXTS - }; return nil; })())).$detect, $g._p = (TMP_16 = function(ctx){var self = TMP_16._s || this;if (ctx == null) ctx = nil; - return this_line.$match($scope.REGEXP['$[]'](ctx))}, TMP_16._s = self, TMP_16), $g).call($h)) !== false && $b !== nil) { - within_nested_list = true; - if (($b = (($g = nested_list_type['$==']("dlist")) ? $gvars["~"]['$[]'](3).$to_s()['$empty?']() : $g)) !== false && $b !== nil) { - has_text = false};}; - buffer['$<<'](this_line); + return text }; - this_line = nil;}; - if (($a = ($b = this_line['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - reader.$unshift_line(this_line)}; - if (detached_continuation !== false && detached_continuation !== nil) { - buffer.$delete_at(detached_continuation)}; - while (($b = ($g = ($i = buffer['$empty?'](), ($i === nil || $i === false)), $g !== false && $g !== nil ?buffer.$last()['$empty?']() : $g)) !== false && $b !== nil) { - buffer.$pop()}; - if (($a = ($b = ($g = buffer['$empty?'](), ($g === nil || $g === false)), $b !== false && $b !== nil ?buffer.$last()['$==']($scope.LIST_CONTINUATION) : $b)) !== false && $a !== nil) { - buffer.$pop()}; - return buffer; - }); + }; - $opal.defs(self, '$initialize_section', function(reader, parent, attributes) { - var $a, $b, self = this, document = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, _ = nil, section = nil, id = nil; - if (attributes == null) { - attributes = $hash2([], {}) - } - document = parent.$document(); - $a = $opal.to_ary(self.$parse_section_title(reader, document)), sect_id = ($a[0] == null ? nil : $a[0]), sect_reftext = ($a[1] == null ? nil : $a[1]), sect_title = ($a[2] == null ? nil : $a[2]), sect_level = ($a[3] == null ? nil : $a[3]), _ = ($a[4] == null ? nil : $a[4]); - if (sect_reftext !== false && sect_reftext !== nil) { - attributes['$[]=']("reftext", sect_reftext)}; - section = $scope.Section.$new(parent, sect_level, document.$attributes()['$has_key?']("numbered")); - section['$id='](sect_id); - section['$title='](sect_title); - if (($a = attributes['$[]'](1)) !== false && $a !== nil) { - $a = $opal.to_ary(self.$parse_style_attribute(attributes, reader)), section['$sectname='](($a[0] == null ? nil : $a[0])), _ = ($a[1] == null ? nil : $a[1]); - section['$special='](true); - if (($a = (($b = section.$sectname()['$==']("abstract")) ? document.$doctype()['$==']("book") : $b)) !== false && $a !== nil) { - section['$sectname=']("sect1"); - section['$special='](false); - section['$level='](1);}; - } else if (($a = (($b = sect_title.$downcase()['$==']("synopsis")) ? document.$doctype()['$==']("manpage") : $b)) !== false && $a !== nil) { - section['$special='](true); - section['$sectname=']("synopsis"); - } else { - section['$sectname=']("sect" + (section.$level())) - }; - if (($a = ($b = section.$id()['$nil?'](), $b !== false && $b !== nil ?(id = attributes['$[]']("id")) : $b)) !== false && $a !== nil) { - section['$id='](id) + def.$apply_normal_subs = function(lines) { + var $a, $b, self = this; + + return self.$apply_subs((function() {if ((($a = lines['$is_a?']((($b = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + return (lines['$*']($scope.EOL)) } else { - ($a = section, ((($b = $a.$id()) !== false && $b !== nil) ? $b : $a['$id='](section.$generate_id()))) - }; - if (($a = section.$id()) !== false && $a !== nil) { - section.$document().$register("ids", [section.$id(), (((($a = attributes['$[]']("reftext")) !== false && $a !== nil) ? $a : section.$title()))])}; - section.$update_attributes(attributes); - reader.$skip_blank_lines(); - return section; - }); + return lines + }; return nil; })()); + }; - $opal.defs(self, '$section_level', function(line) { + def.$apply_title_subs = function(title) { var self = this; - return $scope.SECTION_LEVELS['$[]'](line['$[]']($range(0, 0, false))); - }); - $opal.defs(self, '$single_line_section_level', function(marker) { + return self.$apply_subs(title, $scope.SUBS['$[]']("title")); + }; + + def.$apply_header_subs = function(text) { var self = this; - return marker.$length()['$-'](1); - }); - $opal.defs(self, '$is_next_line_section?', function(reader, attributes) { - var $a, $b, $c, $d, self = this, val = nil, ord_0 = nil; - if (($a = ($b = ($c = ($d = ((val = attributes['$[]'](1)))['$nil?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?(((($d = ((ord_0 = val['$[]'](0).$ord()))['$=='](100)) !== false && $d !== nil) ? $d : ord_0['$=='](102))) : $c), $b !== false && $b !== nil ?(val.$match($scope.REGEXP['$[]']("section_float_style"))) : $b)) !== false && $a !== nil) { - return false}; - if (($a = ($b = reader['$has_more_lines?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - return false}; - if (($a = $scope.Compliance.$underline_style_section_titles()) !== false && $a !== nil) { - return ($a = self)['$is_section_title?'].apply($a, [].concat(reader.$peek_lines(2))) + return self.$apply_subs(text, $scope.SUBS['$[]']("header")); + }; + + def.$extract_passthroughs = function(text) { + var $a, $b, $c, TMP_3, TMP_4, $d, TMP_5, self = this; + + if ((($a = ((($b = ((($c = (text['$include?']("++"))) !== false && $c !== nil) ? $c : (text['$include?']("$$")))) !== false && $b !== nil) ? $b : (text['$include?']("ss:")))) !== nil && (!$a._isBoolean || $a == true))) { + text = ($a = ($b = text).$gsub, $a._p = (TMP_3 = function(){var self = TMP_3._s || this, $a, m = nil, subs = nil, index = nil; + if (self.passthroughs == null) self.passthroughs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + if ((($a = m['$[]'](4)['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + text = m['$[]'](2); + subs = ((function() {if (m['$[]'](1)['$==']("$$")) { + return ["specialcharacters"] + } else { + return [] + }; return nil; })()); + } else { + text = self.$unescape_brackets(m['$[]'](4)); + if ((($a = m['$[]'](3)['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + subs = [] + } else { + subs = self.$resolve_pass_subs(m['$[]'](3)) + }; + }; + self.passthroughs['$<<']($hash2(["text", "subs"], {"text": text, "subs": subs})); + index = self.passthroughs.$size()['$-'](1); + return "" + ($scope.PASS_START) + (index) + ($scope.PASS_END);}, TMP_3._s = self, TMP_3), $a).call($b, $scope.PassInlineMacroRx)}; + if ((($a = (text['$include?']("`"))) !== nil && (!$a._isBoolean || $a == true))) { + text = ($a = ($c = text).$gsub, $a._p = (TMP_4 = function(){var self = TMP_4._s || this, $a, $b, m = nil, unescaped_attrs = nil, attributes = nil, index = nil; + if (self.passthroughs == null) self.passthroughs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + m = $gvars["~"]; + if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if (m['$[]'](2)['$==']("")) { + m['$[]='](2, nil)}}; + unescaped_attrs = nil; + if ((($a = m['$[]'](3)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return (function() {if ((($a = m['$[]'](2)) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (m['$[]'](1)) + "[" + (m['$[]'](2)) + "]" + (m['$[]'](3)['$[]']($range(1, -1, false))) + } else { + return "" + (m['$[]'](1)) + (m['$[]'](3)['$[]']($range(1, -1, false))) + }; return nil; })(); + } else if ((($a = (($b = m['$[]'](1)['$==']("\\")) ? m['$[]'](2) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + unescaped_attrs = "[" + (m['$[]'](2)) + "]"}; + if ((($a = ($b = unescaped_attrs['$!'](), $b !== false && $b !== nil ?m['$[]'](2) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + attributes = self.$parse_attributes(m['$[]'](2)) + } else { + attributes = nil + }; + self.passthroughs['$<<']($hash2(["text", "subs", "attributes", "type"], {"text": m['$[]'](4), "subs": ["specialcharacters"], "attributes": attributes, "type": "monospaced"})); + index = self.passthroughs.$size()['$-'](1); + return "" + (((($a = unescaped_attrs) !== false && $a !== nil) ? $a : m['$[]'](1))) + ($scope.PASS_START) + (index) + ($scope.PASS_END);}, TMP_4._s = self, TMP_4), $a).call($c, $scope.PassInlineLiteralRx)}; + if ((($a = (text['$include?']("math:"))) !== nil && (!$a._isBoolean || $a == true))) { + text = ($a = ($d = text).$gsub, $a._p = (TMP_5 = function(){var self = TMP_5._s || this, $a, m = nil, type = nil, default_type = nil, subs = nil, index = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + type = m['$[]'](1).$to_sym(); + if (type['$==']("math")) { + type = ((function() {if ((($a = ((default_type = self.$document().$attributes()['$[]']("math")))['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "asciimath" + } else { + return default_type + }; return nil; })()).$to_sym()}; + text = self.$unescape_brackets(m['$[]'](3)); + if ((($a = m['$[]'](2)['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + subs = (function() {if ((($a = (self.document['$basebackend?']("html"))) !== nil && (!$a._isBoolean || $a == true))) { + return ["specialcharacters"] + } else { + return [] + }; return nil; })() + } else { + subs = self.$resolve_pass_subs(m['$[]'](2)) + }; + self.passthroughs['$<<']($hash2(["text", "subs", "type"], {"text": text, "subs": subs, "type": type})); + index = self.passthroughs.$size()['$-'](1); + return "" + ($scope.PASS_START) + (index) + ($scope.PASS_END);}, TMP_5._s = self, TMP_5), $a).call($d, $scope.MathInlineMacroRx)}; + return text; + }; + + def.$restore_passthroughs = function(text) { + var $a, $b, TMP_6, self = this; + if (self.passthroughs == null) self.passthroughs = nil; + + if ((($a = ((($b = self.passthroughs['$nil_or_empty?']()) !== false && $b !== nil) ? $b : text['$include?']($scope.PASS_START)['$!']())) !== nil && (!$a._isBoolean || $a == true))) { + return text}; + return ($a = ($b = text).$gsub, $a._p = (TMP_6 = function(){var self = TMP_6._s || this, $a, pass = nil, subbed_text = nil, subs = nil, type = nil; + if (self.passthroughs == null) self.passthroughs = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + pass = self.passthroughs['$[]']($gvars["~"]['$[]'](1).$to_i()); + subbed_text = (function() {if ((($a = (subs = pass['$[]']("subs"))) !== nil && (!$a._isBoolean || $a == true))) { + return (self.$apply_subs(pass['$[]']("text"), subs)) + } else { + return pass['$[]']("text") + }; return nil; })(); + if ((($a = (type = pass['$[]']("type"))) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.Inline.$new(self, "quoted", subbed_text, $hash2(["type", "attributes"], {"type": type, "attributes": pass['$[]']("attributes")})).$convert() + } else { + return subbed_text + };}, TMP_6._s = self, TMP_6), $a).call($b, $scope.PASS_MATCH); + }; + + def.$sub_specialcharacters = function(text) { + var $a, $b, TMP_7, self = this; + + if ((($a = $scope.SUPPORTS_GSUB_RESULT_HASH) !== nil && (!$a._isBoolean || $a == true))) { + return text.$gsub($scope.SPECIAL_CHARS_PATTERN, $scope.SPECIAL_CHARS) } else { - return self['$is_section_title?'](reader.$peek_line()) + return ($a = ($b = text).$gsub, $a._p = (TMP_7 = function(){var self = TMP_7._s || this; + if ($gvars["&"] == null) $gvars["&"] = nil; + + return $scope.SPECIAL_CHARS['$[]']($gvars["&"])}, TMP_7._s = self, TMP_7), $a).call($b, $scope.SPECIAL_CHARS_PATTERN) }; - }); + }; - $opal.defs(self, '$is_next_line_document_title?', function(reader, attributes) { - var self = this; - return self['$is_next_line_section?'](reader, attributes)['$=='](0); - }); + $opal.defn(self, '$sub_specialchars', def.$sub_specialcharacters); - $opal.defs(self, '$is_section_title?', function(line1, line2) { - var $a, $b, self = this, level = nil; - if (line2 == null) { - line2 = nil - } - if (($a = (level = self['$is_single_line_section_title?'](line1))) !== false && $a !== nil) { - return level - } else if (($a = (($b = line2 !== false && line2 !== nil) ? (level = self['$is_two_line_section_title?'](line1, line2)) : $b)) !== false && $a !== nil) { - return level + def.$sub_quotes = function(text) { + var $a, $b, TMP_8, $c, TMP_10, self = this, result = nil; + + if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== nil && (!$a._isBoolean || $a == true))) { + result = text; + ($a = ($b = $scope.QUOTE_SUBS).$each, $a._p = (TMP_8 = function(type, scope, pattern){var self = TMP_8._s || this, $a, $b, TMP_9; +if (type == null) type = nil;if (scope == null) scope = nil;if (pattern == null) pattern = nil; + return result = ($a = ($b = result).$gsub, $a._p = (TMP_9 = function(){var self = TMP_9._s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$convert_quoted_text($gvars["~"], type, scope)}, TMP_9._s = self, TMP_9), $a).call($b, pattern)}, TMP_8._s = self, TMP_8), $a).call($b); } else { - return false + result = "" + (text); + ($a = ($c = $scope.QUOTE_SUBS).$each, $a._p = (TMP_10 = function(type, scope, pattern){var self = TMP_10._s || this, $a, $b, TMP_11; +if (type == null) type = nil;if (scope == null) scope = nil;if (pattern == null) pattern = nil; + return ($a = ($b = result)['$gsub!'], $a._p = (TMP_11 = function(){var self = TMP_11._s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$convert_quoted_text($gvars["~"], type, scope)}, TMP_11._s = self, TMP_11), $a).call($b, pattern)}, TMP_10._s = self, TMP_10), $a).call($c); }; - }); + return result; + }; - $opal.defs(self, '$is_single_line_section_title?', function(line1) { - var $a, $b, $c, $d, self = this, first_char = nil, match = nil; - first_char = (function() {if (($a = line1['$nil?']()) !== false && $a !== nil) { - return nil - } else { - return line1['$[]']($range(0, 0, false)) - }; return nil; })(); - if (($a = ($b = (((($c = first_char['$==']("=")) !== false && $c !== nil) ? $c : (($d = $scope.Compliance.$markdown_syntax(), $d !== false && $d !== nil ?first_char['$==']("#") : $d)))), $b !== false && $b !== nil ?(match = line1.$match($scope.REGEXP['$[]']("section_title"))) : $b)) !== false && $a !== nil) { - return self.$single_line_section_level(match['$[]'](1)) - } else { - return false - }; - }); + def.$sub_replacements = function(text) { + var $a, $b, TMP_12, $c, TMP_14, self = this, result = nil; - $opal.defs(self, '$is_two_line_section_title?', function(line1, line2) { - var $a, $b, $c, $d, $e, $f, $g, self = this; - if (($a = ($b = ($c = ($d = ($e = ($f = ($g = line1['$nil?'](), ($g === nil || $g === false)), $f !== false && $f !== nil ?($g = line2['$nil?'](), ($g === nil || $g === false)) : $f), $e !== false && $e !== nil ?$scope.SECTION_LEVELS['$has_key?'](line2['$[]']($range(0, 0, false))) : $e), $d !== false && $d !== nil ?line2.$match($scope.REGEXP['$[]']("section_underline")) : $d), $c !== false && $c !== nil ?line1.$match($scope.REGEXP['$[]']("section_name")) : $c), $b !== false && $b !== nil ?(self.$line_length(line1)['$-'](self.$line_length(line2))).$abs()['$<='](1) : $b)) !== false && $a !== nil) { - return self.$section_level(line2) + if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== nil && (!$a._isBoolean || $a == true))) { + result = text; + ($a = ($b = $scope.REPLACEMENTS).$each, $a._p = (TMP_12 = function(pattern, replacement, restore){var self = TMP_12._s || this, $a, $b, TMP_13; +if (pattern == null) pattern = nil;if (replacement == null) replacement = nil;if (restore == null) restore = nil; + return result = ($a = ($b = result).$gsub, $a._p = (TMP_13 = function(){var self = TMP_13._s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_13._s = self, TMP_13), $a).call($b, pattern)}, TMP_12._s = self, TMP_12), $a).call($b); } else { - return false + result = "" + (text); + ($a = ($c = $scope.REPLACEMENTS).$each, $a._p = (TMP_14 = function(pattern, replacement, restore){var self = TMP_14._s || this, $a, $b, TMP_15; +if (pattern == null) pattern = nil;if (replacement == null) replacement = nil;if (restore == null) restore = nil; + return ($a = ($b = result)['$gsub!'], $a._p = (TMP_15 = function(){var self = TMP_15._s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; + + return self.$do_replacement($gvars["~"], replacement, restore)}, TMP_15._s = self, TMP_15), $a).call($b, pattern)}, TMP_14._s = self, TMP_14), $a).call($c); }; - }); + return result; + }; - $opal.defs(self, '$parse_section_title', function(reader, document) { - var $a, $b, $c, $d, $e, $f, self = this, line1 = nil, sect_id = nil, sect_title = nil, sect_level = nil, sect_reftext = nil, single_line = nil, first_char = nil, match = nil, anchor_match = nil, line2 = nil, name_match = nil; - line1 = reader.$read_line(); - sect_id = nil; - sect_title = nil; - sect_level = -1; - sect_reftext = nil; - single_line = true; - first_char = line1['$[]']($range(0, 0, false)); - if (($a = ($b = (((($c = first_char['$==']("=")) !== false && $c !== nil) ? $c : (($d = $scope.Compliance.$markdown_syntax(), $d !== false && $d !== nil ?first_char['$==']("#") : $d)))), $b !== false && $b !== nil ?(match = line1.$match($scope.REGEXP['$[]']("section_title"))) : $b)) !== false && $a !== nil) { - sect_level = self.$single_line_section_level(match['$[]'](1)); - sect_title = match['$[]'](2); - if (($a = ($b = (sect_title['$end_with?']("]]")), $b !== false && $b !== nil ?(anchor_match = (sect_title.$match($scope.REGEXP['$[]']("anchor_embedded")))) : $b)) !== false && $a !== nil) { - if (($a = anchor_match['$[]'](2)['$nil?']()) !== false && $a !== nil) { - sect_title = anchor_match['$[]'](1); - sect_id = anchor_match['$[]'](3); - sect_reftext = anchor_match['$[]'](4);}}; - } else if (($a = $scope.Compliance.$underline_style_section_titles()) !== false && $a !== nil) { - line2 = reader.$peek_line(true); - if (($a = ($b = ($c = ($d = ($e = ($f = line2['$nil?'](), ($f === nil || $f === false)), $e !== false && $e !== nil ?$scope.SECTION_LEVELS['$has_key?'](line2['$[]']($range(0, 0, false))) : $e), $d !== false && $d !== nil ?line2.$match($scope.REGEXP['$[]']("section_underline")) : $d), $c !== false && $c !== nil ?(name_match = line1.$match($scope.REGEXP['$[]']("section_name"))) : $c), $b !== false && $b !== nil ?(self.$line_length(line1)['$-'](self.$line_length(line2))).$abs()['$<='](1) : $b)) !== false && $a !== nil) { - sect_title = name_match['$[]'](1); - if (($a = ($b = (sect_title['$end_with?']("]]")), $b !== false && $b !== nil ?(anchor_match = (sect_title.$match($scope.REGEXP['$[]']("anchor_embedded")))) : $b)) !== false && $a !== nil) { - if (($a = anchor_match['$[]'](2)['$nil?']()) !== false && $a !== nil) { - sect_title = anchor_match['$[]'](1); - sect_id = anchor_match['$[]'](3); - sect_reftext = anchor_match['$[]'](4);}}; - sect_level = self.$section_level(line2); - single_line = false; - reader.$advance();};}; - if (sect_level['$>='](0)) { - sect_level = sect_level['$+'](document.$attr("leveloffset", 0).$to_i())}; - return [sect_id, sect_reftext, sect_title, sect_level, single_line]; - }); + def.$do_replacement = function(m, replacement, restore) { + var $a, self = this, matched = nil, $case = nil; - $opal.defs(self, '$line_length', function(line) { - var $a, self = this; - if (($a = $scope.FORCE_UNICODE_LINE_LENGTH) !== false && $a !== nil) { - return line.$scan(/./i).$length() + if ((($a = ((matched = m['$[]'](0)))['$include?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return matched.$tr("\\", "") } else { - return line.$length() + return (function() {$case = restore;if ("none"['$===']($case)) {return replacement}else if ("leading"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement)}else if ("bounding"['$===']($case)) {return "" + (m['$[]'](1)) + (replacement) + (m['$[]'](2))}else { return nil }})() }; - }); + }; - $opal.defs(self, '$parse_header_metadata', function(reader, document) { - var $a, $b, $c, TMP_17, $d, TMP_18, $e, self = this, metadata = nil, implicit_author = nil, implicit_authors = nil, author_metadata = nil, rev_metadata = nil, rev_line = nil, match = nil, author_line = nil, authors = nil, author_key = nil; - if (document == null) { - document = nil - } - self.$process_attribute_entries(reader, document); - metadata = $hash2([], {}); - implicit_author = nil; - implicit_authors = nil; - if (($a = ($b = reader['$has_more_lines?'](), $b !== false && $b !== nil ?($c = reader['$next_line_empty?'](), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - author_metadata = self.$process_authors(reader.$read_line()); - if (($a = author_metadata['$empty?']()) === false || $a === nil) { - if (($a = ($b = document['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - ($a = ($b = author_metadata).$each, $a._p = (TMP_17 = function(key, val){var self = TMP_17._s || this, $a;if (key == null) key = nil;if (val == null) val = nil; - if (($a = document.$attributes()['$has_key?'](key)) !== false && $a !== nil) { - return nil - } else { - return document.$attributes()['$[]='](key, ((function() {if (($a = (val['$is_a?']($scope.String))) !== false && $a !== nil) { - return document.$apply_header_subs(val) - } else { - return val - }; return nil; })())) - }}, TMP_17._s = self, TMP_17), $a).call($b); - implicit_author = document.$attributes()['$[]']("author"); - implicit_authors = document.$attributes()['$[]']("authors");}; - metadata = author_metadata;}; - self.$process_attribute_entries(reader, document); - rev_metadata = $hash2([], {}); - if (($a = ($c = reader['$has_more_lines?'](), $c !== false && $c !== nil ?($d = reader['$next_line_empty?'](), ($d === nil || $d === false)) : $c)) !== false && $a !== nil) { - rev_line = reader.$read_line(); - if (($a = match = rev_line.$match($scope.REGEXP['$[]']("revision_info"))) !== false && $a !== nil) { - rev_metadata['$[]=']("revdate", match['$[]'](2).$strip()); - if (($a = match['$[]'](1)['$nil?']()) === false || $a === nil) { - rev_metadata['$[]=']("revnumber", match['$[]'](1).$rstrip())}; - if (($a = match['$[]'](3)['$nil?']()) === false || $a === nil) { - rev_metadata['$[]=']("revremark", match['$[]'](3).$rstrip())}; - } else { - reader.$unshift_line(rev_line) - };}; - if (($a = rev_metadata['$empty?']()) === false || $a === nil) { - if (($a = ($c = document['$nil?'](), ($c === nil || $c === false))) !== false && $a !== nil) { - ($a = ($c = rev_metadata).$each, $a._p = (TMP_18 = function(key, val){var self = TMP_18._s || this, $a;if (key == null) key = nil;if (val == null) val = nil; - if (($a = document.$attributes()['$has_key?'](key)) !== false && $a !== nil) { - return nil - } else { - return document.$attributes()['$[]='](key, document.$apply_header_subs(val)) - }}, TMP_18._s = self, TMP_18), $a).call($c)}; - metadata.$update(rev_metadata);}; - self.$process_attribute_entries(reader, document); - reader.$skip_blank_lines();}; - if (($a = ($d = document['$nil?'](), ($d === nil || $d === false))) !== false && $a !== nil) { - author_metadata = nil; - if (($a = ($d = document.$attributes()['$has_key?']("author"), $d !== false && $d !== nil ?($e = ((author_line = document.$attributes()['$[]']("author")))['$=='](implicit_author), ($e === nil || $e === false)) : $d)) !== false && $a !== nil) { - author_metadata = self.$process_authors(author_line, true, false) - } else if (($a = ($d = document.$attributes()['$has_key?']("authors"), $d !== false && $d !== nil ?($e = ((author_line = document.$attributes()['$[]']("authors")))['$=='](implicit_authors), ($e === nil || $e === false)) : $d)) !== false && $a !== nil) { - author_metadata = self.$process_authors(author_line, true) - } else { - authors = []; - author_key = "author_" + (authors.$size()['$+'](1)); - while (($d = document.$attributes()['$has_key?'](author_key)) !== false && $d !== nil) { - authors['$<<'](document.$attributes()['$[]'](author_key)); - author_key = "author_" + (authors.$size()['$+'](1));}; - if (authors.$size()['$=='](1)) { - author_metadata = self.$process_authors(authors.$first(), true, false) - } else if (authors.$size()['$>'](1)) { - author_metadata = self.$process_authors(authors.$join("; "), true)}; - }; - if (($a = author_metadata['$nil?']()) === false || $a === nil) { - document.$attributes().$update(author_metadata); - if (($a = ($d = ($e = document.$attributes()['$has_key?']("email"), ($e === nil || $e === false)), $d !== false && $d !== nil ?document.$attributes()['$has_key?']("email_1") : $d)) !== false && $a !== nil) { - document.$attributes()['$[]=']("email", document.$attributes()['$[]']("email_1"))};};}; - return metadata; - }); + def.$sub_attributes = function(data, opts) { + var $a, $b, TMP_16, self = this, string_data = nil, lines = nil, result = nil; - $opal.defs(self, '$process_authors', function(author_line, names_only, multiple) { - var $a, $b, $c, TMP_19, self = this, author_metadata = nil, keys = nil, author_entries = nil; - if (names_only == null) { - names_only = false - } - if (multiple == null) { - multiple = true + if (opts == null) { + opts = $hash2([], {}) } - author_metadata = $hash2([], {}); - keys = ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]; - author_entries = (function() {if (multiple !== false && multiple !== nil) { - return ($a = ($b = (author_line.$split(";"))).$map, $a._p = "strip".$to_proc(), $a).call($b) + if ((($a = data['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return data}; + string_data = data['$is_a?']((($a = $opal.Object._scope.String) == null ? $opal.cm('String') : $a)); + lines = (function() {if (string_data !== false && string_data !== nil) { + return [data] } else { - return [author_line] + return data }; return nil; })(); - ($a = ($c = author_entries).$each_with_index, $a._p = (TMP_19 = function(author_entry, idx){var self = TMP_19._s || this, $a, $b, TMP_20, $c, TMP_21, $d, $e, TMP_22, key_map = nil, segments = nil, match = nil, fname = nil, mname = nil, lname = nil;if (author_entry == null) author_entry = nil;if (idx == null) idx = nil; - if (($a = author_entry['$empty?']()) !== false && $a !== nil) { - return nil;}; - key_map = $hash2([], {}); - if (($a = idx['$zero?']()) !== false && $a !== nil) { - ($a = ($b = keys).$each, $a._p = (TMP_20 = function(key){var self = TMP_20._s || this;if (key == null) key = nil; - return key_map['$[]='](key.$to_sym(), key)}, TMP_20._s = self, TMP_20), $a).call($b) - } else { - ($a = ($c = keys).$each, $a._p = (TMP_21 = function(key){var self = TMP_21._s || this;if (key == null) key = nil; - return key_map['$[]='](key.$to_sym(), "" + (key) + "_" + (idx['$+'](1)))}, TMP_21._s = self, TMP_21), $a).call($c) - }; - segments = nil; - if (names_only !== false && names_only !== nil) { - segments = author_entry.$split(" ", 3) - } else if (($a = (match = author_entry.$match($scope.REGEXP['$[]']("author_info")))) !== false && $a !== nil) { - segments = match.$to_a(); - segments.$shift();}; - if (($a = segments['$nil?']()) !== false && $a !== nil) { - author_metadata['$[]='](key_map['$[]']("author"), author_metadata['$[]='](key_map['$[]']("firstname"), fname = author_entry.$strip().$tr_s(" ", " "))); - author_metadata['$[]='](key_map['$[]']("authorinitials"), fname['$[]'](0, 1)); - } else { - author_metadata['$[]='](key_map['$[]']("firstname"), fname = segments['$[]'](0).$tr("_", " ")); - author_metadata['$[]='](key_map['$[]']("author"), fname); - author_metadata['$[]='](key_map['$[]']("authorinitials"), fname['$[]'](0, 1)); - if (($a = ($d = ($e = segments['$[]'](1)['$nil?'](), ($e === nil || $e === false)), $d !== false && $d !== nil ?($e = segments['$[]'](2)['$nil?'](), ($e === nil || $e === false)) : $d)) !== false && $a !== nil) { - author_metadata['$[]='](key_map['$[]']("middlename"), mname = segments['$[]'](1).$tr("_", " ")); - author_metadata['$[]='](key_map['$[]']("lastname"), lname = segments['$[]'](2).$tr("_", " ")); - author_metadata['$[]='](key_map['$[]']("author"), [fname, mname, lname].$join(" ")); - author_metadata['$[]='](key_map['$[]']("authorinitials"), [fname['$[]'](0, 1), mname['$[]'](0, 1), lname['$[]'](0, 1)].$join()); - } else if (($a = ($d = segments['$[]'](1)['$nil?'](), ($d === nil || $d === false))) !== false && $a !== nil) { - author_metadata['$[]='](key_map['$[]']("lastname"), lname = segments['$[]'](1).$tr("_", " ")); - author_metadata['$[]='](key_map['$[]']("author"), [fname, lname].$join(" ")); - author_metadata['$[]='](key_map['$[]']("authorinitials"), [fname['$[]'](0, 1), lname['$[]'](0, 1)].$join());}; - if (($a = ((($d = names_only) !== false && $d !== nil) ? $d : segments['$[]'](3)['$nil?']())) === false || $a === nil) { - author_metadata['$[]='](key_map['$[]']("email"), segments['$[]'](3))}; - }; - author_metadata['$[]=']("authorcount", idx['$+'](1)); - if (idx['$=='](1)) { - ($a = ($d = keys).$each, $a._p = (TMP_22 = function(key){var self = TMP_22._s || this, $a;if (key == null) key = nil; - if (($a = author_metadata['$has_key?'](key)) !== false && $a !== nil) { - return author_metadata['$[]=']("" + (key) + "_1", author_metadata['$[]'](key)) - } else { - return nil - }}, TMP_22._s = self, TMP_22), $a).call($d)}; - if (($a = idx['$zero?']()) !== false && $a !== nil) { - return author_metadata['$[]=']("authors", author_metadata['$[]'](key_map['$[]']("author"))) - } else { - return author_metadata['$[]=']("authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))) - };}, TMP_19._s = self, TMP_19), $a).call($c); - return author_metadata; - }); - - $opal.defs(self, '$parse_block_metadata_lines', function(reader, parent, attributes, options) { - var $a, $b, self = this; - if (attributes == null) { - attributes = $hash2([], {}) - } - if (options == null) { - options = $hash2([], {}) - } - while (($b = self.$parse_block_metadata_line(reader, parent, attributes, options)) !== false && $b !== nil) { - reader.$advance(); - reader.$skip_blank_lines();}; - return attributes; - }); - - $opal.defs(self, '$parse_block_metadata_line', function(reader, parent, attributes, options) { - var $a, $b, $c, self = this, next_line = nil, commentish = nil, match = nil, terminator = nil; - if (options == null) { - options = $hash2([], {}) - } - if (($a = ($b = reader['$has_more_lines?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - return false}; - next_line = reader.$peek_line(); - if (($a = ($b = (commentish = next_line['$start_with?']("//")), $b !== false && $b !== nil ?(match = next_line.$match($scope.REGEXP['$[]']("comment_blk"))) : $b)) !== false && $a !== nil) { - terminator = match['$[]'](0); - reader.$read_lines_until($hash2(["skip_first_line", "preserve_last_line", "terminator", "skip_processing"], {"skip_first_line": true, "preserve_last_line": true, "terminator": terminator, "skip_processing": true})); - } else if (($a = (($b = commentish !== false && commentish !== nil) ? next_line.$match($scope.REGEXP['$[]']("comment")) : $b)) === false || $a === nil) { - if (($a = ($b = ($c = options['$[]']("text"), ($c === nil || $c === false)), $b !== false && $b !== nil ?(match = next_line.$match($scope.REGEXP['$[]']("attr_entry"))) : $b)) !== false && $a !== nil) { - self.$process_attribute_entry(reader, parent, attributes, match) - } else if (($a = match = next_line.$match($scope.REGEXP['$[]']("anchor"))) !== false && $a !== nil) { - if (($a = match['$[]'](1)['$==']("")) === false || $a === nil) { - attributes['$[]=']("id", match['$[]'](1)); - if (($a = match['$[]'](2)['$nil?']()) === false || $a === nil) { - attributes['$[]=']("reftext", match['$[]'](2))};} - } else if (($a = match = next_line.$match($scope.REGEXP['$[]']("blk_attr_list"))) !== false && $a !== nil) { - parent.$document().$parse_attributes(match['$[]'](1), [], $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes})) - } else if (($a = ($b = ($c = options['$[]']("text"), ($c === nil || $c === false)), $b !== false && $b !== nil ?(match = next_line.$match($scope.REGEXP['$[]']("blk_title"))) : $b)) !== false && $a !== nil) { - attributes['$[]=']("title", match['$[]'](1)) - } else { - return false - }}; - return true; - }); + result = []; + ($a = ($b = lines).$each, $a._p = (TMP_16 = function(line){var self = TMP_16._s || this, $a, $b, TMP_17, $c, $d, reject = nil, reject_if_empty = nil; +if (line == null) line = nil; + reject = false; + reject_if_empty = false; + if ((($a = line['$include?']("{")) !== nil && (!$a._isBoolean || $a == true))) { + line = ($a = ($b = line).$gsub, $a._p = (TMP_17 = function(){var self = TMP_17._s || this, $a, $b, TMP_18, $c, TMP_19, m = nil, offset = nil, directive = nil, expr = nil, $case = nil, args = nil, _ = nil, value = nil, val = nil, key = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - $opal.defs(self, '$process_attribute_entries', function(reader, parent, attributes) { - var $a, $b, self = this; - if (attributes == null) { - attributes = nil - } - reader.$skip_comment_lines(); - while (($b = self.$process_attribute_entry(reader, parent, attributes)) !== false && $b !== nil) { - reader.$advance(); - reader.$skip_comment_lines();}; - }); + m = $gvars["~"]; + if ((($a = ((($b = m['$[]'](1)['$==']("\\")) !== false && $b !== nil) ? $b : m['$[]'](4)['$==']("\\"))) !== nil && (!$a._isBoolean || $a == true))) { + return "{" + (m['$[]'](2)) + "}" + } else if ((($a = m['$[]'](3)['$nil_or_empty?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + offset = ((directive = m['$[]'](3))).$length()['$+'](1); + expr = m['$[]'](2)['$[]']($range(offset, -1, false)); + return (function() {$case = directive;if ("set"['$===']($case)) {args = expr.$split(":"); + $a = $opal.to_ary($scope.Parser.$store_attribute(args['$[]'](0), ((($b = args['$[]'](1)) !== false && $b !== nil) ? $b : ""), self.document)), _ = ($a[0] == null ? nil : $a[0]), value = ($a[1] == null ? nil : $a[1]); + if (value !== false && value !== nil) { + } else if (self.document.$attributes().$fetch("attribute-undefined", $scope.Compliance.$attribute_undefined())['$==']("drop-line")) { + ($a = ($b = $scope.Debug).$debug, $a._p = (TMP_18 = function(){var self = TMP_18._s || this; + + return "Undefining attribute: " + (self.$key()) + ", line marked for removal"}, TMP_18._s = self, TMP_18), $a).call($b); + reject = true; + return ($breaker.$v = "", $breaker);}; + reject_if_empty = true; + return "";}else if ("counter"['$===']($case) || "counter2"['$===']($case)) {args = expr.$split(":"); + val = self.document.$counter(args['$[]'](0), args['$[]'](1)); + if (directive['$==']("counter2")) { + reject_if_empty = true; + return ""; + } else { + return val + };}else {self.$warn("asciidoctor: WARNING: illegal attribute directive: " + (m['$[]'](3))); + return m['$[]'](0);}})(); + } else if ((($a = ($c = (key = m['$[]'](2).$downcase()), $c !== false && $c !== nil ?(self.document.$attributes()['$has_key?'](key)) : $c)) !== nil && (!$a._isBoolean || $a == true))) { + return self.document.$attributes()['$[]'](key) + } else if ((($a = $scope.INTRINSIC_ATTRIBUTES['$has_key?'](key)) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.INTRINSIC_ATTRIBUTES['$[]'](key) + } else { + return (function() {$case = (((($a = opts['$[]']("attribute_missing")) !== false && $a !== nil) ? $a : self.document.$attributes().$fetch("attribute-missing", $scope.Compliance.$attribute_missing())));if ("skip"['$===']($case)) {return m['$[]'](0)}else if ("drop-line"['$===']($case)) {($a = ($c = $scope.Debug).$debug, $a._p = (TMP_19 = function(){var self = TMP_19._s || this; - $opal.defs(self, '$process_attribute_entry', function(reader, parent, attributes, match) { - var $a, $b, self = this, name = nil, value = nil, next_line = nil; - if (attributes == null) { - attributes = nil - } - if (match == null) { - match = nil - } - ((($a = match) !== false && $a !== nil) ? $a : match = (function() {if (($b = reader['$has_more_lines?']()) !== false && $b !== nil) { - return reader.$peek_line().$match($scope.REGEXP['$[]']("attr_entry")) - } else { - return nil - }; return nil; })()); - if (match !== false && match !== nil) { - name = match['$[]'](1); - value = (function() {if (($a = match['$[]'](2)['$nil?']()) !== false && $a !== nil) { - return "" - } else { - return match['$[]'](2) - }; return nil; })(); - if (($a = value['$end_with?']($scope.LINE_BREAK)) !== false && $a !== nil) { - value = value.$chop().$rstrip(); - while (($b = reader.$advance()) !== false && $b !== nil) { - next_line = reader.$peek_line().$strip(); - if (($b = next_line['$empty?']()) !== false && $b !== nil) { - break;}; - if (($b = next_line['$end_with?']($scope.LINE_BREAK)) !== false && $b !== nil) { - value = "" + (value) + " " + (next_line.$chop().$rstrip()) - } else { - value = "" + (value) + " " + (next_line); - break;; - };};}; - self.$store_attribute(name, value, (function() {if (($a = parent['$nil?']()) !== false && $a !== nil) { + return "Missing attribute: " + (key) + ", line marked for removal"}, TMP_19._s = self, TMP_19), $a).call($c); + reject = true; + return ($breaker.$v = "", $breaker);}else {reject_if_empty = true; + return "";}})() + };}, TMP_17._s = self, TMP_17), $a).call($b, $scope.AttributeReferenceRx)}; + if ((($a = ((($c = reject) !== false && $c !== nil) ? $c : ((($d = reject_if_empty !== false && reject_if_empty !== nil) ? line['$empty?']() : $d)))) !== nil && (!$a._isBoolean || $a == true))) { return nil } else { - return parent.$document() - }; return nil; })(), attributes); - return true; + return result['$<<'](line) + };}, TMP_16._s = self, TMP_16), $a).call($b); + if (string_data !== false && string_data !== nil) { + return (result['$*']($scope.EOL)) } else { - return false + return result }; - }); + }; - $opal.defs(self, '$store_attribute', function(name, value, doc, attrs) { - var $a, $b, $c, self = this, accessible = nil; - if (doc == null) { - doc = nil - } - if (attrs == null) { - attrs = nil - } - if (($a = name['$end_with?']("!")) !== false && $a !== nil) { - value = nil; - name = name.$chop(); - } else if (($a = name['$start_with?']("!")) !== false && $a !== nil) { - value = nil; - name = name['$[]']($range(1, -1, false));}; - name = self.$sanitize_attribute_name(name); - accessible = true; - if (($a = doc['$nil?']()) === false || $a === nil) { - accessible = (function() {if (($a = value['$nil?']()) !== false && $a !== nil) { - return doc.$delete_attribute(name) - } else { - return doc.$set_attribute(name, value) - }; return nil; })()}; - if (($a = ((($b = ($c = accessible, ($c === nil || $c === false))) !== false && $b !== nil) ? $b : attrs['$nil?']())) === false || $a === nil) { - ($scope.Document)._scope.AttributeEntry.$new(name, value).$save_to(attrs)}; - return [name, value]; - }); + def.$sub_macros = function(source) { + var $a, $b, $c, TMP_20, TMP_22, $d, TMP_24, $e, TMP_26, $f, $g, TMP_28, TMP_29, $h, TMP_30, $i, $j, TMP_31, TMP_32, $k, TMP_33, self = this, found = nil, found_colon = nil, use_link_attrs = nil, experimental = nil, result = nil, extensions = nil; + if (self.document == null) self.document = nil; - $opal.defs(self, '$resolve_list_marker', function(list_type, marker, ordinal, validate, reader) { - var $a, $b, $c, self = this; - if (ordinal == null) { - ordinal = 0 - } - if (validate == null) { - validate = false - } - if (reader == null) { - reader = nil - } - if (($a = (($b = list_type['$==']("olist")) ? ($c = marker['$start_with?']("."), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader) - } else if (list_type['$==']("colist")) { - return "<1>" - } else { - return marker - }; - }); + if ((($a = source['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return source}; + found = $hash2([], {}); + found['$[]=']("square_bracket", source['$include?']("[")); + found['$[]=']("round_bracket", source['$include?']("(")); + found['$[]=']("colon", found_colon = source['$include?'](":")); + found['$[]=']("macroish", (($a = found['$[]']("square_bracket"), $a !== false && $a !== nil ?found_colon : $a))); + found['$[]=']("macroish_short_form", (($a = ($b = found['$[]']("square_bracket"), $b !== false && $b !== nil ?found_colon : $b), $a !== false && $a !== nil ?source['$include?'](":[") : $a))); + use_link_attrs = self.document.$attributes()['$has_key?']("linkattrs"); + experimental = self.document.$attributes()['$has_key?']("experimental"); + result = "" + (source); + if (experimental !== false && experimental !== nil) { + if ((($a = ($b = found['$[]']("macroish_short_form"), $b !== false && $b !== nil ?(((($c = result['$include?']("kbd:")) !== false && $c !== nil) ? $c : result['$include?']("btn:"))) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($b = result).$gsub, $a._p = (TMP_20 = function(){var self = TMP_20._s || this, $a, $b, TMP_21, m = nil, captured = nil, keys = nil, label = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - $opal.defs(self, '$resolve_ordered_list_marker', function(marker, ordinal, validate, reader) { - var $a, $b, TMP_23, $c, $d, self = this, number_style = nil, expected = nil, actual = nil, $case = nil; - if (ordinal == null) { - ordinal = 0 - } - if (validate == null) { - validate = false - } - if (reader == null) { - reader = nil - } - number_style = ($a = ($b = $scope.ORDERED_LIST_STYLES).$detect, $a._p = (TMP_23 = function(s){var self = TMP_23._s || this;if (s == null) s = nil; - return marker.$match($scope.ORDERED_LIST_MARKER_PATTERNS['$[]'](s))}, TMP_23._s = self, TMP_23), $a).call($b); - expected = actual = nil; - $case = number_style;if ("arabic"['$===']($case)) {if (validate !== false && validate !== nil) { - expected = ordinal['$+'](1); - actual = marker.$to_i();}; - marker = "1.";}else if ("loweralpha"['$===']($case)) {if (validate !== false && validate !== nil) { - expected = ("a"['$[]'](0).$ord()['$+'](ordinal)).$chr(); - actual = marker.$chomp(".");}; - marker = "a.";}else if ("upperalpha"['$===']($case)) {if (validate !== false && validate !== nil) { - expected = ("A"['$[]'](0).$ord()['$+'](ordinal)).$chr(); - actual = marker.$chomp(".");}; - marker = "A.";}else if ("lowerroman"['$===']($case)) {if (validate !== false && validate !== nil) { - expected = ordinal['$+'](1); - actual = self.$roman_numeral_to_int(marker.$chomp(")"));}; - marker = "i)";}else if ("upperroman"['$===']($case)) {if (validate !== false && validate !== nil) { - expected = ordinal['$+'](1); - actual = self.$roman_numeral_to_int(marker.$chomp(")"));}; - marker = "I)";}; - if (($a = (($c = validate !== false && validate !== nil) ? ($d = expected['$=='](actual), ($d === nil || $d === false)) : $c)) !== false && $a !== nil) { - self.$warn("asciidoctor: WARNING: " + (reader.$line_info()) + ": list item index: expected " + (expected) + ", got " + (actual))}; - return marker; - }); + m = $gvars["~"]; + if ((($a = ((captured = m['$[]'](0)))['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return captured['$[]']($range(1, -1, false));}; + if ((($a = captured['$start_with?']("kbd")) !== nil && (!$a._isBoolean || $a == true))) { + keys = self.$unescape_bracketed_text(m['$[]'](1)); + if (keys['$==']("+")) { + keys = ["+"] + } else { + keys = ($a = ($b = keys.$split($scope.KbdDelimiterRx)).$inject, $a._p = (TMP_21 = function(c, key){var self = TMP_21._s || this, $a; +if (c == null) c = nil;if (key == null) key = nil; + if ((($a = key['$end_with?']("++")) !== nil && (!$a._isBoolean || $a == true))) { + c['$<<'](key['$[]']($range(0, -3, false)).$strip()); + c['$<<']("+"); + } else { + c['$<<'](key.$strip()) + }; + return c;}, TMP_21._s = self, TMP_21), $a).call($b, []) + }; + return $scope.Inline.$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$convert(); + } else if ((($a = captured['$start_with?']("btn")) !== nil && (!$a._isBoolean || $a == true))) { + label = self.$unescape_bracketed_text(m['$[]'](1)); + return $scope.Inline.$new(self, "button", label).$convert(); + } else { + return nil + };}, TMP_20._s = self, TMP_20), $a).call($b, $scope.KbdBtnInlineMacroRx)}; + if ((($a = ($c = found['$[]']("macroish"), $c !== false && $c !== nil ?result['$include?']("menu:") : $c)) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($c = result).$gsub, $a._p = (TMP_22 = function(){var self = TMP_22._s || this, $a, $b, TMP_23, m = nil, captured = nil, menu = nil, items = nil, submenus = nil, menuitem = nil, delim = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - $opal.defs(self, '$is_sibling_list_item?', function(line, list_type, sibling_trait) { - var $a, self = this, matcher = nil, expected_marker = nil, m = nil; - if (($a = sibling_trait['$is_a?']($scope.Regexp)) !== false && $a !== nil) { - matcher = sibling_trait; - expected_marker = false; - } else { - matcher = $scope.REGEXP['$[]'](list_type); - expected_marker = sibling_trait; - }; - if (($a = m = line.$match(matcher)) !== false && $a !== nil) { - if (expected_marker !== false && expected_marker !== nil) { - return expected_marker['$=='](self.$resolve_list_marker(list_type, m['$[]'](1))) - } else { - return true - } - } else { - return false - }; - }); + m = $gvars["~"]; + if ((($a = ((captured = m['$[]'](0)))['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return captured['$[]']($range(1, -1, false));}; + menu = m['$[]'](1); + items = m['$[]'](2); + if ((($a = items['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + submenus = []; + menuitem = nil; + } else if ((($a = (delim = (function() {if ((($b = items['$include?'](">")) !== nil && (!$b._isBoolean || $b == true))) { + return ">" + } else { + return ((function() {if ((($b = items['$include?'](",")) !== nil && (!$b._isBoolean || $b == true))) { + return "," + } else { + return nil + }; return nil; })()) + }; return nil; })())) !== nil && (!$a._isBoolean || $a == true))) { + submenus = ($a = ($b = items.$split(delim)).$map, $a._p = (TMP_23 = function(it){var self = TMP_23._s || this; +if (it == null) it = nil; + return it.$strip()}, TMP_23._s = self, TMP_23), $a).call($b); + menuitem = submenus.$pop(); + } else { + submenus = []; + menuitem = items.$rstrip(); + }; + return $scope.Inline.$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_22._s = self, TMP_22), $a).call($c, $scope.MenuInlineMacroRx)}; + if ((($a = ($d = result['$include?']("\""), $d !== false && $d !== nil ?result['$include?'](">") : $d)) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($d = result).$gsub, $a._p = (TMP_24 = function(){var self = TMP_24._s || this, $a, $b, $c, TMP_25, m = nil, captured = nil, input = nil, menu = nil, submenus = nil, menuitem = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - $opal.defs(self, '$next_table', function(table_reader, parent, attributes) { - var $a, $b, $c, $d, $e, $f, TMP_24, self = this, table = nil, explicit_col_specs = nil, skipped = nil, parser_ctx = nil, loop_idx = nil, line = nil, next_line = nil, next_cell_spec = nil, seen = nil, m = nil, cell_text = nil, even_width = nil; - table = $scope.Table.$new(parent, attributes); - if (($a = attributes['$has_key?']("title")) !== false && $a !== nil) { - table['$title='](attributes.$delete("title"))}; - table.$assign_caption(attributes.$delete("caption")); - if (($a = attributes['$has_key?']("cols")) !== false && $a !== nil) { - table.$create_columns(self.$parse_col_specs(attributes['$[]']("cols"))); - explicit_col_specs = true; - } else { - explicit_col_specs = false - }; - skipped = table_reader.$skip_blank_lines(); - parser_ctx = ($scope.Table)._scope.ParserContext.$new(table_reader, table, attributes); - loop_idx = -1; - while (($b = table_reader['$has_more_lines?']()) !== false && $b !== nil) { - loop_idx = loop_idx['$+'](1); - line = table_reader.$read_line(); - if (($b = ($c = ($d = ($e = (($f = skipped['$=='](0)) ? loop_idx['$zero?']() : $f), $e !== false && $e !== nil ?($f = attributes['$has_key?']("options"), ($f === nil || $f === false)) : $e), $d !== false && $d !== nil ?($e = ((next_line = table_reader.$peek_line()))['$nil?'](), ($e === nil || $e === false)) : $d), $c !== false && $c !== nil ?next_line['$empty?']() : $c)) !== false && $b !== nil) { - table['$has_header_option='](true); - table.$set_option("header");}; - if (parser_ctx.$format()['$==']("psv")) { - if (($b = parser_ctx['$starts_with_delimiter?'](line)) !== false && $b !== nil) { - line = line['$[]']($range(1, -1, false)); - parser_ctx.$close_open_cell(); - } else { - $b = $opal.to_ary(self.$parse_cell_spec(line, "start")), next_cell_spec = ($b[0] == null ? nil : $b[0]), line = ($b[1] == null ? nil : $b[1]); - if (($b = ($c = next_cell_spec['$nil?'](), ($c === nil || $c === false))) !== false && $b !== nil) { - parser_ctx.$close_open_cell(next_cell_spec)}; - }}; - seen = false; - while (($c = ((($d = ($e = seen, ($e === nil || $e === false))) !== false && $d !== nil) ? $d : ($e = line['$empty?'](), ($e === nil || $e === false)))) !== false && $c !== nil) { - seen = true; - if (($c = m = parser_ctx.$match_delimiter(line)) !== false && $c !== nil) { - if (parser_ctx.$format()['$==']("csv")) { - if (($c = parser_ctx['$buffer_has_unclosed_quotes?'](m.$pre_match())) !== false && $c !== nil) { - line = parser_ctx.$skip_matched_delimiter(m); - continue;;} - } else if (($c = m.$pre_match()['$end_with?']("\\")) !== false && $c !== nil) { - line = parser_ctx.$skip_matched_delimiter(m, true); - continue;;}; - if (parser_ctx.$format()['$==']("psv")) { - $c = $opal.to_ary(self.$parse_cell_spec(m.$pre_match(), "end")), next_cell_spec = ($c[0] == null ? nil : $c[0]), cell_text = ($c[1] == null ? nil : $c[1]); - parser_ctx.$push_cell_spec(next_cell_spec); - parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (cell_text)); - } else { - parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (m.$pre_match())) - }; - line = m.$post_match(); - parser_ctx.$close_cell(); - } else { - parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (line) + ($scope.EOL)); - if (parser_ctx.$format()['$==']("csv")) { - parser_ctx['$buffer=']("" + (parser_ctx.$buffer().$rstrip()) + " ")}; - line = ""; - if (($c = ((($d = parser_ctx.$format()['$==']("psv")) !== false && $d !== nil) ? $d : ((($e = parser_ctx.$format()['$==']("csv")) ? parser_ctx['$buffer_has_unclosed_quotes?']() : $e)))) !== false && $c !== nil) { - parser_ctx.$keep_cell_open() - } else { - parser_ctx.$close_cell(true) - }; - };}; - if (($b = parser_ctx['$cell_open?']()) === false || $b === nil) { - skipped = table_reader.$skip_blank_lines()}; - if (($b = ($c = table_reader['$has_more_lines?'](), ($c === nil || $c === false))) !== false && $b !== nil) { - parser_ctx.$close_cell(true)};}; - ($a = "colcount", $b = table.$attributes(), ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, parser_ctx.$col_count()))); - if (($a = ($b = explicit_col_specs, ($b === nil || $b === false))) !== false && $a !== nil) { - even_width = ((100.0)['$/'](parser_ctx.$col_count())).$floor(); - ($a = ($b = table.$columns()).$each, $a._p = (TMP_24 = function(c){var self = TMP_24._s || this;if (c == null) c = nil; - return c.$assign_width(0, even_width)}, TMP_24._s = self, TMP_24), $a).call($b);}; - table.$partition_header_footer(attributes); - return table; - }); + m = $gvars["~"]; + if ((($a = ((captured = m['$[]'](0)))['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return captured['$[]']($range(1, -1, false));}; + input = m['$[]'](1); + $a = $opal.to_ary(($b = ($c = input.$split(">")).$map, $b._p = (TMP_25 = function(it){var self = TMP_25._s || this; +if (it == null) it = nil; + return it.$strip()}, TMP_25._s = self, TMP_25), $b).call($c)), menu = ($a[0] == null ? nil : $a[0]), submenus = $slice.call($a, 1); + menuitem = submenus.$pop(); + return $scope.Inline.$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, TMP_24._s = self, TMP_24), $a).call($d, $scope.MenuInlineRx)};}; + if ((($a = ($e = (extensions = self.document.$extensions()), $e !== false && $e !== nil ?extensions['$inline_macros?']() : $e)) !== nil && (!$a._isBoolean || $a == true))) { + ($a = ($e = extensions.$inline_macros()).$each, $a._p = (TMP_26 = function(extension){var self = TMP_26._s || this, $a, $b, TMP_27; +if (extension == null) extension = nil; + return result = ($a = ($b = result).$gsub, $a._p = (TMP_27 = function(){var self = TMP_27._s || this, $a, m = nil, target = nil, attributes = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - $opal.defs(self, '$parse_col_specs', function(records) { - var $a, $b, TMP_25, $c, TMP_26, self = this, specs = nil, m = nil; - specs = []; - if (($a = m = records.$match($scope.REGEXP['$[]']("digits"))) !== false && $a !== nil) { - ($a = ($b = (1)).$upto, $a._p = (TMP_25 = function(){var self = TMP_25._s || this; - return specs['$<<']($hash2(["width"], {"width": 1}))}, TMP_25._s = self, TMP_25), $a).call($b, m['$[]'](0).$to_i()); - return specs;}; - ($a = ($c = records.$split(",")).$each, $a._p = (TMP_26 = function(record){var self = TMP_26._s || this, $a, $b, $c, TMP_27, spec = nil, colspec = nil, rowspec = nil, repeat = nil;if (record == null) record = nil; - if (($a = m = record.$match($scope.REGEXP['$[]']("table_colspec"))) !== false && $a !== nil) { - spec = $hash2([], {}); - if (($a = m['$[]'](2)) !== false && $a !== nil) { - $a = $opal.to_ary(m['$[]'](2).$split(".")), colspec = ($a[0] == null ? nil : $a[0]), rowspec = ($a[1] == null ? nil : $a[1]); - if (($a = ($b = ($c = colspec.$to_s()['$empty?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?($scope.Table)._scope.ALIGNMENTS['$[]']("h")['$has_key?'](colspec) : $b)) !== false && $a !== nil) { - spec['$[]=']("halign", ($scope.Table)._scope.ALIGNMENTS['$[]']("h")['$[]'](colspec))}; - if (($a = ($b = ($c = rowspec.$to_s()['$empty?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?($scope.Table)._scope.ALIGNMENTS['$[]']("v")['$has_key?'](rowspec) : $b)) !== false && $a !== nil) { - spec['$[]=']("valign", ($scope.Table)._scope.ALIGNMENTS['$[]']("v")['$[]'](rowspec))};}; - spec['$[]=']("width", (function() {if (($a = ($b = m['$[]'](3)['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - return m['$[]'](3).$to_i() + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + target = m['$[]'](1); + attributes = (function() {if (extension.$config()['$[]']("format")['$==']("short")) { + return $hash2([], {}) + } else if (extension.$config()['$[]']("content_model")['$==']("attributes")) { + return self.$parse_attributes(m['$[]'](2), (((($a = extension.$config()['$[]']("pos_attrs")) !== false && $a !== nil) ? $a : [])), $hash2(["sub_input", "unescape_input"], {"sub_input": true, "unescape_input": true})) + } else { + return $hash2(["text"], {"text": (self.$unescape_bracketed_text(m['$[]'](2)))}) + }; return nil; })(); + return extension.$process_method()['$[]'](self, target, attributes);}, TMP_27._s = self, TMP_27), $a).call($b, extension.$config()['$[]']("regexp"))}, TMP_26._s = self, TMP_26), $a).call($e)}; + if ((($a = ($f = found['$[]']("macroish"), $f !== false && $f !== nil ?(((($g = result['$include?']("image:")) !== false && $g !== nil) ? $g : result['$include?']("icon:"))) : $f)) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($f = result).$gsub, $a._p = (TMP_28 = function(){var self = TMP_28._s || this, $a, $b, $c, m = nil, raw_attrs = nil, type = nil, posattrs = nil, target = nil, attrs = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + raw_attrs = self.$unescape_bracketed_text(m['$[]'](2)); + if ((($a = m['$[]'](0)['$start_with?']("icon:")) !== nil && (!$a._isBoolean || $a == true))) { + type = "icon"; + posattrs = ["size"]; } else { - return 1 - }; return nil; })()); - if (($a = ($b = m['$[]'](4), $b !== false && $b !== nil ?($scope.Table)._scope.TEXT_STYLES['$has_key?'](m['$[]'](4)) : $b)) !== false && $a !== nil) { - spec['$[]=']("style", ($scope.Table)._scope.TEXT_STYLES['$[]'](m['$[]'](4)))}; - repeat = (function() {if (($a = ($b = m['$[]'](1)['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - return m['$[]'](1).$to_i() + type = "image"; + posattrs = ["alt", "width", "height"]; + }; + target = self.$sub_attributes(m['$[]'](1)); + if (type['$==']("icon")) { } else { - return 1 - }; return nil; })(); - return ($a = ($b = (1)).$upto, $a._p = (TMP_27 = function(){var self = TMP_27._s || this; - return specs['$<<'](spec.$dup())}, TMP_27._s = self, TMP_27), $a).call($b, repeat); - } else { - return nil - }}, TMP_26._s = self, TMP_26), $a).call($c); - return specs; - }); + self.document.$register("images", target) + }; + attrs = self.$parse_attributes(raw_attrs, posattrs); + ($a = "alt", $b = attrs, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, $scope.File.$basename(target, $scope.File.$extname(target))))); + return $scope.Inline.$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$convert();}, TMP_28._s = self, TMP_28), $a).call($f, $scope.ImageInlineMacroRx)}; + if ((($a = ((($g = found['$[]']("macroish_short_form")) !== false && $g !== nil) ? $g : found['$[]']("round_bracket"))) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($g = result).$gsub, $a._p = (TMP_29 = function(){var self = TMP_29._s || this, $a, $b, m = nil, num_brackets = nil, text_in_brackets = nil, macro_name = nil, terms = nil, text = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - $opal.defs(self, '$parse_cell_spec', function(line, pos) { - var $a, $b, $c, self = this, spec = nil, rest = nil, m = nil, colspec = nil, rowspec = nil; - if (pos == null) { - pos = "start" - } - spec = ((function() {if (pos['$==']("end")) { - return $hash2([], {}) - } else { - return nil - }; return nil; })()); - rest = line; - if (($a = m = line.$match($scope.REGEXP['$[]']("table_cellspec")['$[]'](pos))) !== false && $a !== nil) { - spec = $hash2([], {}); - if (($a = m['$[]'](0)['$empty?']()) !== false && $a !== nil) { - return [spec, line]}; - rest = ((function() {if (pos['$==']("start")) { - return m.$post_match() - } else { - return m.$pre_match() - }; return nil; })()); - if (($a = m['$[]'](1)) !== false && $a !== nil) { - $a = $opal.to_ary(m['$[]'](1).$split(".")), colspec = ($a[0] == null ? nil : $a[0]), rowspec = ($a[1] == null ? nil : $a[1]); - colspec = (function() {if (($a = colspec.$to_s()['$empty?']()) !== false && $a !== nil) { - return 1 + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if (m['$[]'](1)['$==']("")) { + m['$[]='](1, nil)}}; + num_brackets = 0; + text_in_brackets = nil; + if ((($a = (macro_name = m['$[]'](1))) !== nil && (!$a._isBoolean || $a == true))) { } else { - return colspec.$to_i() - }; return nil; })(); - rowspec = (function() {if (($a = rowspec.$to_s()['$empty?']()) !== false && $a !== nil) { - return 1 + text_in_brackets = m['$[]'](3); + if ((($a = ($b = (text_in_brackets['$start_with?']("(")), $b !== false && $b !== nil ?(text_in_brackets['$end_with?'](")")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + text_in_brackets = text_in_brackets['$[]']($range(1, -1, true)); + num_brackets = 3; + } else { + num_brackets = 2 + }; + }; + if ((($a = ((($b = macro_name['$==']("indexterm")) !== false && $b !== nil) ? $b : num_brackets['$=='](3))) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = macro_name['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + terms = self.$split_simple_csv(self.$normalize_string(text_in_brackets)) + } else { + terms = self.$split_simple_csv(self.$normalize_string(m['$[]'](2), true)) + }; + self.document.$register("indexterms", [].concat(terms)); + return $scope.Inline.$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": $hash2(["terms"], {"terms": terms})})).$convert(); } else { - return rowspec.$to_i() - }; return nil; })(); - if (m['$[]'](2)['$==']("+")) { - if (($a = colspec['$=='](1)) === false || $a === nil) { - spec['$[]=']("colspan", colspec)}; - if (($a = rowspec['$=='](1)) === false || $a === nil) { - spec['$[]=']("rowspan", rowspec)}; - } else if (m['$[]'](2)['$==']("*")) { - if (($a = colspec['$=='](1)) === false || $a === nil) { - spec['$[]=']("repeatcol", colspec)}};}; - if (($a = m['$[]'](3)) !== false && $a !== nil) { - $a = $opal.to_ary(m['$[]'](3).$split(".")), colspec = ($a[0] == null ? nil : $a[0]), rowspec = ($a[1] == null ? nil : $a[1]); - if (($a = ($b = ($c = colspec.$to_s()['$empty?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?($scope.Table)._scope.ALIGNMENTS['$[]']("h")['$has_key?'](colspec) : $b)) !== false && $a !== nil) { - spec['$[]=']("halign", ($scope.Table)._scope.ALIGNMENTS['$[]']("h")['$[]'](colspec))}; - if (($a = ($b = ($c = rowspec.$to_s()['$empty?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?($scope.Table)._scope.ALIGNMENTS['$[]']("v")['$has_key?'](rowspec) : $b)) !== false && $a !== nil) { - spec['$[]=']("valign", ($scope.Table)._scope.ALIGNMENTS['$[]']("v")['$[]'](rowspec))};}; - if (($a = ($b = m['$[]'](4), $b !== false && $b !== nil ?($scope.Table)._scope.TEXT_STYLES['$has_key?'](m['$[]'](4)) : $b)) !== false && $a !== nil) { - spec['$[]=']("style", ($scope.Table)._scope.TEXT_STYLES['$[]'](m['$[]'](4)))};}; - return [spec, rest]; - }); + if ((($a = macro_name['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + text = self.$normalize_string(text_in_brackets) + } else { + text = self.$normalize_string(m['$[]'](2), true) + }; + self.document.$register("indexterms", [text]); + return $scope.Inline.$new(self, "indexterm", text, $hash2(["type"], {"type": "visible"})).$convert(); + };}, TMP_29._s = self, TMP_29), $a).call($g, $scope.IndextermInlineMacroRx)}; + if ((($a = (($h = found_colon !== false && found_colon !== nil) ? (result['$include?']("://")) : $h)) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($h = result).$gsub, $a._p = (TMP_30 = function(){var self = TMP_30._s || this, $a, $b, $c, m = nil, prefix = nil, target = nil, suffix = nil, $case = nil, attrs = nil, text = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - $opal.defs(self, '$parse_style_attribute', function(attributes, reader) { - var $a, $b, $c, TMP_28, TMP_29, $d, TMP_30, self = this, original_style = nil, raw_style = nil, type = nil, collector = nil, parsed = nil, save_current = nil, parsed_style = nil, options = nil, existing_opts = nil; - if (reader == null) { - reader = nil - } - original_style = attributes['$[]']("style"); - raw_style = attributes['$[]'](1); - if (($a = ((($b = ($c = raw_style, ($c === nil || $c === false))) !== false && $b !== nil) ? $b : raw_style['$include?'](" "))) !== false && $a !== nil) { - attributes['$[]=']("style", raw_style); - return [raw_style, original_style]; - } else { - type = "style"; - collector = []; - parsed = $hash2([], {}); - save_current = ($a = ($b = self).$lambda, $a._p = (TMP_28 = function(){var self = TMP_28._s || this, $a, $b, $c, $case = nil; - if (($a = collector['$empty?']()) !== false && $a !== nil) { - if (($a = ($b = type['$==']("style"), ($b === nil || $b === false))) !== false && $a !== nil) { - return self.$warn("asciidoctor: WARNING:" + ((function() {if (($a = reader['$nil?']()) !== false && $a !== nil) { - return nil - } else { - return " " + (reader.$prev_line_info()) + ":" - }; return nil; })()) + " invalid empty " + (type) + " detected in style attribute") + m = $gvars["~"]; + if ((($a = m['$[]'](2)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (m['$[]'](1)) + (m['$[]'](2)['$[]']($range(1, -1, false))) + (m['$[]'](3));}; + if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if (m['$[]'](3)['$==']("")) { + m['$[]='](3, nil)}}; + if ((($a = (($b = m['$[]'](1)['$==']("link:")) ? m['$[]'](3)['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0);}; + prefix = ((function() {if ((($a = m['$[]'](1)['$==']("link:")['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](1) + } else { + return "" + }; return nil; })()); + target = m['$[]'](2); + suffix = ""; + if ((($a = ((($b = m['$[]'](3)) !== false && $b !== nil) ? $b : ($c = target['$=~']($scope.UriTerminator), ($c === nil || $c === false)))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + $case = $gvars["~"]['$[]'](0);if (")"['$===']($case)) {target = target['$[]']($range(0, -2, false)); + suffix = ")";}else if (";"['$===']($case)) {if ((($a = ($b = prefix['$start_with?']("<"), $b !== false && $b !== nil ?target['$end_with?'](">") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + prefix = prefix['$[]']($range(4, -1, false)); + target = target['$[]']($range(0, -5, false)); + } else if ((($a = target['$end_with?'](");")) !== nil && (!$a._isBoolean || $a == true))) { + target = target['$[]']($range(0, -3, false)); + suffix = ");"; } else { - return nil - } + target = target['$[]']($range(0, -2, false)); + suffix = ";"; + }}else if (":"['$===']($case)) {if ((($a = target['$end_with?']("):")) !== nil && (!$a._isBoolean || $a == true))) { + target = target['$[]']($range(0, -3, false)); + suffix = "):"; + } else { + target = target['$[]']($range(0, -2, false)); + suffix = ":"; + }} + }; + self.document.$register("links", target); + attrs = nil; + if ((($a = m['$[]'](3)['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + text = "" } else { - $case = type;if ("role"['$===']($case) || "option"['$===']($case)) {($a = type, $b = parsed, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, []))); - parsed['$[]'](type).$push(collector.$join());}else if ("id"['$===']($case)) {if (($a = parsed['$has_key?']("id")) !== false && $a !== nil) { - self.$warn("asciidoctor: WARNING:" + ((function() {if (($a = reader['$nil?']()) !== false && $a !== nil) { - return nil + if ((($a = (($b = use_link_attrs !== false && use_link_attrs !== nil) ? (((($c = m['$[]'](3)['$start_with?']("\"")) !== false && $c !== nil) ? $c : m['$[]'](3)['$include?'](","))) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + attrs = self.$parse_attributes(self.$sub_attributes(m['$[]'](3).$gsub("\\]", "]")), []); + text = attrs['$[]'](1); + } else { + text = self.$sub_attributes(m['$[]'](3).$gsub("\\]", "]")) + }; + if ((($a = text['$end_with?']("^")) !== nil && (!$a._isBoolean || $a == true))) { + text = text.$chop(); + ((($a = attrs) !== false && $a !== nil) ? $a : attrs = $hash2([], {})); + if ((($a = attrs['$has_key?']("window")) !== nil && (!$a._isBoolean || $a == true))) { } else { - return " " + (reader.$prev_line_info()) + ":" - }; return nil; })()) + " multiple ids detected in style attribute")}; - parsed['$[]='](type, collector.$join());}else {parsed['$[]='](type, collector.$join())}; - return collector = []; - }}, TMP_28._s = self, TMP_28), $a).call($b); - ($a = ($c = raw_style).$each_char, $a._p = (TMP_29 = function(c){var self = TMP_29._s || this, $a, $b, $c, $case = nil;if (c == null) c = nil; - if (($a = ((($b = ((($c = c['$=='](".")) !== false && $c !== nil) ? $c : c['$==']("#"))) !== false && $b !== nil) ? $b : c['$==']("%"))) !== false && $a !== nil) { - save_current.$call(); - return (function() {$case = c;if ("."['$===']($case)) {return type = "role"}else if ("#"['$===']($case)) {return type = "id"}else if ("%"['$===']($case)) {return type = "option"}else { return nil }})(); + attrs['$[]=']("window", "_blank") + };}; + }; + if ((($a = text['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = self.document['$attr?']("hide-uri-scheme")) !== nil && (!$a._isBoolean || $a == true))) { + text = target.$sub($scope.UriSniffRx, "") + } else { + text = target + }}; + return "" + (prefix) + ($scope.Inline.$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "link", "target": target, "attributes": attrs})).$convert()) + (suffix);}, TMP_30._s = self, TMP_30), $a).call($h, $scope.LinkInlineRx)}; + if ((($a = ((($i = ($j = found['$[]']("macroish"), $j !== false && $j !== nil ?(result['$include?']("link:")) : $j)) !== false && $i !== nil) ? $i : (result['$include?']("mailto:")))) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($i = result).$gsub, $a._p = (TMP_31 = function(){var self = TMP_31._s || this, $a, $b, $c, m = nil, raw_target = nil, mailto = nil, target = nil, attrs = nil, text = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + raw_target = m['$[]'](1); + mailto = m['$[]'](0)['$start_with?']("mailto:"); + target = (function() {if (mailto !== false && mailto !== nil) { + return "mailto:" + (raw_target) } else { - return collector.$push(c) - }}, TMP_29._s = self, TMP_29), $a).call($c); - if (type['$==']("style")) { - parsed_style = attributes['$[]=']("style", raw_style) - } else { - save_current.$call(); - if (($a = parsed['$has_key?']("style")) !== false && $a !== nil) { - parsed_style = attributes['$[]=']("style", parsed['$[]']("style")) + return raw_target + }; return nil; })(); + attrs = nil; + if ((($a = (($b = use_link_attrs !== false && use_link_attrs !== nil) ? (((($c = m['$[]'](2)['$start_with?']("\"")) !== false && $c !== nil) ? $c : m['$[]'](2)['$include?'](","))) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + attrs = self.$parse_attributes(self.$sub_attributes(m['$[]'](2).$gsub("\\]", "]")), []); + text = attrs['$[]'](1); + if (mailto !== false && mailto !== nil) { + if ((($a = attrs['$has_key?'](2)) !== nil && (!$a._isBoolean || $a == true))) { + target = "" + (target) + "?subject=" + ($scope.Helpers.$encode_uri(attrs['$[]'](2))); + if ((($a = attrs['$has_key?'](3)) !== nil && (!$a._isBoolean || $a == true))) { + target = "" + (target) + "&body=" + ($scope.Helpers.$encode_uri(attrs['$[]'](3)))};}}; } else { - parsed_style = nil + text = self.$sub_attributes(m['$[]'](2).$gsub("\\]", "]")) }; - if (($a = parsed['$has_key?']("id")) !== false && $a !== nil) { - attributes['$[]=']("id", parsed['$[]']("id"))}; - if (($a = parsed['$has_key?']("role")) !== false && $a !== nil) { - attributes['$[]=']("role", parsed['$[]']("role")['$*'](" "))}; - if (($a = parsed['$has_key?']("option")) !== false && $a !== nil) { - ($a = ($d = ((options = parsed['$[]']("option")))).$each, $a._p = (TMP_30 = function(option){var self = TMP_30._s || this;if (option == null) option = nil; - return attributes['$[]=']("" + (option) + "-option", "")}, TMP_30._s = self, TMP_30), $a).call($d); - if (($a = (existing_opts = attributes['$[]']("options"))) !== false && $a !== nil) { - attributes['$[]=']("options", (options['$+'](existing_opts.$split(",")))['$*'](",")) + if ((($a = text['$end_with?']("^")) !== nil && (!$a._isBoolean || $a == true))) { + text = text.$chop(); + ((($a = attrs) !== false && $a !== nil) ? $a : attrs = $hash2([], {})); + if ((($a = attrs['$has_key?']("window")) !== nil && (!$a._isBoolean || $a == true))) { } else { - attributes['$[]=']("options", options['$*'](",")) + attrs['$[]=']("window", "_blank") };}; - }; - return [parsed_style, original_style]; - }; - }); - - $opal.defs(self, '$reset_block_indent!', function(lines, indent) { - var $a, $b, TMP_31, $c, TMP_32, $d, TMP_33, self = this, tab_detected = nil, tab_expansion = nil, offsets = nil, offset = nil, padding = nil; - if (indent == null) { - indent = 0 - } - if (($a = ((($b = indent['$nil?']()) !== false && $b !== nil) ? $b : lines['$empty?']())) !== false && $a !== nil) { - return nil}; - tab_detected = false; - tab_expansion = " "; - offsets = ($a = ($b = lines).$map, $a._p = (TMP_31 = function(line){var self = TMP_31._s || this, $a, flush_line = nil, offset = nil;if (line == null) line = nil; - if (($a = line['$[]']($range(0, 0, false)).$lstrip()['$empty?']()) === false || $a === nil) { - return ($breaker.$v = [], $breaker)}; - if (($a = line['$include?']("\t")) !== false && $a !== nil) { - tab_detected = true; - line = line.$gsub("\t", tab_expansion);}; - if (($a = ((flush_line = line.$lstrip()))['$empty?']()) !== false && $a !== nil) { - return nil - } else if (((offset = line.$length()['$-'](flush_line.$length())))['$=='](0)) { - return ($breaker.$v = [], $breaker) - } else { - return offset - };}, TMP_31._s = self, TMP_31), $a).call($b); - if (($a = ((($c = offsets['$empty?']()) !== false && $c !== nil) ? $c : ((offsets = offsets.$compact()))['$empty?']())) === false || $a === nil) { - if (((offset = offsets.$min()))['$>'](0)) { - ($a = ($c = lines)['$map!'], $a._p = (TMP_32 = function(line){var self = TMP_32._s || this;if (line == null) line = nil; - if (tab_detected !== false && tab_detected !== nil) { - line = line.$gsub("\t", tab_expansion)}; - return line['$[]']($range(offset, -1, false)).$to_s();}, TMP_32._s = self, TMP_32), $a).call($c)}}; - if (indent['$>'](0)) { - padding = " "['$*'](indent); - ($a = ($d = lines)['$map!'], $a._p = (TMP_33 = function(line){var self = TMP_33._s || this;if (line == null) line = nil; - return "" + (padding) + (line)}, TMP_33._s = self, TMP_33), $a).call($d);}; - return nil; - }); - - $opal.defs(self, '$sanitize_attribute_name', function(name) { - var self = this; - return name.$gsub($scope.REGEXP['$[]']("illegal_attr_name_chars"), "").$downcase(); - }); - - return ($opal.defs(self, '$roman_numeral_to_int', function(value) { - var $a, $b, TMP_34, self = this, digits = nil, result = nil; - value = value.$downcase(); - digits = $hash2(["i", "v", "x"], {"i": 1, "v": 5, "x": 10}); - result = 0; - ($a = ($b = ($range(0, value.$length()['$-'](1), false))).$each, $a._p = (TMP_34 = function(i){var self = TMP_34._s || this, $a, $b, digit = nil;if (i == null) i = nil; - digit = digits['$[]'](value['$[]']($range(i, i, false))); - if (($a = (($b = i['$+'](1)['$<'](value.$length())) ? digits['$[]'](value['$[]']($range(i['$+'](1), i['$+'](1), false)))['$>'](digit) : $b)) !== false && $a !== nil) { - return result = result['$-'](digit) - } else { - return result = result['$+'](digit) - };}, TMP_34._s = self, TMP_34), $a).call($b); - return result; - }), nil); - })(self, null) - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass; - return (function($base) { - var self = $module($base, 'Asciidoctor'); - - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $List(){}; - var self = $List = $klass($base, $super, 'List', $List); - - var def = $List._proto, $scope = $List._scope, TMP_1, TMP_2; - def.blocks = def.context = def.document = nil; - $opal.defn(self, '$items', def.$blocks); - - $opal.defn(self, '$items?', def['$blocks?']); + self.document.$register("links", target); + if ((($a = text['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = self.document['$attr?']("hide-uri-scheme")) !== nil && (!$a._isBoolean || $a == true))) { + text = raw_target.$sub($scope.UriSniffRx, "") + } else { + text = raw_target + }}; + return $scope.Inline.$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "link", "target": target, "attributes": attrs})).$convert();}, TMP_31._s = self, TMP_31), $a).call($i, $scope.LinkInlineMacroRx)}; + if ((($a = result['$include?']("@")) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($j = result).$gsub, $a._p = (TMP_32 = function(){var self = TMP_32._s || this, $a, m = nil, address = nil, lead = nil, $case = nil, target = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - def.$initialize = TMP_1 = function(parent, context) { - var self = this, $iter = TMP_1._p, $yield = $iter || nil; - TMP_1._p = null; - return $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, context]); - }; + m = $gvars["~"]; + address = m['$[]'](0); + if ((($a = (lead = m['$[]'](1))) !== nil && (!$a._isBoolean || $a == true))) { + $case = lead;if ("\\"['$===']($case)) {return address['$[]']($range(1, -1, false));}else {return address;}}; + target = "mailto:" + (address); + self.document.$register("links", target); + return $scope.Inline.$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$convert();}, TMP_32._s = self, TMP_32), $a).call($j, $scope.EmailInlineMacroRx)}; + if ((($a = ($k = found['$[]']("macroish_short_form"), $k !== false && $k !== nil ?result['$include?']("footnote") : $k)) !== nil && (!$a._isBoolean || $a == true))) { + result = ($a = ($k = result).$gsub, $a._p = (TMP_33 = function(){var self = TMP_33._s || this, $a, $b, $c, TMP_34, m = nil, id = nil, text = nil, index = nil, type = nil, target = nil, footnote = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - def.$content = function() { - var self = this; - return self.blocks; + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + if (m['$[]'](1)['$==']("footnote")) { + id = nil; + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(m['$[]'](2), true)))); + index = self.document.$counter("footnote-number"); + self.document.$register("footnotes", ($scope.Document)._scope.Footnote.$new(index, id, text)); + type = nil; + target = nil; + } else { + $a = $opal.to_ary(m['$[]'](2).$split(",", 2)), id = ($a[0] == null ? nil : $a[0]), text = ($a[1] == null ? nil : $a[1]); + id = id.$strip(); + if ((($a = text['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = (footnote = ($b = ($c = self.document.$references()['$[]']("footnotes")).$find, $b._p = (TMP_34 = function(fn){var self = TMP_34._s || this; +if (fn == null) fn = nil; + return fn.$id()['$=='](id)}, TMP_34._s = self, TMP_34), $b).call($c))) !== nil && (!$a._isBoolean || $a == true))) { + index = footnote.$index(); + text = footnote.$text(); + } else { + index = nil; + text = id; + }; + target = id; + id = nil; + type = "xref"; + } else { + text = self.$restore_passthroughs(self.$sub_inline_xrefs(self.$sub_inline_anchors(self.$normalize_string(text, true)))); + index = self.document.$counter("footnote-number"); + self.document.$register("footnotes", ($scope.Document)._scope.Footnote.$new(index, id, text)); + type = "ref"; + target = nil; + }; + }; + return $scope.Inline.$new(self, "footnote", text, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$convert();}, TMP_33._s = self, TMP_33), $a).call($k, $scope.FootnoteInlineMacroRx)}; + return self.$sub_inline_xrefs(self.$sub_inline_anchors(result, found), found); }; - return (def.$render = TMP_2 = function() {var $zuper = $slice.call(arguments, 0); - var self = this, $iter = TMP_2._p, $yield = $iter || nil, result = nil; - TMP_2._p = null; - result = $opal.find_super_dispatcher(self, 'render', TMP_2, $iter).apply(self, $zuper); - if (self.context['$==']("colist")) { - self.document.$callouts().$next_list()}; - return result; - }, nil); - })(self, $scope.AbstractBlock); + def.$sub_inline_anchors = function(text, found) { + var $a, $b, $c, TMP_35, $d, $e, TMP_36, self = this; - (function($base, $super) { - function $ListItem(){}; - var self = $ListItem = $klass($base, $super, 'ListItem', $ListItem); + if (found == null) { + found = nil + } + if ((($a = ($b = (((($c = found['$!']()) !== false && $c !== nil) ? $c : found['$[]']("square_bracket"))), $b !== false && $b !== nil ?text['$include?']("[[[") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + text = ($a = ($b = text).$gsub, $a._p = (TMP_35 = function(){var self = TMP_35._s || this, $a, m = nil, id = nil, reftext = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - var def = $ListItem._proto, $scope = $ListItem._scope, TMP_3; - def.text = def.blocks = def.context = nil; - self.$attr_accessor("marker"); + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + id = reftext = m['$[]'](1); + return $scope.Inline.$new(self, "anchor", reftext, $hash2(["type", "target"], {"type": "bibref", "target": id})).$convert();}, TMP_35._s = self, TMP_35), $a).call($b, $scope.InlineBiblioAnchorRx)}; + if ((($a = ((($c = (($d = (((($e = found['$!']()) !== false && $e !== nil) ? $e : found['$[]']("square_bracket"))), $d !== false && $d !== nil ?text['$include?']("[[") : $d))) !== false && $c !== nil) ? $c : (($d = (((($e = found['$!']()) !== false && $e !== nil) ? $e : found['$[]']("macroish"))), $d !== false && $d !== nil ?text['$include?']("anchor:") : $d)))) !== nil && (!$a._isBoolean || $a == true))) { + text = ($a = ($c = text).$gsub, $a._p = (TMP_36 = function(){var self = TMP_36._s || this, $a, $b, TMP_37, m = nil, id = nil, reftext = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - def.$initialize = TMP_3 = function(parent, text) { - var self = this, $iter = TMP_3._p, $yield = $iter || nil; - if (text == null) { - text = nil - } - TMP_3._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_3, null).apply(self, [parent, "list_item"]); - self.text = text; - return self.level = parent.$level(); - }; + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if (m['$[]'](1)['$==']("")) { + m['$[]='](1, nil)}; + if (m['$[]'](2)['$==']("")) { + m['$[]='](2, nil)}; + if (m['$[]'](4)['$==']("")) { + m['$[]='](4, nil)};}; + id = ((($a = m['$[]'](1)) !== false && $a !== nil) ? $a : m['$[]'](3)); + reftext = ((($a = ((($b = m['$[]'](2)) !== false && $b !== nil) ? $b : m['$[]'](4))) !== false && $a !== nil) ? $a : "[" + (id) + "]"); + if ((($a = self.document.$references()['$[]']("ids")['$has_key?'](id)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + ($a = ($b = $scope.Debug).$debug, $a._p = (TMP_37 = function(){var self = TMP_37._s || this; - def['$text?'] = function() { - var $a, self = this; - return ($a = self.text.$to_s()['$empty?'](), ($a === nil || $a === false)); + return "Missing reference for anchor " + (id)}, TMP_37._s = self, TMP_37), $a).call($b) + }; + return $scope.Inline.$new(self, "anchor", reftext, $hash2(["type", "target"], {"type": "ref", "target": id})).$convert();}, TMP_36._s = self, TMP_36), $a).call($c, $scope.InlineAnchorRx)}; + return text; }; - def.$text = function() { - var self = this; - return self.$apply_subs(self.text); - }; + def.$sub_inline_xrefs = function(text, found) { + var $a, $b, $c, TMP_38, self = this; - def.$fold_first = function(continuation_connects_first_block, content_adjacent) { - var $a, $b, $c, $d, $e, $f, $g, self = this, first_block = nil, block = nil; - if (continuation_connects_first_block == null) { - continuation_connects_first_block = false - } - if (content_adjacent == null) { - content_adjacent = false + if (found == null) { + found = nil } - if (($a = ($b = ($c = ($d = ((first_block = self.blocks.$first()))['$nil?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?first_block['$is_a?']($scope.Block) : $c), $b !== false && $b !== nil ?(((($c = ((($d = first_block.$context()['$==']("paragraph")) ? ($e = continuation_connects_first_block, ($e === nil || $e === false)) : $d))) !== false && $c !== nil) ? $c : (($d = ($e = (((($f = content_adjacent) !== false && $f !== nil) ? $f : ($g = continuation_connects_first_block, ($g === nil || $g === false)))), $e !== false && $e !== nil ?first_block.$context()['$==']("literal") : $e), $d !== false && $d !== nil ?first_block['$option?']("listparagraph") : $d)))) : $b)) !== false && $a !== nil) { - block = self.$blocks().$shift(); - if (($a = self.text.$to_s()['$empty?']()) === false || $a === nil) { - block.$lines().$unshift(self.text)}; - self.text = block.$source();}; - return nil; - }; - - return (def.$to_s = function() { - var $a, self = this; - return "" + (self.context) + " [text:" + (self.text) + ", blocks:" + ((((($a = self.blocks) !== false && $a !== nil) ? $a : [])).$size()) + "]"; - }, nil); - })(self, $scope.AbstractBlock); - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $gvars = $opal.gvars, $range = $opal.range; - return (function($base) { - var self = $module($base, 'Asciidoctor'); + if ((($a = ((($b = (((($c = found['$!']()) !== false && $c !== nil) ? $c : found['$[]']("macroish")))) !== false && $b !== nil) ? $b : text['$include?']("<<"))) !== nil && (!$a._isBoolean || $a == true))) { + text = ($a = ($b = text).$gsub, $a._p = (TMP_38 = function(){var self = TMP_38._s || this, $a, $b, $c, TMP_39, m = nil, id = nil, reftext = nil, path = nil, fragment = nil, refid = nil, target = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $PathResolver(){}; - var self = $PathResolver = $klass($base, $super, 'PathResolver', $PathResolver); - - var def = $PathResolver._proto, $scope = $PathResolver._scope; - def.file_separator = def.working_dir = nil; - $opal.cdecl($scope, 'DOT', "."); - - $opal.cdecl($scope, 'DOT_DOT', ".."); - - $opal.cdecl($scope, 'SLASH', "/"); + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](0)['$[]']($range(1, -1, false));}; + if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if (m['$[]'](1)['$==']("")) { + m['$[]='](1, nil)}}; + if ((($a = m['$[]'](1)) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(($b = ($c = m['$[]'](1).$split(",", 2)).$map, $b._p = (TMP_39 = function(it){var self = TMP_39._s || this; +if (it == null) it = nil; + return it.$strip()}, TMP_39._s = self, TMP_39), $b).call($c)), id = ($a[0] == null ? nil : $a[0]), reftext = ($a[1] == null ? nil : $a[1]); + id = id.$sub($scope.DoubleQuotedRx, "\\2"); + reftext = (function() {if ((($a = reftext['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return reftext.$sub($scope.DoubleQuotedMultiRx, "\\2") + }; return nil; })(); + } else { + id = m['$[]'](2); + if ((($a = m['$[]'](3)['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + reftext = m['$[]'](3) + }; + }; + if ((($a = id['$include?']("#")) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(id.$split("#")), path = ($a[0] == null ? nil : $a[0]), fragment = ($a[1] == null ? nil : $a[1]) + } else { + path = nil; + fragment = id; + }; + if ((($a = path['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + refid = fragment; + target = "#" + (fragment); + } else { + path = $scope.Helpers.$rootname(path); + if ((($a = ((($b = self.document.$attributes()['$[]']("docname")['$=='](path)) !== false && $b !== nil) ? $b : self.document.$references()['$[]']("includes")['$include?'](path))) !== nil && (!$a._isBoolean || $a == true))) { + refid = fragment; + path = nil; + target = "#" + (fragment); + } else { + refid = (function() {if (fragment !== false && fragment !== nil) { + return "" + (path) + "#" + (fragment) + } else { + return path + }; return nil; })(); + path = "" + (self.document.$attributes()['$[]']("relfileprefix")) + (path) + (self.document.$attributes().$fetch("outfilesuffix", ".html")); + target = (function() {if (fragment !== false && fragment !== nil) { + return "" + (path) + "#" + (fragment) + } else { + return path + }; return nil; })(); + }; + }; + return $scope.Inline.$new(self, "anchor", reftext, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": $hash2(["path", "fragment", "refid"], {"path": path, "fragment": fragment, "refid": refid})})).$convert();}, TMP_38._s = self, TMP_38), $a).call($b, $scope.XrefInlineMacroRx)}; + return text; + }; - $opal.cdecl($scope, 'BACKSLASH', "\\"); + def.$sub_callouts = function(text) { + var $a, $b, TMP_40, self = this; - $opal.cdecl($scope, 'WIN_ROOT_RE', /^[a-zA-Z]:(?:\\|\/)/); + return ($a = ($b = text).$gsub, $a._p = (TMP_40 = function(){var self = TMP_40._s || this, m = nil; + if (self.document == null) self.document = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - self.$attr_accessor("file_separator"); + m = $gvars["~"]; + if (m['$[]'](1)['$==']("\\")) { + return m['$[]'](0).$sub("\\", "");}; + return $scope.Inline.$new(self, "callout", m['$[]'](3), $hash2(["id"], {"id": self.document.$callouts().$read_next_id()})).$convert();}, TMP_40._s = self, TMP_40), $a).call($b, $scope.CalloutConvertRx); + }; - self.$attr_accessor("working_dir"); + def.$sub_post_replacements = function(text) { + var $a, $b, TMP_41, $c, TMP_42, self = this, lines = nil, last = nil; + if (self.document == null) self.document = nil; + if (self.attributes == null) self.attributes = nil; - def.$initialize = function(file_separator, working_dir) { - var $a, self = this; - if (file_separator == null) { - file_separator = nil - } - if (working_dir == null) { - working_dir = nil - } - self.file_separator = (function() {if (($a = file_separator['$nil?']()) !== false && $a !== nil) { - return (((($a = ($scope.File)._scope.ALT_SEPARATOR) !== false && $a !== nil) ? $a : ($scope.File)._scope.SEPARATOR)) - } else { - return file_separator - }; return nil; })(); - if (($a = working_dir['$nil?']()) !== false && $a !== nil) { - return self.working_dir = $scope.File.$expand_path($scope.Dir.$pwd()) - } else { - return self.working_dir = (function() {if (($a = self['$is_root?'](working_dir)) !== false && $a !== nil) { - return working_dir - } else { - return $scope.File.$expand_path(working_dir) - }; return nil; })() - }; - }; + if ((($a = ((($b = (self.document.$attributes()['$has_key?']("hardbreaks"))) !== false && $b !== nil) ? $b : (self.attributes['$has_key?']("hardbreaks-option")))) !== nil && (!$a._isBoolean || $a == true))) { + lines = (text.$split($scope.EOL)); + if (lines.$size()['$=='](1)) { + return text}; + last = lines.$pop(); + return ($a = ($b = lines).$map, $a._p = (TMP_41 = function(line){var self = TMP_41._s || this; +if (line == null) line = nil; + return $scope.Inline.$new(self, "break", line.$rstrip().$chomp($scope.LINE_BREAK), $hash2(["type"], {"type": "line"})).$convert()}, TMP_41._s = self, TMP_41), $a).call($b).$push(last)['$*']($scope.EOL); + } else if ((($a = text['$include?']("+")) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = ($c = text).$gsub, $a._p = (TMP_42 = function(){var self = TMP_42._s || this; + if ($gvars["~"] == null) $gvars["~"] = nil; - def['$is_root?'] = function(path) { - var $a, $b, self = this; - if (($a = (($b = self.file_separator['$==']($scope.BACKSLASH)) ? path.$match($scope.WIN_ROOT_RE) : $b)) !== false && $a !== nil) { - return true - } else if (($a = path['$start_with?']($scope.SLASH)) !== false && $a !== nil) { - return true + return $scope.Inline.$new(self, "break", $gvars["~"]['$[]'](1), $hash2(["type"], {"type": "line"})).$convert()}, TMP_42._s = self, TMP_42), $a).call($c, $scope.LineBreakRx) } else { - return false + return text }; }; - def['$is_web_root?'] = function(path) { - var self = this; - return path['$start_with?']($scope.SLASH); - }; + def.$convert_quoted_text = function(match, type, scope) { + var $a, $b, self = this, unescaped_attrs = nil, attrs = nil, attributes = nil, id = nil; - def.$posixfy = function(path) { - var $a, self = this; - if (($a = path.$to_s()['$empty?']()) !== false && $a !== nil) { - return ""}; - if (($a = path['$include?']($scope.BACKSLASH)) !== false && $a !== nil) { - return path.$tr($scope.BACKSLASH, $scope.SLASH) + unescaped_attrs = nil; + if ((($a = match['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = (($b = scope['$==']("constrained")) ? ((attrs = match['$[]'](2)))['$nil_or_empty?']()['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + unescaped_attrs = "[" + (attrs) + "]" + } else { + return match['$[]'](0)['$[]']($range(1, -1, false)) + }}; + if (scope['$==']("constrained")) { + if (unescaped_attrs !== false && unescaped_attrs !== nil) { + return "" + (unescaped_attrs) + ($scope.Inline.$new(self, "quoted", match['$[]'](3), $hash2(["type"], {"type": type})).$convert()) + } else { + attributes = self.$parse_quoted_text_attributes(match['$[]'](2)); + id = (function() {if (attributes !== false && attributes !== nil) { + return attributes.$delete("id") + } else { + return nil + }; return nil; })(); + return "" + (match['$[]'](1)) + ($scope.Inline.$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert()); + } } else { - return path + attributes = self.$parse_quoted_text_attributes(match['$[]'](1)); + id = (function() {if (attributes !== false && attributes !== nil) { + return attributes.$delete("id") + } else { + return nil + }; return nil; })(); + return $scope.Inline.$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert(); }; }; - def.$expand_path = function(path) { - var $a, self = this, path_segments = nil, path_root = nil, _ = nil; - $a = $opal.to_ary(self.$partition_path(path)), path_segments = ($a[0] == null ? nil : $a[0]), path_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); - return self.$join_path(path_segments, path_root); - }; + def.$parse_quoted_text_attributes = function(str) { + var $a, $b, self = this, _ = nil, segments = nil, id = nil, more_roles = nil, roles = nil, attrs = nil; - def.$partition_path = function(path, web_path) { - var self = this, posix_path = nil, is_root = nil, path_segments = nil, root = nil; - if (web_path == null) { - web_path = false - } - posix_path = self.$posixfy(path); - is_root = (function() {if (web_path !== false && web_path !== nil) { - return self['$is_web_root?'](posix_path) - } else { - return self['$is_root?'](posix_path) - }; return nil; })(); - path_segments = posix_path.$tr_s($scope.SLASH, $scope.SLASH).$split($scope.SLASH); - root = (function() {if (path_segments.$first()['$==']($scope.DOT)) { - return $scope.DOT + if (str !== false && str !== nil) { } else { return nil - }; return nil; })(); - path_segments.$delete($scope.DOT); - root = (function() {if (is_root !== false && is_root !== nil) { - return path_segments.$shift() - } else { - return root - }; return nil; })(); - return [path_segments, root, posix_path]; - }; - - def.$join_path = function(segments, root) { - var self = this; - if (root == null) { - root = nil - } - if (root !== false && root !== nil) { - return "" + (root) + ($scope.SLASH) + (segments['$*']($scope.SLASH)) + }; + if ((($a = str['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return $hash2([], {})}; + if ((($a = str['$include?']("{")) !== nil && (!$a._isBoolean || $a == true))) { + str = self.$sub_attributes(str)}; + str = str.$strip(); + if ((($a = str['$include?'](",")) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(str.$split(",", 2)), str = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1])}; + if ((($a = str['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return $hash2([], {}) + } else if ((($a = ((($b = str['$start_with?'](".")) !== false && $b !== nil) ? $b : str['$start_with?']("#"))) !== nil && (!$a._isBoolean || $a == true))) { + segments = str.$split("#", 2); + if (segments.$length()['$>'](1)) { + $a = $opal.to_ary(segments['$[]'](1).$split(".")), id = ($a[0] == null ? nil : $a[0]), more_roles = $slice.call($a, 1) + } else { + id = nil; + more_roles = []; + }; + roles = (function() {if ((($a = segments['$[]'](0)['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return [] + } else { + return segments['$[]'](0).$split(".") + }; return nil; })(); + if (roles.$length()['$>'](1)) { + roles.$shift()}; + if (more_roles.$length()['$>'](0)) { + roles.$concat(more_roles)}; + attrs = $hash2([], {}); + if (id !== false && id !== nil) { + attrs['$[]=']("id", id)}; + if ((($a = roles['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + attrs['$[]=']("role", roles['$*'](" ")) + }; + return attrs; } else { - return segments['$*']($scope.SLASH) + return $hash2(["role"], {"role": str}) }; }; - def.$system_path = function(target, start, jail, opts) { - var $a, $b, $c, TMP_1, self = this, recover = nil, target_segments = nil, target_root = nil, _ = nil, resolved_target = nil, jail_segments = nil, jail_root = nil, start_segments = nil, start_root = nil, resolved_segments = nil, warned = nil; - if (jail == null) { - jail = nil + def.$parse_attributes = function(attrline, posattrs, opts) { + var $a, self = this, block = nil, into = nil; + if (self.document == null) self.document = nil; + + if (posattrs == null) { + posattrs = ["role"] } if (opts == null) { opts = $hash2([], {}) } - recover = opts.$fetch("recover", true); - if (($a = jail['$nil?']()) === false || $a === nil) { - if (($a = self['$is_root?'](jail)) === false || $a === nil) { - self.$raise($scope.SecurityError, "Jail is not an absolute path: " + (jail))}; - jail = self.$posixfy(jail);}; - if (($a = target.$to_s()['$empty?']()) !== false && $a !== nil) { - target_segments = [] - } else { - $a = $opal.to_ary(self.$partition_path(target)), target_segments = ($a[0] == null ? nil : $a[0]), target_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]) - }; - if (($a = target_segments['$empty?']()) !== false && $a !== nil) { - if (($a = start.$to_s()['$empty?']()) !== false && $a !== nil) { - return (function() {if (($a = jail['$nil?']()) !== false && $a !== nil) { - return self.working_dir - } else { - return jail - }; return nil; })() - } else if (($a = self['$is_root?'](start)) !== false && $a !== nil) { - if (($a = jail['$nil?']()) !== false && $a !== nil) { - return self.$expand_path(start)} - } else { - return self.$system_path(start, jail, jail) - }}; - if (($a = (($b = target_root !== false && target_root !== nil) ? ($c = target_root['$==']($scope.DOT), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - resolved_target = self.$join_path(target_segments, target_root); - if (($a = ((($b = jail['$nil?']()) !== false && $b !== nil) ? $b : resolved_target['$start_with?'](jail))) !== false && $a !== nil) { - return resolved_target};}; - if (($a = start.$to_s()['$empty?']()) !== false && $a !== nil) { - start = (function() {if (($a = jail['$nil?']()) !== false && $a !== nil) { - return self.working_dir - } else { - return jail - }; return nil; })() - } else if (($a = self['$is_root?'](start)) !== false && $a !== nil) { - start = self.$posixfy(start) + if (attrline !== false && attrline !== nil) { } else { - start = self.$system_path(start, jail, jail) + return nil }; - if (jail['$=='](start)) { - $a = $opal.to_ary(self.$partition_path(jail)), jail_segments = ($a[0] == null ? nil : $a[0]), jail_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); - start_segments = jail_segments.$dup(); - } else if (($a = ($b = jail['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - if (($a = ($b = start['$start_with?'](jail), ($b === nil || $b === false))) !== false && $a !== nil) { - self.$raise($scope.SecurityError, "" + (((($a = opts['$[]']("target_name")) !== false && $a !== nil) ? $a : "Start path")) + " " + (start) + " is outside of jail: " + (jail) + " (disallowed in safe mode)")}; - $a = $opal.to_ary(self.$partition_path(start)), start_segments = ($a[0] == null ? nil : $a[0]), start_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); - $a = $opal.to_ary(self.$partition_path(jail)), jail_segments = ($a[0] == null ? nil : $a[0]), jail_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); + if ((($a = attrline['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return $hash2([], {})}; + if ((($a = opts['$[]']("sub_input")) !== nil && (!$a._isBoolean || $a == true))) { + attrline = self.document.$sub_attributes(attrline)}; + if ((($a = opts['$[]']("unescape_input")) !== nil && (!$a._isBoolean || $a == true))) { + attrline = self.$unescape_bracketed_text(attrline)}; + block = nil; + if ((($a = opts.$fetch("sub_result", true)) !== nil && (!$a._isBoolean || $a == true))) { + block = self}; + if ((($a = (into = opts['$[]']("into"))) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.AttributeList.$new(attrline, block).$parse_into(into, posattrs) } else { - $a = $opal.to_ary(self.$partition_path(start)), start_segments = ($a[0] == null ? nil : $a[0]), start_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); - jail_root = start_root; + return $scope.AttributeList.$new(attrline, block).$parse(posattrs) }; - resolved_segments = start_segments.$dup(); - warned = false; - ($a = ($b = target_segments).$each, $a._p = (TMP_1 = function(segment){var self = TMP_1._s || this, $a, $b;if (segment == null) segment = nil; - if (segment['$==']($scope.DOT_DOT)) { - if (($a = ($b = jail['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - if (resolved_segments.$length()['$>'](jail_segments.$length())) { - return resolved_segments.$pop() - } else if (($a = ($b = recover, ($b === nil || $b === false))) !== false && $a !== nil) { - return self.$raise($scope.SecurityError, "" + (((($a = opts['$[]']("target_name")) !== false && $a !== nil) ? $a : "path")) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)") - } else if (($a = ($b = warned, ($b === nil || $b === false))) !== false && $a !== nil) { - self.$warn("asciidoctor: WARNING: " + (((($a = opts['$[]']("target_name")) !== false && $a !== nil) ? $a : "path")) + " has illegal reference to ancestor of jail, auto-recovering"); - return warned = true; - } else { - return nil - } - } else { - return resolved_segments.$pop() - } - } else { - return resolved_segments.$push(segment) - }}, TMP_1._s = self, TMP_1), $a).call($b); - return self.$join_path(resolved_segments, jail_root); }; - def.$web_path = function(target, start) { - var $a, $b, TMP_2, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, _ = nil, resolved_segments = nil; - if (start == null) { - start = nil + def.$unescape_bracketed_text = function(text) { + var $a, self = this; + + if ((($a = text['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return ""}; + return text.$strip().$tr($scope.EOL, " ").$gsub("\\]", "]"); + }; + + def.$normalize_string = function(str, unescape_brackets) { + var $a, self = this; + + if (unescape_brackets == null) { + unescape_brackets = false } - target = self.$posixfy(target); - start = self.$posixfy(start); - uri_prefix = nil; - if (($a = ((($b = self['$is_web_root?'](target)) !== false && $b !== nil) ? $b : start['$empty?']())) === false || $a === nil) { - target = "" + (start) + ($scope.SLASH) + (target); - if (($a = ($b = target['$include?'](":"), $b !== false && $b !== nil ?target.$match(($scope.Asciidoctor)._scope.REGEXP['$[]']("uri_sniff")) : $b)) !== false && $a !== nil) { - uri_prefix = $gvars["~"]['$[]'](0); - target = target['$[]']($range(uri_prefix.$length(), -1, false));};}; - $a = $opal.to_ary(self.$partition_path(target, true)), target_segments = ($a[0] == null ? nil : $a[0]), target_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); - resolved_segments = ($a = ($b = target_segments).$inject, $a._p = (TMP_2 = function(accum, segment){var self = TMP_2._s || this, $a, $b, $c;if (accum == null) accum = nil;if (segment == null) segment = nil; - if (segment['$==']($scope.DOT_DOT)) { - if (($a = accum['$empty?']()) !== false && $a !== nil) { - if (($a = (($b = target_root !== false && target_root !== nil) ? ($c = target_root['$==']($scope.DOT), ($c === nil || $c === false)) : $b)) === false || $a === nil) { - accum.$push(segment)} - } else if (accum['$[]'](-1)['$==']($scope.DOT_DOT)) { - accum.$push(segment) - } else { - accum.$pop() - } - } else { - accum.$push(segment) - }; - return accum;}, TMP_2._s = self, TMP_2), $a).call($b, []); - if (($a = uri_prefix['$nil?']()) !== false && $a !== nil) { - return self.$join_path(resolved_segments, target_root) + if ((($a = str['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "" + } else if (unescape_brackets !== false && unescape_brackets !== nil) { + return self.$unescape_brackets(str.$strip().$tr($scope.EOL, " ")) } else { - return "" + (uri_prefix) + (self.$join_path(resolved_segments, target_root)) + return str.$strip().$tr($scope.EOL, " ") }; }; - return (def.$relative_path = function(filename, base_directory) { - var $a, $b, self = this, offset = nil; - if (($a = ($b = (self['$is_root?'](filename)), $b !== false && $b !== nil ?(self['$is_root?'](base_directory)) : $b)) !== false && $a !== nil) { - offset = base_directory.$chomp(self.file_separator).$length()['$+'](1); - return filename['$[]']($range(offset, -1, false)); + def.$unescape_brackets = function(str) { + var $a, self = this; + + if ((($a = str['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "" } else { - return filename + return str.$gsub("\\]", "]") }; - }, nil); - })(self, null) - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range; - return (function($base) { - var self = $module($base, 'Asciidoctor'); - - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $Reader(){}; - var self = $Reader = $klass($base, $super, 'Reader', $Reader); - - var def = $Reader._proto, $scope = $Reader._scope, TMP_4; - def.file = def.dir = def.lines = def.process_lines = def.look_ahead = def.eof = def.unescape_next_line = def.lineno = def.path = def.source_lines = nil; - (function($base, $super) { - function $Cursor(){}; - var self = $Cursor = $klass($base, $super, 'Cursor', $Cursor); - - var def = $Cursor._proto, $scope = $Cursor._scope; - self.$attr_accessor("file"); - - self.$attr_accessor("dir"); - - self.$attr_accessor("path"); + }; - self.$attr_accessor("lineno"); + def.$split_simple_csv = function(str) { + var $a, $b, TMP_43, $c, TMP_44, self = this, values = nil, current = nil, quote_open = nil; - def.$initialize = function(file, dir, path, lineno) { - var self = this; - if (dir == null) { - dir = nil - } - if (path == null) { - path = nil - } - if (lineno == null) { - lineno = nil - } - self.file = file; - self.dir = dir; - self.path = path; - return self.lineno = lineno; + if ((($a = str['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + values = [] + } else if ((($a = str['$include?']("\"")) !== nil && (!$a._isBoolean || $a == true))) { + values = []; + current = []; + quote_open = false; + ($a = ($b = str).$each_char, $a._p = (TMP_43 = function(c){var self = TMP_43._s || this, $case = nil; +if (c == null) c = nil; + return (function() {$case = c;if (","['$===']($case)) {if (quote_open !== false && quote_open !== nil) { + return current.$push(c) + } else { + values['$<<'](current.$join().$strip()); + return current = []; + }}else if ("\""['$===']($case)) {return quote_open = quote_open['$!']()}else {return current.$push(c)}})()}, TMP_43._s = self, TMP_43), $a).call($b); + values['$<<'](current.$join().$strip()); + } else { + values = ($a = ($c = str.$split(",")).$map, $a._p = (TMP_44 = function(it){var self = TMP_44._s || this; +if (it == null) it = nil; + return it.$strip()}, TMP_44._s = self, TMP_44), $a).call($c) }; + return values; + }; - return (def.$line_info = function() { - var self = this; - return "" + (self.$path()) + ": line " + (self.$lineno()); - }, nil); - })(self, null); - - self.$attr_reader("file"); - - self.$attr_reader("dir"); - - self.$attr_reader("path"); - - self.$attr_reader("lineno"); - - self.$attr_reader("source_lines"); - - self.$attr_accessor("process_lines"); + def.$resolve_subs = function(subs, type, defaults, subject) { + var $a, $b, TMP_45, self = this, candidates = nil, modification_group = nil, resolved = nil, invalid = nil; - def.$initialize = function(data, cursor, opts) { - var $a, self = this; - if (data == null) { - data = nil + if (type == null) { + type = "block" } - if (cursor == null) { - cursor = nil + if (defaults == null) { + defaults = nil } - if (opts == null) { - opts = $hash2(["normalize"], {"normalize": false}) + if (subject == null) { + subject = nil } - if (($a = cursor['$nil?']()) !== false && $a !== nil) { - self.file = self.dir = nil; - self.path = ""; - self.lineno = 1; - } else if (($a = cursor['$is_a?']($scope.String)) !== false && $a !== nil) { - self.file = cursor; - self.dir = $scope.File.$dirname(self.file); - self.path = $scope.File.$basename(self.file); - self.lineno = 1; - } else { - self.file = cursor.$file(); - self.dir = cursor.$dir(); - self.path = ((($a = cursor.$path()) !== false && $a !== nil) ? $a : ""); - if (($a = self.file['$nil?']()) === false || $a === nil) { - if (($a = self.dir['$nil?']()) !== false && $a !== nil) { - self.dir = $scope.File.$dirname(self.file); - if (self.dir['$=='](".")) { - self.dir = nil};}; - if (($a = cursor.$path()['$nil?']()) !== false && $a !== nil) { - self.path = $scope.File.$basename(self.file)};}; - self.lineno = ((($a = cursor.$lineno()) !== false && $a !== nil) ? $a : 1); - }; - self.lines = (function() {if (($a = data['$nil?']()) !== false && $a !== nil) { - return [] + if ((($a = subs['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return []}; + candidates = []; + modification_group = (function() {if (defaults !== false && defaults !== nil) { + return nil } else { - return (self.$prepare_lines(data, opts)) + return false }; return nil; })(); - self.source_lines = self.lines.$dup(); - self.eof = self.lines['$empty?'](); - self.look_ahead = 0; - self.process_lines = true; - return self.unescape_next_line = false; - }; - - def.$prepare_lines = function(data, opts) { - var $a, $b, self = this; - if (opts == null) { - opts = $hash2([], {}) - } - if (($a = data['$is_a?']((($b = $opal.Object._scope.String) == null ? $opal.cm('String') : $b))) !== false && $a !== nil) { - if (($a = opts['$[]']("normalize")) !== false && $a !== nil) { - return $scope.Helpers.$normalize_lines_from_string(data) + ($a = ($b = subs.$split(",")).$each, $a._p = (TMP_45 = function(val){var self = TMP_45._s || this, $a, $b, $c, key = nil, first = nil, operation = nil, resolved_keys = nil, resolved_key = nil, candidate = nil, $case = nil; +if (val == null) val = nil; + key = val.$strip(); + if ((($a = modification_group['$=='](false)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + if (((first = key.$chr()))['$==']("+")) { + operation = "append"; + key = key['$[]']($range(1, -1, false)); + } else if (first['$==']("-")) { + operation = "remove"; + key = key['$[]']($range(1, -1, false)); + } else if ((($a = key['$end_with?']("+")) !== nil && (!$a._isBoolean || $a == true))) { + operation = "prepend"; + key = key.$chop(); + } else if (modification_group !== false && modification_group !== nil) { + self.$warn("asciidoctor: WARNING: invalid entry in substitution modification group" + ((function() {if (subject !== false && subject !== nil) { + return " for " + } else { + return nil + }; return nil; })()) + (subject) + ": " + (key)); + return nil;; + } else { + operation = nil + }; + if ((($a = modification_group['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + if (operation !== false && operation !== nil) { + candidates = defaults.$dup(); + modification_group = true; + } else { + modification_group = false + }};}; + key = key.$to_sym(); + if ((($a = (($b = type['$==']("inline")) ? (((($c = key['$==']("verbatim")) !== false && $c !== nil) ? $c : key['$==']("v"))) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + resolved_keys = ["specialcharacters"] + } else if ((($a = $scope.COMPOSITE_SUBS['$has_key?'](key)) !== nil && (!$a._isBoolean || $a == true))) { + resolved_keys = $scope.COMPOSITE_SUBS['$[]'](key) + } else if ((($a = ($b = (($c = type['$==']("inline")) ? key.$length()['$=='](1) : $c), $b !== false && $b !== nil ?($scope.SUB_SYMBOLS['$has_key?'](key)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + resolved_key = $scope.SUB_SYMBOLS['$[]'](key); + if ((($a = (candidate = $scope.COMPOSITE_SUBS['$[]'](resolved_key))) !== nil && (!$a._isBoolean || $a == true))) { + resolved_keys = candidate + } else { + resolved_keys = [resolved_key] + }; } else { - return data.$each_line().$to_a() - } - } else if (($a = opts['$[]']("normalize")) !== false && $a !== nil) { - return $scope.Helpers.$normalize_lines_array(data) + resolved_keys = [key] + }; + if (modification_group !== false && modification_group !== nil) { + return (function() {$case = operation;if ("append"['$===']($case)) {return candidates = candidates['$+'](resolved_keys)}else if ("prepend"['$===']($case)) {return candidates = resolved_keys['$+'](candidates)}else if ("remove"['$===']($case)) {return candidates = candidates['$-'](resolved_keys)}else { return nil }})() + } else { + return candidates = candidates['$+'](resolved_keys) + };}, TMP_45._s = self, TMP_45), $a).call($b); + resolved = candidates['$&']($scope.SUB_OPTIONS['$[]'](type)); + if ((($a = (candidates['$-'](resolved))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { } else { - return data.$dup() + invalid = candidates['$-'](resolved); + self.$warn("asciidoctor: WARNING: invalid substitution type" + ((function() {if (invalid.$size()['$>'](1)) { + return "s" + } else { + return "" + }; return nil; })()) + ((function() {if (subject !== false && subject !== nil) { + return " for " + } else { + return nil + }; return nil; })()) + (subject) + ": " + (invalid['$*'](", "))); }; + return resolved; }; - def.$process_line = function(line) { - var $a, self = this; - if (($a = self.process_lines) !== false && $a !== nil) { - self.look_ahead = self.look_ahead['$+'](1)}; - return line; - }; + def.$resolve_block_subs = function(subs, defaults, subject) { + var self = this; - def['$has_more_lines?'] = function() { - var $a, $b, self = this; - return ($a = (((($b = self.eof) !== false && $b !== nil) ? $b : (self.eof = self.$peek_line()['$nil?']()))), ($a === nil || $a === false)); + return self.$resolve_subs(subs, "block", defaults, subject); }; - def['$next_line_empty?'] = function() { - var $a, self = this, line = nil; - return ((($a = ((line = self.$peek_line()))['$nil?']()) !== false && $a !== nil) ? $a : line['$empty?']()); - }; + def.$resolve_pass_subs = function(subs) { + var self = this; - def.$peek_line = function(direct) { - var $a, $b, self = this, line = nil; - if (direct == null) { - direct = false - } - if (($a = ((($b = direct) !== false && $b !== nil) ? $b : self.look_ahead['$>'](0))) !== false && $a !== nil) { - if (($a = self.unescape_next_line) !== false && $a !== nil) { - return self.lines.$first()['$[]']($range(1, -1, false)) - } else { - return self.lines.$first() - } - } else if (($a = ((($b = self.eof) !== false && $b !== nil) ? $b : self.lines['$empty?']())) !== false && $a !== nil) { - self.eof = true; - self.look_ahead = 0; - return nil; - } else if (($a = ((line = self.$process_line(self.lines.$first())))['$nil?']()) !== false && $a !== nil) { - return self.$peek_line() - } else { - return line - }; + return self.$resolve_subs(subs, "inline", nil, "passthrough macro"); }; - def.$peek_lines = function(num, direct) { - var $a, $b, TMP_1, $c, TMP_2, self = this, old_look_ahead = nil, result = nil; - if (num == null) { - num = 1 - } - if (direct == null) { - direct = true - } - old_look_ahead = self.look_ahead; - result = []; - ($a = ($b = ($range(1, num, false))).$each, $a._p = (TMP_1 = function(){var self = TMP_1._s || this, $a, line = nil; - if (($a = (line = self.$read_line(direct))) !== false && $a !== nil) { - return result['$<<'](line) - } else { - return ($breaker.$v = nil, $breaker) - }}, TMP_1._s = self, TMP_1), $a).call($b); - if (($a = result['$empty?']()) === false || $a === nil) { - ($a = ($c = result).$reverse_each, $a._p = (TMP_2 = function(line){var self = TMP_2._s || this;if (line == null) line = nil; - return self.$unshift(line)}, TMP_2._s = self, TMP_2), $a).call($c); - if (direct !== false && direct !== nil) { - self.look_ahead = old_look_ahead};}; - return result; - }; + def.$highlight_source = function(source, sub_callouts, highlighter) { + var $a, $b, TMP_46, $c, TMP_48, self = this, callout_marks = nil, lineno = nil, callout_on_last = nil, last = nil, linenums_mode = nil, $case = nil, result = nil, lexer = nil, opts = nil, reached_code = nil; + if (self.document == null) self.document = nil; + if (self.passthroughs == null) self.passthroughs = nil; - def.$read_line = function(direct) { - var $a, $b, $c, self = this; - if (direct == null) { - direct = false + if (highlighter == null) { + highlighter = nil } - if (($a = ((($b = ((($c = direct) !== false && $c !== nil) ? $c : self.look_ahead['$>'](0))) !== false && $b !== nil) ? $b : self['$has_more_lines?']())) !== false && $a !== nil) { - return self.$shift() + ((($a = highlighter) !== false && $a !== nil) ? $a : highlighter = self.document.$attributes()['$[]']("source-highlighter")); + $scope.Helpers.$require_library(highlighter, ((function() {if (highlighter['$==']("pygments")) { + return "pygments.rb" } else { - return nil - }; - }; - - def.$read_lines = function() { - var $a, $b, self = this, lines = nil; - lines = []; - while (($b = self['$has_more_lines?']()) !== false && $b !== nil) { - lines['$<<'](self.$read_line())}; - return lines; - }; - - $opal.defn(self, '$readlines', def.$read_lines); + return highlighter + }; return nil; })())); + callout_marks = $hash2([], {}); + lineno = 0; + callout_on_last = false; + if (sub_callouts !== false && sub_callouts !== nil) { + last = -1; + source = ($a = ($b = source.$split($scope.EOL)).$map, $a._p = (TMP_46 = function(line){var self = TMP_46._s || this, $a, $b, TMP_47; +if (line == null) line = nil; + lineno = lineno['$+'](1); + return ($a = ($b = line).$gsub, $a._p = (TMP_47 = function(){var self = TMP_47._s || this, $a, $b, $c, m = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; - def.$read = function() { - var self = this; - return self.$read_lines()['$*']($scope.EOL); + m = $gvars["~"]; + if (m['$[]'](1)['$==']("\\")) { + return m['$[]'](0).$sub("\\", "") + } else { + (($a = lineno, $b = callout_marks, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, []))))['$<<'](m['$[]'](3)); + last = lineno; + return nil; + };}, TMP_47._s = self, TMP_47), $a).call($b, $scope.CalloutScanRx);}, TMP_46._s = self, TMP_46), $a).call($b)['$*']($scope.EOL); + callout_on_last = (last['$=='](lineno));}; + linenums_mode = nil; + $case = highlighter;if ("coderay"['$===']($case)) {result = ((($a = $opal.Object._scope.CodeRay) == null ? $opal.cm('CodeRay') : $a))._scope.Duo['$[]'](self.$attr("language", "text").$to_sym(), "html", $hash2(["css", "line_numbers", "line_number_anchors"], {"css": (((($a = self.document.$attributes()['$[]']("coderay-css")) !== false && $a !== nil) ? $a : "class")).$to_sym(), "line_numbers": (linenums_mode = ((function() {if ((($a = (self['$attr?']("linenums"))) !== nil && (!$a._isBoolean || $a == true))) { + return (((($a = self.document.$attributes()['$[]']("coderay-linenums-mode")) !== false && $a !== nil) ? $a : "table")).$to_sym() + } else { + return nil + }; return nil; })())), "line_number_anchors": false})).$highlight(source)}else if ("pygments"['$===']($case)) {if ((($a = (lexer = ((($c = $opal.Object._scope.Pygments) == null ? $opal.cm('Pygments') : $c))._scope.Lexer['$[]'](self.$attr("language")))) !== nil && (!$a._isBoolean || $a == true))) { + opts = $hash2(["cssclass", "classprefix", "nobackground"], {"cssclass": "pyhl", "classprefix": "tok-", "nobackground": true}); + if ((((($a = self.document.$attributes()['$[]']("pygments-css")) !== false && $a !== nil) ? $a : "class"))['$==']("class")) { + } else { + opts['$[]=']("noclasses", true); + opts['$[]=']("style", (((($a = self.document.$attributes()['$[]']("pygments-style")) !== false && $a !== nil) ? $a : ($scope.Stylesheets)._scope.DEFAULT_PYGMENTS_STYLE))); + }; + if ((($a = self['$attr?']("linenums")) !== nil && (!$a._isBoolean || $a == true))) { + if ((opts['$[]=']("linenos", ((($a = self.document.$attributes()['$[]']("pygments-linenums-mode")) !== false && $a !== nil) ? $a : "table")))['$==']("table")) { + result = lexer.$highlight(source, $hash2(["options"], {"options": opts})).$sub(/
(.*)<\/div>/m, "\\1").$gsub(/]*>(.*?)<\/pre>\s*/m, "\\1") + } else { + result = lexer.$highlight(source, $hash2(["options"], {"options": opts})).$sub(/
]*>(.*?)<\/pre><\/div>/m, "\\1") + } + } else { + opts['$[]=']("nowrap", true); + result = lexer.$highlight(source, $hash2(["options"], {"options": opts})); + }; + } else { + result = source + }}; + if ((($a = self.passthroughs['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + result = result.$gsub($scope.PASS_MATCH_HI, "" + ($scope.PASS_START) + "\\1" + ($scope.PASS_END)) + }; + if ((($a = ((($c = sub_callouts['$!']()) !== false && $c !== nil) ? $c : callout_marks['$empty?']())) !== nil && (!$a._isBoolean || $a == true))) { + return result + } else { + lineno = 0; + reached_code = linenums_mode['$==']("table")['$!'](); + return ($a = ($c = result.$split($scope.EOL)).$map, $a._p = (TMP_48 = function(line){var self = TMP_48._s || this, $a, $b, $c, TMP_49, conums = nil, tail = nil, pos = nil, conums_markup = nil; + if (self.document == null) self.document = nil; +if (line == null) line = nil; + if (reached_code !== false && reached_code !== nil) { + } else { + if ((($a = line['$include?']("")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return line; + }; + reached_code = true; + }; + lineno = lineno['$+'](1); + if ((($a = (conums = callout_marks.$delete(lineno))) !== nil && (!$a._isBoolean || $a == true))) { + tail = nil; + if ((($a = ($b = (($c = callout_on_last !== false && callout_on_last !== nil) ? callout_marks['$empty?']() : $c), $b !== false && $b !== nil ?(pos = line.$index("")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + tail = line['$[]']($range(pos, -1, false)); + line = line['$[]']($range(0, pos, true));}; + if (conums.$size()['$=='](1)) { + return "" + (line) + ($scope.Inline.$new(self, "callout", conums['$[]'](0), $hash2(["id"], {"id": self.document.$callouts().$read_next_id()})).$convert()) + (tail) + } else { + conums_markup = ($a = ($b = conums).$map, $a._p = (TMP_49 = function(conum){var self = TMP_49._s || this; + if (self.document == null) self.document = nil; +if (conum == null) conum = nil; + return $scope.Inline.$new(self, "callout", conum, $hash2(["id"], {"id": self.document.$callouts().$read_next_id()})).$convert()}, TMP_49._s = self, TMP_49), $a).call($b)['$*'](" "); + return "" + (line) + (conums_markup) + (tail); + }; + } else { + return line + };}, TMP_48._s = self, TMP_48), $a).call($c)['$*']($scope.EOL); + }; }; - def.$advance = function(direct) { + def.$lock_in_subs = function() { + var $a, $b, $c, $d, $e, TMP_50, self = this, default_subs = nil, $case = nil, custom_subs = nil, highlighter = nil; + if (self.default_subs == null) self.default_subs = nil; + if (self.content_model == null) self.content_model = nil; + if (self.context == null) self.context = nil; + if (self.attributes == null) self.attributes = nil; + if (self.style == null) self.style = nil; + if (self.document == null) self.document = nil; + if (self.subs == null) self.subs = nil; + + if ((($a = self.default_subs) !== nil && (!$a._isBoolean || $a == true))) { + default_subs = self.default_subs + } else { + $case = self.content_model;if ("simple"['$===']($case)) {default_subs = $scope.SUBS['$[]']("normal")}else if ("verbatim"['$===']($case)) {default_subs = (function() {if ((($a = ((($b = self.context['$==']("listing")) !== false && $b !== nil) ? $b : ((($c = self.context['$==']("literal")) ? (self['$option?']("listparagraph"))['$!']() : $c)))) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.SUBS['$[]']("verbatim") + } else if (self.context['$==']("verse")) { + return $scope.SUBS['$[]']("normal") + } else { + return $scope.SUBS['$[]']("basic") + }; return nil; })()}else if ("raw"['$===']($case)) {default_subs = $scope.SUBS['$[]']("pass")}else {return nil} + }; + if ((($a = (custom_subs = self.attributes['$[]']("subs"))) !== nil && (!$a._isBoolean || $a == true))) { + self.subs = self.$resolve_block_subs(custom_subs, default_subs, self.context) + } else { + self.subs = default_subs.$dup() + }; + if ((($a = ($b = ($c = ($d = (($e = self.context['$==']("listing")) ? self.style['$==']("source") : $e), $d !== false && $d !== nil ?(self.document['$basebackend?']("html")) : $d), $c !== false && $c !== nil ?(((($d = ((highlighter = self.document.$attributes()['$[]']("source-highlighter")))['$==']("coderay")) !== false && $d !== nil) ? $d : highlighter['$==']("pygments"))) : $c), $b !== false && $b !== nil ?(self['$attr?']("language")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.subs = ($a = ($b = self.subs).$map, $a._p = (TMP_50 = function(sub){var self = TMP_50._s || this; +if (sub == null) sub = nil; + if (sub['$==']("specialcharacters")) { + return "highlight" + } else { + return sub + }}, TMP_50._s = self, TMP_50), $a).call($b) + } else { + return nil + }; + }; + ;$opal.donate(self, ["$apply_subs", "$apply_normal_subs", "$apply_title_subs", "$apply_header_subs", "$extract_passthroughs", "$restore_passthroughs", "$sub_specialcharacters", "$sub_specialchars", "$sub_quotes", "$sub_replacements", "$do_replacement", "$sub_attributes", "$sub_macros", "$sub_inline_anchors", "$sub_inline_xrefs", "$sub_callouts", "$sub_post_replacements", "$convert_quoted_text", "$parse_quoted_text_attributes", "$parse_attributes", "$unescape_bracketed_text", "$normalize_string", "$unescape_brackets", "$split_simple_csv", "$resolve_subs", "$resolve_block_subs", "$resolve_pass_subs", "$highlight_source", "$lock_in_subs"]); + })(self) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $AbstractNode(){}; + var self = $AbstractNode = $klass($base, $super, 'AbstractNode', $AbstractNode); + + var def = self._proto, $scope = self._scope; + + def.document = def.attributes = def.path_resolver = def.style = nil; + self.$include($scope.Substitutors); + + self.$attr_reader("parent"); + + self.$attr_reader("document"); + + self.$attr_reader("context"); + + self.$attr_reader("node_name"); + + self.$attr_accessor("id"); + + self.$attr_reader("attributes"); + + def.$initialize = function(parent, context) { var $a, self = this; - if (direct == null) { - direct = true - } - return ($a = (self.$read_line(direct))['$nil?'](), ($a === nil || $a === false)); + + if (context['$==']("document")) { + self.parent = nil; + self.document = parent; + } else if ((($a = (self.parent = parent)) !== nil && (!$a._isBoolean || $a == true))) { + self.document = parent.$document() + } else { + self.document = nil + }; + self.context = context; + self.node_name = context.$to_s(); + self.attributes = $hash2([], {}); + return self.passthroughs = []; }; - def.$unshift_line = function(line_to_restore) { + def['$parent='] = function(parent) { var self = this; - self.$unshift(line_to_restore); + + self.parent = parent; + self.document = parent.$document(); return nil; }; - $opal.defn(self, '$restore_line', def.$unshift_line); + def['$inline?'] = function() { + var $a, self = this; - def.$unshift_lines = function(lines_to_restore) { - var $a, $b, TMP_3, self = this; - ($a = ($b = lines_to_restore).$reverse_each, $a._p = (TMP_3 = function(line){var self = TMP_3._s || this;if (line == null) line = nil; - return self.$unshift(line)}, TMP_3._s = self, TMP_3), $a).call($b); - return nil; + return self.$raise((($a = $opal.Object._scope.NotImplementedError) == null ? $opal.cm('NotImplementedError') : $a)); }; - $opal.defn(self, '$restore_lines', def.$unshift_lines); + def['$block?'] = function() { + var $a, self = this; - def.$replace_line = function(replacement) { - var self = this; - self.$advance(); - self.$unshift(replacement); - return nil; + return self.$raise((($a = $opal.Object._scope.NotImplementedError) == null ? $opal.cm('NotImplementedError') : $a)); }; - def.$skip_blank_lines = function() { - var $a, $b, self = this, num_skipped = nil, next_line = nil; - if (($a = self['$eof?']()) !== false && $a !== nil) { - return 0}; - num_skipped = 0; - while (($b = (next_line = self.$peek_line())) !== false && $b !== nil) { - if (($b = next_line['$empty?']()) !== false && $b !== nil) { - self.$advance(); - num_skipped = num_skipped['$+'](1); + def.$attr = function(name, default_value, inherit) { + var $a, $b, self = this; + + if (default_value == null) { + default_value = nil + } + if (inherit == null) { + inherit = true + } + if ((($a = name['$is_a?']((($b = $opal.Object._scope.Symbol) == null ? $opal.cm('Symbol') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + name = name.$to_s()}; + if (self['$=='](self.document)) { + inherit = false}; + if (inherit !== false && inherit !== nil) { + return ((($a = ((($b = self.attributes['$[]'](name)) !== false && $b !== nil) ? $b : self.document.$attributes()['$[]'](name))) !== false && $a !== nil) ? $a : default_value) } else { - return num_skipped - }}; - return num_skipped; + return ((($a = self.attributes['$[]'](name)) !== false && $a !== nil) ? $a : default_value) + }; }; - def.$skip_comment_lines = function(opts) { - var $a, $b, $c, $d, self = this, comment_lines = nil, include_blank_lines = nil, next_line = nil, commentish = nil, match = nil; - if (opts == null) { - opts = $hash2([], {}) + def['$attr?'] = function(name, expect, inherit) { + var $a, $b, self = this; + + if (expect == null) { + expect = nil } - if (($a = self['$eof?']()) !== false && $a !== nil) { - return []}; - comment_lines = []; - include_blank_lines = opts['$[]']("include_blank_lines"); - while (($b = (next_line = self.$peek_line())) !== false && $b !== nil) { - if (($b = (($c = include_blank_lines !== false && include_blank_lines !== nil) ? next_line['$empty?']() : $c)) !== false && $b !== nil) { - comment_lines['$<<'](self.$read_line()) - } else if (($b = ($c = (commentish = next_line['$start_with?']("//")), $c !== false && $c !== nil ?(match = next_line.$match($scope.REGEXP['$[]']("comment_blk"))) : $c)) !== false && $b !== nil) { - comment_lines['$<<'](self.$read_line()); - ($b = comment_lines).$push.apply($b, [].concat((self.$read_lines_until($hash2(["terminator", "read_last_line", "skip_processing"], {"terminator": match['$[]'](0), "read_last_line": true, "skip_processing": true}))))); - } else if (($c = (($d = commentish !== false && commentish !== nil) ? next_line.$match($scope.REGEXP['$[]']("comment")) : $d)) !== false && $c !== nil) { - comment_lines['$<<'](self.$read_line()) + if (inherit == null) { + inherit = true + } + if ((($a = name['$is_a?']((($b = $opal.Object._scope.Symbol) == null ? $opal.cm('Symbol') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + name = name.$to_s()}; + if (self['$=='](self.document)) { + inherit = false}; + if ((($a = expect['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return ((($a = self.attributes['$has_key?'](name)) !== false && $a !== nil) ? $a : ((($b = inherit !== false && inherit !== nil) ? self.document.$attributes()['$has_key?'](name) : $b))) + } else if (inherit !== false && inherit !== nil) { + return expect['$==']((((($a = self.attributes['$[]'](name)) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]'](name)))) } else { - break; - }}; - return comment_lines; + return expect['$=='](self.attributes['$[]'](name)) + }; }; - def.$skip_line_comments = function() { - var $a, $b, self = this, comment_lines = nil, next_line = nil; - if (($a = self['$eof?']()) !== false && $a !== nil) { - return []}; - comment_lines = []; - while (($b = (next_line = self.$peek_line())) !== false && $b !== nil) { - if (($b = next_line.$match($scope.REGEXP['$[]']("comment"))) !== false && $b !== nil) { - comment_lines['$<<'](self.$read_line()) + def.$set_attr = function(name, value, overwrite) { + var $a, $b, self = this; + + if (overwrite == null) { + overwrite = nil + } + if ((($a = overwrite['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.attributes['$[]='](name, value); + return true; + } else if ((($a = ((($b = overwrite) !== false && $b !== nil) ? $b : (self.attributes['$key?'](name))['$!']())) !== nil && (!$a._isBoolean || $a == true))) { + self.attributes['$[]='](name, value); + return true; } else { - break; - }}; - return comment_lines; + return false + }; }; - def.$terminate = function() { + def.$set_option = function(name) { + var $a, self = this; + + if ((($a = self.attributes['$has_key?']("options")) !== nil && (!$a._isBoolean || $a == true))) { + self.attributes['$[]=']("options", "" + (self.attributes['$[]']("options")) + "," + (name)) + } else { + self.attributes['$[]=']("options", name) + }; + return self.attributes['$[]=']("" + (name) + "-option", ""); + }; + + def['$option?'] = function(name) { var self = this; - self.lineno = self.lineno['$+'](self.lines.$size()); - self.lines.$clear(); - self.eof = true; - self.look_ahead = 0; + + return self.attributes['$has_key?']("" + (name) + "-option"); + }; + + def.$update_attributes = function(attributes) { + var self = this; + + self.attributes.$update(attributes); return nil; }; - def['$eof?'] = function() { - var $a, self = this; - return ($a = self['$has_more_lines?'](), ($a === nil || $a === false)); + def.$converter = function() { + var self = this; + + return self.document.$converter(); }; - $opal.defn(self, '$empty?', def['$eof?']); + def['$role?'] = function(expect) { + var $a, self = this; - def.$read_lines_until = TMP_4 = function(options) { - var $a, $b, $c, $d, $e, self = this, $iter = TMP_4._p, $yield = $iter || nil, result = nil, restore_process_lines = nil, has_block = nil, terminator = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_line_comments = nil, line_read = nil, line_restored = nil, complete = nil, line = nil; - if (options == null) { - options = $hash2([], {}) + if (expect == null) { + expect = nil } - TMP_4._p = null; - result = []; - if (($a = options['$[]']("skip_first_line")) !== false && $a !== nil) { - self.$advance()}; - if (($a = ($b = self.process_lines, $b !== false && $b !== nil ?options['$[]']("skip_processing") : $b)) !== false && $a !== nil) { - self.process_lines = false; - restore_process_lines = true; - } else { - restore_process_lines = false - }; - has_block = ($yield !== nil); - if (($a = (terminator = options['$[]']("terminator"))) !== false && $a !== nil) { - break_on_blank_lines = false; - break_on_list_continuation = false; + if ((($a = expect['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return ((($a = self.attributes['$has_key?']("role")) !== false && $a !== nil) ? $a : self.document.$attributes()['$has_key?']("role")) } else { - break_on_blank_lines = options['$[]']("break_on_blank_lines"); - break_on_list_continuation = options['$[]']("break_on_list_continuation"); + return expect['$==']((((($a = self.attributes['$[]']("role")) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]']("role")))) }; - skip_line_comments = options['$[]']("skip_line_comments"); - line_read = false; - line_restored = false; - complete = false; - while (($b = ($c = ($d = complete, ($d === nil || $d === false)), $c !== false && $c !== nil ?(line = self.$read_line()) : $c)) !== false && $b !== nil) { - complete = (function() {while (($c = true) !== false && $c !== nil) { - if (($c = (($d = terminator !== false && terminator !== nil) ? line['$=='](terminator) : $d)) !== false && $c !== nil) { - return true}; - if (($c = (($d = break_on_blank_lines !== false && break_on_blank_lines !== nil) ? line['$empty?']() : $d)) !== false && $c !== nil) { - return true}; - if (($c = ($d = (($e = break_on_list_continuation !== false && break_on_list_continuation !== nil) ? line_read : $e), $d !== false && $d !== nil ?line['$==']($scope.LIST_CONTINUATION) : $d)) !== false && $c !== nil) { - options['$[]=']("preserve_last_line", true); - return true;}; - if (($c = (($d = has_block !== false && has_block !== nil) ? (((($e = $opal.$yield1($yield, line)) === $breaker) ? $breaker.$v : $e)) : $d)) !== false && $c !== nil) { - return true}; - return false;}; return nil; })(); - if (complete !== false && complete !== nil) { - if (($b = options['$[]']("read_last_line")) !== false && $b !== nil) { - result['$<<'](line); - line_read = true;}; - if (($b = options['$[]']("preserve_last_line")) !== false && $b !== nil) { - self.$restore_line(line); - line_restored = true;}; - } else if (($b = ($c = (($d = skip_line_comments !== false && skip_line_comments !== nil) ? line['$start_with?']("//") : $d), $c !== false && $c !== nil ?line.$match($scope.REGEXP['$[]']("comment")) : $c)) === false || $b === nil) { - result['$<<'](line); - line_read = true;};}; - if (restore_process_lines !== false && restore_process_lines !== nil) { - self.process_lines = true; - if (($a = (($b = line_restored !== false && line_restored !== nil) ? terminator['$nil?']() : $b)) !== false && $a !== nil) { - self.look_ahead = self.look_ahead['$-'](1)};}; - return result; }; - def.$shift = function() { + def.$role = function() { var $a, self = this; - self.lineno = self.lineno['$+'](1); - if (($a = self.look_ahead['$=='](0)) === false || $a === nil) { - self.look_ahead = self.look_ahead['$-'](1)}; - return self.lines.$shift(); - }; - def.$unshift = function(line) { - var self = this; - self.lineno = self.lineno['$-'](1); - self.look_ahead = self.look_ahead['$+'](1); - self.eof = false; - return self.lines.$unshift(line); + return ((($a = self.attributes['$[]']("role")) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]']("role")); }; - def.$cursor = function() { - var self = this; - return $scope.Cursor.$new(self.file, self.dir, self.path, self.lineno); - }; + def['$has_role?'] = function(name) { + var $a, $b, self = this, val = nil; - def.$line_info = function() { - var self = this; - return "" + (self.path) + ": line " + (self.lineno); + if ((($a = (val = (((($b = self.attributes['$[]']("role")) !== false && $b !== nil) ? $b : self.document.$attributes()['$[]']("role"))))) !== nil && (!$a._isBoolean || $a == true))) { + return val.$split(" ")['$include?'](name) + } else { + return false + }; }; - $opal.defn(self, '$next_line_info', def.$line_info); + def.$roles = function() { + var $a, $b, self = this, val = nil; - def.$prev_line_info = function() { - var self = this; - return "" + (self.path) + ": line " + (self.lineno['$-'](1)); + if ((($a = (val = (((($b = self.attributes['$[]']("role")) !== false && $b !== nil) ? $b : self.document.$attributes()['$[]']("role"))))) !== nil && (!$a._isBoolean || $a == true))) { + return val.$split(" ") + } else { + return [] + }; }; - def.$lines = function() { - var self = this; - return self.lines.$dup(); - }; + def['$reftext?'] = function() { + var $a, self = this; - def.$string = function() { - var self = this; - return self.lines['$*']($scope.EOL); + return ((($a = self.attributes['$has_key?']("reftext")) !== false && $a !== nil) ? $a : self.document.$attributes()['$has_key?']("reftext")); }; - def.$source = function() { - var self = this; - return self.source_lines['$*']($scope.EOL); - }; + def.$reftext = function() { + var $a, self = this; - return (def.$to_s = function() { - var self = this; - return self.$line_info(); - }, nil); - })(self, null); + return ((($a = self.attributes['$[]']("reftext")) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]']("reftext")); + }; - (function($base, $super) { - function $PreprocessorReader(){}; - var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + def.$icon_uri = function(name) { + var $a, self = this; - var def = $PreprocessorReader._proto, $scope = $PreprocessorReader._scope, TMP_5, TMP_6, TMP_7, TMP_20; - def.document = def.lineno = def.process_lines = def.look_ahead = def.skipping = def.include_stack = def.conditional_stack = def.include_processors = def.maxdepth = def.dir = def.lines = def.file = def.path = def.includes = def.unescape_next_line = nil; - self.$attr_reader("include_stack"); + if ((($a = self['$attr?']("icon")) !== nil && (!$a._isBoolean || $a == true))) { + return self.$image_uri(self.$attr("icon"), nil) + } else { + return self.$image_uri("" + (name) + "." + (self.document.$attr("icontype", "png")), "iconsdir") + }; + }; - self.$attr_reader("includes"); + def.$media_uri = function(target, asset_dir_key) { + var $a, $b, self = this; - def.$initialize = TMP_5 = function(document, data, cursor) { - var $a, $b, $c, self = this, $iter = TMP_5._p, $yield = $iter || nil, include_depth_default = nil; - if (data == null) { - data = nil - } - if (cursor == null) { - cursor = nil + if (asset_dir_key == null) { + asset_dir_key = "imagesdir" } - TMP_5._p = null; - self.document = document; - $opal.find_super_dispatcher(self, 'initialize', TMP_5, null).apply(self, [data, cursor, $hash2(["normalize"], {"normalize": true})]); - include_depth_default = document.$attributes().$fetch("max-include-depth", 64).$to_i(); - if (include_depth_default['$<'](0)) { - include_depth_default = 0}; - self.maxdepth = $hash2(["abs", "rel"], {"abs": include_depth_default, "rel": include_depth_default}); - self.include_stack = []; - self.includes = (($a = "includes", $b = document.$references(), ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, [])))); - self.skipping = false; - self.conditional_stack = []; - return self.include_processors = nil; + if ((($a = ($b = target['$include?'](":"), $b !== false && $b !== nil ?$scope.UriSniffRx['$=~'](target) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return target + } else if ((($a = (($b = asset_dir_key !== false && asset_dir_key !== nil) ? self['$attr?'](asset_dir_key) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.$normalize_web_path(target, self.document.$attr(asset_dir_key)) + } else { + return self.$normalize_web_path(target) + }; }; - def.$prepare_lines = TMP_6 = function(data, opts) {var $zuper = $slice.call(arguments, 0); - var $a, $b, $c, $d, self = this, $iter = TMP_6._p, $yield = $iter || nil, result = nil, front_matter = nil, first = nil, last = nil, indent = nil; - if (opts == null) { - opts = $hash2([], {}) + def.$image_uri = function(target_image, asset_dir_key) { + var $a, $b, self = this; + + if (asset_dir_key == null) { + asset_dir_key = "imagesdir" } - TMP_6._p = null; - result = $opal.find_super_dispatcher(self, 'prepare_lines', TMP_6, $iter).apply(self, $zuper); - if (($a = ((($b = self.document['$nil?']()) !== false && $b !== nil) ? $b : ($c = (self.document.$attributes()['$has_key?']("skip-front-matter")), ($c === nil || $c === false)))) === false || $a === nil) { - if (($a = (front_matter = self['$skip_front_matter!'](result))) !== false && $a !== nil) { - self.document.$attributes()['$[]=']("front-matter", front_matter['$*']($scope.EOL))}}; - if (($a = opts.$fetch("condense", true)) !== false && $a !== nil) { - while (($b = ($c = ($d = ((first = result.$first()))['$nil?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?first['$empty?']() : $c)) !== false && $b !== nil) { - ($b = result.$shift(), $b !== false && $b !== nil ?self.lineno = self.lineno['$+'](1) : $b)}; - while (($b = ($c = ($d = ((last = result.$last()))['$nil?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?last['$empty?']() : $c)) !== false && $b !== nil) { - result.$pop()};}; - if (($a = (indent = opts.$fetch("indent", nil))) !== false && $a !== nil) { - $scope.Lexer['$reset_block_indent!'](result, indent.$to_i())}; - return result; + if ((($a = ($b = target_image['$include?'](":"), $b !== false && $b !== nil ?$scope.UriSniffRx['$=~'](target_image) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return target_image + } else if ((($a = (($b = self.document.$safe()['$<'](($scope.SafeMode)._scope.SECURE)) ? self.document['$attr?']("data-uri") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.$generate_data_uri(target_image, asset_dir_key) + } else if ((($a = (($b = asset_dir_key !== false && asset_dir_key !== nil) ? self['$attr?'](asset_dir_key) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.$normalize_web_path(target_image, self.document.$attr(asset_dir_key)) + } else { + return self.$normalize_web_path(target_image) + }; }; - def.$process_line = function(line) { - var $a, $b, $c, $d, self = this, macroish = nil, match = nil; - if (($a = self.process_lines) === false || $a === nil) { - return line}; - if (($a = line['$empty?']()) !== false && $a !== nil) { - self.look_ahead = self.look_ahead['$+'](1); - return "";}; - macroish = ($a = line['$include?']("::"), $a !== false && $a !== nil ?line['$include?']("[") : $a); - if (($a = ($b = (($c = macroish !== false && macroish !== nil) ? line['$include?']("if") : $c), $b !== false && $b !== nil ?(match = line.$match($scope.REGEXP['$[]']("ifdef_macro"))) : $b)) !== false && $a !== nil) { - if (($a = line['$start_with?']("\\")) !== false && $a !== nil) { - self.unescape_next_line = true; - self.look_ahead = self.look_ahead['$+'](1); - return line['$[]']($range(1, -1, false)); - } else if (($a = ($b = self).$preprocess_conditional_inclusion.apply($b, [].concat(match.$captures()))) !== false && $a !== nil) { - self.$advance(); - return nil; - } else { - self.look_ahead = self.look_ahead['$+'](1); - return line; - } - } else if (($a = self.skipping) !== false && $a !== nil) { - self.$advance(); - return nil; - } else if (($a = ($c = (($d = macroish !== false && macroish !== nil) ? line['$include?']("include::") : $d), $c !== false && $c !== nil ?(match = line.$match($scope.REGEXP['$[]']("include_macro"))) : $c)) !== false && $a !== nil) { - if (($a = line['$start_with?']("\\")) !== false && $a !== nil) { - self.unescape_next_line = true; - self.look_ahead = self.look_ahead['$+'](1); - return line['$[]']($range(1, -1, false)); - } else if (($a = self.$preprocess_include(match['$[]'](1), match['$[]'](2).$strip())) !== false && $a !== nil) { - return nil - } else { - self.look_ahead = self.look_ahead['$+'](1); - return line; - } + def.$generate_data_uri = function(target_image, asset_dir_key) { + var $a, $b, TMP_1, $c, self = this, ext = nil, mimetype = nil, image_path = nil, bindata = nil; + + if (asset_dir_key == null) { + asset_dir_key = nil + } + ext = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$extname(target_image)['$[]']($range(1, -1, false)); + mimetype = "image/"['$+'](ext); + if (ext['$==']("svg")) { + mimetype = "" + (mimetype) + "+xml"}; + if (asset_dir_key !== false && asset_dir_key !== nil) { + image_path = self.$normalize_system_path(target_image, self.document.$attr(asset_dir_key), nil, $hash2(["target_name"], {"target_name": "image"})) } else { - self.look_ahead = self.look_ahead['$+'](1); - return line; + image_path = self.$normalize_system_path(target_image) + }; + if ((($a = (($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b)['$readable?'](image_path)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$warn("asciidoctor: WARNING: image to embed not found or not readable: " + (image_path)); + return "data:" + (mimetype) + ":base64,"; + }; + bindata = nil; + if ((($a = (($b = $opal.Object._scope.IO) == null ? $opal.cm('IO') : $b)['$respond_to?']("binread")) !== nil && (!$a._isBoolean || $a == true))) { + bindata = (($a = $opal.Object._scope.IO) == null ? $opal.cm('IO') : $a).$binread(image_path) + } else { + bindata = ($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)).$open, $a._p = (TMP_1 = function(file){var self = TMP_1._s || this; +if (file == null) file = nil; + return file.$read()}, TMP_1._s = self, TMP_1), $a).call($b, image_path, "rb") }; + return "data:" + (mimetype) + ";base64," + ((($a = $opal.Object._scope.Base64) == null ? $opal.cm('Base64') : $a).$encode64(bindata).$delete($scope.EOL)); }; - def.$peek_line = TMP_7 = function(direct) {var $zuper = $slice.call(arguments, 0); - var $a, self = this, $iter = TMP_7._p, $yield = $iter || nil, line = nil; - if (direct == null) { - direct = false + def.$read_asset = function(path, warn_on_failure) { + var $a, $b, self = this; + + if (warn_on_failure == null) { + warn_on_failure = false } - TMP_7._p = null; - if (($a = (line = $opal.find_super_dispatcher(self, 'peek_line', TMP_7, $iter).apply(self, $zuper))) !== false && $a !== nil) { - return line - } else if (($a = self.include_stack['$empty?']()) !== false && $a !== nil) { - return nil + if ((($a = (($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b)['$readable?'](path)) !== nil && (!$a._isBoolean || $a == true))) { + return (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$read(path).$chomp() } else { - self.$pop_include(); - return self.$peek_line(direct); + if (warn_on_failure !== false && warn_on_failure !== nil) { + self.$warn("asciidoctor: WARNING: file does not exist or cannot be read: " + (path))}; + return nil; }; }; - def.$preprocess_conditional_inclusion = function(directive, target, delimiter, text) { - var $a, $b, $c, $d, TMP_8, TMP_9, $e, TMP_10, TMP_11, $f, $g, self = this, stack_size = nil, pair = nil, skip = nil, $case = nil, expr_match = nil, lhs = nil, op = nil, rhs = nil, conditional_line = nil; - if (($a = ((($b = (($c = (((($d = directive['$==']("ifdef")) !== false && $d !== nil) ? $d : directive['$==']("ifndef"))), $c !== false && $c !== nil ?target['$empty?']() : $c))) !== false && $b !== nil) ? $b : ((($c = directive['$==']("endif")) ? ($d = text['$nil?'](), ($d === nil || $d === false)) : $c)))) !== false && $a !== nil) { - return false}; - if (directive['$==']("endif")) { - stack_size = self.conditional_stack.$size(); - if (stack_size['$>'](0)) { - pair = self.conditional_stack.$last(); - if (($a = ((($b = target['$empty?']()) !== false && $b !== nil) ? $b : target['$=='](pair['$[]']("target")))) !== false && $a !== nil) { - self.conditional_stack.$pop(); - self.skipping = (function() {if (($a = self.conditional_stack['$empty?']()) !== false && $a !== nil) { - return false - } else { - return self.conditional_stack.$last()['$[]']("skipping") - }; return nil; })(); - } else { - self.$warn("asciidoctor: ERROR: " + (self.$line_info()) + ": mismatched macro: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]") - }; - } else { - self.$warn("asciidoctor: ERROR: " + (self.$line_info()) + ": unmatched macro: endif::" + (target) + "[]") - }; - return true;}; - skip = false; - if (($a = self.skipping) === false || $a === nil) { - $case = directive;if ("ifdef"['$===']($case)) {$case = delimiter;if (nil['$===']($case)) {skip = ($a = self.document.$attributes()['$has_key?'](target), ($a === nil || $a === false))}else if (","['$===']($case)) {skip = ($a = ($b = ($c = target.$split(",")).$detect, $b._p = (TMP_8 = function(name){var self = TMP_8._s || this; - if (self.document == null) self.document = nil; -if (name == null) name = nil; - return self.document.$attributes()['$has_key?'](name)}, TMP_8._s = self, TMP_8), $b).call($c), ($a === nil || $a === false))}else if ("+"['$===']($case)) {skip = ($a = ($b = target.$split("+")).$detect, $a._p = (TMP_9 = function(name){var self = TMP_9._s || this, $a; - if (self.document == null) self.document = nil; -if (name == null) name = nil; - return ($a = self.document.$attributes()['$has_key?'](name), ($a === nil || $a === false))}, TMP_9._s = self, TMP_9), $a).call($b)}}else if ("ifndef"['$===']($case)) {$case = delimiter;if (nil['$===']($case)) {skip = self.document.$attributes()['$has_key?'](target)}else if (","['$===']($case)) {skip = ($a = ($d = ($e = target.$split(",")).$detect, $d._p = (TMP_10 = function(name){var self = TMP_10._s || this, $a; - if (self.document == null) self.document = nil; -if (name == null) name = nil; - return ($a = self.document.$attributes()['$has_key?'](name), ($a === nil || $a === false))}, TMP_10._s = self, TMP_10), $d).call($e), ($a === nil || $a === false))}else if ("+"['$===']($case)) {skip = ($a = ($d = target.$split("+")).$detect, $a._p = (TMP_11 = function(name){var self = TMP_11._s || this; - if (self.document == null) self.document = nil; -if (name == null) name = nil; - return self.document.$attributes()['$has_key?'](name)}, TMP_11._s = self, TMP_11), $a).call($d)}}else if ("ifeval"['$===']($case)) {if (($a = ((($f = ($g = target['$empty?'](), ($g === nil || $g === false))) !== false && $f !== nil) ? $f : ($g = (expr_match = text.$strip().$match($scope.REGEXP['$[]']("eval_expr"))), ($g === nil || $g === false)))) !== false && $a !== nil) { - return false}; - lhs = self.$resolve_expr_val(expr_match['$[]'](1)); - op = expr_match['$[]'](2); - rhs = self.$resolve_expr_val(expr_match['$[]'](3)); - skip = ($a = (lhs.$send(op.$to_sym(), rhs)), ($a === nil || $a === false));}}; - if (($a = ((($f = directive['$==']("ifeval")) !== false && $f !== nil) ? $f : text['$nil?']())) !== false && $a !== nil) { - if (skip !== false && skip !== nil) { - self.skipping = true}; - self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping})); - } else if (($a = ((($f = self.skipping) !== false && $f !== nil) ? $f : skip)) === false || $a === nil) { - conditional_line = self.$peek_line(true); - self.$replace_line(text.$rstrip()); - self.$unshift(conditional_line); - return true;}; - return true; + def.$normalize_web_path = function(target, start) { + var $a, self = this; + + if (start == null) { + start = nil + } + return (((($a = self.path_resolver) !== false && $a !== nil) ? $a : self.path_resolver = $scope.PathResolver.$new())).$web_path(target, start); }; - def.$preprocess_include = function(target, raw_attributes) { - var $a, $b, $c, $d, TMP_12, TMP_13, TMP_14, $e, TMP_16, $f, TMP_19, self = this, processor = nil, abs_maxdepth = nil, target_type = nil, include_file = nil, path = nil, inc_lines = nil, tags = nil, attributes = nil, selected = nil, inc_line_offset = nil, inc_lineno = nil, active_tag = nil, tags_found = nil, missing_tags = nil; - target = self.document.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})); - if (($a = target['$empty?']()) !== false && $a !== nil) { - if (self.document.$attributes().$fetch("attribute-missing", $scope.Compliance.$attribute_missing())['$==']("skip")) { - return false - } else { - self.$advance(); - return true; - } - } else if (($a = ($b = self['$include_processors?'](), $b !== false && $b !== nil ?(processor = ($c = ($d = self.include_processors).$find, $c._p = (TMP_12 = function(candidate){var self = TMP_12._s || this;if (candidate == null) candidate = nil; - return candidate['$handles?'](target)}, TMP_12._s = self, TMP_12), $c).call($d)) : $b)) !== false && $a !== nil) { - self.$advance(); - processor.$process(self, target, $scope.AttributeList.$new(raw_attributes).$parse()); - return true; - } else if (self.document.$safe()['$>='](($scope.SafeMode)._scope.SECURE)) { - self.$replace_line("link:" + (target) + "[]"); - return true; - } else if (($a = (($b = ((abs_maxdepth = self.maxdepth['$[]']("abs")))['$>'](0)) ? self.include_stack.$size()['$>='](abs_maxdepth) : $b)) !== false && $a !== nil) { - self.$warn("asciidoctor: ERROR: " + (self.$line_info()) + ": maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded"); - return false; - } else if (abs_maxdepth['$>'](0)) { - if (($a = ($b = target['$include?'](":"), $b !== false && $b !== nil ?target.$match($scope.REGEXP['$[]']("uri_sniff")) : $b)) !== false && $a !== nil) { - if (($a = self.document.$attributes()['$has_key?']("allow-uri-read")) === false || $a === nil) { - self.$replace_line("link:" + (target) + "[]"); - return true;}; - target_type = "uri"; - include_file = path = target; - if (($a = self.document.$attributes()['$has_key?']("cache-uri")) !== false && $a !== nil) { - $scope.Helpers.$require_library("open-uri/cached", "open-uri-cached") - } else { - (($a = $opal.Object._scope.OpenURI) == null ? $opal.cm('OpenURI') : $a) - }; - } else { - target_type = "file"; - include_file = self.document.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"})); - if (($a = ($b = $scope.File['$file?'](include_file), ($b === nil || $b === false))) !== false && $a !== nil) { - self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": include file not found: " + (include_file)); - self.$advance(); - return true;}; - path = $scope.PathResolver.$new().$relative_path(include_file, self.document.$base_dir()); - }; - inc_lines = nil; - tags = nil; - attributes = $hash2([], {}); - if (($a = ($b = raw_attributes['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - attributes = $scope.AttributeList.$new(raw_attributes).$parse(); - if (($a = attributes['$has_key?']("lines")) !== false && $a !== nil) { - inc_lines = []; - ($a = ($b = attributes['$[]']("lines").$split($scope.REGEXP['$[]']("ssv_or_csv_delim"))).$each, $a._p = (TMP_13 = function(linedef){var self = TMP_13._s || this, $a, $b, $c, from = nil, to = nil;if (linedef == null) linedef = nil; - if (($a = linedef['$include?']("..")) !== false && $a !== nil) { - $a = $opal.to_ary(($b = ($c = linedef.$split("..")).$map, $b._p = "to_i".$to_proc(), $b).call($c)), from = ($a[0] == null ? nil : $a[0]), to = ($a[1] == null ? nil : $a[1]); - if (to['$=='](-1)) { - inc_lines['$<<'](from); - return inc_lines['$<<']((1.0)['$/'](0.0)); - } else { - return inc_lines.$concat($scope.Range.$new(from, to).$to_a()) - }; - } else { - return inc_lines['$<<'](linedef.$to_i()) - }}, TMP_13._s = self, TMP_13), $a).call($b); - inc_lines = inc_lines.$sort().$uniq(); - } else if (($a = attributes['$has_key?']("tag")) !== false && $a !== nil) { - tags = [attributes['$[]']("tag")].$to_set() - } else if (($a = attributes['$has_key?']("tags")) !== false && $a !== nil) { - tags = attributes['$[]']("tags").$split($scope.REGEXP['$[]']("ssv_or_csv_delim")).$uniq().$to_set()};}; - if (($a = ($c = inc_lines['$nil?'](), ($c === nil || $c === false))) !== false && $a !== nil) { - if (($a = ($c = inc_lines['$empty?'](), ($c === nil || $c === false))) !== false && $a !== nil) { - selected = []; - inc_line_offset = 0; - inc_lineno = 0; - try { - ($a = ($c = self).$open, $a._p = (TMP_14 = function(f){var self = TMP_14._s || this, $a, $b, TMP_15;if (f == null) f = nil; - return ($a = ($b = f).$each_line, $a._p = (TMP_15 = function(l){var self = TMP_15._s || this, $a, $b, take = nil;if (l == null) l = nil; - inc_lineno = inc_lineno['$+'](1); - take = inc_lines.$first(); - if (($a = ($b = take['$is_a?']($scope.Float), $b !== false && $b !== nil ?take['$infinite?']() : $b)) !== false && $a !== nil) { - selected.$push(l); - if (inc_line_offset['$=='](0)) { - return inc_line_offset = inc_lineno - } else { - return nil - }; - } else { - if (f.$lineno()['$=='](take)) { - selected.$push(l); - if (inc_line_offset['$=='](0)) { - inc_line_offset = inc_lineno}; - inc_lines.$shift();}; - if (($a = inc_lines['$empty?']()) !== false && $a !== nil) { - return ($breaker.$v = nil, $breaker) - } else { - return nil - }; - };}, TMP_15._s = self, TMP_15), $a).call($b)}, TMP_14._s = self, TMP_14), $a).call($c, include_file, "r") - } catch ($err) {if (true) { - self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": include " + (target_type) + " not readable: " + (include_file)); - self.$advance(); - return true; - }else { throw $err; } - }; - self.$advance(); - self.$push_include(selected, include_file, path, inc_line_offset, attributes);} - } else if (($a = ($e = tags['$nil?'](), ($e === nil || $e === false))) !== false && $a !== nil) { - if (($a = ($e = tags['$empty?'](), ($e === nil || $e === false))) !== false && $a !== nil) { - selected = []; - inc_line_offset = 0; - inc_lineno = 0; - active_tag = nil; - tags_found = $scope.Set.$new(); - try { - ($a = ($e = self).$open, $a._p = (TMP_16 = function(f){var self = TMP_16._s || this, $a, $b, TMP_17;if (f == null) f = nil; - return ($a = ($b = f).$each_line, $a._p = (TMP_17 = function(l){var self = TMP_17._s || this, $a, $b, TMP_18;if (l == null) l = nil; - inc_lineno = inc_lineno['$+'](1); - if (($a = $scope.FORCE_ENCODING) !== false && $a !== nil) { - l.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8)}; - if (($a = ($b = active_tag['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - if (($a = l['$include?']("end::" + (active_tag) + "[]")) !== false && $a !== nil) { - return active_tag = nil - } else { - selected.$push(l); - if (inc_line_offset['$=='](0)) { - return inc_line_offset = inc_lineno - } else { - return nil - }; - } - } else { - return ($a = ($b = tags).$each, $a._p = (TMP_18 = function(tag){var self = TMP_18._s || this, $a;if (tag == null) tag = nil; - if (($a = l['$include?']("tag::" + (tag) + "[]")) !== false && $a !== nil) { - active_tag = tag; - tags_found['$<<'](tag); - return ($breaker.$v = nil, $breaker); - } else { - return nil - }}, TMP_18._s = self, TMP_18), $a).call($b) - };}, TMP_17._s = self, TMP_17), $a).call($b)}, TMP_16._s = self, TMP_16), $a).call($e, include_file, "r") - } catch ($err) {if (true) { - self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": include " + (target_type) + " not readable: " + (include_file)); - self.$advance(); - return true; - }else { throw $err; } - }; - if (($a = ((missing_tags = tags['$-'](tags_found)))['$empty?']()) === false || $a === nil) { - self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": tag" + ((function() {if (missing_tags.$size()['$>'](1)) { - return "s" - } else { - return nil - }; return nil; })()) + " '" + (missing_tags.$to_a()['$*'](",")) + "' not found in include " + (target_type) + ": " + (include_file))}; - self.$advance(); - self.$push_include(selected, include_file, path, inc_line_offset, attributes);} - } else { - try { - self.$advance(); - self.$push_include(($a = ($f = self).$open, $a._p = (TMP_19 = function(f){var self = TMP_19._s || this;if (f == null) f = nil; - return f.$read()}, TMP_19._s = self, TMP_19), $a).call($f, include_file, "r"), include_file, path, 1, attributes); - } catch ($err) {if (true) { - self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": include " + (target_type) + " not readable: " + (include_file)); - self.$advance(); - return true; - }else { throw $err; } - } - }; - return true; - } else { - return false - }; - }; + def.$normalize_system_path = function(target, start, jail, opts) { + var $a, $b, self = this; - def.$push_include = function(data, file, path, lineno, attributes) { - var $a, self = this, depth = nil; - if (file == null) { - file = nil - } - if (path == null) { - path = nil + if (start == null) { + start = nil } - if (lineno == null) { - lineno = 1 + if (jail == null) { + jail = nil } - if (attributes == null) { - attributes = $hash2([], {}) + if (opts == null) { + opts = $hash2([], {}) } - self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]); - self.includes['$<<']($scope.Helpers.$rootname(path)); - self.file = file; - self.dir = $scope.File.$dirname(file); - self.path = path; - self.lineno = lineno; - self.process_lines = $scope.ASCIIDOC_EXTENSIONS['$[]']($scope.File.$extname(self.file)); - if (($a = attributes['$has_key?']("depth")) !== false && $a !== nil) { - depth = attributes['$[]']("depth").$to_i(); - if (depth['$<='](0)) { - depth = 1}; - self.maxdepth = $hash2(["abs", "rel"], {"abs": (self.include_stack.$size()['$-'](1))['$+'](depth), "rel": depth});}; - self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": true, "condense": false, "indent": attributes['$[]']("indent")})); - if (($a = self.lines['$empty?']()) !== false && $a !== nil) { - self.$pop_include() - } else { - self.eof = false; - self.look_ahead = 0; - }; - return nil; - }; - - def.$pop_include = function() { - var $a, self = this; - if (self.include_stack.$size()['$>'](0)) { - $a = $opal.to_ary(self.include_stack.$pop()), self.lines = ($a[0] == null ? nil : $a[0]), self.file = ($a[1] == null ? nil : $a[1]), self.dir = ($a[2] == null ? nil : $a[2]), self.path = ($a[3] == null ? nil : $a[3]), self.lineno = ($a[4] == null ? nil : $a[4]), self.maxdepth = ($a[5] == null ? nil : $a[5]), self.process_lines = ($a[6] == null ? nil : $a[6]); - self.eof = self.lines['$empty?'](); - self.look_ahead = 0;}; - return nil; + if ((($a = start['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + start = self.document.$base_dir()}; + if ((($a = ($b = jail['$nil?'](), $b !== false && $b !== nil ?self.document.$safe()['$>='](($scope.SafeMode)._scope.SAFE) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + jail = self.document.$base_dir()}; + return (((($a = self.path_resolver) !== false && $a !== nil) ? $a : self.path_resolver = $scope.PathResolver.$new())).$system_path(target, start, jail, opts); }; - def.$include_depth = function() { + def.$normalize_asset_path = function(asset_ref, asset_name, autocorrect) { var self = this; - return self.include_stack.$size(); - }; - - def['$exceeded_max_depth?'] = function() { - var $a, $b, self = this, abs_maxdepth = nil; - if (($a = (($b = ((abs_maxdepth = self.maxdepth['$[]']("abs")))['$>'](0)) ? self.include_stack.$size()['$>='](abs_maxdepth) : $b)) !== false && $a !== nil) { - return self.maxdepth['$[]']("rel") - } else { - return false - }; - }; - - def.$shift = TMP_20 = function() {var $zuper = $slice.call(arguments, 0); - var $a, self = this, $iter = TMP_20._p, $yield = $iter || nil; - TMP_20._p = null; - if (($a = self.unescape_next_line) !== false && $a !== nil) { - self.unescape_next_line = false; - return $opal.find_super_dispatcher(self, 'shift', TMP_20, $iter).apply(self, $zuper)['$[]']($range(1, -1, false)); - } else { - return $opal.find_super_dispatcher(self, 'shift', TMP_20, $iter).apply(self, $zuper) - }; - }; - def['$skip_front_matter!'] = function(data, increment_linenos) { - var $a, $b, $c, $d, self = this, front_matter = nil, original_data = nil; - if (increment_linenos == null) { - increment_linenos = true + if (asset_name == null) { + asset_name = "path" } - front_matter = nil; - if (($a = (($b = data.$size()['$>'](0)) ? data.$first()['$==']("---") : $b)) !== false && $a !== nil) { - original_data = data.$dup(); - front_matter = []; - data.$shift(); - if (increment_linenos !== false && increment_linenos !== nil) { - self.lineno = self.lineno['$+'](1)}; - while (($b = ($c = ($d = data['$empty?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?($d = data.$first()['$==']("---"), ($d === nil || $d === false)) : $c)) !== false && $b !== nil) { - front_matter.$push(data.$shift()); - if (increment_linenos !== false && increment_linenos !== nil) { - self.lineno = self.lineno['$+'](1)};}; - if (($a = data['$empty?']()) !== false && $a !== nil) { - ($a = data).$unshift.apply($a, [].concat(original_data)); - if (increment_linenos !== false && increment_linenos !== nil) { - self.lineno = 0}; - front_matter = nil; - } else { - data.$shift(); - if (increment_linenos !== false && increment_linenos !== nil) { - self.lineno = self.lineno['$+'](1)}; - };}; - return front_matter; + if (autocorrect == null) { + autocorrect = true + } + return self.$normalize_system_path(asset_ref, self.document.$base_dir(), nil, $hash2(["target_name", "recover"], {"target_name": asset_name, "recover": autocorrect})); }; - def.$resolve_expr_val = function(str) { - var $a, $b, $c, self = this, val = nil, type = nil; - val = str; - type = nil; - if (($a = ((($b = ($c = val['$start_with?']("\""), $c !== false && $c !== nil ?val['$end_with?']("\"") : $c)) !== false && $b !== nil) ? $b : ($c = val['$start_with?']("'"), $c !== false && $c !== nil ?val['$end_with?']("'") : $c))) !== false && $a !== nil) { - type = "string"; - val = val['$[]']($range(1, -1, true));}; - if (($a = val['$include?']("{")) !== false && $a !== nil) { - val = self.document.$sub_attributes(val)}; - if (($a = type['$==']("string")) === false || $a === nil) { - if (($a = val['$empty?']()) !== false && $a !== nil) { - val = nil - } else if (($a = val.$strip()['$empty?']()) !== false && $a !== nil) { - val = " " - } else if (val['$==']("true")) { - val = true - } else if (val['$==']("false")) { - val = false - } else if (($a = val['$include?'](".")) !== false && $a !== nil) { - val = val.$to_f() - } else { - val = val.$to_i() - }}; - return val; - }; + def.$relative_path = function(filename) { + var $a, self = this; - def['$include_processors?'] = function() { - var $a, $b, self = this; - if (($a = self.include_processors['$nil?']()) !== false && $a !== nil) { - if (($a = ($b = self.document['$extensions?'](), $b !== false && $b !== nil ?self.document.$extensions()['$include_processors?']() : $b)) !== false && $a !== nil) { - self.include_processors = self.document.$extensions().$load_include_processors(self.document); - return true; - } else { - self.include_processors = false; - return false; - } - } else { - return ($a = self.include_processors['$=='](false), ($a === nil || $a === false)) - }; + return (((($a = self.path_resolver) !== false && $a !== nil) ? $a : self.path_resolver = $scope.PathResolver.$new())).$relative_path(filename, self.document.$base_dir()); }; - return (def.$to_s = function() { - var $a, $b, TMP_21, self = this; - return "" + (self.$class().$name()) + " [path: " + (self.path) + ", line #: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + (($a = ($b = self.include_stack).$map, $a._p = (TMP_21 = function(inc){var self = TMP_21._s || this;if (inc == null) inc = nil; - return inc.$to_s()}, TMP_21._s = self, TMP_21), $a).call($b).$join(", ")) + "]]"; - }, nil); - })(self, $scope.Reader); + return (def.$list_marker_keyword = function(list_type) { + var $a, self = this; + + if (list_type == null) { + list_type = nil + } + return $scope.ORDERED_LIST_KEYWORDS['$[]'](((($a = list_type) !== false && $a !== nil) ? $a : self.style)); + }, nil) && 'list_marker_keyword'; + })(self, null) })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass; + return (function($base) { var self = $module($base, 'Asciidoctor'); var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $BaseTemplate(){}; - var self = $BaseTemplate = $klass($base, $super, 'BaseTemplate', $BaseTemplate); - - var def = $BaseTemplate._proto, $scope = $BaseTemplate._scope; - def.view = nil; - self.$attr_reader("view"); - self.$attr_reader("backend"); + (function($base, $super) { + function $AbstractBlock(){}; + var self = $AbstractBlock = $klass($base, $super, 'AbstractBlock', $AbstractBlock); - self.$attr_reader("eruby"); + var def = self._proto, $scope = self._scope, TMP_1; - def.$initialize = function(view, backend, eruby) { - var self = this; - self.view = view; - self.backend = backend; - return self.eruby = eruby; - }; + def.document = def.attributes = def.blocks = def.subs = def.title = def.subbed_title = def.caption = def.context = def.next_section_index = def.next_section_number = nil; + self.$attr_accessor("content_model"); - $opal.defs(self, '$inherited', function(klass) { - var $a, self = this; - if (self.template_classes == null) self.template_classes = nil; + self.$attr_reader("subs"); - if (self['$==']($scope.BaseTemplate)) { - ((($a = self.template_classes) !== false && $a !== nil) ? $a : self.template_classes = []); - return self.template_classes['$<<'](klass); - } else { - return self.$superclass().$inherited(klass) - }; - }); + self.$attr_reader("blocks"); - $opal.defs(self, '$template_classes', function() { - var self = this; - if (self.template_classes == null) self.template_classes = nil; + self.$attr_accessor("level"); - return self.template_classes; - }); + self.$attr_writer("title"); - def.$render = function(node, locals) { - var $a, $b, $c, $d, self = this, tmpl = nil, $case = nil, result = nil; - if (node == null) { - node = $scope.Object.$new() - } - if (locals == null) { - locals = $hash2([], {}) - } - tmpl = self.$template(); - $case = tmpl;if ("invoke_result"['$===']($case)) {return self.$result(node)}else if ("content"['$===']($case)) {result = node.$content()}else {result = tmpl.$result(node.$get_binding(self))}; - if (($a = ($b = ($c = (((($d = self.view['$==']("document")) !== false && $d !== nil) ? $d : self.view['$==']("embedded"))), $c !== false && $c !== nil ?node.$renderer().$compact() : $c), $b !== false && $b !== nil ?($c = node.$document()['$nested?'](), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - return self.$compact(result) - } else { - return result - }; - }; + self.$attr_accessor("style"); - def.$compact = function(str) { - var self = this; - return str.$gsub($scope.BLANK_LINE_PATTERN, "").$gsub($scope.LINE_FEED_ENTITY, $scope.EOL); - }; + self.$attr_accessor("caption"); - def.$preserve_endlines = function(str, node) { - var $a, self = this; - if (($a = node.$renderer().$compact()) !== false && $a !== nil) { - return str.$gsub($scope.EOL, $scope.LINE_FEED_ENTITY) - } else { - return str - }; - }; + def.$initialize = TMP_1 = function(parent, context) {var $zuper = $slice.call(arguments, 0); + var $a, $b, self = this, $iter = TMP_1._p, $yield = $iter || nil; - def.$template = function() { - var self = this; - return self.$raise("You chilluns need to make your own template"); - }; - - return (def.$attribute = function(name, key) { - var $a, self = this, type = nil; - type = (function() {if (($a = key['$is_a?']($scope.Symbol)) !== false && $a !== nil) { - return "attr" + TMP_1._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_1, $iter).apply(self, $zuper); + self.content_model = "compound"; + self.subs = []; + self.default_subs = nil; + self.blocks = []; + self.id = nil; + self.title = nil; + self.caption = nil; + self.style = nil; + self.level = (function() {if (context['$==']("document")) { + return 0 + } else if ((($a = (($b = parent !== false && parent !== nil) ? context['$==']("section")['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return parent.$level() } else { - return "var" + return nil }; return nil; })(); - if (type['$==']("attr")) { - return "<% if attr? '" + (key) + "' %> " + (name) + "=\"<%= attr '" + (key) + "' %>\"<% end %>" - } else { - return "<% if " + (key) + " %> " + (name) + "=\"<%= " + (key) + " %>\"<% end %>" - }; - }, nil); - })(self, null); - - (function($base) { - var self = $module($base, 'EmptyTemplate'); - - var def = self._proto, $scope = self._scope; - def.$result = function(node) { - var self = this; - return ""; + self.next_section_index = 0; + return self.next_section_number = 1; }; - def.$template = function() { + def['$block?'] = function() { var self = this; - return "invoke_result"; + + return true; }; - ;$opal.donate(self, ["$result", "$template"]); - })(self); - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; - return (function($base) { - var self = $module($base, 'Asciidoctor'); - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $Renderer(){}; - var self = $Renderer = $klass($base, $super, 'Renderer', $Renderer); + def['$inline?'] = function() { + var self = this; - var def = $Renderer._proto, $scope = $Renderer._scope; - def.views = def.chomp_result = nil; - $opal.cdecl($scope, 'RE_ASCIIDOCTOR_NAMESPACE', /^Asciidoctor::/); + return false; + }; - $opal.cdecl($scope, 'RE_TEMPLATE_CLASS_SUFFIX', /Template$/); + def['$context='] = function(context) { + var self = this; - $opal.cdecl($scope, 'RE_CAMELCASE_BOUNDARY_1', /([[:upper:]]+)([[:upper:]][a-zA-Z])/); + self.context = context; + return self.node_name = context.$to_s(); + }; - $opal.cdecl($scope, 'RE_CAMELCASE_BOUNDARY_2', /([[:lower:]])([[:upper:]])/); + def.$convert = function() { + var self = this; - self.$attr_reader("compact"); + self.document.$playback_attributes(self.attributes); + return self.$converter().$convert(self); + }; - self.$attr_reader("cache"); + $opal.defn(self, '$render', def.$convert); - ($opal.cvars['@@global_cache'] = nil); + def.$content = function() { + var $a, $b, TMP_2, self = this; - def.$initialize = function(options) { - var $a, $b, TMP_1, $c, TMP_2, $d, TMP_3, $e, TMP_4, self = this, backend = nil, $case = nil, eruby = nil, template_dirs = nil, template_cache = nil, view_opts = nil, slim_loaded = nil, path_resolver = nil, engine = nil; - if (options == null) { - options = $hash2([], {}) - } - self.debug = ($a = ($b = options['$[]']("debug"), ($b === nil || $b === false)), ($a === nil || $a === false)); - self.views = $hash2([], {}); - self.compact = options['$[]']("compact"); - self.cache = nil; - self.chomp_result = false; - backend = options['$[]']("backend"); - if (($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== false && $a !== nil) { - ($a = ($b = (($c = $opal.Object._scope.Template) == null ? $opal.cm('Template') : $c).$instance_variable_get("@_cache")).$each, $a._p = (TMP_1 = function(path, tmpl){var self = TMP_1._s || this; - if (self.views == null) self.views = nil; -if (path == null) path = nil;if (tmpl == null) tmpl = nil; - return self.views['$[]='](($scope.File.$basename(path)), tmpl)}, TMP_1._s = self, TMP_1), $a).call($b); - return nil;}; - $case = backend;if ("html5"['$===']($case) || "docbook45"['$===']($case) || "docbook5"['$===']($case)) {eruby = self.$load_eruby(options['$[]']("eruby")); - ; - ; - ($a = ($c = $scope.BaseTemplate.$template_classes()).$each, $a._p = (TMP_2 = function(tc){var self = TMP_2._s || this, $a, view_name = nil, view_backend = nil; - if (self.views == null) self.views = nil; -if (tc == null) tc = nil; - if (($a = tc.$to_s().$downcase()['$include?']("::"['$+'](backend)['$+']("::"))) !== false && $a !== nil) { - $a = $opal.to_ary(self.$class().$extract_view_mapping(tc)), view_name = ($a[0] == null ? nil : $a[0]), view_backend = ($a[1] == null ? nil : $a[1]); - if (view_backend['$=='](backend)) { - return self.views['$[]='](view_name, tc.$new(view_name, backend, eruby)) - } else { - return nil - }; - } else { - return nil - }}, TMP_2._s = self, TMP_2), $a).call($c);}else {($a = ($d = $scope.Debug).$debug, $a._p = (TMP_3 = function(){var self = TMP_3._s || this; - return "No built-in templates for backend: " + (backend)}, TMP_3._s = self, TMP_3), $a).call($d)}; - if (($a = (template_dirs = options.$delete("template_dirs"))) !== false && $a !== nil) { - $scope.Helpers.$require_library("tilt"); - self.chomp_result = true; - if (($a = ((template_cache = options['$[]']("template_cache")))['$==='](true)) !== false && $a !== nil) { - self.cache = (((($a = (($e = $opal.cvars['@@global_cache']) == null ? nil : $e)) !== false && $a !== nil) ? $a : ($opal.cvars['@@global_cache'] = $scope.TemplateCache.$new()))) - } else if (template_cache !== false && template_cache !== nil) { - self.cache = template_cache}; - view_opts = $hash2(["erb", "haml", "slim"], {"erb": $hash2(["trim"], {"trim": "<"}), "haml": $hash2(["format", "attr_wrapper", "ugly", "escape_attrs"], {"format": "xhtml", "attr_wrapper": "\"", "ugly": true, "escape_attrs": false}), "slim": $hash2(["disable_escape", "sort_attrs", "pretty"], {"disable_escape": true, "sort_attrs": false, "pretty": false})}); - if (options['$[]']("htmlsyntax")['$==']("html")) { - view_opts['$[]']("haml")['$[]=']("format", view_opts['$[]']("slim")['$[]=']("format", "html5"))}; - slim_loaded = false; - path_resolver = $scope.PathResolver.$new(); - engine = options['$[]']("template_engine"); - return ($a = ($e = template_dirs).$each, $a._p = (TMP_4 = function(template_dir){var self = TMP_4._s || this, $a, $b, TMP_5, $c, $d, TMP_7, template_glob = nil, helpers = nil, scan_result = nil; - if (self.cache == null) self.cache = nil; - if (self.views == null) self.views = nil; -if (template_dir == null) template_dir = nil; - template_dir = path_resolver.$system_path(template_dir, nil); - template_glob = "*"; - if (engine !== false && engine !== nil) { - template_glob = "*." + (engine); - if (($a = $scope.File['$directory?']($scope.File.$join(template_dir, engine))) !== false && $a !== nil) { - template_dir = $scope.File.$join(template_dir, engine)};}; - if (($a = $scope.File['$directory?']($scope.File.$join(template_dir, backend))) !== false && $a !== nil) { - template_dir = $scope.File.$join(template_dir, backend)}; - if (($a = ($b = self.cache, $b !== false && $b !== nil ?self.cache['$cached?']("scan", template_dir, template_glob) : $b)) !== false && $a !== nil) { - self.views.$update(self.cache.$fetch("scan", template_dir, template_glob)); - return nil;;}; - helpers = nil; - scan_result = $hash2([], {}); - ($a = ($b = ($c = ($d = $scope.Dir.$glob($scope.File.$join(template_dir, template_glob))).$select, $c._p = (TMP_7 = function(f){var self = TMP_7._s || this;if (f == null) f = nil; - return $scope.File['$file?'](f)}, TMP_7._s = self, TMP_7), $c).call($d)).$each, $a._p = (TMP_5 = function(template){var self = TMP_5._s || this, $a, $b, $c, TMP_6, basename = nil, name_parts = nil, view_name = nil, ext_name = nil, opts = nil; - if (self.cache == null) self.cache = nil; - if (self.views == null) self.views = nil; -if (template == null) template = nil; - basename = $scope.File.$basename(template); - if (basename['$==']("helpers.rb")) { - helpers = template; - return nil;;}; - name_parts = basename.$split("."); - if (name_parts.$size()['$<'](2)) { - return nil;}; - view_name = name_parts.$first(); - ext_name = name_parts.$last(); - if (($a = (($b = ext_name['$==']("slim")) ? ($c = slim_loaded, ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - $scope.Helpers.$require_library("slim")}; - if (($a = $scope.Tilt['$registered?'](ext_name)) === false || $a === nil) { - return nil;}; - opts = view_opts['$[]'](ext_name.$to_sym()); - if (($a = self.cache) !== false && $a !== nil) { - return self.views['$[]='](view_name, scan_result['$[]='](view_name, ($a = ($b = self.cache).$fetch, $a._p = (TMP_6 = function(){var self = TMP_6._s || this; - return $scope.Tilt.$new(template, nil, opts)}, TMP_6._s = self, TMP_6), $a).call($b, "view", template))) - } else { - return self.views['$[]='](view_name, $scope.Tilt.$new(template, nil, opts)) - };}, TMP_5._s = self, TMP_5), $a).call($b); - if (($a = helpers['$nil?']()) === false || $a === nil) { - }; - if (($a = self.cache) !== false && $a !== nil) { - return self.cache.$store(scan_result, "scan", template_dir, template_glob) - } else { - return nil - };}, TMP_4._s = self, TMP_4), $a).call($e); - } else { - return nil - }; + return ($a = ($b = self.blocks).$map, $a._p = (TMP_2 = function(b){var self = TMP_2._s || this; +if (b == null) b = nil; + return b.$convert()}, TMP_2._s = self, TMP_2), $a).call($b)['$*']($scope.EOL); }; - def.$render = function(view, object, locals) { - var $a, $b, self = this; - if (locals == null) { - locals = $hash2([], {}) - } - if (($a = ($b = self.views['$has_key?'](view), ($b === nil || $b === false))) !== false && $a !== nil) { - self.$raise("Couldn't find a view in @views for " + (view))}; - if (($a = self.chomp_result) !== false && $a !== nil) { - return self.views['$[]'](view).$render(object, locals).$chomp() - } else { - return self.views['$[]'](view).$render(object, locals) - }; - }; + def['$sub?'] = function(name) { + var self = this; - def.$views = function() { - var self = this, readonly_views = nil; - readonly_views = self.views.$dup(); - readonly_views.$freeze(); - return readonly_views; + return self.subs['$include?'](name); }; - def.$register_view = function(view_name, tilt_template) { + def['$title?'] = function() { var self = this; - return self.views['$[]='](view_name, tilt_template); - }; - def.$load_eruby = function(name) { - var $a, $b, $c, self = this; - if (($a = ((($b = name['$nil?']()) !== false && $b !== nil) ? $b : ($c = ["erb", "erubis"]['$include?'](name), ($c === nil || $c === false)))) !== false && $a !== nil) { - name = "erb"}; - if (name['$==']("erb")) { - return (($a = $opal.Object._scope.ERB) == null ? $opal.cm('ERB') : $a) - } else if (name['$==']("erubis")) { - $scope.Helpers.$require_library("erubis"); - return ((($a = $opal.Object._scope.Erubis) == null ? $opal.cm('Erubis') : $a))._scope.FastEruby; - } else { - return nil - }; + return self.title['$nil_or_empty?']()['$!'](); }; - $opal.defs(self, '$global_cache', function() { - var $a, self = this; - return (($a = $opal.cvars['@@global_cache']) == null ? nil : $a); - }); - - $opal.defs(self, '$reset_global_cache', function() { + def.$title = function() { var $a, $b, self = this; - if (($a = (($b = $opal.cvars['@@global_cache']) == null ? nil : $b)) !== false && $a !== nil) { - return (($a = $opal.cvars['@@global_cache']) == null ? nil : $a).$clear() + + if ((($a = (($b = self['subbed_title'], $b != null && $b !== nil) ? 'instance-variable' : nil)) !== nil && (!$a._isBoolean || $a == true))) { + return self.subbed_title + } else if ((($a = self.title) !== nil && (!$a._isBoolean || $a == true))) { + return self.subbed_title = self.$apply_title_subs(self.title) } else { - return nil + return self.title }; - }); - - $opal.defs(self, '$extract_view_mapping', function(qualified_class) { - var $a, self = this, view_name = nil, backend = nil; - $a = $opal.to_ary(qualified_class.$to_s().$sub($scope.RE_ASCIIDOCTOR_NAMESPACE, "").$sub($scope.RE_TEMPLATE_CLASS_SUFFIX, "").$split("::").$reverse()), view_name = ($a[0] == null ? nil : $a[0]), backend = ($a[1] == null ? nil : $a[1]); - view_name = self.$camelcase_to_underscore(view_name); - if (($a = backend['$nil?']()) === false || $a === nil) { - backend = backend.$downcase()}; - return [view_name, backend]; - }); - - return ($opal.defs(self, '$camelcase_to_underscore', function(str) { - var self = this; - return str.$gsub($scope.RE_CAMELCASE_BOUNDARY_1, "1_2").$gsub($scope.RE_CAMELCASE_BOUNDARY_2, "1_2").$downcase(); - }), nil); - })(self, null); - - (function($base, $super) { - function $TemplateCache(){}; - var self = $TemplateCache = $klass($base, $super, 'TemplateCache', $TemplateCache); - - var def = $TemplateCache._proto, $scope = $TemplateCache._scope, TMP_8; - def.cache = nil; - self.$attr_reader("cache"); - - def.$initialize = function() { - var self = this; - return self.cache = $hash2([], {}); }; - def['$cached?'] = function(key) { + def.$captioned_title = function() { var self = this; - key = $slice.call(arguments, 0); - return self.cache['$has_key?'](key); - }; - def.$fetch = TMP_8 = function(key) { - var $a, $b, $c, $d, self = this, $iter = TMP_8._p, $yield = $iter || nil; - key = $slice.call(arguments, 0); - TMP_8._p = null; - if (($yield !== nil)) { - return ($a = key, $b = self.cache, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, ((($d = $opal.$yieldX($yield, [])) === $breaker) ? $breaker.$v : $d)))) - } else { - return self.cache['$[]'](key) - }; + return "" + (self.caption) + (self.$title()); }; - def.$store = function(value, key) { + def['$blocks?'] = function() { var self = this; - key = $slice.call(arguments, 1); - return self.cache['$[]='](key, value); + + return self.blocks['$empty?']()['$!'](); }; - return (def.$clear = function() { + def['$<<'] = function(block) { var self = this; - return self.cache = $hash2([], {}); - }, nil); - })(self, null); - - })(self) -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $range = $opal.range; - return (function($base) { - var self = $module($base, 'Asciidoctor'); - var def = self._proto, $scope = self._scope; - (function($base, $super) { - function $Section(){}; - var self = $Section = $klass($base, $super, 'Section', $Section); + return self.blocks['$<<'](block); + }; - var def = $Section._proto, $scope = $Section._scope, TMP_1, TMP_2, TMP_3; - def.level = def.document = def.parent = def.number = def.title = def.numbered = def.blocks = nil; - self.$attr_accessor("index"); + def.$sections = function() { + var $a, $b, TMP_3, self = this; - self.$attr_accessor("number"); + return ($a = ($b = self.blocks).$select, $a._p = (TMP_3 = function(block){var self = TMP_3._s || this; +if (block == null) block = nil; + return block.$context()['$==']("section")}, TMP_3._s = self, TMP_3), $a).call($b); + }; - self.$attr_accessor("sectname"); + def.$remove_sub = function(sub) { + var self = this; - self.$attr_accessor("special"); + self.subs.$delete(sub); + return nil; + }; - self.$attr_accessor("numbered"); + def.$assign_caption = function(caption, key) { + var $a, $b, self = this, value = nil, caption_key = nil, caption_title = nil, caption_num = nil; - def.$initialize = TMP_1 = function(parent, level, numbered) { - var $a, $b, $c, self = this, $iter = TMP_1._p, $yield = $iter || nil; - if (parent == null) { - parent = nil - } - if (level == null) { - level = nil + if (caption == null) { + caption = nil } - if (numbered == null) { - numbered = true + if (key == null) { + key = nil } - TMP_1._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, "section"]); - self.template_name = "section"; - if (($a = level['$nil?']()) !== false && $a !== nil) { - if (($a = ($b = parent['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - self.level = parent.$level()['$+'](1) - } else if (($a = self.level['$nil?']()) !== false && $a !== nil) { - self.level = 1} + if ((($a = ((($b = self['$title?']()) !== false && $b !== nil) ? $b : self.caption['$!']())) !== nil && (!$a._isBoolean || $a == true))) { } else { - self.level = level + return nil }; - self.numbered = (($a = numbered !== false && numbered !== nil) ? self.level['$>'](0) : $a); - self.special = ($a = ($b = ($c = parent['$nil?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?parent.$context()['$==']("section") : $b), $a !== false && $a !== nil ?parent.$special() : $a); - self.index = 0; - return self.number = 1; + if (caption !== false && caption !== nil) { + self.caption = caption + } else if ((($a = (value = self.document.$attributes()['$[]']("caption"))) !== nil && (!$a._isBoolean || $a == true))) { + self.caption = value + } else if ((($a = self['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + ((($a = key) !== false && $a !== nil) ? $a : key = self.context.$to_s()); + caption_key = "" + (key) + "-caption"; + if ((($a = (caption_title = self.document.$attributes()['$[]'](caption_key))) !== nil && (!$a._isBoolean || $a == true))) { + caption_num = self.document.$counter_increment("" + (key) + "-number", self); + self.caption = "" + (caption_title) + " " + (caption_num) + ". ";};}; + return nil; }; - $opal.defn(self, '$name', def.$title); + def.$assign_index = function(section) { + var $a, $b, $c, $d, self = this, appendix_number = nil, caption = nil; - def.$generate_id = function() { - var $a, $b, self = this, sep = nil, pre = nil, base_id = nil, gen_id = nil, cnt = nil; - if (($a = self.document.$attributes()['$has_key?']("sectids")) !== false && $a !== nil) { - sep = ((($a = self.document.$attributes()['$[]']("idseparator")) !== false && $a !== nil) ? $a : "_"); - pre = ((($a = self.document.$attributes()['$[]']("idprefix")) !== false && $a !== nil) ? $a : "_"); - base_id = "" + (pre) + (self.$title().$downcase().$gsub($scope.REGEXP['$[]']("illegal_sectid_chars"), sep).$tr_s(sep, sep).$chomp(sep)); - if (($a = ($b = pre['$empty?'](), $b !== false && $b !== nil ?base_id['$start_with?'](sep) : $b)) !== false && $a !== nil) { - base_id = base_id['$[]']($range(1, -1, false)); - while (($b = base_id['$start_with?'](sep)) !== false && $b !== nil) { - base_id = base_id['$[]']($range(1, -1, false))};}; - gen_id = base_id; - cnt = 2; - while (($b = self.document.$references()['$[]']("ids")['$has_key?'](gen_id)) !== false && $b !== nil) { - gen_id = "" + (base_id) + (sep) + (cnt); - cnt = cnt['$+'](1);}; - return gen_id; + section['$index='](self.next_section_index); + self.next_section_index = self.next_section_index['$+'](1); + if (section.$sectname()['$==']("appendix")) { + appendix_number = self.document.$counter("appendix-number", "A"); + if ((($a = section.$numbered()) !== nil && (!$a._isBoolean || $a == true))) { + section['$number='](appendix_number)}; + if ((($a = ((caption = self.document.$attr("appendix-caption", "")))['$==']("")['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return section['$caption=']("" + (caption) + " " + (appendix_number) + ": ") + } else { + return section['$caption=']("" + (appendix_number) + ". ") + }; + } else if ((($a = section.$numbered()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ($b = (((($c = section.$level()['$=='](1)) !== false && $c !== nil) ? $c : ((($d = section.$level()['$=='](0)) ? section.$special() : $d)))), $b !== false && $b !== nil ?self.document.$doctype()['$==']("book") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return section['$number='](self.document.$counter("chapter-number", 1)) + } else { + section['$number='](self.next_section_number); + return self.next_section_number = self.next_section_number['$+'](1); + } } else { return nil }; }; - def.$sectnum = function(delimiter, append) { - var $a, $b, $c, $d, $e, self = this; - if (delimiter == null) { - delimiter = "." - } - if (append == null) { - append = nil - } - ((($a = append) !== false && $a !== nil) ? $a : append = ((function() {if (append['$=='](false)) { - return "" - } else { - return delimiter - }; return nil; })())); - if (($a = ($b = ($c = ($d = ($e = self.level['$nil?'](), ($e === nil || $e === false)), $d !== false && $d !== nil ?self.level['$>'](1) : $d), $c !== false && $c !== nil ?($d = self.parent['$nil?'](), ($d === nil || $d === false)) : $c), $b !== false && $b !== nil ?self.parent.$context()['$==']("section") : $b)) !== false && $a !== nil) { - return "" + (self.parent.$sectnum(delimiter)) + (self.number) + (append) - } else { - return "" + (self.number) + (append) - }; - }; + return (def.$reindex_sections = function() { + var $a, $b, TMP_4, self = this; - def['$<<'] = TMP_2 = function(block) {var $zuper = $slice.call(arguments, 0); - var self = this, $iter = TMP_2._p, $yield = $iter || nil; - TMP_2._p = null; - $opal.find_super_dispatcher(self, '<<', TMP_2, $iter).apply(self, $zuper); + self.next_section_index = 0; + self.next_section_number = 0; + return ($a = ($b = self.blocks).$each, $a._p = (TMP_4 = function(block){var self = TMP_4._s || this; +if (block == null) block = nil; if (block.$context()['$==']("section")) { - return self.$assign_index(block) - } else { - return nil - }; - }; - - return (def.$to_s = TMP_3 = function() {var $zuper = $slice.call(arguments, 0); - var $a, self = this, $iter = TMP_3._p, $yield = $iter || nil; - TMP_3._p = null; - if (($a = self.title) !== false && $a !== nil) { - if (($a = self.numbered) !== false && $a !== nil) { - return "" + ($opal.find_super_dispatcher(self, 'to_s', TMP_3, $iter).apply(self, $zuper).$to_s()) + " - " + (self.$sectnum()) + " " + (self.title) + " [blocks:" + (self.blocks.$size()) + "]" + self.$assign_index(block); + return block.$reindex_sections(); } else { - return "" + ($opal.find_super_dispatcher(self, 'to_s', TMP_3, $iter).apply(self, $zuper).$to_s()) + " - " + (self.title) + " [blocks:" + (self.blocks.$size()) + "]" - } - } else { - return $opal.find_super_dispatcher(self, 'to_s', TMP_3, $iter).apply(self, $zuper).$to_s() - }; - }, nil); - })(self, $scope.AbstractBlock) + return nil + }}, TMP_4._s = self, TMP_4), $a).call($b); + }, nil) && 'reindex_sections'; + })(self, $scope.AbstractNode) })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range; + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; + return (function($base) { var self = $module($base, 'Asciidoctor'); var def = self._proto, $scope = self._scope; + (function($base, $super) { - function $Table(){}; - var self = $Table = $klass($base, $super, 'Table', $Table); + function $AttributeList(){}; + var self = $AttributeList = $klass($base, $super, 'AttributeList', $AttributeList); - var def = $Table._proto, $scope = $Table._scope, TMP_1; - def.attributes = def.document = def.has_header_option = def.rows = def.columns = nil; - (function($base, $super) { - function $Rows(){}; - var self = $Rows = $klass($base, $super, 'Rows', $Rows); + var def = self._proto, $scope = self._scope; - var def = $Rows._proto, $scope = $Rows._scope; - self.$attr_accessor("head", "foot", "body"); + def.attributes = def.scanner = def.delimiter = def.block = def.delimiter_skip_pattern = def.delimiter_boundary_pattern = nil; + $opal.cdecl($scope, 'BoundaryRxs', $hash2(["\"", "'", ","], {"\"": /.*?[^\\](?=")/, "'": /.*?[^\\](?=')/, ",": /.*?(?=[ \t]*(,|$))/})); - def.$initialize = function(head, foot, body) { - var self = this; - if (head == null) { - head = [] - } - if (foot == null) { - foot = [] - } - if (body == null) { - body = [] - } - self.head = head; - self.foot = foot; - return self.body = body; - }; + $opal.cdecl($scope, 'EscapedQuoteRxs', $hash2(["\"", "'"], {"\"": /\\"/, "'": /\\'/})); - return (def['$[]'] = function(name) { - var self = this; - return self.$send(name); - }, nil); - })(self, null); - - $opal.cdecl($scope, 'DEFAULT_DATA_FORMAT', "psv"); + $opal.cdecl($scope, 'NameRx', /[A-Za-z:_][A-Za-z:_\-.]*/); - $opal.cdecl($scope, 'DATA_FORMATS', ["psv", "dsv", "csv"]); + $opal.cdecl($scope, 'BlankRx', /[ \t]+/); - $opal.cdecl($scope, 'DEFAULT_DELIMITERS', $hash2(["psv", "dsv", "csv"], {"psv": "|", "dsv": ":", "csv": ","})); + $opal.cdecl($scope, 'SkipRxs', $hash2(["blank", ","], {"blank": $scope.BlankRx, ",": /[ \t]*(,|$)/})); - $opal.cdecl($scope, 'TEXT_STYLES', $hash2(["d", "s", "e", "m", "h", "l", "v", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "v": "verse", "a": "asciidoc"})); + def.$initialize = function(source, block, delimiter) { + var $a, self = this; - $opal.cdecl($scope, 'ALIGNMENTS', $hash2(["h", "v"], {"h": $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"}), "v": $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"})})); + if (block == null) { + block = nil + } + if (delimiter == null) { + delimiter = "," + } + self.scanner = (($a = $opal.Object._scope.StringScanner) == null ? $opal.cm('StringScanner') : $a).$new(source); + self.block = block; + self.delimiter = delimiter; + self.delimiter_skip_pattern = $scope.SkipRxs['$[]'](delimiter); + self.delimiter_boundary_pattern = $scope.BoundaryRxs['$[]'](delimiter); + return self.attributes = nil; + }; - self.$attr_accessor("columns"); + def.$parse_into = function(attributes, posattrs) { + var self = this; - self.$attr_accessor("rows"); + if (posattrs == null) { + posattrs = [] + } + return attributes.$update(self.$parse(posattrs)); + }; - self.$attr_accessor("has_header_option"); + def.$parse = function(posattrs) { + var $a, $b, self = this, index = nil; - def.$initialize = TMP_1 = function(parent, attributes) { - var $a, $b, $c, $d, self = this, $iter = TMP_1._p, $yield = $iter || nil, pcwidth = nil, pcwidth_intval = nil; - TMP_1._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, "table"]); - self.rows = $scope.Rows.$new(); - self.columns = []; - self.has_header_option = attributes['$has_key?']("header-option"); - pcwidth = attributes['$[]']("width"); - pcwidth_intval = pcwidth.$to_i().$abs(); - if (($a = ((($b = (($c = pcwidth_intval['$=='](0)) ? ($d = pcwidth['$==']("0"), ($d === nil || $d === false)) : $c)) !== false && $b !== nil) ? $b : pcwidth_intval['$>'](100))) !== false && $a !== nil) { - pcwidth_intval = 100}; - self.attributes['$[]=']("tablepcwidth", pcwidth_intval); - if (($a = self.document.$attributes()['$has_key?']("pagewidth")) !== false && $a !== nil) { - return ($a = "tableabswidth", $b = self.attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, ((self.attributes['$[]']("tablepcwidth").$to_f()['$/'](100))['$*'](self.document.$attributes()['$[]']("pagewidth"))).$round()))) - } else { - return nil - }; + if (posattrs == null) { + posattrs = [] + } + if ((($a = self.attributes) !== nil && (!$a._isBoolean || $a == true))) { + return self.attributes}; + self.attributes = $hash2([], {}); + index = 0; + while ((($b = self.$parse_attribute(index, posattrs)) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = self.scanner['$eos?']()) !== nil && (!$b._isBoolean || $b == true))) { + break;}; + self.$skip_delimiter(); + index = index['$+'](1);}; + return self.attributes; }; - def['$header_row?'] = function() { - var $a, self = this; - return ($a = self.has_header_option, $a !== false && $a !== nil ?self.rows.$body().$size()['$=='](0) : $a); - }; + def.$rekey = function(posattrs) { + var self = this; - def.$create_columns = function(col_specs) { - var $a, $b, TMP_2, $c, TMP_3, self = this, total_width = nil, even_width = nil; - total_width = 0; - self.columns = ($a = ($b = col_specs).$inject, $a._p = (TMP_2 = function(collector, col_spec){var self = TMP_2._s || this;if (collector == null) collector = nil;if (col_spec == null) col_spec = nil; - total_width = total_width['$+'](col_spec['$[]']("width")); - collector['$<<']($scope.Column.$new(self, collector.$size(), col_spec)); - return collector;}, TMP_2._s = self, TMP_2), $a).call($b, []); - if (($a = ($c = self.columns['$empty?'](), ($c === nil || $c === false))) !== false && $a !== nil) { - self.attributes['$[]=']("colcount", self.columns.$size()); - even_width = ((100.0)['$/'](self.columns.$size())).$floor(); - ($a = ($c = self.columns).$each, $a._p = (TMP_3 = function(c){var self = TMP_3._s || this;if (c == null) c = nil; - return c.$assign_width(total_width, even_width)}, TMP_3._s = self, TMP_3), $a).call($c);}; - return nil; + return $scope.AttributeList.$rekey(self.attributes, posattrs); }; - return (def.$partition_header_footer = function(attributes) { - var $a, $b, $c, TMP_4, $d, self = this, head = nil; - self.attributes['$[]=']("rowcount", self.rows.$body().$size()); - if (($a = ($b = ($c = self.rows.$body()['$empty?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?self.has_header_option : $b)) !== false && $a !== nil) { - head = self.rows.$body().$shift(); - ($a = ($b = head).$each, $a._p = (TMP_4 = function(c){var self = TMP_4._s || this;if (c == null) c = nil; - return c['$style='](nil)}, TMP_4._s = self, TMP_4), $a).call($b); - self.rows['$head=']([head]);}; - if (($a = ($c = ($d = self.rows.$body()['$empty?'](), ($d === nil || $d === false)), $c !== false && $c !== nil ?attributes['$has_key?']("footer-option") : $c)) !== false && $a !== nil) { - self.rows['$foot=']([self.rows.$body().$pop()])}; - return nil; - }, nil); - })(self, $scope.AbstractBlock); + $opal.defs(self, '$rekey', function(attributes, pos_attrs) { + var $a, $b, TMP_1, self = this; - (function($base, $super) { - function $Column(){}; - var self = $Column = $klass($base, $super, 'Column', $Column); + ($a = ($b = pos_attrs).$each_with_index, $a._p = (TMP_1 = function(key, index){var self = TMP_1._s || this, $a, pos = nil, val = nil; +if (key == null) key = nil;if (index == null) index = nil; + if (key !== false && key !== nil) { + } else { + return nil; + }; + pos = index['$+'](1); + if ((($a = (val = attributes['$[]'](pos))) !== nil && (!$a._isBoolean || $a == true))) { + return attributes['$[]='](key, val) + } else { + return nil + };}, TMP_1._s = self, TMP_1), $a).call($b); + return attributes; + }); - var def = $Column._proto, $scope = $Column._scope, TMP_5; - def.attributes = nil; - self.$attr_accessor("style"); + def.$parse_attribute = function(index, pos_attrs) { + var $a, $b, TMP_2, $c, self = this, single_quoted_value = nil, first = nil, name = nil, value = nil, skipped = nil, c = nil, resolved_value = nil, $case = nil, resolved_name = nil, pos_name = nil; - def.$initialize = TMP_5 = function(table, index, attributes) { - var $a, $b, $c, self = this, $iter = TMP_5._p, $yield = $iter || nil; - if (attributes == null) { - attributes = $hash2([], {}) + if (index == null) { + index = 0 } - TMP_5._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_5, null).apply(self, [table, "column"]); - self.style = attributes['$[]']("style"); - attributes['$[]=']("colnumber", index['$+'](1)); - ($a = "width", $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, 1))); - ($a = "halign", $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, "left"))); - ($a = "valign", $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, "top"))); - return self.$update_attributes(attributes); + if (pos_attrs == null) { + pos_attrs = [] + } + single_quoted_value = false; + self.$skip_blank(); + if (((first = self.scanner.$peek(1)))['$==']("\"")) { + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + } else if (first['$==']("'")) { + name = self.$parse_attribute_value(self.scanner.$get_byte()); + value = nil; + single_quoted_value = true; + } else { + name = self.$scan_name(); + skipped = 0; + c = nil; + if ((($a = self.scanner['$eos?']()) !== nil && (!$a._isBoolean || $a == true))) { + if (name !== false && name !== nil) { + } else { + return false + } + } else { + skipped = ((($a = self.$skip_blank()) !== false && $a !== nil) ? $a : 0); + c = self.scanner.$get_byte(); + }; + if ((($a = ((($b = c['$!']()) !== false && $b !== nil) ? $b : c['$=='](self.delimiter))) !== nil && (!$a._isBoolean || $a == true))) { + value = nil + } else if ((($a = ((($b = c['$==']("=")['$!']()) !== false && $b !== nil) ? $b : name['$!']())) !== nil && (!$a._isBoolean || $a == true))) { + name = "" + (name) + (" "['$*'](skipped)) + (c) + (self.$scan_to_delimiter()); + value = nil; + } else { + self.$skip_blank(); + if ((($a = self.scanner.$peek(1)) !== nil && (!$a._isBoolean || $a == true))) { + if (((c = self.scanner.$get_byte()))['$==']("\"")) { + value = self.$parse_attribute_value(c) + } else if (c['$==']("'")) { + value = self.$parse_attribute_value(c); + single_quoted_value = true; + } else if (c['$=='](self.delimiter)) { + value = nil + } else { + value = "" + (c) + (self.$scan_to_delimiter()); + if (value['$==']("None")) { + return true}; + }}; + }; + }; + if (value !== false && value !== nil) { + resolved_value = (function() {$case = name;if ("options"['$===']($case) || "opts"['$===']($case)) {name = "options"; + ($a = ($b = value.$split(",")).$each, $a._p = (TMP_2 = function(o){var self = TMP_2._s || this; + if (self.attributes == null) self.attributes = nil; +if (o == null) o = nil; + return self.attributes['$[]=']("" + (o.$strip()) + "-option", "")}, TMP_2._s = self, TMP_2), $a).call($b); + return value;}else if ("title"['$===']($case)) {return value}else {if ((($a = (($c = single_quoted_value !== false && single_quoted_value !== nil) ? self.block : $c)) !== nil && (!$a._isBoolean || $a == true))) { + return (self.block.$apply_normal_subs(value)) + } else { + return value + }}})(); + self.attributes['$[]='](name, resolved_value); + } else { + resolved_name = (function() {if ((($a = (($c = single_quoted_value !== false && single_quoted_value !== nil) ? self.block : $c)) !== nil && (!$a._isBoolean || $a == true))) { + return (self.block.$apply_normal_subs(name)) + } else { + return name + }; return nil; })(); + if ((($a = (pos_name = pos_attrs['$[]'](index))) !== nil && (!$a._isBoolean || $a == true))) { + self.attributes['$[]='](pos_name, resolved_name)}; + self.attributes['$[]='](index['$+'](1), resolved_name); + }; + return true; }; - $opal.defn(self, '$table', def.$parent); + def.$parse_attribute_value = function(quote) { + var $a, self = this, value = nil; - return (def.$assign_width = function(total_width, even_width) { - var $a, self = this, width = nil; - if (total_width['$>'](0)) { - width = ((self.attributes['$[]']("width").$to_f()['$/'](total_width))['$*'](100)).$floor() + if (self.scanner.$peek(1)['$=='](quote)) { + self.scanner.$get_byte(); + return "";}; + if ((($a = (value = self.$scan_to_quote(quote))) !== nil && (!$a._isBoolean || $a == true))) { + self.scanner.$get_byte(); + return value.$gsub($scope.EscapedQuoteRxs['$[]'](quote), quote); } else { - width = even_width + return "" + (quote) + (self.$scan_to_delimiter()) }; - self.attributes['$[]=']("colpcwidth", width); - if (($a = self.$parent().$attributes()['$has_key?']("tableabswidth")) !== false && $a !== nil) { - self.attributes['$[]=']("colabswidth", ((width.$to_f()['$/'](100))['$*'](self.$parent().$attributes()['$[]']("tableabswidth"))).$round())}; - return nil; - }, nil); - })($scope.Table, $scope.AbstractNode); - - (function($base, $super) { - function $Cell(){}; - var self = $Cell = $klass($base, $super, 'Cell', $Cell); + }; - var def = $Cell._proto, $scope = $Cell._scope, TMP_6, TMP_8; - def.style = def.document = def.text = def.inner_document = def.colspan = def.rowspan = def.attributes = nil; - self.$attr_accessor("style"); + def.$skip_blank = function() { + var self = this; - self.$attr_accessor("colspan"); + return self.scanner.$skip($scope.BlankRx); + }; - self.$attr_accessor("rowspan"); + def.$skip_delimiter = function() { + var self = this; - $opal.defn(self, '$column', def.$parent); + return self.scanner.$skip(self.delimiter_skip_pattern); + }; - self.$attr_reader("inner_document"); + def.$scan_name = function() { + var self = this; - def.$initialize = TMP_6 = function(column, text, attributes, cursor) { - var $a, $b, $c, self = this, $iter = TMP_6._p, $yield = $iter || nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_lines = nil, processed_lines = nil; - if (attributes == null) { - attributes = $hash2([], {}) - } - if (cursor == null) { - cursor = nil - } - TMP_6._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_6, null).apply(self, [column, "cell"]); - self.text = text; - self.style = nil; - self.colspan = nil; - self.rowspan = nil; - if (($a = ($b = column['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - self.style = column.$attributes()['$[]']("style"); - self.$update_attributes(column.$attributes());}; - if (($a = ($b = attributes['$nil?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - self.colspan = attributes.$delete("colspan"); - self.rowspan = attributes.$delete("rowspan"); - if (($a = attributes['$has_key?']("style")) !== false && $a !== nil) { - self.style = attributes['$[]']("style")}; - self.$update_attributes(attributes);}; - if (($a = (($b = self.style['$==']("asciidoc")) ? ($c = column.$table()['$header_row?'](), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - parent_doctitle = self.document.$attributes().$delete("doctitle"); - inner_document_lines = self.text.$split($scope.LINE_SPLIT); - if (($a = ((($b = inner_document_lines['$empty?']()) !== false && $b !== nil) ? $b : ($c = inner_document_lines.$first()['$include?']("::"), ($c === nil || $c === false)))) === false || $a === nil) { - unprocessed_lines = inner_document_lines['$[]']($range(0, 0, false)); - processed_lines = $scope.PreprocessorReader.$new(self.document, unprocessed_lines).$readlines(); - if (($a = ($b = processed_lines['$=='](unprocessed_lines), ($b === nil || $b === false))) !== false && $a !== nil) { - inner_document_lines.$shift(); - ($a = inner_document_lines).$unshift.apply($a, [].concat(processed_lines));};}; - self.inner_document = $scope.Document.$new(inner_document_lines, $hash2(["header_footer", "parent", "cursor"], {"header_footer": false, "parent": self.document, "cursor": cursor})); - if (($b = parent_doctitle['$nil?']()) !== false && $b !== nil) { - return nil - } else { - return self.document.$attributes()['$[]=']("doctitle", parent_doctitle) - }; - } else { - return nil - }; + return self.scanner.$scan($scope.NameRx); }; - def.$text = function() { + def.$scan_to_delimiter = function() { var self = this; - return self.$apply_normal_subs(self.text).$strip(); - }; - def.$content = function() { - var $a, $b, TMP_7, self = this; - if (self.style['$==']("asciidoc")) { - return self.inner_document.$render() - } else { - return ($a = ($b = self.$text().$split($scope.BLANK_LINE_PATTERN)).$map, $a._p = (TMP_7 = function(p){var self = TMP_7._s || this, $a, $b, $c; - if (self.style == null) self.style = nil; -if (p == null) p = nil; - if (($a = ((($b = ($c = self.style, ($c === nil || $c === false))) !== false && $b !== nil) ? $b : self.style['$==']("header"))) !== false && $a !== nil) { - return p - } else { - return $scope.Inline.$new(self.$parent(), "quoted", p, $hash2(["type"], {"type": self.style})).$render() - }}, TMP_7._s = self, TMP_7), $a).call($b) - }; + return self.scanner.$scan(self.delimiter_boundary_pattern); }; - return (def.$to_s = TMP_8 = function() {var $zuper = $slice.call(arguments, 0); - var $a, self = this, $iter = TMP_8._p, $yield = $iter || nil; - TMP_8._p = null; - return "" + ($opal.find_super_dispatcher(self, 'to_s', TMP_8, $iter).apply(self, $zuper).$to_s()) + " - [text: " + (self.text) + ", colspan: " + (((($a = self.colspan) !== false && $a !== nil) ? $a : 1)) + ", rowspan: " + (((($a = self.rowspan) !== false && $a !== nil) ? $a : 1)) + ", attributes: " + (self.attributes) + "]"; - }, nil); - })($scope.Table, $scope.AbstractNode); + return (def.$scan_to_quote = function(quote) { + var self = this; - (function($base, $super) { - function $ParserContext(){}; - var self = $ParserContext = $klass($base, $super, 'ParserContext', $ParserContext); + return self.scanner.$scan($scope.BoundaryRxs['$[]'](quote)); + }, nil) && 'scan_to_quote'; + })(self, null) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; - var def = $ParserContext._proto, $scope = $ParserContext._scope; - def.format = def.delimiter = def.delimiter_re = def.buffer = def.cell_specs = def.cell_open = def.last_cursor = def.table = def.current_row = def.col_count = def.col_visits = def.active_rowspans = def.linenum = nil; - self.$attr_accessor("table"); + return (function($base) { + var self = $module($base, 'Asciidoctor'); - self.$attr_accessor("format"); + var def = self._proto, $scope = self._scope; - self.$attr_reader("col_count"); + (function($base, $super) { + function $Block(){}; + var self = $Block = $klass($base, $super, 'Block', $Block); - self.$attr_accessor("buffer"); + var def = self._proto, $scope = self._scope, $a, TMP_1, TMP_2; - self.$attr_reader("delimiter"); + def.subs = def.attributes = def.content_model = def.lines = def.blocks = def.context = def.style = nil; + $opal.cdecl($scope, 'DEFAULT_CONTENT_MODEL', (($a = $opal.Object._scope.Hash) == null ? $opal.cm('Hash') : $a).$new("simple").$merge($hash2(["audio", "image", "listing", "literal", "math", "open", "page_break", "pass", "thematic_break", "video"], {"audio": "empty", "image": "empty", "listing": "verbatim", "literal": "verbatim", "math": "raw", "open": "compound", "page_break": "empty", "pass": "raw", "thematic_break": "empty", "video": "empty"}))); - self.$attr_reader("delimiter_re"); + $opal.defn(self, '$blockname', def.$context); - def.$initialize = function(reader, table, attributes) { - var $a, $b, $c, $d, self = this; - if (attributes == null) { - attributes = $hash2([], {}) + self.$attr_accessor("lines"); + + def.$initialize = TMP_1 = function(parent, context, opts) { + var $a, $b, $c, self = this, $iter = TMP_1._p, $yield = $iter || nil, attrs = nil, subs = nil, raw_source = nil; + + if (opts == null) { + opts = $hash2([], {}) } - self.reader = reader; - self.table = table; - self.last_cursor = reader.$cursor(); - if (($a = attributes['$has_key?']("format")) !== false && $a !== nil) { - self.format = attributes['$[]']("format"); - if (($a = ($b = ($scope.Table)._scope.DATA_FORMATS['$include?'](self.format), ($b === nil || $b === false))) !== false && $a !== nil) { - self.$raise("Illegal table format: " + (self.format))}; + TMP_1._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, context]); + self.content_model = ((($a = opts['$[]']("content_model")) !== false && $a !== nil) ? $a : $scope.DEFAULT_CONTENT_MODEL['$[]'](context)); + if ((($a = ((attrs = opts['$[]']("attributes")))['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.attributes = $hash2([], {}) } else { - self.format = ($scope.Table)._scope.DEFAULT_DATA_FORMAT + self.attributes = attrs.$dup() }; - if (($a = ($b = (($c = self.format['$==']("psv")) ? ($d = attributes['$has_key?']("separator"), ($d === nil || $d === false)) : $c), $b !== false && $b !== nil ?table.$document()['$nested?']() : $b)) !== false && $a !== nil) { - self.delimiter = "!" + if ((($a = opts['$has_key?']("subs")) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ((($b = ((subs = opts['$[]']("subs")))['$!']()) !== false && $b !== nil) ? $b : (subs['$is_a?']((($c = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $c))))) !== nil && (!$a._isBoolean || $a == true))) { + self.subs = ((($a = subs) !== false && $a !== nil) ? $a : []); + self.default_subs = self.subs.$dup(); + self.attributes.$delete("subs"); + } else { + self.attributes['$[]=']("subs", "" + (subs)) + }}; + if ((($a = ((raw_source = opts['$[]']("source")))['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return self.lines = [] + } else if ((($a = raw_source['$is_a?']((($b = $opal.Object._scope.String) == null ? $opal.cm('String') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + return self.lines = $scope.Helpers.$normalize_lines_from_string(raw_source) } else { - self.delimiter = attributes.$fetch("separator", ($scope.Table)._scope.DEFAULT_DELIMITERS['$[]'](self.format)) + return self.lines = raw_source.$dup() }; - self.delimiter_re = (new RegExp("" + $scope.Regexp.$escape(self.delimiter))); - self.col_count = (function() {if (($a = table.$columns()['$empty?']()) !== false && $a !== nil) { - return -1 - } else { - return table.$columns().$size() - }; return nil; })(); - self.buffer = ""; - self.cell_specs = []; - self.cell_open = false; - self.active_rowspans = [0]; - self.col_visits = 0; - self.current_row = []; - return self.linenum = -1; }; - def['$starts_with_delimiter?'] = function(line) { - var self = this; - return line['$start_with?'](self.delimiter); + def.$content = TMP_2 = function() {var $zuper = $slice.call(arguments, 0); + var $a, $b, $c, self = this, $iter = TMP_2._p, $yield = $iter || nil, $case = nil, result = nil, first = nil, last = nil; + + TMP_2._p = null; + return (function() {$case = self.content_model;if ("compound"['$===']($case)) {return $opal.find_super_dispatcher(self, 'content', TMP_2, $iter).apply(self, $zuper)}else if ("simple"['$===']($case)) {return self.$apply_subs(self.lines['$*']($scope.EOL), self.subs)}else if ("verbatim"['$===']($case) || "raw"['$===']($case)) {result = self.$apply_subs(self.lines, self.subs); + if (result.$size()['$<'](2)) { + return result['$[]'](0) + } else { + while ((($b = ($c = (first = result['$[]'](0)), $c !== false && $c !== nil ?first.$rstrip()['$empty?']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + result.$shift()}; + while ((($b = ($c = (last = result['$[]'](-1)), $c !== false && $c !== nil ?last.$rstrip()['$empty?']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + result.$pop()}; + return result['$*']($scope.EOL); + };}else {if (self.content_model['$==']("empty")) { + } else { + self.$warn("Unknown content model '" + (self.content_model) + "' for block: " + (self.$to_s())) + }; + return nil;}})(); }; - def.$match_delimiter = function(line) { + def.$source = function() { var self = this; - return line.$match(self.delimiter_re); + + return self.lines['$*']($scope.EOL); }; - def.$skip_matched_delimiter = function(match, escaped) { - var self = this; - if (escaped == null) { - escaped = false - } - self.buffer = "" + (self.buffer) + ((function() {if (escaped !== false && escaped !== nil) { - return match.$pre_match().$chop() + return (def.$to_s = function() { + var self = this, content_summary = nil; + + content_summary = (function() {if (self.content_model['$==']("compound")) { + return "blocks: " + (self.blocks.$size()) } else { - return match.$pre_match() - }; return nil; })()) + (self.delimiter); - return match.$post_match(); - }; + return "lines: " + (self.lines.$size()) + }; return nil; })(); + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", content_model: " + (self.content_model.$inspect()) + ", style: " + (self.style.$inspect()) + ", " + (content_summary) + "}>"; + }, nil) && 'to_s'; + })(self, $scope.AbstractBlock) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; - def['$buffer_has_unclosed_quotes?'] = function(append) { - var $a, $b, $c, self = this, record = nil; - if (append == null) { - append = nil - } - record = ((("") + (self.buffer)) + (append)).$strip(); - return ($a = ($b = record['$start_with?']("\""), $b !== false && $b !== nil ?($c = record['$start_with?']("\"\""), ($c === nil || $c === false)) : $b), $a !== false && $a !== nil ?($b = record['$end_with?']("\""), ($b === nil || $b === false)) : $a); - }; + return (function($base) { + var self = $module($base, 'Asciidoctor'); - def['$buffer_quoted?'] = function() { - var $a, $b, self = this; - self.buffer = self.buffer.$lstrip(); - return ($a = self.buffer['$start_with?']("\""), $a !== false && $a !== nil ?($b = self.buffer['$start_with?']("\"\""), ($b === nil || $b === false)) : $a); - }; + var def = self._proto, $scope = self._scope; - def.$take_cell_spec = function() { - var self = this; - return self.cell_specs.$shift(); - }; + (function($base, $super) { + function $Callouts(){}; + var self = $Callouts = $klass($base, $super, 'Callouts', $Callouts); - def.$push_cell_spec = function(cell_spec) { - var $a, self = this; - if (cell_spec == null) { - cell_spec = $hash2([], {}) - } - self.cell_specs['$<<']((((($a = cell_spec) !== false && $a !== nil) ? $a : $hash2([], {})))); - return nil; - }; + var def = self._proto, $scope = self._scope; - def.$keep_cell_open = function() { + def.co_index = def.lists = def.list_index = nil; + def.$initialize = function() { var self = this; - self.cell_open = true; - return nil; - }; - def.$mark_cell_closed = function() { - var self = this; - self.cell_open = false; - return nil; + self.lists = []; + self.list_index = 0; + return self.$next_list(); }; - def['$cell_open?'] = function() { - var self = this; - return self.cell_open; - }; + def.$register = function(li_ordinal) { + var self = this, id = nil; - def['$cell_closed?'] = function() { - var $a, self = this; - return ($a = self.cell_open, ($a === nil || $a === false)); + self.$current_list()['$<<']($hash2(["ordinal", "id"], {"ordinal": li_ordinal.$to_i(), "id": (id = self.$generate_next_callout_id())})); + self.co_index = self.co_index['$+'](1); + return id; }; - def.$close_open_cell = function(next_cell_spec) { - var $a, self = this; - if (next_cell_spec == null) { - next_cell_spec = $hash2([], {}) - } - self.$push_cell_spec(next_cell_spec); - if (($a = self['$cell_open?']()) !== false && $a !== nil) { - self.$close_cell(true)}; - self.$advance(); - return nil; + def.$read_next_id = function() { + var self = this, id = nil, list = nil; + + id = nil; + list = self.$current_list(); + if (self.co_index['$<='](list.$size())) { + id = list['$[]'](self.co_index['$-'](1))['$[]']("id")}; + self.co_index = self.co_index['$+'](1); + return id; }; - def.$close_cell = function(eol) { - var $a, $b, $c, TMP_9, self = this, cell_text = nil, cell_spec = nil, repeat = nil; - if (eol == null) { - eol = false - } - cell_text = self.buffer.$strip(); - self.buffer = ""; - if (self.$format()['$==']("psv")) { - cell_spec = self.$take_cell_spec(); - if (($a = cell_spec['$nil?']()) !== false && $a !== nil) { - self.$warn("asciidoctor: ERROR: " + (self.last_cursor.$line_info()) + ": table missing leading separator, recovering automatically"); - cell_spec = $hash2([], {}); - repeat = 1; - } else { - repeat = cell_spec.$fetch("repeatcol", 1); - cell_spec.$delete("repeatcol"); - }; - } else { - cell_spec = nil; - repeat = 1; - if (self.$format()['$==']("csv")) { - if (($a = ($b = ($c = cell_text['$empty?'](), ($c === nil || $c === false)), $b !== false && $b !== nil ?cell_text['$include?']("\"") : $b)) !== false && $a !== nil) { - if (($a = ($b = cell_text['$start_with?']("\""), $b !== false && $b !== nil ?cell_text['$end_with?']("\"") : $b)) !== false && $a !== nil) { - cell_text = cell_text['$[]']($range(1, -2, false)).$strip()}; - cell_text = cell_text.$tr_s("\"", "\"");}}; - }; - ($a = ($b = (1)).$upto, $a._p = (TMP_9 = function(i){var self = TMP_9._s || this, $a, $b, $c, $d, $e, column = nil, cell = nil; - if (self.col_count == null) self.col_count = nil; - if (self.table == null) self.table = nil; - if (self.current_row == null) self.current_row = nil; - if (self.last_cursor == null) self.last_cursor = nil; - if (self.reader == null) self.reader = nil; - if (self.col_visits == null) self.col_visits = nil; - if (self.linenum == null) self.linenum = nil; -if (i == null) i = nil; - if (self.col_count['$=='](-1)) { - self.table.$columns()['$<<'](($scope.Table)._scope.Column.$new(self.table, self.current_row.$size()['$+'](i)['$-'](1))); - column = self.table.$columns().$last(); - } else { - column = self.table.$columns()['$[]'](self.current_row.$size()) - }; - cell = ($scope.Table)._scope.Cell.$new(column, cell_text, cell_spec, self.last_cursor); - self.last_cursor = self.reader.$cursor(); - if (($a = ((($b = cell.$rowspan()['$nil?']()) !== false && $b !== nil) ? $b : cell.$rowspan()['$=='](1))) === false || $a === nil) { - self.$activate_rowspan(cell.$rowspan(), (((($a = cell.$colspan()) !== false && $a !== nil) ? $a : 1)))}; - self.col_visits = self.col_visits['$+']((((($a = cell.$colspan()) !== false && $a !== nil) ? $a : 1))); - self.current_row['$<<'](cell); - if (($a = ($b = self['$end_of_row?'](), $b !== false && $b !== nil ?(((($c = ((($d = ($e = self.col_count['$=='](-1), ($e === nil || $e === false))) !== false && $d !== nil) ? $d : self.linenum['$>'](0))) !== false && $c !== nil) ? $c : ((($d = eol !== false && eol !== nil) ? i['$=='](repeat) : $d)))) : $b)) !== false && $a !== nil) { - return self.$close_row() + def.$callout_ids = function(li_ordinal) { + var $a, $b, TMP_1, self = this; + + return ($a = ($b = self.$current_list()).$map, $a._p = (TMP_1 = function(element){var self = TMP_1._s || this; +if (element == null) element = nil; + if (element['$[]']("ordinal")['$=='](li_ordinal)) { + return "" + (element['$[]']("id")) + " " } else { return nil - };}, TMP_9._s = self, TMP_9), $a).call($b, repeat); - self.open_cell = false; - return nil; + }}, TMP_1._s = self, TMP_1), $a).call($b).$join().$chop(); }; - def.$close_row = function() { - var $a, $b, $c, self = this; - self.table.$rows().$body()['$<<'](self.current_row); - if (self.col_count['$=='](-1)) { - self.col_count = self.col_visits}; - self.col_visits = 0; - self.current_row = []; - self.active_rowspans.$shift(); - ($a = 0, $b = self.active_rowspans, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, 0))); - return nil; + def.$current_list = function() { + var self = this; + + return self.lists['$[]'](self.list_index['$-'](1)); }; - def.$activate_rowspan = function(rowspan, colspan) { - var $a, $b, TMP_10, self = this; - ($a = ($b = (1).$upto(rowspan['$-'](1))).$each, $a._p = (TMP_10 = function(i){var self = TMP_10._s || this, $a; - if (self.active_rowspans == null) self.active_rowspans = nil; -if (i == null) i = nil; - return self.active_rowspans['$[]='](i, (((($a = self.active_rowspans['$[]'](i)) !== false && $a !== nil) ? $a : 0))['$+'](colspan))}, TMP_10._s = self, TMP_10), $a).call($b); + def.$next_list = function() { + var self = this; + + self.list_index = self.list_index['$+'](1); + if (self.lists.$size()['$<'](self.list_index)) { + self.lists['$<<']([])}; + self.co_index = 1; return nil; }; - def['$end_of_row?'] = function() { - var $a, self = this; - return ((($a = self.col_count['$=='](-1)) !== false && $a !== nil) ? $a : self.$effective_col_visits()['$=='](self.col_count)); + def.$rewind = function() { + var self = this; + + self.list_index = 1; + self.co_index = 1; + return nil; }; - def.$effective_col_visits = function() { + def.$generate_next_callout_id = function() { var self = this; - return self.col_visits['$+'](self.active_rowspans.$first()); + + return self.$generate_callout_id(self.list_index, self.co_index); }; - return (def.$advance = function() { + return (def.$generate_callout_id = function(list_index, co_index) { var self = this; - return self.linenum = self.linenum['$+'](1); - }, nil); - })($scope.Table, null); + + return "CO" + (list_index) + "-" + (co_index); + }, nil) && 'generate_callout_id'; + })(self, null) })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $hash2 = $opal.hash2; - return (function($base, $super) { - function $Template(){}; - var self = $Template = $klass($base, $super, 'Template', $Template); + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; - var def = $Template._proto, $scope = $Template._scope, TMP_1; - def.name = def.body = nil; - self._cache = $hash2([], {}); + return (function($base) { + var self = $module($base, 'Asciidoctor'); - $opal.defs(self, '$[]', function(name) { - var self = this; - if (self._cache == null) self._cache = nil; + var def = self._proto, $scope = self._scope; - return self._cache['$[]'](name); - }); + (function($base) { + var self = $module($base, 'Converter'); - $opal.defs(self, '$[]=', function(name, instance) { - var self = this; - if (self._cache == null) self._cache = nil; + var def = self._proto, $scope = self._scope; - return self._cache['$[]='](name, instance); - }); + nil + + })(self); - $opal.defs(self, '$paths', function() { - var self = this; - if (self._cache == null) self._cache = nil; + (function($base, $super) { + function $Base(){}; + var self = $Base = $klass($base, $super, 'Base', $Base); - return self._cache.$keys(); - }); + var def = self._proto, $scope = self._scope; - self.$attr_reader("body"); + return self.$include($scope.Converter) + })($scope.Converter, null); - def.$initialize = TMP_1 = function(name) { - var $a, self = this, $iter = TMP_1._p, body = $iter || nil; - TMP_1._p = null; - $a = [name, body], self.name = $a[0], self.body = $a[1]; - return $scope.Template['$[]='](name, self); - }; + (function($base, $super) { + function $BuiltIn(){}; + var self = $BuiltIn = $klass($base, $super, 'BuiltIn', $BuiltIn); - def.$inspect = function() { - var self = this; - return "#"; - }; + var def = self._proto, $scope = self._scope; - def.$render = function(ctx) { - var $a, $b, self = this; - if (ctx == null) { - ctx = self - } - return ($a = ($b = ctx).$instance_exec, $a._p = self.body.$to_proc(), $a).call($b, $scope.OutputBuffer.$new()); - }; + def.$initialize = function(backend, opts) { + var self = this; + + if (opts == null) { + opts = $hash2([], {}) + } + return nil; + }; - return (function($base, $super) { - function $OutputBuffer(){}; - var self = $OutputBuffer = $klass($base, $super, 'OutputBuffer', $OutputBuffer); + def.$convert = function(node, transform) { + var $a, self = this; - var def = $OutputBuffer._proto, $scope = $OutputBuffer._scope; - def.buffer = nil; - def.$initialize = function() { - var self = this; - return self.buffer = []; + if (transform == null) { + transform = nil + } + ((($a = transform) !== false && $a !== nil) ? $a : transform = node.$node_name()); + return self.$send(transform, node); }; - def.$append = function(str) { - var self = this; - return self.buffer['$<<'](str); + def.$convert_with_options = function(node, transform, opts) { + var $a, self = this; + + if (transform == null) { + transform = nil + } + if (opts == null) { + opts = $hash2([], {}) + } + ((($a = transform) !== false && $a !== nil) ? $a : transform = node.$node_name()); + return self.$send(transform, node, opts); }; - def['$append='] = function(content) { + $opal.defn(self, '$handles?', def['$respond_to?']); + + def.$content = function(node) { var self = this; - return self.buffer['$<<'](content); + + return node.$content(); }; - return (def.$join = function() { + $opal.defn(self, '$pass', def.$content); + + return (def.$skip = function(node) { var self = this; - return self.buffer.$join(); - }, nil); - })(self, null); - })(self, null) + + return nil; + }, nil) && 'skip'; + })($scope.Converter, null); + + })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $module = $opal.module; - ; - return (function($base, $super) { - function $ERB(){}; - var self = $ERB = $klass($base, $super, 'ERB', $ERB); + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); - var def = $ERB._proto, $scope = $ERB._scope; - return (function($base) { - var self = $module($base, 'Util'); + var def = self._proto, $scope = self._scope; + + (function($base) { + var self = $module($base, 'Converter'); var def = self._proto, $scope = self._scope; - var escapes = { '&': '&', '<': '<', '>': '>', '"': '"', "'": '''}; - var escape_regexp = /[&<>"']/g; + (function($base, $super) { + function $Factory(){}; + var self = $Factory = $klass($base, $super, 'Factory', $Factory); + + var def = self._proto, $scope = self._scope; - def.$html_escape = function(str) { - var self = this; - return ("" + str).replace(escape_regexp, function (m) { return escapes[m] }); - }; + def.converters = def.star_converter = nil; + self.__default__ = nil; + + (function(self) { + var $scope = self._scope, def = self._proto; + + self._proto.$default = function(initialize_singleton) { + var $a, $b, self = this; + if (self.__default__ == null) self.__default__ = nil; + + if (initialize_singleton == null) { + initialize_singleton = true + } + if (initialize_singleton !== false && initialize_singleton !== nil) { + } else { + return ((($a = self.__default__) !== false && $a !== nil) ? $a : self.$new()) + }; + return ((($a = self.__default__) !== false && $a !== nil) ? $a : self.__default__ = (function() { try { + (function() {if ((($b = ($opal.Object._scope.ThreadSafe == null ? nil : 'constant')) !== nil && (!$b._isBoolean || $b == true))) { + return nil + } else { + return true + }; return nil; })() + self.$new(((($b = $opal.Object._scope.ThreadSafe) == null ? $opal.cm('ThreadSafe') : $b))._scope.Cache.$new()) + } catch ($err) {if ($opal.$rescue($err, [(($b = $opal.Object._scope.LoadError) == null ? $opal.cm('LoadError') : $b)])) { + self.$warn("asciidoctor: WARNING: gem 'thread_safe' is not installed. This gem recommended when registering custom converters.") + self.$new() + }else { throw $err; } + }})()); + }; + self._proto.$register = function(converter, backends) { + var self = this; + + if (backends == null) { + backends = ["*"] + } + return self.$default().$register(converter, backends); + }; + self._proto.$resolve = function(backend) { + var self = this; + + return self.$default().$resolve(backend); + }; + self._proto.$converters = function() { + var self = this; + + return self.$default().$converters(); + }; + return (self._proto.$unregister_all = function() { + var self = this; + + return self.$default().$unregister_all(); + }, nil) && 'unregister_all'; + })(self.$singleton_class()); + + self.$attr_reader("converters"); + + def.$initialize = function(converters) { + var $a, self = this; + + if (converters == null) { + converters = nil + } + self.converters = ((($a = converters) !== false && $a !== nil) ? $a : $hash2([], {})); + return self.star_converter = nil; + }; + + def.$register = function(converter, backends) { + var $a, $b, TMP_1, self = this; + + if (backends == null) { + backends = ["*"] + } + ($a = ($b = backends).$each, $a._p = (TMP_1 = function(backend){var self = TMP_1._s || this; + if (self.converters == null) self.converters = nil; +if (backend == null) backend = nil; + self.converters['$[]='](backend, converter); + if (backend['$==']("*")) { + return self.star_converter = converter + } else { + return nil + };}, TMP_1._s = self, TMP_1), $a).call($b); + return nil; + }; + + def.$resolve = function(backend) { + var $a, $b, self = this; + + return ($a = self.converters, $a !== false && $a !== nil ?(((($b = self.converters['$[]'](backend)) !== false && $b !== nil) ? $b : self.star_converter)) : $a); + }; + + def.$unregister_all = function() { + var self = this; - $opal.defn(self, '$h', def.$html_escape); + self.converters.$clear(); + return self.star_converter = nil; + }; - self.$module_function("h"); + return (def.$create = function(backend, opts) { + var $a, $b, self = this, converter = nil, base_converter = nil, $case = nil, template_converter = nil; - self.$module_function("html_escape"); - ;$opal.donate(self, ["$html_escape", "$h"]); + if (opts == null) { + opts = $hash2([], {}) + } + if ((($a = (converter = self.$resolve(backend))) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = converter['$is_a?']((($b = $opal.Object._scope.Class) == null ? $opal.cm('Class') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + return converter.$new(backend, opts) + } else { + return converter + }}; + base_converter = (function() {$case = backend;if ("html5"['$===']($case)) {if ((($a = (function(){ try { return (((((($b = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $b))._scope.Converter)._scope.Html5Converter) != null ? 'constant' : nil); } catch (err) { if (err._klass === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + + }; + return $scope.Html5Converter.$new(backend, opts);}else if ("docbook5"['$===']($case)) {if ((($a = (function(){ try { return (((((($b = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $b))._scope.Converter)._scope.DocBook5Converter) != null ? 'constant' : nil); } catch (err) { if (err._klass === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + + }; + return $scope.DocBook5Converter.$new(backend, opts);}else if ("docbook45"['$===']($case)) {if ((($a = (function(){ try { return (((((($b = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $b))._scope.Converter)._scope.DocBook45Converter) != null ? 'constant' : nil); } catch (err) { if (err._klass === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + + }; + return $scope.DocBook45Converter.$new(backend, opts);}else { return nil }})(); + if ((($a = opts['$key?']("template_dirs")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return base_converter + }; + if ((($a = (function(){ try { return (((((($b = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $b))._scope.Converter)._scope.TemplateConverter) != null ? 'constant' : nil); } catch (err) { if (err._klass === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + + }; + if ((($a = (function(){ try { return (((((($b = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $b))._scope.Converter)._scope.CompositeConverter) != null ? 'constant' : nil); } catch (err) { if (err._klass === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + + }; + template_converter = $scope.TemplateConverter.$new(backend, opts['$[]']("template_dirs"), opts); + return $scope.CompositeConverter.$new(backend, template_converter, base_converter); + }, nil) && 'create'; + })(self, null) + })(self) - })(self, null); -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$attr', '$role', '$attr?', '$icon_uri', '$title?', '$title', '$content', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a; - if (self.id == null) self.id = nil; - if (self.document == null) self.document = nil; - if (self.caption == null) self.caption = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append("\n\n\n\n\n
"); - if (($a = self.document['$attr?']("icons", "font")) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("");}; - output_buffer.$append("\n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
\n
\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_admonition") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$captioned_title', '$media_uri', '$attr', '$option?', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a; - if (self.id == null) self.id = nil; - if (self.style == null) self.style = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$captioned_title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
\n\n
\n
\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_audio") + + })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$title', '$attr?', '$each_with_index', '$+', '$icon_uri', '$text', '$items', '$each', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, TMP_2, $c, TMP_3, font_icons = nil; - if (self.id == null) self.id = nil; - if (self.style == null) self.style = nil; - if (self.document == null) self.document = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
");}; - if (($a = self.document['$attr?']("icons")) !== false && $a !== nil) { - font_icons = self.document['$attr?']("icons", "font"); - output_buffer.$append("\n"); - ($a = ($b = self.$items()).$each_with_index, $a._p = (TMP_2 = function(item, i){var self = TMP_2._s || this, num = nil;if (item == null) item = nil;if (i == null) i = nil; - num = i['$+'](1); - output_buffer.$append("\n\n");}; - if (($a = (self.$attr("rowcount"))['$zero?']()) === false || $a === nil) { - output_buffer.$append("\n"); - if (($a = self['$option?']("autowidth")) !== false && $a !== nil) { - ($a = ($b = self.columns.$size()).$times, $a._p = (TMP_2 = function(){var self = TMP_2._s || this; - return output_buffer.$append("\n")}, TMP_2._s = self, TMP_2), $a).call($b) - } else { - ($a = ($c = self.columns).$each, $a._p = (TMP_3 = function(col){var self = TMP_3._s || this;if (col == null) col = nil; - output_buffer.$append("\n"); - ($a = ($b = row).$each, $a._p = (TMP_6 = function(cell){var self = TMP_6._s || this, $a, $b, TMP_7, $c, TMP_8, cell_content = nil, $case = nil, cell_css_style = nil; - if (self.document == null) self.document = nil; -if (cell == null) cell = nil; - if (tsec['$==']("head")) { - cell_content = cell.$text() - } else { - $case = cell.$style();if ("verse"['$===']($case) || "literal"['$===']($case)) {cell_content = cell.$text()}else {cell_content = cell.$content()} - }; - cell_css_style = (function() {if (($a = (self.document['$attr?']("cellbgcolor"))) !== false && $a !== nil) { - return "background-color: " + (self.document.$attr("cellbgcolor")) + ";" - } else { - return nil - }; return nil; })(); - output_buffer.$append("\n<"); - output_buffer['$append='](((function() {if (tsec['$==']("head")) { - return "th" - } else { - return "td" - }; return nil; })())); - output_buffer.$append(" class=\""); - output_buffer['$append=']((["tableblock", "halign-" + (cell.$attr("halign")), "valign-" + (cell.$attr("valign"))]['$*'](" "))); - output_buffer.$append("\""); - output_buffer['$append='](((function() {if (($a = cell.$colspan()) !== false && $a !== nil) { - return " colspan=\"" + (cell.$colspan()) + "\"" - } else { - return nil - }; return nil; })())); - output_buffer.$append(""); - output_buffer['$append='](((function() {if (($a = cell.$rowspan()) !== false && $a !== nil) { - return " rowspan=\"" + (cell.$rowspan()) + "\"" - } else { - return nil - }; return nil; })())); - output_buffer.$append(""); - output_buffer['$append='](((function() {if (cell_css_style !== false && cell_css_style !== nil) { - return " style=\"" + (cell_css_style) + "\"" - } else { - return nil - }; return nil; })())); - output_buffer.$append(">"); - if (tsec['$==']("head")) { - output_buffer.$append(""); - output_buffer['$append=']((cell_content)); - output_buffer.$append(""); - } else { - $case = cell.$style();if ("asciidoc"['$===']($case)) {output_buffer.$append("
"); - output_buffer['$append=']((cell_content)); - output_buffer.$append("
");}else if ("verse"['$===']($case)) {output_buffer.$append("
"); - output_buffer['$append=']((cell_content)); - output_buffer.$append("
");}else if ("literal"['$===']($case)) {output_buffer.$append("
");
-              output_buffer['$append=']((cell_content));
-              output_buffer.$append("
");}else if ("header"['$===']($case)) {($a = ($b = cell_content).$each, $a._p = (TMP_7 = function(text){var self = TMP_7._s || this;if (text == null) text = nil; - output_buffer.$append("

"); - output_buffer['$append=']((text)); - return output_buffer.$append("

");}, TMP_7._s = self, TMP_7), $a).call($b)}else {($a = ($c = cell_content).$each, $a._p = (TMP_8 = function(text){var self = TMP_8._s || this;if (text == null) text = nil; - output_buffer.$append("

"); - output_buffer['$append=']((text)); - return output_buffer.$append("

");}, TMP_8._s = self, TMP_8), $a).call($c)} - }; - output_buffer.$append("");}, TMP_6._s = self, TMP_6), $a).call($b); - return output_buffer.$append("\n");}, TMP_5._s = self, TMP_5), $a).call($b); - output_buffer.$append("\n"; - marker_unchecked = ""; - } else if (($a = self.document['$attr?']("icons", "font")) !== false && $a !== nil) { - marker_checked = ""; - marker_unchecked = ""; - } else { - marker_checked = ""; - marker_unchecked = ""; - }}; - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
");}; - output_buffer.$append("\n"); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
");
-    output_buffer['$append=']((self.$content()));
-    output_buffer.$append("
"); - if (($a = ((($b = (self['$attr?']("attribution"))) !== false && $b !== nil) ? $b : (self['$attr?']("citetitle")))) !== false && $a !== nil) { - output_buffer.$append("\n
"); - if (($a = self['$attr?']("citetitle")) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((self.$attr("citetitle"))); - output_buffer.$append("");}; - if (($a = self['$attr?']("attribution")) !== false && $a !== nil) { - if (($a = self['$attr?']("citetitle")) !== false && $a !== nil) { - output_buffer.$append("
")}; - output_buffer.$append("\n"); - output_buffer['$append='](("— " + (self.$attr("attribution")))); - output_buffer.$append("");}; - output_buffer.$append("\n
");}; - output_buffer.$append("\n\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_verse") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$captioned_title', '$attr', '$===', '$attr?', '$option?', '$<<', '$media_uri', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $case = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, src = nil, params = nil; - if (self.id == null) self.id = nil; - if (self.style == null) self.style = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$captioned_title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
"); - $case = self.$attr("poster");if ("vimeo"['$===']($case)) {start_anchor = (function() {if (($a = (self['$attr?']("start"))) !== false && $a !== nil) { - return "#at=" + (self.$attr("start")) - } else { - return nil - }; return nil; })(); - delimiter = "?"; - autoplay_param = (function() {if (($a = (self['$option?']("autoplay"))) !== false && $a !== nil) { - return "" + (delimiter) + "autoplay=1" - } else { - return nil - }; return nil; })(); - if (autoplay_param !== false && autoplay_param !== nil) { - delimiter = "&"}; - loop_param = (function() {if (($a = (self['$option?']("loop"))) !== false && $a !== nil) { - return "" + (delimiter) + "loop=1" - } else { - return nil - }; return nil; })(); - src = "//player.vimeo.com/video/" + (self.$attr("target")) + (start_anchor) + (autoplay_param) + (loop_param); - output_buffer.$append("\n");}else {output_buffer.$append("\n");}; - output_buffer.$append("\n
\n\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_video") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $hash2 = $opal.hash2, $range = $opal.range; - $opal.add_stubs(['$new', '$append', '$append=', '$attr?', '$attr', '$each', '$doctitle', '$include?', '$>=', '$normalize_web_path', '$default_asciidoctor_stylesheet', '$read_asset', '$normalize_system_path', '$nil?', '$===', '$==', '$default_coderay_stylesheet', '$pygments_stylesheet', '$[]', '$empty?', '$docinfo', '$*', '$compact', '$noheader', '$doctype', '$outline', '$to_i', '$has_header?', '$notitle', '$title', '$sub_macros', '$>', '$downcase', '$content', '$footnotes?', '$index', '$text', '$footnotes', '$nofooter', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, TMP_2, $c, $d, TMP_3, $e, TMP_4, $case = nil, docinfo_content = nil, authorcount = nil; - if (self.safe == null) self.safe = nil; - if (self.id == null) self.id = nil; - if (self.header == null) self.header = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append("\n\n\n\n=']((((($d = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $d))._scope.SafeMode)._scope.SECURE)) !== false && $c !== nil) ? $c : (self['$attr?']("linkcss")))) !== false && $a !== nil) { - output_buffer.$append("\n"); - } else { - output_buffer.$append("\n"); - } - } else if (($a = self['$attr?']("stylesheet")) !== false && $a !== nil) { - if (($a = ((($c = self.safe['$>=']((((($d = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $d))._scope.SafeMode)._scope.SECURE)) !== false && $c !== nil) ? $c : (self['$attr?']("linkcss")))) !== false && $a !== nil) { - output_buffer.$append("\n=']((((($d = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $d))._scope.SafeMode)._scope.SECURE)) !== false && $c !== nil) ? $c : (self['$attr?']("linkcss")))) !== false && $a !== nil) { - output_buffer.$append("\n"); - }}}else if ("pygments"['$===']($case)) {if ((self.$attr("pygments-css", "class"))['$==']("class")) { - if (($a = ((($c = self.safe['$>=']((((($d = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $d))._scope.SafeMode)._scope.SECURE)) !== false && $c !== nil) ? $c : (self['$attr?']("linkcss")))) !== false && $a !== nil) { - output_buffer.$append("\n"); - }}}else if ("highlightjs"['$===']($case)) {output_buffer.$append("\n");}; - if (($a = self['$attr?']("math")) !== false && $a !== nil) { - output_buffer.$append("\n\n\n");}; - output_buffer.$append(""); - output_buffer['$append='](((function() {if (($a = ((docinfo_content = self.$docinfo()))['$empty?']()) !== false && $a !== nil) { - return nil - } else { - return "\n" + (docinfo_content) - }; return nil; })())); - output_buffer.$append("\n\n"); - if (($a = self.$noheader()) === false || $a === nil) { - output_buffer.$append("\n
"); - if (self.$doctype()['$==']("manpage")) { - output_buffer.$append("\n

"); - output_buffer['$append=']((self.$doctitle())); - output_buffer.$append(" Manual Page

"); - if (($a = ($c = (self['$attr?']("toc")), $c !== false && $c !== nil ?(self['$attr?']("toc-placement", "auto")) : $c)) !== false && $a !== nil) { - output_buffer.$append("\n
");}; - output_buffer.$append("\n

"); - output_buffer['$append=']((self.$attr("manname-title"))); - output_buffer.$append("

\n
\n

"); - output_buffer['$append='](("" + (self.$attr("manname")) + " - " + (self.$attr("manpurpose")))); - output_buffer.$append("

\n
"); - } else { - if (($a = self['$has_header?']()) !== false && $a !== nil) { - if (($a = self.$notitle()) === false || $a === nil) { - output_buffer.$append("\n

"); - output_buffer['$append=']((self.header.$title())); - output_buffer.$append("

");}; - if (($a = self['$attr?']("author")) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((self.$attr("author"))); - output_buffer.$append("
"); - if (($a = self['$attr?']("email")) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((self.$sub_macros(self.$attr("email")))); - output_buffer.$append("
");}; - if (((authorcount = (self.$attr("authorcount")).$to_i()))['$>'](1)) { - ($a = ($c = ($range(2, authorcount, false))).$each, $a._p = (TMP_3 = function(idx){var self = TMP_3._s || this, $a;if (idx == null) idx = nil; - output_buffer.$append("\n\n\n\n\n"); + if ((($a = node['$attr?']("app-name")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("")}; + if ((($a = node['$attr?']("description")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("")}; + if ((($a = node['$attr?']("keywords")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("")}; + if ((($a = node['$attr?']("authors")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("")}; + if ((($a = node['$attr?']("copyright")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("")}; + result['$<<']("" + (((($a = node.$doctitle($hash2(["sanitize"], {"sanitize": true}))) !== false && $a !== nil) ? $a : node.$attr("untitled-label"))) + ""); + if ((($a = $scope.DEFAULT_STYLESHEET_KEYS['$include?'](node.$attr("stylesheet"))) !== nil && (!$a._isBoolean || $a == true))) { + if (linkcss !== false && linkcss !== nil) { + result['$<<']("") + } else { + result['$<<'](self.stylesheets.$embed_primary_stylesheet()) + } + } else if ((($a = node['$attr?']("stylesheet")) !== nil && (!$a._isBoolean || $a == true))) { + if (linkcss !== false && linkcss !== nil) { + result['$<<']("") + } else { + result['$<<']("") + }}; + if ((($a = node['$attr?']("icons", "font")) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = (node.$attr("iconfont-remote", ""))['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("") + } else { + iconfont_stylesheet = "" + (node.$attr("iconfont-name", "font-awesome")) + ".css"; + result['$<<'](""); + }}; + $case = node.$attr("source-highlighter");if ("coderay"['$===']($case)) {if ((node.$attr("coderay-css", "class"))['$==']("class")) { + if (linkcss !== false && linkcss !== nil) { + result['$<<']("") + } else { + result['$<<'](self.stylesheets.$embed_coderay_stylesheet()) + }}}else if ("pygments"['$===']($case)) {if ((node.$attr("pygments-css", "class"))['$==']("class")) { + pygments_style = (self.$doc().$attr("pygments-style", "pastie")); + if (linkcss !== false && linkcss !== nil) { + result['$<<']("") + } else { + result['$<<']((self.stylesheets.$instance().$embed_pygments_stylesheet(pygments_style))) + };}}else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) {result['$<<']("\n\n\n")}else if ("prettify"['$===']($case)) {result['$<<']("\n\n")}; + if ((($a = node['$attr?']("math")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("\n\n")}; + if ((($a = ((docinfo_content = node.$docinfo()))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + result['$<<'](docinfo_content) + }; + result['$<<'](""); + body_attrs = []; + if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + body_attrs['$<<']("id=\"" + (node.$id()) + "\"")}; + if ((($a = ($b = ($c = (node['$attr?']("toc-class")), $c !== false && $c !== nil ?(node['$attr?']("toc")) : $c), $b !== false && $b !== nil ?(node['$attr?']("toc-placement", "auto")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + body_attrs['$<<']("class=\"" + (node.$doctype()) + " " + (node.$attr("toc-class")) + " toc-" + (node.$attr("toc-position", "left")) + "\"") + } else { + body_attrs['$<<']("class=\"" + (node.$doctype()) + "\"") + }; + if ((($a = node['$attr?']("max-width")) !== nil && (!$a._isBoolean || $a == true))) { + body_attrs['$<<']("style=\"max-width: " + (node.$attr("max-width")) + ";\"")}; + result['$<<'](""); + if ((($a = node.$noheader()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + result['$<<']("
"); + if (node.$doctype()['$==']("manpage")) { + result['$<<']("

" + (node.$doctitle()) + " Manual Page

"); + if ((($a = ($b = (node['$attr?']("toc")), $b !== false && $b !== nil ?(node['$attr?']("toc-placement", "auto")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
\n
" + (node.$attr("toc-title")) + "
\n" + (self.$outline(node)) + "\n
")}; + result['$<<']("

" + (node.$attr("manname-title")) + "

\n
\n

" + (node.$attr("manname")) + " - " + (node.$attr("manpurpose")) + "

\n
"); + } else { + if ((($a = node['$has_header?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = node.$notitle()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + result['$<<']("

" + (node.$header().$title()) + "

") + }; + if ((($a = node['$attr?']("author")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("" + (node.$attr("author")) + "" + (br)); + if ((($a = node['$attr?']("email")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("" + (node.$sub_macros(node.$attr("email"))) + "" + (br))}; + if (((authorcount = (node.$attr("authorcount")).$to_i()))['$>'](1)) { + ($a = ($b = ($range(2, authorcount, false))).$each, $a._p = (TMP_1 = function(idx){var self = TMP_1._s || this, $a; +if (idx == null) idx = nil; + result['$<<']("" + (node.$attr("author_" + (idx))) + "" + (br)); + if ((($a = node['$attr?']("email_" + (idx))) !== nil && (!$a._isBoolean || $a == true))) { + return result['$<<']("" + (node.$sub_macros(node.$attr("email_" + (idx)))) + "" + (br)) + } else { + return nil + };}, TMP_1._s = self, TMP_1), $a).call($b)};}; + if ((($a = node['$attr?']("revnumber")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("" + ((((($a = (node.$attr("version-label"))) !== false && $a !== nil) ? $a : "")).$downcase()) + " " + (node.$attr("revnumber")) + ((function() {if ((($a = (node['$attr?']("revdate"))) !== nil && (!$a._isBoolean || $a == true))) { + return "," } else { - return nil - };}, TMP_3._s = self, TMP_3), $a).call($c)};}; - if (($a = self['$attr?']("revnumber")) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append='](((((($a = (self.$attr("version-label"))) !== false && $a !== nil) ? $a : "")).$downcase())); - output_buffer.$append(" "); - output_buffer['$append=']((self.$attr("revnumber"))); - output_buffer.$append(""); - output_buffer['$append='](((function() {if (($a = self['$attr?']("revdate")) !== false && $a !== nil) { - return "," - } else { - return "" - }; return nil; })())); - output_buffer.$append("");}; - if (($a = self['$attr?']("revdate")) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((self.$attr("revdate"))); - output_buffer.$append("");}; - if (($a = self['$attr?']("revremark")) !== false && $a !== nil) { - output_buffer.$append("\n
\n"); - output_buffer['$append=']((self.$attr("revremark"))); - output_buffer.$append("");};}; - if (($a = ($d = (self['$attr?']("toc")), $d !== false && $d !== nil ?(self['$attr?']("toc-placement", "auto")) : $d)) !== false && $a !== nil) { - output_buffer.$append("\n
");}; - }; - output_buffer.$append("\n
");}; - output_buffer.$append("\n
\n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
"); - if (($a = ((($d = ($e = self['$footnotes?'](), ($e === nil || $e === false))) !== false && $d !== nil) ? $d : self['$attr?']("nofootnotes"))) === false || $a === nil) { - output_buffer.$append("\n
\n
"); - ($a = ($d = self.$footnotes()).$each, $a._p = (TMP_4 = function(fn){var self = TMP_4._s || this;if (fn == null) fn = nil; - output_buffer.$append("\n
\n
");}; - output_buffer.$append("\n\n\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/document") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$notitle', '$has_header?', '$append=', '$title', '$content', '$footnotes?', '$attr?', '$each', '$index', '$text', '$footnotes', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, $c, TMP_2; - if (self.id == null) self.id = nil; - if (self.header == null) self.header = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = ($b = ($c = self.$notitle(), ($c === nil || $c === false)), $b !== false && $b !== nil ?self['$has_header?']() : $b)) !== false && $a !== nil) { - output_buffer.$append("\n
"); - ($a = ($b = self.$footnotes()).$each, $a._p = (TMP_2 = function(fn){var self = TMP_2._s || this;if (fn == null) fn = nil; - output_buffer.$append(""); - output_buffer['$append='](("\n
\n" + (fn.$index()) + ". " + (fn.$text()) + "\n
")); - return output_buffer.$append("");}, TMP_2._s = self, TMP_2), $a).call($b); - output_buffer.$append("\n
");}; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/embedded") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$===', '$attr', '$append=', '$tr_s', '$fetch', '$[]', '$references', '$role?', '$role', '$attr?', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $case = nil, refid = nil; - if (self.type == null) self.type = nil; - if (self.target == null) self.target = nil; - if (self.text == null) self.text = nil; - if (self.document == null) self.document = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - $case = self.type;if ("xref"['$===']($case)) {refid = ((($a = (self.$attr("refid"))) !== false && $a !== nil) ? $a : self.target); - output_buffer.$append(""); - output_buffer['$append='](("" + (((($a = self.text) !== false && $a !== nil) ? $a : self.document.$references()['$[]']("ids").$fetch(refid, "[" + (refid) + "]").$tr_s("\n", " "))) + "")); - output_buffer.$append("");}else if ("ref"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](("")); - output_buffer.$append("");}else if ("bibref"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](("[" + (self.target) + "]")); - output_buffer.$append("");}else {output_buffer.$append(""); - output_buffer['$append='](("" + (self.text) + "")); - output_buffer.$append("");}; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/inline_anchor") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this; - if (self.text == null) self.text = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer['$append=']((self.text)); - output_buffer.$append("
\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/inline_break") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this; - if (self.text == null) self.text = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - output_buffer['$append=']((self.text)); - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/inline_button") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$attr?', '$append=', '$icon_uri', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a; - if (self.document == null) self.document = nil; - if (self.text == null) self.text = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self.document['$attr?']("icons", "font")) !== false && $a !== nil) { - output_buffer.$append(""); - if (($a = (($b = self.type['$==']("icon")) ? (self.document['$attr?']("icons", "font")) : $b)) !== false && $a !== nil) { - style_class = ["icon-" + (self.target)]; - if (($a = self['$attr?']("size")) !== false && $a !== nil) { - style_class['$<<']("icon-" + (self.$attr("size")))}; - if (($a = self['$attr?']("rotate")) !== false && $a !== nil) { - style_class['$<<']("icon-rotate-" + (self.$attr("rotate")))}; - if (($a = self['$attr?']("flip")) !== false && $a !== nil) { - style_class['$<<']("icon-flip-" + (self.$attr("flip")))}; - title_attr = (function() {if (($a = (self['$attr?']("title"))) !== false && $a !== nil) { - return " title=\"" + (self.$attr("title")) + "\"" - } else { - return nil - }; return nil; })(); - img = ""; - } else if (($a = (($b = self.type['$==']("icon")) ? ($c = (self.document['$attr?']("icons")), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { - img = "[" + (self.$attr("alt")) + "]" - } else { - img_src = ((function() {if (self.type['$==']("icon")) { - return (self.$icon_uri(self.target)) - } else { - return (self.$image_uri(self.target)) - }; return nil; })()); - img_attrs = ($a = ($b = ["alt", "width", "height", "title"]).$map, $a._p = (TMP_2 = function(name){var self = TMP_2._s || this, $a;if (name == null) name = nil; - if (($a = (self['$attr?'](name))) !== false && $a !== nil) { - return " " + (name) + "=\"" + (self.$attr(name)) + "\"" + return "" + }; return nil; })()) + "
")}; + if ((($a = node['$attr?']("revdate")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("" + (node.$attr("revdate")) + "")}; + if ((($a = node['$attr?']("revremark")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("" + (br) + "" + (node.$attr("revremark")) + "")};}; + if ((($a = ($c = (node['$attr?']("toc")), $c !== false && $c !== nil ?(node['$attr?']("toc-placement", "auto")) : $c)) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
\n
" + (node.$attr("toc-title")) + "
\n" + (self.$outline(node)) + "\n
")}; + }; + result['$<<']("
"); + }; + result['$<<']("
\n" + (node.$content()) + "\n
"); + if ((($a = ($c = node['$footnotes?'](), $c !== false && $c !== nil ?(node['$attr?']("nofootnotes"))['$!']() : $c)) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
\n"); + ($a = ($c = node.$footnotes()).$each, $a._p = (TMP_2 = function(footnote){var self = TMP_2._s || this; +if (footnote == null) footnote = nil; + return result['$<<']("
\n" + (footnote.$index()) + ". " + (footnote.$text()) + "\n
")}, TMP_2._s = self, TMP_2), $a).call($c); + result['$<<']("
");}; + if ((($a = node.$nofooter()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + result['$<<']("
"); + result['$<<']("
"); + if ((($a = node['$attr?']("revnumber")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("" + (node.$attr("version-label")) + " " + (node.$attr("revnumber")) + (br))}; + if ((($a = node['$attr?']("last-update-label")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("" + (node.$attr("last-update-label")) + " " + (node.$attr("docdatetime")))}; + result['$<<']("
"); + if ((($a = ((docinfo_content = node.$docinfo("footer")))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + result['$<<'](docinfo_content) + }; + result['$<<']("
"); + }; + result['$<<'](""); + result['$<<'](""); + return result['$*']($scope.EOL); + }; + + def.$embedded = function(node) { + var $a, $b, TMP_3, self = this, result = nil, id_attr = nil; + + result = []; + if ((($a = ($b = node.$notitle()['$!'](), $b !== false && $b !== nil ?node['$has_header?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + id_attr = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + result['$<<']("" + (node.$header().$title()) + "");}; + result['$<<'](node.$content()); + if ((($a = ($b = node['$footnotes?'](), $b !== false && $b !== nil ?(node['$attr?']("nofootnotes"))['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
\n"); + ($a = ($b = node.$footnotes()).$each, $a._p = (TMP_3 = function(footnote){var self = TMP_3._s || this; +if (footnote == null) footnote = nil; + return result['$<<']("
\n" + (footnote.$index()) + " " + (footnote.$text()) + "\n
")}, TMP_3._s = self, TMP_3), $a).call($b); + result['$<<']("
");}; + return result['$*']($scope.EOL); + }; + + def.$outline = function(node, opts) { + var $a, $b, TMP_4, self = this, sections = nil, sectnumlevels = nil, toclevels = nil, result = nil, slevel = nil, first_section = nil; + + if (opts == null) { + opts = $hash2([], {}) + } + if ((($a = ((sections = node.$sections()))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + sectnumlevels = ((($a = opts['$[]']("sectnumlevels")) !== false && $a !== nil) ? $a : (node.$document().$attr("sectnumlevels", 3)).$to_i()); + toclevels = ((($a = opts['$[]']("toclevels")) !== false && $a !== nil) ? $a : (node.$document().$attr("toclevels", 2)).$to_i()); + result = []; + slevel = ((first_section = sections['$[]'](0))).$level(); + if ((($a = (($b = slevel['$=='](0)) ? first_section.$special() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + slevel = 1}; + result['$<<']("
    "); + ($a = ($b = sections).$each, $a._p = (TMP_4 = function(section){var self = TMP_4._s || this, $a, $b, $c, section_num = nil, child_toc_level = nil; +if (section == null) section = nil; + section_num = (function() {if ((($a = (($b = ($c = section.$numbered(), $c !== false && $c !== nil ?section.$caption()['$!']() : $c), $b !== false && $b !== nil ?section.$level()['$<='](sectnumlevels) : $b))) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (section.$sectnum()) + " " + } else { + return nil + }; return nil; })(); + result['$<<']("
  • " + (section_num) + (section.$captioned_title()) + "
  • "); + if ((($a = (($b = section.$level()['$<'](toclevels)) ? (child_toc_level = self.$outline(section, $hash2(["toclevels", "secnumlevels"], {"toclevels": toclevels, "secnumlevels": sectnumlevels}))) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
  • "); + result['$<<'](child_toc_level); + return result['$<<']("
  • "); + } else { + return nil + };}, TMP_4._s = self, TMP_4), $a).call($b); + result['$<<']("
"); + return result['$*']($scope.EOL); + }; + + def.$section = function(node) { + var $a, $b, $c, self = this, slevel = nil, htag = nil, id_attr = nil, anchor = nil, link_start = nil, link_end = nil, class_attr = nil, role = nil, sectnum = nil; + + slevel = node.$level(); + if ((($a = (($b = slevel['$=='](0)) ? node.$special() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + slevel = 1}; + htag = "h" + (slevel['$+'](1)); + id_attr = anchor = link_start = link_end = nil; + if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + id_attr = " id=\"" + (node.$id()) + "\""; + if ((($a = node.$document()['$attr?']("sectanchors")) !== nil && (!$a._isBoolean || $a == true))) { + anchor = "" + } else if ((($a = node.$document()['$attr?']("sectlinks")) !== nil && (!$a._isBoolean || $a == true))) { + link_start = ""; + link_end = "";};}; + if (slevel['$=='](0)) { + return "" + (anchor) + (link_start) + (node.$title()) + (link_end) + "\n" + (node.$content()) + } else { + class_attr = (function() {if ((($a = (role = node.$role())) !== nil && (!$a._isBoolean || $a == true))) { + return " class=\"sect" + (slevel) + " " + (role) + "\"" + } else { + return " class=\"sect" + (slevel) + "\"" + }; return nil; })(); + sectnum = (function() {if ((($a = ($b = ($c = node.$numbered(), $c !== false && $c !== nil ?node.$caption()['$!']() : $c), $b !== false && $b !== nil ?slevel['$<=']((node.$document().$attr("sectnumlevels", 3)).$to_i()) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (node.$sectnum()) + " " + } else { + return nil + }; return nil; })(); + return "\n<" + (htag) + (id_attr) + ">" + (anchor) + (link_start) + (sectnum) + (node.$captioned_title()) + (link_end) + "\n" + ((function() {if (slevel['$=='](1)) { + return "
\n" + (node.$content()) + "\n
" + } else { + return node.$content() + }; return nil; })()) + "\n
"; + }; + }; + + def.$admonition = function(node) { + var $a, self = this, id_attr = nil, name = nil, title_element = nil, caption = nil, role = nil; + + id_attr = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" } else { return nil - }}, TMP_2._s = self, TMP_2), $a).call($b).$join(); - img = ""; - }; - if (($a = self['$attr?']("link")) !== false && $a !== nil) { - output_buffer.$append(""); - output_buffer['$append=']((img)); - output_buffer.$append(""); - } else { - output_buffer.$append(""); - output_buffer['$append=']((img)); - output_buffer.$append(""); - }; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/inline_image") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$==', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this; - if (self.type == null) self.type = nil; - if (self.text == null) self.text = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - output_buffer['$append='](((function() {if (self.type['$==']("visible")) { - return self.text - } else { - return nil - }; return nil; })())); - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/inline_indexterm") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$attr', '$==', '$size', '$append=', '$first', '$map', '$+', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, TMP_2, keys = nil, idx = nil;if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - keys = self.$attr("keys"); - if (keys.$size()['$=='](1)) { - output_buffer.$append(""); - output_buffer['$append=']((keys.$first())); - output_buffer.$append(""); - } else { - output_buffer.$append(""); - idx = 0; - ($a = ($b = keys).$map, $a._p = (TMP_2 = function(key){var self = TMP_2._s || this;if (key == null) key = nil; - output_buffer.$append(""); - output_buffer['$append='](((function() {if (((idx = idx['$+'](1)))['$=='](1)) { + }; return nil; })(); + name = node.$attr("name"); + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$title()) + "
\n" + } else { return nil + }; return nil; })(); + caption = (function() {if ((($a = node.$document()['$attr?']("icons")) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = node.$document()['$attr?']("icons", "font")) !== nil && (!$a._isBoolean || $a == true))) { + return "" + } else { + return "\""" + } } else { - return "+" - }; return nil; })())); - output_buffer.$append(""); - output_buffer['$append=']((key)); - return output_buffer.$append("");}, TMP_2._s = self, TMP_2), $a).call($b); - output_buffer.$append("
"); - }; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/inline_kbd") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$attr', '$empty?', '$chop', '$join', '$map', '$append=', '$nil?']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, TMP_2, $c, menu = nil, submenus = nil, menuitem = nil, submenu_path = nil;if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - menu = self.$attr("menu"); - submenus = self.$attr("submenus"); - menuitem = self.$attr("menuitem"); - if (($a = ($b = submenus['$empty?'](), ($b === nil || $b === false))) !== false && $a !== nil) { - submenu_path = ($a = ($b = submenus).$map, $a._p = (TMP_2 = function(submenu){var self = TMP_2._s || this;if (submenu == null) submenu = nil; - return "" + (submenu) + " ▸ "}, TMP_2._s = self, TMP_2), $a).call($b).$join().$chop(); - output_buffer.$append(""); - output_buffer['$append=']((menu)); - output_buffer.$append(" ▸ "); - output_buffer['$append=']((submenu_path)); - output_buffer.$append(" "); - output_buffer['$append=']((menuitem)); - output_buffer.$append(""); - } else if (($a = ($c = menuitem['$nil?'](), ($c === nil || $c === false))) !== false && $a !== nil) { - output_buffer.$append(""); - output_buffer['$append=']((menu)); - output_buffer.$append(" ▸ "); - output_buffer['$append=']((menuitem)); - output_buffer.$append(""); - } else { - output_buffer.$append(""); - output_buffer['$append=']((menu)); - output_buffer.$append(""); - }; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/inline_menu") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$role', '$===', '$[]', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, class_attr = nil, style_class = nil, $case = nil, open = nil, close = nil; - if (self.id == null) self.id = nil; - if (self.type == null) self.type = nil; - if (self.text == null) self.text = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - output_buffer['$append=']((($a = self.id, $a !== false && $a !== nil ?"" : $a))); - output_buffer.$append(""); - class_attr = (function() {if (($a = (style_class = self.$role())) !== false && $a !== nil) { - return " class=\"" + (style_class) + "\"" - } else { - return nil - }; return nil; })(); - $case = self.type;if ("emphasis"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](("" + (self.text) + "")); - output_buffer.$append("");}else if ("strong"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](("" + (self.text) + "")); - output_buffer.$append("");}else if ("monospaced"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](("" + (self.text) + "")); - output_buffer.$append("");}else if ("superscript"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](("" + (self.text) + "")); - output_buffer.$append("");}else if ("subscript"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](("" + (self.text) + "")); - output_buffer.$append("");}else if ("double"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](((function() {if (class_attr !== false && class_attr !== nil) { - return "“" + (self.text) + "”" - } else { - return "“" + (self.text) + "”" - }; return nil; })())); - output_buffer.$append("");}else if ("single"['$===']($case)) {output_buffer.$append(""); - output_buffer['$append='](((function() {if (class_attr !== false && class_attr !== nil) { - return "‘" + (self.text) + "’" - } else { - return "‘" + (self.text) + "’" - }; return nil; })())); - output_buffer.$append("");}else if ("asciimath"['$===']($case) || "latexmath"['$===']($case)) {$a = $opal.to_ary(((($b = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $b))._scope.INLINE_MATH_DELIMITERS['$[]'](self.type)), open = ($a[0] == null ? nil : $a[0]), close = ($a[1] == null ? nil : $a[1]); - output_buffer.$append(""); - output_buffer['$append='](("" + (open) + (self.text) + (close))); - output_buffer.$append("");}else {output_buffer.$append(""); - output_buffer['$append='](((function() {if (class_attr !== false && class_attr !== nil) { - return "" + (self.text) + "" - } else { - return self.text - }; return nil; })())); - output_buffer.$append("");}; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/inline_quoted") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$zero?', '$attr?', '$append=', '$title', '$content', '$nil?', '$<=', '$to_i', '$attr', '$sectnum', '$+', '$*', '$compact', '$role', '$captioned_title', '$==', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, $c, slevel = nil, anchor = nil, link_start = nil, link_end = nil, snum = nil, hlevel = nil; - if (self.level == null) self.level = nil; - if (self.special == null) self.special = nil; - if (self.id == null) self.id = nil; - if (self.document == null) self.document = nil; - if (self.numbered == null) self.numbered = nil; - if (self.caption == null) self.caption = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - slevel = (function() {if (($a = ($b = self.level['$zero?'](), $b !== false && $b !== nil ?self.special : $b)) !== false && $a !== nil) { - return 1 - } else { - return self.level - }; return nil; })(); - anchor = link_start = link_end = nil; - if (($a = self.id) !== false && $a !== nil) { - if (($a = self.document['$attr?']("sectanchors")) !== false && $a !== nil) { - anchor = "" - } else if (($a = self.document['$attr?']("sectlinks")) !== false && $a !== nil) { - link_start = ""; - link_end = "";}}; - if (($a = slevel['$zero?']()) !== false && $a !== nil) { - output_buffer.$append("\n\n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
"); - } else { - output_buffer.$append("\n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append(""); + return "
" + (node.$caption()) + "
" + }; return nil; })(); + return "\n
"); - if (font_icons !== false && font_icons !== nil) { - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
    "); - ($a = ($b = self.$items()).$each, $a._p = (TMP_2 = function(questions, answer){var self = TMP_2._s || this, $a, $b, TMP_3;if (questions == null) questions = nil;if (answer == null) answer = nil; - output_buffer.$append("\n
  1. "); - ($a = ($b = [].concat(questions)).$each, $a._p = (TMP_3 = function(question){var self = TMP_3._s || this;if (question == null) question = nil; - output_buffer.$append("\n

    "); - output_buffer['$append=']((question.$text())); - return output_buffer.$append("

    ");}, TMP_3._s = self, TMP_3), $a).call($b); - if (($a = answer['$nil?']()) === false || $a === nil) { - if (($a = answer['$text?']()) !== false && $a !== nil) { - output_buffer.$append("\n

    "); - output_buffer['$append=']((answer.$text())); - output_buffer.$append("

    ");}; - if (($a = answer['$blocks?']()) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((self.$dd().$content())); - output_buffer.$append("");};}; - return output_buffer.$append("\n
  2. ");}, TMP_2._s = self, TMP_2), $a).call($b); - output_buffer.$append("\n
\n");}else if ("horizontal"['$===']($case)) {output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
");}; - output_buffer.$append("\n"); - if (($a = ((($c = (self['$attr?']("labelwidth"))) !== false && $c !== nil) ? $c : (self['$attr?']("itemwidth")))) !== false && $a !== nil) { - output_buffer.$append("\n\n\n\n");}; - ($a = ($c = self.$items()).$each, $a._p = (TMP_4 = function(terms, dd){var self = TMP_4._s || this, $a, $b, TMP_5, last_term = nil;if (terms == null) terms = nil;if (dd == null) dd = nil; - output_buffer.$append("\n\n\n\n");}, TMP_4._s = self, TMP_4), $a).call($c); - output_buffer.$append("\n
"); - terms = [].concat(terms); - last_term = terms.$last(); - ($a = ($b = terms).$each, $a._p = (TMP_5 = function(dt){var self = TMP_5._s || this, $a, $b;if (dt == null) dt = nil; - output_buffer.$append("\n"); - output_buffer['$append=']((dt.$text())); - output_buffer.$append(""); - if (($a = ($b = dt['$=='](last_term), ($b === nil || $b === false))) !== false && $a !== nil) { - return output_buffer.$append("\n
") + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $Html5Converter(){}; + var self = $Html5Converter = $klass($base, $super, 'Html5Converter', $Html5Converter); + + var def = self._proto, $scope = self._scope; + + def.xml_mode = def.void_element_slash = def.stylesheets = nil; + $opal.cdecl($scope, 'QUOTE_TAGS', $hash2(["emphasis", "strong", "monospaced", "superscript", "subscript", "double", "single", "asciimath", "latexmath"], {"emphasis": ["", "", true], "strong": ["", "", true], "monospaced": ["", "", true], "superscript": ["", "", true], "subscript": ["", "", true], "double": ["“", "”", false], "single": ["‘", "’", false], "asciimath": ["\\$", "\\$", false], "latexmath": ["\\(", "\\)", false]})); + + $scope.QUOTE_TAGS['$default=']([nil, nil, nil]); + + def.$initialize = function(backend, opts) { + var $a, self = this; + + if (opts == null) { + opts = $hash2([], {}) + } + self.xml_mode = opts['$[]']("htmlsyntax")['$==']("xml"); + self.void_element_slash = (function() {if ((($a = self.xml_mode) !== nil && (!$a._isBoolean || $a == true))) { + return "/" } else { return nil - };}, TMP_5._s = self, TMP_5), $a).call($b); - output_buffer.$append("\n
"); - if (($a = dd['$nil?']()) === false || $a === nil) { - if (($a = dd['$text?']()) !== false && $a !== nil) { - output_buffer.$append("\n

"); - output_buffer['$append=']((dd.$text())); - output_buffer.$append("

");}; - if (($a = dd['$blocks?']()) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((dd.$content())); - output_buffer.$append("");};}; - return output_buffer.$append("\n
\n");}else {output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
"); - ($a = ($d = self.$items()).$each, $a._p = (TMP_6 = function(terms, dd){var self = TMP_6._s || this, $a, $b, TMP_7;if (terms == null) terms = nil;if (dd == null) dd = nil; - ($a = ($b = [].concat(terms)).$each, $a._p = (TMP_7 = function(dt){var self = TMP_7._s || this, $a, $b; - if (self.style == null) self.style = nil; -if (dt == null) dt = nil; - output_buffer.$append("\n='](($scope.SafeMode)._scope.SECURE)) !== false && $a !== nil) ? $a : (node['$attr?']("linkcss"))); + result['$<<'](""); + lang_attribute = (function() {if ((($a = (node['$attr?']("nolang"))) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return " lang=\"" + (node.$attr("lang", "en")) + "\"" + }; return nil; })(); + result['$<<'](""); - output_buffer['$append=']((dt.$text())); - return output_buffer.$append("");}, TMP_7._s = self, TMP_7), $a).call($b); - if (($a = dd['$nil?']()) !== false && $a !== nil) { - return nil - } else { - output_buffer.$append("\n
"); - if (($a = dd['$text?']()) !== false && $a !== nil) { - output_buffer.$append("\n

"); - output_buffer['$append=']((dd.$text())); - output_buffer.$append("

");}; - if (($a = dd['$blocks?']()) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((dd.$content())); - output_buffer.$append("");}; - return output_buffer.$append("\n
"); - };}, TMP_6._s = self, TMP_6), $a).call($d); - output_buffer.$append("\n
\n");}; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_dlist") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$captioned_title', '$content', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a; - if (self.id == null) self.id = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$captioned_title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
\n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
\n\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_example") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$+', '$*', '$compact', '$role', '$title', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a; - if (self.level == null) self.level = nil; - if (self.id == null) self.id = nil; - if (self.style == null) self.style = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - output_buffer['$append='](("" + (self.$title()) + "")); - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_floating_title") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$attr?', '$attr', '$image_uri', '$title?', '$captioned_title', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b; - if (self.id == null) self.id = nil; - if (self.style == null) self.style = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append("\n
"); - if (($a = self['$attr?']("link")) !== false && $a !== nil) { - output_buffer.$append("\n"); - } else { - output_buffer.$append("\n"); - }; - output_buffer.$append("\n
"); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$captioned_title())); - output_buffer.$append("
");}; - output_buffer.$append("\n\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_image") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$captioned_title', '$attr?', '$option?', '$==', '$attr', '$===', '$<<', '$empty?', '$content', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, nowrap = nil, language = nil, code_class = nil, pre_class = nil, pre_lang = nil, $case = nil; - if (self.id == null) self.id = nil; - if (self.document == null) self.document = nil; - if (self.style == null) self.style = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$captioned_title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
"); - nowrap = ((($a = ($b = (self.document['$attr?']("prewrap")), ($b === nil || $b === false))) !== false && $a !== nil) ? $a : (self['$option?']("nowrap"))); - if (self.style['$==']("source")) { - language = self.$attr("language"); - code_class = (function() {if (language !== false && language !== nil) { - return [language, "language-" + (language)] - } else { - return [] - }; return nil; })(); - pre_class = ["highlight"]; - pre_lang = nil; - $case = self.$attr("source-highlighter");if ("coderay"['$===']($case)) {pre_class = ["CodeRay"]}else if ("pygments"['$===']($case)) {pre_class = ["pygments", "highlight"]}else if ("prettify"['$===']($case)) {pre_class = ["prettyprint"]; - if (($a = self['$attr?']("linenums")) !== false && $a !== nil) { - pre_class['$<<']("linenums")}; - if (language !== false && language !== nil) { - pre_class['$<<'](language)}; - if (language !== false && language !== nil) { - pre_class['$<<']("language-" + (language))}; - code_class = [];}else if ("html-pipeline"['$===']($case)) {pre_lang = language; - pre_class = code_class = []; - nowrap = false;}; - if (nowrap !== false && nowrap !== nil) { - pre_class['$<<']("nowrap")}; - output_buffer.$append("\n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append(""); - } else { - output_buffer.$append("\n"); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
\n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
\n
\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_literal") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$title', '$attr?', '$attr', '$list_marker_keyword', '$each', '$text', '$blocks?', '$content', '$items', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, TMP_2, keyword = nil; - if (self.id == null) self.id = nil; - if (self.style == null) self.style = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
");}; - output_buffer.$append("\n
    "); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
    "); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
    ");}; - output_buffer.$append("\n
    \n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
    \n"); - } - } else if (($a = (($b = self.style['$==']("partintro")) ? (((($c = ((($d = ($e = self.level['$=='](0), ($e === nil || $e === false))) !== false && $d !== nil) ? $d : ($e = self.parent.$context()['$==']("section"), ($e === nil || $e === false)))) !== false && $c !== nil) ? $c : ($d = self.document.$doctype()['$==']("book"), ($d === nil || $d === false)))) : $b)) !== false && $a !== nil) { - self.$puts("asciidoctor: ERROR: partintro block can only be used when doctype is book and it's a child of a book part. Excluding block content.") - } else { - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
    "); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
    ");}; - output_buffer.$append("\n
    \n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
    \n"); - }; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_open") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this;if (output_buffer == null) output_buffer = nil; - output_buffer.$append("
    \n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_page_break") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$title', '$content', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a; - if (self.id == null) self.id = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
    "); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
    ");}; - output_buffer.$append("\n

    "); - output_buffer['$append=']((self.$content())); - output_buffer.$append("

    \n\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_paragraph") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$content', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this;if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_pass") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$content', '$attr?', '$attr', '$outline', '$to_i', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b; - if (self.document == null) self.document = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append("
    \n
    \n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
    "); - if (($a = ($b = (self['$attr?']("toc")), $b !== false && $b !== nil ?(self['$attr?']("toc-placement", "preamble")) : $b)) !== false && $a !== nil) { - output_buffer.$append("\n
    ");}; - output_buffer.$append("\n
    \n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_preamble") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$title', '$content', '$attr?', '$attr', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b; - if (self.id == null) self.id = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
    "); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
    ");}; - output_buffer.$append("\n
    \n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
    "); - if (($a = ((($b = (self['$attr?']("attribution"))) !== false && $b !== nil) ? $b : (self['$attr?']("citetitle")))) !== false && $a !== nil) { - output_buffer.$append("\n
    "); - if (($a = self['$attr?']("citetitle")) !== false && $a !== nil) { - output_buffer.$append("\n"); - output_buffer['$append=']((self.$attr("citetitle"))); - output_buffer.$append("");}; - if (($a = self['$attr?']("attribution")) !== false && $a !== nil) { - if (($a = self['$attr?']("citetitle")) !== false && $a !== nil) { - output_buffer.$append("
    ")}; - output_buffer.$append("\n"); - output_buffer['$append='](("— " + (self.$attr("attribution")))); - output_buffer.$append("");}; - output_buffer.$append("\n
    ");}; - output_buffer.$append("\n
    \n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_quote") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this;if (output_buffer == null) output_buffer = nil; - output_buffer.$append("
    \n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_ruler") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$role', '$title?', '$title', '$content', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a; - if (self.id == null) self.id = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append("\n
    "); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
    "); - output_buffer['$append=']((self.$title())); - output_buffer.$append("
    ");}; - output_buffer.$append("\n"); - output_buffer['$append=']((self.$content())); - output_buffer.$append("\n
    \n\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_sidebar") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var $a, $b, TMP_1, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.add_stubs(['$new', '$append', '$append=', '$*', '$compact', '$attr', '$role', '$attr?', '$option?', '$title?', '$captioned_title', '$zero?', '$times', '$size', '$each', '$==', '$text', '$style', '$===', '$content', '$colspan', '$rowspan', '$[]', '$select', '$empty?', '$join']); - return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, $c, TMP_2, TMP_3, $d, TMP_4, $e, $f, TMP_9; - if (self.id == null) self.id = nil; - if (self.columns == null) self.columns = nil; -if (output_buffer == null) output_buffer = nil; - output_buffer.$append(""); - output_buffer.$append(""); - if (($a = self['$title?']()) !== false && $a !== nil) { - output_buffer.$append("\n
"); - output_buffer['$append=']((self.$captioned_title())); - output_buffer.$append("
\n\n\n\n\n
\n" + (caption) + "\n\n" + (title_element) + (node.$content()) + "\n
\n
"; + }; + + def.$audio = function(node) { + var $a, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil; + + xml = node.$document()['$attr?']("htmlsyntax", "xml"); + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = ["audioblock", node.$style(), node.$role()].$compact(); + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$captioned_title()) + "
\n" + } else { + return nil + }; return nil; })(); + return "\n" + (title_element) + "
\n\n
\n
"; + }; + + def.$colist = function(node) { + var $a, $b, TMP_5, $c, TMP_6, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil; + + result = []; + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = ["colist", node.$style(), node.$role()].$compact(); + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + result['$<<'](""); + if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
" + (node.$title()) + "
")}; + if ((($a = node.$document()['$attr?']("icons")) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<'](""); + font_icons = node.$document()['$attr?']("icons", "font"); + ($a = ($b = node.$items()).$each_with_index, $a._p = (TMP_5 = function(item, i){var self = TMP_5._s || this, num = nil, num_element = nil; + if (self.void_element_slash == null) self.void_element_slash = nil; +if (item == null) item = nil;if (i == null) i = nil; + num = i['$+'](1); + num_element = (function() {if (font_icons !== false && font_icons !== nil) { + return "" + (num) + "" + } else { + return "\""" + }; return nil; })(); + return result['$<<']("\n\n\n");}, TMP_5._s = self, TMP_5), $a).call($b); + result['$<<']("
" + (num_element) + "" + (item.$text()) + "
"); + } else { + result['$<<']("
    "); + ($a = ($c = node.$items()).$each, $a._p = (TMP_6 = function(item){var self = TMP_6._s || this; +if (item == null) item = nil; + return result['$<<']("
  1. \n

    " + (item.$text()) + "

    \n
  2. ")}, TMP_6._s = self, TMP_6), $a).call($c); + result['$<<']("
"); + }; + result['$<<'](""); + return result['$*']($scope.EOL); + }; + + def.$dlist = function(node) { + var $a, $b, TMP_7, $c, TMP_9, $d, TMP_11, self = this, result = nil, id_attribute = nil, classes = nil, $case = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil; + + result = []; + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = (function() {$case = node.$style();if ("qanda"['$===']($case)) {return ["qlist", "qanda", node.$role()]}else if ("horizontal"['$===']($case)) {return ["hdlist", node.$role()]}else {return ["dlist", node.$style(), node.$role()]}})().$compact(); + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + result['$<<'](""); + if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
" + (node.$title()) + "
")}; + $case = node.$style();if ("qanda"['$===']($case)) {result['$<<']("
    "); + ($a = ($b = node.$items()).$each, $a._p = (TMP_7 = function(terms, dd){var self = TMP_7._s || this, $a, $b, TMP_8; +if (terms == null) terms = nil;if (dd == null) dd = nil; + result['$<<']("
  1. "); + ($a = ($b = [].concat(terms)).$each, $a._p = (TMP_8 = function(dt){var self = TMP_8._s || this; +if (dt == null) dt = nil; + return result['$<<']("

    " + (dt.$text()) + "

    ")}, TMP_8._s = self, TMP_8), $a).call($b); + if (dd !== false && dd !== nil) { + if ((($a = dd['$text?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("

    " + (dd.$text()) + "

    ")}; + if ((($a = dd['$blocks?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<'](dd.$content())};}; + return result['$<<']("
  2. ");}, TMP_7._s = self, TMP_7), $a).call($b); + result['$<<']("
");}else if ("horizontal"['$===']($case)) {slash = self.void_element_slash; + result['$<<'](""); + if ((($a = ((($c = (node['$attr?']("labelwidth"))) !== false && $c !== nil) ? $c : (node['$attr?']("itemwidth")))) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<'](""); + col_style_attribute = (function() {if ((($a = (node['$attr?']("labelwidth"))) !== nil && (!$a._isBoolean || $a == true))) { + return " style=\"width: " + ((node.$attr("labelwidth")).$chomp("%")) + "%;\"" + } else { + return nil + }; return nil; })(); + result['$<<'](""); + col_style_attribute = (function() {if ((($a = (node['$attr?']("itemwidth"))) !== nil && (!$a._isBoolean || $a == true))) { + return " style=\"width: " + ((node.$attr("itemwidth")).$chomp("%")) + "%;\"" + } else { + return nil + }; return nil; })(); + result['$<<'](""); + result['$<<']("");}; + ($a = ($c = node.$items()).$each, $a._p = (TMP_9 = function(terms, dd){var self = TMP_9._s || this, $a, $b, TMP_10, terms_array = nil, last_term = nil; +if (terms == null) terms = nil;if (dd == null) dd = nil; + result['$<<'](""); + result['$<<'](""); + result['$<<'](""); + return result['$<<']("");}, TMP_9._s = self, TMP_9), $a).call($c); + result['$<<']("
"); + terms_array = [].concat(terms); + last_term = terms_array['$[]'](-1); + ($a = ($b = terms_array).$each, $a._p = (TMP_10 = function(dt){var self = TMP_10._s || this, $a; +if (dt == null) dt = nil; + result['$<<'](dt.$text()); + if ((($a = dt['$=='](last_term)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return result['$<<']("") + } else { + return nil + };}, TMP_10._s = self, TMP_10), $a).call($b); + result['$<<'](""); + if (dd !== false && dd !== nil) { + if ((($a = dd['$text?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("

" + (dd.$text()) + "

")}; + if ((($a = dd['$blocks?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<'](dd.$content())};}; + result['$<<']("
");}else {result['$<<']("
"); + dt_style_attribute = (function() {if ((($a = node.$style()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return " class=\"hdlist1\"" + }; return nil; })(); + ($a = ($d = node.$items()).$each, $a._p = (TMP_11 = function(terms, dd){var self = TMP_11._s || this, $a, $b, TMP_12; +if (terms == null) terms = nil;if (dd == null) dd = nil; + ($a = ($b = [].concat(terms)).$each, $a._p = (TMP_12 = function(dt){var self = TMP_12._s || this; +if (dt == null) dt = nil; + return result['$<<']("" + (dt.$text()) + "")}, TMP_12._s = self, TMP_12), $a).call($b); + if (dd !== false && dd !== nil) { + result['$<<']("
"); + if ((($a = dd['$text?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("

" + (dd.$text()) + "

")}; + if ((($a = dd['$blocks?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<'](dd.$content())}; + return result['$<<']("
"); + } else { + return nil + };}, TMP_11._s = self, TMP_11), $a).call($d); + result['$<<']("
");}; + result['$<<'](""); + return result['$*']($scope.EOL); + }; + + def.$example = function(node) { + var $a, self = this, id_attribute = nil, title_element = nil, role = nil; + + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$captioned_title()) + "
\n" + } else { + return nil + }; return nil; })(); + return "\n" + (title_element) + "
\n" + (node.$content()) + "\n
\n"; + }; + + def.$floating_title = function(node) { + var $a, self = this, tag_name = nil, id_attribute = nil, classes = nil; + + tag_name = "h" + (node.$level()['$+'](1)); + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = [node.$style(), node.$role()].$compact(); + return "<" + (tag_name) + (id_attribute) + " class=\"" + (classes['$*'](" ")) + "\">" + (node.$title()) + ""; + }; + + def.$image = function(node) { + var $a, $b, self = this, align = nil, float$ = nil, style_attribute = nil, styles = nil, width_attribute = nil, height_attribute = nil, img_element = nil, link = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil; + + align = (function() {if ((($a = (node['$attr?']("align"))) !== nil && (!$a._isBoolean || $a == true))) { + return (node.$attr("align")) + } else { + return nil + }; return nil; })(); + float$ = (function() {if ((($a = (node['$attr?']("float"))) !== nil && (!$a._isBoolean || $a == true))) { + return (node.$attr("float")) + } else { + return nil + }; return nil; })(); + style_attribute = (function() {if ((($a = ((($b = align) !== false && $b !== nil) ? $b : float$)) !== nil && (!$a._isBoolean || $a == true))) { + styles = [(function() {if (align !== false && align !== nil) { + return "text-align: " + (align) + } else { + return nil + }; return nil; })(), (function() {if (float$ !== false && float$ !== nil) { + return "float: " + (float$) + } else { + return nil + }; return nil; })()].$compact(); + return " style=\"" + (styles['$*'](";")) + "\""; + } else { + return nil + }; return nil; })(); + width_attribute = (function() {if ((($a = (node['$attr?']("width"))) !== nil && (!$a._isBoolean || $a == true))) { + return " width=\"" + (node.$attr("width")) + "\"" + } else { + return nil + }; return nil; })(); + height_attribute = (function() {if ((($a = (node['$attr?']("height"))) !== nil && (!$a._isBoolean || $a == true))) { + return " height=\"" + (node.$attr("height")) + "\"" + } else { + return nil + }; return nil; })(); + img_element = "\"""; + if ((($a = (link = node.$attr("link"))) !== nil && (!$a._isBoolean || $a == true))) { + img_element = "" + (img_element) + ""}; + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = ["imageblock", node.$style(), node.$role()].$compact(); + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "\n
" + (node.$captioned_title()) + "
" + } else { + return nil + }; return nil; })(); + return "\n
\n" + (img_element) + "\n
" + (title_element) + "\n"; + }; + + def.$listing = function(node) { + var $a, self = this, nowrap = nil, language = nil, language_classes = nil, $case = nil, pre_class = nil, code_class = nil, pre_start = nil, pre_end = nil, id_attribute = nil, title_element = nil, role = nil; + + nowrap = ((($a = (node.$document()['$attr?']("prewrap"))['$!']()) !== false && $a !== nil) ? $a : (node['$option?']("nowrap"))); + if (node.$style()['$==']("source")) { + language = node.$attr("language"); + language_classes = (function() {if (language !== false && language !== nil) { + return "" + (language) + " language-" + (language) + } else { + return nil + }; return nil; })(); + $case = node.$attr("source-highlighter");if ("coderay"['$===']($case)) {pre_class = (function() {if (nowrap !== false && nowrap !== nil) { + return " class=\"CodeRay nowrap\"" + } else { + return " class=\"CodeRay\"" + }; return nil; })(); + code_class = (function() {if (language !== false && language !== nil) { + return " class=\"" + (language_classes) + "\"" + } else { + return nil + }; return nil; })();}else if ("pygments"['$===']($case)) {pre_class = (function() {if (nowrap !== false && nowrap !== nil) { + return " class=\"pygments highlight nowrap\"" + } else { + return " class=\"pygments highlight\"" + }; return nil; })(); + code_class = (function() {if (language !== false && language !== nil) { + return " class=\"" + (language_classes) + "\"" + } else { + return nil + }; return nil; })();}else if ("highlightjs"['$===']($case) || "highlight.js"['$===']($case)) {pre_class = (function() {if (nowrap !== false && nowrap !== nil) { + return " class=\"highlight nowrap\"" + } else { + return " class=\"highlight\"" + }; return nil; })(); + code_class = (function() {if (language !== false && language !== nil) { + return " class=\"" + (language_classes) + "\"" + } else { + return nil + }; return nil; })();}else if ("prettify"['$===']($case)) {pre_class = " class=\"prettyprint" + ((function() {if (nowrap !== false && nowrap !== nil) { + return " nowrap" + } else { + return nil + }; return nil; })()) + ((function() {if ((($a = (node['$attr?']("linenums"))) !== nil && (!$a._isBoolean || $a == true))) { + return " linenums" + } else { + return nil + }; return nil; })()) + "\""; + code_class = (function() {if (language !== false && language !== nil) { + return " class=\"" + (language_classes) + "\"" + } else { + return nil + }; return nil; })();}else if ("html-pipeline"['$===']($case)) {pre_class = (function() {if (language !== false && language !== nil) { + return " lang=\"" + (language) + "\"" + } else { + return nil + }; return nil; })(); + code_class = nil;}else {pre_class = (function() {if (nowrap !== false && nowrap !== nil) { + return " class=\"highlight nowrap\"" + } else { + return " class=\"highlight\"" + }; return nil; })(); + code_class = (function() {if (language !== false && language !== nil) { + return " class=\"" + (language_classes) + "\"" + } else { + return nil + }; return nil; })();}; + pre_start = ""; + pre_end = ""; + } else { + pre_start = ""; + pre_end = ""; + }; + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$captioned_title()) + "
\n" + } else { + return nil + }; return nil; })(); + return "\n" + (title_element) + "
\n" + (pre_start) + (node.$content()) + (pre_end) + "\n
\n"; + }; + + def.$literal = function(node) { + var $a, self = this, id_attribute = nil, title_element = nil, nowrap = nil, role = nil; + + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$title()) + "
\n" + } else { + return nil + }; return nil; })(); + nowrap = ((($a = (node.$document()['$attr?']("prewrap"))['$!']()) !== false && $a !== nil) ? $a : (node['$option?']("nowrap"))); + return "\n" + (title_element) + "
\n" + (node.$content()) + "\n
\n"; + }; + + def.$math = function(node) { + var $a, $b, self = this, id_attribute = nil, title_element = nil, open = nil, close = nil, equation = nil, role = nil; + + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$title()) + "
\n" + } else { + return nil + }; return nil; })(); + $a = $opal.to_ary($scope.BLOCK_MATH_DELIMITERS['$[]'](node.$style().$to_sym())), open = ($a[0] == null ? nil : $a[0]), close = ($a[1] == null ? nil : $a[1]); + equation = node.$content().$strip(); + if ((($a = ($b = node.$subs()['$nil_or_empty?'](), $b !== false && $b !== nil ?(node['$attr?']("subs"))['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + equation = node.$sub_specialcharacters(equation)}; + if ((($a = ($b = (equation['$start_with?'](open)), $b !== false && $b !== nil ?(equation['$end_with?'](close)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + equation = "" + (open) + (equation) + (close) + }; + return "\n" + (title_element) + "
\n" + (equation) + "\n
\n"; + }; + + def.$olist = function(node) { + var $a, $b, TMP_13, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil; + + result = []; + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = ["olist", node.$style(), node.$role()].$compact(); + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + result['$<<'](""); + if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
" + (node.$title()) + "
")}; + type_attribute = (function() {if ((($a = (keyword = node.$list_marker_keyword())) !== nil && (!$a._isBoolean || $a == true))) { + return " type=\"" + (keyword) + "\"" + } else { + return nil + }; return nil; })(); + start_attribute = (function() {if ((($a = (node['$attr?']("start"))) !== nil && (!$a._isBoolean || $a == true))) { + return " start=\"" + (node.$attr("start")) + "\"" + } else { + return nil + }; return nil; })(); + result['$<<']("
    "); + ($a = ($b = node.$items()).$each, $a._p = (TMP_13 = function(item){var self = TMP_13._s || this, $a; +if (item == null) item = nil; + result['$<<']("
  1. "); + result['$<<']("

    " + (item.$text()) + "

    "); + if ((($a = item['$blocks?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<'](item.$content())}; + return result['$<<']("
  2. ");}, TMP_13._s = self, TMP_13), $a).call($b); + result['$<<']("
"); + result['$<<'](""); + return result['$*']($scope.EOL); + }; + + def.$open = function(node) { + var $a, $b, $c, $d, self = this, style = nil, id_attr = nil, title_el = nil, role = nil; + + if (((style = node.$style()))['$==']("abstract")) { + if ((($a = (($b = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.$warn("asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. Excluding block content."); + return ""; + } else { + id_attr = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + title_el = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$title()) + "
" + } else { + return nil + }; return nil; })(); + return "\n" + (title_el) + "
\n" + (node.$content()) + "\n
\n"; + } + } else if ((($a = (($b = style['$==']("partintro")) ? (((($c = ((($d = node.$level()['$=='](0)['$!']()) !== false && $d !== nil) ? $d : node.$parent().$context()['$==']("section")['$!']())) !== false && $c !== nil) ? $c : node.$document().$doctype()['$==']("book")['$!']())) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.$warn("asciidoctor: ERROR: partintro block can only be used when doctype is book and it's a child of a book part. Excluding block content."); + return ""; + } else { + id_attr = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + title_el = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$title()) + "
" + } else { + return nil + }; return nil; })(); + return "\n" + (title_el) + "
\n" + (node.$content()) + "\n
\n"; + }; + }; + + def.$page_break = function(node) { + var self = this; + + return "
"; + }; + + def.$paragraph = function(node) { + var $a, self = this, attributes = nil; + + attributes = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = node.$role()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\" class=\"paragraph " + (node.$role()) + "\"" + } else { + return " id=\"" + (node.$id()) + "\" class=\"paragraph\"" + } + } else if ((($a = node.$role()) !== nil && (!$a._isBoolean || $a == true))) { + return " class=\"paragraph " + (node.$role()) + "\"" + } else { + return " class=\"paragraph\"" + }; return nil; })(); + if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "\n
" + (node.$title()) + "
\n

" + (node.$content()) + "

\n" + } else { + return "\n

" + (node.$content()) + "

\n" + }; + }; + + def.$preamble = function(node) { + var $a, $b, self = this, toc = nil; + + toc = (function() {if ((($a = ($b = (node['$attr?']("toc")), $b !== false && $b !== nil ?(node['$attr?']("toc-placement", "preamble")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return "\n
\n
" + (node.$attr("toc-title")) + "
\n" + (self.$outline(node.$document())) + "\n
" + } else { + return nil + }; return nil; })(); + return "
\n
\n" + (node.$content()) + "\n
" + (toc) + "\n
"; + }; + + def.$quote = function(node) { + var $a, $b, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = ["quoteblock", node.$role()].$compact(); + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "\n
" + (node.$title()) + "
" + } else { + return nil + }; return nil; })(); + attribution = (function() {if ((($a = (node['$attr?']("attribution"))) !== nil && (!$a._isBoolean || $a == true))) { + return (node.$attr("attribution")) + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ((($a = (node['$attr?']("citetitle"))) !== nil && (!$a._isBoolean || $a == true))) { + return (node.$attr("citetitle")) + } else { + return nil + }; return nil; })(); + if ((($a = ((($b = attribution) !== false && $b !== nil) ? $b : citetitle)) !== nil && (!$a._isBoolean || $a == true))) { + cite_element = (function() {if (citetitle !== false && citetitle !== nil) { + return "" + (citetitle) + "" + } else { + return nil + }; return nil; })(); + attribution_text = (function() {if (attribution !== false && attribution !== nil) { + return "" + ((function() {if (citetitle !== false && citetitle !== nil) { + return "\n" + } else { + return nil + }; return nil; })()) + "— " + (attribution) + } else { + return nil + }; return nil; })(); + attribution_element = "\n
\n" + (cite_element) + (attribution_text) + "\n
"; + } else { + attribution_element = nil + }; + return "" + (title_element) + "\n
\n" + (node.$content()) + "\n
" + (attribution_element) + "\n"; + }; + + def.$thematic_break = function(node) { + var self = this; + + return ""; + }; + + def.$sidebar = function(node) { + var $a, self = this, id_attribute = nil, title_element = nil, role = nil; + + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "
" + (node.$title()) + "
\n" + } else { + return nil + }; return nil; })(); + return "\n
\n" + (title_element) + (node.$content()) + "\n
\n"; + }; + + def.$table = function(node) { + var $a, $b, TMP_14, $c, TMP_15, $d, TMP_16, $e, $f, TMP_20, self = this, result = nil, id_attribute = nil, classes = nil, role_class = nil, class_attribute = nil, styles = nil, style_attribute = nil, slash = nil, tag = nil; + + result = []; + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = ["tableblock", "frame-" + (node.$attr("frame", "all")), "grid-" + (node.$attr("grid", "all"))]; + if ((($a = (role_class = node.$role())) !== nil && (!$a._isBoolean || $a == true))) { + classes['$<<'](role_class)}; + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + styles = [(function() {if ((($a = (node['$option?']("autowidth"))) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return "width: " + (node.$attr("tablepcwidth")) + "%;" + }; return nil; })(), (function() {if ((($a = (node['$attr?']("float"))) !== nil && (!$a._isBoolean || $a == true))) { + return "float: " + (node.$attr("float")) + ";" + } else { + return nil + }; return nil; })()].$compact(); + style_attribute = (function() {if (styles.$size()['$>'](0)) { + return " style=\"" + (styles['$*'](" ")) + "\"" + } else { + return nil + }; return nil; })(); + result['$<<'](""); + if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("" + (node.$captioned_title()) + "")}; + if ((node.$attr("rowcount"))['$>'](0)) { + slash = self.void_element_slash; + result['$<<'](""); + if ((($a = node['$option?']("autowidth")) !== nil && (!$a._isBoolean || $a == true))) { + tag = ""; + ($a = ($b = node.$columns().$size()).$times, $a._p = (TMP_14 = function(){var self = TMP_14._s || this; + + return result['$<<'](tag)}, TMP_14._s = self, TMP_14), $a).call($b); + } else { + ($a = ($c = node.$columns()).$each, $a._p = (TMP_15 = function(col){var self = TMP_15._s || this; +if (col == null) col = nil; + return result['$<<']("")}, TMP_15._s = self, TMP_15), $a).call($c) + }; + result['$<<'](""); + ($a = ($d = ($e = ($f = ["head", "foot", "body"]).$select, $e._p = (TMP_20 = function(tsec){var self = TMP_20._s || this; +if (tsec == null) tsec = nil; + return node.$rows()['$[]'](tsec)['$empty?']()['$!']()}, TMP_20._s = self, TMP_20), $e).call($f)).$each, $a._p = (TMP_16 = function(tsec){var self = TMP_16._s || this, $a, $b, TMP_17; +if (tsec == null) tsec = nil; + result['$<<'](""); + ($a = ($b = node.$rows()['$[]'](tsec)).$each, $a._p = (TMP_17 = function(row){var self = TMP_17._s || this, $a, $b, TMP_18; +if (row == null) row = nil; + result['$<<'](""); + ($a = ($b = row).$each, $a._p = (TMP_18 = function(cell){var self = TMP_18._s || this, $a, $b, TMP_19, $c, cell_content = nil, $case = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil; +if (cell == null) cell = nil; + if (tsec['$==']("head")) { + cell_content = cell.$text() + } else { + $case = cell.$style();if ("asciidoc"['$===']($case)) {cell_content = "
" + (cell.$content()) + "
"}else if ("verse"['$===']($case)) {cell_content = "
" + (cell.$text()) + "
"}else if ("literal"['$===']($case)) {cell_content = "
" + (cell.$text()) + "
"}else {cell_content = ""; + ($a = ($b = cell.$content()).$each, $a._p = (TMP_19 = function(text){var self = TMP_19._s || this; +if (text == null) text = nil; + return cell_content = "" + (cell_content) + "

" + (text) + "

"}, TMP_19._s = self, TMP_19), $a).call($b);} + }; + cell_tag_name = ((function() {if ((($a = ((($c = tsec['$==']("head")) !== false && $c !== nil) ? $c : cell.$style()['$==']("header"))) !== nil && (!$a._isBoolean || $a == true))) { + return "th" + } else { + return "td" + }; return nil; })()); + cell_class_attribute = " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\""; + cell_colspan_attribute = (function() {if ((($a = cell.$colspan()) !== nil && (!$a._isBoolean || $a == true))) { + return " colspan=\"" + (cell.$colspan()) + "\"" + } else { + return nil + }; return nil; })(); + cell_rowspan_attribute = (function() {if ((($a = cell.$rowspan()) !== nil && (!$a._isBoolean || $a == true))) { + return " rowspan=\"" + (cell.$rowspan()) + "\"" + } else { + return nil + }; return nil; })(); + cell_style_attribute = (function() {if ((($a = (node.$document()['$attr?']("cellbgcolor"))) !== nil && (!$a._isBoolean || $a == true))) { + return " style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\"" + } else { + return nil + }; return nil; })(); + return result['$<<']("<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "");}, TMP_18._s = self, TMP_18), $a).call($b); + return result['$<<']("");}, TMP_17._s = self, TMP_17), $a).call($b); + return result['$<<']("
");}, TMP_16._s = self, TMP_16), $a).call($d);}; + result['$<<'](""); + return result['$*']($scope.EOL); + }; + + def.$toc = function(node) { + var $a, $b, self = this, doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil; + + if ((($a = ((doc = node.$document()))['$attr?']("toc")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return "" + }; + if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + id_attr = " id=\"" + (node.$id()) + "\""; + title_id_attr = ""; + } else if ((($a = ((($b = doc['$embedded?']()) !== false && $b !== nil) ? $b : (doc['$attr?']("toc-placement"))['$!']())) !== nil && (!$a._isBoolean || $a == true))) { + id_attr = " id=\"toc\""; + title_id_attr = " id=\"toctitle\""; + } else { + id_attr = nil; + title_id_attr = nil; + }; + title = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return node.$title() + } else { + return (doc.$attr("toc-title")) + }; return nil; })(); + levels = (function() {if ((($a = (node['$attr?']("levels"))) !== nil && (!$a._isBoolean || $a == true))) { + return (node.$attr("levels")).$to_i() + } else { + return nil + }; return nil; })(); + role = (function() {if ((($a = node['$role?']()) !== nil && (!$a._isBoolean || $a == true))) { + return node.$role() + } else { + return (doc.$attr("toc-class", "toc")) + }; return nil; })(); + return "\n" + (title) + "\n" + (self.$outline(doc, $hash2(["toclevels"], {"toclevels": levels}))) + "\n"; + }; + + def.$ulist = function(node) { + var $a, $b, TMP_21, self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil; + + result = []; + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + div_classes = ["ulist", node.$style(), node.$role()].$compact(); + marker_checked = nil; + marker_unchecked = nil; + if ((($a = (checklist = node['$option?']("checklist"))) !== nil && (!$a._isBoolean || $a == true))) { + div_classes.$insert(1, "checklist"); + ul_class_attribute = " class=\"checklist\""; + if ((($a = node['$option?']("interactive")) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = node.$document()['$attr?']("htmlsyntax", "xml")) !== nil && (!$a._isBoolean || $a == true))) { + marker_checked = " "; + marker_unchecked = " "; + } else { + marker_checked = " "; + marker_unchecked = " "; + } + } else if ((($a = node.$document()['$attr?']("icons", "font")) !== nil && (!$a._isBoolean || $a == true))) { + marker_checked = " "; + marker_unchecked = " "; + } else { + marker_checked = "✓ "; + marker_unchecked = "❏ "; + }; + } else { + ul_class_attribute = (function() {if ((($a = node.$style()) !== nil && (!$a._isBoolean || $a == true))) { + return " class=\"" + (node.$style()) + "\"" + } else { + return nil + }; return nil; })() + }; + result['$<<'](""); + if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("
" + (node.$title()) + "
")}; + result['$<<'](""); + ($a = ($b = node.$items()).$each, $a._p = (TMP_21 = function(item){var self = TMP_21._s || this, $a, $b; +if (item == null) item = nil; + result['$<<']("
  • "); + if ((($a = (($b = checklist !== false && checklist !== nil) ? (item['$attr?']("checkbox")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<']("

    " + ((function() {if ((($a = (item['$attr?']("checked"))) !== nil && (!$a._isBoolean || $a == true))) { + return marker_checked + } else { + return marker_unchecked + }; return nil; })()) + (item.$text()) + "

    ") + } else { + result['$<<']("

    " + (item.$text()) + "

    ") + }; + if ((($a = item['$blocks?']()) !== nil && (!$a._isBoolean || $a == true))) { + result['$<<'](item.$content())}; + return result['$<<']("
  • ");}, TMP_21._s = self, TMP_21), $a).call($b); + result['$<<'](""); + result['$<<'](""); + return result['$*']($scope.EOL); + }; + + def.$verse = function(node) { + var $a, $b, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil; + + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = ["verseblock", node.$role()].$compact(); + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "\n
    " + (node.$title()) + "
    " + } else { + return nil + }; return nil; })(); + attribution = (function() {if ((($a = (node['$attr?']("attribution"))) !== nil && (!$a._isBoolean || $a == true))) { + return (node.$attr("attribution")) + } else { + return nil + }; return nil; })(); + citetitle = (function() {if ((($a = (node['$attr?']("citetitle"))) !== nil && (!$a._isBoolean || $a == true))) { + return (node.$attr("citetitle")) + } else { + return nil + }; return nil; })(); + if ((($a = ((($b = attribution) !== false && $b !== nil) ? $b : citetitle)) !== nil && (!$a._isBoolean || $a == true))) { + cite_element = (function() {if (citetitle !== false && citetitle !== nil) { + return "" + (citetitle) + "" + } else { + return nil + }; return nil; })(); + attribution_text = (function() {if (attribution !== false && attribution !== nil) { + return "" + ((function() {if (citetitle !== false && citetitle !== nil) { + return "\n" + } else { + return nil + }; return nil; })()) + "— " + (attribution) + } else { + return nil + }; return nil; })(); + attribution_element = "\n
    \n" + (cite_element) + (attribution_text) + "\n
    "; + } else { + attribution_element = nil + }; + return "" + (title_element) + "\n
    " + (node.$content()) + "
    " + (attribution_element) + "\n"; + }; + + def.$video = function(node) { + var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, $case = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, start_param = nil, end_param = nil, controls_param = nil, poster_attribute = nil, poster = nil, time_anchor = nil; + + xml = node.$document()['$attr?']("htmlsyntax", "xml"); + id_attribute = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + classes = ["videoblock", node.$style(), node.$role()].$compact(); + class_attribute = " class=\"" + (classes['$*'](" ")) + "\""; + title_element = (function() {if ((($a = node['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "\n
    " + (node.$captioned_title()) + "
    " + } else { + return nil + }; return nil; })(); + width_attribute = (function() {if ((($a = (node['$attr?']("width"))) !== nil && (!$a._isBoolean || $a == true))) { + return " width=\"" + (node.$attr("width")) + "\"" + } else { + return nil + }; return nil; })(); + height_attribute = (function() {if ((($a = (node['$attr?']("height"))) !== nil && (!$a._isBoolean || $a == true))) { + return " height=\"" + (node.$attr("height")) + "\"" + } else { + return nil + }; return nil; })(); + return (function() {$case = node.$attr("poster");if ("vimeo"['$===']($case)) {start_anchor = (function() {if ((($a = (node['$attr?']("start"))) !== nil && (!$a._isBoolean || $a == true))) { + return "#at=" + (node.$attr("start")) + } else { + return nil + }; return nil; })(); + delimiter = "?"; + autoplay_param = (function() {if ((($a = (node['$option?']("autoplay"))) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (delimiter) + "autoplay=1" + } else { + return nil + }; return nil; })(); + if (autoplay_param !== false && autoplay_param !== nil) { + delimiter = "&"}; + loop_param = (function() {if ((($a = (node['$option?']("loop"))) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (delimiter) + "loop=1" + } else { + return nil + }; return nil; })(); + return "" + (title_element) + "\n
    \n\n
    \n";}else if ("youtube"['$===']($case)) {start_param = (function() {if ((($a = (node['$attr?']("start"))) !== nil && (!$a._isBoolean || $a == true))) { + return "&start=" + (node.$attr("start")) + } else { + return nil + }; return nil; })(); + end_param = (function() {if ((($a = (node['$attr?']("end"))) !== nil && (!$a._isBoolean || $a == true))) { + return "&end=" + (node.$attr("end")) + } else { + return nil + }; return nil; })(); + autoplay_param = (function() {if ((($a = (node['$option?']("autoplay"))) !== nil && (!$a._isBoolean || $a == true))) { + return "&autoplay=1" + } else { + return nil + }; return nil; })(); + loop_param = (function() {if ((($a = (node['$option?']("loop"))) !== nil && (!$a._isBoolean || $a == true))) { + return "&loop=1" + } else { + return nil + }; return nil; })(); + controls_param = (function() {if ((($a = (node['$option?']("nocontrols"))) !== nil && (!$a._isBoolean || $a == true))) { + return "&controls=0" + } else { + return nil + }; return nil; })(); + return "" + (title_element) + "\n
    \n\n
    \n";}else {poster_attribute = (function() {if ((($a = (("") + (poster = node.$attr("poster")))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return " poster=\"" + (node.$media_uri(poster)) + "\"" + }; return nil; })(); + time_anchor = (function() {if ((($a = (((($b = (node['$attr?']("start"))) !== false && $b !== nil) ? $b : (node['$attr?']("end"))))) !== nil && (!$a._isBoolean || $a == true))) { + return "#t=" + (node.$attr("start")) + ((function() {if ((($a = (node['$attr?']("end"))) !== nil && (!$a._isBoolean || $a == true))) { + return "," + } else { + return nil + }; return nil; })()) + (node.$attr("end")) + } else { + return nil + }; return nil; })(); + return "" + (title_element) + "\n
    \n\n
    \n";}})(); + }; + + def.$inline_anchor = function(node) { + var $a, $b, self = this, target = nil, $case = nil, refid = nil, text = nil, class_attr = nil, role = nil, window_attr = nil; + + target = node.$target(); + return (function() {$case = node.$type();if ("xref"['$===']($case)) {refid = ((($a = (node.$attr("refid"))) !== false && $a !== nil) ? $a : target); + text = ((($a = node.$text()) !== false && $a !== nil) ? $a : (((($b = node.$document().$references()['$[]']("ids")['$[]'](refid)) !== false && $b !== nil) ? $b : "[" + (refid) + "]"))); + return "" + (text) + "";}else if ("ref"['$===']($case)) {return ""}else if ("link"['$===']($case)) {class_attr = (function() {if ((($a = (role = node.$role())) !== nil && (!$a._isBoolean || $a == true))) { + return " class=\"" + (role) + "\"" + } else { + return nil + }; return nil; })(); + window_attr = (function() {if ((($a = (node['$attr?']("window"))) !== nil && (!$a._isBoolean || $a == true))) { + return " target=\"" + (node.$attr("window")) + "\"" + } else { + return nil + }; return nil; })(); + return "" + (node.$text()) + "";}else if ("bibref"['$===']($case)) {return "[" + (target) + "]"}else {return self.$warn("asciidoctor: WARNING: unknown anchor type: " + (node.$type().$inspect()))}})(); + }; + + def.$inline_break = function(node) { + var self = this; + + return "" + (node.$text()) + ""; + }; + + def.$inline_button = function(node) { + var self = this; + + return "" + (node.$text()) + ""; + }; + + def.$inline_callout = function(node) { + var $a, self = this, src = nil; + + if ((($a = node.$document()['$attr?']("icons", "font")) !== nil && (!$a._isBoolean || $a == true))) { + return "(" + (node.$text()) + ")" + } else if ((($a = node.$document()['$attr?']("icons")) !== nil && (!$a._isBoolean || $a == true))) { + src = node.$icon_uri("callouts/" + (node.$text())); + return "\"""; + } else { + return "(" + (node.$text()) + ")" + }; + }; + + def.$inline_footnote = function(node) { + var $a, self = this, index = nil, id_attr = nil; + + if ((($a = (index = node.$attr("index"))) !== nil && (!$a._isBoolean || $a == true))) { + if (node.$type()['$==']("xref")) { + return "[" + (index) + "]" + } else { + id_attr = (function() {if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return " id=\"_footnote_" + (node.$id()) + "\"" + } else { + return nil + }; return nil; })(); + return "[" + (index) + "]"; + } + } else if (node.$type()['$==']("xref")) { + return "[" + (node.$text()) + "]" + } else { + return nil + }; + }; + + def.$inline_image = function(node) { + var $a, $b, TMP_22, self = this, type = nil, style_class = nil, title_attribute = nil, img = nil, resolved_target = nil, attrs = nil, window_attr = nil, style_classes = nil, role = nil, style_attr = nil; + + if ((($a = (($b = ((type = node.$type()))['$==']("icon")) ? (node.$document()['$attr?']("icons", "font")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + style_class = "icon-" + (node.$target()); + if ((($a = node['$attr?']("size")) !== nil && (!$a._isBoolean || $a == true))) { + style_class = "" + (style_class) + " icon-" + (node.$attr("size"))}; + if ((($a = node['$attr?']("rotate")) !== nil && (!$a._isBoolean || $a == true))) { + style_class = "" + (style_class) + " icon-rotate-" + (node.$attr("rotate"))}; + if ((($a = node['$attr?']("flip")) !== nil && (!$a._isBoolean || $a == true))) { + style_class = "" + (style_class) + " icon-flip-" + (node.$attr("flip"))}; + title_attribute = (function() {if ((($a = (node['$attr?']("title"))) !== nil && (!$a._isBoolean || $a == true))) { + return " title=\"" + (node.$attr("title")) + "\"" + } else { + return nil + }; return nil; })(); + img = ""; + } else if ((($a = (($b = type['$==']("icon")) ? (node.$document()['$attr?']("icons"))['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + img = "[" + (node.$attr("alt")) + "]" + } else { + resolved_target = (function() {if ((($a = (type['$==']("icon"))) !== nil && (!$a._isBoolean || $a == true))) { + return (node.$icon_uri(node.$target())) + } else { + return (node.$image_uri(node.$target())) + }; return nil; })(); + attrs = ($a = ($b = ["alt", "width", "height", "title"]).$map, $a._p = (TMP_22 = function(name){var self = TMP_22._s || this, $a; +if (name == null) name = nil; + if ((($a = (node['$attr?'](name))) !== nil && (!$a._isBoolean || $a == true))) { + return " " + (name) + "=\"" + (node.$attr(name)) + "\"" + } else { + return nil + }}, TMP_22._s = self, TMP_22), $a).call($b).$join(); + img = ""; + }; + if ((($a = node['$attr?']("link")) !== nil && (!$a._isBoolean || $a == true))) { + window_attr = (function() {if ((($a = (node['$attr?']("window"))) !== nil && (!$a._isBoolean || $a == true))) { + return " target=\"" + (node.$attr("window")) + "\"" + } else { + return nil + }; return nil; })(); + img = "" + (img) + "";}; + style_classes = (function() {if ((($a = (role = node.$role())) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (type) + " " + (role) + } else { + return type + }; return nil; })(); + style_attr = (function() {if ((($a = (node['$attr?']("float"))) !== nil && (!$a._isBoolean || $a == true))) { + return " style=\"float: " + (node.$attr("float")) + "\"" + } else { + return nil + }; return nil; })(); + return "" + (img) + ""; + }; + + def.$inline_indexterm = function(node) { + var self = this; + + if (node.$type()['$==']("visible")) { + return node.$text() + } else { + return "" + }; + }; + + def.$inline_kbd = function(node) { + var $a, $b, TMP_23, self = this, keys = nil, key_combo = nil; + + if (((keys = node.$attr("keys"))).$size()['$=='](1)) { + return "" + (keys['$[]'](0)) + "" + } else { + key_combo = ($a = ($b = keys).$map, $a._p = (TMP_23 = function(key){var self = TMP_23._s || this; +if (key == null) key = nil; + return "" + (key) + "+"}, TMP_23._s = self, TMP_23), $a).call($b).$join().$chop(); + return "" + (key_combo) + ""; + }; + }; + + def.$inline_menu = function(node) { + var $a, $b, TMP_24, self = this, menu = nil, submenus = nil, submenu_path = nil, menuitem = nil; + + menu = node.$attr("menu"); + if ((($a = ((submenus = node.$attr("submenus")))['$empty?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + submenu_path = ($a = ($b = submenus).$map, $a._p = (TMP_24 = function(submenu){var self = TMP_24._s || this; +if (submenu == null) submenu = nil; + return "" + (submenu) + " ▸ "}, TMP_24._s = self, TMP_24), $a).call($b).$join().$chop(); + return "" + (menu) + " ▸ " + (submenu_path) + " " + (node.$attr("menuitem")) + ""; + } else if ((($a = (menuitem = node.$attr("menuitem"))) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (menu) + " ▸ " + (menuitem) + "" + } else { + return "" + (menu) + "" + }; + }; + + def.$inline_quoted = function(node) { + var $a, self = this, open = nil, close = nil, is_tag = nil, quoted_text = nil, role = nil; + + $a = $opal.to_ary($scope.QUOTE_TAGS['$[]'](node.$type())), open = ($a[0] == null ? nil : $a[0]), close = ($a[1] == null ? nil : $a[1]), is_tag = ($a[2] == null ? nil : $a[2]); + quoted_text = (function() {if ((($a = (role = node.$role())) !== nil && (!$a._isBoolean || $a == true))) { + if (is_tag !== false && is_tag !== nil) { + return "" + (open.$chop()) + " class=\"" + (role) + "\">" + (node.$text()) + (close) + } else { + return "" + (open) + (node.$text()) + (close) + "" + } + } else { + return "" + (open) + (node.$text()) + (close) + }; return nil; })(); + if ((($a = node.$id()) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (quoted_text) + } else { + return quoted_text + }; + }; + + return (def.$append_boolean_attribute = function(name, xml) { + var self = this; + + if (xml !== false && xml !== nil) { + return " " + (name) + "=\"" + (name) + "\"" + } else { + return " " + (name) + }; + }, nil) && 'append_boolean_attribute'; + })($scope.Converter, ($scope.Converter)._scope.BuiltIn) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $Document(){}; + var self = $Document = $klass($base, $super, 'Document', $Document); + + var def = self._proto, $scope = self._scope, $a, TMP_1, TMP_9, TMP_15; + + def.attributes = def.safe = def.reader = def.callouts = def.base_dir = def.parsed = def.parent_document = def.extensions = def.options = def.counters = def.references = def.doctype = def.backend = def.header = def.blocks = def.attributes_modified = def.id = def.original_attributes = def.attribute_overrides = def.converter = nil; + $opal.cdecl($scope, 'Footnote', (($a = $opal.Object._scope.Struct) == null ? $opal.cm('Struct') : $a).$new("index", "id", "text")); + + (function($base, $super) { + function $AttributeEntry(){}; + var self = $AttributeEntry = $klass($base, $super, 'AttributeEntry', $AttributeEntry); + + var def = self._proto, $scope = self._scope; + + self.$attr_reader("name", "value", "negate"); + + def.$initialize = function(name, value, negate) { + var $a, self = this; + + if (negate == null) { + negate = nil + } + self.name = name; + self.value = value; + return self.negate = (function() {if ((($a = negate['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return value['$nil?']() + } else { + return negate + }; return nil; })(); + }; + + return (def.$save_to = function(block_attributes) { + var $a, $b, $c, self = this; + + return (($a = "attribute_entries", $b = block_attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, []))))['$<<'](self); + }, nil) && 'save_to'; + })(self, null); + + self.$attr_reader("safe"); + + self.$attr_reader("references"); + + self.$attr_reader("counters"); + + self.$attr_reader("callouts"); + + self.$attr_reader("header"); + + self.$attr_reader("base_dir"); + + self.$attr_reader("parent_document"); + + self.$attr_reader("reader"); + + self.$attr_reader("converter"); + + self.$attr_reader("extensions"); + + def.$initialize = TMP_1 = function(data, options) { + var $a, $b, $c, TMP_2, TMP_3, $e, $f, TMP_4, $g, TMP_5, $h, $i, self = this, $iter = TMP_1._p, $yield = $iter || nil, parent_doc = nil, attr_overrides = nil, initialize_extensions = nil, safe_mode = nil, header_footer = nil, attrs = nil, safe_mode_name = nil, backend_val = nil, doctype_val = nil, now = nil, localdate = nil, localtime = nil, registry = nil, ext_registry = nil, ext_block = nil; + + if (data == null) { + data = nil + } + if (options == null) { + options = $hash2([], {}) + } + TMP_1._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [self, "document"]); + if ((($a = (parent_doc = options.$delete("parent"))) !== nil && (!$a._isBoolean || $a == true))) { + self.parent_document = parent_doc; + ($a = "base_dir", $b = options, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, parent_doc.$base_dir()))); + self.references = ($a = ($b = parent_doc.$references()).$inject, $a._p = (TMP_2 = function(accum, $d){var self = TMP_2._s || this; +if (accum == null) accum = nil;key = $d[0];ref = $d[1]; + if (key['$==']("footnotes")) { + accum['$[]=']("footnotes", []) + } else { + accum['$[]='](key, ref) + }; + return accum;}, TMP_2._s = self, TMP_2), $a).call($b, $hash2([], {})); + attr_overrides = parent_doc.$attributes().$dup(); + attr_overrides.$delete("doctype"); + self.attribute_overrides = attr_overrides; + self.safe = parent_doc.$safe(); + self.converter = parent_doc.$converter(); + initialize_extensions = false; + self.extensions = parent_doc.$extensions(); + } else { + self.parent_document = nil; + self.references = $hash2(["ids", "footnotes", "links", "images", "indexterms", "includes"], {"ids": $hash2([], {}), "footnotes": [], "links": [], "images": [], "indexterms": [], "includes": (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()}); + attr_overrides = $hash2([], {}); + ($a = ($c = (((($e = options['$[]']("attributes")) !== false && $e !== nil) ? $e : $hash2([], {})))).$each, $a._p = (TMP_3 = function(key, value){var self = TMP_3._s || this, $a; +if (key == null) key = nil;if (value == null) value = nil; + if ((($a = key['$start_with?']("!")) !== nil && (!$a._isBoolean || $a == true))) { + key = key['$[]']($range(1, -1, false)); + value = nil; + } else if ((($a = key['$end_with?']("!")) !== nil && (!$a._isBoolean || $a == true))) { + key = key.$chop(); + value = nil;}; + return attr_overrides['$[]='](key.$downcase(), value);}, TMP_3._s = self, TMP_3), $a).call($c); + self.attribute_overrides = attr_overrides; + self.safe = nil; + self.converter = nil; + initialize_extensions = (function(){ try { return ((((($a = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $a))._scope.Extensions) != null ? 'constant' : nil); } catch (err) { if (err._klass === Opal.NameError) { return nil; } else { throw(err); }}; })(); + self.extensions = nil; + }; + self.parsed = false; + self.header = nil; + self.counters = $hash2([], {}); + self.callouts = $scope.Callouts.$new(); + self.attributes_modified = (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new(); + self.options = options; + if (parent_doc !== false && parent_doc !== nil) { + } else if ((($a = ((safe_mode = options['$[]']("safe")))['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + self.safe = ($scope.SafeMode)._scope.SECURE + } else if ((($a = safe_mode['$is_a?']((($e = $opal.Object._scope.Fixnum) == null ? $opal.cm('Fixnum') : $e))) !== nil && (!$a._isBoolean || $a == true))) { + self.safe = safe_mode + } else { + self.safe = (function() {try {return $scope.SafeMode.$const_get(safe_mode.$to_s().$upcase()).$to_i() } catch ($err) { return ($scope.SafeMode)._scope.SECURE.$to_i() }})() + }; + header_footer = (($a = "header_footer", $e = options, ((($f = $e['$[]']($a)) !== false && $f !== nil) ? $f : $e['$[]=']($a, false)))); + attrs = self.attributes; + attrs['$[]=']("encoding", "UTF-8"); + attrs['$[]=']("sectids", ""); + if (header_footer !== false && header_footer !== nil) { + } else { + attrs['$[]=']("notitle", "") + }; + attrs['$[]=']("toc-placement", "auto"); + attrs['$[]=']("stylesheet", ""); + if (header_footer !== false && header_footer !== nil) { + attrs['$[]=']("copycss", "")}; + attrs['$[]=']("prewrap", ""); + attrs['$[]=']("attribute-undefined", $scope.Compliance.$attribute_undefined()); + attrs['$[]=']("attribute-missing", $scope.Compliance.$attribute_missing()); + attrs['$[]=']("caution-caption", "Caution"); + attrs['$[]=']("important-caption", "Important"); + attrs['$[]=']("note-caption", "Note"); + attrs['$[]=']("tip-caption", "Tip"); + attrs['$[]=']("warning-caption", "Warning"); + attrs['$[]=']("appendix-caption", "Appendix"); + attrs['$[]=']("example-caption", "Example"); + attrs['$[]=']("figure-caption", "Figure"); + attrs['$[]=']("table-caption", "Table"); + attrs['$[]=']("toc-title", "Table of Contents"); + attrs['$[]=']("manname-title", "NAME"); + attrs['$[]=']("untitled-label", "Untitled"); + attrs['$[]=']("version-label", "Version"); + attrs['$[]=']("last-update-label", "Last updated"); + attr_overrides['$[]=']("asciidoctor", ""); + attr_overrides['$[]=']("asciidoctor-version", $scope.VERSION); + safe_mode_name = ($a = ($e = $scope.SafeMode.$constants()).$detect, $a._p = (TMP_4 = function(l){var self = TMP_4._s || this; + if (self.safe == null) self.safe = nil; +if (l == null) l = nil; + return $scope.SafeMode.$const_get(l)['$=='](self.safe)}, TMP_4._s = self, TMP_4), $a).call($e).$to_s().$downcase(); + attr_overrides['$[]=']("safe-mode-name", safe_mode_name); + attr_overrides['$[]=']("safe-mode-" + (safe_mode_name), ""); + attr_overrides['$[]=']("safe-mode-level", self.safe); + attr_overrides['$[]=']("embedded", (function() {if (header_footer !== false && header_footer !== nil) { + return nil + } else { + return "" + }; return nil; })()); + ($a = "max-include-depth", $f = attr_overrides, ((($g = $f['$[]']($a)) !== false && $g !== nil) ? $g : $f['$[]=']($a, 64))); + if ((($a = attr_overrides['$[]']("allow-uri-read")['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + attr_overrides['$[]=']("allow-uri-read", nil) + }; + attr_overrides['$[]=']("user-home", $scope.USER_HOME); + if ((($a = options['$[]']("base_dir")) !== nil && (!$a._isBoolean || $a == true))) { + self.base_dir = attr_overrides['$[]=']("docdir", (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(options['$[]']("base_dir"))) + } else if ((($a = attr_overrides['$[]']("docdir")) !== nil && (!$a._isBoolean || $a == true))) { + self.base_dir = attr_overrides['$[]=']("docdir", (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(attr_overrides['$[]']("docdir"))) + } else { + self.base_dir = attr_overrides['$[]=']("docdir", (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path((($a = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $a).$pwd())) + }; + if ((($a = (backend_val = options['$[]']("backend"))) !== nil && (!$a._isBoolean || $a == true))) { + attr_overrides['$[]=']("backend", "" + (backend_val))}; + if ((($a = (doctype_val = options['$[]']("doctype"))) !== nil && (!$a._isBoolean || $a == true))) { + attr_overrides['$[]=']("doctype", "" + (doctype_val))}; + if (self.safe['$>='](($scope.SafeMode)._scope.SERVER)) { + ($a = "copycss", $f = attr_overrides, ((($g = $f['$[]']($a)) !== false && $g !== nil) ? $g : $f['$[]=']($a, nil))); + ($a = "source-highlighter", $f = attr_overrides, ((($g = $f['$[]']($a)) !== false && $g !== nil) ? $g : $f['$[]=']($a, nil))); + ($a = "backend", $f = attr_overrides, ((($g = $f['$[]']($a)) !== false && $g !== nil) ? $g : $f['$[]=']($a, $scope.DEFAULT_BACKEND))); + if ((($a = ($f = parent_doc['$!'](), $f !== false && $f !== nil ?attr_overrides['$key?']("docfile") : $f)) !== nil && (!$a._isBoolean || $a == true))) { + attr_overrides['$[]=']("docfile", attr_overrides['$[]']("docfile")['$[]']($range((attr_overrides['$[]']("docdir").$length()['$+'](1)), -1, false)))}; + attr_overrides['$[]=']("docdir", ""); + attr_overrides['$[]=']("user-home", "."); + if (self.safe['$>='](($scope.SafeMode)._scope.SECURE)) { + if ((($a = attr_overrides.$fetch("linkcss", "")['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + attr_overrides['$[]=']("linkcss", "") + }; + ($a = "icons", $f = attr_overrides, ((($g = $f['$[]']($a)) !== false && $g !== nil) ? $g : $f['$[]=']($a, nil)));};}; + ($a = ($f = attr_overrides).$delete_if, $a._p = (TMP_5 = function(key, val){var self = TMP_5._s || this, $a, $b, $c, verdict = nil; +if (key == null) key = nil;if (val == null) val = nil; + verdict = false; + if ((($a = val['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + attrs.$delete(key) + } else { + if ((($a = ($b = (val['$is_a?']((($c = $opal.Object._scope.String) == null ? $opal.cm('String') : $c))), $b !== false && $b !== nil ?(val['$end_with?']("@")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + val = val.$chop(); + verdict = true;}; + attrs['$[]='](key, val); + }; + return verdict;}, TMP_5._s = self, TMP_5), $a).call($f); + if (parent_doc !== false && parent_doc !== nil) { + self.reader = $scope.Reader.$new(data, options['$[]']("cursor")); + $scope.Parser.$parse(self.reader, self); + self.callouts.$rewind(); + return self.parsed = true; + } else { + ($a = "backend", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, $scope.DEFAULT_BACKEND))); + ($a = "doctype", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, $scope.DEFAULT_DOCTYPE))); + self.$update_backend_attributes(attrs['$[]']("backend"), true); + now = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now(); + localdate = (($a = "localdate", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, now.$strftime("%Y-%m-%d"))))); + localtime = (($a = "localtime", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, ((function() {try {return now.$strftime("%H:%M:%S %Z") } catch ($err) { return now.$strftime("%H:%M:%S") }})()))))); + ($a = "localdatetime", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, "" + (localdate) + " " + (localtime)))); + ($a = "docdate", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, localdate))); + ($a = "doctime", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, localtime))); + ($a = "docdatetime", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, "" + (localdate) + " " + (localtime)))); + ($a = "stylesdir", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, "."))); + ($a = "iconsdir", $g = attrs, ((($h = $g['$[]']($a)) !== false && $h !== nil) ? $h : $g['$[]=']($a, (($i = $opal.Object._scope.File) == null ? $opal.cm('File') : $i).$join(attrs.$fetch("imagesdir", "./images"), "icons")))); + self.extensions = (function() {if (initialize_extensions !== false && initialize_extensions !== nil) { + registry = (function() {if ((($a = (ext_registry = options['$[]']("extensions_registry"))) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ((($g = (ext_registry['$is_a?'](($scope.Extensions)._scope.Registry))) !== false && $g !== nil) ? $g : (($h = (($i = $opal.Object._scope.RUBY_ENGINE_JRUBY) == null ? $opal.cm('RUBY_ENGINE_JRUBY') : $i), $h !== false && $h !== nil ?(ext_registry['$is_a?']((((($i = $opal.Object._scope.AsciidoctorJ) == null ? $opal.cm('AsciidoctorJ') : $i))._scope.Extensions)._scope.ExtensionRegistry)) : $h)))) !== nil && (!$a._isBoolean || $a == true))) { + return ext_registry + } else { + return nil + } + } else if ((($a = ((ext_block = options['$[]']("extensions")))['$is_a?']((($g = $opal.Object._scope.Proc) == null ? $opal.cm('Proc') : $g))) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = ($g = $scope.Extensions).$build_registry, $a._p = ext_block.$to_proc(), $a).call($g) + } else { + return nil + }; return nil; })(); + return (((($a = registry) !== false && $a !== nil) ? $a : registry = ($scope.Extensions)._scope.Registry.$new())).$activate(self); + } else { + return nil + }; return nil; })(); + self.reader = $scope.PreprocessorReader.$new(self, data, ($scope.Reader)._scope.Cursor.$new(attrs['$[]']("docfile"), self.base_dir)); + if ((($a = (($h = data !== false && data !== nil) ? options['$[]']("parse") : $h)) !== nil && (!$a._isBoolean || $a == true))) { + return self.$parse() + } else { + return nil + }; + }; + }; + + def.$parse = function(data) { + var $a, $b, $c, TMP_6, TMP_7, self = this, exts = nil; + + if (data == null) { + data = nil + } + if ((($a = self.parsed) !== nil && (!$a._isBoolean || $a == true))) { + } else { + if (data !== false && data !== nil) { + self.reader = $scope.PreprocessorReader.$new(self, data, ($scope.Reader)._scope.Cursor.$new(self.attributes['$[]']("docfile"), self.base_dir))}; + if ((($a = ($b = (exts = (function() {if ((($c = self.parent_document) !== nil && (!$c._isBoolean || $c == true))) { + return nil + } else { + return self.extensions + }; return nil; })()), $b !== false && $b !== nil ?exts['$preprocessors?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + ($a = ($b = exts.$preprocessors()).$each, $a._p = (TMP_6 = function(ext){var self = TMP_6._s || this, $a; + if (self.reader == null) self.reader = nil; +if (ext == null) ext = nil; + return self.reader = ((($a = ext.$process_method()['$[]'](self, self.reader)) !== false && $a !== nil) ? $a : self.reader)}, TMP_6._s = self, TMP_6), $a).call($b)}; + $scope.Parser.$parse(self.reader, self, $hash2(["header_only"], {"header_only": self.options['$[]']("parse_header_only")['$!']()['$!']()})); + self.callouts.$rewind(); + if ((($a = (($c = exts !== false && exts !== nil) ? exts['$treeprocessors?']() : $c)) !== nil && (!$a._isBoolean || $a == true))) { + ($a = ($c = exts.$treeprocessors()).$each, $a._p = (TMP_7 = function(ext){var self = TMP_7._s || this; +if (ext == null) ext = nil; + return ext.$process_method()['$[]'](self)}, TMP_7._s = self, TMP_7), $a).call($c)}; + self.parsed = true; + }; + return self; + }; + + def.$counter = function(name, seed) { + var $a, $b, self = this, attr_is_seed = nil, attr_val = nil; + + if (seed == null) { + seed = nil + } + if ((($a = ($b = (attr_is_seed = ((attr_val = self.attributes['$[]'](name)))['$nil_or_empty?']()['$!']()), $b !== false && $b !== nil ?self.counters['$key?'](name) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.counters['$[]='](name, self.$nextval(attr_val)) + } else { + if ((($a = seed['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + seed = self.$nextval((function() {if (attr_is_seed !== false && attr_is_seed !== nil) { + return attr_val + } else { + return 0 + }; return nil; })()) + } else if (seed.$to_i().$to_s()['$=='](seed)) { + seed = seed.$to_i()}; + self.counters['$[]='](name, seed); + }; + return (self.attributes['$[]='](name, self.counters['$[]'](name))); + }; + + def.$counter_increment = function(counter_name, block) { + var self = this, val = nil; + + val = self.$counter(counter_name); + $scope.AttributeEntry.$new(counter_name, val).$save_to(block.$attributes()); + return val; + }; + + def.$nextval = function(current) { + var $a, $b, self = this, intval = nil; + + if ((($a = current['$is_a?']((($b = $opal.Object._scope.Integer) == null ? $opal.cm('Integer') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + return current['$+'](1) + } else { + intval = current.$to_i(); + if ((($a = intval.$to_s()['$=='](current.$to_s())['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return (current['$[]'](0).$ord()['$+'](1)).$chr() + } else { + return intval['$+'](1) + }; + }; + }; + + def.$register = function(type, value) { + var $a, $b, self = this, $case = nil; + + return (function() {$case = type;if ("ids"['$===']($case)) {if ((($a = value['$is_a?']((($b = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + return self.references['$[]']("ids")['$[]='](value['$[]'](0), (((($a = value['$[]'](1)) !== false && $a !== nil) ? $a : "["['$+'](value['$[]'](0))['$+']("]")))) + } else { + return self.references['$[]']("ids")['$[]='](value, "["['$+'](value)['$+']("]")) + }}else if ("footnotes"['$===']($case) || "indexterms"['$===']($case)) {return self.references['$[]'](type)['$<<'](value)}else {if ((($a = self.options['$[]']("catalog_assets")) !== nil && (!$a._isBoolean || $a == true))) { + return self.references['$[]'](type)['$<<'](value) + } else { + return nil + }}})(); + }; + + def['$footnotes?'] = function() { + var self = this; + + return self.references['$[]']("footnotes")['$empty?']()['$!'](); + }; + + def.$footnotes = function() { + var self = this; + + return self.references['$[]']("footnotes"); + }; + + def['$nested?'] = function() { + var self = this; + + return self.parent_document['$!']()['$!'](); + }; + + def['$embedded?'] = function() { + var self = this; + + return self.attributes['$key?']("embedded"); + }; + + def['$extensions?'] = function() { + var self = this; + + return self.extensions['$!']()['$!'](); + }; + + def.$source = function() { + var $a, self = this; + + if ((($a = self.reader) !== nil && (!$a._isBoolean || $a == true))) { + return self.reader.$source() + } else { + return nil + }; + }; + + def.$source_lines = function() { + var $a, self = this; + + if ((($a = self.reader) !== nil && (!$a._isBoolean || $a == true))) { + return self.reader.$source_lines() + } else { + return nil + }; + }; + + def.$doctype = function() { + var $a, self = this; + + return ((($a = self.doctype) !== false && $a !== nil) ? $a : self.doctype = self.attributes['$[]']("doctype")); + }; + + def.$backend = function() { + var $a, self = this; + + return ((($a = self.backend) !== false && $a !== nil) ? $a : self.backend = self.attributes['$[]']("backend")); + }; + + def['$basebackend?'] = function(base) { + var self = this; + + return self.attributes['$[]']("basebackend")['$=='](base); + }; + + def.$title = function() { + var self = this; + + return self.attributes['$[]']("title"); + }; + + def['$title='] = function(title) { + var $a, self = this; + + ((($a = self.header) !== false && $a !== nil) ? $a : self.header = $scope.Section.$new(self, 0)); + return self.header['$title='](title); + }; + + def.$doctitle = function(opts) { + var $a, $b, self = this, val = nil, sect = nil; + + if (opts == null) { + opts = $hash2([], {}) + } + if ((($a = ((val = self.attributes.$fetch("title", "")))['$empty?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + val = self.$title() + } else if ((($a = ($b = (sect = self.$first_section()), $b !== false && $b !== nil ?sect['$title?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + val = sect.$title() + } else { + return nil + }; + if ((($a = ($b = opts['$[]']("sanitize"), $b !== false && $b !== nil ?val['$include?']("<") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return val.$gsub($scope.XmlSanitizeRx, "").$tr_s(" ", " ").$strip() + } else { + return val + }; + }; + + $opal.defn(self, '$name', def.$doctitle); + + def.$author = function() { + var self = this; + + return self.attributes['$[]']("author"); + }; + + def.$revdate = function() { + var self = this; + + return self.attributes['$[]']("revdate"); + }; + + def.$notitle = function() { + var $a, self = this; + + return ($a = self.attributes['$key?']("showtitle")['$!'](), $a !== false && $a !== nil ?self.attributes['$key?']("notitle") : $a); + }; + + def.$noheader = function() { + var self = this; + + return self.attributes['$key?']("noheader"); + }; + + def.$nofooter = function() { + var self = this; + + return self.attributes['$key?']("nofooter"); + }; + + def.$first_section = function() { + var $a, $b, TMP_8, $c, self = this; + + if ((($a = self['$has_header?']()) !== nil && (!$a._isBoolean || $a == true))) { + return self.header + } else { + return ($a = ($b = (((($c = self.blocks) !== false && $c !== nil) ? $c : []))).$detect, $a._p = (TMP_8 = function(e){var self = TMP_8._s || this; +if (e == null) e = nil; + return e.$context()['$==']("section")}, TMP_8._s = self, TMP_8), $a).call($b) + }; + }; + + def['$has_header?'] = function() { + var $a, self = this; + + if ((($a = self.header) !== nil && (!$a._isBoolean || $a == true))) { + return true + } else { + return false + }; + }; + + $opal.defn(self, '$header?', def['$has_header?']); + + def['$<<'] = TMP_9 = function(block) {var $zuper = $slice.call(arguments, 0); + var self = this, $iter = TMP_9._p, $yield = $iter || nil; + + TMP_9._p = null; + $opal.find_super_dispatcher(self, '<<', TMP_9, $iter).apply(self, $zuper); + if (block.$context()['$==']("section")) { + return self.$assign_index(block) + } else { + return nil + }; + }; + + def.$finalize_header = function(unrooted_attributes, header_valid) { + var self = this; + + if (header_valid == null) { + header_valid = true + } + self.$clear_playback_attributes(unrooted_attributes); + self.$save_attributes(); + if (header_valid !== false && header_valid !== nil) { + } else { + unrooted_attributes['$[]=']("invalid-header", true) + }; + return unrooted_attributes; + }; + + def.$save_attributes = function() { + var $a, $b, $c, $d, TMP_10, TMP_11, self = this, val = nil, toc_val = nil, toc2_val = nil, toc_position_val = nil, default_toc_position = nil, default_toc_class = nil, position = nil, $case = nil; + + if (self.attributes['$[]']("basebackend")['$==']("docbook")) { + if ((($a = ((($b = self['$attribute_locked?']("toc")) !== false && $b !== nil) ? $b : self.attributes_modified['$include?']("toc"))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.attributes['$[]=']("toc", "") + }; + if ((($a = ((($b = self['$attribute_locked?']("numbered")) !== false && $b !== nil) ? $b : self.attributes_modified['$include?']("numbered"))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.attributes['$[]=']("numbered", "") + };}; + if ((($a = ((($b = self.attributes['$key?']("doctitle")) !== false && $b !== nil) ? $b : ((val = self.$doctitle()))['$!']())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.attributes['$[]=']("doctitle", val) + }; + if ((($a = self.id) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.id = self.attributes['$[]']("css-signature") + }; + toc_val = self.attributes['$[]']("toc"); + toc2_val = self.attributes['$[]']("toc2"); + toc_position_val = self.attributes['$[]']("toc-position"); + if ((($a = ((($b = ((($c = toc_val !== false && toc_val !== nil) ? (((($d = toc_val['$==']("")['$!']()) !== false && $d !== nil) ? $d : toc_position_val['$nil_or_empty?']()['$!']())) : $c))) !== false && $b !== nil) ? $b : toc2_val)) !== nil && (!$a._isBoolean || $a == true))) { + default_toc_position = "left"; + default_toc_class = "toc2"; + position = ($a = ($b = [toc_position_val, toc2_val, toc_val]).$find, $a._p = (TMP_10 = function(pos){var self = TMP_10._s || this; +if (pos == null) pos = nil; + return pos['$nil_or_empty?']()['$!']()}, TMP_10._s = self, TMP_10), $a).call($b); + if ((($a = ($c = position['$!'](), $c !== false && $c !== nil ?toc2_val : $c)) !== nil && (!$a._isBoolean || $a == true))) { + position = default_toc_position}; + self.attributes['$[]=']("toc", ""); + $case = position;if ("left"['$===']($case) || "<"['$===']($case) || "<"['$===']($case)) {self.attributes['$[]=']("toc-position", "left")}else if ("right"['$===']($case) || ">"['$===']($case) || ">"['$===']($case)) {self.attributes['$[]=']("toc-position", "right")}else if ("top"['$===']($case) || "^"['$===']($case)) {self.attributes['$[]=']("toc-position", "top")}else if ("bottom"['$===']($case) || "v"['$===']($case)) {self.attributes['$[]=']("toc-position", "bottom")}else if ("preamble"['$===']($case)) {self.attributes.$delete("toc2"); + self.attributes['$[]=']("toc-placement", "preamble"); + default_toc_class = nil; + default_toc_position = nil;}else if ("default"['$===']($case)) {self.attributes.$delete("toc2"); + default_toc_class = nil; + default_toc_position = "default";}; + if (default_toc_class !== false && default_toc_class !== nil) { + ($a = "toc-class", $c = self.attributes, ((($d = $c['$[]']($a)) !== false && $d !== nil) ? $d : $c['$[]=']($a, default_toc_class)))}; + if (default_toc_position !== false && default_toc_position !== nil) { + ($a = "toc-position", $c = self.attributes, ((($d = $c['$[]']($a)) !== false && $d !== nil) ? $d : $c['$[]=']($a, default_toc_position)))};}; + self.original_attributes = self.attributes.$dup(); + if ((($a = self['$nested?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return ($a = ($c = $scope.FLEXIBLE_ATTRIBUTES).$each, $a._p = (TMP_11 = function(name){var self = TMP_11._s || this, $a, $b; + if (self.attribute_overrides == null) self.attribute_overrides = nil; +if (name == null) name = nil; + if ((($a = ($b = self.attribute_overrides['$key?'](name), $b !== false && $b !== nil ?self.attribute_overrides['$[]'](name)['$nil?']()['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.attribute_overrides.$delete(name) + } else { + return nil + }}, TMP_11._s = self, TMP_11), $a).call($c) + }; + }; + + def.$restore_attributes = function() { + var self = this; + + return self.attributes = self.original_attributes; + }; + + def.$clear_playback_attributes = function(attributes) { + var self = this; + + return attributes.$delete("attribute_entries"); + }; + + def.$playback_attributes = function(block_attributes) { + var $a, $b, TMP_12, self = this; + + if ((($a = block_attributes['$key?']("attribute_entries")) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = ($b = block_attributes['$[]']("attribute_entries")).$each, $a._p = (TMP_12 = function(entry){var self = TMP_12._s || this, $a; + if (self.attributes == null) self.attributes = nil; +if (entry == null) entry = nil; + if ((($a = entry.$negate()) !== nil && (!$a._isBoolean || $a == true))) { + return self.attributes.$delete(entry.$name()) + } else { + return self.attributes['$[]='](entry.$name(), entry.$value()) + }}, TMP_12._s = self, TMP_12), $a).call($b) + } else { + return nil + }; + }; + + def.$set_attribute = function(name, value) { + var $a, self = this, $case = nil; + + if ((($a = self['$attribute_locked?'](name)) !== nil && (!$a._isBoolean || $a == true))) { + return false + } else { + $case = name;if ("backend"['$===']($case)) {self.$update_backend_attributes(self.$apply_attribute_value_subs(value))}else if ("doctype"['$===']($case)) {self.$update_doctype_attributes(self.$apply_attribute_value_subs(value))}else {self.attributes['$[]='](name, self.$apply_attribute_value_subs(value))}; + self.attributes_modified['$<<'](name); + return true; + }; + }; + + def.$delete_attribute = function(name) { + var $a, self = this; + + if ((($a = self['$attribute_locked?'](name)) !== nil && (!$a._isBoolean || $a == true))) { + return false + } else { + self.attributes.$delete(name); + self.attributes_modified['$<<'](name); + return true; + }; + }; + + def['$attribute_locked?'] = function(name) { + var self = this; + + return self.attribute_overrides['$key?'](name); + }; + + def.$apply_attribute_value_subs = function(value) { + var $a, self = this, m = nil, subs = nil; + + if ((($a = (m = $scope.AttributeEntryPassMacroRx.$match(value))) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = m['$[]'](1)['$empty?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + subs = self.$resolve_pass_subs(m['$[]'](1)); + if ((($a = subs['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](2) + } else { + return (self.$apply_subs(m['$[]'](2), subs)) + }; + } else { + return m['$[]'](2) + } + } else { + return self.$apply_header_subs(value) + }; + }; + + def.$update_backend_attributes = function(new_backend, force) { + var $a, $b, $c, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, resolved_name = nil, new_basebackend = nil, new_filetype = nil, new_outfilesuffix = nil, current_filetype = nil, page_width = nil; + + if (force == null) { + force = false + } + if ((($a = ((($b = force) !== false && $b !== nil) ? $b : ((($c = new_backend !== false && new_backend !== nil) ? new_backend['$=='](self.attributes['$[]']("backend"))['$!']() : $c)))) !== nil && (!$a._isBoolean || $a == true))) { + attrs = self.attributes; + current_backend = attrs['$[]']("backend"); + current_basebackend = attrs['$[]']("basebackend"); + current_doctype = attrs['$[]']("doctype"); + if ((($a = new_backend['$start_with?']("xhtml")) !== nil && (!$a._isBoolean || $a == true))) { + attrs['$[]=']("htmlsyntax", "xml"); + new_backend = new_backend['$[]']($range(1, -1, false)); + } else if ((($a = new_backend['$start_with?']("html")) !== nil && (!$a._isBoolean || $a == true))) { + attrs['$[]=']("htmlsyntax", "html")}; + if ((($a = (resolved_name = $scope.BACKEND_ALIASES['$[]'](new_backend))) !== nil && (!$a._isBoolean || $a == true))) { + new_backend = resolved_name}; + if (current_backend !== false && current_backend !== nil) { + attrs.$delete("backend-" + (current_backend)); + if (current_doctype !== false && current_doctype !== nil) { + attrs.$delete("backend-" + (current_backend) + "-doctype-" + (current_doctype))};}; + if (current_doctype !== false && current_doctype !== nil) { + attrs['$[]=']("doctype-" + (current_doctype), ""); + attrs['$[]=']("backend-" + (new_backend) + "-doctype-" + (current_doctype), "");}; + attrs['$[]=']("backend", new_backend); + attrs['$[]=']("backend-" + (new_backend), ""); + if ((($a = (self.converter = self.$create_converter())['$is_a?'](($scope.Converter)._scope.BackendInfo)) !== nil && (!$a._isBoolean || $a == true))) { + new_basebackend = self.converter.$basebackend(); + attrs['$[]=']("outfilesuffix", self.converter.$outfilesuffix()); + new_filetype = self.converter.$filetype(); + } else { + new_basebackend = new_backend.$sub($scope.TrailingDigitsRx, ""); + new_outfilesuffix = ((($a = $scope.DEFAULT_EXTENSIONS['$[]'](new_basebackend)) !== false && $a !== nil) ? $a : ".html"); + new_filetype = new_outfilesuffix['$[]']($range(1, -1, false)); + if ((($a = self['$attribute_locked?']("outfilesuffix")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + attrs['$[]=']("outfilesuffix", new_outfilesuffix) + }; + }; + if ((($a = (current_filetype = attrs['$[]']("filetype"))) !== nil && (!$a._isBoolean || $a == true))) { + attrs.$delete("filetype-" + (current_filetype))}; + attrs['$[]=']("filetype", new_filetype); + attrs['$[]=']("filetype-" + (new_filetype), ""); + if ((($a = (page_width = $scope.DEFAULT_PAGE_WIDTHS['$[]'](new_basebackend))) !== nil && (!$a._isBoolean || $a == true))) { + attrs['$[]=']("pagewidth", page_width) + } else { + attrs.$delete("pagewidth") + }; + if ((($a = new_basebackend['$=='](current_basebackend)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + if (current_basebackend !== false && current_basebackend !== nil) { + attrs.$delete("basebackend-" + (current_basebackend)); + if (current_doctype !== false && current_doctype !== nil) { + attrs.$delete("basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype))};}; + attrs['$[]=']("basebackend", new_basebackend); + attrs['$[]=']("basebackend-" + (new_basebackend), ""); + if (current_doctype !== false && current_doctype !== nil) { + attrs['$[]=']("basebackend-" + (new_basebackend) + "-doctype-" + (current_doctype), "")};}; + return self.backend = nil; + } else { + return nil + }; + }; + + def.$update_doctype_attributes = function(new_doctype) { + var $a, $b, self = this, attrs = nil, current_doctype = nil, current_backend = nil, current_basebackend = nil; + + if ((($a = (($b = new_doctype !== false && new_doctype !== nil) ? new_doctype['$=='](self.attributes['$[]']("doctype"))['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + attrs = self.attributes; + current_doctype = attrs['$[]']("doctype"); + current_backend = attrs['$[]']("backend"); + current_basebackend = attrs['$[]']("basebackend"); + if (current_doctype !== false && current_doctype !== nil) { + attrs.$delete("doctype-" + (current_doctype)); + if (current_backend !== false && current_backend !== nil) { + attrs.$delete("backend-" + (current_backend) + "-doctype-" + (current_doctype))}; + if (current_basebackend !== false && current_basebackend !== nil) { + attrs.$delete("basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype))};}; + attrs['$[]=']("doctype", new_doctype); + attrs['$[]=']("doctype-" + (new_doctype), ""); + if (current_backend !== false && current_backend !== nil) { + attrs['$[]=']("backend-" + (current_backend) + "-doctype-" + (new_doctype), "")}; + if (current_basebackend !== false && current_basebackend !== nil) { + attrs['$[]=']("basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), "")}; + return self.doctype = nil; + } else { + return nil + }; + }; + + def.$create_converter = function() { + var $a, self = this, converter_opts = nil, template_dirs = nil, template_dir = nil, converter_factory = nil, converter = nil; + + converter_opts = $hash2([], {}); + converter_opts['$[]=']("htmlsyntax", self.attributes['$[]']("htmlsyntax")); + template_dirs = (function() {if ((($a = (template_dir = self.options['$[]']("template_dir"))) !== nil && (!$a._isBoolean || $a == true))) { + return converter_opts['$[]=']("template_dirs", [template_dir]) + } else if ((($a = (template_dirs = self.options['$[]']("template_dirs"))) !== nil && (!$a._isBoolean || $a == true))) { + return converter_opts['$[]=']("template_dirs", template_dirs) + } else { + return nil + }; return nil; })(); + if (template_dirs !== false && template_dirs !== nil) { + converter_opts['$[]=']("template_cache", self.options.$fetch("template_cache", true)); + converter_opts['$[]=']("template_engine", self.options['$[]']("template_engine")); + converter_opts['$[]=']("template_engine_options", self.options['$[]']("template_engine_options")); + converter_opts['$[]=']("eruby", self.options['$[]']("eruby"));}; + converter_factory = (function() {if ((($a = (converter = self.options['$[]']("converter"))) !== nil && (!$a._isBoolean || $a == true))) { + return ($scope.Converter)._scope.Factory.$new((($a = $opal.Object._scope.Hash) == null ? $opal.cm('Hash') : $a)['$[]'](self.$backend(), converter)) + } else { + return ($scope.Converter)._scope.Factory.$default(false) + }; return nil; })(); + return converter_factory.$create(self.$backend(), converter_opts); + }; + + def.$convert = function(opts) { + var $a, $b, TMP_13, self = this, block = nil, output = nil, transform = nil, exts = nil; + + if (opts == null) { + opts = $hash2([], {}) + } + if ((($a = self.parsed) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$parse() + }; + self.$restore_attributes(); + if (self.$doctype()['$==']("inline")) { + if ((($a = ($b = (block = self.blocks['$[]'](0)), $b !== false && $b !== nil ?block.$content_model()['$==']("compound")['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + output = block.$content() + } else { + output = "" + } + } else { + transform = (function() {if ((($a = ((function() {if ((($b = (opts['$key?']("header_footer"))) !== nil && (!$b._isBoolean || $b == true))) { + return opts['$[]']("header_footer") + } else { + return self.options['$[]']("header_footer") + }; return nil; })())) !== nil && (!$a._isBoolean || $a == true))) { + return "document" + } else { + return "embedded" + }; return nil; })(); + output = self.converter.$convert(self, transform); + }; + if ((($a = self.parent_document) !== nil && (!$a._isBoolean || $a == true))) { + } else if ((($a = ($b = (exts = self.extensions), $b !== false && $b !== nil ?exts['$postprocessors?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + ($a = ($b = exts.$postprocessors()).$each, $a._p = (TMP_13 = function(ext){var self = TMP_13._s || this; +if (ext == null) ext = nil; + return output = ext.$process_method()['$[]'](self, output)}, TMP_13._s = self, TMP_13), $a).call($b)}; + return output; + }; + + $opal.defn(self, '$render', def.$convert); + + def.$write = function(output, target) { + var $a, $b, TMP_14, $c, self = this; + + if ((($a = self.converter['$is_a?']($scope.Writer)) !== nil && (!$a._isBoolean || $a == true))) { + return self.converter.$write(output, target) + } else { + if ((($a = target['$respond_to?']("write")) !== nil && (!$a._isBoolean || $a == true))) { + target.$write(output.$chomp()); + target.$write($scope.EOL); + } else { + ($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)).$open, $a._p = (TMP_14 = function(f){var self = TMP_14._s || this; +if (f == null) f = nil; + return f.$write(output)}, TMP_14._s = self, TMP_14), $a).call($b, target, "w") + }; + return nil; + }; + }; + + def.$content = TMP_15 = function() {var $zuper = $slice.call(arguments, 0); + var self = this, $iter = TMP_15._p, $yield = $iter || nil; + + TMP_15._p = null; + self.attributes.$delete("title"); + return $opal.find_super_dispatcher(self, 'content', TMP_15, $iter).apply(self, $zuper); + }; + + def.$docinfo = function(pos, ext) { + var $a, $b, $c, self = this, $case = nil, qualifier = nil, content = nil, docinfo = nil, docinfo1 = nil, docinfo2 = nil, docinfo_filename = nil, docinfo_path = nil, content2 = nil; + + if (pos == null) { + pos = "header" + } + if (ext == null) { + ext = nil + } + if (self.$safe()['$>='](($scope.SafeMode)._scope.SECURE)) { + return "" + } else { + $case = pos;if ("footer"['$===']($case)) {qualifier = "-footer"}else {qualifier = nil}; + if ((($a = ext['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + ext = self.attributes['$[]']("outfilesuffix")}; + content = nil; + docinfo = self.attributes['$key?']("docinfo"); + docinfo1 = self.attributes['$key?']("docinfo1"); + docinfo2 = self.attributes['$key?']("docinfo2"); + docinfo_filename = "docinfo" + (qualifier) + (ext); + if ((($a = ((($b = docinfo1) !== false && $b !== nil) ? $b : docinfo2)) !== nil && (!$a._isBoolean || $a == true))) { + docinfo_path = self.$normalize_system_path(docinfo_filename); + content = self.$read_asset(docinfo_path); + if ((($a = content['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + if ((($a = $scope.FORCE_ENCODING) !== nil && (!$a._isBoolean || $a == true))) { + content.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8)}; + content = self.$sub_attributes(content.$split($scope.EOL))['$*']($scope.EOL); + };}; + if ((($a = ($b = (((($c = docinfo) !== false && $c !== nil) ? $c : docinfo2)), $b !== false && $b !== nil ?self.attributes['$key?']("docname") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_filename)); + content2 = self.$read_asset(docinfo_path); + if ((($a = content2['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + if ((($a = $scope.FORCE_ENCODING) !== nil && (!$a._isBoolean || $a == true))) { + content2.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8)}; + content2 = self.$sub_attributes(content2.$split($scope.EOL))['$*']($scope.EOL); + content = (function() {if ((($a = content['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return content2 + } else { + return "" + (content) + ($scope.EOL) + (content2) + }; return nil; })(); + };}; + return content.$to_s(); + }; + }; + + return (def.$to_s = function() { + var $a, self = this; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {doctype: " + (self.$doctype().$inspect()) + ", doctitle: " + (((function() {if ((($a = self.header['$=='](nil)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return self.header.$title() + } else { + return nil + }; return nil; })()).$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"; + }, nil) && 'to_s'; + })(self, $scope.AbstractBlock) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $Inline(){}; + var self = $Inline = $klass($base, $super, 'Inline', $Inline); + + var def = self._proto, $scope = self._scope, TMP_1; + + self.$attr_reader("text"); + + self.$attr_reader("type"); + + self.$attr_accessor("target"); + + def.$initialize = TMP_1 = function(parent, context, text, opts) { + var $a, self = this, $iter = TMP_1._p, $yield = $iter || nil, more_attributes = nil; + + if (text == null) { + text = nil + } + if (opts == null) { + opts = $hash2([], {}) + } + TMP_1._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, context]); + self.node_name = "inline_" + (context); + self.text = text; + self.id = opts['$[]']("id"); + self.type = opts['$[]']("type"); + self.target = opts['$[]']("target"); + if ((($a = ((more_attributes = opts['$[]']("attributes")))['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return self.$update_attributes(more_attributes) + }; + }; + + def['$block?'] = function() { + var self = this; + + return false; + }; + + def['$inline?'] = function() { + var self = this; + + return true; + }; + + def.$convert = function() { + var self = this; + + return self.$converter().$convert(self); + }; + + return $opal.defn(self, '$render', def.$convert); + })(self, $scope.AbstractNode) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $List(){}; + var self = $List = $klass($base, $super, 'List', $List); + + var def = self._proto, $scope = self._scope, TMP_1, TMP_2; + + def.blocks = def.context = def.document = def.style = nil; + $opal.defn(self, '$items', def.$blocks); + + $opal.defn(self, '$items?', def['$blocks?']); + + def.$initialize = TMP_1 = function(parent, context) {var $zuper = $slice.call(arguments, 0); + var self = this, $iter = TMP_1._p, $yield = $iter || nil; + + TMP_1._p = null; + return $opal.find_super_dispatcher(self, 'initialize', TMP_1, $iter).apply(self, $zuper); + }; + + def.$content = function() { + var self = this; + + return self.blocks; + }; + + def.$convert = TMP_2 = function() {var $zuper = $slice.call(arguments, 0); + var self = this, $iter = TMP_2._p, $yield = $iter || nil, result = nil; + + TMP_2._p = null; + if (self.context['$==']("colist")) { + result = $opal.find_super_dispatcher(self, 'convert', TMP_2, $iter).apply(self, $zuper); + self.document.$callouts().$next_list(); + return result; + } else { + return $opal.find_super_dispatcher(self, 'convert', TMP_2, $iter).apply(self, $zuper) + }; + }; + + $opal.defn(self, '$render', def.$convert); + + return (def.$to_s = function() { + var self = this; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", style: " + (self.style.$inspect()) + ", items: " + (self.$items().$size()) + "}>"; + }, nil) && 'to_s'; + })(self, $scope.AbstractBlock); + + (function($base, $super) { + function $ListItem(){}; + var self = $ListItem = $klass($base, $super, 'ListItem', $ListItem); + + var def = self._proto, $scope = self._scope, TMP_3; + + def.text = def.blocks = nil; + self.$attr_accessor("marker"); + + def.$initialize = TMP_3 = function(parent, text) { + var self = this, $iter = TMP_3._p, $yield = $iter || nil; + + if (text == null) { + text = nil + } + TMP_3._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_3, null).apply(self, [parent, "list_item"]); + self.text = text; + return self.level = parent.$level(); + }; + + def['$text?'] = function() { + var self = this; + + return self.text['$nil_or_empty?']()['$!'](); + }; + + def.$text = function() { + var self = this; + + return self.$apply_subs(self.text); + }; + + def.$fold_first = function(continuation_connects_first_block, content_adjacent) { + var $a, $b, $c, $d, $e, $f, self = this, first_block = nil, block = nil; + + if (continuation_connects_first_block == null) { + continuation_connects_first_block = false + } + if (content_adjacent == null) { + content_adjacent = false + } + if ((($a = ($b = ($c = (first_block = self.blocks['$[]'](0)), $c !== false && $c !== nil ?first_block['$is_a?']($scope.Block) : $c), $b !== false && $b !== nil ?(((($c = ((($d = first_block.$context()['$==']("paragraph")) ? continuation_connects_first_block['$!']() : $d))) !== false && $c !== nil) ? $c : (($d = ($e = (((($f = content_adjacent) !== false && $f !== nil) ? $f : continuation_connects_first_block['$!']())), $e !== false && $e !== nil ?first_block.$context()['$==']("literal") : $e), $d !== false && $d !== nil ?first_block['$option?']("listparagraph") : $d)))) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + block = self.$blocks().$shift(); + if ((($a = self.text['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + block.$lines().$unshift(self.text) + }; + self.text = block.$source();}; + return nil; + }; + + return (def.$to_s = function() { + var $a, self = this; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {list_context: " + (self.$parent().$context().$inspect()) + ", text: " + (self.text.$inspect()) + ", blocks: " + ((((($a = self.blocks) !== false && $a !== nil) ? $a : [])).$size()) + "}>"; + }, nil) && 'to_s'; + })(self, $scope.AbstractBlock); + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range, $gvars = $opal.gvars; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $Parser(){}; + var self = $Parser = $klass($base, $super, 'Parser', $Parser); + + var def = self._proto, $scope = self._scope; + + $opal.cdecl($scope, 'BlockMatchData', $scope.Struct.$new("context", "masq", "tip", "terminator")); + + def.$initialize = function() { + var self = this; + + return self.$raise("Au contraire, mon frere. No lexer instances will be running around."); + }; + + $opal.defs(self, '$parse', function(reader, document, options) { + var $a, $b, self = this, block_attributes = nil, new_section = nil; + + if (options == null) { + options = $hash2([], {}) + } + block_attributes = self.$parse_document_header(reader, document); + if ((($a = options['$[]']("header_only")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + while ((($b = reader['$has_more_lines?']()) !== nil && (!$b._isBoolean || $b == true))) { + $b = $opal.to_ary(self.$next_section(reader, document, block_attributes)), new_section = ($b[0] == null ? nil : $b[0]), block_attributes = ($b[1] == null ? nil : $b[1]); + if (new_section !== false && new_section !== nil) { + document['$<<'](new_section)};} + }; + return document; + }); + + $opal.defs(self, '$parse_document_header', function(reader, document) { + var $a, $b, self = this, block_attributes = nil, assigned_doctitle = nil, val = nil, section_title = nil, _ = nil, doctitle = nil; + + block_attributes = self.$parse_block_metadata_lines(reader, document); + if ((($a = block_attributes['$has_key?']("title")) !== nil && (!$a._isBoolean || $a == true))) { + return document.$finalize_header(block_attributes, false)}; + assigned_doctitle = nil; + if ((($a = ((val = document.$attributes()['$[]']("doctitle")))['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + document['$title='](val); + assigned_doctitle = val; + }; + section_title = nil; + if ((($a = self['$is_next_line_document_title?'](reader, block_attributes)) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(self.$parse_section_title(reader, document)), document['$id='](($a[0] == null ? nil : $a[0])), _ = ($a[1] == null ? nil : $a[1]), doctitle = ($a[2] == null ? nil : $a[2]), _ = ($a[3] == null ? nil : $a[3]), _ = ($a[4] == null ? nil : $a[4]); + if (assigned_doctitle !== false && assigned_doctitle !== nil) { + } else { + document['$title='](doctitle); + assigned_doctitle = doctitle; + }; + document.$attributes()['$[]=']("doctitle", section_title = doctitle); + if ((($a = document.$id()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + document['$id='](block_attributes.$delete("id")) + }; + self.$parse_header_metadata(reader, document);}; + if ((($a = ($b = ((val = document.$attributes()['$[]']("doctitle")))['$nil_or_empty?']()['$!'](), $b !== false && $b !== nil ?val['$=='](section_title)['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + document['$title='](val); + assigned_doctitle = val;}; + if (assigned_doctitle !== false && assigned_doctitle !== nil) { + document.$attributes()['$[]=']("doctitle", assigned_doctitle)}; + if (document.$doctype()['$==']("manpage")) { + self.$parse_manpage_header(reader, document)}; + return document.$finalize_header(block_attributes); + }); + + $opal.defs(self, '$parse_manpage_header', function(reader, document) { + var $a, self = this, m = nil, name_section = nil, name_section_buffer = nil; + + if ((($a = (m = $scope.ManpageTitleVolnumRx.$match(document.$attributes()['$[]']("doctitle")))) !== nil && (!$a._isBoolean || $a == true))) { + document.$attributes()['$[]=']("mantitle", document.$sub_attributes(m['$[]'](1).$rstrip().$downcase())); + document.$attributes()['$[]=']("manvolnum", m['$[]'](2).$strip()); + } else { + self.$warn("asciidoctor: ERROR: " + (reader.$prev_line_info()) + ": malformed manpage title") + }; + reader.$skip_blank_lines(); + if ((($a = self['$is_next_line_section?'](reader, $hash2([], {}))) !== nil && (!$a._isBoolean || $a == true))) { + name_section = self.$initialize_section(reader, document, $hash2([], {})); + if (name_section.$level()['$=='](1)) { + name_section_buffer = reader.$read_lines_until($hash2(["break_on_blank_lines"], {"break_on_blank_lines": true})).$join(" ").$tr_s(" ", " "); + if ((($a = (m = $scope.ManpageNamePurposeRx.$match(name_section_buffer))) !== nil && (!$a._isBoolean || $a == true))) { + document.$attributes()['$[]=']("manname", m['$[]'](1)); + document.$attributes()['$[]=']("manpurpose", m['$[]'](2)); + if (document.$backend()['$==']("manpage")) { + document.$attributes()['$[]=']("docname", document.$attributes()['$[]']("manname")); + return document.$attributes()['$[]=']("outfilesuffix", "." + (document.$attributes()['$[]']("manvolnum"))); + } else { + return nil + }; + } else { + return self.$warn("asciidoctor: ERROR: " + (reader.$prev_line_info()) + ": malformed name section body") + }; + } else { + return self.$warn("asciidoctor: ERROR: " + (reader.$prev_line_info()) + ": name section title must be at level 1") + }; + } else { + return self.$warn("asciidoctor: ERROR: " + (reader.$prev_line_info()) + ": name section expected") + }; + }); + + $opal.defs(self, '$next_section', function(reader, parent, attributes) { + var $a, $b, $c, $d, self = this, preamble = nil, part = nil, intro = nil, has_header = nil, doctype = nil, section = nil, current_level = nil, expected_next_levels = nil, title = nil, next_level = nil, new_section = nil, block_line_info = nil, new_block = nil, first_block = nil, document = nil, child_block = nil; + + if (attributes == null) { + attributes = $hash2([], {}) + } + preamble = false; + part = false; + intro = false; + if ((($a = ($b = (($c = parent.$context()['$==']("document")) ? parent.$blocks()['$empty?']() : $c), $b !== false && $b !== nil ?(((($c = ((($d = (has_header = parent['$has_header?']())) !== false && $d !== nil) ? $d : attributes.$delete("invalid-header"))) !== false && $c !== nil) ? $c : self['$is_next_line_section?'](reader, attributes)['$!']())) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + doctype = parent.$doctype(); + if (has_header !== false && has_header !== nil) { + preamble = intro = $scope.Block.$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"})); + parent['$<<'](preamble);}; + section = parent; + current_level = 0; + if ((($a = parent.$attributes()['$has_key?']("fragment")) !== nil && (!$a._isBoolean || $a == true))) { + expected_next_levels = nil + } else if (doctype['$==']("book")) { + expected_next_levels = [0, 1] + } else { + expected_next_levels = [1] + }; + } else { + doctype = parent.$document().$doctype(); + section = self.$initialize_section(reader, parent, attributes); + attributes = (function() {if ((($a = (title = attributes['$[]']("title"))) !== nil && (!$a._isBoolean || $a == true))) { + return $hash2(["title"], {"title": title}) + } else { + return $hash2([], {}) + }; return nil; })(); + current_level = section.$level(); + if ((($a = (($b = current_level['$=='](0)) ? doctype['$==']("book") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + part = section.$special()['$!'](); + if ((($a = ($b = section.$special(), $b !== false && $b !== nil ?(["preface", "appendix"]['$include?'](section.$sectname())) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + expected_next_levels = [current_level['$+'](2)] + } else { + expected_next_levels = [current_level['$+'](1)] + }; + } else { + expected_next_levels = [current_level['$+'](1)] + }; + }; + reader.$skip_blank_lines(); + while ((($b = reader['$has_more_lines?']()) !== nil && (!$b._isBoolean || $b == true))) { + self.$parse_block_metadata_lines(reader, section, attributes); + if ((($b = (next_level = self['$is_next_line_section?'](reader, attributes))) !== nil && (!$b._isBoolean || $b == true))) { + next_level = next_level['$+'](section.$document().$attr("leveloffset", 0).$to_i()); + if ((($b = ((($c = next_level['$>'](current_level)) !== false && $c !== nil) ? $c : ((($d = section.$context()['$==']("document")) ? next_level['$=='](0) : $d)))) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = (($c = next_level['$=='](0)) ? doctype['$==']("book")['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + self.$warn("asciidoctor: ERROR: " + (reader.$line_info()) + ": only book doctypes can contain level 0 sections") + } else if ((($b = (($c = expected_next_levels !== false && expected_next_levels !== nil) ? expected_next_levels['$include?'](next_level)['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + self.$warn(((("asciidoctor: WARNING: ") + (reader.$line_info())) + ": section title out of sequence: ")['$+']("expected " + ((function() {if (expected_next_levels.$size()['$>'](1)) { + return "levels" + } else { + return "level" + }; return nil; })()) + " " + (expected_next_levels['$*'](" or ")) + ", ")['$+']("got level " + (next_level)))}; + $b = $opal.to_ary(self.$next_section(reader, section, attributes)), new_section = ($b[0] == null ? nil : $b[0]), attributes = ($b[1] == null ? nil : $b[1]); + section['$<<'](new_section); + } else { + if ((($b = (($c = next_level['$=='](0)) ? doctype['$==']("book")['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + self.$warn("asciidoctor: ERROR: " + (reader.$line_info()) + ": only book doctypes can contain level 0 sections")}; + break;; + }; + } else { + block_line_info = reader.$line_info(); + if ((($b = (new_block = self.$next_block(reader, (((($c = intro) !== false && $c !== nil) ? $c : section)), attributes, $hash2(["parse_metadata"], {"parse_metadata": false})))) !== nil && (!$b._isBoolean || $b == true))) { + if (part !== false && part !== nil) { + if ((($b = section['$blocks?']()['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = new_block.$style()['$==']("partintro")['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + if (new_block.$context()['$==']("paragraph")) { + new_block['$context=']("open"); + new_block['$style=']("partintro"); + } else { + intro = $scope.Block.$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})); + intro['$style=']("partintro"); + new_block['$parent='](intro); + section['$<<'](intro); + }} + } else if (section.$blocks().$size()['$=='](1)) { + first_block = section.$blocks()['$[]'](0); + if ((($b = ($c = intro['$!'](), $c !== false && $c !== nil ?first_block.$content_model()['$==']("compound") : $c)) !== nil && (!$b._isBoolean || $b == true))) { + self.$warn("asciidoctor: ERROR: " + (block_line_info) + ": illegal block content outside of partintro block") + } else if ((($b = first_block.$content_model()['$==']("compound")['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + intro = $scope.Block.$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})); + intro['$style=']("partintro"); + section.$blocks().$shift(); + if (first_block.$style()['$==']("partintro")) { + first_block['$context=']("paragraph"); + first_block['$style='](nil);}; + first_block['$parent='](intro); + intro['$<<'](first_block); + new_block['$parent='](intro); + section['$<<'](intro);};}}; + (((($b = intro) !== false && $b !== nil) ? $b : section))['$<<'](new_block); + attributes = $hash2([], {});}; + }; + reader.$skip_blank_lines();}; + if (part !== false && part !== nil) { + if ((($a = ($b = section['$blocks?'](), $b !== false && $b !== nil ?section.$blocks()['$[]'](-1).$context()['$==']("section") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$warn("asciidoctor: ERROR: " + (reader.$line_info()) + ": invalid part, must have at least one section (e.g., chapter, appendix, etc.)") + } + } else if (preamble !== false && preamble !== nil) { + document = parent; + if ((($a = preamble['$blocks?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ($b = ($c = $scope.Compliance.$unwrap_standalone_preamble(), $c !== false && $c !== nil ?document.$blocks().$size()['$=='](1) : $c), $b !== false && $b !== nil ?(((($c = doctype['$==']("book")['$!']()) !== false && $c !== nil) ? $c : preamble.$blocks()['$[]'](0).$style()['$==']("abstract")['$!']())) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + document.$blocks().$shift(); + while ((($b = (child_block = preamble.$blocks().$shift())) !== nil && (!$b._isBoolean || $b == true))) { + child_block['$parent='](document); + document['$<<'](child_block);};} + } else { + document.$blocks().$shift() + };}; + return [(function() {if ((($a = section['$=='](parent)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return section + } else { + return nil + }; return nil; })(), attributes.$dup()]; + }); + + $opal.defs(self, '$next_block', function(reader, parent, attributes, options) { + var $a, $b, $c, $d, $e, TMP_1, $f, TMP_2, $g, TMP_3, TMP_4, $h, $i, TMP_5, $j, $k, $l, TMP_6, TMP_7, self = this, skipped = nil, text_only = nil, parse_metadata = nil, document = nil, extensions = nil, block_extensions = nil, block_macro_extensions = nil, in_list = nil, block = nil, style = nil, explicit_style = nil, this_line = nil, delimited_block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_blk_match = nil, first_char = nil, match = nil, blk_ctx = nil, posattrs = nil, target = nil, extension = nil, raw_attributes = nil, default_attrs = nil, expected_index = nil, list_item = nil, coids = nil, marker = nil, float_id = nil, float_reftext = nil, float_title = nil, float_level = nil, _ = nil, tmp_sect = nil, break_at_list = nil, lines = nil, first_line = nil, admonition_match = nil, admonition_name = nil, attribution = nil, citetitle = nil, first_line_shifted = nil, indent = nil, $case = nil, language = nil, linenums = nil, default_math_syntax = nil, cursor = nil, block_reader = nil, content_model = nil, pos_attrs = nil, resolved_target = nil, scaledwidth = nil, block_id = nil; + + if (attributes == null) { + attributes = $hash2([], {}) + } + if (options == null) { + options = $hash2([], {}) + } + skipped = reader.$skip_blank_lines(); + if ((($a = reader['$has_more_lines?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return nil + }; + if ((($a = ($b = (text_only = options['$[]']("text")), $b !== false && $b !== nil ?skipped['$>'](0) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + options.$delete("text"); + text_only = false;}; + parse_metadata = options.$fetch("parse_metadata", true); + document = parent.$document(); + if ((($a = (extensions = document.$extensions())) !== nil && (!$a._isBoolean || $a == true))) { + block_extensions = extensions['$blocks?'](); + block_macro_extensions = extensions['$block_macros?'](); + } else { + block_extensions = block_macro_extensions = false + }; + in_list = (parent['$is_a?']($scope.List)); + block = nil; + style = nil; + explicit_style = nil; + while ((($b = ($c = block['$!'](), $c !== false && $c !== nil ?reader['$has_more_lines?']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = (($c = parse_metadata !== false && parse_metadata !== nil) ? self.$parse_block_metadata_line(reader, document, attributes, options) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + reader.$advance(); + continue;;}; + this_line = reader.$read_line(); + delimited_block = false; + block_context = nil; + cloaked_context = nil; + terminator = nil; + if ((($b = attributes['$[]'](1)) !== nil && (!$b._isBoolean || $b == true))) { + $b = $opal.to_ary(self.$parse_style_attribute(attributes, reader)), style = ($b[0] == null ? nil : $b[0]), explicit_style = ($b[1] == null ? nil : $b[1])}; + if ((($b = (delimited_blk_match = self['$is_delimited_block?'](this_line, true))) !== nil && (!$b._isBoolean || $b == true))) { + delimited_block = true; + block_context = cloaked_context = delimited_blk_match.$context(); + terminator = delimited_blk_match.$terminator(); + if ((($b = style['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + style = attributes['$[]=']("style", block_context.$to_s()) + } else if ((($b = style['$=='](block_context.$to_s())['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = delimited_blk_match.$masq()['$include?'](style)) !== nil && (!$b._isBoolean || $b == true))) { + block_context = style.$to_sym() + } else if ((($b = ($c = delimited_blk_match.$masq()['$include?']("admonition"), $c !== false && $c !== nil ?$scope.ADMONITION_STYLES['$include?'](style) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + block_context = "admonition" + } else if ((($b = (($c = block_extensions !== false && block_extensions !== nil) ? extensions['$registered_for_block?'](style, block_context) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + block_context = style.$to_sym() + } else { + self.$warn("asciidoctor: WARNING: " + (reader.$prev_line_info()) + ": invalid style for " + (block_context) + " block: " + (style)); + style = block_context.$to_s(); + }};}; + if (delimited_block !== false && delimited_block !== nil) { + } else { + while ((($c = true) !== nil && (!$c._isBoolean || $c == true))) { + if ((($c = ($d = (($e = style !== false && style !== nil) ? $scope.Compliance.$strict_verbatim_paragraphs() : $e), $d !== false && $d !== nil ?$scope.VERBATIM_STYLES['$include?'](style) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + block_context = style.$to_sym(); + reader.$unshift_line(this_line); + break;;}; + if (text_only !== false && text_only !== nil) { + } else { + first_char = (function() {if ((($c = $scope.Compliance.$markdown_syntax()) !== nil && (!$c._isBoolean || $c == true))) { + return this_line.$lstrip().$chr() + } else { + return this_line.$chr() + }; return nil; })(); + if ((($c = ($d = ($e = ($scope.LAYOUT_BREAK_LINES['$has_key?'](first_char)), $e !== false && $e !== nil ?this_line.$length()['$>='](3) : $e), $d !== false && $d !== nil ?((function() {if ((($e = $scope.Compliance.$markdown_syntax()) !== nil && (!$e._isBoolean || $e == true))) { + return $scope.LayoutBreakLinePlusRx + } else { + return $scope.LayoutBreakLineRx + }; return nil; })())['$=~'](this_line) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + block = $scope.Block.$new(parent, $scope.LAYOUT_BREAK_LINES['$[]'](first_char), $hash2(["content_model"], {"content_model": "empty"})); + break;; + } else if ((($c = ($d = this_line['$end_with?']("]"), $d !== false && $d !== nil ?(match = $scope.MediaBlockMacroRx.$match(this_line)) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + blk_ctx = match['$[]'](1).$to_sym(); + block = $scope.Block.$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"})); + if (blk_ctx['$==']("image")) { + posattrs = ["alt", "width", "height"] + } else if (blk_ctx['$==']("video")) { + posattrs = ["poster", "width", "height"] + } else { + posattrs = [] + }; + if ((($c = ((($d = style['$!']()) !== false && $d !== nil) ? $d : explicit_style)) !== nil && (!$c._isBoolean || $c == true))) { + } else { + if (blk_ctx['$==']("image")) { + attributes['$[]=']("alt", style)}; + attributes.$delete("style"); + style = nil; + }; + block.$parse_attributes(match['$[]'](3), posattrs, $hash2(["unescape_input", "sub_input", "sub_result", "into"], {"unescape_input": (blk_ctx['$==']("image")), "sub_input": true, "sub_result": false, "into": attributes})); + target = block.$sub_attributes(match['$[]'](2), $hash2(["attribute_missing"], {"attribute_missing": "drop-line"})); + if ((($c = target['$empty?']()) !== nil && (!$c._isBoolean || $c == true))) { + if (document.$attributes().$fetch("attribute-missing", $scope.Compliance.$attribute_missing())['$==']("skip")) { + return $scope.Block.$new(parent, "paragraph", $hash2(["content_model", "source"], {"content_model": "simple", "source": [this_line]})) + } else { + attributes.$clear(); + return nil; + }}; + attributes['$[]=']("target", target); + break;; + } else if ((($c = (($d = first_char['$==']("t")) ? (match = $scope.TocBlockMacroRx.$match(this_line)) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + block = $scope.Block.$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"})); + block.$parse_attributes(match['$[]'](1), [], $hash2(["sub_result", "into"], {"sub_result": false, "into": attributes})); + break;; + } else if ((($c = ($d = (($e = block_macro_extensions !== false && block_macro_extensions !== nil) ? (match = $scope.GenericBlockMacroRx.$match(this_line)) : $e), $d !== false && $d !== nil ?(extension = extensions['$registered_for_block_macro?'](match['$[]'](1))) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + target = match['$[]'](2); + raw_attributes = match['$[]'](3); + if (extension.$config()['$[]']("content_model")['$==']("attributes")) { + if ((($c = raw_attributes['$empty?']()) !== nil && (!$c._isBoolean || $c == true))) { + } else { + document.$parse_attributes(raw_attributes, (((($c = extension.$config()['$[]']("pos_attrs")) !== false && $c !== nil) ? $c : [])), $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": false, "into": attributes})) + } + } else { + attributes['$[]=']("text", raw_attributes) + }; + if ((($c = (default_attrs = extension.$config()['$[]']("default_attrs"))) !== nil && (!$c._isBoolean || $c == true))) { + ($c = ($d = default_attrs).$each, $c._p = (TMP_1 = function(k, v){var self = TMP_1._s || this, $a, $b, $c; +if (k == null) k = nil;if (v == null) v = nil; + return ($a = k, $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, v)))}, TMP_1._s = self, TMP_1), $c).call($d)}; + if ((($c = (block = extension.$process_method()['$[]'](parent, target, attributes.$dup()))) !== nil && (!$c._isBoolean || $c == true))) { + attributes.$replace(block.$attributes()) + } else { + attributes.$clear(); + return nil; + }; + break;;}; + }; + if ((($c = (match = $scope.CalloutListRx.$match(this_line))) !== nil && (!$c._isBoolean || $c == true))) { + block = $scope.List.$new(parent, "colist"); + attributes['$[]=']("style", "arabic"); + reader.$unshift_line(this_line); + expected_index = 1; + while ((($e = ($f = reader['$has_more_lines?'](), $f !== false && $f !== nil ?(match = $scope.CalloutListRx.$match(reader.$peek_line())) : $f)) !== nil && (!$e._isBoolean || $e == true))) { + if ((($e = match['$[]'](1).$to_i()['$=='](expected_index)['$!']()) !== nil && (!$e._isBoolean || $e == true))) { + self.$warn("asciidoctor: WARNING: " + (reader.$path()) + ": line " + (reader.$lineno()['$-'](2)) + ": callout list item index: expected " + (expected_index) + " got " + (match['$[]'](1)))}; + list_item = self.$next_list_item(reader, block, match); + expected_index = expected_index['$+'](1); + if (list_item !== false && list_item !== nil) { + block['$<<'](list_item); + coids = document.$callouts().$callout_ids(block.$items().$size()); + if ((($e = coids['$empty?']()['$!']()) !== nil && (!$e._isBoolean || $e == true))) { + list_item.$attributes()['$[]=']("coids", coids) + } else { + self.$warn("asciidoctor: WARNING: " + (reader.$path()) + ": line " + (reader.$lineno()['$-'](2)) + ": no callouts refer to list item " + (block.$items().$size())) + };};}; + document.$callouts().$next_list(); + break;; + } else if ((($c = $scope.UnorderedListRx['$=~'](this_line)) !== nil && (!$c._isBoolean || $c == true))) { + reader.$unshift_line(this_line); + block = self.$next_outline_list(reader, "ulist", parent); + break;; + } else if ((($c = (match = $scope.OrderedListRx.$match(this_line))) !== nil && (!$c._isBoolean || $c == true))) { + reader.$unshift_line(this_line); + block = self.$next_outline_list(reader, "olist", parent); + if ((($c = ($e = attributes['$[]']("style")['$!'](), $e !== false && $e !== nil ?block.$attributes()['$[]']("style")['$!']() : $e)) !== nil && (!$c._isBoolean || $c == true))) { + marker = block.$items()['$[]'](0).$marker(); + if ((($c = marker['$start_with?'](".")) !== nil && (!$c._isBoolean || $c == true))) { + attributes['$[]=']("style", (((($c = $scope.ORDERED_LIST_STYLES['$[]'](marker.$length()['$-'](1))) !== false && $c !== nil) ? $c : $scope.ORDERED_LIST_STYLES['$[]'](0))).$to_s()) + } else { + style = ($c = ($e = $scope.ORDERED_LIST_STYLES).$detect, $c._p = (TMP_2 = function(s){var self = TMP_2._s || this; +if (s == null) s = nil; + return $scope.OrderedListMarkerRxMap['$[]'](s)['$=~'](marker)}, TMP_2._s = self, TMP_2), $c).call($e); + attributes['$[]=']("style", (((($c = style) !== false && $c !== nil) ? $c : $scope.ORDERED_LIST_STYLES['$[]'](0))).$to_s()); + };}; + break;; + } else if ((($c = (match = $scope.DefinitionListRx.$match(this_line))) !== nil && (!$c._isBoolean || $c == true))) { + reader.$unshift_line(this_line); + block = self.$next_labeled_list(reader, match, parent); + break;; + } else if ((($c = ($f = (((($g = style['$==']("float")) !== false && $g !== nil) ? $g : style['$==']("discrete"))), $f !== false && $f !== nil ?self['$is_section_title?'](this_line, ((function() {if ((($g = $scope.Compliance.$underline_style_section_titles()) !== nil && (!$g._isBoolean || $g == true))) { + return reader.$peek_line(true) + } else { + return nil + }; return nil; })())) : $f)) !== nil && (!$c._isBoolean || $c == true))) { + reader.$unshift_line(this_line); + $c = $opal.to_ary(self.$parse_section_title(reader, document)), float_id = ($c[0] == null ? nil : $c[0]), float_reftext = ($c[1] == null ? nil : $c[1]), float_title = ($c[2] == null ? nil : $c[2]), float_level = ($c[3] == null ? nil : $c[3]), _ = ($c[4] == null ? nil : $c[4]); + if (float_reftext !== false && float_reftext !== nil) { + attributes['$[]=']("reftext", float_reftext)}; + if ((($c = attributes['$has_key?']("id")) !== nil && (!$c._isBoolean || $c == true))) { + ((($c = float_id) !== false && $c !== nil) ? $c : float_id = attributes['$[]']("id"))}; + block = $scope.Block.$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"})); + if ((($c = float_id['$nil_or_empty?']()) !== nil && (!$c._isBoolean || $c == true))) { + tmp_sect = $scope.Section.$new(parent); + tmp_sect['$title='](float_title); + block['$id='](tmp_sect.$generate_id()); + } else { + block['$id='](float_id) + }; + block['$level='](float_level); + block['$title='](float_title); + break;; + } else if ((($c = (($f = style !== false && style !== nil) ? style['$==']("normal")['$!']() : $f)) !== nil && (!$c._isBoolean || $c == true))) { + if ((($c = $scope.PARAGRAPH_STYLES['$include?'](style)) !== nil && (!$c._isBoolean || $c == true))) { + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ((($c = $scope.ADMONITION_STYLES['$include?'](style)) !== nil && (!$c._isBoolean || $c == true))) { + block_context = "admonition"; + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else if ((($c = (($f = block_extensions !== false && block_extensions !== nil) ? extensions['$registered_for_block?'](style, "paragraph") : $f)) !== nil && (!$c._isBoolean || $c == true))) { + block_context = style.$to_sym(); + cloaked_context = "paragraph"; + reader.$unshift_line(this_line); + break;; + } else { + self.$warn("asciidoctor: WARNING: " + (reader.$prev_line_info()) + ": invalid style for paragraph: " + (style)); + style = nil; + }}; + break_at_list = ((($c = skipped['$=='](0)) ? in_list : $c)); + if ((($c = ($f = style['$==']("normal")['$!'](), $f !== false && $f !== nil ?$scope.LiteralParagraphRx['$=~'](this_line) : $f)) !== nil && (!$c._isBoolean || $c == true))) { + reader.$unshift_line(this_line); + lines = ($c = ($f = reader).$read_lines_until, $c._p = (TMP_3 = function(line){var self = TMP_3._s || this, $a, $b, $c; +if (line == null) line = nil; + return ((($a = ((($b = break_at_list !== false && break_at_list !== nil) ? $scope.AnyListRx['$=~'](line) : $b))) !== false && $a !== nil) ? $a : (($b = $scope.Compliance.$block_terminates_paragraph(), $b !== false && $b !== nil ?(((($c = self['$is_delimited_block?'](line)) !== false && $c !== nil) ? $c : $scope.BlockAttributeLineRx['$=~'](line))) : $b)))}, TMP_3._s = self, TMP_3), $c).call($f, $hash2(["break_on_blank_lines", "break_on_list_continuation", "preserve_last_line"], {"break_on_blank_lines": true, "break_on_list_continuation": true, "preserve_last_line": true})); + self['$reset_block_indent!'](lines); + block = $scope.Block.$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes})); + if (in_list !== false && in_list !== nil) { + block.$set_option("listparagraph")}; + } else { + reader.$unshift_line(this_line); + lines = ($c = ($g = reader).$read_lines_until, $c._p = (TMP_4 = function(line){var self = TMP_4._s || this, $a, $b, $c; +if (line == null) line = nil; + return ((($a = ((($b = break_at_list !== false && break_at_list !== nil) ? $scope.AnyListRx['$=~'](line) : $b))) !== false && $a !== nil) ? $a : (($b = $scope.Compliance.$block_terminates_paragraph(), $b !== false && $b !== nil ?(((($c = self['$is_delimited_block?'](line)) !== false && $c !== nil) ? $c : $scope.BlockAttributeLineRx['$=~'](line))) : $b)))}, TMP_4._s = self, TMP_4), $c).call($g, $hash2(["break_on_blank_lines", "break_on_list_continuation", "preserve_last_line", "skip_line_comments"], {"break_on_blank_lines": true, "break_on_list_continuation": true, "preserve_last_line": true, "skip_line_comments": true})); + if ((($c = lines['$empty?']()) !== nil && (!$c._isBoolean || $c == true))) { + reader.$advance(); + return nil;}; + self.$catalog_inline_anchors(lines.$join($scope.EOL), document); + first_line = lines['$[]'](0); + if ((($c = ($h = text_only['$!'](), $h !== false && $h !== nil ?(admonition_match = $scope.AdmonitionParagraphRx.$match(first_line)) : $h)) !== nil && (!$c._isBoolean || $c == true))) { + lines['$[]='](0, admonition_match.$post_match().$lstrip()); + attributes['$[]=']("style", admonition_match['$[]'](1)); + attributes['$[]=']("name", admonition_name = admonition_match['$[]'](1).$downcase()); + ($c = "caption", $h = attributes, ((($i = $h['$[]']($c)) !== false && $i !== nil) ? $i : $h['$[]=']($c, document.$attributes()['$[]']("" + (admonition_name) + "-caption")))); + block = $scope.Block.$new(parent, "admonition", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else if ((($c = ($h = ($i = text_only['$!'](), $i !== false && $i !== nil ?$scope.Compliance.$markdown_syntax() : $i), $h !== false && $h !== nil ?first_line['$start_with?']("> ") : $h)) !== nil && (!$c._isBoolean || $c == true))) { + ($c = ($h = lines)['$map!'], $c._p = (TMP_5 = function(line){var self = TMP_5._s || this, $a; +if (line == null) line = nil; + if (line['$=='](">")) { + return line['$[]']($range(1, -1, false)) + } else if ((($a = line['$start_with?']("> ")) !== nil && (!$a._isBoolean || $a == true))) { + return line['$[]']($range(2, -1, false)) + } else { + return line + }}, TMP_5._s = self, TMP_5), $c).call($h); + if ((($c = lines['$[]'](-1)['$start_with?']("-- ")) !== nil && (!$c._isBoolean || $c == true))) { + $c = $opal.to_ary(lines.$pop()['$[]']($range(3, -1, false)).$split(", ", 2)), attribution = ($c[0] == null ? nil : $c[0]), citetitle = ($c[1] == null ? nil : $c[1]); + while ((($i = lines['$[]'](-1)['$empty?']()) !== nil && (!$i._isBoolean || $i == true))) { + lines.$pop()}; + } else { + $c = $opal.to_ary(nil), attribution = ($c[0] == null ? nil : $c[0]), citetitle = ($c[1] == null ? nil : $c[1]) + }; + attributes['$[]=']("style", "quote"); + if (attribution !== false && attribution !== nil) { + attributes['$[]=']("attribution", attribution)}; + if (citetitle !== false && citetitle !== nil) { + attributes['$[]=']("citetitle", citetitle)}; + block = self.$build_block("quote", "compound", false, parent, $scope.Reader.$new(lines), attributes); + } else if ((($c = ($i = ($j = ($k = ($l = text_only['$!'](), $l !== false && $l !== nil ?lines.$size()['$>'](1) : $l), $k !== false && $k !== nil ?first_line['$start_with?']("\"") : $k), $j !== false && $j !== nil ?lines['$[]'](-1)['$start_with?']("-- ") : $j), $i !== false && $i !== nil ?lines['$[]'](-2)['$end_with?']("\"") : $i)) !== nil && (!$c._isBoolean || $c == true))) { + lines['$[]='](0, first_line['$[]']($range(1, -1, false))); + $c = $opal.to_ary(lines.$pop()['$[]']($range(3, -1, false)).$split(", ", 2)), attribution = ($c[0] == null ? nil : $c[0]), citetitle = ($c[1] == null ? nil : $c[1]); + while ((($i = lines['$[]'](-1)['$empty?']()) !== nil && (!$i._isBoolean || $i == true))) { + lines.$pop()}; + lines['$[]='](-1, lines['$[]'](-1).$chop()); + attributes['$[]=']("style", "quote"); + if (attribution !== false && attribution !== nil) { + attributes['$[]=']("attribution", attribution)}; + if (citetitle !== false && citetitle !== nil) { + attributes['$[]=']("citetitle", citetitle)}; + block = $scope.Block.$new(parent, "quote", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + } else { + if ((($c = (($i = style['$==']("normal")) ? (((($j = ((first_char = lines['$[]'](0).$chr()))['$=='](" ")) !== false && $j !== nil) ? $j : first_char['$==']($scope.TAB))) : $i)) !== nil && (!$c._isBoolean || $c == true))) { + first_line = lines['$[]'](0); + first_line_shifted = first_line.$lstrip(); + indent = self.$line_length(first_line)['$-'](self.$line_length(first_line_shifted)); + lines['$[]='](0, first_line_shifted); + ($c = ($i = lines.$size()).$times, $c._p = (TMP_6 = function(i){var self = TMP_6._s || this; +if (i == null) i = nil; + if (i['$>'](0)) { + return lines['$[]='](i, lines['$[]'](i)['$[]']($range(indent, -1, false))) + } else { + return nil + }}, TMP_6._s = self, TMP_6), $c).call($i);}; + block = $scope.Block.$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes})); + }; + }; + break;;} + }; + if ((($b = ($c = block['$!'](), $c !== false && $c !== nil ?block_context : $c)) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = ((($c = block_context['$==']("abstract")) !== false && $c !== nil) ? $c : block_context['$==']("partintro"))) !== nil && (!$b._isBoolean || $b == true))) { + block_context = "open"}; + $case = block_context;if ("admonition"['$===']($case)) {attributes['$[]=']("name", admonition_name = style.$downcase()); + ($b = "caption", $c = attributes, ((($j = $c['$[]']($b)) !== false && $j !== nil) ? $j : $c['$[]=']($b, document.$attributes()['$[]']("" + (admonition_name) + "-caption")))); + block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);}else if ("comment"['$===']($case)) {self.$build_block(block_context, "skip", terminator, parent, reader, attributes); + return nil;}else if ("example"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)}else if ("listing"['$===']($case) || "fenced_code"['$===']($case) || "source"['$===']($case)) {if (block_context['$==']("fenced_code")) { + style = attributes['$[]=']("style", "source"); + $b = $opal.to_ary(this_line['$[]']($range(3, -1, false)).$split(",", 2)), language = ($b[0] == null ? nil : $b[0]), linenums = ($b[1] == null ? nil : $b[1]); + if ((($b = (($c = language !== false && language !== nil) ? ((language = language.$strip()))['$empty?']()['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + attributes['$[]=']("language", language); + if ((($b = (($c = linenums !== false && linenums !== nil) ? linenums.$strip()['$empty?']()['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + attributes['$[]=']("linenums", "")};}; + terminator = terminator['$[]']($range(0, 2, false)); + } else if (block_context['$==']("source")) { + $scope.AttributeList.$rekey(attributes, [nil, "language", "linenums"])}; + block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);}else if ("literal"['$===']($case)) {block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes)}else if ("pass"['$===']($case)) {block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes)}else if ("math"['$===']($case) || "latexmath"['$===']($case) || "asciimath"['$===']($case)) {if (block_context['$==']("math")) { + attributes['$[]=']("style", (function() {if ((($b = ((default_math_syntax = document.$attributes()['$[]']("math")))['$nil_or_empty?']()) !== nil && (!$b._isBoolean || $b == true))) { + return "asciimath" + } else { + return default_math_syntax + }; return nil; })())}; + block = self.$build_block("math", "raw", terminator, parent, reader, attributes);}else if ("open"['$===']($case) || "sidebar"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)}else if ("table"['$===']($case)) {cursor = reader.$cursor(); + block_reader = $scope.Reader.$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments"], {"terminator": terminator, "skip_line_comments": true})), cursor); + $case = terminator.$chr();if (","['$===']($case)) {attributes['$[]=']("format", "csv")}else if (":"['$===']($case)) {attributes['$[]=']("format", "dsv")}; + block = self.$next_table(block_reader, parent, attributes);}else if ("quote"['$===']($case) || "verse"['$===']($case)) {$scope.AttributeList.$rekey(attributes, [nil, "attribution", "citetitle"]); + block = self.$build_block(block_context, ((function() {if (block_context['$==']("verse")) { + return "verbatim" + } else { + return "compound" + }; return nil; })()), terminator, parent, reader, attributes);}else {if ((($b = (($c = block_extensions !== false && block_extensions !== nil) ? (extension = extensions['$registered_for_block?'](block_context, cloaked_context)) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = ((content_model = extension.$config()['$[]']("content_model")))['$==']("skip")['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = ((pos_attrs = ((($c = extension.$config()['$[]']("pos_attrs")) !== false && $c !== nil) ? $c : [])))['$empty?']()['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + $scope.AttributeList.$rekey(attributes, [nil].$concat(pos_attrs))}; + if ((($b = (default_attrs = extension.$config()['$[]']("default_attrs"))) !== nil && (!$b._isBoolean || $b == true))) { + ($b = ($c = default_attrs).$each, $b._p = (TMP_7 = function(k, v){var self = TMP_7._s || this, $a, $b, $c; +if (k == null) k = nil;if (v == null) v = nil; + return ($a = k, $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, v)))}, TMP_7._s = self, TMP_7), $b).call($c)};}; + block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["extension"], {"extension": extension})); + if ((($b = (($j = block !== false && block !== nil) ? content_model['$==']("skip")['$!']() : $j)) !== nil && (!$b._isBoolean || $b == true))) { + } else { + attributes.$clear(); + return nil; + }; + } else { + self.$raise("Unsupported block type " + (block_context) + " at " + (reader.$line_info())) + }};};}; + if (block !== false && block !== nil) { + if ((($a = block['$title?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + block['$title='](attributes['$[]']("title")) + }; + if (block.$context()['$==']("image")) { + resolved_target = attributes['$[]']("target"); + block.$document().$register("images", resolved_target); + ($a = "alt", $b = attributes, ((($j = $b['$[]']($a)) !== false && $j !== nil) ? $j : $b['$[]=']($a, (($k = $opal.Object._scope.File) == null ? $opal.cm('File') : $k).$basename(resolved_target, (($k = $opal.Object._scope.File) == null ? $opal.cm('File') : $k).$extname(resolved_target)).$tr("_-", " ")))); + block.$assign_caption(attributes.$delete("caption"), "figure"); + if ((($a = (scaledwidth = attributes['$[]']("scaledwidth"))) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ($range(48, 57, false))['$include?']((((($b = scaledwidth['$[]'](-1)) !== false && $b !== nil) ? $b : 0)).$ord())) !== nil && (!$a._isBoolean || $a == true))) { + attributes['$[]=']("scaledwidth", "" + (scaledwidth) + "%")}}; + } else { + ($a = block, ((($b = $a.$caption()) !== false && $b !== nil) ? $b : $a['$caption='](attributes.$delete("caption")))) + }; + block['$style='](attributes['$[]']("style")); + if ((($a = (block_id = (($b = block, ((($j = $b.$id()) !== false && $j !== nil) ? $j : $b['$id='](attributes['$[]']("id"))))))) !== nil && (!$a._isBoolean || $a == true))) { + document.$register("ids", [block_id, (((($a = attributes['$[]']("reftext")) !== false && $a !== nil) ? $a : ((function() {if ((($b = block['$title?']()) !== nil && (!$b._isBoolean || $b == true))) { + return block.$title() + } else { + return nil + }; return nil; })())))])}; + if ((($a = attributes['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + block.$attributes().$update(attributes) + }; + block.$lock_in_subs(); + if ((($a = block['$sub?']("callouts")) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = (self.$catalog_callouts(block.$source(), document))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + block.$remove_sub("callouts") + }};}; + return block; + }); + + $opal.defs(self, '$is_delimited_block?', function(line, return_match_data) { + var $a, $b, self = this, line_len = nil, tip = nil, tl = nil, fenced_code = nil, tip_3 = nil, context = nil, masq = nil; + + if (return_match_data == null) { + return_match_data = false + } + if ((($a = (($b = ((line_len = line.$length()))['$>'](1)) ? ($scope.DELIMITED_BLOCK_LEADERS['$include?'](line['$[]']($range(0, 1, false)))) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return nil + }; + if (line_len['$=='](2)) { + tip = line; + tl = 2; + } else { + if (line_len['$<='](4)) { + tip = line; + tl = line_len; + } else { + tip = line['$[]']($range(0, 3, false)); + tl = 4; + }; + fenced_code = false; + if ((($a = $scope.Compliance.$markdown_syntax()) !== nil && (!$a._isBoolean || $a == true))) { + tip_3 = ((function() {if (tl['$=='](4)) { + return tip.$chop() + } else { + return tip + }; return nil; })()); + if (tip_3['$==']("```")) { + if ((($a = (($b = tl['$=='](4)) ? tip['$end_with?']("`") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + tip = tip_3; + tl = 3; + fenced_code = true; + } else if (tip_3['$==']("~~~")) { + if ((($a = (($b = tl['$=='](4)) ? tip['$end_with?']("~") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + tip = tip_3; + tl = 3; + fenced_code = true;};}; + if ((($a = (($b = tl['$=='](3)) ? fenced_code['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + }; + if ((($a = $scope.DELIMITED_BLOCKS['$has_key?'](tip)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ((($b = tl['$<'](4)) !== false && $b !== nil) ? $b : tl['$=='](line_len))) !== nil && (!$a._isBoolean || $a == true))) { + if (return_match_data !== false && return_match_data !== nil) { + ($a = $scope.DELIMITED_BLOCKS['$[]'](tip))['$to_a'] ? ($a = $a['$to_a']()) : ($a)._isArray ? $a : ($a = [$a]), context = ($a[0] == null ? nil : $a[0]), masq = ($a[1] == null ? nil : $a[1]); + return $scope.BlockMatchData.$new(context, masq, tip, tip); + } else { + return true + } + } else if (((("") + (tip)) + (tip['$[]']($range(-1, -1, false))['$*']((line_len['$-'](tl)))))['$=='](line)) { + if (return_match_data !== false && return_match_data !== nil) { + ($a = $scope.DELIMITED_BLOCKS['$[]'](tip))['$to_a'] ? ($a = $a['$to_a']()) : ($a)._isArray ? $a : ($a = [$a]), context = ($a[0] == null ? nil : $a[0]), masq = ($a[1] == null ? nil : $a[1]); + return $scope.BlockMatchData.$new(context, masq, tip, line); + } else { + return true + } + } else { + return nil + } + } else { + return nil + }; + }); + + $opal.defs(self, '$build_block', function(block_context, content_model, terminator, parent, reader, attributes, options) { + var $a, $b, TMP_8, $c, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, cursor = nil, indent = nil, extension = nil, block = nil; + + if (options == null) { + options = $hash2([], {}) + } + if ((($a = ((($b = content_model['$==']("skip")) !== false && $b !== nil) ? $b : content_model['$==']("raw"))) !== nil && (!$a._isBoolean || $a == true))) { + skip_processing = content_model['$==']("skip"); + parse_as_content_model = "simple"; + } else { + skip_processing = false; + parse_as_content_model = content_model; + }; + if ((($a = terminator['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + if (parse_as_content_model['$==']("verbatim")) { + lines = reader.$read_lines_until($hash2(["break_on_blank_lines", "break_on_list_continuation"], {"break_on_blank_lines": true, "break_on_list_continuation": true})) + } else { + if (content_model['$==']("compound")) { + content_model = "simple"}; + lines = ($a = ($b = reader).$read_lines_until, $a._p = (TMP_8 = function(line){var self = TMP_8._s || this, $a, $b; +if (line == null) line = nil; + return ($a = $scope.Compliance.$block_terminates_paragraph(), $a !== false && $a !== nil ?(((($b = self['$is_delimited_block?'](line)) !== false && $b !== nil) ? $b : $scope.BlockAttributeLineRx['$=~'](line))) : $a)}, TMP_8._s = self, TMP_8), $a).call($b, $hash2(["break_on_blank_lines", "break_on_list_continuation", "preserve_last_line", "skip_line_comments", "skip_processing"], {"break_on_blank_lines": true, "break_on_list_continuation": true, "preserve_last_line": true, "skip_line_comments": true, "skip_processing": skip_processing})); + }; + block_reader = nil; + } else if ((($a = parse_as_content_model['$==']("compound")['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + lines = reader.$read_lines_until($hash2(["terminator", "skip_processing"], {"terminator": terminator, "skip_processing": skip_processing})); + block_reader = nil; + } else if (terminator['$=='](false)) { + lines = nil; + block_reader = reader; + } else { + lines = nil; + cursor = reader.$cursor(); + block_reader = $scope.Reader.$new(reader.$read_lines_until($hash2(["terminator", "skip_processing"], {"terminator": terminator, "skip_processing": skip_processing})), cursor); + }; + if (content_model['$==']("skip")) { + attributes.$clear(); + return lines;}; + if ((($a = (($c = content_model['$==']("verbatim")) ? (indent = attributes['$[]']("indent")) : $c)) !== nil && (!$a._isBoolean || $a == true))) { + self['$reset_block_indent!'](lines, indent.$to_i())}; + if ((($a = (extension = options['$[]']("extension"))) !== nil && (!$a._isBoolean || $a == true))) { + attributes.$delete("style"); + if ((($a = (block = extension.$process_method()['$[]'](parent, ((($c = block_reader) !== false && $c !== nil) ? $c : ($scope.Reader.$new(lines))), attributes.$dup()))) !== nil && (!$a._isBoolean || $a == true))) { + attributes.$replace(block.$attributes()); + if ((($a = (($c = block.$content_model()['$==']("compound")) ? ((lines = block.$lines()))['$nil_or_empty?']()['$!']() : $c)) !== nil && (!$a._isBoolean || $a == true))) { + content_model = "compound"; + block_reader = $scope.Reader.$new(lines);}; + } else { + return nil + }; + } else { + block = $scope.Block.$new(parent, block_context, $hash2(["content_model", "source", "attributes"], {"content_model": content_model, "source": lines, "attributes": attributes})) + }; + if ((($a = ($c = (attributes['$has_key?']("title")), $c !== false && $c !== nil ?(block.$document()['$attr?']("" + (block.$context()) + "-caption")) : $c)) !== nil && (!$a._isBoolean || $a == true))) { + block['$title='](attributes.$delete("title")); + block.$assign_caption(attributes.$delete("caption"));}; + if (content_model['$==']("compound")) { + self.$parse_blocks(block_reader, block)}; + return block; + }); + + $opal.defs(self, '$parse_blocks', function(reader, parent) { + var $a, $b, self = this, block = nil; + + while ((($b = reader['$has_more_lines?']()) !== nil && (!$b._isBoolean || $b == true))) { + block = $scope.Parser.$next_block(reader, parent); + if (block !== false && block !== nil) { + parent['$<<'](block)};}; + }); + + $opal.defs(self, '$next_outline_list', function(reader, list_type, parent) { + var $a, $b, $c, self = this, list_block = nil, match = nil, marker = nil, this_item_level = nil, ancestor = nil, list_item = nil; + + list_block = $scope.List.$new(parent, list_type); + if (parent.$context()['$=='](list_type)) { + list_block['$level='](parent.$level()['$+'](1)) + } else { + list_block['$level='](1) + }; + while ((($b = ($c = reader['$has_more_lines?'](), $c !== false && $c !== nil ?(match = $scope.ListRxMap['$[]'](list_type).$match(reader.$peek_line())) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + marker = self.$resolve_list_marker(list_type, match['$[]'](1)); + if ((($b = ($c = list_block['$items?'](), $c !== false && $c !== nil ?marker['$=='](list_block.$items()['$[]'](0).$marker())['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + this_item_level = list_block.$level()['$+'](1); + ancestor = parent; + while (ancestor.$context()['$=='](list_type)) { + if (marker['$=='](ancestor.$items()['$[]'](0).$marker())) { + this_item_level = ancestor.$level(); + break;;}; + ancestor = ancestor.$parent();}; + } else { + this_item_level = list_block.$level() + }; + if ((($b = ((($c = list_block['$items?']()['$!']()) !== false && $c !== nil) ? $c : this_item_level['$=='](list_block.$level()))) !== nil && (!$b._isBoolean || $b == true))) { + list_item = self.$next_list_item(reader, list_block, match) + } else if (this_item_level['$<'](list_block.$level())) { + break; + } else if (this_item_level['$>'](list_block.$level())) { + list_block.$items()['$[]'](-1)['$<<'](self.$next_block(reader, list_block))}; + if (list_item !== false && list_item !== nil) { + list_block['$<<'](list_item)}; + list_item = nil; + reader.$skip_blank_lines();}; + return list_block; + }); + + $opal.defs(self, '$catalog_callouts', function(text, document) { + var $a, $b, TMP_9, self = this, found = nil; + + found = false; + if ((($a = text['$include?']("<")) !== nil && (!$a._isBoolean || $a == true))) { + ($a = ($b = text).$scan, $a._p = (TMP_9 = function(){var self = TMP_9._s || this, $a, m = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + m = $gvars["~"]; + if ((($a = m['$[]'](0).$chr()['$==']("\\")['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + document.$callouts().$register(m['$[]'](2))}; + return found = true;}, TMP_9._s = self, TMP_9), $a).call($b, $scope.CalloutQuickScanRx)}; + return found; + }); + + $opal.defs(self, '$catalog_inline_anchors', function(text, document) { + var $a, $b, TMP_10, self = this; + + if ((($a = text['$include?']("[")) !== nil && (!$a._isBoolean || $a == true))) { + ($a = ($b = text).$scan, $a._p = (TMP_10 = function(){var self = TMP_10._s || this, $a, m = nil, id = nil, reftext = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + m = $gvars["~"]; + if ((($a = m['$[]'](0)['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + return nil;}; + id = ((($a = m['$[]'](1)) !== false && $a !== nil) ? $a : m['$[]'](3)); + reftext = ((($a = m['$[]'](2)) !== false && $a !== nil) ? $a : m['$[]'](4)); + return document.$register("ids", [id, reftext]);}, TMP_10._s = self, TMP_10), $a).call($b, $scope.InlineAnchorRx)}; + return nil; + }); + + $opal.defs(self, '$next_labeled_list', function(reader, match, parent) { + var $a, $b, $c, self = this, list_block = nil, previous_pair = nil, sibling_pattern = nil, term = nil, item = nil; + + list_block = $scope.List.$new(parent, "dlist"); + previous_pair = nil; + sibling_pattern = $scope.DefinitionListSiblingRx['$[]'](match['$[]'](2)); + while ((($b = ($c = reader['$has_more_lines?'](), $c !== false && $c !== nil ?(match = sibling_pattern.$match(reader.$peek_line())) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + $b = $opal.to_ary(self.$next_list_item(reader, list_block, match, sibling_pattern)), term = ($b[0] == null ? nil : $b[0]), item = ($b[1] == null ? nil : $b[1]); + if ((($b = (($c = previous_pair !== false && previous_pair !== nil) ? previous_pair['$[]'](-1)['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + previous_pair.$pop(); + previous_pair['$[]'](0)['$<<'](term); + previous_pair['$<<'](item); + } else { + list_block.$items()['$<<']((previous_pair = [[term], item])) + };}; + return list_block; + }); + + $opal.defs(self, '$next_list_item', function(reader, list_block, match, sibling_trait) { + var $a, $b, self = this, list_type = nil, list_term = nil, list_item = nil, has_text = nil, text = nil, checkbox = nil, checked = nil, cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, continuation_connects_first_block = nil, content_adjacent = nil, options = nil, new_block = nil; + + if (sibling_trait == null) { + sibling_trait = nil + } + if (((list_type = list_block.$context()))['$==']("dlist")) { + list_term = $scope.ListItem.$new(list_block, match['$[]'](1)); + list_item = $scope.ListItem.$new(list_block, match['$[]'](3)); + has_text = match['$[]'](3)['$nil_or_empty?']()['$!'](); + } else { + text = match['$[]'](2); + checkbox = false; + if ((($a = (($b = list_type['$==']("ulist")) ? text['$start_with?']("[") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = text['$start_with?']("[ ] ")) !== nil && (!$a._isBoolean || $a == true))) { + checkbox = true; + checked = false; + text = text['$[]']($range(3, -1, false)).$lstrip(); + } else if ((($a = ((($b = text['$start_with?']("[*] ")) !== false && $b !== nil) ? $b : text['$start_with?']("[x] "))) !== nil && (!$a._isBoolean || $a == true))) { + checkbox = true; + checked = true; + text = text['$[]']($range(3, -1, false)).$lstrip();}}; + list_item = $scope.ListItem.$new(list_block, text); + if (checkbox !== false && checkbox !== nil) { + list_block.$attributes()['$[]=']("checklist-option", ""); + list_item.$attributes()['$[]=']("checkbox", ""); + if (checked !== false && checked !== nil) { + list_item.$attributes()['$[]=']("checked", "")};}; + ((($a = sibling_trait) !== false && $a !== nil) ? $a : sibling_trait = self.$resolve_list_marker(list_type, match['$[]'](1), list_block.$items().$size(), true, reader)); + list_item['$marker='](sibling_trait); + has_text = true; + }; + reader.$advance(); + cursor = reader.$cursor(); + list_item_reader = $scope.Reader.$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), cursor); + if ((($a = list_item_reader['$has_more_lines?']()) !== nil && (!$a._isBoolean || $a == true))) { + comment_lines = list_item_reader.$skip_line_comments(); + subsequent_line = list_item_reader.$peek_line(); + if ((($a = comment_lines['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + list_item_reader.$unshift_lines(comment_lines) + }; + if ((($a = subsequent_line['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + continuation_connects_first_block = subsequent_line['$empty?'](); + if ((($a = ($b = continuation_connects_first_block['$!'](), $b !== false && $b !== nil ?list_type['$==']("dlist")['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + has_text = false}; + content_adjacent = ($a = continuation_connects_first_block['$!'](), $a !== false && $a !== nil ?subsequent_line['$empty?']()['$!']() : $a); + } else { + continuation_connects_first_block = false; + content_adjacent = false; + }; + options = $hash2(["text"], {"text": has_text['$!']()}); + while ((($b = list_item_reader['$has_more_lines?']()) !== nil && (!$b._isBoolean || $b == true))) { + new_block = self.$next_block(list_item_reader, list_block, $hash2([], {}), options); + if (new_block !== false && new_block !== nil) { + list_item['$<<'](new_block)};}; + list_item.$fold_first(continuation_connects_first_block, content_adjacent);}; + if (list_type['$==']("dlist")) { + if ((($a = ((($b = list_item['$text?']()) !== false && $b !== nil) ? $b : list_item['$blocks?']())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + list_item = nil + }; + return [list_term, list_item]; + } else { + return list_item + }; + }); + + $opal.defs(self, '$read_lines_for_list_item', function(reader, list_type, sibling_trait, has_text) { + var $a, $b, $c, $d, TMP_11, $e, TMP_12, $f, TMP_13, TMP_14, $g, $h, TMP_15, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, this_line = nil, prev_line = nil, match = nil, nested_list_type = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if (sibling_trait == null) { + sibling_trait = nil + } + if (has_text == null) { + has_text = true + } + buffer = []; + continuation = "inactive"; + within_nested_list = false; + detached_continuation = nil; + while ((($b = reader['$has_more_lines?']()) !== nil && (!$b._isBoolean || $b == true))) { + this_line = reader.$read_line(); + if ((($b = self['$is_sibling_list_item?'](this_line, list_type, sibling_trait)) !== nil && (!$b._isBoolean || $b == true))) { + break;}; + prev_line = (function() {if ((($b = buffer['$empty?']()) !== nil && (!$b._isBoolean || $b == true))) { + return nil + } else { + return buffer['$[]'](-1) + }; return nil; })(); + if (prev_line['$==']($scope.LIST_CONTINUATION)) { + if (continuation['$==']("inactive")) { + continuation = "active"; + has_text = true; + if (within_nested_list !== false && within_nested_list !== nil) { + } else { + buffer['$[]='](-1, "") + };}; + if (this_line['$==']($scope.LIST_CONTINUATION)) { + if ((($b = continuation['$==']("frozen")['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + continuation = "frozen"; + buffer['$<<'](this_line);}; + this_line = nil; + continue;;};}; + if ((($b = (match = self['$is_delimited_block?'](this_line, true))) !== nil && (!$b._isBoolean || $b == true))) { + if (continuation['$==']("active")) { + buffer['$<<'](this_line); + buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line"], {"terminator": match.$terminator(), "read_last_line": true}))); + continuation = "inactive"; + } else { + break; + } + } else if ((($b = ($c = (($d = list_type['$==']("dlist")) ? continuation['$==']("active")['$!']() : $d), $c !== false && $c !== nil ?$scope.BlockAttributeLineRx['$=~'](this_line) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + break; + } else if ((($b = (($c = continuation['$==']("active")) ? this_line['$empty?']()['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = $scope.LiteralParagraphRx['$=~'](this_line)) !== nil && (!$b._isBoolean || $b == true))) { + reader.$unshift_line(this_line); + buffer.$concat(($b = ($c = reader).$read_lines_until, $b._p = (TMP_11 = function(line){var self = TMP_11._s || this, $a; +if (line == null) line = nil; + return (($a = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : $a)}, TMP_11._s = self, TMP_11), $b).call($c, $hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true}))); + continuation = "inactive"; + } else if ((($b = ((($d = ((($e = $scope.BlockTitleRx['$=~'](this_line)) !== false && $e !== nil) ? $e : $scope.BlockAttributeLineRx['$=~'](this_line))) !== false && $d !== nil) ? $d : $scope.AttributeEntryRx['$=~'](this_line))) !== nil && (!$b._isBoolean || $b == true))) { + buffer['$<<'](this_line) + } else { + if ((($b = nested_list_type = ($d = ($e = ((function() {if (within_nested_list !== false && within_nested_list !== nil) { + return ["dlist"] + } else { + return $scope.NESTABLE_LIST_CONTEXTS + }; return nil; })())).$detect, $d._p = (TMP_12 = function(ctx){var self = TMP_12._s || this; +if (ctx == null) ctx = nil; + return $scope.ListRxMap['$[]'](ctx)['$=~'](this_line)}, TMP_12._s = self, TMP_12), $d).call($e)) !== nil && (!$b._isBoolean || $b == true))) { + within_nested_list = true; + if ((($b = (($d = nested_list_type['$==']("dlist")) ? $gvars["~"]['$[]'](3)['$nil_or_empty?']() : $d)) !== nil && (!$b._isBoolean || $b == true))) { + has_text = false};}; + buffer['$<<'](this_line); + continuation = "inactive"; + } + } else if ((($b = ($d = prev_line['$nil?']()['$!'](), $d !== false && $d !== nil ?prev_line['$empty?']() : $d)) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = this_line['$empty?']()) !== nil && (!$b._isBoolean || $b == true))) { + reader.$skip_blank_lines(); + this_line = reader.$read_line(); + if ((($b = ((($d = this_line['$nil?']()) !== false && $d !== nil) ? $d : self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) !== nil && (!$b._isBoolean || $b == true))) { + break;};}; + if (this_line['$==']($scope.LIST_CONTINUATION)) { + detached_continuation = buffer.$size(); + buffer['$<<'](this_line); + } else if (has_text !== false && has_text !== nil) { + if ((($b = self['$is_sibling_list_item?'](this_line, list_type, sibling_trait)) !== nil && (!$b._isBoolean || $b == true))) { + break; + } else if ((($b = nested_list_type = ($d = ($f = $scope.NESTABLE_LIST_CONTEXTS).$detect, $d._p = (TMP_13 = function(ctx){var self = TMP_13._s || this; +if (ctx == null) ctx = nil; + return $scope.ListRxMap['$[]'](ctx)['$=~'](this_line)}, TMP_13._s = self, TMP_13), $d).call($f)) !== nil && (!$b._isBoolean || $b == true))) { + buffer['$<<'](this_line); + within_nested_list = true; + if ((($b = (($d = nested_list_type['$==']("dlist")) ? $gvars["~"]['$[]'](3)['$nil_or_empty?']() : $d)) !== nil && (!$b._isBoolean || $b == true))) { + has_text = false}; + } else if ((($b = $scope.LiteralParagraphRx['$=~'](this_line)) !== nil && (!$b._isBoolean || $b == true))) { + reader.$unshift_line(this_line); + buffer.$concat(($b = ($d = reader).$read_lines_until, $b._p = (TMP_14 = function(line){var self = TMP_14._s || this, $a; +if (line == null) line = nil; + return (($a = list_type['$==']("dlist")) ? self['$is_sibling_list_item?'](line, list_type, sibling_trait) : $a)}, TMP_14._s = self, TMP_14), $b).call($d, $hash2(["preserve_last_line", "break_on_blank_lines", "break_on_list_continuation"], {"preserve_last_line": true, "break_on_blank_lines": true, "break_on_list_continuation": true}))); + } else { + break; + } + } else { + if (within_nested_list !== false && within_nested_list !== nil) { + } else { + buffer.$pop() + }; + buffer['$<<'](this_line); + has_text = true; + }; + } else { + if ((($b = this_line['$empty?']()['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + has_text = true}; + if ((($b = nested_list_type = ($g = ($h = ((function() {if (within_nested_list !== false && within_nested_list !== nil) { + return ["dlist"] + } else { + return $scope.NESTABLE_LIST_CONTEXTS + }; return nil; })())).$detect, $g._p = (TMP_15 = function(ctx){var self = TMP_15._s || this; +if (ctx == null) ctx = nil; + return $scope.ListRxMap['$[]'](ctx)['$=~'](this_line)}, TMP_15._s = self, TMP_15), $g).call($h)) !== nil && (!$b._isBoolean || $b == true))) { + within_nested_list = true; + if ((($b = (($g = nested_list_type['$==']("dlist")) ? $gvars["~"]['$[]'](3)['$nil_or_empty?']() : $g)) !== nil && (!$b._isBoolean || $b == true))) { + has_text = false};}; + buffer['$<<'](this_line); + }; + this_line = nil;}; + if (this_line !== false && this_line !== nil) { + reader.$unshift_line(this_line)}; + if (detached_continuation !== false && detached_continuation !== nil) { + buffer.$delete_at(detached_continuation)}; + while ((($b = ($g = buffer['$empty?']()['$!'](), $g !== false && $g !== nil ?buffer['$[]'](-1)['$empty?']() : $g)) !== nil && (!$b._isBoolean || $b == true))) { + buffer.$pop()}; + if ((($a = ($b = buffer['$empty?']()['$!'](), $b !== false && $b !== nil ?buffer['$[]'](-1)['$==']($scope.LIST_CONTINUATION) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + buffer.$pop()}; + return buffer; + }); + + $opal.defs(self, '$initialize_section', function(reader, parent, attributes) { + var $a, $b, self = this, document = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, _ = nil, section = nil, style = nil, id = nil; + + if (attributes == null) { + attributes = $hash2([], {}) + } + document = parent.$document(); + $a = $opal.to_ary(self.$parse_section_title(reader, document)), sect_id = ($a[0] == null ? nil : $a[0]), sect_reftext = ($a[1] == null ? nil : $a[1]), sect_title = ($a[2] == null ? nil : $a[2]), sect_level = ($a[3] == null ? nil : $a[3]), _ = ($a[4] == null ? nil : $a[4]); + if (sect_reftext !== false && sect_reftext !== nil) { + attributes['$[]=']("reftext", sect_reftext)}; + section = $scope.Section.$new(parent, sect_level, document.$attributes()['$has_key?']("numbered")); + section['$id='](sect_id); + section['$title='](sect_title); + if ((($a = attributes['$[]'](1)) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(self.$parse_style_attribute(attributes, reader)), style = ($a[0] == null ? nil : $a[0]), _ = ($a[1] == null ? nil : $a[1]); + if (style !== false && style !== nil) { + section['$sectname='](style); + section['$special='](true); + if ((($a = (($b = section.$sectname()['$==']("abstract")) ? document.$doctype()['$==']("book") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + section['$sectname=']("sect1"); + section['$special='](false); + section['$level='](1);}; + } else { + section['$sectname=']("sect" + (section.$level())) + }; + } else if ((($a = (($b = sect_title.$downcase()['$==']("synopsis")) ? document.$doctype()['$==']("manpage") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + section['$special='](true); + section['$sectname=']("synopsis"); + } else { + section['$sectname=']("sect" + (section.$level())) + }; + if ((($a = ($b = section.$id()['$!'](), $b !== false && $b !== nil ?(id = attributes['$[]']("id")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + section['$id='](id) + } else { + ($a = section, ((($b = $a.$id()) !== false && $b !== nil) ? $b : $a['$id='](section.$generate_id()))) + }; + if ((($a = section.$id()) !== nil && (!$a._isBoolean || $a == true))) { + section.$document().$register("ids", [section.$id(), (((($a = attributes['$[]']("reftext")) !== false && $a !== nil) ? $a : section.$title()))])}; + section.$update_attributes(attributes); + reader.$skip_blank_lines(); + return section; + }); + + $opal.defs(self, '$section_level', function(line) { + var self = this; + + return $scope.SECTION_LEVELS['$[]'](line.$chr()); + }); + + $opal.defs(self, '$single_line_section_level', function(marker) { + var self = this; + + return marker.$length()['$-'](1); + }); + + $opal.defs(self, '$is_next_line_section?', function(reader, attributes) { + var $a, $b, $c, $d, self = this, val = nil, ord_0 = nil; + + if ((($a = ($b = ($c = ((val = attributes['$[]'](1)))['$nil?']()['$!'](), $c !== false && $c !== nil ?(((($d = ((ord_0 = val['$[]'](0).$ord()))['$=='](100)) !== false && $d !== nil) ? $d : ord_0['$=='](102))) : $c), $b !== false && $b !== nil ?val['$=~']($scope.FloatingTitleStyleRx) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return false}; + if ((($a = reader['$has_more_lines?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; + if ((($a = $scope.Compliance.$underline_style_section_titles()) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = self)['$is_section_title?'].apply($a, [].concat(reader.$peek_lines(2))) + } else { + return self['$is_section_title?'](reader.$peek_line()) + }; + }); + + $opal.defs(self, '$is_next_line_document_title?', function(reader, attributes) { + var self = this; + + return self['$is_next_line_section?'](reader, attributes)['$=='](0); + }); + + $opal.defs(self, '$is_section_title?', function(line1, line2) { + var $a, $b, self = this, level = nil; + + if (line2 == null) { + line2 = nil + } + if ((($a = (level = self['$is_single_line_section_title?'](line1))) !== nil && (!$a._isBoolean || $a == true))) { + return level + } else if ((($a = (($b = line2 !== false && line2 !== nil) ? (level = self['$is_two_line_section_title?'](line1, line2)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return level + } else { + return false + }; + }); + + $opal.defs(self, '$is_single_line_section_title?', function(line1) { + var $a, $b, $c, $d, self = this, first_char = nil, match = nil; + + first_char = (function() {if (line1 !== false && line1 !== nil) { + return line1.$chr() + } else { + return nil + }; return nil; })(); + if ((($a = ($b = (((($c = first_char['$==']("=")) !== false && $c !== nil) ? $c : (($d = $scope.Compliance.$markdown_syntax(), $d !== false && $d !== nil ?first_char['$==']("#") : $d)))), $b !== false && $b !== nil ?(match = $scope.AtxSectionRx.$match(line1)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.$single_line_section_level(match['$[]'](1)) + } else { + return false + }; + }); + + $opal.defs(self, '$is_two_line_section_title?', function(line1, line2) { + var $a, $b, $c, $d, $e, $f, self = this; + + if ((($a = ($b = ($c = ($d = ($e = (($f = line1 !== false && line1 !== nil) ? line2 : $f), $e !== false && $e !== nil ?$scope.SECTION_LEVELS['$has_key?'](line2.$chr()) : $e), $d !== false && $d !== nil ?line2['$=~']($scope.SetextSectionLineRx) : $d), $c !== false && $c !== nil ?line1['$=~']($scope.SetextSectionTitleRx) : $c), $b !== false && $b !== nil ?(self.$line_length(line1)['$-'](self.$line_length(line2))).$abs()['$<='](1) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.$section_level(line2) + } else { + return false + }; + }); + + $opal.defs(self, '$parse_section_title', function(reader, document) { + var $a, $b, $c, $d, $e, self = this, line1 = nil, sect_id = nil, sect_title = nil, sect_level = nil, sect_reftext = nil, single_line = nil, first_char = nil, match = nil, anchor_match = nil, line2 = nil, name_match = nil; + + line1 = reader.$read_line(); + sect_id = nil; + sect_title = nil; + sect_level = -1; + sect_reftext = nil; + single_line = true; + first_char = line1.$chr(); + if ((($a = ($b = (((($c = first_char['$==']("=")) !== false && $c !== nil) ? $c : (($d = $scope.Compliance.$markdown_syntax(), $d !== false && $d !== nil ?first_char['$==']("#") : $d)))), $b !== false && $b !== nil ?(match = $scope.AtxSectionRx.$match(line1)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + sect_level = self.$single_line_section_level(match['$[]'](1)); + sect_title = match['$[]'](2); + if ((($a = ($b = sect_title['$end_with?']("]]"), $b !== false && $b !== nil ?(anchor_match = $scope.InlineSectionAnchorRx.$match(sect_title)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = anchor_match['$[]'](2)['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + sect_title = anchor_match['$[]'](1); + sect_id = anchor_match['$[]'](3); + sect_reftext = anchor_match['$[]'](4);}}; + } else if ((($a = $scope.Compliance.$underline_style_section_titles()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ($b = ($c = ($d = ($e = (line2 = reader.$peek_line(true)), $e !== false && $e !== nil ?$scope.SECTION_LEVELS['$has_key?'](line2.$chr()) : $e), $d !== false && $d !== nil ?line2['$=~']($scope.SetextSectionLineRx) : $d), $c !== false && $c !== nil ?(name_match = $scope.SetextSectionTitleRx.$match(line1)) : $c), $b !== false && $b !== nil ?(self.$line_length(line1)['$-'](self.$line_length(line2))).$abs()['$<='](1) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + sect_title = name_match['$[]'](1); + if ((($a = ($b = sect_title['$end_with?']("]]"), $b !== false && $b !== nil ?(anchor_match = $scope.InlineSectionAnchorRx.$match(sect_title)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = anchor_match['$[]'](2)['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + sect_title = anchor_match['$[]'](1); + sect_id = anchor_match['$[]'](3); + sect_reftext = anchor_match['$[]'](4);}}; + sect_level = self.$section_level(line2); + single_line = false; + reader.$advance();}}; + if (sect_level['$>='](0)) { + sect_level = sect_level['$+'](document.$attr("leveloffset", 0).$to_i())}; + return [sect_id, sect_reftext, sect_title, sect_level, single_line]; + }); + + $opal.defs(self, '$line_length', function(line) { + var $a, self = this; + + if ((($a = $scope.FORCE_UNICODE_LINE_LENGTH) !== nil && (!$a._isBoolean || $a == true))) { + return line.$scan($scope.UnicodeCharScanRx).$length() + } else { + return line.$length() + }; + }); + + $opal.defs(self, '$parse_header_metadata', function(reader, document) { + var $a, $b, TMP_16, $c, TMP_17, $d, self = this, metadata = nil, implicit_author = nil, implicit_authors = nil, author_metadata = nil, rev_metadata = nil, rev_line = nil, match = nil, author_line = nil, authors = nil, author_key = nil; + + if (document == null) { + document = nil + } + self.$process_attribute_entries(reader, document); + metadata = $hash2([], {}); + implicit_author = nil; + implicit_authors = nil; + if ((($a = ($b = reader['$has_more_lines?'](), $b !== false && $b !== nil ?reader['$next_line_empty?']()['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + author_metadata = self.$process_authors(reader.$read_line()); + if ((($a = author_metadata['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + if (document !== false && document !== nil) { + ($a = ($b = author_metadata).$each, $a._p = (TMP_16 = function(key, val){var self = TMP_16._s || this, $a, $b; +if (key == null) key = nil;if (val == null) val = nil; + if ((($a = document.$attributes()['$has_key?'](key)) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return document.$attributes()['$[]='](key, ((function() {if ((($a = (val['$is_a?']((($b = $opal.Object._scope.String) == null ? $opal.cm('String') : $b)))) !== nil && (!$a._isBoolean || $a == true))) { + return document.$apply_header_subs(val) + } else { + return val + }; return nil; })())) + }}, TMP_16._s = self, TMP_16), $a).call($b); + implicit_author = document.$attributes()['$[]']("author"); + implicit_authors = document.$attributes()['$[]']("authors");}; + metadata = author_metadata; + }; + self.$process_attribute_entries(reader, document); + rev_metadata = $hash2([], {}); + if ((($a = ($c = reader['$has_more_lines?'](), $c !== false && $c !== nil ?reader['$next_line_empty?']()['$!']() : $c)) !== nil && (!$a._isBoolean || $a == true))) { + rev_line = reader.$read_line(); + if ((($a = (match = $scope.RevisionInfoLineRx.$match(rev_line))) !== nil && (!$a._isBoolean || $a == true))) { + rev_metadata['$[]=']("revdate", match['$[]'](2).$strip()); + if ((($a = match['$[]'](1)['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + rev_metadata['$[]=']("revnumber", match['$[]'](1).$rstrip()) + }; + if ((($a = match['$[]'](3)['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + rev_metadata['$[]=']("revremark", match['$[]'](3).$rstrip()) + }; + } else { + reader.$unshift_line(rev_line) + };}; + if ((($a = rev_metadata['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + if (document !== false && document !== nil) { + ($a = ($c = rev_metadata).$each, $a._p = (TMP_17 = function(key, val){var self = TMP_17._s || this, $a; +if (key == null) key = nil;if (val == null) val = nil; + if ((($a = document.$attributes()['$has_key?'](key)) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return document.$attributes()['$[]='](key, document.$apply_header_subs(val)) + }}, TMP_17._s = self, TMP_17), $a).call($c)}; + metadata.$update(rev_metadata); + }; + self.$process_attribute_entries(reader, document); + reader.$skip_blank_lines();}; + if (document !== false && document !== nil) { + author_metadata = nil; + if ((($a = ($d = document.$attributes()['$has_key?']("author"), $d !== false && $d !== nil ?((author_line = document.$attributes()['$[]']("author")))['$=='](implicit_author)['$!']() : $d)) !== nil && (!$a._isBoolean || $a == true))) { + author_metadata = self.$process_authors(author_line, true, false) + } else if ((($a = ($d = document.$attributes()['$has_key?']("authors"), $d !== false && $d !== nil ?((author_line = document.$attributes()['$[]']("authors")))['$=='](implicit_authors)['$!']() : $d)) !== nil && (!$a._isBoolean || $a == true))) { + author_metadata = self.$process_authors(author_line, true) + } else { + authors = []; + author_key = "author_" + (authors.$size()['$+'](1)); + while ((($d = document.$attributes()['$has_key?'](author_key)) !== nil && (!$d._isBoolean || $d == true))) { + authors['$<<'](document.$attributes()['$[]'](author_key)); + author_key = "author_" + (authors.$size()['$+'](1));}; + if (authors.$size()['$=='](1)) { + author_metadata = self.$process_authors(authors['$[]'](0), true, false) + } else if (authors.$size()['$>'](1)) { + author_metadata = self.$process_authors(authors.$join("; "), true)}; + }; + if (author_metadata !== false && author_metadata !== nil) { + document.$attributes().$update(author_metadata); + if ((($a = ($d = document.$attributes()['$has_key?']("email")['$!'](), $d !== false && $d !== nil ?document.$attributes()['$has_key?']("email_1") : $d)) !== nil && (!$a._isBoolean || $a == true))) { + document.$attributes()['$[]=']("email", document.$attributes()['$[]']("email_1"))};};}; + return metadata; + }); + + $opal.defs(self, '$process_authors', function(author_line, names_only, multiple) { + var $a, $b, TMP_18, $c, TMP_19, self = this, author_metadata = nil, keys = nil, author_entries = nil; + + if (names_only == null) { + names_only = false + } + if (multiple == null) { + multiple = true + } + author_metadata = $hash2([], {}); + keys = ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]; + author_entries = (function() {if (multiple !== false && multiple !== nil) { + return ($a = ($b = (author_line.$split(";"))).$map, $a._p = (TMP_18 = function(line){var self = TMP_18._s || this; +if (line == null) line = nil; + return line.$strip()}, TMP_18._s = self, TMP_18), $a).call($b) + } else { + return [author_line] + }; return nil; })(); + ($a = ($c = author_entries).$each_with_index, $a._p = (TMP_19 = function(author_entry, idx){var self = TMP_19._s || this, $a, $b, TMP_20, $c, TMP_21, $d, TMP_22, key_map = nil, segments = nil, match = nil, fname = nil, mname = nil, lname = nil; +if (author_entry == null) author_entry = nil;if (idx == null) idx = nil; + if ((($a = author_entry['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil;}; + key_map = $hash2([], {}); + if ((($a = idx['$zero?']()) !== nil && (!$a._isBoolean || $a == true))) { + ($a = ($b = keys).$each, $a._p = (TMP_20 = function(key){var self = TMP_20._s || this; +if (key == null) key = nil; + return key_map['$[]='](key.$to_sym(), key)}, TMP_20._s = self, TMP_20), $a).call($b) + } else { + ($a = ($c = keys).$each, $a._p = (TMP_21 = function(key){var self = TMP_21._s || this; +if (key == null) key = nil; + return key_map['$[]='](key.$to_sym(), "" + (key) + "_" + (idx['$+'](1)))}, TMP_21._s = self, TMP_21), $a).call($c) + }; + segments = nil; + if (names_only !== false && names_only !== nil) { + segments = author_entry.$split(" ", 3) + } else if ((($a = (match = $scope.AuthorInfoLineRx.$match(author_entry))) !== nil && (!$a._isBoolean || $a == true))) { + segments = match.$to_a(); + segments.$shift();}; + if ((($a = segments['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + author_metadata['$[]='](key_map['$[]']("author"), author_metadata['$[]='](key_map['$[]']("firstname"), fname = author_entry.$strip().$tr_s(" ", " "))); + author_metadata['$[]='](key_map['$[]']("authorinitials"), fname['$[]'](0, 1)); + } else { + author_metadata['$[]='](key_map['$[]']("firstname"), fname = segments['$[]'](0).$tr("_", " ")); + author_metadata['$[]='](key_map['$[]']("author"), fname); + author_metadata['$[]='](key_map['$[]']("authorinitials"), fname['$[]'](0, 1)); + if ((($a = ($d = segments['$[]'](1)['$nil?']()['$!'](), $d !== false && $d !== nil ?segments['$[]'](2)['$nil?']()['$!']() : $d)) !== nil && (!$a._isBoolean || $a == true))) { + author_metadata['$[]='](key_map['$[]']("middlename"), mname = segments['$[]'](1).$tr("_", " ")); + author_metadata['$[]='](key_map['$[]']("lastname"), lname = segments['$[]'](2).$tr("_", " ")); + author_metadata['$[]='](key_map['$[]']("author"), [fname, mname, lname].$join(" ")); + author_metadata['$[]='](key_map['$[]']("authorinitials"), [fname['$[]'](0, 1), mname['$[]'](0, 1), lname['$[]'](0, 1)].$join()); + } else if ((($a = segments['$[]'](1)['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + author_metadata['$[]='](key_map['$[]']("lastname"), lname = segments['$[]'](1).$tr("_", " ")); + author_metadata['$[]='](key_map['$[]']("author"), [fname, lname].$join(" ")); + author_metadata['$[]='](key_map['$[]']("authorinitials"), [fname['$[]'](0, 1), lname['$[]'](0, 1)].$join());}; + if ((($a = ((($d = names_only) !== false && $d !== nil) ? $d : segments['$[]'](3)['$nil?']())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + author_metadata['$[]='](key_map['$[]']("email"), segments['$[]'](3)) + }; + }; + author_metadata['$[]=']("authorcount", idx['$+'](1)); + if (idx['$=='](1)) { + ($a = ($d = keys).$each, $a._p = (TMP_22 = function(key){var self = TMP_22._s || this, $a; +if (key == null) key = nil; + if ((($a = author_metadata['$has_key?'](key)) !== nil && (!$a._isBoolean || $a == true))) { + return author_metadata['$[]=']("" + (key) + "_1", author_metadata['$[]'](key)) + } else { + return nil + }}, TMP_22._s = self, TMP_22), $a).call($d)}; + if ((($a = idx['$zero?']()) !== nil && (!$a._isBoolean || $a == true))) { + return author_metadata['$[]=']("authors", author_metadata['$[]'](key_map['$[]']("author"))) + } else { + return author_metadata['$[]=']("authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))) + };}, TMP_19._s = self, TMP_19), $a).call($c); + return author_metadata; + }); + + $opal.defs(self, '$parse_block_metadata_lines', function(reader, parent, attributes, options) { + var $a, $b, self = this; + + if (attributes == null) { + attributes = $hash2([], {}) + } + if (options == null) { + options = $hash2([], {}) + } + while ((($b = self.$parse_block_metadata_line(reader, parent, attributes, options)) !== nil && (!$b._isBoolean || $b == true))) { + reader.$advance(); + reader.$skip_blank_lines();}; + return attributes; + }); + + $opal.defs(self, '$parse_block_metadata_line', function(reader, parent, attributes, options) { + var $a, $b, $c, self = this, next_line = nil, commentish = nil, match = nil, terminator = nil, in_square_brackets = nil; + + if (options == null) { + options = $hash2([], {}) + } + if ((($a = reader['$has_more_lines?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; + next_line = reader.$peek_line(); + if ((($a = ($b = (commentish = next_line['$start_with?']("//")), $b !== false && $b !== nil ?(match = $scope.CommentBlockRx.$match(next_line)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + terminator = match['$[]'](0); + reader.$read_lines_until($hash2(["skip_first_line", "preserve_last_line", "terminator", "skip_processing"], {"skip_first_line": true, "preserve_last_line": true, "terminator": terminator, "skip_processing": true})); + } else if ((($a = (($b = commentish !== false && commentish !== nil) ? $scope.CommentLineRx['$=~'](next_line) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + } else if ((($a = ($b = ($c = options['$[]']("text")['$!'](), $c !== false && $c !== nil ?next_line['$start_with?'](":") : $c), $b !== false && $b !== nil ?(match = $scope.AttributeEntryRx.$match(next_line)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.$process_attribute_entry(reader, parent, attributes, match) + } else if ((($a = ($b = (in_square_brackets = ($c = next_line['$start_with?']("["), $c !== false && $c !== nil ?next_line['$end_with?']("]") : $c)), $b !== false && $b !== nil ?(match = $scope.BlockAnchorRx.$match(next_line)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = match['$[]'](1)['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + attributes['$[]=']("id", match['$[]'](1)); + if ((($a = match['$[]'](2)['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + attributes['$[]=']("reftext", match['$[]'](2)) + }; + } + } else if ((($a = (($b = in_square_brackets !== false && in_square_brackets !== nil) ? (match = $scope.BlockAttributeListRx.$match(next_line)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + parent.$document().$parse_attributes(match['$[]'](1), [], $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes})) + } else if ((($a = ($b = options['$[]']("text")['$!'](), $b !== false && $b !== nil ?(match = $scope.BlockTitleRx.$match(next_line)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + attributes['$[]=']("title", match['$[]'](1)) + } else { + return false + }; + return true; + }); + + $opal.defs(self, '$process_attribute_entries', function(reader, parent, attributes) { + var $a, $b, self = this; + + if (attributes == null) { + attributes = nil + } + reader.$skip_comment_lines(); + while ((($b = self.$process_attribute_entry(reader, parent, attributes)) !== nil && (!$b._isBoolean || $b == true))) { + reader.$advance(); + reader.$skip_comment_lines();}; + }); + + $opal.defs(self, '$process_attribute_entry', function(reader, parent, attributes, match) { + var $a, $b, self = this, name = nil, value = nil, next_line = nil; + + if (attributes == null) { + attributes = nil + } + if (match == null) { + match = nil + } + ((($a = match) !== false && $a !== nil) ? $a : match = ((function() {if ((($b = reader['$has_more_lines?']()) !== nil && (!$b._isBoolean || $b == true))) { + return $scope.AttributeEntryRx.$match(reader.$peek_line()) + } else { + return nil + }; return nil; })())); + if (match !== false && match !== nil) { + name = match['$[]'](1); + value = ((($a = match['$[]'](2)) !== false && $a !== nil) ? $a : ""); + if ((($a = value['$end_with?']($scope.LINE_BREAK)) !== nil && (!$a._isBoolean || $a == true))) { + value = value.$chop().$rstrip(); + while ((($b = reader.$advance()) !== nil && (!$b._isBoolean || $b == true))) { + next_line = reader.$peek_line().$strip(); + if ((($b = next_line['$empty?']()) !== nil && (!$b._isBoolean || $b == true))) { + break;}; + if ((($b = next_line['$end_with?']($scope.LINE_BREAK)) !== nil && (!$b._isBoolean || $b == true))) { + value = "" + (value) + " " + (next_line.$chop().$rstrip()) + } else { + value = "" + (value) + " " + (next_line); + break;; + };};}; + self.$store_attribute(name, value, ((function() {if (parent !== false && parent !== nil) { + return parent.$document() + } else { + return nil + }; return nil; })()), attributes); + return true; + } else { + return false + }; + }); + + $opal.defs(self, '$store_attribute', function(name, value, doc, attrs) { + var $a, $b, self = this, accessible = nil; + + if (doc == null) { + doc = nil + } + if (attrs == null) { + attrs = nil + } + if ((($a = name['$end_with?']("!")) !== nil && (!$a._isBoolean || $a == true))) { + value = nil; + name = name.$chop(); + } else if ((($a = name['$start_with?']("!")) !== nil && (!$a._isBoolean || $a == true))) { + value = nil; + name = name['$[]']($range(1, -1, false));}; + name = self.$sanitize_attribute_name(name); + accessible = true; + if (doc !== false && doc !== nil) { + accessible = (function() {if ((($a = value['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return doc.$delete_attribute(name) + } else { + return doc.$set_attribute(name, value) + }; return nil; })()}; + if ((($a = ((($b = accessible['$!']()) !== false && $b !== nil) ? $b : attrs['$nil?']())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + ($scope.Document)._scope.AttributeEntry.$new(name, value).$save_to(attrs) + }; + return [name, value]; + }); + + $opal.defs(self, '$resolve_list_marker', function(list_type, marker, ordinal, validate, reader) { + var $a, $b, self = this; + + if (ordinal == null) { + ordinal = 0 + } + if (validate == null) { + validate = false + } + if (reader == null) { + reader = nil + } + if ((($a = (($b = list_type['$==']("olist")) ? marker['$start_with?'](".")['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader) + } else if (list_type['$==']("colist")) { + return "<1>" + } else { + return marker + }; + }); + + $opal.defs(self, '$resolve_ordered_list_marker', function(marker, ordinal, validate, reader) { + var $a, $b, TMP_23, $c, self = this, number_style = nil, expected = nil, actual = nil, $case = nil; + + if (ordinal == null) { + ordinal = 0 + } + if (validate == null) { + validate = false + } + if (reader == null) { + reader = nil + } + number_style = ($a = ($b = $scope.ORDERED_LIST_STYLES).$detect, $a._p = (TMP_23 = function(s){var self = TMP_23._s || this; +if (s == null) s = nil; + return $scope.OrderedListMarkerRxMap['$[]'](s)['$=~'](marker)}, TMP_23._s = self, TMP_23), $a).call($b); + expected = actual = nil; + $case = number_style;if ("arabic"['$===']($case)) {if (validate !== false && validate !== nil) { + expected = ordinal['$+'](1); + actual = marker.$to_i();}; + marker = "1.";}else if ("loweralpha"['$===']($case)) {if (validate !== false && validate !== nil) { + expected = ("a"['$[]'](0).$ord()['$+'](ordinal)).$chr(); + actual = marker.$chomp(".");}; + marker = "a.";}else if ("upperalpha"['$===']($case)) {if (validate !== false && validate !== nil) { + expected = ("A"['$[]'](0).$ord()['$+'](ordinal)).$chr(); + actual = marker.$chomp(".");}; + marker = "A.";}else if ("lowerroman"['$===']($case)) {if (validate !== false && validate !== nil) { + expected = ordinal['$+'](1); + actual = self.$roman_numeral_to_int(marker.$chomp(")"));}; + marker = "i)";}else if ("upperroman"['$===']($case)) {if (validate !== false && validate !== nil) { + expected = ordinal['$+'](1); + actual = self.$roman_numeral_to_int(marker.$chomp(")"));}; + marker = "I)";}; + if ((($a = (($c = validate !== false && validate !== nil) ? expected['$=='](actual)['$!']() : $c)) !== nil && (!$a._isBoolean || $a == true))) { + self.$warn("asciidoctor: WARNING: " + (reader.$line_info()) + ": list item index: expected " + (expected) + ", got " + (actual))}; + return marker; + }); + + $opal.defs(self, '$is_sibling_list_item?', function(line, list_type, sibling_trait) { + var $a, $b, self = this, matcher = nil, expected_marker = nil, m = nil; + + if ((($a = sibling_trait['$is_a?']((($b = $opal.Object._scope.Regexp) == null ? $opal.cm('Regexp') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + matcher = sibling_trait; + expected_marker = false; + } else { + matcher = $scope.ListRxMap['$[]'](list_type); + expected_marker = sibling_trait; + }; + if ((($a = (m = matcher.$match(line))) !== nil && (!$a._isBoolean || $a == true))) { + if (expected_marker !== false && expected_marker !== nil) { + return expected_marker['$=='](self.$resolve_list_marker(list_type, m['$[]'](1))) + } else { + return true + } + } else { + return false + }; + }); + + $opal.defs(self, '$next_table', function(table_reader, parent, attributes) { + var $a, $b, $c, $d, $e, $f, TMP_24, self = this, table = nil, explicit_col_specs = nil, skipped = nil, parser_ctx = nil, loop_idx = nil, line = nil, next_line = nil, next_cell_spec = nil, seen = nil, m = nil, cell_text = nil, even_width = nil; + + table = $scope.Table.$new(parent, attributes); + if ((($a = (attributes['$has_key?']("title"))) !== nil && (!$a._isBoolean || $a == true))) { + table['$title='](attributes.$delete("title")); + table.$assign_caption(attributes.$delete("caption"));}; + if ((($a = attributes['$has_key?']("cols")) !== nil && (!$a._isBoolean || $a == true))) { + table.$create_columns(self.$parse_col_specs(attributes['$[]']("cols"))); + explicit_col_specs = true; + } else { + explicit_col_specs = false + }; + skipped = table_reader.$skip_blank_lines(); + parser_ctx = ($scope.Table)._scope.ParserContext.$new(table_reader, table, attributes); + loop_idx = -1; + while ((($b = table_reader['$has_more_lines?']()) !== nil && (!$b._isBoolean || $b == true))) { + loop_idx = loop_idx['$+'](1); + line = table_reader.$read_line(); + if ((($b = ($c = ($d = ($e = (($f = skipped['$=='](0)) ? loop_idx['$zero?']() : $f), $e !== false && $e !== nil ?attributes['$has_key?']("options")['$!']() : $e), $d !== false && $d !== nil ?((next_line = table_reader.$peek_line()))['$nil?']()['$!']() : $d), $c !== false && $c !== nil ?next_line['$empty?']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + table['$has_header_option='](true); + table.$set_option("header");}; + if (parser_ctx.$format()['$==']("psv")) { + if ((($b = parser_ctx['$starts_with_delimiter?'](line)) !== nil && (!$b._isBoolean || $b == true))) { + line = line['$[]']($range(1, -1, false)); + parser_ctx.$close_open_cell(); + } else { + $b = $opal.to_ary(self.$parse_cell_spec(line, "start")), next_cell_spec = ($b[0] == null ? nil : $b[0]), line = ($b[1] == null ? nil : $b[1]); + if ((($b = next_cell_spec['$nil?']()['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + parser_ctx.$close_open_cell(next_cell_spec)}; + }}; + seen = false; + while ((($c = ((($d = seen['$!']()) !== false && $d !== nil) ? $d : line['$empty?']()['$!']())) !== nil && (!$c._isBoolean || $c == true))) { + seen = true; + if ((($c = (m = parser_ctx.$match_delimiter(line))) !== nil && (!$c._isBoolean || $c == true))) { + if (parser_ctx.$format()['$==']("csv")) { + if ((($c = parser_ctx['$buffer_has_unclosed_quotes?'](m.$pre_match())) !== nil && (!$c._isBoolean || $c == true))) { + line = parser_ctx.$skip_matched_delimiter(m); + continue;;} + } else if ((($c = m.$pre_match()['$end_with?']("\\")) !== nil && (!$c._isBoolean || $c == true))) { + line = parser_ctx.$skip_matched_delimiter(m, true); + continue;;}; + if (parser_ctx.$format()['$==']("psv")) { + $c = $opal.to_ary(self.$parse_cell_spec(m.$pre_match(), "end")), next_cell_spec = ($c[0] == null ? nil : $c[0]), cell_text = ($c[1] == null ? nil : $c[1]); + parser_ctx.$push_cell_spec(next_cell_spec); + parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (cell_text)); + } else { + parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (m.$pre_match())) + }; + line = m.$post_match(); + parser_ctx.$close_cell(); + } else { + parser_ctx['$buffer=']("" + (parser_ctx.$buffer()) + (line) + ($scope.EOL)); + if (parser_ctx.$format()['$==']("csv")) { + parser_ctx['$buffer=']("" + (parser_ctx.$buffer().$rstrip()) + " ")}; + line = ""; + if ((($c = ((($d = parser_ctx.$format()['$==']("psv")) !== false && $d !== nil) ? $d : ((($e = parser_ctx.$format()['$==']("csv")) ? parser_ctx['$buffer_has_unclosed_quotes?']() : $e)))) !== nil && (!$c._isBoolean || $c == true))) { + parser_ctx.$keep_cell_open() + } else { + parser_ctx.$close_cell(true) + }; + };}; + if ((($b = parser_ctx['$cell_open?']()) !== nil && (!$b._isBoolean || $b == true))) { + } else { + skipped = table_reader.$skip_blank_lines() + }; + if ((($b = table_reader['$has_more_lines?']()['$!']()) !== nil && (!$b._isBoolean || $b == true))) { + parser_ctx.$close_cell(true)};}; + ($a = "colcount", $b = table.$attributes(), ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, parser_ctx.$col_count()))); + if ((($a = explicit_col_specs['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + even_width = ((100.0)['$/'](parser_ctx.$col_count())).$floor(); + ($a = ($b = table.$columns()).$each, $a._p = (TMP_24 = function(c){var self = TMP_24._s || this; +if (c == null) c = nil; + return c.$assign_width(0, even_width)}, TMP_24._s = self, TMP_24), $a).call($b);}; + table.$partition_header_footer(attributes); + return table; + }); + + $opal.defs(self, '$parse_col_specs', function(records) { + var $a, $b, TMP_25, $c, TMP_26, self = this, specs = nil; + + if ((($a = $scope.DigitsRx['$=~'](records)) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = ($b = (($c = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $c)).$new, $a._p = (TMP_25 = function(){var self = TMP_25._s || this; + + return $hash2(["width"], {"width": 1})}, TMP_25._s = self, TMP_25), $a).call($b, records.$to_i())}; + specs = []; + ($a = ($c = records.$split(",")).$each, $a._p = (TMP_26 = function(record){var self = TMP_26._s || this, $a, $b, TMP_27, m = nil, spec = nil, colspec = nil, rowspec = nil, repeat = nil; +if (record == null) record = nil; + if ((($a = (m = $scope.ColumnSpecRx.$match(record))) !== nil && (!$a._isBoolean || $a == true))) { + spec = $hash2([], {}); + if ((($a = m['$[]'](2)) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(m['$[]'](2).$split(".")), colspec = ($a[0] == null ? nil : $a[0]), rowspec = ($a[1] == null ? nil : $a[1]); + if ((($a = ($b = colspec['$nil_or_empty?']()['$!'](), $b !== false && $b !== nil ?($scope.Table)._scope.ALIGNMENTS['$[]']("h")['$has_key?'](colspec) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + spec['$[]=']("halign", ($scope.Table)._scope.ALIGNMENTS['$[]']("h")['$[]'](colspec))}; + if ((($a = ($b = rowspec['$nil_or_empty?']()['$!'](), $b !== false && $b !== nil ?($scope.Table)._scope.ALIGNMENTS['$[]']("v")['$has_key?'](rowspec) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + spec['$[]=']("valign", ($scope.Table)._scope.ALIGNMENTS['$[]']("v")['$[]'](rowspec))};}; + spec['$[]=']("width", (function() {if ((($a = m['$[]'](3)['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](3).$to_i() + } else { + return 1 + }; return nil; })()); + if ((($a = ($b = m['$[]'](4), $b !== false && $b !== nil ?($scope.Table)._scope.TEXT_STYLES['$has_key?'](m['$[]'](4)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + spec['$[]=']("style", ($scope.Table)._scope.TEXT_STYLES['$[]'](m['$[]'](4)))}; + repeat = (function() {if ((($a = m['$[]'](1)['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return m['$[]'](1).$to_i() + } else { + return 1 + }; return nil; })(); + return ($a = ($b = (1)).$upto, $a._p = (TMP_27 = function(){var self = TMP_27._s || this; + + return specs['$<<'](spec.$dup())}, TMP_27._s = self, TMP_27), $a).call($b, repeat); + } else { + return nil + }}, TMP_26._s = self, TMP_26), $a).call($c); + return specs; + }); + + $opal.defs(self, '$parse_cell_spec', function(line, pos) { + var $a, $b, self = this, spec = nil, rest = nil, m = nil, colspec = nil, rowspec = nil; + + if (pos == null) { + pos = "start" + } + spec = ((function() {if (pos['$==']("end")) { + return $hash2([], {}) + } else { + return nil + }; return nil; })()); + rest = line; + if ((($a = (m = ((function() {if (pos['$==']("start")) { + return $scope.CellSpecStartRx + } else { + return $scope.CellSpecEndRx + }; return nil; })()).$match(line))) !== nil && (!$a._isBoolean || $a == true))) { + spec = $hash2([], {}); + if ((($a = m['$[]'](0)['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return [spec, line]}; + rest = ((function() {if (pos['$==']("start")) { + return m.$post_match() + } else { + return m.$pre_match() + }; return nil; })()); + if ((($a = m['$[]'](1)) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(m['$[]'](1).$split(".")), colspec = ($a[0] == null ? nil : $a[0]), rowspec = ($a[1] == null ? nil : $a[1]); + colspec = (function() {if ((($a = colspec['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return 1 + } else { + return colspec.$to_i() + }; return nil; })(); + rowspec = (function() {if ((($a = rowspec['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return 1 + } else { + return rowspec.$to_i() + }; return nil; })(); + if (m['$[]'](2)['$==']("+")) { + if (colspec['$=='](1)) { + } else { + spec['$[]=']("colspan", colspec) + }; + if (rowspec['$=='](1)) { + } else { + spec['$[]=']("rowspan", rowspec) + }; + } else if (m['$[]'](2)['$==']("*")) { + if (colspec['$=='](1)) { + } else { + spec['$[]=']("repeatcol", colspec) + }};}; + if ((($a = m['$[]'](3)) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(m['$[]'](3).$split(".")), colspec = ($a[0] == null ? nil : $a[0]), rowspec = ($a[1] == null ? nil : $a[1]); + if ((($a = ($b = colspec['$nil_or_empty?']()['$!'](), $b !== false && $b !== nil ?($scope.Table)._scope.ALIGNMENTS['$[]']("h")['$has_key?'](colspec) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + spec['$[]=']("halign", ($scope.Table)._scope.ALIGNMENTS['$[]']("h")['$[]'](colspec))}; + if ((($a = ($b = rowspec['$nil_or_empty?']()['$!'](), $b !== false && $b !== nil ?($scope.Table)._scope.ALIGNMENTS['$[]']("v")['$has_key?'](rowspec) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + spec['$[]=']("valign", ($scope.Table)._scope.ALIGNMENTS['$[]']("v")['$[]'](rowspec))};}; + if ((($a = ($b = m['$[]'](4), $b !== false && $b !== nil ?($scope.Table)._scope.TEXT_STYLES['$has_key?'](m['$[]'](4)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + spec['$[]=']("style", ($scope.Table)._scope.TEXT_STYLES['$[]'](m['$[]'](4)))};}; + return [spec, rest]; + }); + + $opal.defs(self, '$parse_style_attribute', function(attributes, reader) { + var $a, $b, TMP_28, $c, TMP_29, $d, TMP_30, self = this, original_style = nil, raw_style = nil, type = nil, collector = nil, parsed = nil, save_current = nil, parsed_style = nil, options = nil, existing_opts = nil; + + if (reader == null) { + reader = nil + } + original_style = attributes['$[]']("style"); + raw_style = attributes['$[]'](1); + if ((($a = ((($b = raw_style['$!']()) !== false && $b !== nil) ? $b : raw_style['$include?'](" "))) !== nil && (!$a._isBoolean || $a == true))) { + attributes['$[]=']("style", raw_style); + return [raw_style, original_style]; + } else { + type = "style"; + collector = []; + parsed = $hash2([], {}); + save_current = ($a = ($b = self).$lambda, $a._p = (TMP_28 = function(){var self = TMP_28._s || this, $a, $b, $c, $case = nil; + + if ((($a = collector['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = type['$==']("style")['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return self.$warn("asciidoctor: WARNING:" + ((function() {if ((($a = reader['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return " " + (reader.$prev_line_info()) + ":" + }; return nil; })()) + " invalid empty " + (type) + " detected in style attribute") + } else { + return nil + } + } else { + $case = type;if ("role"['$===']($case) || "option"['$===']($case)) {($a = type, $b = parsed, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, []))); + parsed['$[]'](type).$push(collector.$join());}else if ("id"['$===']($case)) {if ((($a = parsed['$has_key?']("id")) !== nil && (!$a._isBoolean || $a == true))) { + self.$warn("asciidoctor: WARNING:" + ((function() {if ((($a = reader['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return " " + (reader.$prev_line_info()) + ":" + }; return nil; })()) + " multiple ids detected in style attribute")}; + parsed['$[]='](type, collector.$join());}else {parsed['$[]='](type, collector.$join())}; + return collector = []; + }}, TMP_28._s = self, TMP_28), $a).call($b); + ($a = ($c = raw_style).$each_char, $a._p = (TMP_29 = function(c){var self = TMP_29._s || this, $a, $b, $c, $case = nil; +if (c == null) c = nil; + if ((($a = ((($b = ((($c = c['$=='](".")) !== false && $c !== nil) ? $c : c['$==']("#"))) !== false && $b !== nil) ? $b : c['$==']("%"))) !== nil && (!$a._isBoolean || $a == true))) { + save_current.$call(); + return (function() {$case = c;if ("."['$===']($case)) {return type = "role"}else if ("#"['$===']($case)) {return type = "id"}else if ("%"['$===']($case)) {return type = "option"}else { return nil }})(); + } else { + return collector.$push(c) + }}, TMP_29._s = self, TMP_29), $a).call($c); + if (type['$==']("style")) { + parsed_style = attributes['$[]=']("style", raw_style) + } else { + save_current.$call(); + if ((($a = parsed['$has_key?']("style")) !== nil && (!$a._isBoolean || $a == true))) { + parsed_style = attributes['$[]=']("style", parsed['$[]']("style")) + } else { + parsed_style = nil + }; + if ((($a = parsed['$has_key?']("id")) !== nil && (!$a._isBoolean || $a == true))) { + attributes['$[]=']("id", parsed['$[]']("id"))}; + if ((($a = parsed['$has_key?']("role")) !== nil && (!$a._isBoolean || $a == true))) { + attributes['$[]=']("role", parsed['$[]']("role")['$*'](" "))}; + if ((($a = parsed['$has_key?']("option")) !== nil && (!$a._isBoolean || $a == true))) { + ($a = ($d = ((options = parsed['$[]']("option")))).$each, $a._p = (TMP_30 = function(option){var self = TMP_30._s || this; +if (option == null) option = nil; + return attributes['$[]=']("" + (option) + "-option", "")}, TMP_30._s = self, TMP_30), $a).call($d); + if ((($a = (existing_opts = attributes['$[]']("options"))) !== nil && (!$a._isBoolean || $a == true))) { + attributes['$[]=']("options", (options['$+'](existing_opts.$split(",")))['$*'](",")) + } else { + attributes['$[]=']("options", options['$*'](",")) + };}; + }; + return [parsed_style, original_style]; + }; + }); + + $opal.defs(self, '$reset_block_indent!', function(lines, indent) { + var $a, $b, TMP_31, $c, TMP_32, $d, TMP_33, self = this, tab_detected = nil, tab_expansion = nil, offsets = nil, offset = nil, padding = nil; + + if (indent == null) { + indent = 0 + } + if ((($a = ((($b = indent['$!']()) !== false && $b !== nil) ? $b : lines['$empty?']())) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + tab_detected = false; + tab_expansion = " "; + offsets = ($a = ($b = lines).$map, $a._p = (TMP_31 = function(line){var self = TMP_31._s || this, $a, flush_line = nil, offset = nil; +if (line == null) line = nil; + if ((($a = line.$chr().$lstrip()['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return ($breaker.$v = [], $breaker) + }; + if ((($a = line['$include?']($scope.TAB)) !== nil && (!$a._isBoolean || $a == true))) { + tab_detected = true; + line = line.$gsub($scope.TAB_PATTERN, tab_expansion);}; + if ((($a = ((flush_line = line.$lstrip()))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else if (((offset = line.$length()['$-'](flush_line.$length())))['$=='](0)) { + return ($breaker.$v = [], $breaker) + } else { + return offset + };}, TMP_31._s = self, TMP_31), $a).call($b); + if ((($a = ((($c = offsets['$empty?']()) !== false && $c !== nil) ? $c : ((offsets = offsets.$compact()))['$empty?']())) !== nil && (!$a._isBoolean || $a == true))) { + } else if (((offset = offsets.$min()))['$>'](0)) { + ($a = ($c = lines)['$map!'], $a._p = (TMP_32 = function(line){var self = TMP_32._s || this; +if (line == null) line = nil; + if (tab_detected !== false && tab_detected !== nil) { + line = line.$gsub($scope.TAB_PATTERN, tab_expansion)}; + return line['$[]']($range(offset, -1, false)).$to_s();}, TMP_32._s = self, TMP_32), $a).call($c)}; + if (indent['$>'](0)) { + padding = " "['$*'](indent); + ($a = ($d = lines)['$map!'], $a._p = (TMP_33 = function(line){var self = TMP_33._s || this; +if (line == null) line = nil; + return "" + (padding) + (line)}, TMP_33._s = self, TMP_33), $a).call($d);}; + return nil; + }); + + $opal.defs(self, '$sanitize_attribute_name', function(name) { + var self = this; + + return name.$gsub($scope.InvalidAttributeNameCharsRx, "").$downcase(); + }); + + return ($opal.defs(self, '$roman_numeral_to_int', function(value) { + var $a, $b, TMP_34, self = this, digits = nil, result = nil; + + value = value.$downcase(); + digits = $hash2(["i", "v", "x"], {"i": 1, "v": 5, "x": 10}); + result = 0; + ($a = ($b = ($range(0, value.$length()['$-'](1), false))).$each, $a._p = (TMP_34 = function(i){var self = TMP_34._s || this, $a, $b, digit = nil; +if (i == null) i = nil; + digit = digits['$[]'](value['$[]']($range(i, i, false))); + if ((($a = (($b = i['$+'](1)['$<'](value.$length())) ? digits['$[]'](value['$[]']($range(i['$+'](1), i['$+'](1), false)))['$>'](digit) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return result = result['$-'](digit) + } else { + return result = result['$+'](digit) + };}, TMP_34._s = self, TMP_34), $a).call($b); + return result; + }), nil) && 'roman_numeral_to_int'; + })(self, null) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range, $gvars = $opal.gvars; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $PathResolver(){}; + var self = $PathResolver = $klass($base, $super, 'PathResolver', $PathResolver); + + var def = self._proto, $scope = self._scope; + + def.file_separator = def._partition_path_web = def._partition_path_sys = def.working_dir = nil; + $opal.cdecl($scope, 'DOT', "."); + + $opal.cdecl($scope, 'DOT_DOT', ".."); + + $opal.cdecl($scope, 'DOT_SLASH', "./"); + + $opal.cdecl($scope, 'SLASH', "/"); + + $opal.cdecl($scope, 'BACKSLASH', "\\"); + + $opal.cdecl($scope, 'DOUBLE_SLASH', "//"); + + $opal.cdecl($scope, 'WindowsRootRx', /^[a-zA-Z]:(?:\\|\/)/); + + self.$attr_accessor("file_separator"); + + self.$attr_accessor("working_dir"); + + def.$initialize = function(file_separator, working_dir) { + var $a, $b, self = this; + + if (file_separator == null) { + file_separator = nil + } + if (working_dir == null) { + working_dir = nil + } + self.file_separator = (function() {if (file_separator !== false && file_separator !== nil) { + return file_separator + } else { + return (((($a = ((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b))._scope.ALT_SEPARATOR) !== false && $a !== nil) ? $a : ((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b))._scope.SEPARATOR)) + }; return nil; })(); + if (working_dir !== false && working_dir !== nil) { + self.working_dir = (function() {if ((($a = (self['$is_root?'](working_dir))) !== nil && (!$a._isBoolean || $a == true))) { + return working_dir + } else { + return ((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(working_dir)) + }; return nil; })() + } else { + self.working_dir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path((($a = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $a).$pwd()) + }; + self._partition_path_sys = $hash2([], {}); + return self._partition_path_web = $hash2([], {}); + }; + + def['$is_root?'] = function(path) { + var $a, $b, self = this; + + if ((($a = path['$start_with?']($scope.SLASH)) !== nil && (!$a._isBoolean || $a == true))) { + return true + } else if ((($a = (($b = self.file_separator['$==']($scope.BACKSLASH)) ? $scope.WindowsRootRx['$=~'](path) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return true + } else { + return false + }; + }; + + def['$is_unc?'] = function(path) { + var self = this; + + return path['$start_with?']($scope.DOUBLE_SLASH); + }; + + def['$is_web_root?'] = function(path) { + var self = this; + + return path['$start_with?']($scope.SLASH); + }; + + def.$posixfy = function(path) { + var $a, self = this; + + if ((($a = path['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return "" + } else if ((($a = path['$include?']($scope.BACKSLASH)) !== nil && (!$a._isBoolean || $a == true))) { + return path.$tr($scope.BACKSLASH, $scope.SLASH) + } else { + return path + }; + }; + + def.$expand_path = function(path) { + var $a, self = this, path_segments = nil, path_root = nil, _ = nil; + + $a = $opal.to_ary(self.$partition_path(path)), path_segments = ($a[0] == null ? nil : $a[0]), path_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); + return self.$join_path(path_segments, path_root); + }; + + def.$partition_path = function(path, web_path) { + var $a, self = this, result = nil, posix_path = nil, root = nil, path_segments = nil; + + if (web_path == null) { + web_path = false + } + if ((($a = (result = (function() {if (web_path !== false && web_path !== nil) { + return self._partition_path_web['$[]'](path) + } else { + return self._partition_path_sys['$[]'](path) + }; return nil; })())) !== nil && (!$a._isBoolean || $a == true))) { + return result}; + posix_path = self.$posixfy(path); + root = (function() {if (web_path !== false && web_path !== nil) { + if ((($a = self['$is_web_root?'](posix_path)) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.SLASH + } else if ((($a = posix_path['$start_with?']($scope.DOT_SLASH)) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.DOT_SLASH + } else { + return nil + } + } else if ((($a = self['$is_root?'](posix_path)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = self['$is_unc?'](posix_path)) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.DOUBLE_SLASH + } else if ((($a = posix_path['$start_with?']($scope.SLASH)) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.SLASH + } else { + return posix_path['$[]']($range(0, (posix_path.$index($scope.SLASH)), false)) + } + } else if ((($a = posix_path['$start_with?']($scope.DOT_SLASH)) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.DOT_SLASH + } else { + return nil + }; return nil; })(); + path_segments = posix_path.$split($scope.SLASH); + if (root['$==']($scope.DOUBLE_SLASH)) { + path_segments = path_segments['$[]']($range(2, -1, false)) + } else if (root !== false && root !== nil) { + path_segments.$shift()}; + path_segments.$delete($scope.DOT); + return ((function() {if (web_path !== false && web_path !== nil) { + return self._partition_path_web + } else { + return self._partition_path_sys + }; return nil; })())['$[]='](path, [path_segments, root, posix_path]); + }; + + def.$join_path = function(segments, root) { + var self = this; + + if (root == null) { + root = nil + } + if (root !== false && root !== nil) { + return "" + (root) + (segments['$*']($scope.SLASH)) + } else { + return segments['$*']($scope.SLASH) + }; + }; + + def.$system_path = function(target, start, jail, opts) { + var $a, $b, TMP_1, self = this, recover = nil, target_segments = nil, target_root = nil, _ = nil, resolved_target = nil, jail_segments = nil, jail_root = nil, start_segments = nil, start_root = nil, resolved_segments = nil, warned = nil; + + if (jail == null) { + jail = nil + } + if (opts == null) { + opts = $hash2([], {}) + } + recover = opts.$fetch("recover", true); + if (jail !== false && jail !== nil) { + if ((($a = self['$is_root?'](jail)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise((($a = $opal.Object._scope.SecurityError) == null ? $opal.cm('SecurityError') : $a), "Jail is not an absolute path: " + (jail)) + }; + jail = self.$posixfy(jail);}; + if ((($a = target['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + target_segments = [] + } else { + $a = $opal.to_ary(self.$partition_path(target)), target_segments = ($a[0] == null ? nil : $a[0]), target_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]) + }; + if ((($a = target_segments['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = start['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return (function() {if (jail !== false && jail !== nil) { + return jail + } else { + return self.working_dir + }; return nil; })() + } else if ((($a = self['$is_root?'](start)) !== nil && (!$a._isBoolean || $a == true))) { + if (jail !== false && jail !== nil) { + } else { + return self.$expand_path(start) + } + } else { + return self.$system_path(start, jail, jail) + }}; + if ((($a = (($b = target_root !== false && target_root !== nil) ? target_root['$==']($scope.DOT_SLASH)['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + resolved_target = self.$join_path(target_segments, target_root); + if ((($a = ((($b = jail['$!']()) !== false && $b !== nil) ? $b : (resolved_target['$start_with?'](jail)))) !== nil && (!$a._isBoolean || $a == true))) { + return resolved_target};}; + if ((($a = start['$nil_or_empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + start = (function() {if (jail !== false && jail !== nil) { + return jail + } else { + return self.working_dir + }; return nil; })() + } else if ((($a = self['$is_root?'](start)) !== nil && (!$a._isBoolean || $a == true))) { + start = self.$posixfy(start) + } else { + start = self.$system_path(start, jail, jail) + }; + if (jail['$=='](start)) { + $a = $opal.to_ary(self.$partition_path(jail)), jail_segments = ($a[0] == null ? nil : $a[0]), jail_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); + start_segments = jail_segments.$dup(); + } else if (jail !== false && jail !== nil) { + if ((($a = start['$start_with?'](jail)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise((($a = $opal.Object._scope.SecurityError) == null ? $opal.cm('SecurityError') : $a), "" + (((($a = opts['$[]']("target_name")) !== false && $a !== nil) ? $a : "Start path")) + " " + (start) + " is outside of jail: " + (jail) + " (disallowed in safe mode)") + }; + $a = $opal.to_ary(self.$partition_path(start)), start_segments = ($a[0] == null ? nil : $a[0]), start_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); + $a = $opal.to_ary(self.$partition_path(jail)), jail_segments = ($a[0] == null ? nil : $a[0]), jail_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); + } else { + $a = $opal.to_ary(self.$partition_path(start)), start_segments = ($a[0] == null ? nil : $a[0]), start_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); + jail_root = start_root; + }; + resolved_segments = start_segments.$dup(); + warned = false; + ($a = ($b = target_segments).$each, $a._p = (TMP_1 = function(segment){var self = TMP_1._s || this, $a; +if (segment == null) segment = nil; + if (segment['$==']($scope.DOT_DOT)) { + if (jail !== false && jail !== nil) { + if (resolved_segments.$length()['$>'](jail_segments.$length())) { + return resolved_segments.$pop() + } else if ((($a = recover['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return self.$raise((($a = $opal.Object._scope.SecurityError) == null ? $opal.cm('SecurityError') : $a), "" + (((($a = opts['$[]']("target_name")) !== false && $a !== nil) ? $a : "path")) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)") + } else if ((($a = warned['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + self.$warn("asciidoctor: WARNING: " + (((($a = opts['$[]']("target_name")) !== false && $a !== nil) ? $a : "path")) + " has illegal reference to ancestor of jail, auto-recovering"); + return warned = true; + } else { + return nil + } + } else { + return resolved_segments.$pop() + } + } else { + return resolved_segments.$push(segment) + }}, TMP_1._s = self, TMP_1), $a).call($b); + return self.$join_path(resolved_segments, jail_root); + }; + + def.$web_path = function(target, start) { + var $a, $b, TMP_2, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, _ = nil, resolved_segments = nil; + if ($gvars["~"] == null) $gvars["~"] = nil; + + if (start == null) { + start = nil + } + target = self.$posixfy(target); + start = self.$posixfy(start); + uri_prefix = nil; + if ((($a = ((($b = start['$nil_or_empty?']()) !== false && $b !== nil) ? $b : (self['$is_web_root?'](target)))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + target = "" + (start) + ($scope.SLASH) + (target); + if ((($a = ($b = (target['$include?'](":")), $b !== false && $b !== nil ?$scope.UriSniffRx['$=~'](target) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + uri_prefix = $gvars["~"]['$[]'](0); + target = target['$[]']($range(uri_prefix.$length(), -1, false));}; + }; + $a = $opal.to_ary(self.$partition_path(target, true)), target_segments = ($a[0] == null ? nil : $a[0]), target_root = ($a[1] == null ? nil : $a[1]), _ = ($a[2] == null ? nil : $a[2]); + resolved_segments = []; + ($a = ($b = target_segments).$each, $a._p = (TMP_2 = function(segment){var self = TMP_2._s || this, $a, $b; +if (segment == null) segment = nil; + if (segment['$==']($scope.DOT_DOT)) { + if ((($a = resolved_segments['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = (($b = target_root !== false && target_root !== nil) ? target_root['$==']($scope.DOT_SLASH)['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + return resolved_segments['$<<'](segment) + } + } else if (resolved_segments['$[]'](-1)['$==']($scope.DOT_DOT)) { + return resolved_segments['$<<'](segment) + } else { + return resolved_segments.$pop() + } + } else { + return resolved_segments['$<<'](segment) + }}, TMP_2._s = self, TMP_2), $a).call($b); + if (uri_prefix !== false && uri_prefix !== nil) { + return "" + (uri_prefix) + (self.$join_path(resolved_segments, target_root)) + } else { + return self.$join_path(resolved_segments, target_root) + }; + }; + + return (def.$relative_path = function(filename, base_directory) { + var $a, $b, self = this, offset = nil; + + if ((($a = ($b = (self['$is_root?'](filename)), $b !== false && $b !== nil ?(self['$is_root?'](base_directory)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + offset = base_directory.$chomp(self.file_separator).$length()['$+'](1); + return filename['$[]']($range(offset, -1, false)); + } else { + return filename + }; + }, nil) && 'relative_path'; + })(self, null) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $Reader(){}; + var self = $Reader = $klass($base, $super, 'Reader', $Reader); + + var def = self._proto, $scope = self._scope, TMP_4; + + def.file = def.dir = def.lines = def.process_lines = def.look_ahead = def.eof = def.unescape_next_line = def.lineno = def.path = def.source_lines = nil; + (function($base, $super) { + function $Cursor(){}; + var self = $Cursor = $klass($base, $super, 'Cursor', $Cursor); + + var def = self._proto, $scope = self._scope; + + self.$attr_accessor("file"); + + self.$attr_accessor("dir"); + + self.$attr_accessor("path"); + + self.$attr_accessor("lineno"); + + def.$initialize = function(file, dir, path, lineno) { + var self = this; + + if (dir == null) { + dir = nil + } + if (path == null) { + path = nil + } + if (lineno == null) { + lineno = nil + } + self.file = file; + self.dir = dir; + self.path = path; + return self.lineno = lineno; + }; + + def.$line_info = function() { + var self = this; + + return "" + (self.$path()) + ": line " + (self.$lineno()); + }; + + return $opal.defn(self, '$to_s', def.$line_info); + })(self, null); + + self.$attr_reader("file"); + + self.$attr_reader("dir"); + + self.$attr_reader("path"); + + self.$attr_reader("lineno"); + + self.$attr_reader("source_lines"); + + self.$attr_accessor("process_lines"); + + def.$initialize = function(data, cursor, opts) { + var $a, $b, self = this; + + if (data == null) { + data = nil + } + if (cursor == null) { + cursor = nil + } + if (opts == null) { + opts = $hash2(["normalize"], {"normalize": false}) + } + if ((($a = cursor['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + self.file = self.dir = nil; + self.path = ""; + self.lineno = 1; + } else if ((($a = cursor['$is_a?']((($b = $opal.Object._scope.String) == null ? $opal.cm('String') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + self.file = cursor; + self.dir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(self.file); + self.path = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$basename(self.file); + self.lineno = 1; + } else { + self.file = cursor.$file(); + self.dir = cursor.$dir(); + self.path = ((($a = cursor.$path()) !== false && $a !== nil) ? $a : ""); + if ((($a = self.file) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = self.dir) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.dir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(self.file); + if (self.dir['$=='](".")) { + self.dir = nil}; + }; + if ((($a = cursor.$path()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.path = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$basename(self.file) + };}; + self.lineno = ((($a = cursor.$lineno()) !== false && $a !== nil) ? $a : 1); + }; + self.lines = (function() {if (data !== false && data !== nil) { + return (self.$prepare_lines(data, opts)) + } else { + return [] + }; return nil; })(); + self.source_lines = self.lines.$dup(); + self.eof = self.lines['$empty?'](); + self.look_ahead = 0; + self.process_lines = true; + return self.unescape_next_line = false; + }; + + def.$prepare_lines = function(data, opts) { + var $a, $b, self = this; + + if (opts == null) { + opts = $hash2([], {}) + } + if ((($a = data['$is_a?']((($b = $opal.Object._scope.String) == null ? $opal.cm('String') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = opts['$[]']("normalize")) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.Helpers.$normalize_lines_from_string(data) + } else { + return data.$split($scope.EOL) + } + } else if ((($a = opts['$[]']("normalize")) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.Helpers.$normalize_lines_array(data) + } else { + return data.$dup() + }; + }; + + def.$process_line = function(line) { + var $a, self = this; + + if ((($a = self.process_lines) !== nil && (!$a._isBoolean || $a == true))) { + self.look_ahead = self.look_ahead['$+'](1)}; + return line; + }; + + def['$has_more_lines?'] = function() { + var $a, self = this; + + return (((($a = self.eof) !== false && $a !== nil) ? $a : (self.eof = self.$peek_line()['$nil?']())))['$!'](); + }; + + def['$next_line_empty?'] = function() { + var self = this; + + return self.$peek_line()['$nil_or_empty?'](); + }; + + def.$peek_line = function(direct) { + var $a, $b, self = this, line = nil; + + if (direct == null) { + direct = false + } + if ((($a = ((($b = direct) !== false && $b !== nil) ? $b : self.look_ahead['$>'](0))) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = self.unescape_next_line) !== nil && (!$a._isBoolean || $a == true))) { + return self.lines['$[]'](0)['$[]']($range(1, -1, false)) + } else { + return self.lines['$[]'](0) + } + } else if ((($a = ((($b = self.eof) !== false && $b !== nil) ? $b : self.lines['$empty?']())) !== nil && (!$a._isBoolean || $a == true))) { + self.eof = true; + self.look_ahead = 0; + return nil; + } else if ((($a = ((line = self.$process_line(self.lines['$[]'](0))))['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return self.$peek_line() + } else { + return line + }; + }; + + def.$peek_lines = function(num, direct) { + var $a, $b, TMP_1, $c, TMP_2, self = this, old_look_ahead = nil, result = nil; + + if (num == null) { + num = 1 + } + if (direct == null) { + direct = true + } + old_look_ahead = self.look_ahead; + result = []; + ($a = ($b = num).$times, $a._p = (TMP_1 = function(){var self = TMP_1._s || this, $a, line = nil; + + if ((($a = (line = self.$read_line(direct))) !== nil && (!$a._isBoolean || $a == true))) { + return result['$<<'](line) + } else { + return ($breaker.$v = nil, $breaker) + }}, TMP_1._s = self, TMP_1), $a).call($b); + if ((($a = result['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + ($a = ($c = result).$reverse_each, $a._p = (TMP_2 = function(line){var self = TMP_2._s || this; +if (line == null) line = nil; + return self.$unshift(line)}, TMP_2._s = self, TMP_2), $a).call($c); + if (direct !== false && direct !== nil) { + self.look_ahead = old_look_ahead}; + }; + return result; + }; + + def.$read_line = function(direct) { + var $a, $b, $c, self = this; + + if (direct == null) { + direct = false + } + if ((($a = ((($b = ((($c = direct) !== false && $c !== nil) ? $c : self.look_ahead['$>'](0))) !== false && $b !== nil) ? $b : self['$has_more_lines?']())) !== nil && (!$a._isBoolean || $a == true))) { + return self.$shift() + } else { + return nil + }; + }; + + def.$read_lines = function() { + var $a, $b, self = this, lines = nil; + + lines = []; + while ((($b = self['$has_more_lines?']()) !== nil && (!$b._isBoolean || $b == true))) { + lines['$<<'](self.$shift())}; + return lines; + }; + + $opal.defn(self, '$readlines', def.$read_lines); + + def.$read = function() { + var self = this; + + return self.$read_lines()['$*']($scope.EOL); + }; + + def.$advance = function(direct) { + var self = this; + + if (direct == null) { + direct = true + } + return self.$read_line(direct)['$!']()['$!'](); + }; + + def.$unshift_line = function(line_to_restore) { + var self = this; + + self.$unshift(line_to_restore); + return nil; + }; + + $opal.defn(self, '$restore_line', def.$unshift_line); + + def.$unshift_lines = function(lines_to_restore) { + var $a, $b, TMP_3, self = this; + + ($a = ($b = lines_to_restore).$reverse_each, $a._p = (TMP_3 = function(line){var self = TMP_3._s || this; +if (line == null) line = nil; + return self.$unshift(line)}, TMP_3._s = self, TMP_3), $a).call($b); + return nil; + }; + + $opal.defn(self, '$restore_lines', def.$unshift_lines); + + def.$replace_line = function(replacement) { + var self = this; + + self.$advance(); + self.$unshift(replacement); + return nil; + }; + + def.$skip_blank_lines = function() { + var $a, $b, self = this, num_skipped = nil, next_line = nil; + + if ((($a = self['$eof?']()) !== nil && (!$a._isBoolean || $a == true))) { + return 0}; + num_skipped = 0; + while ((($b = (next_line = self.$peek_line())) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = next_line['$empty?']()) !== nil && (!$b._isBoolean || $b == true))) { + self.$advance(); + num_skipped = num_skipped['$+'](1); + } else { + return num_skipped + }}; + return num_skipped; + }; + + def.$skip_comment_lines = function(opts) { + var $a, $b, $c, $d, self = this, comment_lines = nil, include_blank_lines = nil, next_line = nil, commentish = nil, match = nil; + + if (opts == null) { + opts = $hash2([], {}) + } + if ((($a = self['$eof?']()) !== nil && (!$a._isBoolean || $a == true))) { + return []}; + comment_lines = []; + include_blank_lines = opts['$[]']("include_blank_lines"); + while ((($b = (next_line = self.$peek_line())) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = (($c = include_blank_lines !== false && include_blank_lines !== nil) ? next_line['$empty?']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + comment_lines['$<<'](self.$shift()) + } else if ((($b = ($c = (commentish = next_line['$start_with?']("//")), $c !== false && $c !== nil ?(match = $scope.CommentBlockRx.$match(next_line)) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + comment_lines['$<<'](self.$shift()); + ($b = comment_lines).$push.apply($b, [].concat((self.$read_lines_until($hash2(["terminator", "read_last_line", "skip_processing"], {"terminator": match['$[]'](0), "read_last_line": true, "skip_processing": true}))))); + } else if ((($c = (($d = commentish !== false && commentish !== nil) ? $scope.CommentLineRx['$=~'](next_line) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + comment_lines['$<<'](self.$shift()) + } else { + break; + }}; + return comment_lines; + }; + + def.$skip_line_comments = function() { + var $a, $b, self = this, comment_lines = nil, next_line = nil; + + if ((($a = self['$eof?']()) !== nil && (!$a._isBoolean || $a == true))) { + return []}; + comment_lines = []; + while ((($b = (next_line = self.$peek_line())) !== nil && (!$b._isBoolean || $b == true))) { + if ((($b = $scope.CommentLineRx['$=~'](next_line)) !== nil && (!$b._isBoolean || $b == true))) { + comment_lines['$<<'](self.$shift()) + } else { + break; + }}; + return comment_lines; + }; + + def.$terminate = function() { + var self = this; + + self.lineno = self.lineno['$+'](self.lines.$size()); + self.lines.$clear(); + self.eof = true; + self.look_ahead = 0; + return nil; + }; + + def['$eof?'] = function() { + var self = this; + + return self['$has_more_lines?']()['$!'](); + }; + + $opal.defn(self, '$empty?', def['$eof?']); + + def.$read_lines_until = TMP_4 = function(options) { + var $a, $b, $c, $d, $e, self = this, $iter = TMP_4._p, $yield = $iter || nil, result = nil, restore_process_lines = nil, terminator = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_line_comments = nil, line_read = nil, line_restored = nil, complete = nil, line = nil; + + if (options == null) { + options = $hash2([], {}) + } + TMP_4._p = null; + result = []; + if ((($a = options['$[]']("skip_first_line")) !== nil && (!$a._isBoolean || $a == true))) { + self.$advance()}; + if ((($a = ($b = self.process_lines, $b !== false && $b !== nil ?options['$[]']("skip_processing") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.process_lines = false; + restore_process_lines = true; + } else { + restore_process_lines = false + }; + if ((($a = (terminator = options['$[]']("terminator"))) !== nil && (!$a._isBoolean || $a == true))) { + break_on_blank_lines = false; + break_on_list_continuation = false; + } else { + break_on_blank_lines = options['$[]']("break_on_blank_lines"); + break_on_list_continuation = options['$[]']("break_on_list_continuation"); + }; + skip_line_comments = options['$[]']("skip_line_comments"); + line_read = false; + line_restored = false; + complete = false; + while ((($b = ($c = complete['$!'](), $c !== false && $c !== nil ?(line = self.$read_line()) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + complete = (function() {while ((($c = true) !== nil && (!$c._isBoolean || $c == true))) { + if ((($c = (($d = terminator !== false && terminator !== nil) ? line['$=='](terminator) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + return true}; + if ((($c = (($d = break_on_blank_lines !== false && break_on_blank_lines !== nil) ? line['$empty?']() : $d)) !== nil && (!$c._isBoolean || $c == true))) { + return true}; + if ((($c = ($d = (($e = break_on_list_continuation !== false && break_on_list_continuation !== nil) ? line_read : $e), $d !== false && $d !== nil ?line['$==']($scope.LIST_CONTINUATION) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + options['$[]=']("preserve_last_line", true); + return true;}; + if ((($c = (($d = ($yield !== nil)) ? (((($e = $opal.$yield1($yield, line)) === $breaker) ? $breaker.$v : $e)) : $d)) !== nil && (!$c._isBoolean || $c == true))) { + return true}; + return false;}; return nil; })(); + if (complete !== false && complete !== nil) { + if ((($b = options['$[]']("read_last_line")) !== nil && (!$b._isBoolean || $b == true))) { + result['$<<'](line); + line_read = true;}; + if ((($b = options['$[]']("preserve_last_line")) !== nil && (!$b._isBoolean || $b == true))) { + self.$restore_line(line); + line_restored = true;}; + } else if ((($b = ($c = (($d = skip_line_comments !== false && skip_line_comments !== nil) ? line['$start_with?']("//") : $d), $c !== false && $c !== nil ?$scope.CommentLineRx['$=~'](line) : $c)) !== nil && (!$b._isBoolean || $b == true))) { + } else { + result['$<<'](line); + line_read = true; + };}; + if (restore_process_lines !== false && restore_process_lines !== nil) { + self.process_lines = true; + if ((($a = (($b = line_restored !== false && line_restored !== nil) ? terminator['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.look_ahead = self.look_ahead['$-'](1)};}; + return result; + }; + + def.$shift = function() { + var self = this; + + self.lineno = self.lineno['$+'](1); + if (self.look_ahead['$=='](0)) { + } else { + self.look_ahead = self.look_ahead['$-'](1) + }; + return self.lines.$shift(); + }; + + def.$unshift = function(line) { + var self = this; + + self.lineno = self.lineno['$-'](1); + self.look_ahead = self.look_ahead['$+'](1); + self.eof = false; + return self.lines.$unshift(line); + }; + + def.$cursor = function() { + var self = this; + + return $scope.Cursor.$new(self.file, self.dir, self.path, self.lineno); + }; + + def.$line_info = function() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno); + }; + + $opal.defn(self, '$next_line_info', def.$line_info); + + def.$prev_line_info = function() { + var self = this; + + return "" + (self.path) + ": line " + (self.lineno['$-'](1)); + }; + + def.$lines = function() { + var self = this; + + return self.lines.$dup(); + }; + + def.$string = function() { + var self = this; + + return self.lines['$*']($scope.EOL); + }; + + def.$source = function() { + var self = this; + + return self.source_lines['$*']($scope.EOL); + }; + + return (def.$to_s = function() { + var self = this; + + return self.$line_info(); + }, nil) && 'to_s'; + })(self, null); + + (function($base, $super) { + function $PreprocessorReader(){}; + var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader); + + var def = self._proto, $scope = self._scope, TMP_5, TMP_6, TMP_7, TMP_20; + + def.document = def.lineno = def.process_lines = def.look_ahead = def.skipping = def.include_stack = def.conditional_stack = def.path = def.include_processor_extensions = def.maxdepth = def.dir = def.lines = def.file = def.includes = def.unescape_next_line = nil; + self.$attr_reader("include_stack"); + + self.$attr_reader("includes"); + + def.$initialize = TMP_5 = function(document, data, cursor) { + var $a, $b, $c, self = this, $iter = TMP_5._p, $yield = $iter || nil, include_depth_default = nil; + + if (data == null) { + data = nil + } + if (cursor == null) { + cursor = nil + } + TMP_5._p = null; + self.document = document; + $opal.find_super_dispatcher(self, 'initialize', TMP_5, null).apply(self, [data, cursor, $hash2(["normalize"], {"normalize": true})]); + include_depth_default = document.$attributes().$fetch("max-include-depth", 64).$to_i(); + if (include_depth_default['$<'](0)) { + include_depth_default = 0}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": include_depth_default, "rel": include_depth_default}); + self.include_stack = []; + self.includes = (($a = "includes", $b = document.$references(), ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, [])))); + self.skipping = false; + self.conditional_stack = []; + return self.include_processor_extensions = nil; + }; + + def.$prepare_lines = TMP_6 = function(data, opts) {var $zuper = $slice.call(arguments, 0); + var $a, $b, $c, self = this, $iter = TMP_6._p, $yield = $iter || nil, result = nil, front_matter = nil, first = nil, last = nil, indent = nil; + + if (opts == null) { + opts = $hash2([], {}) + } + TMP_6._p = null; + result = $opal.find_super_dispatcher(self, 'prepare_lines', TMP_6, $iter).apply(self, $zuper); + if ((($a = ($b = self.document, $b !== false && $b !== nil ?(self.document.$attributes()['$has_key?']("skip-front-matter")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = (front_matter = self['$skip_front_matter!'](result))) !== nil && (!$a._isBoolean || $a == true))) { + self.document.$attributes()['$[]=']("front-matter", front_matter['$*']($scope.EOL))}}; + if ((($a = opts.$fetch("condense", true)) !== nil && (!$a._isBoolean || $a == true))) { + while ((($b = ($c = (first = result['$[]'](0)), $c !== false && $c !== nil ?first['$empty?']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + ($b = result.$shift(), $b !== false && $b !== nil ?self.lineno = self.lineno['$+'](1) : $b)}; + while ((($b = ($c = (last = result['$[]'](-1)), $c !== false && $c !== nil ?last['$empty?']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + result.$pop()};}; + if ((($a = (indent = opts.$fetch("indent", nil))) !== nil && (!$a._isBoolean || $a == true))) { + $scope.Parser['$reset_block_indent!'](result, indent.$to_i())}; + return result; + }; + + def.$process_line = function(line) { + var $a, $b, $c, $d, self = this, match = nil, escaped = nil; + + if ((($a = self.process_lines) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return line + }; + if ((($a = line['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.look_ahead = self.look_ahead['$+'](1); + return "";}; + if ((($a = ($b = ($c = line['$end_with?']("]"), $c !== false && $c !== nil ?line['$start_with?']("[")['$!']() : $c), $b !== false && $b !== nil ?line['$include?']("::") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ($b = line['$include?']("if"), $b !== false && $b !== nil ?(match = $scope.ConditionalDirectiveRx.$match(line)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = line['$start_with?']("\\")) !== nil && (!$a._isBoolean || $a == true))) { + self.unescape_next_line = true; + self.look_ahead = self.look_ahead['$+'](1); + return line['$[]']($range(1, -1, false)); + } else if ((($a = ($b = self).$preprocess_conditional_inclusion.apply($b, [].concat(match.$captures()))) !== nil && (!$a._isBoolean || $a == true))) { + self.$advance(); + return nil; + } else { + self.look_ahead = self.look_ahead['$+'](1); + return line; + } + } else if ((($a = self.skipping) !== nil && (!$a._isBoolean || $a == true))) { + self.$advance(); + return nil; + } else if ((($a = ($c = (((($d = (escaped = line['$start_with?']("\\include::"))) !== false && $d !== nil) ? $d : line['$start_with?']("include::"))), $c !== false && $c !== nil ?(match = $scope.IncludeDirectiveRx.$match(line)) : $c)) !== nil && (!$a._isBoolean || $a == true))) { + if (escaped !== false && escaped !== nil) { + self.unescape_next_line = true; + self.look_ahead = self.look_ahead['$+'](1); + return line['$[]']($range(1, -1, false)); + } else if ((($a = self.$preprocess_include(match['$[]'](1), match['$[]'](2).$strip())) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + self.look_ahead = self.look_ahead['$+'](1); + return line; + } + } else { + self.look_ahead = self.look_ahead['$+'](1); + return line; + } + } else if ((($a = self.skipping) !== nil && (!$a._isBoolean || $a == true))) { + self.$advance(); + return nil; + } else { + self.look_ahead = self.look_ahead['$+'](1); + return line; + }; + }; + + def.$peek_line = TMP_7 = function(direct) {var $zuper = $slice.call(arguments, 0); + var $a, self = this, $iter = TMP_7._p, $yield = $iter || nil, line = nil; + + if (direct == null) { + direct = false + } + TMP_7._p = null; + if ((($a = (line = $opal.find_super_dispatcher(self, 'peek_line', TMP_7, $iter).apply(self, $zuper))) !== nil && (!$a._isBoolean || $a == true))) { + return line + } else if ((($a = self.include_stack['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil + } else { + self.$pop_include(); + return self.$peek_line(direct); + }; + }; + + def.$preprocess_conditional_inclusion = function(directive, target, delimiter, text) { + var $a, $b, $c, $d, TMP_8, TMP_9, TMP_10, $e, TMP_11, $f, self = this, stack_size = nil, pair = nil, skip = nil, $case = nil, expr_match = nil, lhs = nil, op = nil, rhs = nil, conditional_line = nil; + + if ((($a = ((($b = (($c = (((($d = directive['$==']("ifdef")) !== false && $d !== nil) ? $d : directive['$==']("ifndef"))), $c !== false && $c !== nil ?target['$empty?']() : $c))) !== false && $b !== nil) ? $b : ((($c = directive['$==']("endif")) ? text : $c)))) !== nil && (!$a._isBoolean || $a == true))) { + return false}; + target = target.$downcase(); + if (directive['$==']("endif")) { + stack_size = self.conditional_stack.$size(); + if (stack_size['$>'](0)) { + pair = self.conditional_stack['$[]'](-1); + if ((($a = ((($b = target['$empty?']()) !== false && $b !== nil) ? $b : target['$=='](pair['$[]']("target")))) !== nil && (!$a._isBoolean || $a == true))) { + self.conditional_stack.$pop(); + self.skipping = (function() {if ((($a = self.conditional_stack['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return false + } else { + return self.conditional_stack['$[]'](-1)['$[]']("skipping") + }; return nil; })(); + } else { + self.$warn("asciidoctor: ERROR: " + (self.$line_info()) + ": mismatched macro: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]") + }; + } else { + self.$warn("asciidoctor: ERROR: " + (self.$line_info()) + ": unmatched macro: endif::" + (target) + "[]") + }; + return true;}; + skip = false; + if ((($a = self.skipping) !== nil && (!$a._isBoolean || $a == true))) { + } else { + $case = directive;if ("ifdef"['$===']($case)) {$case = delimiter;if (nil['$===']($case)) {skip = self.document.$attributes()['$has_key?'](target)['$!']()}else if (","['$===']($case)) {skip = ($a = ($b = target.$split(",")).$detect, $a._p = (TMP_8 = function(name){var self = TMP_8._s || this; + if (self.document == null) self.document = nil; +if (name == null) name = nil; + return self.document.$attributes()['$has_key?'](name)}, TMP_8._s = self, TMP_8), $a).call($b)['$!']()}else if ("+"['$===']($case)) {skip = ($a = ($c = target.$split("+")).$detect, $a._p = (TMP_9 = function(name){var self = TMP_9._s || this; + if (self.document == null) self.document = nil; +if (name == null) name = nil; + return self.document.$attributes()['$has_key?'](name)['$!']()}, TMP_9._s = self, TMP_9), $a).call($c)}}else if ("ifndef"['$===']($case)) {$case = delimiter;if (nil['$===']($case)) {skip = self.document.$attributes()['$has_key?'](target)}else if (","['$===']($case)) {skip = ($a = ($d = target.$split(",")).$detect, $a._p = (TMP_10 = function(name){var self = TMP_10._s || this; + if (self.document == null) self.document = nil; +if (name == null) name = nil; + return self.document.$attributes()['$has_key?'](name)['$!']()}, TMP_10._s = self, TMP_10), $a).call($d)['$!']()}else if ("+"['$===']($case)) {skip = ($a = ($e = target.$split("+")).$detect, $a._p = (TMP_11 = function(name){var self = TMP_11._s || this; + if (self.document == null) self.document = nil; +if (name == null) name = nil; + return self.document.$attributes()['$has_key?'](name)}, TMP_11._s = self, TMP_11), $a).call($e)}}else if ("ifeval"['$===']($case)) {if ((($a = ((($f = target['$empty?']()['$!']()) !== false && $f !== nil) ? $f : ((expr_match = $scope.EvalExpressionRx.$match(text.$strip())))['$!']())) !== nil && (!$a._isBoolean || $a == true))) { + return false}; + lhs = self.$resolve_expr_val(expr_match['$[]'](1)); + op = expr_match['$[]'](2); + rhs = self.$resolve_expr_val(expr_match['$[]'](3)); + skip = (lhs.$send(op.$to_sym(), rhs))['$!']();} + }; + if ((($a = ((($f = directive['$==']("ifeval")) !== false && $f !== nil) ? $f : text['$!']())) !== nil && (!$a._isBoolean || $a == true))) { + if (skip !== false && skip !== nil) { + self.skipping = true}; + self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping})); + } else if ((($a = ((($f = self.skipping) !== false && $f !== nil) ? $f : skip)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + conditional_line = self.$peek_line(true); + self.$replace_line(text.$rstrip()); + self.$unshift(conditional_line); + return true; + }; + return true; + }; + + def.$preprocess_include = function(raw_target, raw_attributes) { + var $a, $b, $c, $d, TMP_12, TMP_13, TMP_14, $e, TMP_16, $f, TMP_19, self = this, target = nil, extension = nil, abs_maxdepth = nil, target_type = nil, include_file = nil, path = nil, inc_lines = nil, tags = nil, attributes = nil, selected = nil, inc_line_offset = nil, inc_lineno = nil, active_tag = nil, tags_found = nil, missing_tags = nil; + + if ((($a = ((target = self.document.$sub_attributes(raw_target, $hash2(["attribute_missing"], {"attribute_missing": "drop-line"}))))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + if (self.document.$attributes().$fetch("attribute-missing", $scope.Compliance.$attribute_missing())['$==']("skip")) { + self.$replace_line("Unresolved directive in " + (self.path) + " - include::" + (raw_target) + "[" + (raw_attributes) + "]"); + return true; + } else { + self.$advance(); + return true; + } + } else if ((($a = ($b = self['$include_processors?'](), $b !== false && $b !== nil ?(extension = ($c = ($d = self.include_processor_extensions).$find, $c._p = (TMP_12 = function(candidate){var self = TMP_12._s || this; +if (candidate == null) candidate = nil; + return candidate.$instance()['$handles?'](target)}, TMP_12._s = self, TMP_12), $c).call($d)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.$advance(); + extension.$process_method()['$[]'](self, target, $scope.AttributeList.$new(raw_attributes).$parse()); + return true; + } else if (self.document.$safe()['$>='](($scope.SafeMode)._scope.SECURE)) { + self.$replace_line("link:" + (target) + "[]"); + return true; + } else if ((($a = (($b = ((abs_maxdepth = self.maxdepth['$[]']("abs")))['$>'](0)) ? self.include_stack.$size()['$>='](abs_maxdepth) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.$warn("asciidoctor: ERROR: " + (self.$line_info()) + ": maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded"); + return false; + } else if (abs_maxdepth['$>'](0)) { + if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) !== nil && (!$a._isBoolean || $a == true))) { + target_type = "file"; + include_file = path = (function() {if ((($a = self.include_stack['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $a).$pwd()['$=='](self.document.$base_dir())) { + return target + } else { + return ((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join(self.dir, target)) + } + } else { + return (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join(self.dir, target) + }; return nil; })(); + } else if ((($a = ($b = target['$include?'](":"), $b !== false && $b !== nil ?$scope.UriSniffRx['$=~'](target) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = self.document.$attributes()['$has_key?']("allow-uri-read")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$replace_line("link:" + (target) + "[]"); + return true; + }; + target_type = "uri"; + include_file = path = target; + if ((($a = self.document.$attributes()['$has_key?']("cache-uri")) !== nil && (!$a._isBoolean || $a == true))) { + $scope.Helpers.$require_library("open-uri/cached", "open-uri-cached") + } else if ((($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + (($a = $opal.Object._scope.OpenURI) == null ? $opal.cm('OpenURI') : $a)}; + } else { + target_type = "file"; + include_file = self.document.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"})); + if ((($a = (($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b)['$file?'](include_file)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": include file not found: " + (include_file)); + self.$replace_line("Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (raw_attributes) + "]"); + return true; + }; + path = $scope.PathResolver.$new().$relative_path(include_file, self.document.$base_dir()); + }; + inc_lines = nil; + tags = nil; + attributes = $hash2([], {}); + if ((($a = raw_attributes['$empty?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + attributes = $scope.AttributeList.$new(raw_attributes).$parse(); + if ((($a = attributes['$has_key?']("lines")) !== nil && (!$a._isBoolean || $a == true))) { + inc_lines = []; + ($a = ($b = attributes['$[]']("lines").$split($scope.DataDelimiterRx)).$each, $a._p = (TMP_13 = function(linedef){var self = TMP_13._s || this, $a, $b, $c, from = nil, to = nil; +if (linedef == null) linedef = nil; + if ((($a = linedef['$include?']("..")) !== nil && (!$a._isBoolean || $a == true))) { + $a = $opal.to_ary(($b = ($c = linedef.$split("..")).$map, $b._p = "to_i".$to_proc(), $b).call($c)), from = ($a[0] == null ? nil : $a[0]), to = ($a[1] == null ? nil : $a[1]); + if (to['$=='](-1)) { + inc_lines['$<<'](from); + return inc_lines['$<<']((1.0)['$/'](0.0)); + } else { + return inc_lines.$concat((($a = $opal.Object._scope.Range) == null ? $opal.cm('Range') : $a).$new(from, to).$to_a()) + }; + } else { + return inc_lines['$<<'](linedef.$to_i()) + }}, TMP_13._s = self, TMP_13), $a).call($b); + inc_lines = inc_lines.$sort().$uniq(); + } else if ((($a = attributes['$has_key?']("tag")) !== nil && (!$a._isBoolean || $a == true))) { + tags = [attributes['$[]']("tag")].$to_set() + } else if ((($a = attributes['$has_key?']("tags")) !== nil && (!$a._isBoolean || $a == true))) { + tags = attributes['$[]']("tags").$split($scope.DataDelimiterRx).$uniq().$to_set()};}; + if ((($a = inc_lines['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = inc_lines['$empty?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + selected = []; + inc_line_offset = 0; + inc_lineno = 0; + try { + ($a = ($c = self).$open, $a._p = (TMP_14 = function(f){var self = TMP_14._s || this, $a, $b, TMP_15; +if (f == null) f = nil; + return ($a = ($b = f).$each_line, $a._p = (TMP_15 = function(l){var self = TMP_15._s || this, $a, $b, $c, take = nil; +if (l == null) l = nil; + inc_lineno = inc_lineno['$+'](1); + take = inc_lines['$[]'](0); + if ((($a = ($b = take['$is_a?']((($c = $opal.Object._scope.Float) == null ? $opal.cm('Float') : $c)), $b !== false && $b !== nil ?take['$infinite?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + selected.$push(l); + if (inc_line_offset['$=='](0)) { + return inc_line_offset = inc_lineno + } else { + return nil + }; + } else { + if (f.$lineno()['$=='](take)) { + selected.$push(l); + if (inc_line_offset['$=='](0)) { + inc_line_offset = inc_lineno}; + inc_lines.$shift();}; + if ((($a = inc_lines['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return ($breaker.$v = nil, $breaker) + } else { + return nil + }; + };}, TMP_15._s = self, TMP_15), $a).call($b)}, TMP_14._s = self, TMP_14), $a).call($c, include_file, "r") + } catch ($err) {if (true) { + self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": include " + (target_type) + " not readable: " + (include_file)); + self.$replace_line("Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (raw_attributes) + "]"); + return true; + }else { throw $err; } + }; + self.$advance(); + self.$push_include(selected, include_file, path, inc_line_offset, attributes);} + } else if ((($a = tags['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = tags['$empty?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + selected = []; + inc_line_offset = 0; + inc_lineno = 0; + active_tag = nil; + tags_found = (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new(); + try { + ($a = ($e = self).$open, $a._p = (TMP_16 = function(f){var self = TMP_16._s || this, $a, $b, TMP_17; +if (f == null) f = nil; + return ($a = ($b = f).$each_line, $a._p = (TMP_17 = function(l){var self = TMP_17._s || this, $a, $b, TMP_18; +if (l == null) l = nil; + inc_lineno = inc_lineno['$+'](1); + if ((($a = $scope.FORCE_ENCODING) !== nil && (!$a._isBoolean || $a == true))) { + l.$force_encoding(((($a = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $a))._scope.UTF_8)}; + if ((($a = active_tag['$nil?']()['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = l['$include?']("end::" + (active_tag) + "[]")) !== nil && (!$a._isBoolean || $a == true))) { + return active_tag = nil + } else { + selected.$push(l); + if (inc_line_offset['$=='](0)) { + return inc_line_offset = inc_lineno + } else { + return nil + }; + } + } else { + return ($a = ($b = tags).$each, $a._p = (TMP_18 = function(tag){var self = TMP_18._s || this, $a; +if (tag == null) tag = nil; + if ((($a = l['$include?']("tag::" + (tag) + "[]")) !== nil && (!$a._isBoolean || $a == true))) { + active_tag = tag; + tags_found['$<<'](tag); + return ($breaker.$v = nil, $breaker); + } else { + return nil + }}, TMP_18._s = self, TMP_18), $a).call($b) + };}, TMP_17._s = self, TMP_17), $a).call($b)}, TMP_16._s = self, TMP_16), $a).call($e, include_file, "r") + } catch ($err) {if (true) { + self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": include " + (target_type) + " not readable: " + (include_file)); + self.$replace_line("Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (raw_attributes) + "]"); + return true; + }else { throw $err; } + }; + if ((($a = ((missing_tags = tags.$to_a()['$-'](tags_found.$to_a())))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": tag" + ((function() {if (missing_tags.$size()['$>'](1)) { + return "s" + } else { + return nil + }; return nil; })()) + " '" + (missing_tags['$*'](",")) + "' not found in include " + (target_type) + ": " + (include_file)) + }; + self.$advance(); + self.$push_include(selected, include_file, path, inc_line_offset, attributes);} + } else { + try { + self.$advance(); + self.$push_include(($a = ($f = self).$open, $a._p = (TMP_19 = function(f){var self = TMP_19._s || this; +if (f == null) f = nil; + return f.$read()}, TMP_19._s = self, TMP_19), $a).call($f, include_file, "r"), include_file, path, 1, attributes); + } catch ($err) {if (true) { + self.$warn("asciidoctor: WARNING: " + (self.$line_info()) + ": include " + (target_type) + " not readable: " + (include_file)); + self.$replace_line("Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (raw_attributes) + "]"); + return true; + }else { throw $err; } + } + }; + return true; + } else { + return false + }; + }; + + def.$push_include = function(data, file, path, lineno, attributes) { + var $a, self = this, depth = nil; + + if (file == null) { + file = nil + } + if (path == null) { + path = nil + } + if (lineno == null) { + lineno = 1 + } + if (attributes == null) { + attributes = $hash2([], {}) + } + self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]); + if (file !== false && file !== nil) { + self.file = file; + self.dir = $scope.File.$dirname(file); + self.process_lines = $scope.ASCIIDOC_EXTENSIONS['$[]']((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$extname(file)); + } else { + self.file = nil; + self.dir = "."; + self.process_lines = true; + }; + self.path = (function() {if (path !== false && path !== nil) { + self.includes['$<<']($scope.Helpers.$rootname(path)); + return path; + } else { + return "" + }; return nil; })(); + self.lineno = lineno; + if ((($a = attributes['$has_key?']("depth")) !== nil && (!$a._isBoolean || $a == true))) { + depth = attributes['$[]']("depth").$to_i(); + if (depth['$<='](0)) { + depth = 1}; + self.maxdepth = $hash2(["abs", "rel"], {"abs": (self.include_stack.$size()['$-'](1))['$+'](depth), "rel": depth});}; + self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": true, "condense": false, "indent": attributes['$[]']("indent")})); + if ((($a = self.lines['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.$pop_include() + } else { + self.eof = false; + self.look_ahead = 0; + }; + return nil; + }; + + def.$pop_include = function() { + var $a, self = this; + + if (self.include_stack.$size()['$>'](0)) { + $a = $opal.to_ary(self.include_stack.$pop()), self.lines = ($a[0] == null ? nil : $a[0]), self.file = ($a[1] == null ? nil : $a[1]), self.dir = ($a[2] == null ? nil : $a[2]), self.path = ($a[3] == null ? nil : $a[3]), self.lineno = ($a[4] == null ? nil : $a[4]), self.maxdepth = ($a[5] == null ? nil : $a[5]), self.process_lines = ($a[6] == null ? nil : $a[6]); + self.eof = self.lines['$empty?'](); + self.look_ahead = 0;}; + return nil; + }; + + def.$include_depth = function() { + var self = this; + + return self.include_stack.$size(); + }; + + def['$exceeded_max_depth?'] = function() { + var $a, $b, self = this, abs_maxdepth = nil; + + if ((($a = (($b = ((abs_maxdepth = self.maxdepth['$[]']("abs")))['$>'](0)) ? self.include_stack.$size()['$>='](abs_maxdepth) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.maxdepth['$[]']("rel") + } else { + return false + }; + }; + + def.$shift = TMP_20 = function() {var $zuper = $slice.call(arguments, 0); + var $a, self = this, $iter = TMP_20._p, $yield = $iter || nil; + + TMP_20._p = null; + if ((($a = self.unescape_next_line) !== nil && (!$a._isBoolean || $a == true))) { + self.unescape_next_line = false; + return $opal.find_super_dispatcher(self, 'shift', TMP_20, $iter).apply(self, $zuper)['$[]']($range(1, -1, false)); + } else { + return $opal.find_super_dispatcher(self, 'shift', TMP_20, $iter).apply(self, $zuper) + }; + }; + + def['$skip_front_matter!'] = function(data, increment_linenos) { + var $a, $b, $c, self = this, front_matter = nil, original_data = nil; + + if (increment_linenos == null) { + increment_linenos = true + } + front_matter = nil; + if (data['$[]'](0)['$==']("---")) { + original_data = data.$dup(); + front_matter = []; + data.$shift(); + if (increment_linenos !== false && increment_linenos !== nil) { + self.lineno = self.lineno['$+'](1)}; + while ((($b = ($c = data['$empty?']()['$!'](), $c !== false && $c !== nil ?data['$[]'](0)['$==']("---")['$!']() : $c)) !== nil && (!$b._isBoolean || $b == true))) { + front_matter.$push(data.$shift()); + if (increment_linenos !== false && increment_linenos !== nil) { + self.lineno = self.lineno['$+'](1)};}; + if ((($a = data['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + ($a = data).$unshift.apply($a, [].concat(original_data)); + if (increment_linenos !== false && increment_linenos !== nil) { + self.lineno = 0}; + front_matter = nil; + } else { + data.$shift(); + if (increment_linenos !== false && increment_linenos !== nil) { + self.lineno = self.lineno['$+'](1)}; + };}; + return front_matter; + }; + + def.$resolve_expr_val = function(str) { + var $a, $b, $c, self = this, val = nil, type = nil; + + val = str; + type = nil; + if ((($a = ((($b = ($c = val['$start_with?']("\""), $c !== false && $c !== nil ?val['$end_with?']("\"") : $c)) !== false && $b !== nil) ? $b : ($c = val['$start_with?']("'"), $c !== false && $c !== nil ?val['$end_with?']("'") : $c))) !== nil && (!$a._isBoolean || $a == true))) { + type = "string"; + val = val['$[]']($range(1, -1, true));}; + if ((($a = val['$include?']("{")) !== nil && (!$a._isBoolean || $a == true))) { + val = self.document.$sub_attributes(val)}; + if (type['$==']("string")) { + } else if ((($a = val['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + val = nil + } else if ((($a = val.$strip()['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + val = " " + } else if (val['$==']("true")) { + val = true + } else if (val['$==']("false")) { + val = false + } else if ((($a = val['$include?'](".")) !== nil && (!$a._isBoolean || $a == true))) { + val = val.$to_f() + } else { + val = val.$to_i() + }; + return val; + }; + + def['$include_processors?'] = function() { + var $a, $b, self = this; + + if ((($a = self.include_processor_extensions['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ($b = self.document['$extensions?'](), $b !== false && $b !== nil ?self.document.$extensions()['$include_processors?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.include_processor_extensions = self.document.$extensions().$include_processors(); + return true; + } else { + self.include_processor_extensions = false; + return false; + } + } else { + return self.include_processor_extensions['$=='](false)['$!']() + }; + }; + + return (def.$to_s = function() { + var $a, $b, TMP_21, self = this; + + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line #: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + (($a = ($b = self.include_stack).$map, $a._p = (TMP_21 = function(inc){var self = TMP_21._s || this; +if (inc == null) inc = nil; + return inc.$to_s()}, TMP_21._s = self, TMP_21), $a).call($b).$join(", ")) + "]}>"; + }, nil) && 'to_s'; + })(self, $scope.Reader); + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $range = $opal.range; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $Section(){}; + var self = $Section = $klass($base, $super, 'Section', $Section); + + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3; + + def.level = def.document = def.parent = def.number = def.title = def.numbered = def.blocks = nil; + self.$attr_accessor("index"); + + self.$attr_accessor("number"); + + self.$attr_accessor("sectname"); + + self.$attr_accessor("special"); + + self.$attr_accessor("numbered"); + + def.$initialize = TMP_1 = function(parent, level, numbered) { + var $a, $b, self = this, $iter = TMP_1._p, $yield = $iter || nil; + + if (parent == null) { + parent = nil + } + if (level == null) { + level = nil + } + if (numbered == null) { + numbered = true + } + TMP_1._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, "section"]); + if ((($a = level['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + if (parent !== false && parent !== nil) { + self.level = parent.$level()['$+'](1) + } else if ((($a = self.level['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.level = 1} + } else { + self.level = level + }; + self.numbered = (($a = numbered !== false && numbered !== nil) ? self.level['$>'](0) : $a); + self.special = ($a = (($b = parent !== false && parent !== nil) ? parent.$context()['$==']("section") : $b), $a !== false && $a !== nil ?parent.$special() : $a); + self.index = 0; + return self.number = 1; + }; + + $opal.defn(self, '$name', def.$title); + + def.$generate_id = function() { + var $a, $b, self = this, sep = nil, pre = nil, base_id = nil, gen_id = nil, cnt = nil; + + if ((($a = self.document.$attributes()['$has_key?']("sectids")) !== nil && (!$a._isBoolean || $a == true))) { + sep = ((($a = self.document.$attributes()['$[]']("idseparator")) !== false && $a !== nil) ? $a : "_"); + pre = ((($a = self.document.$attributes()['$[]']("idprefix")) !== false && $a !== nil) ? $a : "_"); + base_id = "" + (pre) + (self.$title().$downcase().$gsub($scope.InvalidSectionIdCharsRx, sep).$tr_s(sep, sep).$chomp(sep)); + if ((($a = ($b = pre['$empty?'](), $b !== false && $b !== nil ?base_id['$start_with?'](sep) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + base_id = base_id['$[]']($range(1, -1, false)); + while ((($b = base_id['$start_with?'](sep)) !== nil && (!$b._isBoolean || $b == true))) { + base_id = base_id['$[]']($range(1, -1, false))};}; + gen_id = base_id; + cnt = 2; + while ((($b = self.document.$references()['$[]']("ids")['$has_key?'](gen_id)) !== nil && (!$b._isBoolean || $b == true))) { + gen_id = "" + (base_id) + (sep) + (cnt); + cnt = cnt['$+'](1);}; + return gen_id; + } else { + return nil + }; + }; + + def.$sectnum = function(delimiter, append) { + var $a, $b, $c, $d, self = this; + + if (delimiter == null) { + delimiter = "." + } + if (append == null) { + append = nil + } + ((($a = append) !== false && $a !== nil) ? $a : append = ((function() {if (append['$=='](false)) { + return "" + } else { + return delimiter + }; return nil; })())); + if ((($a = ($b = ($c = ($d = self.level, $d !== false && $d !== nil ?self.level['$>'](1) : $d), $c !== false && $c !== nil ?self.parent : $c), $b !== false && $b !== nil ?self.parent.$context()['$==']("section") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (self.parent.$sectnum(delimiter)) + (self.number) + (append) + } else { + return "" + (self.number) + (append) + }; + }; + + def['$<<'] = TMP_2 = function(block) {var $zuper = $slice.call(arguments, 0); + var self = this, $iter = TMP_2._p, $yield = $iter || nil; + + TMP_2._p = null; + $opal.find_super_dispatcher(self, '<<', TMP_2, $iter).apply(self, $zuper); + if (block.$context()['$==']("section")) { + return self.$assign_index(block) + } else { + return nil + }; + }; + + return (def.$to_s = TMP_3 = function() {var $zuper = $slice.call(arguments, 0); + var $a, self = this, $iter = TMP_3._p, $yield = $iter || nil, qualified_title = nil; + + TMP_3._p = null; + if ((($a = self.title['$=='](nil)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + qualified_title = (function() {if ((($a = self.numbered) !== nil && (!$a._isBoolean || $a == true))) { + return "" + (self.$sectnum()) + " " + (self.title) + } else { + return self.title + }; return nil; })(); + return "#<" + (self.$class()) + "@" + (self.$object_id()) + " {level: " + (self.level) + ", title: " + (qualified_title.$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"; + } else { + return $opal.find_super_dispatcher(self, 'to_s', TMP_3, $iter).apply(self, $zuper) + }; + }, nil) && 'to_s'; + })(self, $scope.AbstractBlock) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $Stylesheets(){}; + var self = $Stylesheets = $klass($base, $super, 'Stylesheets', $Stylesheets); + + var def = self._proto, $scope = self._scope, $a; + + def.primary_stylesheet_data = def.coderay_stylesheet_data = def.pygments_stylesheet_data = nil; + $opal.cdecl($scope, 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); + + $opal.cdecl($scope, 'DEFAULT_PYGMENTS_STYLE', "pastie"); + + $opal.cdecl($scope, 'STYLESHEETS_DATA_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join($scope.DATA_PATH, "stylesheets")); + + self.__instance__ = self.$new(); + + $opal.defs(self, '$instance', function() { + var self = this; + if (self.__instance__ == null) self.__instance__ = nil; + + return self.__instance__; + }); + + def.$primary_stylesheet_name = function() { + var self = this; + + return $scope.DEFAULT_STYLESHEET_NAME; + }; + + def.$primary_stylesheet_data = function() { + var $a, $b, self = this; + + return ((($a = self.primary_stylesheet_data) !== false && $a !== nil) ? $a : self.primary_stylesheet_data = (($b = $opal.Object._scope.IO) == null ? $opal.cm('IO') : $b).$read((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$join($scope.STYLESHEETS_DATA_PATH, "asciidoctor-default.css")).$chomp()); + }; + + def.$embed_primary_stylesheet = function() { + var self = this; + + return ""; + }; + + def.$write_primary_stylesheet = function(target_dir) { + var $a, $b, TMP_1, $c, self = this; + + return ($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)).$open, $a._p = (TMP_1 = function(f){var self = TMP_1._s || this; +if (f == null) f = nil; + return f.$write(self.$primary_stylesheet_data())}, TMP_1._s = self, TMP_1), $a).call($b, (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c).$join(target_dir, self.$primary_stylesheet_name()), "w"); + }; + + def.$coderay_stylesheet_name = function() { + var self = this; + + return "coderay-asciidoctor.css"; + }; + + def.$coderay_stylesheet_data = function() { + var $a, $b, self = this; + + return ((($a = self.coderay_stylesheet_data) !== false && $a !== nil) ? $a : self.coderay_stylesheet_data = (($b = $opal.Object._scope.IO) == null ? $opal.cm('IO') : $b).$read((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b).$join($scope.STYLESHEETS_DATA_PATH, "coderay-asciidoctor.css")).$chomp()); + }; + + def.$embed_coderay_stylesheet = function() { + var self = this; + + return ""; + }; + + def.$write_coderay_stylesheet = function(target_dir) { + var $a, $b, TMP_2, $c, self = this; + + return ($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)).$open, $a._p = (TMP_2 = function(f){var self = TMP_2._s || this; +if (f == null) f = nil; + return f.$write(self.$coderay_stylesheet_data())}, TMP_2._s = self, TMP_2), $a).call($b, (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c).$join(target_dir, self.$coderay_stylesheet_name()), "w"); + }; + + def.$pygments_stylesheet_name = function(style) { + var $a, self = this; + + if (style == null) { + style = nil + } + ((($a = style) !== false && $a !== nil) ? $a : style = $scope.DEFAULT_PYGMENTS_STYLE); + return "pygments-" + (style) + ".css"; + }; + + def.$pygments_stylesheet_data = function(style) { + var $a, self = this; + + if (style == null) { + style = nil + } + ((($a = style) !== false && $a !== nil) ? $a : style = $scope.DEFAULT_PYGMENTS_STYLE); + return (((($a = self.pygments_stylesheet_data) !== false && $a !== nil) ? $a : self.pygments_stylesheet_data = self.$load_pygments())); + }; + + def.$embed_pygments_stylesheet = function(style) { + var self = this; + + if (style == null) { + style = nil + } + return ""; + }; + + def.$write_pygments_stylesheet = function(target_dir, style) { + var $a, $b, TMP_3, $c, self = this; + + if (style == null) { + style = nil + } + return ($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)).$open, $a._p = (TMP_3 = function(f){var self = TMP_3._s || this; +if (f == null) f = nil; + return f.$write(self.$pygments_stylesheet_data(style))}, TMP_3._s = self, TMP_3), $a).call($b, (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c).$join(target_dir, self.$pygments_stylesheet_name(style)), "w"); + }; + + return (def.$load_pygments = function() { + var $a, self = this; + + if ((($a = ($opal.Object._scope.Pygments == null ? nil : 'constant')) !== nil && (!$a._isBoolean || $a == true))) { + } else { + $scope.Helpers.$require_library("pygments", "pygments.rb") + }; + return $hash2([], {}); + }, nil) && 'load_pygments'; + })(self, null) + + })(self) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $klass = $opal.klass, $hash2 = $opal.hash2, $range = $opal.range; + + return (function($base) { + var self = $module($base, 'Asciidoctor'); + + var def = self._proto, $scope = self._scope; + + (function($base, $super) { + function $Table(){}; + var self = $Table = $klass($base, $super, 'Table', $Table); + + var def = self._proto, $scope = self._scope, TMP_1; + + def.attributes = def.document = def.has_header_option = def.rows = nil; + (function($base, $super) { + function $Rows(){}; + var self = $Rows = $klass($base, $super, 'Rows', $Rows); + + var def = self._proto, $scope = self._scope; + + self.$attr_accessor("head", "foot", "body"); + + def.$initialize = function(head, foot, body) { + var self = this; + + if (head == null) { + head = [] + } + if (foot == null) { + foot = [] + } + if (body == null) { + body = [] + } + self.head = head; + self.foot = foot; + return self.body = body; + }; + + return $opal.defn(self, '$[]', def.$send); + })(self, null); + + $opal.cdecl($scope, 'DEFAULT_DATA_FORMAT', "psv"); + + $opal.cdecl($scope, 'DATA_FORMATS', ["psv", "dsv", "csv"]); + + $opal.cdecl($scope, 'DEFAULT_DELIMITERS', $hash2(["psv", "dsv", "csv"], {"psv": "|", "dsv": ":", "csv": ","})); + + $opal.cdecl($scope, 'TEXT_STYLES', $hash2(["d", "s", "e", "m", "h", "l", "v", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "v": "verse", "a": "asciidoc"})); + + $opal.cdecl($scope, 'ALIGNMENTS', $hash2(["h", "v"], {"h": $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"}), "v": $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"})})); + + self.$attr_accessor("columns"); + + self.$attr_accessor("rows"); + + self.$attr_accessor("has_header_option"); + + def.$initialize = TMP_1 = function(parent, attributes) { + var $a, $b, $c, self = this, $iter = TMP_1._p, $yield = $iter || nil, pcwidth = nil, pcwidth_intval = nil; + + TMP_1._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_1, null).apply(self, [parent, "table"]); + self.rows = $scope.Rows.$new(); + self.columns = []; + self.has_header_option = attributes['$has_key?']("header-option"); + pcwidth = attributes['$[]']("width"); + pcwidth_intval = pcwidth.$to_i().$abs(); + if ((($a = ((($b = (($c = pcwidth_intval['$=='](0)) ? pcwidth['$==']("0")['$!']() : $c)) !== false && $b !== nil) ? $b : pcwidth_intval['$>'](100))) !== nil && (!$a._isBoolean || $a == true))) { + pcwidth_intval = 100}; + self.attributes['$[]=']("tablepcwidth", pcwidth_intval); + if ((($a = self.document.$attributes()['$has_key?']("pagewidth")) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = "tableabswidth", $b = self.attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, ((self.attributes['$[]']("tablepcwidth").$to_f()['$/'](100))['$*'](self.document.$attributes()['$[]']("pagewidth"))).$round()))) + } else { + return nil + }; + }; + + def['$header_row?'] = function() { + var $a, self = this; + + return ($a = self.has_header_option, $a !== false && $a !== nil ?self.rows.$body()['$empty?']() : $a); + }; + + def.$create_columns = function(col_specs) { + var $a, $b, TMP_2, $c, TMP_3, self = this, total_width = nil, cols = nil, even_width = nil; + + total_width = 0; + cols = []; + ($a = ($b = col_specs).$each, $a._p = (TMP_2 = function(col_spec){var self = TMP_2._s || this; +if (col_spec == null) col_spec = nil; + total_width = total_width['$+'](col_spec['$[]']("width")); + return cols['$<<']($scope.Column.$new(self, cols.$size(), col_spec));}, TMP_2._s = self, TMP_2), $a).call($b); + if ((($a = cols['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.attributes['$[]=']("colcount", cols.$size()); + even_width = ((100.0)['$/'](cols.$size())).$floor(); + ($a = ($c = cols).$each, $a._p = (TMP_3 = function(c){var self = TMP_3._s || this; +if (c == null) c = nil; + return c.$assign_width(total_width, even_width)}, TMP_3._s = self, TMP_3), $a).call($c); + }; + self.columns = cols; + return nil; + }; + + return (def.$partition_header_footer = function(attributes) { + var $a, $b, TMP_4, $c, self = this, num_body_rows = nil, head = nil; + + self.attributes['$[]=']("rowcount", self.rows.$body().$size()); + num_body_rows = self.rows.$body().$size(); + if ((($a = (($b = num_body_rows['$>'](0)) ? self.has_header_option : $b)) !== nil && (!$a._isBoolean || $a == true))) { + head = self.rows.$body().$shift(); + num_body_rows = num_body_rows['$-'](1); + ($a = ($b = head).$each, $a._p = (TMP_4 = function(c){var self = TMP_4._s || this; +if (c == null) c = nil; + return c['$style='](nil)}, TMP_4._s = self, TMP_4), $a).call($b); + self.rows['$head=']([head]);}; + if ((($a = (($c = num_body_rows['$>'](0)) ? attributes['$has_key?']("footer-option") : $c)) !== nil && (!$a._isBoolean || $a == true))) { + self.rows['$foot=']([self.rows.$body().$pop()])}; + return nil; + }, nil) && 'partition_header_footer'; + })(self, $scope.AbstractBlock); + + (function($base, $super) { + function $Column(){}; + var self = $Column = $klass($base, $super, 'Column', $Column); + + var def = self._proto, $scope = self._scope, TMP_5; + + def.attributes = nil; + self.$attr_accessor("style"); + + def.$initialize = TMP_5 = function(table, index, attributes) { + var $a, $b, $c, self = this, $iter = TMP_5._p, $yield = $iter || nil; + + if (attributes == null) { + attributes = $hash2([], {}) + } + TMP_5._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_5, null).apply(self, [table, "column"]); + self.style = attributes['$[]']("style"); + attributes['$[]=']("colnumber", index['$+'](1)); + ($a = "width", $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, 1))); + ($a = "halign", $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, "left"))); + ($a = "valign", $b = attributes, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, "top"))); + return self.$update_attributes(attributes); + }; + + $opal.defn(self, '$table', def.$parent); + + return (def.$assign_width = function(total_width, even_width) { + var $a, self = this, width = nil; + + if (total_width['$>'](0)) { + width = ((self.attributes['$[]']("width").$to_f()['$/'](total_width))['$*'](100)).$floor() + } else { + width = even_width + }; + self.attributes['$[]=']("colpcwidth", width); + if ((($a = self.$parent().$attributes()['$has_key?']("tableabswidth")) !== nil && (!$a._isBoolean || $a == true))) { + self.attributes['$[]=']("colabswidth", ((width.$to_f()['$/'](100))['$*'](self.$parent().$attributes()['$[]']("tableabswidth"))).$round())}; + return nil; + }, nil) && 'assign_width'; + })($scope.Table, $scope.AbstractNode); + + (function($base, $super) { + function $Cell(){}; + var self = $Cell = $klass($base, $super, 'Cell', $Cell); + + var def = self._proto, $scope = self._scope, TMP_6, TMP_8; + + def.style = def.document = def.text = def.inner_document = def.colspan = def.rowspan = def.attributes = nil; + self.$attr_accessor("style"); + + self.$attr_accessor("colspan"); + + self.$attr_accessor("rowspan"); + + $opal.defn(self, '$column', def.$parent); + + self.$attr_reader("inner_document"); + + def.$initialize = TMP_6 = function(column, text, attributes, cursor) { + var $a, $b, self = this, $iter = TMP_6._p, $yield = $iter || nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_lines = nil, processed_lines = nil; + + if (attributes == null) { + attributes = $hash2([], {}) + } + if (cursor == null) { + cursor = nil + } + TMP_6._p = null; + $opal.find_super_dispatcher(self, 'initialize', TMP_6, null).apply(self, [column, "cell"]); + self.text = text; + self.style = nil; + self.colspan = nil; + self.rowspan = nil; + if (column !== false && column !== nil) { + self.style = column.$attributes()['$[]']("style"); + self.$update_attributes(column.$attributes());}; + if (attributes !== false && attributes !== nil) { + self.colspan = attributes.$delete("colspan"); + self.rowspan = attributes.$delete("rowspan"); + if ((($a = attributes['$has_key?']("style")) !== nil && (!$a._isBoolean || $a == true))) { + self.style = attributes['$[]']("style")}; + self.$update_attributes(attributes);}; + if ((($a = (($b = self.style['$==']("asciidoc")) ? column.$table()['$header_row?']()['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + parent_doctitle = self.document.$attributes().$delete("doctitle"); + inner_document_lines = self.text.$split($scope.EOL); + if ((($a = ((($b = inner_document_lines['$empty?']()) !== false && $b !== nil) ? $b : inner_document_lines['$[]'](0)['$include?']("::")['$!']())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + unprocessed_lines = inner_document_lines['$[]'](0); + processed_lines = $scope.PreprocessorReader.$new(self.document, unprocessed_lines).$readlines(); + if ((($a = processed_lines['$=='](unprocessed_lines)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + inner_document_lines.$shift(); + ($a = inner_document_lines).$unshift.apply($a, [].concat(processed_lines));}; + }; + self.inner_document = $scope.Document.$new(inner_document_lines, $hash2(["header_footer", "parent", "cursor"], {"header_footer": false, "parent": self.document, "cursor": cursor})); + if ((($b = parent_doctitle['$nil?']()) !== nil && (!$b._isBoolean || $b == true))) { + return nil + } else { + return self.document.$attributes()['$[]=']("doctitle", parent_doctitle) + }; + } else { + return nil + }; + }; + + def.$text = function() { + var self = this; + + return self.$apply_normal_subs(self.text).$strip(); + }; + + def.$content = function() { + var $a, $b, TMP_7, self = this; + + if (self.style['$==']("asciidoc")) { + return self.inner_document.$convert() + } else { + return ($a = ($b = self.$text().$split($scope.BlankLineRx)).$map, $a._p = (TMP_7 = function(p){var self = TMP_7._s || this, $a, $b; + if (self.style == null) self.style = nil; +if (p == null) p = nil; + if ((($a = ((($b = self.style['$!']()) !== false && $b !== nil) ? $b : self.style['$==']("header"))) !== nil && (!$a._isBoolean || $a == true))) { + return p + } else { + return $scope.Inline.$new(self.$parent(), "quoted", p, $hash2(["type"], {"type": self.style})).$convert() + }}, TMP_7._s = self, TMP_7), $a).call($b) + }; + }; + + return (def.$to_s = TMP_8 = function() {var $zuper = $slice.call(arguments, 0); + var $a, self = this, $iter = TMP_8._p, $yield = $iter || nil; + + TMP_8._p = null; + return "" + ($opal.find_super_dispatcher(self, 'to_s', TMP_8, $iter).apply(self, $zuper).$to_s()) + " - [text: " + (self.text) + ", colspan: " + (((($a = self.colspan) !== false && $a !== nil) ? $a : 1)) + ", rowspan: " + (((($a = self.rowspan) !== false && $a !== nil) ? $a : 1)) + ", attributes: " + (self.attributes) + "]"; + }, nil) && 'to_s'; + })($scope.Table, $scope.AbstractNode); + + (function($base, $super) { + function $ParserContext(){}; + var self = $ParserContext = $klass($base, $super, 'ParserContext', $ParserContext); + + var def = self._proto, $scope = self._scope; + + def.format = def.delimiter = def.delimiter_re = def.buffer = def.cell_specs = def.cell_open = def.last_cursor = def.table = def.current_row = def.col_count = def.col_visits = def.active_rowspans = def.linenum = nil; + self.$attr_accessor("table"); + + self.$attr_accessor("format"); + + self.$attr_reader("col_count"); + + self.$attr_accessor("buffer"); + + self.$attr_reader("delimiter"); + + self.$attr_reader("delimiter_re"); + + def.$initialize = function(reader, table, attributes) { + var $a, $b, $c, self = this; + + if (attributes == null) { + attributes = $hash2([], {}) + } + self.reader = reader; + self.table = table; + self.last_cursor = reader.$cursor(); + if ((($a = (self.format = attributes['$[]']("format"))) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ($scope.Table)._scope.DATA_FORMATS['$include?'](self.format)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise("Illegal table format: " + (self.format)) + } + } else { + self.format = ($scope.Table)._scope.DEFAULT_DATA_FORMAT + }; + if ((($a = ($b = (($c = self.format['$==']("psv")) ? attributes['$has_key?']("separator")['$!']() : $c), $b !== false && $b !== nil ?table.$document()['$nested?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { + self.delimiter = "!" + } else { + self.delimiter = ((($a = attributes['$[]']("separator")) !== false && $a !== nil) ? $a : ($scope.Table)._scope.DEFAULT_DELIMITERS['$[]'](self.format)) + }; + self.delimiter_re = (new RegExp("" + $scope.Regexp.$escape(self.delimiter))); + self.col_count = (function() {if ((($a = table.$columns()['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + return -1 + } else { + return table.$columns().$size() + }; return nil; })(); + self.buffer = ""; + self.cell_specs = []; + self.cell_open = false; + self.active_rowspans = [0]; + self.col_visits = 0; + self.current_row = []; + return self.linenum = -1; }; - output_buffer.$append("\n"); - }; - output_buffer.$append("\n"); - return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/section") -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - return true; + + def['$starts_with_delimiter?'] = function(line) { + var self = this; + + return line['$start_with?'](self.delimiter); + }; + + def.$match_delimiter = function(line) { + var self = this; + + return self.delimiter_re.$match(line); + }; + + def.$skip_matched_delimiter = function(match, escaped) { + var self = this; + + if (escaped == null) { + escaped = false + } + self.buffer = "" + (self.buffer) + ((function() {if (escaped !== false && escaped !== nil) { + return match.$pre_match().$chop() + } else { + return match.$pre_match() + }; return nil; })()) + (self.delimiter); + return match.$post_match(); + }; + + def['$buffer_has_unclosed_quotes?'] = function(append) { + var $a, $b, self = this, record = nil; + + if (append == null) { + append = nil + } + record = ((("") + (self.buffer)) + (append)).$strip(); + return ($a = ($b = record['$start_with?']("\""), $b !== false && $b !== nil ?record['$start_with?']("\"\"")['$!']() : $b), $a !== false && $a !== nil ?record['$end_with?']("\"")['$!']() : $a); + }; + + def['$buffer_quoted?'] = function() { + var $a, self = this; + + self.buffer = self.buffer.$lstrip(); + return ($a = self.buffer['$start_with?']("\""), $a !== false && $a !== nil ?self.buffer['$start_with?']("\"\"")['$!']() : $a); + }; + + def.$take_cell_spec = function() { + var self = this; + + return self.cell_specs.$shift(); + }; + + def.$push_cell_spec = function(cell_spec) { + var $a, self = this; + + if (cell_spec == null) { + cell_spec = $hash2([], {}) + } + self.cell_specs['$<<']((((($a = cell_spec) !== false && $a !== nil) ? $a : $hash2([], {})))); + return nil; + }; + + def.$keep_cell_open = function() { + var self = this; + + self.cell_open = true; + return nil; + }; + + def.$mark_cell_closed = function() { + var self = this; + + self.cell_open = false; + return nil; + }; + + def['$cell_open?'] = function() { + var self = this; + + return self.cell_open; + }; + + def['$cell_closed?'] = function() { + var self = this; + + return self.cell_open['$!'](); + }; + + def.$close_open_cell = function(next_cell_spec) { + var $a, self = this; + + if (next_cell_spec == null) { + next_cell_spec = $hash2([], {}) + } + self.$push_cell_spec(next_cell_spec); + if ((($a = self['$cell_open?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.$close_cell(true)}; + self.$advance(); + return nil; + }; + + def.$close_cell = function(eol) { + var $a, $b, TMP_9, self = this, cell_text = nil, cell_spec = nil, repeat = nil; + + if (eol == null) { + eol = false + } + cell_text = self.buffer.$strip(); + self.buffer = ""; + if (self.format['$==']("psv")) { + cell_spec = self.$take_cell_spec(); + if ((($a = cell_spec['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + self.$warn("asciidoctor: ERROR: " + (self.last_cursor.$line_info()) + ": table missing leading separator, recovering automatically"); + cell_spec = $hash2([], {}); + repeat = 1; + } else { + repeat = cell_spec.$fetch("repeatcol", 1); + cell_spec.$delete("repeatcol"); + }; + } else { + cell_spec = nil; + repeat = 1; + if (self.format['$==']("csv")) { + if ((($a = ($b = cell_text['$empty?']()['$!'](), $b !== false && $b !== nil ?cell_text['$include?']("\"") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = ($b = cell_text['$start_with?']("\""), $b !== false && $b !== nil ?cell_text['$end_with?']("\"") : $b)) !== nil && (!$a._isBoolean || $a == true))) { + cell_text = cell_text['$[]']($range(1, -1, true)).$strip()}; + cell_text = cell_text.$tr_s("\"", "\"");}}; + }; + ($a = ($b = (1)).$upto, $a._p = (TMP_9 = function(i){var self = TMP_9._s || this, $a, $b, $c, $d, column = nil, cell = nil; + if (self.col_count == null) self.col_count = nil; + if (self.table == null) self.table = nil; + if (self.current_row == null) self.current_row = nil; + if (self.last_cursor == null) self.last_cursor = nil; + if (self.reader == null) self.reader = nil; + if (self.col_visits == null) self.col_visits = nil; + if (self.linenum == null) self.linenum = nil; +if (i == null) i = nil; + if (self.col_count['$=='](-1)) { + self.table.$columns()['$<<'](($scope.Table)._scope.Column.$new(self.table, self.current_row.$size()['$+'](i)['$-'](1))); + column = self.table.$columns()['$[]'](-1); + } else { + column = self.table.$columns()['$[]'](self.current_row.$size()) + }; + cell = ($scope.Table)._scope.Cell.$new(column, cell_text, cell_spec, self.last_cursor); + self.last_cursor = self.reader.$cursor(); + if ((($a = ((($b = cell.$rowspan()['$!']()) !== false && $b !== nil) ? $b : cell.$rowspan()['$=='](1))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$activate_rowspan(cell.$rowspan(), (((($a = cell.$colspan()) !== false && $a !== nil) ? $a : 1))) + }; + self.col_visits = self.col_visits['$+']((((($a = cell.$colspan()) !== false && $a !== nil) ? $a : 1))); + self.current_row['$<<'](cell); + if ((($a = ($b = self['$end_of_row?'](), $b !== false && $b !== nil ?(((($c = ((($d = self.col_count['$=='](-1)['$!']()) !== false && $d !== nil) ? $d : self.linenum['$>'](0))) !== false && $c !== nil) ? $c : ((($d = eol !== false && eol !== nil) ? i['$=='](repeat) : $d)))) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return self.$close_row() + } else { + return nil + };}, TMP_9._s = self, TMP_9), $a).call($b, repeat); + self.open_cell = false; + return nil; + }; + + def.$close_row = function() { + var $a, $b, $c, self = this; + + self.table.$rows().$body()['$<<'](self.current_row); + if (self.col_count['$=='](-1)) { + self.col_count = self.col_visits}; + self.col_visits = 0; + self.current_row = []; + self.active_rowspans.$shift(); + ($a = 0, $b = self.active_rowspans, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, 0))); + return nil; + }; + + def.$activate_rowspan = function(rowspan, colspan) { + var $a, $b, TMP_10, self = this; + + ($a = ($b = (1).$upto(rowspan['$-'](1))).$each, $a._p = (TMP_10 = function(i){var self = TMP_10._s || this, $a; + if (self.active_rowspans == null) self.active_rowspans = nil; +if (i == null) i = nil; + return self.active_rowspans['$[]='](i, (((($a = self.active_rowspans['$[]'](i)) !== false && $a !== nil) ? $a : 0))['$+'](colspan))}, TMP_10._s = self, TMP_10), $a).call($b); + return nil; + }; + + def['$end_of_row?'] = function() { + var $a, self = this; + + return ((($a = self.col_count['$=='](-1)) !== false && $a !== nil) ? $a : self.$effective_col_visits()['$=='](self.col_count)); + }; + + def.$effective_col_visits = function() { + var self = this; + + return self.col_visits['$+'](self.active_rowspans['$[]'](0)); + }; + + return (def.$advance = function() { + var self = this; + + return self.linenum = self.linenum['$+'](1); + }, nil) && 'advance'; + })($scope.Table, null); + + })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var $a, self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $gvars = $opal.gvars, $module = $opal.module, $hash2 = $opal.hash2, $range = $opal.range; - if (($a = ($scope.RUBY_ENGINE != null)) === false || $a === nil) { - $opal.cdecl($scope, 'RUBY_ENGINE', "unknown")}; + if ($gvars[":"] == null) $gvars[":"] = nil; + + if ((($a = ($scope.RUBY_ENGINE != null)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + $opal.cdecl($scope, 'RUBY_ENGINE', "unknown") + }; $opal.cdecl($scope, 'RUBY_ENGINE_OPAL', ($scope.RUBY_ENGINE['$==']("opal"))); $opal.cdecl($scope, 'RUBY_ENGINE_JRUBY', ($scope.RUBY_ENGINE['$==']("jruby"))); + $opal.cdecl($scope, 'RUBY_MIN_VERSION_1_9', ($scope.RUBY_VERSION['$>=']("1.9"))); + $opal.cdecl($scope, 'RUBY_MIN_VERSION_2', ($scope.RUBY_VERSION['$>=']("2"))); ; - if (($a = $scope.RUBY_ENGINE_OPAL) !== false && $a !== nil) { - ; + if ($scope.RUBY_ENGINE['$==']("opal")) { ; ; ;}; $gvars[":"].$unshift($scope.File.$dirname("asciidoctor")); - return (function($base) { + (function($base) { var self = $module($base, 'Asciidoctor'); - var def = self._proto, $scope = self._scope, $a, $b, $c, TMP_1, TMP_2, $d; - if (($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)) === false || $a === nil) { - ; - - ; - - ; - - ; + var def = self._proto, $scope = self._scope, $a, $b, TMP_1; - ;}; + $opal.cdecl($scope, 'RUBY_ENGINE', (($a = $opal.Object._scope.RUBY_ENGINE) == null ? $opal.cm('RUBY_ENGINE') : $a)); (function($base) { var self = $module($base, 'SafeMode'); var def = self._proto, $scope = self._scope; + $opal.cdecl($scope, 'UNSAFE', 0); $opal.cdecl($scope, 'SAFE', 1); @@ -9144,82 +11923,75 @@ if (output_buffer == null) output_buffer = nil; var self = $module($base, 'Compliance'); var def = self._proto, $scope = self._scope; - self.block_terminates_paragraph = true; - - (function(self) { - var $scope = self._scope, def = self._proto; - return self.$attr_accessor("block_terminates_paragraph") - })(self.$singleton_class()); - self.strict_verbatim_paragraphs = true; + self.keys = [].$to_set(); (function(self) { var $scope = self._scope, def = self._proto; - return self.$attr_accessor("strict_verbatim_paragraphs") + + return self.$attr("keys") })(self.$singleton_class()); - self.underline_style_section_titles = true; + $opal.defs(self, '$define', function(key, value) { + var $a, $b, self = this; + if (self.keys == null) self.keys = nil; - (function(self) { - var $scope = self._scope, def = self._proto; - return self.$attr_accessor("underline_style_section_titles") - })(self.$singleton_class()); + if ((($a = ((($b = key['$==']("keys")) !== false && $b !== nil) ? $b : (self['$respond_to?'](key)))) !== nil && (!$a._isBoolean || $a == true))) { + self.$raise((($a = $opal.Object._scope.ArgumentError) == null ? $opal.cm('ArgumentError') : $a), "Illegal key name: " + (key))}; + self.$instance_variable_set("@" + (key), value); + (function(self) { + var $scope = self._scope, def = self._proto; - self.unwrap_standalone_preamble = true; + return self + })(self.$singleton_class()).$send("attr_accessor", key); + return self.keys['$<<'](key); + }); - (function(self) { - var $scope = self._scope, def = self._proto; - return self.$attr_accessor("unwrap_standalone_preamble") - })(self.$singleton_class()); + self.$define("block_terminates_paragraph", true); - self.attribute_missing = "skip"; + self.$define("strict_verbatim_paragraphs", true); - (function(self) { - var $scope = self._scope, def = self._proto; - return self.$attr_accessor("attribute_missing") - })(self.$singleton_class()); + self.$define("underline_style_section_titles", true); - self.attribute_undefined = "drop-line"; + self.$define("unwrap_standalone_preamble", true); - (function(self) { - var $scope = self._scope, def = self._proto; - return self.$attr_accessor("attribute_undefined") - })(self.$singleton_class()); + self.$define("attribute_missing", "skip"); - self.markdown_syntax = true; + self.$define("attribute_undefined", "drop-line"); - (function(self) { - var $scope = self._scope, def = self._proto; - return self.$attr_accessor("markdown_syntax") - })(self.$singleton_class()); + self.$define("markdown_syntax", true); })(self); - $opal.cdecl($scope, 'LIB_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname("asciidoctor"))); + $opal.cdecl($scope, 'ROOT_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path("asciidoctor")))); - $opal.cdecl($scope, 'ROOT_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname($scope.LIB_PATH)); + $opal.cdecl($scope, 'LIB_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join($scope.ROOT_PATH, "lib")); - $opal.cdecl($scope, 'USER_HOME', (function() {if ((($a = $opal.Object._scope.RUBY_VERSION) == null ? $opal.cm('RUBY_VERSION') : $a)['$>=']("1.9")) { - return (($a = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $a).$home() - } else { - return $scope.ENV['$[]']("HOME") - }; return nil; })()); + $opal.cdecl($scope, 'DATA_PATH', (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join($scope.ROOT_PATH, "data")); + + $opal.cdecl($scope, 'USER_HOME', (function() {try {return (($a = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $a).$home() } catch ($err) { return ((($a = (($b = $opal.Object._scope.ENV) == null ? $opal.cm('ENV') : $b)['$[]']("HOME")) !== false && $a !== nil) ? $a : (($b = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $b).$pwd()) }})()); + + $opal.cdecl($scope, 'COERCE_ENCODING', ($a = (($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)['$!'](), $a !== false && $a !== nil ?(($b = $opal.Object._scope.RUBY_MIN_VERSION_1_9) == null ? $opal.cm('RUBY_MIN_VERSION_1_9') : $b) : $a)); - $opal.cdecl($scope, 'COERCE_ENCODING', ($a = ($b = (($c = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $c), ($b === nil || $b === false)), $a !== false && $a !== nil ?(($b = $opal.Object._scope.RUBY_VERSION) == null ? $opal.cm('RUBY_VERSION') : $b)['$>=']("1.9") : $a)); + $opal.cdecl($scope, 'FORCE_ENCODING', ($a = $scope.COERCE_ENCODING, $a !== false && $a !== nil ?(($b = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $b).$default_external()['$=='](((($b = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $b))._scope.UTF_8)['$!']() : $a)); - $opal.cdecl($scope, 'FORCE_ENCODING', ($a = $scope.COERCE_ENCODING, $a !== false && $a !== nil ?($b = (($c = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $c).$default_external()['$=='](((($c = $opal.Object._scope.Encoding) == null ? $opal.cm('Encoding') : $c))._scope.UTF_8), ($b === nil || $b === false)) : $a)); + $opal.cdecl($scope, 'BOM_BYTES_UTF_8', "\xEF\xBB\xBF".$bytes().$to_a()); - $opal.cdecl($scope, 'BOM_BYTES_UTF_8', "xefxbbxbf".$bytes().$to_a()); + $opal.cdecl($scope, 'BOM_BYTES_UTF_16LE', "\xFF\xFE".$bytes().$to_a()); - $opal.cdecl($scope, 'BOM_BYTES_UTF_16LE', "xffxfe".$bytes().$to_a()); + $opal.cdecl($scope, 'BOM_BYTES_UTF_16BE', "\xFE\xFF".$bytes().$to_a()); - $opal.cdecl($scope, 'BOM_BYTES_UTF_16BE', "xfexff".$bytes().$to_a()); + $opal.cdecl($scope, 'FORCE_UNICODE_LINE_LENGTH', (($a = $opal.Object._scope.RUBY_MIN_VERSION_1_9) == null ? $opal.cm('RUBY_MIN_VERSION_1_9') : $a)['$!']()); - $opal.cdecl($scope, 'FORCE_UNICODE_LINE_LENGTH', (($a = $opal.Object._scope.RUBY_VERSION) == null ? $opal.cm('RUBY_VERSION') : $a)['$<']("1.9")); + $opal.cdecl($scope, 'SUPPORTS_GSUB_RESULT_HASH', ($a = (($b = $opal.Object._scope.RUBY_MIN_VERSION_1_9) == null ? $opal.cm('RUBY_MIN_VERSION_1_9') : $b), $a !== false && $a !== nil ?(($b = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $b)['$!']() : $a)); $opal.cdecl($scope, 'EOL', "\n"); - $opal.cdecl($scope, 'LINE_SPLIT', /\n/); + $opal.cdecl($scope, 'NULL', "\x00"); + + $opal.cdecl($scope, 'TAB', "\t"); + + $opal.cdecl($scope, 'TAB_PATTERN', /\t/); $opal.cdecl($scope, 'DEFAULT_DOCTYPE', "article"); @@ -9229,11 +12001,11 @@ if (output_buffer == null) output_buffer = nil; $opal.cdecl($scope, 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css"); - $opal.cdecl($scope, 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook45"})); + $opal.cdecl($scope, 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook5"})); $opal.cdecl($scope, 'DEFAULT_PAGE_WIDTHS', $hash2(["docbook"], {"docbook": 425})); - $opal.cdecl($scope, 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "asciidoc", "markdown"], {"html": ".html", "docbook": ".xml", "asciidoc": ".ad", "markdown": ".md"})); + $opal.cdecl($scope, 'DEFAULT_EXTENSIONS', $hash2(["html", "docbook", "pdf", "epub", "asciidoc"], {"html": ".html", "docbook": ".xml", "pdf": ".pdf", "epub": ".epub", "asciidoc": ".adoc"})); $opal.cdecl($scope, 'ASCIIDOC_EXTENSIONS', $hash2([".asciidoc", ".adoc", ".ad", ".asc", ".txt"], {".asciidoc": true, ".adoc": true, ".ad": true, ".asc": true, ".txt": true})); @@ -9247,311 +12019,450 @@ if (output_buffer == null) output_buffer = nil; $opal.cdecl($scope, 'DELIMITED_BLOCKS', $hash2(["--", "----", "....", "====", "****", "____", "\"\"", "++++", "|===", ",===", ":===", "!===", "////", "```", "~~~"], {"--": ["open", ["comment", "example", "literal", "listing", "pass", "quote", "sidebar", "source", "verse", "admonition", "abstract", "partintro"].$to_set()], "----": ["listing", ["literal", "source"].$to_set()], "....": ["literal", ["listing", "source"].$to_set()], "====": ["example", ["admonition"].$to_set()], "****": ["sidebar", (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()], "____": ["quote", ["verse"].$to_set()], "\"\"": ["quote", ["verse"].$to_set()], "++++": ["pass", ["math", "latexmath", "asciimath"].$to_set()], "|===": ["table", (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()], ",===": ["table", (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()], ":===": ["table", (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()], "!===": ["table", (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()], "////": ["comment", (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()], "```": ["fenced_code", (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()], "~~~": ["fenced_code", (($a = $opal.Object._scope.Set) == null ? $opal.cm('Set') : $a).$new()]})); - $opal.cdecl($scope, 'DELIMITED_BLOCK_LEADERS', ($a = ($b = $scope.DELIMITED_BLOCKS.$keys()).$map, $a._p = (TMP_1 = function(key){var self = TMP_1._s || this;if (key == null) key = nil; + $opal.cdecl($scope, 'DELIMITED_BLOCK_LEADERS', ($a = ($b = $scope.DELIMITED_BLOCKS.$keys()).$map, $a._p = (TMP_1 = function(key){var self = TMP_1._s || this; +if (key == null) key = nil; return key['$[]']($range(0, 1, false))}, TMP_1._s = self, TMP_1), $a).call($b).$to_set()); - $opal.cdecl($scope, 'BREAK_LINES', $hash2(["'", "-", "*", "_", "<"], {"'": "ruler", "-": "ruler", "*": "ruler", "_": "ruler", "<": "page_break"})); + $opal.cdecl($scope, 'LAYOUT_BREAK_LINES', $hash2(["'", "-", "*", "_", "<"], {"'": "thematic_break", "-": "thematic_break", "*": "thematic_break", "_": "thematic_break", "<": "page_break"})); $opal.cdecl($scope, 'NESTABLE_LIST_CONTEXTS', ["ulist", "olist", "dlist"]); $opal.cdecl($scope, 'ORDERED_LIST_STYLES', ["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"]); - $opal.cdecl($scope, 'ORDERED_LIST_MARKER_PATTERNS', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+[.>]/, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); - $opal.cdecl($scope, 'ORDERED_LIST_KEYWORDS', $hash2(["loweralpha", "lowerroman", "upperalpha", "upperroman"], {"loweralpha": "a", "lowerroman": "i", "upperalpha": "A", "upperroman": "I"})); $opal.cdecl($scope, 'LIST_CONTINUATION', "+"); $opal.cdecl($scope, 'LINE_BREAK', " +"); - $opal.cdecl($scope, 'LINE_FEED_ENTITY', " "); - $opal.cdecl($scope, 'BLOCK_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\[", "\\]"]})); $opal.cdecl($scope, 'INLINE_MATH_DELIMITERS', $hash2(["asciimath", "latexmath"], {"asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})); $opal.cdecl($scope, 'FLEXIBLE_ATTRIBUTES', ["numbered"]); - if (($a = (($c = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $c)) !== false && $a !== nil) { + if ($scope.RUBY_ENGINE['$==']("opal")) { $opal.cdecl($scope, 'CC_ALPHA', "a-zA-Z"); + $opal.cdecl($scope, 'CG_ALPHA', "[a-zA-Z]"); + $opal.cdecl($scope, 'CC_ALNUM', "a-zA-Z0-9"); - $opal.cdecl($scope, 'CC_BLANK', "[ \t]"); + $opal.cdecl($scope, 'CG_ALNUM', "[a-zA-Z0-9]"); - $opal.cdecl($scope, 'CC_GRAPH', "[x21-x7E]"); + $opal.cdecl($scope, 'CG_BLANK', "[ \\t]"); - $opal.cdecl($scope, 'CC_EOL', "(?=\n|$)"); - } else { - $opal.cdecl($scope, 'CC_ALPHA', "[:alpha:]"); + $opal.cdecl($scope, 'CC_EOL', "(?=\\n|$)"); - $opal.cdecl($scope, 'CC_ALNUM', "[:alnum:]"); + $opal.cdecl($scope, 'CG_GRAPH', "[\\x21-\\x7E]"); - $opal.cdecl($scope, 'CC_BLANK', "[[:blank:]]"); + $opal.cdecl($scope, 'CC_WORD', "a-zA-Z0-9_"); - $opal.cdecl($scope, 'CC_GRAPH', "[[:graph:]]"); + $opal.cdecl($scope, 'CG_WORD', "[a-zA-Z0-9_]");}; - $opal.cdecl($scope, 'CC_EOL', "$"); - }; + $opal.cdecl($scope, 'AuthorInfoLineRx', (new RegExp("^(" + $scope.CG_WORD + "[" + $scope.CC_WORD + "\\-'.]*)(?: +(" + $scope.CG_WORD + "[" + $scope.CC_WORD + "\\-'.]*))?(?: +(" + $scope.CG_WORD + "[" + $scope.CC_WORD + "\\-'.]*))?(?: +<([^>]+)>)?$"))); - $opal.cdecl($scope, 'BLANK_LINE_PATTERN', (new RegExp("^" + $scope.CC_BLANK + "*\\n"))); + $opal.cdecl($scope, 'RevisionInfoLineRx', /^(?:\D*(.*?),)?(?:\s*(?!:)(.*?))(?:\s*(?!^):\s*(.*))?$/); - $opal.cdecl($scope, 'PASS_PLACEHOLDER', $hash2(["start", "end", "match", "match_syn"], {"start": (function() {if (($a = (($c = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $c)) !== false && $a !== nil) { - return (150).$chr() - } else { - return "u0096" - }; return nil; })(), "end": (function() {if (($a = (($c = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $c)) !== false && $a !== nil) { - return (151).$chr() - } else { - return "u0097" - }; return nil; })(), "match": /\u0096(\d+)\u0097/, "match_syn": /]*>\u0096<\/span>[^\d]*(\d+)[^\d]*]*>\u0097<\/span>/})); + $opal.cdecl($scope, 'ManpageTitleVolnumRx', /^(.*)\((.*)\)$/); - $opal.cdecl($scope, 'REGEXP', $hash2(["admonition_inline", "anchor", "anchor_embedded", "anchor_macro", "any_blk", "any_list", "attr_entry", "blk_attr_list", "attr_line", "attr_ref", "author_info", "biblio_macro", "callout_render", "callout_quick_scan", "callout_scan", "colist", "comment_blk", "comment", "ssv_or_csv_delim", "space_delim", "kbd_delim", "escaped_space", "digits", "dlist", "dlist_siblings", "illegal_sectid_chars", "footnote_macro", "generic_blk_macro", "kbd_btn_macro", "menu_macro", "menu_inline_macro", "media_blk_macro", "image_macro", "indexterm_macro", "leading_blanks", "leading_parent_dirs", "line_break", "link_inline", "link_macro", "email_inline", "lit_par", "olist", "break_line", "break_line_plus", "pass_macro", "inline_math_macro", "pass_macro_basic", "pass_lit", "revision_info", "single_quote_esc", "illegal_attr_name_chars", "table_colspec", "table_cellspec", "trailing_digit", "blk_title", "dbl_quoted", "m_dbl_quoted", "section_float_style", "section_title", "section_name", "section_underline", "toc", "ulist", "xref_macro", "ifdef_macro", "eval_expr", "include_macro", "uri_sniff", "uri_encode_chars", "mantitle_manvolnum", "manname_manpurpose"], {"admonition_inline": (new RegExp("^(" + $scope.ADMONITION_STYLES.$to_a()['$*']("|") + "):" + $scope.CC_BLANK)), "anchor": (new RegExp("^\\[\\[(?:|([" + $scope.CC_ALPHA + ":_][\\w:.-]*)(?:," + $scope.CC_BLANK + "*(\\S.*))?)\\]\\]$")), "anchor_embedded": (new RegExp("^(.*?)" + $scope.CC_BLANK + "+(\\\\)?\\[\\[([" + $scope.CC_ALPHA + ":_][\\w:.-]*)(?:," + $scope.CC_BLANK + "*(\\S.*?))?\\]\\]$")), "anchor_macro": (new RegExp("\\\\?(?:\\[\\[([" + $scope.CC_ALPHA + ":_][\\w:.-]*)(?:," + $scope.CC_BLANK + "*(\\S.*?))?\\]\\]|anchor:(\\S+)\\[(.*?[^\\\\])?\\])")), "any_blk": /^(?:(?:-|\.|=|\*|_|\+|\/){4,}|[\|,;!]={3,}|(?:`|~){3,}.*)$/, "any_list": (new RegExp("^(?:" + $scope.CC_BLANK + "+" + $scope.CC_GRAPH + "|" + $scope.CC_BLANK + "*(?:-|(?:\\*|\\.){1,5}|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))" + $scope.CC_BLANK + "+" + $scope.CC_GRAPH + "|" + $scope.CC_BLANK + "*.*?(?::{2,4}|;;)(?:" + $scope.CC_BLANK + "+" + $scope.CC_GRAPH + "|$))")), "attr_entry": (new RegExp("^:(!?\\w.*?):(?:" + $scope.CC_BLANK + "+(.*))?$")), "blk_attr_list": (new RegExp("^\\[(|" + $scope.CC_BLANK + "*[\\w\\{,.#\"'%].*)\\]$")), "attr_line": (new RegExp("^\\[(|" + $scope.CC_BLANK + "*[\\w\\{,.#\"'%].*|\\[(?:|[" + $scope.CC_ALPHA + ":_][\\w:.-]*(?:," + $scope.CC_BLANK + "*\\S.*)?)\\])\\]$")), "attr_ref": /(\\)?\{((set|counter2?):.+?|\w+(?:[\-]\w+)*)(\\)?\}/, "author_info": /^(\w[\w\-'.]*)(?: +(\w[\w\-'.]*))?(?: +(\w[\w\-'.]*))?(?: +<([^>]+)>)?$/, "biblio_macro": /\\?\[\[\[([\w:][\w:.-]*?)\]\]\]/, "callout_render": (new RegExp("(?:(?:\\/\\/|#|;;) ?)?(\\\\)?<!?(--|)(\\d+)\\2>(?=(?: ?\\\\?<!?\\2\\d+\\2>)*" + $scope.CC_EOL + ")")), "callout_quick_scan": (new RegExp("\\\\?(?=(?: ?\\\\?)*" + $scope.CC_EOL + ")")), "callout_scan": (new RegExp("(?:(?:\\/\\/|#|;;) ?)?(\\\\)?(?=(?: ?\\\\?)*" + $scope.CC_EOL + ")")), "colist": (new RegExp("^" + $scope.CC_BLANK + "+(.*)")), "comment_blk": /^\/{4,}$/, "comment": /^\/\/(?:[^\/]|$)/, "ssv_or_csv_delim": /,|;/, "space_delim": (new RegExp("([^\\\\])" + $scope.CC_BLANK + "+")), "kbd_delim": (new RegExp("(?:\\+|,)(?=" + $scope.CC_BLANK + "*[^\\1])")), "escaped_space": (new RegExp("\\\\(" + $scope.CC_BLANK + ")")), "digits": /^\d+$/, "dlist": (new RegExp("^(?!\\/\\/)" + $scope.CC_BLANK + "*(.*?)(:{2,4}|;;)(?:" + $scope.CC_BLANK + "+(.*))?$")), "dlist_siblings": $hash2(["::", ":::", "::::", ";;"], {"::": (new RegExp("^(?!\\/\\/)" + $scope.CC_BLANK + "*((?:.*[^:])?)(::)(?:" + $scope.CC_BLANK + "+(.*))?$")), ":::": (new RegExp("^(?!\\/\\/)" + $scope.CC_BLANK + "*((?:.*[^:])?)(:::)(?:" + $scope.CC_BLANK + "+(.*))?$")), "::::": (new RegExp("^(?!\\/\\/)" + $scope.CC_BLANK + "*((?:.*[^:])?)(::::)(?:" + $scope.CC_BLANK + "+(.*))?$")), ";;": (new RegExp("^(?!\\/\\/)" + $scope.CC_BLANK + "*(.*)(;;)(?:" + $scope.CC_BLANK + "+(.*))?$"))}), "illegal_sectid_chars": /&(?:[a-zA-Z]{2,}|#\d{2,4}|#x[a-fA-F0-9]{2,4});|\W+?/, "footnote_macro": /\\?(footnote(?:ref)?):\[(.*?[^\\])\]/i, "generic_blk_macro": /^(\w[\w\-]*)::(\S+?)\[((?:\\\]|[^\]])*?)\]$/, "kbd_btn_macro": /\\?(?:kbd|btn):\[((?:\\\]|[^\]])+?)\]/, "menu_macro": (new RegExp("\\\\?menu:(\\w|\\w.*?\\S)\\[" + $scope.CC_BLANK + "*(.+?)?\\]")), "menu_inline_macro": (new RegExp("\\\\?\"(\\w[^\"]*?" + $scope.CC_BLANK + "*>" + $scope.CC_BLANK + "*[^\" \\t][^\"]*)\"")), "media_blk_macro": /^(image|video|audio)::(\S+?)\[((?:\\\]|[^\]])*?)\]$/, "image_macro": /\\?(?:image|icon):([^:\[][^\[]*)\[((?:\\\]|[^\]])*?)\]/, "indexterm_macro": /\\?(?:(indexterm2?):\[(.*?[^\\])\]|\(\((.+?)\)\)(?!\)))/i, "leading_blanks": (new RegExp("^(" + $scope.CC_BLANK + "*)")), "leading_parent_dirs": /^(?:\.\.\/)*/, "line_break": (new RegExp("^(.*)" + $scope.CC_BLANK + "\\+" + $scope.CC_EOL)), "link_inline": /(^|link:|<|[\s>\(\)\[\];])(\\?(?:https?|ftp|irc):\/\/[^\s\[\]<]*[^\s.,\[\]<])(?:\[((?:\\\]|[^\]])*?)\])?/, "link_macro": /\\?(?:link|mailto):([^\s\[]+)(?:\[((?:\\\]|[^\]])*?)\])/, "email_inline": (new RegExp("[\\\\>:]?\\w[\\w.%+-]*@[" + $scope.CC_ALNUM + "][" + $scope.CC_ALNUM + ".-]*\\.[" + $scope.CC_ALPHA + "]{2,4}\\b")), "lit_par": (new RegExp("^(" + $scope.CC_BLANK + "+.*)$")), "olist": (new RegExp("^" + $scope.CC_BLANK + "*(\\.{1,5}|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))" + $scope.CC_BLANK + "+(.*)$")), "break_line": /^('|<){3,}$/, "break_line_plus": /^(?:'|<){3,}$|^ {0,3}([-\*_])( *)\1\2\1$/, "pass_macro": /\\?(?:(\+{3}|\${2})(.*?)\1|pass:([a-z,]*)\[(.*?[^\\])\])/i, "inline_math_macro": /\\?((?:latex|ascii)?math):([a-z,]*)\[(.*?[^\\])\]/i, "pass_macro_basic": /^pass:([a-z,]*)\[(.*)\]$/, "pass_lit": /(^|[^`\w])(?:\[([^\]]+?)\])?(\\?`([^`\s]|[^`\s].*?\S)`)(?![`\w])/i, "revision_info": /^(?:\D*(.*?),)?(?:\s*(?!:)(.*?))(?:\s*(?!^):\s*(.*))?$/, "single_quote_esc": /(\w)\\'(\w)/, "illegal_attr_name_chars": /[^\w\-]/, "table_colspec": /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?)?([a-z])?$/, "table_cellspec": $hash2(["start", "end"], {"start": (new RegExp("^" + $scope.CC_BLANK + "*(?:(\\d+(?:\\.\\d*)?|(?:\\d*\\.)?\\d+)([*+]))?([<^>](?:\\.[<^>]?)?|(?:[<^>]?\\.)?[<^>])?([a-z])?\\|")), "end": (new RegExp("" + $scope.CC_BLANK + "+(?:(\\d+(?:\\.\\d*)?|(?:\\d*\\.)?\\d+)([*+]))?([<^>](?:\\.[<^>]?)?|(?:[<^>]?\\.)?[<^>])?([a-z])?$"))}), "trailing_digit": /\d+$/, "blk_title": /^\.([^\s.].*)$/, "dbl_quoted": /^("|)(.*)\1$/, "m_dbl_quoted": /^("|)(.*)\1$/i, "section_float_style": /^(?:float|discrete)\b/, "section_title": (new RegExp("^((?:=|#){1,6})" + $scope.CC_BLANK + "+(\\S.*?)(?:" + $scope.CC_BLANK + "+\\1)?$")), "section_name": /^((?=.*\w+.*)[^.].*?)$/, "section_underline": /^(?:=|-|~|\^|\+)+$/, "toc": /^toc::\[(.*?)\]$/, "ulist": (new RegExp("^" + $scope.CC_BLANK + "*(-|\\*{1,5})" + $scope.CC_BLANK + "+(.*)$")), "xref_macro": /\\?(?:<<([\w":].*?)>>|xref:([\w":].*?)\[(.*?)\])/i, "ifdef_macro": /^[\\]?(ifdef|ifndef|ifeval|endif)::(\S*?(?:([,\+])\S+?)?)\[(.+)?\]$/, "eval_expr": (new RegExp("^(\\S.*?)" + $scope.CC_BLANK + "*(==|!=|<=|>=|<|>)" + $scope.CC_BLANK + "*(\\S.*)$")), "include_macro": /^\\?include::([^\[]+)\[(.*?)\]$/, "uri_sniff": (new RegExp("^[" + $scope.CC_ALPHA + "][" + $scope.CC_ALNUM + ".+-]*:/{0,2}")), "uri_encode_chars": /[^\w\-.!~*';:@=+$,()\[\]]/, "mantitle_manvolnum": /^(.*)\((.*)\)$/, "manname_manpurpose": (new RegExp("^(.*?)" + $scope.CC_BLANK + "+-" + $scope.CC_BLANK + "+(.*)$"))})); + $opal.cdecl($scope, 'ManpageNamePurposeRx', (new RegExp("^(.*?)" + $scope.CG_BLANK + "+-" + $scope.CG_BLANK + "+(.*)$"))); - $opal.cdecl($scope, 'INTRINSICS', ($a = ($c = (($d = $opal.Object._scope.Hash) == null ? $opal.cm('Hash') : $d)).$new, $a._p = (TMP_2 = function(h, k){var self = TMP_2._s || this;if (h == null) h = nil;if (k == null) k = nil; - $scope.STDERR.$puts("Missing intrinsic: " + (k.$inspect())); - return "{" + (k) + "}";}, TMP_2._s = self, TMP_2), $a).call($c).$merge($hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "apostrophe", "backslash", "backtick", "empty", "sp", "space", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "apostrophe": "'", "backslash": "\\", "backtick": "`", "empty": "", "sp": " ", "space": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "amp": "&", "lt": "<", "gt": ">"}))); + $opal.cdecl($scope, 'ConditionalDirectiveRx', /^\\?(ifdef|ifndef|ifeval|endif)::(\S*?(?:([,\+])\S+?)?)\[(.+)?\]$/); - $opal.cdecl($scope, 'SPECIAL_CHARS', $hash2(["<", ">", "&"], {"<": "<", ">": ">", "&": "&"})); + $opal.cdecl($scope, 'EvalExpressionRx', (new RegExp("^(\\S.*?)" + $scope.CG_BLANK + "*(==|!=|<=|>=|<|>)" + $scope.CG_BLANK + "*(\\S.*)$"))); - $opal.cdecl($scope, 'SPECIAL_CHARS_PATTERN', (new RegExp("[" + $scope.SPECIAL_CHARS.$keys().$join() + "]"))); + $opal.cdecl($scope, 'IncludeDirectiveRx', /^\\?include::([^\[]+)\[(.*?)\]$/); - $opal.cdecl($scope, 'QUOTE_SUBS', [["strong", "unconstrained", /\\?(?:\[([^\]]+?)\])?\*\*(.+?)\*\*/i], ["strong", "constrained", /(^|[^\w;:}])(?:\[([^\]]+?)\])?\*(\S|\S.*?\S)\*(?=\W|$)/i], ["double", "constrained", /(^|[^\w;:}])(?:\[([^\]]+?)\])?``(\S|\S.*?\S)''(?=\W|$)/i], ["emphasis", "constrained", /(^|[^\w;:}])(?:\[([^\]]+?)\])?'(\S|\S.*?\S)'(?=\W|$)/i], ["single", "constrained", /(^|[^\w;:}])(?:\[([^\]]+?)\])?`(\S|\S.*?\S)'(?=\W|$)/i], ["monospaced", "unconstrained", /\\?(?:\[([^\]]+?)\])?\+\+(.+?)\+\+/i], ["monospaced", "constrained", /(^|[^\w;:}])(?:\[([^\]]+?)\])?\+(\S|\S.*?\S)\+(?=\W|$)/i], ["emphasis", "unconstrained", /\\?(?:\[([^\]]+?)\])?\_\_(.+?)\_\_/i], ["emphasis", "constrained", /(^|[^\w;:}])(?:\[([^\]]+?)\])?_(\S|\S.*?\S)_(?=\W|$)/i], ["none", "unconstrained", /\\?(?:\[([^\]]+?)\])?##(.+?)##/i], ["none", "constrained", /(^|[^\w;:}])(?:\[([^\]]+?)\])?#(\S|\S.*?\S)#(?=\W|$)/i], ["superscript", "unconstrained", /\\?(?:\[([^\]]+?)\])?\^(.+?)\^/i], ["subscript", "unconstrained", /\\?(?:\[([^\]]+?)\])?\~(.+?)\~/i]]); + $opal.cdecl($scope, 'AttributeEntryRx', (new RegExp("^:(!?\\w.*?):(?:" + $scope.CG_BLANK + "+(.*))?$"))); - $opal.cdecl($scope, 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(^|\n| |\\)--( |\n|$)/, " — ", "none"], [/(\w)\\?--(?=\w)/, "—", "leading"], [/\\?\.\.\./, "…", "leading"], [(new RegExp("([" + $scope.CC_ALPHA + "])\\\\?'(?!')")), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z]+|#\d{2,4}|#x[a-fA-F0-9]{2,4});)/, "", "bounding"]]); + $opal.cdecl($scope, 'InvalidAttributeNameCharsRx', /[^\w\-]/); - $opal.defs(self, '$load', function(input, options) { - var $a, $b, $c, $d, TMP_3, TMP_4, TMP_5, $e, self = this, monitor = nil, start = nil, attrs = nil, original_attrs = nil, lines = nil, input_mtime = nil, input_path = nil, docdate = nil, doctime = nil, read_time = nil, doc = nil, parse_time = nil; - if (options == null) { - options = $hash2([], {}) - } - if (($a = (monitor = options.$fetch("monitor", false))) !== false && $a !== nil) { - start = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now().$to_f()}; - attrs = (($a = "attributes", $b = options, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, $hash2([], {}))))); - if (($a = ((($b = attrs['$is_a?']((($c = $opal.Object._scope.Hash) == null ? $opal.cm('Hash') : $c))) !== false && $b !== nil) ? $b : (($c = (($d = $opal.Object._scope.RUBY_ENGINE_JRUBY) == null ? $opal.cm('RUBY_ENGINE_JRUBY') : $d), $c !== false && $c !== nil ?attrs['$is_a?']((((($d = $opal.Object._scope.Java) == null ? $opal.cm('Java') : $d))._scope.JavaUtil)._scope.Map) : $c)))) === false || $a === nil) { - if (($a = attrs['$is_a?']((($b = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $b))) !== false && $a !== nil) { - attrs = options['$[]=']("attributes", ($a = ($b = attrs).$inject, $a._p = (TMP_3 = function(accum, entry){var self = TMP_3._s || this, $a, k = nil, v = nil;if (accum == null) accum = nil;if (entry == null) entry = nil; - $a = $opal.to_ary(entry.$split("=", 2)), k = ($a[0] == null ? nil : $a[0]), v = ($a[1] == null ? nil : $a[1]); - accum['$[]='](k, ((($a = v) !== false && $a !== nil) ? $a : "")); - return accum;}, TMP_3._s = self, TMP_3), $a).call($b, $hash2([], {}))) - } else if (($a = attrs['$is_a?']((($c = $opal.Object._scope.String) == null ? $opal.cm('String') : $c))) !== false && $a !== nil) { - attrs = attrs.$gsub($scope.REGEXP['$[]']("space_delim"), "\\10").$gsub($scope.REGEXP['$[]']("escaped_space"), "1"); - attrs = options['$[]=']("attributes", ($a = ($c = attrs.$split("0")).$inject, $a._p = (TMP_4 = function(accum, entry){var self = TMP_4._s || this, $a, k = nil, v = nil;if (accum == null) accum = nil;if (entry == null) entry = nil; - $a = $opal.to_ary(entry.$split("=", 2)), k = ($a[0] == null ? nil : $a[0]), v = ($a[1] == null ? nil : $a[1]); - accum['$[]='](k, ((($a = v) !== false && $a !== nil) ? $a : "")); - return accum;}, TMP_4._s = self, TMP_4), $a).call($c, $hash2([], {}))); - } else if (($a = ($d = attrs['$respond_to?']("keys"), $d !== false && $d !== nil ?attrs['$respond_to?']("[]") : $d)) !== false && $a !== nil) { - original_attrs = attrs; - attrs = options['$[]=']("attributes", $hash2([], {})); - ($a = ($d = original_attrs.$keys()).$each, $a._p = (TMP_5 = function(key){var self = TMP_5._s || this;if (key == null) key = nil; - return attrs['$[]='](key, original_attrs['$[]'](key))}, TMP_5._s = self, TMP_5), $a).call($d); - } else { - self.$raise((($a = $opal.Object._scope.ArgumentError) == null ? $opal.cm('ArgumentError') : $a), "illegal type for attributes option: " + (attrs.$class().$ancestors())) - }}; - lines = nil; - if (($a = input['$is_a?']((($e = $opal.Object._scope.File) == null ? $opal.cm('File') : $e))) !== false && $a !== nil) { - lines = input.$readlines(); - input_mtime = input.$mtime(); - input_path = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(input.$path()); - attrs['$[]=']("docfile", input_path); - attrs['$[]=']("docdir", (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(input_path)); - attrs['$[]=']("docname", (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$basename(input_path, (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$extname(input_path))); - attrs['$[]=']("docdate", docdate = input_mtime.$strftime("%Y-%m-%d")); - attrs['$[]=']("doctime", doctime = input_mtime.$strftime("%H:%M:%S %Z")); - attrs['$[]=']("docdatetime", "" + (docdate) + " " + (doctime)); - } else if (($a = input['$respond_to?']("readlines")) !== false && $a !== nil) { - try {input.$rewind() } catch ($err) { nil }; - lines = input.$readlines(); - } else if (($a = input['$is_a?']((($e = $opal.Object._scope.String) == null ? $opal.cm('String') : $e))) !== false && $a !== nil) { - lines = input.$lines().$entries() - } else if (($a = input['$is_a?']((($e = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $e))) !== false && $a !== nil) { - lines = input.$dup() - } else { - self.$raise((($a = $opal.Object._scope.ArgumentError) == null ? $opal.cm('ArgumentError') : $a), "Unsupported input type: " + (input.$class())) - }; - if (monitor !== false && monitor !== nil) { - read_time = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now().$to_f()['$-'](start); - start = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now().$to_f();}; - doc = $scope.Document.$new(lines, options); - if (monitor !== false && monitor !== nil) { - parse_time = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now().$to_f()['$-'](start); - monitor['$[]=']("read", read_time); - monitor['$[]=']("parse", parse_time); - monitor['$[]=']("load", read_time['$+'](parse_time));}; - return doc; - }); + $opal.cdecl($scope, 'AttributeEntryPassMacroRx', /^pass:([a-z,]*)\[(.*)\]$/); - $opal.defs(self, '$load_file', function(filename, options) { - var $a, self = this; - if (options == null) { - options = $hash2([], {}) - } - return (($a = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $a).$load((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$new(filename), options); - }); + $opal.cdecl($scope, 'AttributeReferenceRx', /(\\)?\{((set|counter2?):.+?|\w+(?:[\-]\w+)*)(\\)?\}/); - $opal.defs(self, '$render', function(input, options) { - var $a, $b, $c, TMP_6, $d, $e, $f, $g, TMP_7, TMP_8, TMP_9, TMP_10, self = this, in_place = nil, to_file = nil, to_dir = nil, mkdirs = nil, monitor = nil, write_in_place = nil, write_to_target = nil, stream_output = nil, doc = nil, working_dir = nil, jail = nil, start = nil, output = nil, render_time = nil, outfile = nil, write_time = nil, copy_asciidoctor_stylesheet = nil, stylesheet = nil, copy_user_stylesheet = nil, copy_coderay_stylesheet = nil, copy_pygments_stylesheet = nil, outdir = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dst = nil, stylesheet_content = nil; - if (options == null) { - options = $hash2([], {}) - } - in_place = ((($a = options.$delete("in_place")) !== false && $a !== nil) ? $a : false); - to_file = options.$delete("to_file"); - to_dir = options.$delete("to_dir"); - mkdirs = ((($a = options.$delete("mkdirs")) !== false && $a !== nil) ? $a : false); - monitor = options.$fetch("monitor", false); - write_in_place = (($a = in_place !== false && in_place !== nil) ? input['$is_a?']((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b)) : $a); - write_to_target = ((($a = to_file) !== false && $a !== nil) ? $a : to_dir); - stream_output = ($a = ($b = to_file['$nil?'](), ($b === nil || $b === false)), $a !== false && $a !== nil ?to_file['$respond_to?']("write") : $a); - if (($a = (($b = write_in_place !== false && write_in_place !== nil) ? write_to_target : $b)) !== false && $a !== nil) { - self.$raise((($a = $opal.Object._scope.ArgumentError) == null ? $opal.cm('ArgumentError') : $a), "the option :in_place cannot be used with either the :to_dir or :to_file option")}; - if (($a = ($b = ($c = options['$has_key?']("header_footer"), ($c === nil || $c === false)), $b !== false && $b !== nil ?(((($c = write_in_place) !== false && $c !== nil) ? $c : write_to_target)) : $b)) !== false && $a !== nil) { - options['$[]=']("header_footer", true)}; - doc = (($a = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $a).$load(input, options); - if (to_file['$==']("/dev/null")) { - return doc - } else if (write_in_place !== false && write_in_place !== nil) { - to_file = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(input.$path()), "" + (doc.$attributes()['$[]']("docname")) + (doc.$attributes()['$[]']("outfilesuffix"))) - } else if (($a = ($b = ($c = stream_output, ($c === nil || $c === false)), $b !== false && $b !== nil ?write_to_target : $b)) !== false && $a !== nil) { - working_dir = (function() {if (($a = options['$has_key?']("base_dir")) !== false && $a !== nil) { - return (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(options['$[]']("base_dir")) - } else { - return (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path((($a = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $a).$pwd()) - }; return nil; })(); - jail = (function() {if (doc.$safe()['$>='](($scope.SafeMode)._scope.SAFE)) { - return working_dir - } else { - return nil - }; return nil; })(); - if (to_dir !== false && to_dir !== nil) { - to_dir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); - if (to_file !== false && to_file !== nil) { - to_file = doc.$normalize_system_path(to_file, to_dir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); - to_dir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(to_file); - } else { - to_file = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join(to_dir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$attributes()['$[]']("outfilesuffix"))) - }; - } else if (to_file !== false && to_file !== nil) { - to_file = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); - to_dir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(to_file);}; - if (($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)['$directory?'](to_dir), ($b === nil || $b === false))) !== false && $a !== nil) { - if (mkdirs !== false && mkdirs !== nil) { - (($a = $opal.Object._scope.FileUtils) == null ? $opal.cm('FileUtils') : $a).$mkdir_p(to_dir) - } else { - self.$raise((($a = $opal.Object._scope.IOError) == null ? $opal.cm('IOError') : $a), "target directory does not exist: " + (to_dir)) - }};}; - if (monitor !== false && monitor !== nil) { - start = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now().$to_f()}; - output = doc.$render(); - if (monitor !== false && monitor !== nil) { - render_time = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now().$to_f()['$-'](start); - monitor['$[]=']("render", render_time); - monitor['$[]=']("load_render", monitor['$[]']("load")['$+'](render_time));}; - if (to_file !== false && to_file !== nil) { - if (monitor !== false && monitor !== nil) { - start = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now().$to_f()}; - if (stream_output !== false && stream_output !== nil) { - to_file.$write(output.$rstrip()); - to_file.$write($scope.EOL); - } else { - ($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)).$open, $a._p = (TMP_6 = function(file){var self = TMP_6._s || this;if (file == null) file = nil; - return file.$write(output)}, TMP_6._s = self, TMP_6), $a).call($b, to_file, "w"); - doc.$attributes()['$[]=']("outfile", outfile = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(to_file)); - doc.$attributes()['$[]=']("outdir", (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(outfile)); - }; - if (monitor !== false && monitor !== nil) { - write_time = (($a = $opal.Object._scope.Time) == null ? $opal.cm('Time') : $a).$now().$to_f()['$-'](start); - monitor['$[]=']("write", write_time); - monitor['$[]=']("total", monitor['$[]']("load_render")['$+'](write_time));}; - if (($a = ($c = ($d = ($e = ($f = ($g = stream_output, ($g === nil || $g === false)), $f !== false && $f !== nil ?doc.$safe()['$<'](($scope.SafeMode)._scope.SECURE) : $f), $e !== false && $e !== nil ?(doc['$attr?']("basebackend-html")) : $e), $d !== false && $d !== nil ?(doc['$attr?']("linkcss")) : $d), $c !== false && $c !== nil ?(doc['$attr?']("copycss")) : $c)) !== false && $a !== nil) { - copy_asciidoctor_stylesheet = $scope.DEFAULT_STYLESHEET_KEYS['$include?'](stylesheet = (doc.$attr("stylesheet"))); - copy_user_stylesheet = ($a = ($c = copy_asciidoctor_stylesheet, ($c === nil || $c === false)), $a !== false && $a !== nil ?($c = stylesheet.$to_s()['$empty?'](), ($c === nil || $c === false)) : $a); - copy_coderay_stylesheet = ($a = (doc['$attr?']("source-highlighter", "coderay")), $a !== false && $a !== nil ?(doc.$attr("coderay-css", "class"))['$==']("class") : $a); - copy_pygments_stylesheet = ($a = (doc['$attr?']("source-highlighter", "pygments")), $a !== false && $a !== nil ?(doc.$attr("pygments-css", "class"))['$==']("class") : $a); - if (($a = ((($c = ((($d = ((($e = copy_asciidoctor_stylesheet) !== false && $e !== nil) ? $e : copy_user_stylesheet)) !== false && $d !== nil) ? $d : copy_coderay_stylesheet)) !== false && $c !== nil) ? $c : copy_pygments_stylesheet)) !== false && $a !== nil) { - outdir = doc.$attr("outdir"); - stylesoutdir = doc.$normalize_system_path(doc.$attr("stylesdir"), outdir, (function() {if (doc.$safe()['$>='](($scope.SafeMode)._scope.SAFE)) { - return outdir - } else { - return nil - }; return nil; })()); - if (mkdirs !== false && mkdirs !== nil) { - $scope.Helpers.$mkdir_p(stylesoutdir)}; - if (copy_asciidoctor_stylesheet !== false && copy_asciidoctor_stylesheet !== nil) { - ($a = ($c = (($d = $opal.Object._scope.File) == null ? $opal.cm('File') : $d)).$open, $a._p = (TMP_7 = function(f){var self = TMP_7._s || this;if (f == null) f = nil; - return f.$write($scope.HTML5.$default_asciidoctor_stylesheet())}, TMP_7._s = self, TMP_7), $a).call($c, (($d = $opal.Object._scope.File) == null ? $opal.cm('File') : $d).$join(stylesoutdir, $scope.DEFAULT_STYLESHEET_NAME), "w")}; - if (copy_user_stylesheet !== false && copy_user_stylesheet !== nil) { - if (($a = ((stylesheet_src = (doc.$attr("copycss"))))['$empty?']()) !== false && $a !== nil) { - stylesheet_src = doc.$normalize_system_path(stylesheet) - } else { - stylesheet_src = doc.$normalize_system_path(stylesheet_src) - }; - stylesheet_dst = doc.$normalize_system_path(stylesheet, stylesoutdir, ((function() {if (doc.$safe()['$>='](($scope.SafeMode)._scope.SAFE)) { - return outdir - } else { - return nil - }; return nil; })())); - if (($a = ((($d = stylesheet_src['$=='](stylesheet_dst)) !== false && $d !== nil) ? $d : ((stylesheet_content = doc.$read_asset(stylesheet_src)))['$nil?']())) === false || $a === nil) { - ($a = ($d = (($e = $opal.Object._scope.File) == null ? $opal.cm('File') : $e)).$open, $a._p = (TMP_8 = function(f){var self = TMP_8._s || this;if (f == null) f = nil; - return f.$write(stylesheet_content)}, TMP_8._s = self, TMP_8), $a).call($d, stylesheet_dst, "w")};}; - if (copy_coderay_stylesheet !== false && copy_coderay_stylesheet !== nil) { - ($a = ($e = (($f = $opal.Object._scope.File) == null ? $opal.cm('File') : $f)).$open, $a._p = (TMP_9 = function(f){var self = TMP_9._s || this;if (f == null) f = nil; - return f.$write($scope.HTML5.$default_coderay_stylesheet())}, TMP_9._s = self, TMP_9), $a).call($e, (($f = $opal.Object._scope.File) == null ? $opal.cm('File') : $f).$join(stylesoutdir, "asciidoctor-coderay.css"), "w")}; - if (copy_pygments_stylesheet !== false && copy_pygments_stylesheet !== nil) { - ($a = ($f = (($g = $opal.Object._scope.File) == null ? $opal.cm('File') : $g)).$open, $a._p = (TMP_10 = function(f){var self = TMP_10._s || this;if (f == null) f = nil; - return f.$write($scope.HTML5.$pygments_stylesheet(doc.$attr("pygments-style")))}, TMP_10._s = self, TMP_10), $a).call($f, (($g = $opal.Object._scope.File) == null ? $opal.cm('File') : $g).$join(stylesoutdir, "asciidoctor-pygments.css"), "w")};};}; - return doc; - } else { - return output - }; - }); + $opal.cdecl($scope, 'BlockAnchorRx', (new RegExp("^\\[\\[(?:|([" + $scope.CC_ALPHA + ":_][" + $scope.CC_WORD + ":.-]*)(?:," + $scope.CG_BLANK + "*(\\S.*))?)\\]\\]$"))); - $opal.defs(self, '$render_file', function(filename, options) { - var $a, self = this; - if (options == null) { - options = $hash2([], {}) - } - return (($a = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $a).$render((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$new(filename), options); - }); + $opal.cdecl($scope, 'BlockAttributeListRx', (new RegExp("^\\[(|" + $scope.CG_BLANK + "*[" + $scope.CC_WORD + "\\{,.#\"'%].*)\\]$"))); - if (($a = (($d = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $d)) === false || $a === nil) { - ; + $opal.cdecl($scope, 'BlockAttributeLineRx', (new RegExp("^\\[(|" + $scope.CG_BLANK + "*[" + $scope.CC_WORD + "\\{,.#\"'%].*|\\[(?:|[" + $scope.CC_ALPHA + ":_][" + $scope.CC_WORD + ":.-]*(?:," + $scope.CG_BLANK + "*\\S.*)?)\\])\\]$"))); - ;}; + $opal.cdecl($scope, 'BlockTitleRx', /^\.([^\s.].*)$/); - ; + $opal.cdecl($scope, 'AdmonitionParagraphRx', (new RegExp("^(" + $scope.ADMONITION_STYLES.$to_a()['$*']("|") + "):" + $scope.CG_BLANK))); - ; + $opal.cdecl($scope, 'LiteralParagraphRx', (new RegExp("^(" + $scope.CG_BLANK + "+.*)$"))); - ; + $opal.cdecl($scope, 'CommentBlockRx', /^\/{4,}$/); - ; + $opal.cdecl($scope, 'CommentLineRx', /^\/\/(?:[^\/]|$)/); - ; + $opal.cdecl($scope, 'AtxSectionRx', (new RegExp("^((?:=|#){1,6})" + $scope.CG_BLANK + "+(\\S.*?)(?:" + $scope.CG_BLANK + "+\\1)?$"))); - ; + $opal.cdecl($scope, 'SetextSectionTitleRx', (new RegExp("^((?=.*" + $scope.CG_WORD + "+.*)[^.].*?)$"))); - ; + $opal.cdecl($scope, 'SetextSectionLineRx', /^(?:=|-|~|\^|\+)+$/); - ; + $opal.cdecl($scope, 'InlineSectionAnchorRx', (new RegExp("^(.*?)" + $scope.CG_BLANK + "+(\\\\)?\\[\\[([" + $scope.CC_ALPHA + ":_][" + $scope.CC_WORD + ":.-]*)(?:," + $scope.CG_BLANK + "*(\\S.*?))?\\]\\]$"))); - ; + $opal.cdecl($scope, 'InvalidSectionIdCharsRx', (new RegExp("&(?:[a-zA-Z]{2,}|#\\d{2,5}|#x[a-fA-F0-9]{2,4});|[^" + $scope.CC_WORD + "]+?"))); - ; + $opal.cdecl($scope, 'FloatingTitleStyleRx', /^(?:float|discrete)\b/); - ; + $opal.cdecl($scope, 'AnyListRx', (new RegExp("^(?:" + $scope.CG_BLANK + "+" + $scope.CG_GRAPH + "|" + $scope.CG_BLANK + "*(?:-|(?:\\*|\\.){1,5}|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))" + $scope.CG_BLANK + "+" + $scope.CG_GRAPH + "|" + $scope.CG_BLANK + "*.*?(?::{2,4}|;;)(?:" + $scope.CG_BLANK + "+" + $scope.CG_GRAPH + "|$))"))); - ; + $opal.cdecl($scope, 'UnorderedListRx', (new RegExp("^" + $scope.CG_BLANK + "*(-|\\*{1,5})" + $scope.CG_BLANK + "+(.*)$"))); - ; + $opal.cdecl($scope, 'OrderedListRx', (new RegExp("^" + $scope.CG_BLANK + "*(\\.{1,5}|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))" + $scope.CG_BLANK + "+(.*)$"))); - ; + $opal.cdecl($scope, 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+[.>]/, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/})); - ; + $opal.cdecl($scope, 'DefinitionListRx', (new RegExp("^(?!\\/\\/)" + $scope.CG_BLANK + "*(.*?)(:{2,4}|;;)(?:" + $scope.CG_BLANK + "+(.*))?$"))); - ; + $opal.cdecl($scope, 'DefinitionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": (new RegExp("^(?!\\/\\/)" + $scope.CG_BLANK + "*((?:.*[^:])?)(::)(?:" + $scope.CG_BLANK + "+(.*))?$")), ":::": (new RegExp("^(?!\\/\\/)" + $scope.CG_BLANK + "*((?:.*[^:])?)(:::)(?:" + $scope.CG_BLANK + "+(.*))?$")), "::::": (new RegExp("^(?!\\/\\/)" + $scope.CG_BLANK + "*((?:.*[^:])?)(::::)(?:" + $scope.CG_BLANK + "+(.*))?$")), ";;": (new RegExp("^(?!\\/\\/)" + $scope.CG_BLANK + "*(.*)(;;)(?:" + $scope.CG_BLANK + "+(.*))?$"))})); + + $opal.cdecl($scope, 'CalloutListRx', (new RegExp("^" + $scope.CG_BLANK + "+(.*)"))); + + $opal.cdecl($scope, 'CalloutConvertRx', (new RegExp("(?:(?:\\/\\/|#|;;) ?)?(\\\\)?<!?(--|)(\\d+)\\2>(?=(?: ?\\\\?<!?\\2\\d+\\2>)*" + $scope.CC_EOL + ")"))); + + $opal.cdecl($scope, 'CalloutQuickScanRx', (new RegExp("\\\\?(?=(?: ?\\\\?)*" + $scope.CC_EOL + ")"))); + + $opal.cdecl($scope, 'CalloutScanRx', (new RegExp("(?:(?:\\/\\/|#|;;) ?)?(\\\\)?(?=(?: ?\\\\?)*" + $scope.CC_EOL + ")"))); - if (($a = (($d = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $d)) !== false && $a !== nil) { + $opal.cdecl($scope, 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $scope.UnorderedListRx, "olist": $scope.OrderedListRx, "dlist": $scope.DefinitionListRx, "colist": $scope.CalloutListRx})); + + $opal.cdecl($scope, 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?)?([a-z])?$/); + + $opal.cdecl($scope, 'CellSpecStartRx', (new RegExp("^" + $scope.CG_BLANK + "*(?:(\\d+(?:\\.\\d*)?|(?:\\d*\\.)?\\d+)([*+]))?([<^>](?:\\.[<^>]?)?|(?:[<^>]?\\.)?[<^>])?([a-z])?\\|"))); + + $opal.cdecl($scope, 'CellSpecEndRx', (new RegExp("" + $scope.CG_BLANK + "+(?:(\\d+(?:\\.\\d*)?|(?:\\d*\\.)?\\d+)([*+]))?([<^>](?:\\.[<^>]?)?|(?:[<^>]?\\.)?[<^>])?([a-z])?$"))); + + $opal.cdecl($scope, 'GenericBlockMacroRx', (new RegExp("^(" + $scope.CG_WORD + "+)::(\\S*?)\\[((?:\\\\\\]|[^\\]])*?)\\]$"))); + + $opal.cdecl($scope, 'MediaBlockMacroRx', /^(image|video|audio)::(\S+?)\[((?:\\\]|[^\]])*?)\]$/); + + $opal.cdecl($scope, 'TocBlockMacroRx', /^toc::\[(.*?)\]$/); + + $opal.cdecl($scope, 'InlineAnchorRx', (new RegExp("\\\\?(?:\\[\\[([" + $scope.CC_ALPHA + ":_][" + $scope.CC_WORD + ":.-]*)(?:," + $scope.CG_BLANK + "*(\\S.*?))?\\]\\]|anchor:(\\S+)\\[(.*?[^\\\\])?\\])"))); + + $opal.cdecl($scope, 'InlineBiblioAnchorRx', (new RegExp("\\\\?\\[\\[\\[([" + $scope.CC_WORD + ":][" + $scope.CC_WORD + ":.-]*?)\\]\\]\\]"))); + + $opal.cdecl($scope, 'EmailInlineMacroRx', (new RegExp("([\\\\>:\\/])?" + $scope.CG_WORD + "[" + $scope.CC_WORD + ".%+-]*@" + $scope.CG_ALNUM + "[" + $scope.CC_ALNUM + ".-]*\\." + $scope.CG_ALPHA + "{2,4}\\b"))); + + $opal.cdecl($scope, 'FootnoteInlineMacroRx', /\\?(footnote(?:ref)?):\[(.*?[^\\])\]/m); + + $opal.cdecl($scope, 'ImageInlineMacroRx', /\\?(?:image|icon):([^:\[][^\[]*)\[((?:\\\]|[^\]])*?)\]/); + + $opal.cdecl($scope, 'IndextermInlineMacroRx', /\\?(?:(indexterm2?):\[(.*?[^\\])\]|\(\((.+?)\)\)(?!\)))/m); + + $opal.cdecl($scope, 'KbdBtnInlineMacroRx', /\\?(?:kbd|btn):\[((?:\\\]|[^\]])+?)\]/); + + $opal.cdecl($scope, 'KbdDelimiterRx', (new RegExp("(?:\\+|,)(?=" + $scope.CG_BLANK + "*[^\\1])"))); + + $opal.cdecl($scope, 'LinkInlineRx', /(^|link:|<|[\s>\(\)\[\];])(\\?(?:https?|file|ftp|irc):\/\/[^\s\[\]<]*[^\s.,\[\]<])(?:\[((?:\\\]|[^\]])*?)\])?/); + + $opal.cdecl($scope, 'LinkInlineMacroRx', /\\?(?:link|mailto):([^\s\[]+)(?:\[((?:\\\]|[^\]])*?)\])/); + + $opal.cdecl($scope, 'MathInlineMacroRx', /\\?((?:latex|ascii)?math):([a-z,]*)\[(.*?[^\\])\]/m); + + $opal.cdecl($scope, 'MenuInlineMacroRx', (new RegExp("\\\\?menu:(" + $scope.CG_WORD + "|" + $scope.CG_WORD + ".*?\\S)\\[" + $scope.CG_BLANK + "*(.+?)?\\]"))); + + $opal.cdecl($scope, 'MenuInlineRx', (new RegExp("\\\\?\"(" + $scope.CG_WORD + "[^\"]*?" + $scope.CG_BLANK + "*>" + $scope.CG_BLANK + "*[^\" \\t][^\"]*)\""))); + + $opal.cdecl($scope, 'PassInlineLiteralRx', (new RegExp("(^|[^`" + $scope.CC_WORD + "])(?:\\[([^\\]]+?)\\])?(\\\\?`([^`\\s]|[^`\\s].*?\\S)`)(?![`" + $scope.CC_WORD + "])"))); + + $opal.cdecl($scope, 'PassInlineMacroRx', /\\?(?:(\+{3}|\${2})(.*?)\1|pass:([a-z,]*)\[(.*?[^\\])\])/m); + + $opal.cdecl($scope, 'XrefInlineMacroRx', (new RegExp("\\\\?(?:<<([" + $scope.CC_WORD + "\":].*?)>>|xref:([" + $scope.CC_WORD + "\":].*?)\\[(.*?)\\])"))); + + $opal.cdecl($scope, 'LineBreakRx', (function() {if ($scope.RUBY_ENGINE['$==']("opal")) { + return /^(.*)[ \t]\+$/m}; return nil; })()); + + $opal.cdecl($scope, 'LayoutBreakLineRx', /^('|<){3,}$/); + + $opal.cdecl($scope, 'LayoutBreakLinePlusRx', /^(?:'|<){3,}$|^ {0,3}([-\*_])( *)\1\2\1$/); + + $opal.cdecl($scope, 'BlankLineRx', (new RegExp("^" + $scope.CG_BLANK + "*\\n"))); + + $opal.cdecl($scope, 'DataDelimiterRx', /,|;/); + + $opal.cdecl($scope, 'DigitsRx', /^\d+$/); + + $opal.cdecl($scope, 'DoubleQuotedRx', /^("|)(.*)\1$/); + + $opal.cdecl($scope, 'DoubleQuotedMultiRx', /^("|)(.*)\1$/m); + + $opal.cdecl($scope, 'TrailingDigitsRx', /\d+$/); + + $opal.cdecl($scope, 'EscapedSpaceRx', (new RegExp("\\\\(" + $scope.CG_BLANK + ")"))); + + $opal.cdecl($scope, 'SpaceDelimiterRx', (new RegExp("([^\\\\])" + $scope.CG_BLANK + "+"))); + + $opal.cdecl($scope, 'UnicodeCharScanRx', (function() {if ($scope.RUBY_ENGINE['$==']("opal")) { + return nil}; return nil; })()); + + $opal.cdecl($scope, 'UriSniffRx', (new RegExp("^" + $scope.CG_ALPHA + "[" + $scope.CC_ALNUM + ".+-]*:/{0,2}"))); + + $opal.cdecl($scope, 'UriTerminator', /[);:]$/); + + $opal.cdecl($scope, 'XmlSanitizeRx', /<[^>]+>/); + + $opal.cdecl($scope, 'INTRINSIC_ATTRIBUTES', $hash2(["startsb", "endsb", "vbar", "caret", "asterisk", "tilde", "plus", "apostrophe", "backslash", "backtick", "empty", "sp", "space", "two-colons", "two-semicolons", "nbsp", "deg", "zwsp", "quot", "apos", "lsquo", "rsquo", "ldquo", "rdquo", "wj", "brvbar", "amp", "lt", "gt"], {"startsb": "[", "endsb": "]", "vbar": "|", "caret": "^", "asterisk": "*", "tilde": "~", "plus": "+", "apostrophe": "'", "backslash": "\\", "backtick": "`", "empty": "", "sp": " ", "space": " ", "two-colons": "::", "two-semicolons": ";;", "nbsp": " ", "deg": "°", "zwsp": "​", "quot": """, "apos": "'", "lsquo": "‘", "rsquo": "’", "ldquo": "“", "rdquo": "”", "wj": "⁠", "brvbar": "¦", "amp": "&", "lt": "<", "gt": ">"})); + + $opal.cdecl($scope, 'QUOTE_SUBS', [["strong", "unconstrained", /\\?(?:\[([^\]]+?)\])?\*\*(.+?)\*\*/m], ["strong", "constrained", (new RegExp("(^|[^" + $scope.CC_WORD + ";:}])(?:\\[([^\\]]+?)\\])?\\*(\\S|\\S.*?\\S)\\*(?!" + $scope.CG_WORD + ")"))], ["double", "constrained", (new RegExp("(^|[^" + $scope.CC_WORD + ";:}])(?:\\[([^\\]]+?)\\])?``(\\S|\\S.*?\\S)''(?!" + $scope.CG_WORD + ")"))], ["emphasis", "constrained", (new RegExp("(^|[^" + $scope.CC_WORD + ";:}])(?:\\[([^\\]]+?)\\])?'(\\S|\\S.*?\\S)'(?!" + $scope.CG_WORD + ")"))], ["single", "constrained", (new RegExp("(^|[^" + $scope.CC_WORD + ";:}])(?:\\[([^\\]]+?)\\])?`(\\S|\\S.*?\\S)'(?!" + $scope.CG_WORD + ")"))], ["monospaced", "unconstrained", /\\?(?:\[([^\]]+?)\])?\+\+(.+?)\+\+/m], ["monospaced", "constrained", (new RegExp("(^|[^" + $scope.CC_WORD + ";:}])(?:\\[([^\\]]+?)\\])?\\+(\\S|\\S.*?\\S)\\+(?!" + $scope.CG_WORD + ")"))], ["emphasis", "unconstrained", /\\?(?:\[([^\]]+?)\])?__(.+?)__/m], ["emphasis", "constrained", (new RegExp("(^|[^" + $scope.CC_WORD + ";:}])(?:\\[([^\\]]+?)\\])?_(\\S|\\S.*?\\S)_(?!" + $scope.CG_WORD + ")"))], ["none", "unconstrained", /\\?(?:\[([^\]]+?)\])?##(.+?)##/m], ["none", "constrained", (new RegExp("(^|[^" + $scope.CC_WORD + ";:}])(?:\\[([^\\]]+?)\\])?#(\\S|\\S.*?\\S)#(?!" + $scope.CG_WORD + ")"))], ["superscript", "unconstrained", /\\?(?:\[([^\]]+?)\])?\^(.+?)\^/m], ["subscript", "unconstrained", /\\?(?:\[([^\]]+?)\])?~(.+?)~/m]]); + + $opal.cdecl($scope, 'REPLACEMENTS', [[/\\?\(C\)/, "©", "none"], [/\\?\(R\)/, "®", "none"], [/\\?\(TM\)/, "™", "none"], [/(^|\n| |\\)--( |\n|$)/, " — ", "none"], [(new RegExp("(" + $scope.CG_WORD + ")\\\\?--(?=" + $scope.CG_WORD + ")")), "—", "leading"], [/\\?\.\.\./, "…", "leading"], [(new RegExp("(" + $scope.CG_ALPHA + ")\\\\?'(?!')")), "’", "leading"], [/\\?->/, "→", "none"], [/\\?=>/, "⇒", "none"], [/\\?<-/, "←", "none"], [/\\?<=/, "⇐", "none"], [/\\?(&)amp;((?:[a-zA-Z]+|#\d{2,5}|#x[a-fA-F0-9]{2,4});)/, "", "bounding"]]); + + (function(self) { + var $scope = self._scope, def = self._proto; + + self._proto.$load = function(input, options) { + var $a, $b, $c, $d, TMP_2, TMP_3, TMP_4, $e, self = this, timings = nil, attributes = nil, attrs = nil, capture_1 = nil, original_attrs = nil, lines = nil, input_mtime = nil, input_path = nil, docdate = nil, doctime = nil, doc = nil; + + if (options == null) { + options = $hash2([], {}) + } + options = options.$dup(); + if ((($a = (timings = options['$[]']("timings"))) !== nil && (!$a._isBoolean || $a == true))) { + timings.$start("read")}; + attributes = options['$[]=']("attributes", (function() {if ((($a = ((attrs = options['$[]']("attributes")))['$!']()) !== nil && (!$a._isBoolean || $a == true))) { + return $hash2([], {}) + } else if ((($a = ((($b = (attrs['$is_a?']((($c = $opal.Object._scope.Hash) == null ? $opal.cm('Hash') : $c)))) !== false && $b !== nil) ? $b : (($c = (($d = $opal.Object._scope.RUBY_ENGINE_JRUBY) == null ? $opal.cm('RUBY_ENGINE_JRUBY') : $d), $c !== false && $c !== nil ?(attrs['$is_a?']((((($d = $opal.Object._scope.Java) == null ? $opal.cm('Java') : $d))._scope.JavaUtil)._scope.Map)) : $c)))) !== nil && (!$a._isBoolean || $a == true))) { + return attrs.$dup() + } else if ((($a = attrs['$is_a?']((($b = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $b))) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = ($b = attrs).$inject, $a._p = (TMP_2 = function(accum, entry){var self = TMP_2._s || this, $a, k = nil, v = nil; +if (accum == null) accum = nil;if (entry == null) entry = nil; + $a = $opal.to_ary(entry.$split("=", 2)), k = ($a[0] == null ? nil : $a[0]), v = ($a[1] == null ? nil : $a[1]); + accum['$[]='](k, ((($a = v) !== false && $a !== nil) ? $a : "")); + return accum;}, TMP_2._s = self, TMP_2), $a).call($b, $hash2([], {})) + } else if ((($a = attrs['$is_a?']((($c = $opal.Object._scope.String) == null ? $opal.cm('String') : $c))) !== nil && (!$a._isBoolean || $a == true))) { + capture_1 = (function() {if ((($a = (($c = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $c)) !== nil && (!$a._isBoolean || $a == true))) { + return "$1" + } else { + return "\\1" + }; return nil; })(); + attrs = attrs.$gsub($scope.SpaceDelimiterRx, "" + (capture_1) + ($scope.NULL)).$gsub($scope.EscapedSpaceRx, capture_1); + return ($a = ($c = attrs.$split($scope.NULL)).$inject, $a._p = (TMP_3 = function(accum, entry){var self = TMP_3._s || this, $a, k = nil, v = nil; +if (accum == null) accum = nil;if (entry == null) entry = nil; + $a = $opal.to_ary(entry.$split("=", 2)), k = ($a[0] == null ? nil : $a[0]), v = ($a[1] == null ? nil : $a[1]); + accum['$[]='](k, ((($a = v) !== false && $a !== nil) ? $a : "")); + return accum;}, TMP_3._s = self, TMP_3), $a).call($c, $hash2([], {})); + } else if ((($a = ($d = (attrs['$respond_to?']("keys")), $d !== false && $d !== nil ?(attrs['$respond_to?']("[]")) : $d)) !== nil && (!$a._isBoolean || $a == true))) { + original_attrs = attrs; + attrs = $hash2([], {}); + ($a = ($d = original_attrs.$keys()).$each, $a._p = (TMP_4 = function(key){var self = TMP_4._s || this; +if (key == null) key = nil; + return attrs['$[]='](key, original_attrs['$[]'](key))}, TMP_4._s = self, TMP_4), $a).call($d); + return attrs; + } else { + return self.$raise((($a = $opal.Object._scope.ArgumentError) == null ? $opal.cm('ArgumentError') : $a), "illegal type for attributes option: " + (attrs.$class().$ancestors())) + }; return nil; })()); + lines = nil; + if ((($a = input['$is_a?']((($e = $opal.Object._scope.File) == null ? $opal.cm('File') : $e))) !== nil && (!$a._isBoolean || $a == true))) { + lines = input.$readlines(); + input_mtime = input.$mtime(); + input = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$new((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(input.$path())); + input_path = input.$path(); + attributes['$[]=']("docfile", input_path); + attributes['$[]=']("docdir", (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(input_path)); + attributes['$[]=']("docname", (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$basename(input_path, ((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$extname(input_path)))); + attributes['$[]=']("docdate", docdate = input_mtime.$strftime("%Y-%m-%d")); + attributes['$[]=']("doctime", doctime = input_mtime.$strftime("%H:%M:%S %Z")); + attributes['$[]=']("docdatetime", "" + (docdate) + " " + (doctime)); + } else if ((($a = input['$respond_to?']("readlines")) !== nil && (!$a._isBoolean || $a == true))) { + try {input.$rewind() } catch ($err) { nil }; + lines = input.$readlines(); + } else if ((($a = input['$is_a?']((($e = $opal.Object._scope.String) == null ? $opal.cm('String') : $e))) !== nil && (!$a._isBoolean || $a == true))) { + lines = input.$lines().$entries() + } else if ((($a = input['$is_a?']((($e = $opal.Object._scope.Array) == null ? $opal.cm('Array') : $e))) !== nil && (!$a._isBoolean || $a == true))) { + lines = input.$dup() + } else { + self.$raise((($a = $opal.Object._scope.ArgumentError) == null ? $opal.cm('ArgumentError') : $a), "Unsupported input type: " + (input.$class())) + }; + if (timings !== false && timings !== nil) { + timings.$record("read"); + timings.$start("parse");}; + if ((($a = options['$key?']("parse")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + options['$[]=']("parse", true) + }; + doc = $scope.Document.$new(lines, options); + if (timings !== false && timings !== nil) { + timings.$record("parse")}; + return doc; + }; + self._proto.$load_file = function(filename, options) { + var $a, self = this; + + if (options == null) { + options = $hash2([], {}) + } + return self.$load((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$new(((($a = filename) !== false && $a !== nil) ? $a : "")), options); + }; + self._proto.$convert = function(input, options) { + var $a, $b, $c, $d, $e, TMP_5, self = this, to_file = nil, to_dir = nil, mkdirs = nil, timings = nil, $case = nil, write_to_same_dir = nil, stream_output = nil, write_to_target = nil, doc = nil, infile = nil, outfile = nil, outdir = nil, working_dir = nil, jail = nil, output = nil, copy_asciidoctor_stylesheet = nil, stylesheet = nil, copy_user_stylesheet = nil, copy_coderay_stylesheet = nil, copy_pygments_stylesheet = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dst = nil, stylesheet_content = nil; + + if (options == null) { + options = $hash2([], {}) + } + options = options.$dup(); + to_file = options.$delete("to_file"); + to_dir = options.$delete("to_dir"); + mkdirs = ((($a = options.$delete("mkdirs")) !== false && $a !== nil) ? $a : false); + timings = options['$[]']("timings"); + $case = to_file;if (true['$===']($case) || nil['$===']($case)) {write_to_same_dir = ($a = to_dir['$!'](), $a !== false && $a !== nil ?(input['$is_a?']((($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b))) : $a); + stream_output = false; + write_to_target = to_dir; + to_file = nil;}else if (false['$===']($case)) {write_to_same_dir = false; + stream_output = false; + write_to_target = false; + to_file = nil;}else {write_to_same_dir = false; + stream_output = to_file['$respond_to?']("write"); + write_to_target = (function() {if (stream_output !== false && stream_output !== nil) { + return false + } else { + return to_file + }; return nil; })();}; + if ((($a = ($b = options['$key?']("header_footer")['$!'](), $b !== false && $b !== nil ?(((($c = write_to_same_dir) !== false && $c !== nil) ? $c : write_to_target)) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + options['$[]=']("header_footer", true)}; + doc = self.$load(input, options); + if (to_file['$==']("/dev/null")) { + return doc + } else if (write_to_same_dir !== false && write_to_same_dir !== nil) { + infile = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(input.$path()); + outfile = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(infile), "" + (doc.$attributes()['$[]']("docname")) + (doc.$attributes()['$[]']("outfilesuffix"))); + if (outfile['$=='](infile)) { + self.$raise((($a = $opal.Object._scope.IOError) == null ? $opal.cm('IOError') : $a), "Input file and output file are the same!")}; + outdir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(outfile); + } else if (write_to_target !== false && write_to_target !== nil) { + working_dir = (function() {if ((($a = options['$has_key?']("base_dir")) !== nil && (!$a._isBoolean || $a == true))) { + return (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path(options['$[]']("base_dir")) + } else { + return (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$expand_path((($a = $opal.Object._scope.Dir) == null ? $opal.cm('Dir') : $a).$pwd()) + }; return nil; })(); + jail = (function() {if (doc.$safe()['$>='](($scope.SafeMode)._scope.SAFE)) { + return working_dir + } else { + return nil + }; return nil; })(); + if (to_dir !== false && to_dir !== nil) { + outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + if (to_file !== false && to_file !== nil) { + outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(outfile); + } else { + outfile = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$attributes()['$[]']("outfilesuffix"))) + }; + } else if (to_file !== false && to_file !== nil) { + outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false})); + outdir = (($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$dirname(outfile);}; + if ((($a = (($b = $opal.Object._scope.File) == null ? $opal.cm('File') : $b)['$directory?'](outdir)) !== nil && (!$a._isBoolean || $a == true))) { + } else if (mkdirs !== false && mkdirs !== nil) { + (($a = $opal.Object._scope.FileUtils) == null ? $opal.cm('FileUtils') : $a).$mkdir_p(outdir) + } else { + self.$raise((($a = $opal.Object._scope.IOError) == null ? $opal.cm('IOError') : $a), "target directory does not exist: " + (to_dir)) + }; + } else { + outfile = to_file; + outdir = nil; + }; + if (timings !== false && timings !== nil) { + timings.$start("convert")}; + output = doc.$convert(); + if (timings !== false && timings !== nil) { + timings.$record("convert")}; + if (outfile !== false && outfile !== nil) { + if (timings !== false && timings !== nil) { + timings.$start("write")}; + if (stream_output !== false && stream_output !== nil) { + } else { + doc.$attributes()['$[]=']("outfile", outfile); + doc.$attributes()['$[]=']("outdir", outdir); + }; + doc.$write(output, outfile); + if (timings !== false && timings !== nil) { + timings.$record("write")}; + if ((($a = ($b = ($c = ($d = ($e = stream_output['$!'](), $e !== false && $e !== nil ?doc.$safe()['$<'](($scope.SafeMode)._scope.SECURE) : $e), $d !== false && $d !== nil ?(doc['$attr?']("basebackend-html")) : $d), $c !== false && $c !== nil ?(doc['$attr?']("linkcss")) : $c), $b !== false && $b !== nil ?(doc['$attr?']("copycss")) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + copy_asciidoctor_stylesheet = $scope.DEFAULT_STYLESHEET_KEYS['$include?'](stylesheet = (doc.$attr("stylesheet"))); + copy_user_stylesheet = ($a = copy_asciidoctor_stylesheet['$!'](), $a !== false && $a !== nil ?stylesheet['$nil_or_empty?']()['$!']() : $a); + copy_coderay_stylesheet = ($a = (doc['$attr?']("source-highlighter", "coderay")), $a !== false && $a !== nil ?(doc.$attr("coderay-css", "class"))['$==']("class") : $a); + copy_pygments_stylesheet = ($a = (doc['$attr?']("source-highlighter", "pygments")), $a !== false && $a !== nil ?(doc.$attr("pygments-css", "class"))['$==']("class") : $a); + if ((($a = ((($b = ((($c = ((($d = copy_asciidoctor_stylesheet) !== false && $d !== nil) ? $d : copy_user_stylesheet)) !== false && $c !== nil) ? $c : copy_coderay_stylesheet)) !== false && $b !== nil) ? $b : copy_pygments_stylesheet)) !== nil && (!$a._isBoolean || $a == true))) { + outdir = doc.$attr("outdir"); + stylesoutdir = doc.$normalize_system_path(doc.$attr("stylesdir"), outdir, (function() {if (doc.$safe()['$>='](($scope.SafeMode)._scope.SAFE)) { + return outdir + } else { + return nil + }; return nil; })()); + if (mkdirs !== false && mkdirs !== nil) { + $scope.Helpers.$mkdir_p(stylesoutdir)}; + if (copy_asciidoctor_stylesheet !== false && copy_asciidoctor_stylesheet !== nil) { + $scope.Stylesheets.$instance().$write_primary_stylesheet(stylesoutdir) + } else if (copy_user_stylesheet !== false && copy_user_stylesheet !== nil) { + if ((($a = ((stylesheet_src = (doc.$attr("copycss"))))['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + stylesheet_src = doc.$normalize_system_path(stylesheet) + } else { + stylesheet_src = doc.$normalize_system_path(stylesheet_src) + }; + stylesheet_dst = doc.$normalize_system_path(stylesheet, stylesoutdir, ((function() {if (doc.$safe()['$>='](($scope.SafeMode)._scope.SAFE)) { + return outdir + } else { + return nil + }; return nil; })())); + if ((($a = ((($b = stylesheet_src['$=='](stylesheet_dst)) !== false && $b !== nil) ? $b : ((stylesheet_content = doc.$read_asset(stylesheet_src)))['$nil?']())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + ($a = ($b = (($c = $opal.Object._scope.File) == null ? $opal.cm('File') : $c)).$open, $a._p = (TMP_5 = function(f){var self = TMP_5._s || this; +if (f == null) f = nil; + return f.$write(stylesheet_content)}, TMP_5._s = self, TMP_5), $a).call($b, stylesheet_dst, "w") + };}; + if (copy_coderay_stylesheet !== false && copy_coderay_stylesheet !== nil) { + $scope.Stylesheets.$instance().$write_coderay_stylesheet(stylesoutdir) + } else if (copy_pygments_stylesheet !== false && copy_pygments_stylesheet !== nil) { + $scope.Stylesheets.$instance().$write_pygments_stylesheet(stylesoutdir, (doc.$attr("pygments-style")))};};}; + return doc; + } else { + return output + }; + }; + self._proto.$render = self._proto.$convert; + self._proto.$convert_file = function(filename, options) { + var $a, self = this; + + if (options == null) { + options = $hash2([], {}) + } + return self.$convert((($a = $opal.Object._scope.File) == null ? $opal.cm('File') : $a).$new(((($a = filename) !== false && $a !== nil) ? $a : "")), options); }; + return self._proto.$render_file = self._proto.$convert_file; + })(self.$singleton_class()); + + if ($scope.RUBY_ENGINE['$==']("opal")) { + ; + + ; + + ;}; })(self); + ; + ; + ; + ; + ; + ; + ; + ; + ; + if ((($a = $scope.RUBY_ENGINE_OPAL) !== nil && (!$a._isBoolean || $a == true))) { + }; + ; + ; + ; + ; + ; + ; + ; + ; + return true; })(Opal); diff --git a/data/opal.js b/data/opal.js index bea9716..a79f842 100644 --- a/data/opal.js +++ b/data/opal.js @@ -602,6 +602,24 @@ return block.apply(null, args); }; + // Finds the corresponding exception match in candidates. Each candidate can + // be a value, or an array of values. Returns null if not found. + Opal.$rescue = function(exception, candidates) { + for (var i = 0; i != candidates.length; i++) { + var candidate = candidates[i]; + if (candidate._isArray) { + var subresult; + if (subresult = Opal.$rescue(exception, candidate)) { + return subresult; + } + } + else if (candidate['$==='](exception)) { + return candidate; + } + } + return null; + }; + Opal.is_a = function(object, klass) { if (object.__meta__ === klass) { return true; @@ -614,6 +632,12 @@ return true; } + for (var i = 0, length = search.__inc__.length; i < length; i++) { + if (search.__inc__[i] == klass) { + return true; + } + } + search = search._super; } @@ -751,21 +775,42 @@ hash.map = assocs; hash.keys = keys; - if (arguments.length == 1 && arguments[0]._isArray) { - var args = arguments[0]; + if (arguments.length == 1) { + if (arguments[0]._isArray) { + var args = arguments[0]; - for (var i = 0, length = args.length; i < length; i++) { - var key = args[i][0], obj = args[i][1]; + for (var i = 0, length = args.length; i < length; i++) { + var pair = args[i]; - if (assocs[key] == null) { + if (pair.length !== 2) { + throw Opal.ArgumentError.$new("value not of length 2: " + pair.$inspect()); + } + + var key = pair[0], + obj = pair[1]; + + if (assocs[key] == null) { + keys.push(key); + } + + assocs[key] = obj; + } + } + else { + var obj = arguments[0]; + for (var key in obj) { + assocs[key] = obj[key]; keys.push(key); } - - assocs[key] = obj; } } else { - for (var i = 0, length = arguments.length; i < length; i++) { + var length = arguments.length; + if (length % 2 !== 0) { + throw Opal.ArgumentError.$new("odd number of arguments for Hash"); + } + + for (var i = 0; i < length; i++) { var key = arguments[i], obj = arguments[++i]; @@ -876,35 +921,77 @@ TypeError._super = Error; }).call(this); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; + return (function($base) { var self = $module($base, 'Opal'); var def = self._proto, $scope = self._scope; + + $opal.defs(self, '$type_error', function(object, type, method, coerced) { + var $a, $b, self = this; + + if (method == null) { + method = nil + } + if (coerced == null) { + coerced = nil + } + if ((($a = (($b = method !== false && method !== nil) ? coerced : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return $scope.TypeError.$new("can't convert " + (object.$class()) + " into " + (type) + " (" + (object.$class()) + "#" + (method) + " gives " + (coerced.$class())) + } else { + return $scope.TypeError.$new("no implicit conversion of " + (object.$class()) + " into " + (type)) + }; + }); + $opal.defs(self, '$coerce_to', function(object, type, method) { var $a, self = this; - if (($a = type['$==='](object)) !== false && $a !== nil) { + + if ((($a = type['$==='](object)) !== nil && (!$a._isBoolean || $a == true))) { return object}; - if (($a = object['$respond_to?'](method)) === false || $a === nil) { - self.$raise($scope.TypeError, "no implicit conversion of " + (object.$class()) + " into " + (type))}; + if ((($a = object['$respond_to?'](method)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise(self.$type_error(object, type)) + }; return object.$__send__(method); }); $opal.defs(self, '$coerce_to!', function(object, type, method) { var $a, self = this, coerced = nil; + + coerced = self.$coerce_to(object, type, method); + if ((($a = type['$==='](coerced)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; + return coerced; + }); + + $opal.defs(self, '$coerce_to?', function(object, type, method) { + var $a, self = this, coerced = nil; + + if ((($a = object['$respond_to?'](method)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return nil + }; coerced = self.$coerce_to(object, type, method); - if (($a = type['$==='](coerced)) === false || $a === nil) { - self.$raise($scope.TypeError, "can't convert " + (object.$class()) + " into " + (type) + " (" + (object.$class()) + "#" + (method) + " gives " + (coerced.$class()))}; + if ((($a = coerced['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + if ((($a = type['$==='](coerced)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise(self.$type_error(object, type, method, coerced)) + }; return coerced; }); $opal.defs(self, '$try_convert', function(object, type, method) { var $a, self = this; - if (($a = type['$==='](object)) !== false && $a !== nil) { + + if ((($a = type['$==='](object)) !== nil && (!$a._isBoolean || $a == true))) { return object}; - if (($a = object['$respond_to?'](method)) !== false && $a !== nil) { + if ((($a = object['$respond_to?'](method)) !== nil && (!$a._isBoolean || $a == true))) { return object.$__send__(method) } else { return nil @@ -913,32 +1000,16 @@ $opal.defs(self, '$compare', function(a, b) { var $a, self = this, compare = nil; + compare = a['$<=>'](b); - if (($a = compare === nil) !== false && $a !== nil) { + if ((($a = compare === nil) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "comparison of " + (a.$class().$name()) + " with " + (b.$class().$name()) + " failed")}; return compare; }); - $opal.defs(self, '$fits_fixnum!', function(value) { - var $a, self = this; - if (($a = value > 2147483648) !== false && $a !== nil) { - return self.$raise($scope.RangeError, "bignum too big to convert into `long'") - } else { - return nil - }; - }); - - $opal.defs(self, '$fits_array!', function(value) { - var $a, self = this; - if (($a = value >= 536870910) !== false && $a !== nil) { - return self.$raise($scope.ArgumentError, "argument too big") - } else { - return nil - }; - }); - $opal.defs(self, '$destructure', function(args) { var self = this; + if (args.length == 1) { return args[0]; @@ -951,19 +1022,52 @@ } }); + + $opal.defs(self, '$respond_to?', function(obj, method) { + var self = this; + + + if (obj == null || !obj._klass) { + return false; + } + + return obj['$respond_to?'](method); + }); + + $opal.defs(self, '$inspect', function(obj) { + var self = this; + + + if (obj === undefined) { + return "undefined"; + } + else if (obj === null) { + return "null"; + } + else if (!obj._klass) { + return obj.toString(); + } + else { + return obj.$inspect(); + } + + }); })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + return (function($base, $super) { function $Module(){}; var self = $Module = $klass($base, $super, 'Module', $Module); - var def = $Module._proto, $scope = $Module._scope, TMP_1, TMP_2, TMP_3, TMP_4; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4; + $opal.defs(self, '$new', TMP_1 = function() { var self = this, $iter = TMP_1._p, block = $iter || nil; + TMP_1._p = null; function AnonModule(){} @@ -990,13 +1094,15 @@ def['$==='] = function(object) { var $a, self = this; - if (($a = object == null) !== false && $a !== nil) { + + if ((($a = object == null) !== nil && (!$a._isBoolean || $a == true))) { return false}; return $opal.is_a(object, self); }; def['$<'] = function(other) { var self = this; + var working = self; @@ -1014,6 +1120,7 @@ def.$alias_method = function(newname, oldname) { var self = this; + self._proto['$' + newname] = self._proto['$' + oldname]; @@ -1026,6 +1133,7 @@ def.$alias_native = function(mid, jsid) { var self = this; + if (jsid == null) { jsid = mid } @@ -1034,6 +1142,7 @@ def.$ancestors = function() { var self = this; + var parent = self, result = []; @@ -1051,6 +1160,7 @@ def.$append_features = function(klass) { var self = this; + var module = self, included = klass.__inc__; @@ -1105,6 +1215,7 @@ def.$attr_accessor = function(names) { var $a, $b, self = this; + names = $slice.call(arguments, 0); ($a = self).$attr_reader.apply($a, [].concat(names)); return ($b = self).$attr_writer.apply($b, [].concat(names)); @@ -1112,6 +1223,7 @@ def.$attr_reader = function(names) { var self = this; + names = $slice.call(arguments, 0); var proto = self._proto, cls = self; @@ -1129,12 +1241,13 @@ } })(names[i]); } - ; + return nil; }; def.$attr_writer = function(names) { var self = this; + names = $slice.call(arguments, 0); var proto = self._proto, cls = self; @@ -1152,7 +1265,7 @@ } })(names[i]); } - ; + return nil; }; @@ -1160,16 +1273,20 @@ def.$constants = function() { var self = this; + return self._scope.constants; }; def['$const_defined?'] = function(name, inherit) { var $a, self = this; + if (inherit == null) { inherit = true } - if (($a = name['$=~'](/^[A-Z]\w*$/)) === false || $a === nil) { - self.$raise($scope.NameError, "wrong constant name " + (name))}; + if ((($a = name['$=~'](/^[A-Z]\w*$/)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.NameError, "wrong constant name " + (name)) + }; scopes = [self._scope]; if (inherit || self === Opal.Object) { @@ -1187,16 +1304,19 @@ } return false; - ; + }; def.$const_get = function(name, inherit) { var $a, self = this; + if (inherit == null) { inherit = true } - if (($a = name['$=~'](/^[A-Z]\w*$/)) === false || $a === nil) { - self.$raise($scope.NameError, "wrong constant name " + (name))}; + if ((($a = name['$=~'](/^[A-Z]\w*$/)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.NameError, "wrong constant name " + (name)) + }; var scopes = [self._scope]; if (inherit || self == Opal.Object) { @@ -1214,19 +1334,23 @@ } return self.$const_missing(name); - ; + }; def.$const_missing = function(const$) { var self = this, name = nil; + name = self._name; return self.$raise($scope.NameError, "uninitialized constant " + (name) + "::" + (const$)); }; def.$const_set = function(name, value) { var $a, self = this; - if (($a = name['$=~'](/^[A-Z]\w*$/)) === false || $a === nil) { - self.$raise($scope.NameError, "wrong constant name " + (name))}; + + if ((($a = name['$=~'](/^[A-Z]\w*$/)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.NameError, "wrong constant name " + (name)) + }; try { name = name.$to_str() } catch ($err) {if (true) { @@ -1241,6 +1365,7 @@ def.$define_method = TMP_2 = function(name, method) { var self = this, $iter = TMP_2._p, block = $iter || nil; + TMP_2._p = null; if (method) { @@ -1259,12 +1384,13 @@ self._proto[jsid] = block; $opal.donate(self, [jsid]); - return null; + return name; ; }; def.$remove_method = function(name) { var self = this; + var jsid = '$' + name; var current = self._proto[jsid]; @@ -1278,12 +1404,11 @@ def.$include = function(mods) { var self = this; + mods = $slice.call(arguments, 0); - var i = mods.length - 1, mod; - while (i >= 0) { - mod = mods[i]; - i--; + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; if (mod === self) { continue; @@ -1292,13 +1417,29 @@ (mod).$append_features(self); (mod).$included(self); } - + return self; + }; + + def['$include?'] = function(mod) { + var self = this; + + + for (var cls = self; cls; cls = cls.parent) { + for (var i = 0; i != cls.__inc__.length; i++) { + var mod2 = cls.__inc__[i]; + if (mod === mod2) { + return true; + } + } + } + return false; }; def.$instance_method = function(name) { var self = this; + var meth = self._proto['$' + name]; @@ -1312,6 +1453,7 @@ def.$instance_methods = function(include_super) { var self = this; + if (include_super == null) { include_super = false } @@ -1333,27 +1475,36 @@ } return methods; - ; + }; def.$included = function(mod) { var self = this; + + return nil; + }; + + def.$extended = function(mod) { + var self = this; + return nil; }; def.$module_eval = TMP_3 = function() { var self = this, $iter = TMP_3._p, block = $iter || nil; + TMP_3._p = null; + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "no block given") + }; - if (block === nil) { - throw new Error("no block given"); - } - - var block_self = block._s, result; + var old = block._s, + result; block._s = null; result = block.call(self); - block._s = block_self; + block._s = old; return result; @@ -1363,6 +1514,7 @@ def.$module_exec = TMP_4 = function() { var self = this, $iter = TMP_4._p, block = $iter || nil; + TMP_4._p = null; if (block === nil) { @@ -1383,14 +1535,16 @@ def['$method_defined?'] = function(method) { var self = this; + var body = self._proto['$' + method]; return (!!body) && !body.rb_stub; - ; + }; def.$module_function = function(methods) { var self = this; + methods = $slice.call(arguments, 0); for (var i = 0, length = methods.length; i < length; i++) { @@ -1405,6 +1559,7 @@ def.$name = function() { var self = this; + if (self._full_name) { return self._full_name; @@ -1436,11 +1591,13 @@ def.$public = function() { var self = this; + return nil; }; def.$private_class_method = function(name) { var self = this; + return self['$' + name] || nil; }; @@ -1450,9 +1607,16 @@ def['$private_method_defined?'] = function(obj) { var self = this; + return false; }; + def.$private_constant = function() { + var self = this; + + return nil; + }; + $opal.defn(self, '$protected_method_defined?', def['$private_method_defined?']); $opal.defn(self, '$public_instance_methods', def.$instance_methods); @@ -1461,40 +1625,48 @@ def.$remove_class_variable = function() { var self = this; + return nil; }; def.$remove_const = function(name) { var self = this; + var old = self._scope[name]; delete self._scope[name]; return old; - ; + }; def.$to_s = function() { var self = this; + return self.$name().$to_s(); }; return (def.$undef_method = function(symbol) { var self = this; + $opal.add_stub_for(self._proto, "$" + symbol); return self; - }, nil); + }, nil) && 'undef_method'; })(self, null) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + ; return (function($base, $super) { function $Class(){}; var self = $Class = $klass($base, $super, 'Class', $Class); - var def = $Class._proto, $scope = $Class._scope, TMP_1, TMP_2; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2; + $opal.defs(self, '$new', TMP_1 = function(sup) { var self = this, $iter = TMP_1._p, block = $iter || nil; + if (sup == null) { sup = $scope.Object } @@ -1527,6 +1699,7 @@ def.$allocate = function() { var self = this; + var obj = new self._alloc; obj._id = Opal.uid(); @@ -1536,11 +1709,13 @@ def.$inherited = function(cls) { var self = this; + return nil; }; def.$new = TMP_2 = function(args) { var self = this, $iter = TMP_2._p, block = $iter || nil; + args = $slice.call(arguments, 0); TMP_2._p = null; @@ -1554,35 +1729,42 @@ return (def.$superclass = function() { var self = this; + return self._super || nil; - }, nil); - })(self, null) + }, nil) && 'superclass'; + })(self, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + return (function($base, $super) { function $BasicObject(){}; var self = $BasicObject = $klass($base, $super, 'BasicObject', $BasicObject); - var def = $BasicObject._proto, $scope = $BasicObject._scope, TMP_1, TMP_2, TMP_3, TMP_4; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4; + $opal.defn(self, '$initialize', function() { var self = this; + return nil; }); $opal.defn(self, '$==', function(other) { var self = this; + return self === other; }); $opal.defn(self, '$__id__', function() { var self = this; + return self._id || (self._id = Opal.uid()); }); $opal.defn(self, '$__send__', TMP_1 = function(symbol, args) { var self = this, $iter = TMP_1._p, block = $iter || nil; + args = $slice.call(arguments, 1); TMP_1._p = null; @@ -1604,33 +1786,45 @@ }); + $opal.defn(self, '$!', function() { + var self = this; + + return false; + }); + $opal.defn(self, '$eql?', def['$==']); $opal.defn(self, '$equal?', def['$==']); $opal.defn(self, '$instance_eval', TMP_2 = function() { - var $a, self = this, $iter = TMP_2._p, block = $iter || nil; + var self = this, $iter = TMP_2._p, block = $iter || nil; + TMP_2._p = null; - if (($a = block) === false || $a === nil) { - $scope.Kernel.$raise($scope.ArgumentError, "no block given")}; + if (block !== false && block !== nil) { + } else { + $scope.Kernel.$raise($scope.ArgumentError, "no block given") + }; - var block_self = block._s, + var old = block._s, result; block._s = null; result = block.call(self, self); - block._s = block_self; + block._s = old; return result; }); $opal.defn(self, '$instance_exec', TMP_3 = function(args) { - var $a, self = this, $iter = TMP_3._p, block = $iter || nil; + var self = this, $iter = TMP_3._p, block = $iter || nil; + args = $slice.call(arguments, 0); TMP_3._p = null; - if (($a = block) === false || $a === nil) { - $scope.Kernel.$raise($scope.ArgumentError, "no block given")}; + if (block !== false && block !== nil) { + } else { + $scope.Kernel.$raise($scope.ArgumentError, "no block given") + }; var block_self = block._s, result; @@ -1645,21 +1839,25 @@ return ($opal.defn(self, '$method_missing', TMP_4 = function(symbol, args) { var self = this, $iter = TMP_4._p, block = $iter || nil; + args = $slice.call(arguments, 1); TMP_4._p = null; return $scope.Kernel.$raise($scope.NoMethodError, "undefined method `" + (symbol) + "' for BasicObject instance"); - }), nil); + }), nil) && 'method_missing'; })(self, null) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $gvars = $opal.gvars; + return (function($base) { var self = $module($base, 'Kernel'); var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_9; + def.$method_missing = TMP_1 = function(symbol, args) { var self = this, $iter = TMP_1._p, block = $iter || nil; + args = $slice.call(arguments, 1); TMP_1._p = null; return self.$raise($scope.NoMethodError, "undefined method `" + (symbol) + "' for " + (self.$inspect())); @@ -1667,16 +1865,19 @@ def['$=~'] = function(obj) { var self = this; + return false; }; def['$==='] = function(other) { var self = this; + return self['$=='](other); }; def['$<=>'] = function(other) { var self = this; + if (self['$=='](other)) { return 0; @@ -1688,6 +1889,7 @@ def.$method = function(name) { var self = this; + var meth = self['$' + name]; @@ -1701,6 +1903,7 @@ def.$methods = function(all) { var self = this; + if (all == null) { all = true } @@ -1714,8 +1917,9 @@ continue; } } - - methods.push(key.substr(1)); + if (self[key].rb_stub === undefined) { + methods.push(key.substr(1)); + } } } @@ -1725,6 +1929,7 @@ def.$Array = TMP_2 = function(object, args) { var self = this, $iter = TMP_2._p, block = $iter || nil; + args = $slice.call(arguments, 1); TMP_2._p = null; @@ -1745,16 +1950,19 @@ def.$caller = function() { var self = this; + return []; }; def.$class = function() { var self = this; + return self._klass; }; def.$copy_instance_variables = function(other) { var self = this; + for (var name in other) { if (name.charAt(0) !== '$') { @@ -1768,6 +1976,7 @@ def.$clone = function() { var self = this, copy = nil; + copy = self.$class().$allocate(); copy.$copy_instance_variables(self); copy.$initialize_clone(self); @@ -1776,16 +1985,18 @@ def.$initialize_clone = function(other) { var self = this; + return self.$initialize_copy(other); }; - self.$private("initialize_clone"); - def.$define_singleton_method = TMP_3 = function(name) { - var $a, self = this, $iter = TMP_3._p, body = $iter || nil; + var self = this, $iter = TMP_3._p, body = $iter || nil; + TMP_3._p = null; - if (($a = body) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to create Proc object without a block")}; + if (body !== false && body !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to create Proc object without a block") + }; var jsid = '$' + name; body._jsid = name; @@ -1800,6 +2011,7 @@ def.$dup = function() { var self = this, copy = nil; + copy = self.$class().$allocate(); copy.$copy_instance_variables(self); copy.$initialize_dup(self); @@ -1808,13 +2020,13 @@ def.$initialize_dup = function(other) { var self = this; + return self.$initialize_copy(other); }; - self.$private("initialize_dup"); - def.$enum_for = TMP_4 = function(method, args) { var $a, $b, self = this, $iter = TMP_4._p, block = $iter || nil; + args = $slice.call(arguments, 1); if (method == null) { method = "each" @@ -1823,25 +2035,34 @@ return ($a = ($b = $scope.Enumerator).$for, $a._p = block.$to_proc(), $a).apply($b, [self, method].concat(args)); }; + $opal.defn(self, '$to_enum', def.$enum_for); + def['$equal?'] = function(other) { var self = this; + return self === other; }; def.$extend = function(mods) { var self = this; + mods = $slice.call(arguments, 0); - for (var i = 0, length = mods.length; i < length; i++) { - self.$singleton_class().$include(mods[i]); - } + var singleton = self.$singleton_class(); + for (var i = mods.length - 1; i >= 0; i--) { + var mod = mods[i]; + + (mod).$append_features(singleton); + (mod).$extended(self); + } + ; return self; - }; def.$format = function(format, args) { var self = this; + args = $slice.call(arguments, 1); var idx = 0; @@ -1973,31 +2194,37 @@ def.$hash = function() { var self = this; + return self._id; }; def.$initialize_copy = function(other) { var self = this; + return nil; }; def.$inspect = function() { var self = this; + return self.$to_s(); }; def['$instance_of?'] = function(klass) { var self = this; + return self._klass === klass; }; def['$instance_variable_defined?'] = function(name) { var self = this; - return self.hasOwnProperty(name.substr(1)); + + return $opal.hasOwnProperty.call(self, name.substr(1)); }; def.$instance_variable_get = function(name) { var self = this; + var ivar = self[name.substr(1)]; @@ -2007,11 +2234,13 @@ def.$instance_variable_set = function(name, value) { var self = this; + return self[name.substr(1)] = value; }; def.$instance_variables = function() { var self = this; + var result = []; @@ -2029,20 +2258,21 @@ def.$Integer = function(value, base) { var $a, $b, self = this, $case = nil; + if (base == null) { base = nil } - if (($a = $scope.String['$==='](value)) !== false && $a !== nil) { - if (($a = value['$empty?']()) !== false && $a !== nil) { + if ((($a = $scope.String['$==='](value)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = value['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "invalid value for Integer: (empty string)")}; return parseInt(value, ((($a = base) !== false && $a !== nil) ? $a : undefined));}; if (base !== false && base !== nil) { self.$raise(self.$ArgumentError("base is only valid for String values"))}; - return (function() {$case = value;if ($scope.Integer['$===']($case)) {return value}else if ($scope.Float['$===']($case)) {if (($a = ((($b = value['$nan?']()) !== false && $b !== nil) ? $b : value['$infinite?']())) !== false && $a !== nil) { + return (function() {$case = value;if ($scope.Integer['$===']($case)) {return value}else if ($scope.Float['$===']($case)) {if ((($a = ((($b = value['$nan?']()) !== false && $b !== nil) ? $b : value['$infinite?']())) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.FloatDomainError, "unable to coerce " + (value) + " to Integer")}; - return value.$to_int();}else if ($scope.NilClass['$===']($case)) {return self.$raise($scope.TypeError, "can't convert nil into Integer")}else {if (($a = value['$respond_to?']("to_int")) !== false && $a !== nil) { + return value.$to_int();}else if ($scope.NilClass['$===']($case)) {return self.$raise($scope.TypeError, "can't convert nil into Integer")}else {if ((($a = value['$respond_to?']("to_int")) !== nil && (!$a._isBoolean || $a == true))) { return value.$to_int() - } else if (($a = value['$respond_to?']("to_i")) !== false && $a !== nil) { + } else if ((($a = value['$respond_to?']("to_i")) !== nil && (!$a._isBoolean || $a == true))) { return value.$to_i() } else { return self.$raise($scope.TypeError, "can't convert " + (value.$class()) + " into Integer") @@ -2051,9 +2281,10 @@ def.$Float = function(value) { var $a, self = this; - if (($a = $scope.String['$==='](value)) !== false && $a !== nil) { + + if ((($a = $scope.String['$==='](value)) !== nil && (!$a._isBoolean || $a == true))) { return parseFloat(value); - } else if (($a = value['$respond_to?']("to_f")) !== false && $a !== nil) { + } else if ((($a = value['$respond_to?']("to_f")) !== nil && (!$a._isBoolean || $a == true))) { return value.$to_f() } else { return self.$raise($scope.TypeError, "can't convert " + (value.$class()) + " into Float") @@ -2062,6 +2293,7 @@ def['$is_a?'] = function(klass) { var self = this; + return $opal.is_a(self, klass); }; @@ -2069,6 +2301,7 @@ def.$lambda = TMP_5 = function() { var self = this, $iter = TMP_5._p, block = $iter || nil; + TMP_5._p = null; block.is_lambda = true; return block; @@ -2076,6 +2309,7 @@ def.$loop = TMP_6 = function() { var self = this, $iter = TMP_6._p, block = $iter || nil; + TMP_6._p = null; while (true) { @@ -2089,6 +2323,7 @@ def['$nil?'] = function() { var self = this; + return false; }; @@ -2096,6 +2331,7 @@ def.$printf = function(args) { var $a, self = this; + args = $slice.call(arguments, 0); if (args.$length()['$>'](0)) { self.$print(($a = self).$format.apply($a, [].concat(args)))}; @@ -2104,29 +2340,38 @@ def.$private_methods = function() { var self = this; + return []; }; def.$proc = TMP_7 = function() { - var $a, self = this, $iter = TMP_7._p, block = $iter || nil; + var self = this, $iter = TMP_7._p, block = $iter || nil; + TMP_7._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to create Proc object without a block")}; + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to create Proc object without a block") + }; block.is_lambda = false; return block; }; def.$puts = function(strs) { var $a, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + strs = $slice.call(arguments, 0); - return ($a = $gvars["stdout"]).$puts.apply($a, [].concat(strs)); + return ($a = $gvars.stdout).$puts.apply($a, [].concat(strs)); }; def.$p = function(args) { var $a, $b, TMP_8, self = this; + args = $slice.call(arguments, 0); - ($a = ($b = args).$each, $a._p = (TMP_8 = function(obj){var self = TMP_8._s || this;if (obj == null) obj = nil; - return $gvars["stdout"].$puts(obj.$inspect())}, TMP_8._s = self, TMP_8), $a).call($b); + ($a = ($b = args).$each, $a._p = (TMP_8 = function(obj){var self = TMP_8._s || this; + if ($gvars.stdout == null) $gvars.stdout = nil; +if (obj == null) obj = nil; + return $gvars.stdout.$puts(obj.$inspect())}, TMP_8._s = self, TMP_8), $a).call($b); if (args.$length()['$<='](1)) { return args['$[]'](0) } else { @@ -2134,18 +2379,31 @@ }; }; - $opal.defn(self, '$print', def.$puts); + def.$print = function(strs) { + var $a, self = this; + if ($gvars.stdout == null) $gvars.stdout = nil; + + strs = $slice.call(arguments, 0); + return ($a = $gvars.stdout).$print.apply($a, [].concat(strs)); + }; def.$warn = function(strs) { var $a, $b, self = this; + if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + strs = $slice.call(arguments, 0); - if (($a = ((($b = $gvars["VERBOSE"]['$nil?']()) !== false && $b !== nil) ? $b : strs['$empty?']())) === false || $a === nil) { - ($a = $gvars["stderr"]).$puts.apply($a, [].concat(strs))}; + if ((($a = ((($b = $gvars.VERBOSE['$nil?']()) !== false && $b !== nil) ? $b : strs['$empty?']())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + ($a = $gvars.stderr).$puts.apply($a, [].concat(strs)) + }; return nil; }; def.$raise = function(exception, string) { var self = this; + if ($gvars["!"] == null) $gvars["!"] = nil; + if (exception == null && $gvars["!"]) { exception = $gvars["!"]; @@ -2157,6 +2415,7 @@ exception = exception.$new(string); } + $gvars["!"] = exception; throw exception; ; }; @@ -2165,6 +2424,7 @@ def.$rand = function(max) { var self = this; + if (max === undefined) { return Math.random(); @@ -2184,14 +2444,21 @@ $opal.defn(self, '$srand', def.$rand); def['$respond_to?'] = function(name, include_all) { - var self = this; + var $a, self = this; + if (include_all == null) { include_all = false } + if ((($a = self['$respond_to_missing?'](name)) !== nil && (!$a._isBoolean || $a == true))) { + return true}; var body = self['$' + name]; - return (!!body) && !body.rb_stub; + + if (typeof(body) === "function" && !body.rb_stub) { + return true; + } + return false; }; $opal.defn(self, '$send', def.$__send__); @@ -2200,6 +2467,7 @@ def.$singleton_class = function() { var self = this; + if (self._isClass) { if (self.__meta__) { @@ -2252,11 +2520,13 @@ def.$String = function(str) { var self = this; + return String(str); }; def.$tap = TMP_9 = function() { var self = this, $iter = TMP_9._p, block = $iter || nil; + TMP_9._p = null; if ($opal.$yield1(block, self) === $breaker) return $breaker.$v; return self; @@ -2264,16 +2534,19 @@ def.$to_proc = function() { var self = this; + return self; }; def.$to_s = function() { var self = this; + return "#<" + self.$class().$name() + ":" + self._id + ">"; }; def.$freeze = function() { var self = this; + self.___frozen___ = true; return self; }; @@ -2287,71 +2560,91 @@ def['$respond_to_missing?'] = function(method_name) { var self = this; + return false; }; - ;$opal.donate(self, ["$method_missing", "$=~", "$===", "$<=>", "$method", "$methods", "$Array", "$caller", "$class", "$copy_instance_variables", "$clone", "$initialize_clone", "$define_singleton_method", "$dup", "$initialize_dup", "$enum_for", "$equal?", "$extend", "$format", "$hash", "$initialize_copy", "$inspect", "$instance_of?", "$instance_variable_defined?", "$instance_variable_get", "$instance_variable_set", "$instance_variables", "$Integer", "$Float", "$is_a?", "$kind_of?", "$lambda", "$loop", "$nil?", "$object_id", "$printf", "$private_methods", "$proc", "$puts", "$p", "$print", "$warn", "$raise", "$fail", "$rand", "$srand", "$respond_to?", "$send", "$public_send", "$singleton_class", "$sprintf", "$String", "$tap", "$to_proc", "$to_s", "$freeze", "$frozen?", "$respond_to_missing?"]); + ;$opal.donate(self, ["$method_missing", "$=~", "$===", "$<=>", "$method", "$methods", "$Array", "$caller", "$class", "$copy_instance_variables", "$clone", "$initialize_clone", "$define_singleton_method", "$dup", "$initialize_dup", "$enum_for", "$to_enum", "$equal?", "$extend", "$format", "$hash", "$initialize_copy", "$inspect", "$instance_of?", "$instance_variable_defined?", "$instance_variable_get", "$instance_variable_set", "$instance_variables", "$Integer", "$Float", "$is_a?", "$kind_of?", "$lambda", "$loop", "$nil?", "$object_id", "$printf", "$private_methods", "$proc", "$puts", "$p", "$print", "$warn", "$raise", "$fail", "$rand", "$srand", "$respond_to?", "$send", "$public_send", "$singleton_class", "$sprintf", "$String", "$tap", "$to_proc", "$to_s", "$freeze", "$frozen?", "$respond_to_missing?"]); })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + (function($base, $super) { function $NilClass(){}; var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); - var def = $NilClass._proto, $scope = $NilClass._scope; + var def = self._proto, $scope = self._scope; + + def['$!'] = function() { + var self = this; + + return true; + }; + def['$&'] = function(other) { var self = this; + return false; }; def['$|'] = function(other) { var self = this; + return other !== false && other !== nil; }; def['$^'] = function(other) { var self = this; + return other !== false && other !== nil; }; def['$=='] = function(other) { var self = this; + return other === nil; }; def.$dup = function() { var self = this; + return self.$raise($scope.TypeError); }; def.$inspect = function() { var self = this; + return "nil"; }; def['$nil?'] = function() { var self = this; + return true; }; def.$singleton_class = function() { var self = this; + return $scope.NilClass; }; def.$to_a = function() { var self = this; + return []; }; def.$to_h = function() { var self = this; + return $opal.hash(); }; def.$to_i = function() { var self = this; + return 0; }; @@ -2359,11 +2652,13 @@ def.$to_s = function() { var self = this; + return ""; }; def.$object_id = function() { var self = this; + return $scope.NilClass._id || ($scope.NilClass._id = $opal.uid()); }; @@ -2371,38 +2666,51 @@ })(self, null); return $opal.cdecl($scope, 'NIL', nil); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + (function($base, $super) { function $Boolean(){}; var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); - var def = $Boolean._proto, $scope = $Boolean._scope; + var def = self._proto, $scope = self._scope; + def._isBoolean = true; (function(self) { var $scope = self._scope, def = self._proto; + return self.$undef_method("new") })(self.$singleton_class()); + def['$!'] = function() { + var self = this; + + return self != true; + }; + def['$&'] = function(other) { var self = this; + return (self == true) ? (other !== false && other !== nil) : false; }; def['$|'] = function(other) { var self = this; + return (self == true) ? true : (other !== false && other !== nil); }; def['$^'] = function(other) { var self = this; + return (self == true) ? (other === false || other === nil) : (other !== false && other !== nil); }; def['$=='] = function(other) { var self = this; + return (self == true) === other.valueOf(); }; @@ -2412,27 +2720,31 @@ return (def.$to_s = function() { var self = this; + return (self == true) ? 'true' : 'false'; - }, nil); + }, nil) && 'to_s'; })(self, null); $opal.cdecl($scope, 'TrueClass', $scope.Boolean); $opal.cdecl($scope, 'FalseClass', $scope.Boolean); $opal.cdecl($scope, 'TRUE', true); return $opal.cdecl($scope, 'FALSE', false); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $module = $opal.module; + (function($base, $super) { function $Exception(){}; var self = $Exception = $klass($base, $super, 'Exception', $Exception); - var def = $Exception._proto, $scope = $Exception._scope; + var def = self._proto, $scope = self._scope; + def.message = nil; self.$attr_reader("message"); $opal.defs(self, '$new', function(message) { var self = this; + if (message == null) { message = "" } @@ -2446,6 +2758,7 @@ def.$backtrace = function() { var self = this; + var backtrace = self.stack; @@ -2462,198 +2775,251 @@ def.$inspect = function() { var self = this; + return "#<" + (self.$class().$name()) + ": '" + (self.message) + "'>"; }; return $opal.defn(self, '$to_s', def.$message); })(self, null); (function($base, $super) { - function $StandardError(){}; - var self = $StandardError = $klass($base, $super, 'StandardError', $StandardError); + function $ScriptError(){}; + var self = $ScriptError = $klass($base, $super, 'ScriptError', $ScriptError); + + var def = self._proto, $scope = self._scope; - var def = $StandardError._proto, $scope = $StandardError._scope; return nil; })(self, $scope.Exception); (function($base, $super) { - function $SystemCallError(){}; - var self = $SystemCallError = $klass($base, $super, 'SystemCallError', $SystemCallError); + function $SyntaxError(){}; + var self = $SyntaxError = $klass($base, $super, 'SyntaxError', $SyntaxError); + + var def = self._proto, $scope = self._scope; - var def = $SystemCallError._proto, $scope = $SystemCallError._scope; return nil; - })(self, $scope.StandardError); + })(self, $scope.ScriptError); + (function($base, $super) { + function $LoadError(){}; + var self = $LoadError = $klass($base, $super, 'LoadError', $LoadError); + + var def = self._proto, $scope = self._scope; + + return nil; + })(self, $scope.ScriptError); + (function($base, $super) { + function $NotImplementedError(){}; + var self = $NotImplementedError = $klass($base, $super, 'NotImplementedError', $NotImplementedError); + + var def = self._proto, $scope = self._scope; + + return nil; + })(self, $scope.ScriptError); + (function($base, $super) { + function $SystemExit(){}; + var self = $SystemExit = $klass($base, $super, 'SystemExit', $SystemExit); + + var def = self._proto, $scope = self._scope; + + return nil; + })(self, $scope.Exception); + (function($base, $super) { + function $StandardError(){}; + var self = $StandardError = $klass($base, $super, 'StandardError', $StandardError); + + var def = self._proto, $scope = self._scope; + + return nil; + })(self, $scope.Exception); (function($base, $super) { function $NameError(){}; var self = $NameError = $klass($base, $super, 'NameError', $NameError); - var def = $NameError._proto, $scope = $NameError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.StandardError); (function($base, $super) { function $NoMethodError(){}; var self = $NoMethodError = $klass($base, $super, 'NoMethodError', $NoMethodError); - var def = $NoMethodError._proto, $scope = $NoMethodError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.NameError); (function($base, $super) { function $RuntimeError(){}; var self = $RuntimeError = $klass($base, $super, 'RuntimeError', $RuntimeError); - var def = $RuntimeError._proto, $scope = $RuntimeError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.StandardError); (function($base, $super) { function $LocalJumpError(){}; var self = $LocalJumpError = $klass($base, $super, 'LocalJumpError', $LocalJumpError); - var def = $LocalJumpError._proto, $scope = $LocalJumpError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.StandardError); (function($base, $super) { function $TypeError(){}; var self = $TypeError = $klass($base, $super, 'TypeError', $TypeError); - var def = $TypeError._proto, $scope = $TypeError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.StandardError); (function($base, $super) { function $ArgumentError(){}; var self = $ArgumentError = $klass($base, $super, 'ArgumentError', $ArgumentError); - var def = $ArgumentError._proto, $scope = $ArgumentError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.StandardError); (function($base, $super) { function $IndexError(){}; var self = $IndexError = $klass($base, $super, 'IndexError', $IndexError); - var def = $IndexError._proto, $scope = $IndexError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.StandardError); (function($base, $super) { function $StopIteration(){}; var self = $StopIteration = $klass($base, $super, 'StopIteration', $StopIteration); - var def = $StopIteration._proto, $scope = $StopIteration._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.IndexError); (function($base, $super) { function $KeyError(){}; var self = $KeyError = $klass($base, $super, 'KeyError', $KeyError); - var def = $KeyError._proto, $scope = $KeyError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.IndexError); (function($base, $super) { function $RangeError(){}; var self = $RangeError = $klass($base, $super, 'RangeError', $RangeError); - var def = $RangeError._proto, $scope = $RangeError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.StandardError); (function($base, $super) { function $FloatDomainError(){}; var self = $FloatDomainError = $klass($base, $super, 'FloatDomainError', $FloatDomainError); - var def = $FloatDomainError._proto, $scope = $FloatDomainError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.RangeError); (function($base, $super) { function $IOError(){}; var self = $IOError = $klass($base, $super, 'IOError', $IOError); - var def = $IOError._proto, $scope = $IOError._scope; - return nil; - })(self, $scope.StandardError); - (function($base, $super) { - function $ScriptError(){}; - var self = $ScriptError = $klass($base, $super, 'ScriptError', $ScriptError); - - var def = $ScriptError._proto, $scope = $ScriptError._scope; - return nil; - })(self, $scope.Exception); - (function($base, $super) { - function $SyntaxError(){}; - var self = $SyntaxError = $klass($base, $super, 'SyntaxError', $SyntaxError); + var def = self._proto, $scope = self._scope; - var def = $SyntaxError._proto, $scope = $SyntaxError._scope; return nil; - })(self, $scope.ScriptError); + })(self, $scope.StandardError); (function($base, $super) { - function $NotImplementedError(){}; - var self = $NotImplementedError = $klass($base, $super, 'NotImplementedError', $NotImplementedError); + function $SystemCallError(){}; + var self = $SystemCallError = $klass($base, $super, 'SystemCallError', $SystemCallError); - var def = $NotImplementedError._proto, $scope = $NotImplementedError._scope; - return nil; - })(self, $scope.ScriptError); - (function($base, $super) { - function $SystemExit(){}; - var self = $SystemExit = $klass($base, $super, 'SystemExit', $SystemExit); + var def = self._proto, $scope = self._scope; - var def = $SystemExit._proto, $scope = $SystemExit._scope; return nil; - })(self, $scope.Exception); + })(self, $scope.StandardError); return (function($base) { var self = $module($base, 'Errno'); var def = self._proto, $scope = self._scope; + (function($base, $super) { function $EINVAL(){}; var self = $EINVAL = $klass($base, $super, 'EINVAL', $EINVAL); - var def = $EINVAL._proto, $scope = $EINVAL._scope, TMP_1; + var def = self._proto, $scope = self._scope, TMP_1; + return ($opal.defs(self, '$new', TMP_1 = function() { var self = this, $iter = TMP_1._p, $yield = $iter || nil; + TMP_1._p = null; return $opal.find_super_dispatcher(self, 'new', TMP_1, null, $EINVAL).apply(self, ["Invalid argument"]); - }), nil) + }), nil) && 'new' })(self, $scope.SystemCallError) })(self); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $gvars = $opal.gvars; + return (function($base, $super) { function $Regexp(){}; var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); - var def = $Regexp._proto, $scope = $Regexp._scope; + var def = self._proto, $scope = self._scope, TMP_1; + def._isRegexp = true; - $opal.defs(self, '$escape', function(string) { - var self = this; - return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\^\$\| ]/g, '\\$&'); - }); + (function(self) { + var $scope = self._scope, def = self._proto; - $opal.defs(self, '$union', function(parts) { - var self = this; - parts = $slice.call(arguments, 0); - return new RegExp(parts.join('')); - }); + self._proto.$escape = function(string) { + var self = this; - $opal.defs(self, '$new', function(regexp, options) { - var self = this; - return new RegExp(regexp, options); - }); + + return string.replace(/([-[\]/{}()*+?.^$\\| ])/g, '\\$1') + .replace(/[\n]/g, '\\n') + .replace(/[\r]/g, '\\r') + .replace(/[\f]/g, '\\f') + .replace(/[\t]/g, '\\t'); + + }; + self._proto.$quote = self._proto.$escape; + self._proto.$union = function(parts) { + var self = this; + + parts = $slice.call(arguments, 0); + return new RegExp(parts.join('')); + }; + return (self._proto.$new = function(regexp, options) { + var self = this; + + return new RegExp(regexp, options); + }, nil) && 'new'; + })(self.$singleton_class()); def['$=='] = function(other) { var self = this; + return other.constructor == RegExp && self.toString() === other.toString(); }; def['$==='] = function(str) { - var $a, $b, self = this; - if (($a = ($b = str._isString == null, $b !== false && $b !== nil ?str['$respond_to?']("to_str") : $b)) !== false && $a !== nil) { - str = str.$to_str()}; - if (($a = str._isString == null) !== false && $a !== nil) { - return false}; + var self = this; + + + if (!str._isString && str['$respond_to?']("to_str")) { + str = str.$to_str(); + } + + if (!str._isString) { + return false; + } + return self.test(str); + ; }; def['$=~'] = function(string) { var $a, self = this; - if (($a = string === nil) !== false && $a !== nil) { + + if ((($a = string === nil) !== nil && (!$a._isBoolean || $a == true))) { $gvars["~"] = $gvars["`"] = $gvars["'"] = nil; return nil;}; string = $scope.Opal.$coerce_to(string, $scope.String, "to_str").$to_s(); @@ -2686,17 +3052,22 @@ def.$inspect = function() { var self = this; + return self.toString(); }; - def.$match = function(string, pos) { - var $a, self = this; - if (($a = string === nil) !== false && $a !== nil) { + def.$match = TMP_1 = function(string, pos) { + var $a, self = this, $iter = TMP_1._p, block = $iter || nil; + + TMP_1._p = null; + if ((($a = string === nil) !== nil && (!$a._isBoolean || $a == true))) { $gvars["~"] = $gvars["`"] = $gvars["'"] = nil; return nil;}; - if (($a = string._isString == null) !== false && $a !== nil) { - if (($a = string['$respond_to?']("to_str")) === false || $a === nil) { - self.$raise($scope.TypeError, "no implicit conversion of " + (string.$class()) + " into String")}; + if ((($a = string._isString == null) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = string['$respond_to?']("to_str")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "no implicit conversion of " + (string.$class()) + " into String") + }; string = string.$to_str();}; var re = self; @@ -2712,7 +3083,14 @@ var result = re.exec(string); if (result) { - return $gvars["~"] = $scope.MatchData.$new(re, result); + result = $gvars["~"] = $scope.MatchData.$new(re, result); + + if (block === nil) { + return result; + } + else { + return block.$call(result); + } } else { return $gvars["~"] = $gvars["`"] = $gvars["'"] = nil; @@ -2722,22 +3100,26 @@ def.$source = function() { var self = this; + return self.source; }; return $opal.defn(self, '$to_s', def.$source); })(self, null) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; + return (function($base) { var self = $module($base, 'Comparable'); var def = self._proto, $scope = self._scope; + $opal.defs(self, '$normalize', function(what) { var $a, self = this; - if (($a = $scope.Integer['$==='](what)) !== false && $a !== nil) { + + if ((($a = $scope.Integer['$==='](what)) !== nil && (!$a._isBoolean || $a == true))) { return what}; if (what['$>'](0)) { return 1}; @@ -2748,13 +3130,16 @@ def['$=='] = function(other) { var $a, self = this, cmp = nil; + try { - if (($a = self['$equal?'](other)) !== false && $a !== nil) { + if ((($a = self['$equal?'](other)) !== nil && (!$a._isBoolean || $a == true))) { return true}; - if (($a = cmp = (self['$<=>'](other))) === false || $a === nil) { - return false}; + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; return $scope.Comparable.$normalize(cmp)['$=='](0); - } catch ($err) {if ($scope.StandardError['$===']($err)) { + } catch ($err) {if ($opal.$rescue($err, [$scope.StandardError])) { return false }else { throw $err; } }; @@ -2762,34 +3147,47 @@ def['$>'] = function(other) { var $a, self = this, cmp = nil; - if (($a = cmp = (self['$<=>'](other))) === false || $a === nil) { - self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")}; + + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; return $scope.Comparable.$normalize(cmp)['$>'](0); }; def['$>='] = function(other) { var $a, self = this, cmp = nil; - if (($a = cmp = (self['$<=>'](other))) === false || $a === nil) { - self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")}; + + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; return $scope.Comparable.$normalize(cmp)['$>='](0); }; def['$<'] = function(other) { var $a, self = this, cmp = nil; - if (($a = cmp = (self['$<=>'](other))) === false || $a === nil) { - self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")}; + + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; return $scope.Comparable.$normalize(cmp)['$<'](0); }; def['$<='] = function(other) { var $a, self = this, cmp = nil; - if (($a = cmp = (self['$<=>'](other))) === false || $a === nil) { - self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")}; + + if ((($a = cmp = (self['$<=>'](other))) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed") + }; return $scope.Comparable.$normalize(cmp)['$<='](0); }; def['$between?'] = function(min, max) { var self = this; + if (self['$<'](min)) { return false}; if (self['$>'](max)) { @@ -2799,15 +3197,18 @@ ;$opal.donate(self, ["$==", "$>", "$>=", "$<", "$<=", "$between?"]); })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module; + return (function($base) { var self = $module($base, 'Enumerable'); - var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_21, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_33, TMP_34, TMP_38, TMP_39; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_16, TMP_17, TMP_18, TMP_19, TMP_20, TMP_22, TMP_23, TMP_24, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29, TMP_30, TMP_31, TMP_32, TMP_33, TMP_35, TMP_36, TMP_40, TMP_41; + def['$all?'] = TMP_1 = function() { var $a, self = this, $iter = TMP_1._p, block = $iter || nil; + TMP_1._p = null; var result = true; @@ -2821,7 +3222,7 @@ return $breaker; } - if (($a = value) === false || $a === nil) { + if ((($a = value) === nil || ($a._isBoolean && $a == false))) { result = false; return $breaker; } @@ -2829,7 +3230,7 @@ } else { self.$each._p = function(obj) { - if (arguments.length == 1 && ($a = obj) === false || $a === nil) { + if (arguments.length == 1 && (($a = obj) === nil || ($a._isBoolean && $a == false))) { result = false; return $breaker; } @@ -2844,6 +3245,7 @@ def['$any?'] = TMP_2 = function() { var $a, self = this, $iter = TMP_2._p, block = $iter || nil; + TMP_2._p = null; var result = false; @@ -2857,7 +3259,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { result = true; return $breaker; } @@ -2865,7 +3267,7 @@ } else { self.$each._p = function(obj) { - if (arguments.length != 1 || ($a = obj) !== false && $a !== nil) { + if (arguments.length != 1 || (($a = obj) !== nil && (!$a._isBoolean || $a == true))) { result = true; return $breaker; } @@ -2880,15 +3282,19 @@ def.$chunk = TMP_3 = function(state) { var self = this, $iter = TMP_3._p, block = $iter || nil; + TMP_3._p = null; return self.$raise($scope.NotImplementedError); }; def.$collect = TMP_4 = function() { var self = this, $iter = TMP_4._p, block = $iter || nil; + TMP_4._p = null; - if (block === nil) { - return self.$enum_for("collect")}; + if ((block !== nil)) { + } else { + return self.$enum_for("collect") + }; var result = []; @@ -2910,14 +3316,22 @@ }; def.$collect_concat = TMP_5 = function() { - var self = this, $iter = TMP_5._p, block = $iter || nil; + var $a, $b, TMP_6, self = this, $iter = TMP_5._p, block = $iter || nil; + TMP_5._p = null; - return self.$raise($scope.NotImplementedError); + if ((block !== nil)) { + } else { + return self.$enum_for("collect_concat") + }; + return ($a = ($b = self).$map, $a._p = (TMP_6 = function(item){var self = TMP_6._s || this, $a; +if (item == null) item = nil; + return $a = $opal.$yield1(block, item), $a === $breaker ? $a : $a}, TMP_6._s = self, TMP_6), $a).call($b).$flatten(1); }; - def.$count = TMP_6 = function(object) { - var $a, self = this, $iter = TMP_6._p, block = $iter || nil; - TMP_6._p = null; + def.$count = TMP_7 = function(object) { + var $a, self = this, $iter = TMP_7._p, block = $iter || nil; + + TMP_7._p = null; var result = 0; @@ -2938,7 +3352,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { result++; } } @@ -2949,18 +3363,23 @@ }; - def.$cycle = TMP_7 = function(n) { - var $a, self = this, $iter = TMP_7._p, block = $iter || nil; + def.$cycle = TMP_8 = function(n) { + var $a, self = this, $iter = TMP_8._p, block = $iter || nil; + if (n == null) { n = nil } - TMP_7._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("cycle", n)}; - if (($a = n['$nil?']()) === false || $a === nil) { + TMP_8._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("cycle", n) + }; + if ((($a = n['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { n = $scope.Opal['$coerce_to!'](n, $scope.Integer, "to_int"); - if (($a = n <= 0) !== false && $a !== nil) { - return nil};}; + if ((($a = n <= 0) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + }; var result, all = []; @@ -2987,7 +3406,7 @@ return nil; } - if (($a = n['$nil?']()) !== false && $a !== nil) { + if ((($a = n['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { while (true) { for (var i = 0, length = all.length; i < length; i++) { @@ -3016,11 +3435,14 @@ }; }; - def.$detect = TMP_8 = function(ifnone) { - var $a, self = this, $iter = TMP_8._p, block = $iter || nil; - TMP_8._p = null; - if (block === nil) { - return self.$enum_for("detect", ifnone)}; + def.$detect = TMP_9 = function(ifnone) { + var $a, self = this, $iter = TMP_9._p, block = $iter || nil; + + TMP_9._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("detect", ifnone) + }; var result = undefined; @@ -3033,7 +3455,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { result = params; return $breaker; } @@ -3056,8 +3478,9 @@ def.$drop = function(number) { var $a, self = this; + number = $scope.Opal.$coerce_to(number, $scope.Integer, "to_int"); - if (($a = number < 0) !== false && $a !== nil) { + if ((($a = number < 0) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "attempt to drop negative size")}; var result = [], @@ -3077,11 +3500,14 @@ }; - def.$drop_while = TMP_9 = function() { - var $a, self = this, $iter = TMP_9._p, block = $iter || nil; - TMP_9._p = null; - if (block === nil) { - return self.$enum_for("drop_while")}; + def.$drop_while = TMP_10 = function() { + var $a, self = this, $iter = TMP_10._p, block = $iter || nil; + + TMP_10._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("drop_while") + }; var result = [], dropping = true; @@ -3097,7 +3523,7 @@ return $breaker; } - if (($a = value) === false || $a === nil) { + if ((($a = value) === nil || ($a._isBoolean && $a == false))) { dropping = false; result.push(param); } @@ -3113,26 +3539,31 @@ }; - def.$each_cons = TMP_10 = function(n) { - var self = this, $iter = TMP_10._p, block = $iter || nil; - TMP_10._p = null; - return self.$raise($scope.NotImplementedError); - }; - - def.$each_entry = TMP_11 = function() { + def.$each_cons = TMP_11 = function(n) { var self = this, $iter = TMP_11._p, block = $iter || nil; + TMP_11._p = null; return self.$raise($scope.NotImplementedError); }; - def.$each_slice = TMP_12 = function(n) { - var $a, self = this, $iter = TMP_12._p, block = $iter || nil; + def.$each_entry = TMP_12 = function() { + var self = this, $iter = TMP_12._p, block = $iter || nil; + TMP_12._p = null; + return self.$raise($scope.NotImplementedError); + }; + + def.$each_slice = TMP_13 = function(n) { + var $a, self = this, $iter = TMP_13._p, block = $iter || nil; + + TMP_13._p = null; n = $scope.Opal.$coerce_to(n, $scope.Integer, "to_int"); - if (($a = n <= 0) !== false && $a !== nil) { + if ((($a = n <= 0) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "invalid slice size")}; - if (block === nil) { - return self.$enum_for("each_slice", n)}; + if ((block !== nil)) { + } else { + return self.$enum_for("each_slice", n) + }; var result, slice = [] @@ -3143,7 +3574,7 @@ slice.push(param); if (slice.length === n) { - if (block(slice) === $breaker) { + if ($opal.$yield1(block, slice) === $breaker) { result = $breaker.$v; return $breaker; } @@ -3160,7 +3591,7 @@ // our "last" group, if smaller than n then won't have been yielded if (slice.length > 0) { - if (block(slice) === $breaker) { + if ($opal.$yield1(block, slice) === $breaker) { return $breaker.$v; } } @@ -3168,12 +3599,15 @@ return nil; }; - def.$each_with_index = TMP_13 = function(args) { - var $a, self = this, $iter = TMP_13._p, block = $iter || nil; + def.$each_with_index = TMP_14 = function(args) { + var $a, self = this, $iter = TMP_14._p, block = $iter || nil; + args = $slice.call(arguments, 0); - TMP_13._p = null; - if (block === nil) { - return ($a = self).$enum_for.apply($a, ["each_with_index"].concat(args))}; + TMP_14._p = null; + if ((block !== nil)) { + } else { + return ($a = self).$enum_for.apply($a, ["each_with_index"].concat(args)) + }; var result, index = 0; @@ -3199,11 +3633,14 @@ return self; }; - def.$each_with_object = TMP_14 = function(object) { - var self = this, $iter = TMP_14._p, block = $iter || nil; - TMP_14._p = null; - if (block === nil) { - return self.$enum_for("each_with_object", object)}; + def.$each_with_object = TMP_15 = function(object) { + var self = this, $iter = TMP_15._p, block = $iter || nil; + + TMP_15._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("each_with_object", object) + }; var result; @@ -3228,6 +3665,7 @@ def.$entries = function(args) { var self = this; + args = $slice.call(arguments, 0); var result = []; @@ -3244,11 +3682,14 @@ $opal.defn(self, '$find', def.$detect); - def.$find_all = TMP_15 = function() { - var $a, self = this, $iter = TMP_15._p, block = $iter || nil; - TMP_15._p = null; - if (block === nil) { - return self.$enum_for("find_all")}; + def.$find_all = TMP_16 = function() { + var $a, self = this, $iter = TMP_16._p, block = $iter || nil; + + TMP_16._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("find_all") + }; var result = []; @@ -3261,7 +3702,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { result.push(param); } }; @@ -3272,10 +3713,11 @@ }; - def.$find_index = TMP_16 = function(object) { - var $a, self = this, $iter = TMP_16._p, block = $iter || nil; - TMP_16._p = null; - if (($a = object === undefined && block === nil) !== false && $a !== nil) { + def.$find_index = TMP_17 = function(object) { + var $a, self = this, $iter = TMP_17._p, block = $iter || nil; + + TMP_17._p = null; + if ((($a = object === undefined && block === nil) !== nil && (!$a._isBoolean || $a == true))) { return self.$enum_for("find_index")}; var result = nil, @@ -3302,7 +3744,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { result = index; return $breaker; } @@ -3319,7 +3761,8 @@ def.$first = function(number) { var $a, self = this, result = nil; - if (($a = number === undefined) !== false && $a !== nil) { + + if ((($a = number === undefined) !== nil && (!$a._isBoolean || $a == true))) { result = nil; self.$each._p = function() { @@ -3333,9 +3776,9 @@ } else { result = []; number = $scope.Opal.$coerce_to(number, $scope.Integer, "to_int"); - if (($a = number < 0) !== false && $a !== nil) { + if ((($a = number < 0) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "attempt to take negative size")}; - if (($a = number == 0) !== false && $a !== nil) { + if ((($a = number == 0) !== nil && (!$a._isBoolean || $a == true))) { return []}; var current = 0, @@ -3357,9 +3800,10 @@ $opal.defn(self, '$flat_map', def.$collect_concat); - def.$grep = TMP_17 = function(pattern) { - var $a, self = this, $iter = TMP_17._p, block = $iter || nil; - TMP_17._p = null; + def.$grep = TMP_18 = function(pattern) { + var $a, self = this, $iter = TMP_18._p, block = $iter || nil; + + TMP_18._p = null; var result = []; @@ -3368,7 +3812,7 @@ var param = $scope.Opal.$destructure(arguments), value = pattern['$==='](param); - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { value = $opal.$yield1(block, param); if (value === $breaker) { @@ -3385,7 +3829,7 @@ var param = $scope.Opal.$destructure(arguments), value = pattern['$==='](param); - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { result.push(param); } }; @@ -3397,11 +3841,14 @@ ; }; - def.$group_by = TMP_18 = function() { - var $a, $b, $c, self = this, $iter = TMP_18._p, block = $iter || nil, hash = nil; - TMP_18._p = null; - if (block === nil) { - return self.$enum_for("group_by")}; + def.$group_by = TMP_19 = function() { + var $a, $b, $c, self = this, $iter = TMP_19._p, block = $iter || nil, hash = nil; + + TMP_19._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("group_by") + }; hash = $scope.Hash.$new(); var result; @@ -3429,6 +3876,7 @@ def['$include?'] = function(obj) { var self = this; + var result = false; @@ -3447,9 +3895,10 @@ }; - def.$inject = TMP_19 = function(object, sym) { - var self = this, $iter = TMP_19._p, block = $iter || nil; - TMP_19._p = null; + def.$inject = TMP_20 = function(object, sym) { + var self = this, $iter = TMP_20._p, block = $iter || nil; + + TMP_20._p = null; var result = object; @@ -3496,19 +3945,22 @@ self.$each(); - return result; + return result == undefined ? nil : result; ; }; def.$lazy = function() { - var $a, $b, TMP_20, self = this; - return ($a = ($b = ($scope.Enumerator)._scope.Lazy).$new, $a._p = (TMP_20 = function(enum$, args){var self = TMP_20._s || this, $a;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); - return ($a = enum$).$yield.apply($a, [].concat(args))}, TMP_20._s = self, TMP_20), $a).call($b, self, self.$enumerator_size()); + var $a, $b, TMP_21, self = this; + + return ($a = ($b = ($scope.Enumerator)._scope.Lazy).$new, $a._p = (TMP_21 = function(enum$, args){var self = TMP_21._s || this, $a; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + return ($a = enum$).$yield.apply($a, [].concat(args))}, TMP_21._s = self, TMP_21), $a).call($b, self, self.$enumerator_size()); }; def.$enumerator_size = function() { var $a, self = this; - if (($a = self['$respond_to?']("size")) !== false && $a !== nil) { + + if ((($a = self['$respond_to?']("size")) !== nil && (!$a._isBoolean || $a == true))) { return self.$size() } else { return nil @@ -3519,9 +3971,10 @@ $opal.defn(self, '$map', def.$collect); - def.$max = TMP_21 = function() { - var self = this, $iter = TMP_21._p, block = $iter || nil; - TMP_21._p = null; + def.$max = TMP_22 = function() { + var self = this, $iter = TMP_22._p, block = $iter || nil; + + TMP_22._p = null; var result; @@ -3571,11 +4024,14 @@ }; - def.$max_by = TMP_22 = function() { - var $a, self = this, $iter = TMP_22._p, block = $iter || nil; - TMP_22._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("max_by")}; + def.$max_by = TMP_23 = function() { + var self = this, $iter = TMP_23._p, block = $iter || nil; + + TMP_23._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("max_by") + }; var result, by; @@ -3609,9 +4065,10 @@ $opal.defn(self, '$member?', def['$include?']); - def.$min = TMP_23 = function() { - var self = this, $iter = TMP_23._p, block = $iter || nil; - TMP_23._p = null; + def.$min = TMP_24 = function() { + var self = this, $iter = TMP_24._p, block = $iter || nil; + + TMP_24._p = null; var result; @@ -3661,11 +4118,14 @@ }; - def.$min_by = TMP_24 = function() { - var $a, self = this, $iter = TMP_24._p, block = $iter || nil; - TMP_24._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("min_by")}; + def.$min_by = TMP_25 = function() { + var self = this, $iter = TMP_25._p, block = $iter || nil; + + TMP_25._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("min_by") + }; var result, by; @@ -3697,21 +4157,24 @@ }; - def.$minmax = TMP_25 = function() { - var self = this, $iter = TMP_25._p, block = $iter || nil; - TMP_25._p = null; - return self.$raise($scope.NotImplementedError); - }; - - def.$minmax_by = TMP_26 = function() { + def.$minmax = TMP_26 = function() { var self = this, $iter = TMP_26._p, block = $iter || nil; + TMP_26._p = null; return self.$raise($scope.NotImplementedError); }; - def['$none?'] = TMP_27 = function() { - var $a, self = this, $iter = TMP_27._p, block = $iter || nil; + def.$minmax_by = TMP_27 = function() { + var self = this, $iter = TMP_27._p, block = $iter || nil; + TMP_27._p = null; + return self.$raise($scope.NotImplementedError); + }; + + def['$none?'] = TMP_28 = function() { + var $a, self = this, $iter = TMP_28._p, block = $iter || nil; + + TMP_28._p = null; var result = true; @@ -3724,7 +4187,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { result = false; return $breaker; } @@ -3734,7 +4197,7 @@ self.$each._p = function() { var value = $scope.Opal.$destructure(arguments); - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { result = false; return $breaker; } @@ -3747,9 +4210,10 @@ }; - def['$one?'] = TMP_28 = function() { - var $a, self = this, $iter = TMP_28._p, block = $iter || nil; - TMP_28._p = null; + def['$one?'] = TMP_29 = function() { + var $a, self = this, $iter = TMP_29._p, block = $iter || nil; + + TMP_29._p = null; var result = false; @@ -3762,7 +4226,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { if (result === true) { result = false; return $breaker; @@ -3776,7 +4240,7 @@ self.$each._p = function() { var value = $scope.Opal.$destructure(arguments); - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { if (result === true) { result = false; return $breaker; @@ -3793,28 +4257,108 @@ }; - def.$partition = TMP_29 = function() { - var self = this, $iter = TMP_29._p, block = $iter || nil; - TMP_29._p = null; - return self.$raise($scope.NotImplementedError); + def.$partition = TMP_30 = function() { + var $a, self = this, $iter = TMP_30._p, block = $iter || nil; + + TMP_30._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("partition") + }; + + var truthy = [], falsy = []; + + self.$each._p = function() { + var param = $scope.Opal.$destructure(arguments), + value = $opal.$yield1(block, param); + + if (value === $breaker) { + result = $breaker.$v; + return $breaker; + } + + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { + truthy.push(param); + } + else { + falsy.push(param); + } + }; + + self.$each(); + + return [truthy, falsy]; + }; $opal.defn(self, '$reduce', def.$inject); - def.$reverse_each = TMP_30 = function() { - var self = this, $iter = TMP_30._p, block = $iter || nil; - TMP_30._p = null; - return self.$raise($scope.NotImplementedError); + def.$reject = TMP_31 = function() { + var $a, self = this, $iter = TMP_31._p, block = $iter || nil; + + TMP_31._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("reject") + }; + + var result = []; + + self.$each._p = function() { + var param = $scope.Opal.$destructure(arguments), + value = $opal.$yield1(block, param); + + if (value === $breaker) { + result = $breaker.$v; + return $breaker; + } + + if ((($a = value) === nil || ($a._isBoolean && $a == false))) { + result.push(param); + } + }; + + self.$each(); + + return result; + + }; + + def.$reverse_each = TMP_32 = function() { + var self = this, $iter = TMP_32._p, block = $iter || nil; + + TMP_32._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("reverse_each") + }; + + var result = []; + + self.$each._p = function() { + result.push(arguments); + }; + + self.$each(); + + for (var i = result.length - 1; i >= 0; i--) { + $opal.$yieldX(block, result[i]); + } + + return result; + }; $opal.defn(self, '$select', def.$find_all); - def.$slice_before = TMP_31 = function(pattern) { - var $a, $b, TMP_32, self = this, $iter = TMP_31._p, block = $iter || nil; - TMP_31._p = null; - if (($a = pattern === undefined && block === nil || arguments.length > 1) !== false && $a !== nil) { + def.$slice_before = TMP_33 = function(pattern) { + var $a, $b, TMP_34, self = this, $iter = TMP_33._p, block = $iter || nil; + + TMP_33._p = null; + if ((($a = pattern === undefined && block === nil || arguments.length > 1) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "wrong number of arguments (" + (arguments.length) + " for 1)")}; - return ($a = ($b = $scope.Enumerator).$new, $a._p = (TMP_32 = function(e){var self = TMP_32._s || this, $a;if (e == null) e = nil; + return ($a = ($b = $scope.Enumerator).$new, $a._p = (TMP_34 = function(e){var self = TMP_34._s || this, $a; +if (e == null) e = nil; var slice = []; @@ -3824,7 +4368,7 @@ var param = $scope.Opal.$destructure(arguments), value = $opal.$yield1(block, param); - if (($a = value) !== false && $a !== nil && slice.length > 0) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true)) && slice.length > 0) { e['$<<'](slice); slice = []; } @@ -3837,7 +4381,7 @@ var param = $scope.Opal.$destructure(arguments), value = block(param, pattern.$dup()); - if (($a = value) !== false && $a !== nil && slice.length > 0) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true)) && slice.length > 0) { e['$<<'](slice); slice = []; } @@ -3851,7 +4395,7 @@ var param = $scope.Opal.$destructure(arguments), value = pattern['$==='](param); - if (($a = value) !== false && $a !== nil && slice.length > 0) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true)) && slice.length > 0) { e['$<<'](slice); slice = []; } @@ -3865,37 +4409,48 @@ if (slice.length > 0) { e['$<<'](slice); } - ;}, TMP_32._s = self, TMP_32), $a).call($b); + ;}, TMP_34._s = self, TMP_34), $a).call($b); }; - def.$sort = TMP_33 = function() { - var self = this, $iter = TMP_33._p, block = $iter || nil; - TMP_33._p = null; + def.$sort = TMP_35 = function() { + var self = this, $iter = TMP_35._p, block = $iter || nil; + + TMP_35._p = null; return self.$raise($scope.NotImplementedError); }; - def.$sort_by = TMP_34 = function() { - var $a, $b, TMP_35, $c, $d, TMP_36, $e, $f, TMP_37, self = this, $iter = TMP_34._p, block = $iter || nil; - TMP_34._p = null; - if (block === nil) { - return self.$enum_for("sort_by")}; - return ($a = ($b = ($c = ($d = ($e = ($f = self).$map, $e._p = (TMP_37 = function(){var self = TMP_37._s || this; + def.$sort_by = TMP_36 = function() { + var $a, $b, TMP_37, $c, $d, TMP_38, $e, $f, TMP_39, self = this, $iter = TMP_36._p, block = $iter || nil; + + TMP_36._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("sort_by") + }; + return ($a = ($b = ($c = ($d = ($e = ($f = self).$map, $e._p = (TMP_39 = function(){var self = TMP_39._s || this; + arg = $scope.Opal.$destructure(arguments); - return [block.$call(arg), arg];}, TMP_37._s = self, TMP_37), $e).call($f)).$sort, $c._p = (TMP_36 = function(a, b){var self = TMP_36._s || this;if (a == null) a = nil;if (b == null) b = nil; - return a['$[]'](0)['$<=>'](b['$[]'](0))}, TMP_36._s = self, TMP_36), $c).call($d)).$map, $a._p = (TMP_35 = function(arg){var self = TMP_35._s || this;if (arg == null) arg = nil; - return arg[1];}, TMP_35._s = self, TMP_35), $a).call($b); + return [block.$call(arg), arg];}, TMP_39._s = self, TMP_39), $e).call($f)).$sort, $c._p = (TMP_38 = function(a, b){var self = TMP_38._s || this; +if (a == null) a = nil;if (b == null) b = nil; + return a['$[]'](0)['$<=>'](b['$[]'](0))}, TMP_38._s = self, TMP_38), $c).call($d)).$map, $a._p = (TMP_37 = function(arg){var self = TMP_37._s || this; +if (arg == null) arg = nil; + return arg[1];}, TMP_37._s = self, TMP_37), $a).call($b); }; def.$take = function(num) { var self = this; + return self.$first(num); }; - def.$take_while = TMP_38 = function() { - var $a, self = this, $iter = TMP_38._p, block = $iter || nil; - TMP_38._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("take_while")}; + def.$take_while = TMP_40 = function() { + var $a, self = this, $iter = TMP_40._p, block = $iter || nil; + + TMP_40._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("take_while") + }; var result = []; @@ -3908,7 +4463,7 @@ return $breaker; } - if (($a = value) === false || $a === nil) { + if ((($a = value) === nil || ($a._isBoolean && $a == false))) { return $breaker; } @@ -3923,28 +4478,33 @@ $opal.defn(self, '$to_a', def.$entries); - def.$zip = TMP_39 = function(lists) { - var self = this, $iter = TMP_39._p, block = $iter || nil; - lists = $slice.call(arguments, 0); - TMP_39._p = null; - return self.$raise($scope.NotImplementedError); + def.$zip = TMP_41 = function(others) { + var $a, self = this, $iter = TMP_41._p, block = $iter || nil; + + others = $slice.call(arguments, 0); + TMP_41._p = null; + return ($a = self.$to_a()).$zip.apply($a, [].concat(others)); }; - ;$opal.donate(self, ["$all?", "$any?", "$chunk", "$collect", "$collect_concat", "$count", "$cycle", "$detect", "$drop", "$drop_while", "$each_cons", "$each_entry", "$each_slice", "$each_with_index", "$each_with_object", "$entries", "$find", "$find_all", "$find_index", "$first", "$flat_map", "$grep", "$group_by", "$include?", "$inject", "$lazy", "$enumerator_size", "$map", "$max", "$max_by", "$member?", "$min", "$min_by", "$minmax", "$minmax_by", "$none?", "$one?", "$partition", "$reduce", "$reverse_each", "$select", "$slice_before", "$sort", "$sort_by", "$take", "$take_while", "$to_a", "$zip"]); + ;$opal.donate(self, ["$all?", "$any?", "$chunk", "$collect", "$collect_concat", "$count", "$cycle", "$detect", "$drop", "$drop_while", "$each_cons", "$each_entry", "$each_slice", "$each_with_index", "$each_with_object", "$entries", "$find", "$find_all", "$find_index", "$first", "$flat_map", "$grep", "$group_by", "$include?", "$inject", "$lazy", "$enumerator_size", "$map", "$max", "$max_by", "$member?", "$min", "$min_by", "$minmax", "$minmax_by", "$none?", "$one?", "$partition", "$reduce", "$reject", "$reverse_each", "$select", "$slice_before", "$sort", "$sort_by", "$take", "$take_while", "$to_a", "$zip"]); })(self) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + ; return (function($base, $super) { function $Enumerator(){}; var self = $Enumerator = $klass($base, $super, 'Enumerator', $Enumerator); - var def = $Enumerator._proto, $scope = $Enumerator._scope, TMP_1, TMP_2, TMP_3, TMP_4; - def.size = def.object = def.method = def.args = nil; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4; + + def.size = def.args = def.object = def.method = nil; self.$include($scope.Enumerable); $opal.defs(self, '$for', TMP_1 = function(object, method, args) { var self = this, $iter = TMP_1._p, block = $iter || nil; + args = $slice.call(arguments, 2); if (method == null) { method = "each" @@ -3964,13 +4524,14 @@ def.$initialize = TMP_2 = function() { var $a, $b, self = this, $iter = TMP_2._p, block = $iter || nil; + TMP_2._p = null; if (block !== false && block !== nil) { self.object = ($a = ($b = $scope.Generator).$new, $a._p = block.$to_proc(), $a).call($b); self.method = "each"; self.args = []; self.size = arguments[0] || nil; - if (($a = self.size) !== false && $a !== nil) { + if ((($a = self.size) !== nil && (!$a._isBoolean || $a == true))) { return self.size = $scope.Opal.$coerce_to(self.size, $scope.Integer, "to_int") } else { return nil @@ -3983,17 +4544,23 @@ }; }; - def.$each = TMP_3 = function() { - var $a, $b, self = this, $iter = TMP_3._p, block = $iter || nil; + def.$each = TMP_3 = function(args) { + var $a, $b, $c, self = this, $iter = TMP_3._p, block = $iter || nil; + + args = $slice.call(arguments, 0); TMP_3._p = null; - if (($a = block) === false || $a === nil) { + if ((($a = ($b = block['$nil?'](), $b !== false && $b !== nil ?args['$empty?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { return self}; - return ($a = ($b = self.object).$__send__, $a._p = block.$to_proc(), $a).apply($b, [self.method].concat(self.args)); + args = self.args['$+'](args); + if ((($a = block['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { + return ($a = self.$class()).$new.apply($a, [self.object, self.method].concat(args))}; + return ($b = ($c = self.object).$__send__, $b._p = block.$to_proc(), $b).apply($c, [self.method].concat(args)); }; def.$size = function() { var $a, self = this; - if (($a = $scope.Proc['$==='](self.size)) !== false && $a !== nil) { + + if ((($a = $scope.Proc['$==='](self.size)) !== nil && (!$a._isBoolean || $a == true))) { return ($a = self.size).$call.apply($a, [].concat(self.args)) } else { return self.size @@ -4001,7 +4568,8 @@ }; def.$with_index = TMP_4 = function(offset) { - var $a, self = this, $iter = TMP_4._p, block = $iter || nil; + var self = this, $iter = TMP_4._p, block = $iter || nil; + if (offset == null) { offset = 0 } @@ -4011,8 +4579,10 @@ } else { offset = 0 }; - if (($a = block) === false || $a === nil) { - return self.$enum_for("with_index", offset)}; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("with_index", offset) + }; var result @@ -4040,9 +4610,12 @@ def.$inspect = function() { var $a, self = this, result = nil; + result = "#<" + (self.$class().$name()) + ": " + (self.object.$inspect()) + ":" + (self.method); - if (($a = self.args['$empty?']()) === false || $a === nil) { - result = result['$+']("(" + (self.args.$inspect()['$[]']($scope.Range.$new(1, -2))) + ")")}; + if ((($a = self.args['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + result = result['$+']("(" + (self.args.$inspect()['$[]']($scope.Range.$new(1, -2))) + ")") + }; return result['$+'](">"); }; @@ -4050,20 +4623,25 @@ function $Generator(){}; var self = $Generator = $klass($base, $super, 'Generator', $Generator); - var def = $Generator._proto, $scope = $Generator._scope, TMP_5, TMP_6; + var def = self._proto, $scope = self._scope, TMP_5, TMP_6; + def.block = nil; self.$include($scope.Enumerable); def.$initialize = TMP_5 = function() { - var $a, self = this, $iter = TMP_5._p, block = $iter || nil; + var self = this, $iter = TMP_5._p, block = $iter || nil; + TMP_5._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.LocalJumpError, "no block given")}; + if (block !== false && block !== nil) { + } else { + self.$raise($scope.LocalJumpError, "no block given") + }; return self.block = block; }; return (def.$each = TMP_6 = function(args) { var $a, $b, self = this, $iter = TMP_6._p, block = $iter || nil, yielder = nil; + args = $slice.call(arguments, 0); TMP_6._p = null; yielder = ($a = ($b = $scope.Yielder).$new, $a._p = block.$to_proc(), $a).call($b); @@ -4085,23 +4663,26 @@ } ; return self; - }, nil); + }, nil) && 'each'; })(self, null); (function($base, $super) { function $Yielder(){}; var self = $Yielder = $klass($base, $super, 'Yielder', $Yielder); - var def = $Yielder._proto, $scope = $Yielder._scope, TMP_7; + var def = self._proto, $scope = self._scope, TMP_7; + def.block = nil; def.$initialize = TMP_7 = function() { var self = this, $iter = TMP_7._p, block = $iter || nil; + TMP_7._p = null; return self.block = block; }; def.$yield = function(values) { var self = this; + values = $slice.call(arguments, 0); var value = $opal.$yieldX(self.block, values); @@ -4116,38 +4697,46 @@ return (def['$<<'] = function(values) { var $a, self = this; + values = $slice.call(arguments, 0); ($a = self).$yield.apply($a, [].concat(values)); return self; - }, nil); + }, nil) && '<<'; })(self, null); return (function($base, $super) { function $Lazy(){}; var self = $Lazy = $klass($base, $super, 'Lazy', $Lazy); - var def = $Lazy._proto, $scope = $Lazy._scope, TMP_8, TMP_11, TMP_13, TMP_18, TMP_20, TMP_21, TMP_23, TMP_26, TMP_29; + var def = self._proto, $scope = self._scope, TMP_8, TMP_11, TMP_13, TMP_18, TMP_20, TMP_21, TMP_23, TMP_26, TMP_29; + def.enumerator = nil; (function($base, $super) { function $StopLazyError(){}; var self = $StopLazyError = $klass($base, $super, 'StopLazyError', $StopLazyError); - var def = $StopLazyError._proto, $scope = $StopLazyError._scope; + var def = self._proto, $scope = self._scope; + return nil; })(self, $scope.Exception); def.$initialize = TMP_8 = function(object, size) { var TMP_9, self = this, $iter = TMP_8._p, block = $iter || nil; + if (size == null) { size = nil } TMP_8._p = null; - if (block === nil) { - self.$raise($scope.ArgumentError, "tried to call lazy new without a block")}; + if ((block !== nil)) { + } else { + self.$raise($scope.ArgumentError, "tried to call lazy new without a block") + }; self.enumerator = object; - return $opal.find_super_dispatcher(self, 'initialize', TMP_8, (TMP_9 = function(yielder, each_args){var self = TMP_9._s || this, $a, $b, TMP_10;if (yielder == null) yielder = nil;each_args = $slice.call(arguments, 1); + return $opal.find_super_dispatcher(self, 'initialize', TMP_8, (TMP_9 = function(yielder, each_args){var self = TMP_9._s || this, $a, $b, TMP_10; +if (yielder == null) yielder = nil;each_args = $slice.call(arguments, 1); try { - return ($a = ($b = object).$each, $a._p = (TMP_10 = function(args){var self = TMP_10._s || this;args = $slice.call(arguments, 0); + return ($a = ($b = object).$each, $a._p = (TMP_10 = function(args){var self = TMP_10._s || this; +args = $slice.call(arguments, 0); args.unshift(yielder); @@ -4155,7 +4744,7 @@ return $breaker; } ;}, TMP_10._s = self, TMP_10), $a).apply($b, [].concat(each_args)) - } catch ($err) {if ($scope.Exception['$===']($err)) { + } catch ($err) {if ($opal.$rescue($err, [$scope.Exception])) { return nil }else { throw $err; } }}, TMP_9._s = self, TMP_9)).apply(self, [size]); @@ -4165,15 +4754,20 @@ def.$lazy = function() { var self = this; + return self; }; def.$collect = TMP_11 = function() { var $a, $b, TMP_12, self = this, $iter = TMP_11._p, block = $iter || nil; + TMP_11._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to call lazy map without a block")}; - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_12 = function(enum$, args){var self = TMP_12._s || this;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to call lazy map without a block") + }; + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_12 = function(enum$, args){var self = TMP_12._s || this; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); var value = $opal.$yieldX(block, args); @@ -4187,10 +4781,14 @@ def.$collect_concat = TMP_13 = function() { var $a, $b, TMP_14, self = this, $iter = TMP_13._p, block = $iter || nil; + TMP_13._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to call lazy map without a block")}; - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_14 = function(enum$, args){var self = TMP_14._s || this, $a, $b, TMP_15, $c, TMP_16;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to call lazy map without a block") + }; + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_14 = function(enum$, args){var self = TMP_14._s || this, $a, $b, TMP_15, $c, TMP_16; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); var value = $opal.$yieldX(block, args); @@ -4199,7 +4797,8 @@ } if ((value)['$respond_to?']("force") && (value)['$respond_to?']("each")) { - ($a = ($b = (value)).$each, $a._p = (TMP_15 = function(v){var self = TMP_15._s || this;if (v == null) v = nil; + ($a = ($b = (value)).$each, $a._p = (TMP_15 = function(v){var self = TMP_15._s || this; +if (v == null) v = nil; return enum$.$yield(v)}, TMP_15._s = self, TMP_15), $a).call($b) } else { @@ -4209,7 +4808,8 @@ enum$.$yield(value); } else { - ($a = ($c = (value)).$each, $a._p = (TMP_16 = function(v){var self = TMP_16._s || this;if (v == null) v = nil; + ($a = ($c = (value)).$each, $a._p = (TMP_16 = function(v){var self = TMP_16._s || this; +if (v == null) v = nil; return enum$.$yield(v)}, TMP_16._s = self, TMP_16), $a).call($c); } } @@ -4218,11 +4818,12 @@ def.$drop = function(n) { var $a, $b, TMP_17, self = this, current_size = nil, set_size = nil, dropped = nil; + n = $scope.Opal.$coerce_to(n, $scope.Integer, "to_int"); if (n['$<'](0)) { self.$raise($scope.ArgumentError, "attempt to drop negative size")}; current_size = self.$enumerator_size(); - set_size = (function() {if (($a = $scope.Integer['$==='](current_size)) !== false && $a !== nil) { + set_size = (function() {if ((($a = $scope.Integer['$==='](current_size)) !== nil && (!$a._isBoolean || $a == true))) { if (n['$<'](current_size)) { return n } else { @@ -4232,7 +4833,8 @@ return current_size }; return nil; })(); dropped = 0; - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_17 = function(enum$, args){var self = TMP_17._s || this, $a;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_17 = function(enum$, args){var self = TMP_17._s || this, $a; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); if (dropped['$<'](n)) { return dropped = dropped['$+'](1) } else { @@ -4242,11 +4844,15 @@ def.$drop_while = TMP_18 = function() { var $a, $b, TMP_19, self = this, $iter = TMP_18._p, block = $iter || nil, succeeding = nil; + TMP_18._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to call lazy drop_while without a block")}; + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to call lazy drop_while without a block") + }; succeeding = true; - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_19 = function(enum$, args){var self = TMP_19._s || this, $a, $b;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_19 = function(enum$, args){var self = TMP_19._s || this, $a, $b; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); if (succeeding !== false && succeeding !== nil) { var value = $opal.$yieldX(block, args); @@ -4255,7 +4861,7 @@ return $breaker; } - if (($a = value) === false || $a === nil) { + if ((($a = value) === nil || ($a._isBoolean && $a == false))) { succeeding = false; ($a = enum$).$yield.apply($a, [].concat(args)); @@ -4268,6 +4874,7 @@ def.$enum_for = TMP_20 = function(method, args) { var $a, $b, self = this, $iter = TMP_20._p, block = $iter || nil; + args = $slice.call(arguments, 1); if (method == null) { method = "each" @@ -4278,10 +4885,14 @@ def.$find_all = TMP_21 = function() { var $a, $b, TMP_22, self = this, $iter = TMP_21._p, block = $iter || nil; + TMP_21._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to call lazy select without a block")}; - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_22 = function(enum$, args){var self = TMP_22._s || this, $a;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to call lazy select without a block") + }; + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_22 = function(enum$, args){var self = TMP_22._s || this, $a; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); var value = $opal.$yieldX(block, args); @@ -4289,7 +4900,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { ($a = enum$).$yield.apply($a, [].concat(args)); } ;}, TMP_22._s = self, TMP_22), $a).call($b, self, nil); @@ -4299,14 +4910,16 @@ def.$grep = TMP_23 = function(pattern) { var $a, $b, TMP_24, $c, TMP_25, self = this, $iter = TMP_23._p, block = $iter || nil; + TMP_23._p = null; if (block !== false && block !== nil) { - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_24 = function(enum$, args){var self = TMP_24._s || this, $a;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_24 = function(enum$, args){var self = TMP_24._s || this, $a; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); var param = $scope.Opal.$destructure(args), value = pattern['$==='](param); - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { value = $opal.$yield1(block, param); if (value === $breaker) { @@ -4317,12 +4930,13 @@ } ;}, TMP_24._s = self, TMP_24), $a).call($b, self, nil) } else { - return ($a = ($c = $scope.Lazy).$new, $a._p = (TMP_25 = function(enum$, args){var self = TMP_25._s || this, $a;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + return ($a = ($c = $scope.Lazy).$new, $a._p = (TMP_25 = function(enum$, args){var self = TMP_25._s || this, $a; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); var param = $scope.Opal.$destructure(args), value = pattern['$==='](param); - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { enum$.$yield(param); } ;}, TMP_25._s = self, TMP_25), $a).call($c, self, nil) @@ -4335,10 +4949,14 @@ def.$reject = TMP_26 = function() { var $a, $b, TMP_27, self = this, $iter = TMP_26._p, block = $iter || nil; + TMP_26._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to call lazy reject without a block")}; - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_27 = function(enum$, args){var self = TMP_27._s || this, $a;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to call lazy reject without a block") + }; + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_27 = function(enum$, args){var self = TMP_27._s || this, $a; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); var value = $opal.$yieldX(block, args); @@ -4346,7 +4964,7 @@ return $breaker; } - if (($a = value) === false || $a === nil) { + if ((($a = value) === nil || ($a._isBoolean && $a == false))) { ($a = enum$).$yield.apply($a, [].concat(args)); } ;}, TMP_27._s = self, TMP_27), $a).call($b, self, nil); @@ -4354,11 +4972,12 @@ def.$take = function(n) { var $a, $b, TMP_28, self = this, current_size = nil, set_size = nil, taken = nil; + n = $scope.Opal.$coerce_to(n, $scope.Integer, "to_int"); if (n['$<'](0)) { self.$raise($scope.ArgumentError, "attempt to take negative size")}; current_size = self.$enumerator_size(); - set_size = (function() {if (($a = $scope.Integer['$==='](current_size)) !== false && $a !== nil) { + set_size = (function() {if ((($a = $scope.Integer['$==='](current_size)) !== nil && (!$a._isBoolean || $a == true))) { if (n['$<'](current_size)) { return n } else { @@ -4368,7 +4987,8 @@ return current_size }; return nil; })(); taken = 0; - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_28 = function(enum$, args){var self = TMP_28._s || this, $a;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_28 = function(enum$, args){var self = TMP_28._s || this, $a; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); if (taken['$<'](n)) { ($a = enum$).$yield.apply($a, [].concat(args)); return taken = taken['$+'](1); @@ -4379,10 +4999,14 @@ def.$take_while = TMP_29 = function() { var $a, $b, TMP_30, self = this, $iter = TMP_29._p, block = $iter || nil; + TMP_29._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to call lazy take_while without a block")}; - return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_30 = function(enum$, args){var self = TMP_30._s || this, $a;if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to call lazy take_while without a block") + }; + return ($a = ($b = $scope.Lazy).$new, $a._p = (TMP_30 = function(enum$, args){var self = TMP_30._s || this, $a; +if (enum$ == null) enum$ = nil;args = $slice.call(arguments, 1); var value = $opal.$yieldX(block, args); @@ -4390,7 +5014,7 @@ return $breaker; } - if (($a = value) !== false && $a !== nil) { + if ((($a = value) !== nil && (!$a._isBoolean || $a == true))) { ($a = enum$).$yield.apply($a, [].concat(args)); } else { @@ -4403,53 +5027,45 @@ return (def.$inspect = function() { var self = this; + return "#<" + (self.$class().$name()) + ": " + (self.enumerator.$inspect()) + ">"; - }, nil); + }, nil) && 'inspect'; })(self, self); - })(self, null) + })(self, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $range = $opal.range; - (function($base, $super) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $gvars = $opal.gvars, $range = $opal.range; + + ; + return (function($base, $super) { function $Array(){}; var self = $Array = $klass($base, $super, 'Array', $Array); - var def = $Array._proto, $scope = $Array._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_24; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13, TMP_14, TMP_15, TMP_17, TMP_18, TMP_19, TMP_20, TMP_21, TMP_24; + def.length = nil; self.$include($scope.Enumerable); def._isArray = true; - $opal.defs(self, '$inherited', function(klass) { - var self = this, replace = nil; - replace = $scope.Class.$new(($scope.Array)._scope.Wrapper); - - klass._proto = replace._proto; - klass._proto._klass = klass; - klass._alloc = replace._alloc; - klass.__parent = ($scope.Array)._scope.Wrapper; - - klass.$allocate = replace.$allocate; - klass.$new = replace.$new; - klass["$[]"] = replace["$[]"]; - - }); - $opal.defs(self, '$[]', function(objects) { var self = this; + objects = $slice.call(arguments, 0); return objects; }); def.$initialize = function(args) { var $a, self = this; + args = $slice.call(arguments, 0); return ($a = self.$class()).$new.apply($a, [].concat(args)); }; $opal.defs(self, '$new', TMP_1 = function(size, obj) { var $a, self = this, $iter = TMP_1._p, block = $iter || nil; + if (size == null) { size = nil } @@ -4457,17 +5073,17 @@ obj = nil } TMP_1._p = null; - if (($a = arguments.length > 2) !== false && $a !== nil) { + if ((($a = arguments.length > 2) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "wrong number of arguments (" + (arguments.length) + " for 0..2)")}; - if (($a = arguments.length === 0) !== false && $a !== nil) { + if ((($a = arguments.length === 0) !== nil && (!$a._isBoolean || $a == true))) { return []}; - if (($a = arguments.length === 1) !== false && $a !== nil) { - if (($a = $scope.Array['$==='](size)) !== false && $a !== nil) { + if ((($a = arguments.length === 1) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = $scope.Array['$==='](size)) !== nil && (!$a._isBoolean || $a == true))) { return size.$to_a() - } else if (($a = size['$respond_to?']("to_ary")) !== false && $a !== nil) { + } else if ((($a = size['$respond_to?']("to_ary")) !== nil && (!$a._isBoolean || $a == true))) { return size.$to_ary()}}; size = $scope.Opal.$coerce_to(size, $scope.Integer, "to_int"); - if (($a = size < 0) !== false && $a !== nil) { + if ((($a = size < 0) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "negative array size")}; var result = []; @@ -4494,17 +5110,15 @@ }); $opal.defs(self, '$try_convert', function(obj) { - var $a, self = this; - if (($a = $scope.Array['$==='](obj)) !== false && $a !== nil) { - return obj}; - if (($a = obj['$respond_to?']("to_ary")) !== false && $a !== nil) { - return obj.$to_ary()}; - return nil; + var self = this; + + return $scope.Opal['$coerce_to?'](obj, $scope.Array, "to_ary"); }); def['$&'] = function(other) { var $a, self = this; - if (($a = $scope.Array['$==='](other)) !== false && $a !== nil) { + + if ((($a = $scope.Array['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { other = other.$to_a() } else { other = $scope.Opal.$coerce_to(other, $scope.Array, "to_ary").$to_a() @@ -4534,12 +5148,15 @@ def['$*'] = function(other) { var $a, self = this; - if (($a = other['$respond_to?']("to_str")) !== false && $a !== nil) { + + if ((($a = other['$respond_to?']("to_str")) !== nil && (!$a._isBoolean || $a == true))) { return self.join(other.$to_str())}; - if (($a = other['$respond_to?']("to_int")) === false || $a === nil) { - self.$raise($scope.TypeError, "no implicit conversion of " + (other.$class()) + " into Integer")}; + if ((($a = other['$respond_to?']("to_int")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "no implicit conversion of " + (other.$class()) + " into Integer") + }; other = $scope.Opal.$coerce_to(other, $scope.Integer, "to_int"); - if (($a = other < 0) !== false && $a !== nil) { + if ((($a = other < 0) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "negative argument")}; var result = []; @@ -4554,7 +5171,8 @@ def['$+'] = function(other) { var $a, self = this; - if (($a = $scope.Array['$==='](other)) !== false && $a !== nil) { + + if ((($a = $scope.Array['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { other = other.$to_a() } else { other = $scope.Opal.$coerce_to(other, $scope.Array, "to_ary").$to_a() @@ -4564,14 +5182,15 @@ def['$-'] = function(other) { var $a, self = this; - if (($a = $scope.Array['$==='](other)) !== false && $a !== nil) { + + if ((($a = $scope.Array['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { other = other.$to_a() } else { other = $scope.Opal.$coerce_to(other, $scope.Array, "to_ary").$to_a() }; - if (($a = self.length === 0) !== false && $a !== nil) { + if ((($a = self.length === 0) !== nil && (!$a._isBoolean || $a == true))) { return []}; - if (($a = other.length === 0) !== false && $a !== nil) { + if ((($a = other.length === 0) !== nil && (!$a._isBoolean || $a == true))) { return self.$clone()}; var seen = {}, @@ -4595,15 +5214,17 @@ def['$<<'] = function(object) { var self = this; + self.push(object); return self; }; def['$<=>'] = function(other) { var $a, self = this; - if (($a = $scope.Array['$==='](other)) !== false && $a !== nil) { + + if ((($a = $scope.Array['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { other = other.$to_a() - } else if (($a = other['$respond_to?']("to_ary")) !== false && $a !== nil) { + } else if ((($a = other['$respond_to?']("to_ary")) !== nil && (!$a._isBoolean || $a == true))) { other = other.$to_ary().$to_a() } else { return nil @@ -4631,15 +5252,22 @@ def['$=='] = function(other) { var $a, self = this; - if (($a = self === other) !== false && $a !== nil) { + + if ((($a = self === other) !== nil && (!$a._isBoolean || $a == true))) { return true}; - if (($a = $scope.Array['$==='](other)) === false || $a === nil) { - if (($a = other['$respond_to?']("to_ary")) === false || $a === nil) { - return false}; - return other['$=='](self);}; + if ((($a = $scope.Array['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + if ((($a = other['$respond_to?']("to_ary")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; + return other['$=='](self); + }; other = other.$to_a(); - if (($a = self.length === other.length) === false || $a === nil) { - return false}; + if ((($a = self.length === other.length) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; for (var i = 0, length = self.length; i < length; i++) { var a = self[i], @@ -4659,7 +5287,8 @@ def['$[]'] = function(index, length) { var $a, self = this; - if (($a = $scope.Range['$==='](index)) !== false && $a !== nil) { + + if ((($a = $scope.Range['$==='](index)) !== nil && (!$a._isBoolean || $a == true))) { var size = self.length, exclude = index.exclude, @@ -4674,8 +5303,6 @@ } } - $scope.Opal['$fits_fixnum!'](from); - if (from > size) { return nil; } @@ -4688,8 +5315,6 @@ } } - $scope.Opal['$fits_fixnum!'](to); - if (!exclude) { to += 1; } @@ -4709,8 +5334,6 @@ } } - $scope.Opal['$fits_fixnum!'](index); - if (length === undefined) { if (index >= size || index < 0) { return nil; @@ -4721,8 +5344,6 @@ else { length = $scope.Opal.$coerce_to(length, $scope.Integer, "to_int"); - $scope.Opal['$fits_fixnum!'](length); - if (length < 0 || index > size || index < 0) { return nil; } @@ -4735,10 +5356,11 @@ def['$[]='] = function(index, value, extra) { var $a, self = this, data = nil, length = nil; - if (($a = $scope.Range['$==='](index)) !== false && $a !== nil) { - if (($a = $scope.Array['$==='](value)) !== false && $a !== nil) { + + if ((($a = $scope.Range['$==='](index)) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = $scope.Array['$==='](value)) !== nil && (!$a._isBoolean || $a == true))) { data = value.$to_a() - } else if (($a = value['$respond_to?']("to_ary")) !== false && $a !== nil) { + } else if ((($a = value['$respond_to?']("to_ary")) !== nil && (!$a._isBoolean || $a == true))) { data = value.$to_ary().$to_a() } else { data = [value] @@ -4757,20 +5379,16 @@ } } - $scope.Opal['$fits_fixnum!'](from); - if (to < 0) { to += size; } - $scope.Opal['$fits_fixnum!'](to); - if (!exclude) { to += 1; } if (from > size) { - for (var i = size; i < index; i++) { + for (var i = size; i < from; i++) { self[i] = nil; } } @@ -4785,14 +5403,14 @@ return value; ; } else { - if (($a = extra === undefined) !== false && $a !== nil) { + if ((($a = extra === undefined) !== nil && (!$a._isBoolean || $a == true))) { length = 1 } else { length = value; value = extra; - if (($a = $scope.Array['$==='](value)) !== false && $a !== nil) { + if ((($a = $scope.Array['$==='](value)) !== nil && (!$a._isBoolean || $a == true))) { data = value.$to_a() - } else if (($a = value['$respond_to?']("to_ary")) !== false && $a !== nil) { + } else if ((($a = value['$respond_to?']("to_ary")) !== nil && (!$a._isBoolean || $a == true))) { data = value.$to_ary().$to_a() } else { data = [value] @@ -4813,14 +5431,10 @@ } } - $scope.Opal['$fits_fixnum!'](index); - if (length < 0) { self.$raise($scope.IndexError, "negative length (" + (length) + ")") } - $scope.Opal['$fits_fixnum!'](length); - if (index > size) { for (var i = size; i < index; i++) { self[i] = nil; @@ -4841,6 +5455,7 @@ def.$assoc = function(object) { var self = this; + for (var i = 0, length = self.length, item; i < length; i++) { if (item = self[i], item.length && (item[0])['$=='](object)) { @@ -4854,6 +5469,7 @@ def.$at = function(index) { var self = this; + index = $scope.Opal.$coerce_to(index, $scope.Integer, "to_int"); if (index < 0) { @@ -4870,15 +5486,18 @@ def.$cycle = TMP_2 = function(n) { var $a, $b, self = this, $iter = TMP_2._p, block = $iter || nil; + if (n == null) { n = nil } TMP_2._p = null; - if (($a = ((($b = self['$empty?']()) !== false && $b !== nil) ? $b : n['$=='](0))) !== false && $a !== nil) { + if ((($a = ((($b = self['$empty?']()) !== false && $b !== nil) ? $b : n['$=='](0))) !== nil && (!$a._isBoolean || $a == true))) { return nil}; - if (($a = block) === false || $a === nil) { - return self.$enum_for("cycle", n)}; - if (($a = n['$nil?']()) !== false && $a !== nil) { + if (block !== false && block !== nil) { + } else { + return self.$enum_for("cycle", n) + }; + if ((($a = n['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { while (true) { for (var i = 0, length = self.length; i < length; i++) { @@ -4915,12 +5534,14 @@ def.$clear = function() { var self = this; + self.splice(0, self.length); return self; }; def.$clone = function() { var self = this, copy = nil; + copy = []; copy.$initialize_clone(self); return copy; @@ -4928,6 +5549,7 @@ def.$dup = function() { var self = this, copy = nil; + copy = []; copy.$initialize_dup(self); return copy; @@ -4935,14 +5557,18 @@ def.$initialize_copy = function(other) { var self = this; + return self.$replace(other); }; def.$collect = TMP_3 = function() { var self = this, $iter = TMP_3._p, block = $iter || nil; + TMP_3._p = null; - if (block === nil) { - return self.$enum_for("collect")}; + if ((block !== nil)) { + } else { + return self.$enum_for("collect") + }; var result = []; @@ -4962,9 +5588,12 @@ def['$collect!'] = TMP_4 = function() { var self = this, $iter = TMP_4._p, block = $iter || nil; + TMP_4._p = null; - if (block === nil) { - return self.$enum_for("collect!")}; + if ((block !== nil)) { + } else { + return self.$enum_for("collect!") + }; for (var i = 0, length = self.length; i < length; i++) { var value = Opal.$yield1(block, self[i]); @@ -4981,6 +5610,7 @@ def.$compact = function() { var self = this; + var result = []; @@ -4996,6 +5626,7 @@ def['$compact!'] = function() { var self = this; + var original = self.length; @@ -5014,7 +5645,8 @@ def.$concat = function(other) { var $a, self = this; - if (($a = $scope.Array['$==='](other)) !== false && $a !== nil) { + + if ((($a = $scope.Array['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { other = other.$to_a() } else { other = $scope.Opal.$coerce_to(other, $scope.Array, "to_ary").$to_a() @@ -5029,6 +5661,7 @@ def.$delete = function(object) { var self = this; + var original = self.length; @@ -5047,7 +5680,10 @@ def.$delete_at = function(index) { var self = this; + + index = $scope.Opal.$coerce_to(index, $scope.Integer, "to_int"); + if (index < 0) { index += self.length; } @@ -5061,14 +5697,17 @@ self.splice(index, 1); return result; - + ; }; def.$delete_if = TMP_5 = function() { var self = this, $iter = TMP_5._p, block = $iter || nil; + TMP_5._p = null; - if (block === nil) { - return self.$enum_for("delete_if")}; + if ((block !== nil)) { + } else { + return self.$enum_for("delete_if") + }; for (var i = 0, length = self.length, value; i < length; i++) { if ((value = block(self[i])) === $breaker) { @@ -5088,6 +5727,7 @@ def.$drop = function(number) { var self = this; + if (number < 0) { self.$raise($scope.ArgumentError) @@ -5101,9 +5741,12 @@ def.$each = TMP_6 = function() { var self = this, $iter = TMP_6._p, block = $iter || nil; + TMP_6._p = null; - if (block === nil) { - return self.$enum_for("each")}; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; for (var i = 0, length = self.length; i < length; i++) { var value = $opal.$yield1(block, self[i]); @@ -5118,9 +5761,12 @@ def.$each_index = TMP_7 = function() { var self = this, $iter = TMP_7._p, block = $iter || nil; + TMP_7._p = null; - if (block === nil) { - return self.$enum_for("each_index")}; + if ((block !== nil)) { + } else { + return self.$enum_for("each_index") + }; for (var i = 0, length = self.length; i < length; i++) { var value = $opal.$yield1(block, i); @@ -5135,18 +5781,24 @@ def['$empty?'] = function() { var self = this; + return self.length === 0; }; def['$eql?'] = function(other) { var $a, self = this; - if (($a = self === other) !== false && $a !== nil) { + + if ((($a = self === other) !== nil && (!$a._isBoolean || $a == true))) { return true}; - if (($a = $scope.Array['$==='](other)) === false || $a === nil) { - return false}; + if ((($a = $scope.Array['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; other = other.$to_a(); - if (($a = self.length === other.length) === false || $a === nil) { - return false}; + if ((($a = self.length === other.length) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; for (var i = 0, length = self.length; i < length; i++) { var a = self[i], @@ -5166,10 +5818,13 @@ def.$fetch = TMP_8 = function(index, defaults) { var self = this, $iter = TMP_8._p, block = $iter || nil; + TMP_8._p = null; var original = index; + index = $scope.Opal.$coerce_to(index, $scope.Integer, "to_int"); + if (index < 0) { index += self.length; } @@ -5197,43 +5852,46 @@ def.$fill = TMP_9 = function(args) { var $a, self = this, $iter = TMP_9._p, block = $iter || nil, one = nil, two = nil, obj = nil, left = nil, right = nil; + args = $slice.call(arguments, 0); TMP_9._p = null; if (block !== false && block !== nil) { - if (($a = args.length > 2) !== false && $a !== nil) { + if ((($a = args.length > 2) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "wrong number of arguments (" + (args.$length()) + " for 0..2)")}; $a = $opal.to_ary(args), one = ($a[0] == null ? nil : $a[0]), two = ($a[1] == null ? nil : $a[1]); } else { - if (($a = args.length == 0) !== false && $a !== nil) { + if ((($a = args.length == 0) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "wrong number of arguments (0 for 1..3)") - } else if (($a = args.length > 3) !== false && $a !== nil) { + } else if ((($a = args.length > 3) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "wrong number of arguments (" + (args.$length()) + " for 1..3)")}; $a = $opal.to_ary(args), obj = ($a[0] == null ? nil : $a[0]), one = ($a[1] == null ? nil : $a[1]), two = ($a[2] == null ? nil : $a[2]); }; - if (($a = $scope.Range['$==='](one)) !== false && $a !== nil) { + if ((($a = $scope.Range['$==='](one)) !== nil && (!$a._isBoolean || $a == true))) { if (two !== false && two !== nil) { self.$raise($scope.TypeError, "length invalid with range")}; left = $scope.Opal.$coerce_to(one.$begin(), $scope.Integer, "to_int"); - if (($a = left < 0) !== false && $a !== nil) { + if ((($a = left < 0) !== nil && (!$a._isBoolean || $a == true))) { left += self.length;}; - if (($a = left < 0) !== false && $a !== nil) { + if ((($a = left < 0) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.RangeError, "" + (one.$inspect()) + " out of range")}; right = $scope.Opal.$coerce_to(one.$end(), $scope.Integer, "to_int"); - if (($a = right < 0) !== false && $a !== nil) { + if ((($a = right < 0) !== nil && (!$a._isBoolean || $a == true))) { right += self.length;}; - if (($a = one['$exclude_end?']()) === false || $a === nil) { - right += 1;}; - if (($a = right <= left) !== false && $a !== nil) { + if ((($a = one['$exclude_end?']()) !== nil && (!$a._isBoolean || $a == true))) { + } else { + right += 1; + }; + if ((($a = right <= left) !== nil && (!$a._isBoolean || $a == true))) { return self}; } else if (one !== false && one !== nil) { left = $scope.Opal.$coerce_to(one, $scope.Integer, "to_int"); - if (($a = left < 0) !== false && $a !== nil) { + if ((($a = left < 0) !== nil && (!$a._isBoolean || $a == true))) { left += self.length;}; - if (($a = left < 0) !== false && $a !== nil) { + if ((($a = left < 0) !== nil && (!$a._isBoolean || $a == true))) { left = 0}; if (two !== false && two !== nil) { right = $scope.Opal.$coerce_to(two, $scope.Integer, "to_int"); - if (($a = right == 0) !== false && $a !== nil) { + if ((($a = right == 0) !== nil && (!$a._isBoolean || $a == true))) { return self}; right += left; } else { @@ -5243,15 +5901,13 @@ left = 0; right = self.length; }; - $scope.Opal['$fits_fixnum!'](right); - $scope.Opal['$fits_array!'](right); - if (($a = left > self.length) !== false && $a !== nil) { + if ((($a = left > self.length) !== nil && (!$a._isBoolean || $a == true))) { for (var i = self.length; i < right; i++) { self[i] = nil; } ;}; - if (($a = right > self.length) !== false && $a !== nil) { + if ((($a = right > self.length) !== nil && (!$a._isBoolean || $a == true))) { self.length = right}; if (block !== false && block !== nil) { @@ -5277,29 +5933,32 @@ def.$first = function(count) { var self = this; + - if (count != null) { + if (count == null) { + return self.length === 0 ? nil : self[0]; + } - if (count < 0) { - self.$raise($scope.ArgumentError); - } + count = $scope.Opal.$coerce_to(count, $scope.Integer, "to_int"); - return self.slice(0, count); + if (count < 0) { + self.$raise($scope.ArgumentError, "negative array size"); } - return self.length === 0 ? nil : self[0]; - ; + return self.slice(0, count); + }; def.$flatten = function(level) { var self = this; + var result = []; for (var i = 0, length = self.length; i < length; i++) { var item = self[i]; - if ((item)['$respond_to?']("to_ary")) { + if ($scope.Opal['$respond_to?'](item, "to_ary")) { item = (item).$to_ary(); if (level == null) { @@ -5323,6 +5982,7 @@ def['$flatten!'] = function(level) { var self = this; + var flattened = self.$flatten(level); @@ -5345,11 +6005,13 @@ def.$hash = function() { var self = this; + return self._id || (self._id = Opal.uid()); }; def['$include?'] = function(member) { var self = this; + for (var i = 0, length = self.length; i < length; i++) { if ((self[i])['$=='](member)) { @@ -5363,6 +6025,7 @@ def.$index = TMP_10 = function(object) { var self = this, $iter = TMP_10._p, block = $iter || nil; + TMP_10._p = null; if (object != null) { @@ -5393,8 +6056,11 @@ def.$insert = function(index, objects) { var self = this; + objects = $slice.call(arguments, 1); + index = $scope.Opal.$coerce_to(index, $scope.Integer, "to_int"); + if (objects.length > 0) { if (index < 0) { index += self.length + 1; @@ -5411,12 +6077,13 @@ self.splice.apply(self, [index, 0].concat(objects)); } - + ; return self; }; def.$inspect = function() { var self = this; + var i, inspect, el, el_insp, length, object_id; @@ -5437,26 +6104,72 @@ }; def.$join = function(sep) { - var self = this; + var $a, self = this; + if ($gvars[","] == null) $gvars[","] = nil; + if (sep == null) { - sep = "" + sep = nil } + if ((($a = self.length === 0) !== nil && (!$a._isBoolean || $a == true))) { + return ""}; + if ((($a = sep === nil) !== nil && (!$a._isBoolean || $a == true))) { + sep = $gvars[","]}; var result = []; for (var i = 0, length = self.length; i < length; i++) { - result.push((self[i]).$to_s()); + var item = self[i]; + + if ($scope.Opal['$respond_to?'](item, "to_str")) { + var tmp = (item).$to_str(); + + if (tmp !== nil) { + result.push((tmp).$to_s()); + + continue; + } + } + + if ($scope.Opal['$respond_to?'](item, "to_ary")) { + var tmp = (item).$to_ary(); + + if (tmp !== nil) { + result.push((tmp).$join(sep)); + + continue; + } + } + + if ($scope.Opal['$respond_to?'](item, "to_s")) { + var tmp = (item).$to_s(); + + if (tmp !== nil) { + result.push(tmp); + + continue; + } + } + + self.$raise($scope.NoMethodError, "" + ($scope.Opal.$inspect(item)) + " doesn't respond to #to_str, #to_ary or #to_s"); } - return result.join(sep); - + if (sep === nil) { + return result.join(''); + } + else { + return result.join($scope.Opal['$coerce_to!'](sep, $scope.String, "to_str").$to_s()); + } + ; }; def.$keep_if = TMP_11 = function() { var self = this, $iter = TMP_11._p, block = $iter || nil; + TMP_11._p = null; - if (block === nil) { - return self.$enum_for("keep_if")}; + if ((block !== nil)) { + } else { + return self.$enum_for("keep_if") + }; for (var i = 0, length = self.length, value; i < length; i++) { if ((value = block(self[i])) === $breaker) { @@ -5476,39 +6189,29 @@ def.$last = function(count) { var self = this; - - var length = self.length; - if (count === nil || typeof(count) == 'string') { - self.$raise($scope.TypeError, "no implicit conversion to integer"); + + if (count == null) { + return self.length === 0 ? nil : self[self.length - 1]; } - if (typeof(count) == 'object') { - if (count['$respond_to?']("to_int")) { - count = count['$to_int'](); - } - else { - self.$raise($scope.TypeError, "no implicit conversion to integer"); - } - } + count = $scope.Opal.$coerce_to(count, $scope.Integer, "to_int"); - if (count == null) { - return length === 0 ? nil : self[length - 1]; - } - else if (count < 0) { - self.$raise($scope.ArgumentError, "negative count given"); + if (count < 0) { + self.$raise($scope.ArgumentError, "negative array size"); } - if (count > length) { - count = length; + if (count > self.length) { + count = self.length; } - return self.slice(length - count, length); + return self.slice(self.length - count, self.length); }; def.$length = function() { var self = this; + return self.length; }; @@ -5517,24 +6220,27 @@ $opal.defn(self, '$map!', def['$collect!']); def.$pop = function(count) { - var self = this; - - var length = self.length; - - if (count == null) { - return length === 0 ? nil : self.pop(); - } - - if (count < 0) { - self.$raise($scope.ArgumentError, "negative count given"); - } + var $a, self = this; - return count > length ? self.splice(0, self.length) : self.splice(length - count, length); - + if ((($a = count === undefined) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = self.length === 0) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + return self.pop();}; + count = $scope.Opal.$coerce_to(count, $scope.Integer, "to_int"); + if ((($a = count < 0) !== nil && (!$a._isBoolean || $a == true))) { + self.$raise($scope.ArgumentError, "negative array size")}; + if ((($a = self.length === 0) !== nil && (!$a._isBoolean || $a == true))) { + return []}; + if ((($a = count > self.length) !== nil && (!$a._isBoolean || $a == true))) { + return self.splice(0, self.length); + } else { + return self.splice(self.length - count, self.length); + }; }; def.$push = function(objects) { var self = this; + objects = $slice.call(arguments, 0); for (var i = 0, length = objects.length; i < length; i++) { @@ -5546,6 +6252,7 @@ def.$rassoc = function(object) { var self = this; + for (var i = 0, length = self.length, item; i < length; i++) { item = self[i]; @@ -5563,9 +6270,12 @@ def.$reject = TMP_12 = function() { var self = this, $iter = TMP_12._p, block = $iter || nil; + TMP_12._p = null; - if (block === nil) { - return self.$enum_for("reject")}; + if ((block !== nil)) { + } else { + return self.$enum_for("reject") + }; var result = []; @@ -5583,20 +6293,26 @@ }; def['$reject!'] = TMP_13 = function() { - var $a, $b, self = this, $iter = TMP_13._p, block = $iter || nil; + var $a, $b, self = this, $iter = TMP_13._p, block = $iter || nil, original = nil; + TMP_13._p = null; - if (block === nil) { - return self.$enum_for("reject!")}; - - var original = self.length; + if ((block !== nil)) { + } else { + return self.$enum_for("reject!") + }; + original = self.$length(); ($a = ($b = self).$delete_if, $a._p = block.$to_proc(), $a).call($b); - return self.length === original ? nil : self; - + if (self.$length()['$=='](original)) { + return nil + } else { + return self + }; }; def.$replace = function(other) { var $a, self = this; - if (($a = $scope.Array['$==='](other)) !== false && $a !== nil) { + + if ((($a = $scope.Array['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { other = other.$to_a() } else { other = $scope.Opal.$coerce_to(other, $scope.Array, "to_ary").$to_a() @@ -5610,25 +6326,31 @@ def.$reverse = function() { var self = this; + return self.slice(0).reverse(); }; def['$reverse!'] = function() { var self = this; + return self.reverse(); }; def.$reverse_each = TMP_14 = function() { var $a, $b, self = this, $iter = TMP_14._p, block = $iter || nil; + TMP_14._p = null; - if (block === nil) { - return self.$enum_for("reverse_each")}; - ($a = ($b = self.$reverse()).$each, $a._p = block.$to_proc(), $a).call($b); + if ((block !== nil)) { + } else { + return self.$enum_for("reverse_each") + }; + ($a = ($b = self.$reverse()).$each, $a._p = block.$to_proc(), $a).call($b); return self; }; def.$rindex = TMP_15 = function(object) { var self = this, $iter = TMP_15._p, block = $iter || nil; + TMP_15._p = null; if (object != null) { @@ -5658,16 +6380,18 @@ }; def.$sample = function(n) { - var $a, $b, $c, TMP_16, self = this; + var $a, $b, TMP_16, self = this; + if (n == null) { n = nil } - if (($a = ($b = ($c = n, ($c === nil || $c === false)), $b !== false && $b !== nil ?self['$empty?']() : $b)) !== false && $a !== nil) { + if ((($a = ($b = n['$!'](), $b !== false && $b !== nil ?self['$empty?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { return nil}; - if (($a = (($b = n !== false && n !== nil) ? self['$empty?']() : $b)) !== false && $a !== nil) { + if ((($a = (($b = n !== false && n !== nil) ? self['$empty?']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { return []}; if (n !== false && n !== nil) { return ($a = ($b = ($range(1, n, false))).$map, $a._p = (TMP_16 = function(){var self = TMP_16._s || this; + return self['$[]'](self.$rand(self.$length()))}, TMP_16._s = self, TMP_16), $a).call($b) } else { return self['$[]'](self.$rand(self.$length())) @@ -5676,9 +6400,12 @@ def.$select = TMP_17 = function() { var self = this, $iter = TMP_17._p, block = $iter || nil; + TMP_17._p = null; - if (block === nil) { - return self.$enum_for("select")}; + if ((block !== nil)) { + } else { + return self.$enum_for("select") + }; var result = []; @@ -5700,9 +6427,12 @@ def['$select!'] = TMP_18 = function() { var $a, $b, self = this, $iter = TMP_18._p, block = $iter || nil; + TMP_18._p = null; - if (block === nil) { - return self.$enum_for("select!")}; + if ((block !== nil)) { + } else { + return self.$enum_for("select!") + }; var original = self.length; ($a = ($b = self).$keep_if, $a._p = block.$to_proc(), $a).call($b); @@ -5711,25 +6441,31 @@ }; def.$shift = function(count) { - var self = this; - - if (self.length === 0) { - return nil; - } + var $a, self = this; - return count == null ? self.shift() : self.splice(0, count) - + if ((($a = count === undefined) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = self.length === 0) !== nil && (!$a._isBoolean || $a == true))) { + return nil}; + return self.shift();}; + count = $scope.Opal.$coerce_to(count, $scope.Integer, "to_int"); + if ((($a = count < 0) !== nil && (!$a._isBoolean || $a == true))) { + self.$raise($scope.ArgumentError, "negative array size")}; + if ((($a = self.length === 0) !== nil && (!$a._isBoolean || $a == true))) { + return []}; + return self.splice(0, count); }; $opal.defn(self, '$size', def.$length); def.$shuffle = function() { var self = this; + return self.$clone()['$shuffle!'](); }; def['$shuffle!'] = function() { var self = this; + for (var i = self.length - 1; i > 0; i--) { var tmp = self[i], @@ -5746,6 +6482,7 @@ def['$slice!'] = function(index, length) { var self = this; + if (index < 0) { index += self.length; @@ -5765,9 +6502,12 @@ def.$sort = TMP_19 = function() { var $a, self = this, $iter = TMP_19._p, block = $iter || nil; + TMP_19._p = null; - if (($a = self.length > 1) === false || $a === nil) { - return self}; + if ((($a = self.length > 1) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return self + }; if (!(block !== nil)) { block = function(a, b) { @@ -5802,6 +6542,7 @@ def['$sort!'] = TMP_20 = function() { var $a, $b, self = this, $iter = TMP_20._p, block = $iter || nil; + TMP_20._p = null; var result; @@ -5824,6 +6565,7 @@ def.$take = function(count) { var self = this; + if (count < 0) { self.$raise($scope.ArgumentError); @@ -5835,6 +6577,7 @@ def.$take_while = TMP_21 = function() { var self = this, $iter = TMP_21._p, block = $iter || nil; + TMP_21._p = null; var result = []; @@ -5859,6 +6602,7 @@ def.$to_a = function() { var self = this; + return self; }; @@ -5868,20 +6612,23 @@ def.$transpose = function() { var $a, $b, TMP_22, self = this, result = nil, max = nil; - if (($a = self['$empty?']()) !== false && $a !== nil) { + + if ((($a = self['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { return []}; result = []; max = nil; - ($a = ($b = self).$each, $a._p = (TMP_22 = function(row){var self = TMP_22._s || this, $a, $b, TMP_23;if (row == null) row = nil; - if (($a = $scope.Array['$==='](row)) !== false && $a !== nil) { + ($a = ($b = self).$each, $a._p = (TMP_22 = function(row){var self = TMP_22._s || this, $a, $b, TMP_23; +if (row == null) row = nil; + if ((($a = $scope.Array['$==='](row)) !== nil && (!$a._isBoolean || $a == true))) { row = row.$to_a() } else { row = $scope.Opal.$coerce_to(row, $scope.Array, "to_ary").$to_a() }; ((($a = max) !== false && $a !== nil) ? $a : max = row.length); - if (($a = ($b = (row.length)['$=='](max), ($b === nil || $b === false))) !== false && $a !== nil) { + if ((($a = (row.length)['$=='](max)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.IndexError, "element size differs (" + (row.length) + " should be " + (max))}; - return ($a = ($b = (row.length)).$times, $a._p = (TMP_23 = function(i){var self = TMP_23._s || this, $a, $b, $c, entry = nil;if (i == null) i = nil; + return ($a = ($b = (row.length)).$times, $a._p = (TMP_23 = function(i){var self = TMP_23._s || this, $a, $b, $c, entry = nil; +if (i == null) i = nil; entry = (($a = i, $b = result, ((($c = $b['$[]']($a)) !== false && $c !== nil) ? $c : $b['$[]=']($a, [])))); return entry['$<<'](row.$at(i));}, TMP_23._s = self, TMP_23), $a).call($b);}, TMP_22._s = self, TMP_22), $a).call($b); return result; @@ -5889,6 +6636,7 @@ def.$uniq = function() { var self = this; + var result = [], seen = {}; @@ -5910,6 +6658,7 @@ def['$uniq!'] = function() { var self = this; + var original = self.length, seen = {}; @@ -5935,6 +6684,7 @@ def.$unshift = function(objects) { var self = this; + objects = $slice.call(arguments, 0); for (var i = objects.length - 1; i >= 0; i--) { @@ -5946,6 +6696,7 @@ return (def.$zip = TMP_24 = function(others) { var self = this, $iter = TMP_24._p, block = $iter || nil; + others = $slice.call(arguments, 0); TMP_24._p = null; @@ -5977,29 +6728,59 @@ return result; - }, nil); + }, nil) && 'zip'; + })(self, null); +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + (function($base, $super) { + function $Array(){}; + var self = $Array = $klass($base, $super, 'Array', $Array); + + var def = self._proto, $scope = self._scope; + + return ($opal.defs(self, '$inherited', function(klass) { + var self = this, replace = nil; + + replace = $scope.Class.$new(($scope.Array)._scope.Wrapper); + + klass._proto = replace._proto; + klass._proto._klass = klass; + klass._alloc = replace._alloc; + klass.__parent = ($scope.Array)._scope.Wrapper; + + klass.$allocate = replace.$allocate; + klass.$new = replace.$new; + klass["$[]"] = replace["$[]"]; + + }), nil) && 'inherited' })(self, null); return (function($base, $super) { function $Wrapper(){}; var self = $Wrapper = $klass($base, $super, 'Wrapper', $Wrapper); - var def = $Wrapper._proto, $scope = $Wrapper._scope, TMP_25, TMP_26, TMP_27, TMP_28, TMP_29; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5; + def.literal = nil; - $opal.defs(self, '$allocate', TMP_25 = function(array) { - var self = this, $iter = TMP_25._p, $yield = $iter || nil, obj = nil; + $opal.defs(self, '$allocate', TMP_1 = function(array) { + var self = this, $iter = TMP_1._p, $yield = $iter || nil, obj = nil; + if (array == null) { array = [] } - TMP_25._p = null; - obj = $opal.find_super_dispatcher(self, 'allocate', TMP_25, null, $Wrapper).apply(self, []); + TMP_1._p = null; + obj = $opal.find_super_dispatcher(self, 'allocate', TMP_1, null, $Wrapper).apply(self, []); obj.literal = array; return obj; }); - $opal.defs(self, '$new', TMP_26 = function(args) { - var $a, $b, self = this, $iter = TMP_26._p, block = $iter || nil, obj = nil; + $opal.defs(self, '$new', TMP_2 = function(args) { + var $a, $b, self = this, $iter = TMP_2._p, block = $iter || nil, obj = nil; + args = $slice.call(arguments, 0); - TMP_26._p = null; + TMP_2._p = null; obj = self.$allocate(); ($a = ($b = obj).$initialize, $a._p = block.$to_proc(), $a).apply($b, [].concat(args)); return obj; @@ -6007,23 +6788,26 @@ $opal.defs(self, '$[]', function(objects) { var self = this; + objects = $slice.call(arguments, 0); return self.$allocate(objects); }); - def.$initialize = TMP_27 = function(args) { - var $a, $b, self = this, $iter = TMP_27._p, block = $iter || nil; + def.$initialize = TMP_3 = function(args) { + var $a, $b, self = this, $iter = TMP_3._p, block = $iter || nil; + args = $slice.call(arguments, 0); - TMP_27._p = null; + TMP_3._p = null; return self.literal = ($a = ($b = $scope.Array).$new, $a._p = block.$to_proc(), $a).apply($b, [].concat(args)); }; - def.$method_missing = TMP_28 = function(args) { - var $a, $b, self = this, $iter = TMP_28._p, block = $iter || nil, result = nil; + def.$method_missing = TMP_4 = function(args) { + var $a, $b, self = this, $iter = TMP_4._p, block = $iter || nil, result = nil; + args = $slice.call(arguments, 0); - TMP_28._p = null; + TMP_4._p = null; result = ($a = ($b = self.literal).$__send__, $a._p = block.$to_proc(), $a).apply($b, [].concat(args)); - if (($a = result === self.literal) !== false && $a !== nil) { + if ((($a = result === self.literal) !== nil && (!$a._isBoolean || $a == true))) { return self } else { return result @@ -6032,42 +6816,50 @@ def.$initialize_copy = function(other) { var self = this; + return self.literal = (other.literal).$clone(); }; - def['$respond_to?'] = TMP_29 = function(name) {var $zuper = $slice.call(arguments, 0); - var $a, self = this, $iter = TMP_29._p, $yield = $iter || nil; - TMP_29._p = null; - return ((($a = $opal.find_super_dispatcher(self, 'respond_to?', TMP_29, $iter).apply(self, $zuper)) !== false && $a !== nil) ? $a : self.literal['$respond_to?'](name)); + def['$respond_to?'] = TMP_5 = function(name) {var $zuper = $slice.call(arguments, 0); + var $a, self = this, $iter = TMP_5._p, $yield = $iter || nil; + + TMP_5._p = null; + return ((($a = $opal.find_super_dispatcher(self, 'respond_to?', TMP_5, $iter).apply(self, $zuper)) !== false && $a !== nil) ? $a : self.literal['$respond_to?'](name)); }; def['$=='] = function(other) { var self = this; + return self.literal['$=='](other); }; def['$eql?'] = function(other) { var self = this; + return self.literal['$eql?'](other); }; def.$to_a = function() { var self = this; + return self.literal; }; def.$to_ary = function() { var self = this; + return self; }; def.$inspect = function() { var self = this; + return self.literal.$inspect(); }; def['$*'] = function(other) { var self = this; + var result = self.literal['$*'](other); @@ -6082,6 +6874,7 @@ def['$[]'] = function(index, length) { var self = this; + var result = self.literal.$slice(index, length); @@ -6098,41 +6891,48 @@ def.$uniq = function() { var self = this; + return self.$class().$allocate(self.literal.$uniq()); }; return (def.$flatten = function(level) { var self = this; + return self.$class().$allocate(self.literal.$flatten(level)); - }, nil); + }, nil) && 'flatten'; })($scope.Array, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + ; return (function($base, $super) { function $Hash(){}; var self = $Hash = $klass($base, $super, 'Hash', $Hash); - var def = $Hash._proto, $scope = $Hash._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7, TMP_8, TMP_9, TMP_10, TMP_11, TMP_12, TMP_13; + def.proc = def.none = nil; self.$include($scope.Enumerable); - var $hasOwn = {}.hasOwnProperty; - $opal.defs(self, '$[]', function(objs) { var self = this; + objs = $slice.call(arguments, 0); return $opal.hash.apply(null, objs); }); $opal.defs(self, '$allocate', function() { var self = this; + var hash = new self._alloc; hash.map = {}; hash.keys = []; + hash.none = nil; + hash.proc = nil; return hash; @@ -6140,21 +6940,18 @@ def.$initialize = TMP_1 = function(defaults) { var self = this, $iter = TMP_1._p, block = $iter || nil; + TMP_1._p = null; - if (defaults != null) { - self.none = defaults; - } - else if (block !== nil) { - self.proc = block; - } - - return self; + self.none = (defaults === undefined ? nil : defaults); + self.proc = block; + return self; }; def['$=='] = function(other) { - var $a, self = this; + var self = this; + if (self === other) { return true; @@ -6173,8 +6970,7 @@ for (var i = 0, length = self.keys.length; i < length; i++) { var key = self.keys[i], obj = map[key], obj2 = map2[key]; - - if (($a = (obj)['$=='](obj2), ($a === nil || $a === false))) { + if (obj2 === undefined || (obj)['$=='](obj2)['$!']()) { return false; } } @@ -6185,10 +6981,11 @@ def['$[]'] = function(key) { var self = this; + var map = self.map; - if ($hasOwn.call(map, key)) { + if ($opal.hasOwnProperty.call(map, key)) { return map[key]; } @@ -6204,10 +7001,11 @@ def['$[]='] = function(key, value) { var self = this; + var map = self.map; - if (!$hasOwn.call(map, key)) { + if (!$opal.hasOwnProperty.call(map, key)) { self.keys.push(key); } @@ -6219,6 +7017,7 @@ def.$assoc = function(object) { var self = this; + var keys = self.keys, key; @@ -6236,6 +7035,7 @@ def.$clear = function() { var self = this; + self.map = {}; self.keys = []; @@ -6245,6 +7045,7 @@ def.$clone = function() { var self = this; + var map = {}, keys = []; @@ -6270,26 +7071,50 @@ def.$default = function(val) { var self = this; + + + if (val !== undefined && self.proc !== nil) { + return self.proc.$call(self, val); + } return self.none; + ; }; def['$default='] = function(object) { var self = this; - return self.none = object; + + + self.proc = nil; + return (self.none = object); + }; def.$default_proc = function() { var self = this; + return self.proc; }; def['$default_proc='] = function(proc) { var self = this; - return self.proc = proc; + + + if (proc !== nil) { + proc = $scope.Opal['$coerce_to!'](proc, $scope.Proc, "to_proc"); + + if (proc['$lambda?']() && proc.$arity().$abs() != 2) { + self.$raise($scope.TypeError, "default_proc takes two arguments"); + } + } + self.none = nil; + return (self.proc = proc); + ; }; - def.$delete = function(key) { - var self = this; + def.$delete = TMP_2 = function(key) { + var self = this, $iter = TMP_2._p, block = $iter || nil; + + TMP_2._p = null; var map = self.map, result = map[key]; @@ -6300,15 +7125,21 @@ return result; } + if (block !== nil) { + return block.$call(key); + } return nil; }; - def.$delete_if = TMP_2 = function() { - var $a, self = this, $iter = TMP_2._p, block = $iter || nil; - TMP_2._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("delete_if")}; + def.$delete_if = TMP_3 = function() { + var self = this, $iter = TMP_3._p, block = $iter || nil; + + TMP_3._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("delete_if") + }; var map = self.map, keys = self.keys, value; @@ -6334,11 +7165,14 @@ $opal.defn(self, '$dup', def.$clone); - def.$each = TMP_3 = function() { - var $a, self = this, $iter = TMP_3._p, block = $iter || nil; - TMP_3._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("each")}; + def.$each = TMP_4 = function() { + var self = this, $iter = TMP_4._p, block = $iter || nil; + + TMP_4._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("each") + }; var map = self.map, keys = self.keys; @@ -6356,11 +7190,14 @@ }; - def.$each_key = TMP_4 = function() { - var $a, self = this, $iter = TMP_4._p, block = $iter || nil; - TMP_4._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("each_key")}; + def.$each_key = TMP_5 = function() { + var self = this, $iter = TMP_5._p, block = $iter || nil; + + TMP_5._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("each_key") + }; var keys = self.keys; @@ -6378,11 +7215,14 @@ $opal.defn(self, '$each_pair', def.$each); - def.$each_value = TMP_5 = function() { - var $a, self = this, $iter = TMP_5._p, block = $iter || nil; - TMP_5._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("each_value")}; + def.$each_value = TMP_6 = function() { + var self = this, $iter = TMP_6._p, block = $iter || nil; + + TMP_6._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("each_value") + }; var map = self.map, keys = self.keys; @@ -6398,14 +7238,16 @@ def['$empty?'] = function() { var self = this; + return self.keys.length === 0; }; $opal.defn(self, '$eql?', def['$==']); - def.$fetch = TMP_6 = function(key, defaults) { - var self = this, $iter = TMP_6._p, block = $iter || nil; - TMP_6._p = null; + def.$fetch = TMP_7 = function(key, defaults) { + var self = this, $iter = TMP_7._p, block = $iter || nil; + + TMP_7._p = null; var value = self.map[key]; @@ -6433,6 +7275,7 @@ def.$flatten = function(level) { var self = this; + var map = self.map, keys = self.keys, result = []; @@ -6460,11 +7303,13 @@ def['$has_key?'] = function(key) { var self = this; - return $hasOwn.call(self.map, key); + + return $opal.hasOwnProperty.call(self.map, key); }; def['$has_value?'] = function(value) { var self = this; + for (var assoc in self.map) { if ((self.map[assoc])['$=='](value)) { @@ -6478,6 +7323,7 @@ def.$hash = function() { var self = this; + return self._id; }; @@ -6485,6 +7331,7 @@ def.$index = function(object) { var self = this; + var map = self.map, keys = self.keys; @@ -6502,6 +7349,7 @@ def.$indexes = function(keys) { var self = this; + keys = $slice.call(arguments, 0); var result = [], map = self.map, val; @@ -6525,6 +7373,7 @@ def.$inspect = function() { var self = this; + var inspect = [], keys = self.keys, map = self.map; @@ -6544,6 +7393,7 @@ def.$invert = function() { var self = this; + var result = $opal.hash(), keys = self.keys, map = self.map, keys2 = result.keys, map2 = result.map; @@ -6559,11 +7409,14 @@ }; - def.$keep_if = TMP_7 = function() { - var $a, self = this, $iter = TMP_7._p, block = $iter || nil; - TMP_7._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("keep_if")}; + def.$keep_if = TMP_8 = function() { + var self = this, $iter = TMP_8._p, block = $iter || nil; + + TMP_8._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("keep_if") + }; var map = self.map, keys = self.keys, value; @@ -6593,20 +7446,27 @@ def.$keys = function() { var self = this; + return self.keys.slice(0); }; def.$length = function() { var self = this; + return self.keys.length; }; $opal.defn(self, '$member?', def['$has_key?']); - def.$merge = TMP_8 = function(other) { - var self = this, $iter = TMP_8._p, block = $iter || nil; - TMP_8._p = null; + def.$merge = TMP_9 = function(other) { + var self = this, $iter = TMP_9._p, block = $iter || nil; + + TMP_9._p = null; + if (! $scope.Hash['$==='](other)) { + other = $scope.Opal['$coerce_to!'](other, $scope.Hash, "to_hash"); + } + var keys = self.keys, map = self.map, result = $opal.hash(), keys2 = result.keys, map2 = result.map; @@ -6645,13 +7505,18 @@ } return result; - + ; }; - def['$merge!'] = TMP_9 = function(other) { - var self = this, $iter = TMP_9._p, block = $iter || nil; - TMP_9._p = null; + def['$merge!'] = TMP_10 = function(other) { + var self = this, $iter = TMP_10._p, block = $iter || nil; + + TMP_10._p = null; + if (! $scope.Hash['$==='](other)) { + other = $scope.Opal['$coerce_to!'](other, $scope.Hash, "to_hash"); + } + var keys = self.keys, map = self.map, keys2 = other.keys, map2 = other.map; @@ -6681,11 +7546,12 @@ } return self; - + ; }; def.$rassoc = function(object) { var self = this; + var keys = self.keys, map = self.map; @@ -6701,11 +7567,14 @@ }; - def.$reject = TMP_10 = function() { - var $a, self = this, $iter = TMP_10._p, block = $iter || nil; - TMP_10._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("reject")}; + def.$reject = TMP_11 = function() { + var self = this, $iter = TMP_11._p, block = $iter || nil; + + TMP_11._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("reject") + }; var keys = self.keys, map = self.map, result = $opal.hash(), map2 = result.map, keys2 = result.keys; @@ -6729,6 +7598,7 @@ def.$replace = function(other) { var self = this; + var map = self.map = {}, keys = self.keys = []; @@ -6742,11 +7612,14 @@ }; - def.$select = TMP_11 = function() { - var $a, self = this, $iter = TMP_11._p, block = $iter || nil; - TMP_11._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("select")}; + def.$select = TMP_12 = function() { + var self = this, $iter = TMP_12._p, block = $iter || nil; + + TMP_12._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("select") + }; var keys = self.keys, map = self.map, result = $opal.hash(), map2 = result.map, keys2 = result.keys; @@ -6768,11 +7641,14 @@ }; - def['$select!'] = TMP_12 = function() { - var $a, self = this, $iter = TMP_12._p, block = $iter || nil; - TMP_12._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("select!")}; + def['$select!'] = TMP_13 = function() { + var self = this, $iter = TMP_13._p, block = $iter || nil; + + TMP_13._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("select!") + }; var map = self.map, keys = self.keys, value, result = nil; @@ -6799,6 +7675,7 @@ def.$shift = function() { var self = this; + var keys = self.keys, map = self.map; @@ -6821,6 +7698,7 @@ def.$to_a = function() { var self = this; + var keys = self.keys, map = self.map, result = []; @@ -6835,6 +7713,7 @@ def.$to_h = function() { var self = this; + var hash = new Opal.Hash._alloc, cloned = self.$clone(); @@ -6850,6 +7729,7 @@ def.$to_hash = function() { var self = this; + return self; }; @@ -6863,6 +7743,7 @@ return (def.$values = function() { var self = this; + var map = self.map, result = []; @@ -6873,17 +7754,20 @@ return result; - }, nil); - })(self, null) + }, nil) && 'values'; + })(self, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $gvars = $opal.gvars; + + ; (function($base, $super) { function $String(){}; var self = $String = $klass($base, $super, 'String', $String); - var def = $String._proto, $scope = $String._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6, TMP_7; + def.length = nil; self.$include($scope.Comparable); @@ -6891,6 +7775,7 @@ $opal.defs(self, '$try_convert', function(what) { var self = this; + try { return what.$to_str() } catch ($err) {if (true) { @@ -6901,6 +7786,7 @@ $opal.defs(self, '$new', function(str) { var self = this; + if (str == null) { str = "" } @@ -6909,7 +7795,8 @@ def['$%'] = function(data) { var $a, self = this; - if (($a = $scope.Array['$==='](data)) !== false && $a !== nil) { + + if ((($a = $scope.Array['$==='](data)) !== nil && (!$a._isBoolean || $a == true))) { return ($a = self).$format.apply($a, [self].concat(data)) } else { return self.$format(self, data) @@ -6918,6 +7805,7 @@ def['$*'] = function(count) { var self = this; + if (count < 1) { return ''; @@ -6941,13 +7829,15 @@ def['$+'] = function(other) { var self = this; + other = $scope.Opal.$coerce_to(other, $scope.String, "to_str"); return self + other.$to_s(); }; def['$<=>'] = function(other) { var $a, self = this; - if (($a = other['$respond_to?']("to_str")) !== false && $a !== nil) { + + if ((($a = other['$respond_to?']("to_str")) !== nil && (!$a._isBoolean || $a == true))) { other = other.$to_str().$to_s(); return self > other ? 1 : (self < other ? -1 : 0); } else { @@ -6965,14 +7855,22 @@ }; def['$=='] = function(other) { - var self = this; - return !!(other._isString && self.valueOf() === other.valueOf()); + var $a, self = this; + + if ((($a = $scope.String['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; + return self.$to_s() == other.$to_s(); }; + $opal.defn(self, '$eql?', def['$==']); + $opal.defn(self, '$===', def['$==']); def['$=~'] = function(other) { var self = this; + if (other._isString) { self.$raise($scope.TypeError, "type mismatch: String given"); @@ -6984,6 +7882,7 @@ def['$[]'] = function(index, length) { var self = this; + var size = self.length; @@ -7039,25 +7938,28 @@ def.$capitalize = function() { var self = this; + return self.charAt(0).toUpperCase() + self.substr(1).toLowerCase(); }; def.$casecmp = function(other) { var self = this; + other = $scope.Opal.$coerce_to(other, $scope.String, "to_str").$to_s(); return (self.toLowerCase())['$<=>'](other.toLowerCase()); }; def.$center = function(width, padstr) { var $a, self = this; + if (padstr == null) { padstr = " " } width = $scope.Opal.$coerce_to(width, $scope.Integer, "to_int"); padstr = $scope.Opal.$coerce_to(padstr, $scope.String, "to_str").$to_s(); - if (($a = padstr['$empty?']()) !== false && $a !== nil) { + if ((($a = padstr['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "zero width padding")}; - if (($a = width <= self.length) !== false && $a !== nil) { + if ((($a = width <= self.length) !== nil && (!$a._isBoolean || $a == true))) { return self}; var ljustified = self.$ljust((width['$+'](self.length))['$/'](2).$ceil(), padstr), @@ -7067,17 +7969,25 @@ ; }; - def.$chars = function() { - var self = this; - return self.$each_char().$to_a(); + def.$chars = TMP_1 = function() { + var $a, $b, self = this, $iter = TMP_1._p, block = $iter || nil; + + TMP_1._p = null; + if (block !== false && block !== nil) { + } else { + return self.$each_char().$to_a() + }; + return ($a = ($b = self).$each_char, $a._p = block.$to_proc(), $a).call($b); }; def.$chomp = function(separator) { var $a, self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + if (separator == null) { separator = $gvars["/"] } - if (($a = separator === nil || self.length === 0) !== false && $a !== nil) { + if ((($a = separator === nil || self.length === 0) !== nil && (!$a._isBoolean || $a == true))) { return self}; separator = $scope.Opal['$coerce_to!'](separator, $scope.String, "to_str").$to_s(); @@ -7088,7 +7998,7 @@ return self.replace(/(\r?\n)+$/, ''); } else if (self.length > separator.length) { - var tail = self.substr(-1 * separator.length); + var tail = self.substr(self.length - separator.length, separator.length); if (tail === separator) { return self.substr(0, self.length - separator.length); @@ -7100,6 +8010,7 @@ def.$chop = function() { var self = this; + var length = self.length; @@ -7118,16 +8029,29 @@ def.$chr = function() { var self = this; + return self.charAt(0); }; def.$clone = function() { - var self = this; - return self.slice(); + var self = this, copy = nil; + + copy = self.slice(); + copy.$initialize_clone(self); + return copy; + }; + + def.$dup = function() { + var self = this, copy = nil; + + copy = self.slice(); + copy.$initialize_dup(self); + return copy; }; def.$count = function(str) { var self = this; + return (self.length - self.replace(new RegExp(str, 'g'), '').length) / str.length; }; @@ -7135,14 +8059,18 @@ def.$downcase = function() { var self = this; + return self.toLowerCase(); }; - def.$each_char = TMP_1 = function() { - var $a, self = this, $iter = TMP_1._p, block = $iter || nil; - TMP_1._p = null; - if (block === nil) { - return self.$enum_for("each_char")}; + def.$each_char = TMP_2 = function() { + var $a, self = this, $iter = TMP_2._p, block = $iter || nil; + + TMP_2._p = null; + if ((block !== nil)) { + } else { + return self.$enum_for("each_char") + }; for (var i = 0, length = self.length; i < length; i++) { ((($a = $opal.$yield1(block, self.charAt(i))) === $breaker) ? $breaker.$v : $a); @@ -7151,14 +8079,18 @@ return self; }; - def.$each_line = TMP_2 = function(separator) { - var $a, self = this, $iter = TMP_2._p, $yield = $iter || nil; + def.$each_line = TMP_3 = function(separator) { + var $a, self = this, $iter = TMP_3._p, $yield = $iter || nil; + if ($gvars["/"] == null) $gvars["/"] = nil; + if (separator == null) { separator = $gvars["/"] } - TMP_2._p = null; - if ($yield === nil) { - return self.$split(separator)}; + TMP_3._p = null; + if (($yield !== nil)) { + } else { + return self.$split(separator) + }; var chomped = self.$chomp(), trailing = self.length != chomped.length, @@ -7178,17 +8110,20 @@ def['$empty?'] = function() { var self = this; + return self.length === 0; }; def['$end_with?'] = function(suffixes) { var self = this; + suffixes = $slice.call(arguments, 0); for (var i = 0, length = suffixes.length; i < length; i++) { - var suffix = $scope.Opal.$coerce_to(suffixes[i], $scope.String, "to_str"); + var suffix = $scope.Opal.$coerce_to(suffixes[i], $scope.String, "to_str").$to_s(); - if (self.length >= suffix.length && self.substr(0 - suffix.length) === suffix) { + if (self.length >= suffix.length && + self.substr(self.length - suffix.length, suffix.length) == suffix) { return true; } } @@ -7200,13 +8135,16 @@ $opal.defn(self, '$equal?', def['$===']); - def.$gsub = TMP_3 = function(pattern, replace) { - var $a, $b, self = this, $iter = TMP_3._p, block = $iter || nil; - TMP_3._p = null; - if (($a = ((($b = $scope.String['$==='](pattern)) !== false && $b !== nil) ? $b : pattern['$respond_to?']("to_str"))) !== false && $a !== nil) { + def.$gsub = TMP_4 = function(pattern, replace) { + var $a, $b, self = this, $iter = TMP_4._p, block = $iter || nil; + + TMP_4._p = null; + if ((($a = ((($b = $scope.String['$==='](pattern)) !== false && $b !== nil) ? $b : pattern['$respond_to?']("to_str"))) !== nil && (!$a._isBoolean || $a == true))) { pattern = (new RegExp("" + $scope.Regexp.$escape(pattern.$to_str())))}; - if (($a = $scope.Regexp['$==='](pattern)) === false || $a === nil) { - self.$raise($scope.TypeError, "wrong argument type " + (pattern.$class()) + " (expected Regexp)")}; + if ((($a = $scope.Regexp['$==='](pattern)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; var pattern = pattern.toString(), options = pattern.substr(pattern.lastIndexOf('/') + 1) + 'g', @@ -7219,36 +8157,42 @@ def.$hash = function() { var self = this; + return self.toString(); }; def.$hex = function() { var self = this; + return self.$to_i(16); }; def['$include?'] = function(other) { var $a, self = this; + if (other._isString) { return self.indexOf(other) !== -1; } - if (($a = other['$respond_to?']("to_str")) === false || $a === nil) { - self.$raise($scope.TypeError, "no implicit conversion of " + (other.$class().$name()) + " into String")}; + if ((($a = other['$respond_to?']("to_str")) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "no implicit conversion of " + (other.$class().$name()) + " into String") + }; return self.indexOf(other.$to_str()) !== -1; }; def.$index = function(what, offset) { - var $a, $b, self = this, result = nil; + var $a, self = this, result = nil; + if (offset == null) { offset = nil } - if (($a = $scope.String['$==='](what)) !== false && $a !== nil) { + if ((($a = $scope.String['$==='](what)) !== nil && (!$a._isBoolean || $a == true))) { what = what.$to_s() - } else if (($a = what['$respond_to?']("to_str")) !== false && $a !== nil) { + } else if ((($a = what['$respond_to?']("to_str")) !== nil && (!$a._isBoolean || $a == true))) { what = what.$to_str().$to_s() - } else if (($a = ($b = $scope.Regexp['$==='](what), ($b === nil || $b === false))) !== false && $a !== nil) { + } else if ((($a = $scope.Regexp['$==='](what)['$!']()) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.TypeError, "type mismatch: " + (what.$class()) + " given")}; result = -1; if (offset !== false && offset !== nil) { @@ -7264,7 +8208,7 @@ return nil; } - if (($a = $scope.Regexp['$==='](what)) !== false && $a !== nil) { + if ((($a = $scope.Regexp['$==='](what)) !== nil && (!$a._isBoolean || $a == true))) { result = ((($a = (what['$=~'](self.substr(offset)))) !== false && $a !== nil) ? $a : -1) } else { result = self.substr(offset).indexOf(what) @@ -7274,12 +8218,12 @@ result += offset; } - } else if (($a = $scope.Regexp['$==='](what)) !== false && $a !== nil) { + } else if ((($a = $scope.Regexp['$==='](what)) !== nil && (!$a._isBoolean || $a == true))) { result = ((($a = (what['$=~'](self))) !== false && $a !== nil) ? $a : -1) } else { result = self.indexOf(what) }; - if (($a = result === -1) !== false && $a !== nil) { + if ((($a = result === -1) !== nil && (!$a._isBoolean || $a == true))) { return nil } else { return result @@ -7288,6 +8232,7 @@ def.$inspect = function() { var self = this; + var escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, meta = { @@ -7313,11 +8258,14 @@ def.$intern = function() { var self = this; + return self; }; def.$lines = function(separator) { var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + if (separator == null) { separator = $gvars["/"] } @@ -7326,19 +8274,21 @@ def.$length = function() { var self = this; + return self.length; }; def.$ljust = function(width, padstr) { var $a, self = this; + if (padstr == null) { padstr = " " } width = $scope.Opal.$coerce_to(width, $scope.Integer, "to_int"); padstr = $scope.Opal.$coerce_to(padstr, $scope.String, "to_str").$to_s(); - if (($a = padstr['$empty?']()) !== false && $a !== nil) { + if ((($a = padstr['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "zero width padding")}; - if (($a = width <= self.length) !== false && $a !== nil) { + if ((($a = width <= self.length) !== nil && (!$a._isBoolean || $a == true))) { return self}; var index = -1, @@ -7356,21 +8306,26 @@ def.$lstrip = function() { var self = this; + return self.replace(/^\s*/, ''); }; - def.$match = TMP_4 = function(pattern, pos) { - var $a, $b, self = this, $iter = TMP_4._p, block = $iter || nil; - TMP_4._p = null; - if (($a = ((($b = $scope.String['$==='](pattern)) !== false && $b !== nil) ? $b : pattern['$respond_to?']("to_str"))) !== false && $a !== nil) { + def.$match = TMP_5 = function(pattern, pos) { + var $a, $b, self = this, $iter = TMP_5._p, block = $iter || nil; + + TMP_5._p = null; + if ((($a = ((($b = $scope.String['$==='](pattern)) !== false && $b !== nil) ? $b : pattern['$respond_to?']("to_str"))) !== nil && (!$a._isBoolean || $a == true))) { pattern = (new RegExp("" + $scope.Regexp.$escape(pattern.$to_str())))}; - if (($a = $scope.Regexp['$==='](pattern)) === false || $a === nil) { - self.$raise($scope.TypeError, "wrong argument type " + (pattern.$class()) + " (expected Regexp)")}; + if ((($a = $scope.Regexp['$==='](pattern)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "wrong argument type " + (pattern.$class()) + " (expected Regexp)") + }; return ($a = ($b = pattern).$match, $a._p = block.$to_proc(), $a).call($b, self, pos); }; def.$next = function() { var self = this; + if (self.length === 0) { return ""; @@ -7380,31 +8335,35 @@ var last = String.fromCharCode(self.charCodeAt(self.length - 1) + 1); return initial + last; - ; + }; def.$ord = function() { var self = this; + return self.charCodeAt(0); }; def.$partition = function(str) { var self = this; + var result = self.split(str); var splitter = (result[0].length === self.length ? "" : str); return [result[0], splitter, result.slice(1).join(str.toString())]; - ; + }; def.$reverse = function() { var self = this; + return self.split('').reverse().join(''); }; def.$rindex = function(search, offset) { var self = this; + var search_type = (search == null ? Opal.NilClass : search.constructor); if (search_type != String && search_type != RegExp) { @@ -7450,14 +8409,15 @@ def.$rjust = function(width, padstr) { var $a, self = this; + if (padstr == null) { padstr = " " } width = $scope.Opal.$coerce_to(width, $scope.Integer, "to_int"); padstr = $scope.Opal.$coerce_to(padstr, $scope.String, "to_str").$to_s(); - if (($a = padstr['$empty?']()) !== false && $a !== nil) { + if ((($a = padstr['$empty?']()) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "zero width padding")}; - if (($a = width <= self.length) !== false && $a !== nil) { + if ((($a = width <= self.length) !== nil && (!$a._isBoolean || $a == true))) { return self}; var chars = Math.floor(width - self.length), @@ -7471,12 +8431,14 @@ def.$rstrip = function() { var self = this; + return self.replace(/\s*$/, ''); }; - def.$scan = TMP_5 = function(pattern) { - var self = this, $iter = TMP_5._p, block = $iter || nil; - TMP_5._p = null; + def.$scan = TMP_6 = function(pattern) { + var self = this, $iter = TMP_6._p, block = $iter || nil; + + TMP_6._p = null; if (pattern.global) { // should we clear it afterwards too? @@ -7501,7 +8463,7 @@ } return (block !== nil ? self : result); - ; + }; $opal.defn(self, '$size', def.$length); @@ -7510,18 +8472,166 @@ def.$split = function(pattern, limit) { var self = this, $a; + if ($gvars[";"] == null) $gvars[";"] = nil; + if (pattern == null) { pattern = ((($a = $gvars[";"]) !== false && $a !== nil) ? $a : " ") } - return self.split(pattern, limit); + + if (pattern === nil || pattern === undefined) { + pattern = $gvars[";"]; + } + + var result = []; + if (limit !== undefined) { + limit = $scope.Opal['$coerce_to!'](limit, $scope.Integer, "to_int"); + } + + if (self.length === 0) { + return []; + } + + if (limit === 1) { + return [self]; + } + + if (pattern && pattern._isRegexp) { + var pattern_str = pattern.toString(); + + /* Opal and JS's repr of an empty RE. */ + var blank_pattern = (pattern_str.substr(0, 3) == '/^/') || + (pattern_str.substr(0, 6) == '/(?:)/'); + + /* This is our fast path */ + if (limit === undefined || limit === 0) { + result = self.split(blank_pattern ? /(?:)/ : pattern); + } + else { + /* RegExp.exec only has sane behavior with global flag */ + if (! pattern.global) { + pattern = eval(pattern_str + 'g'); + } + + var match_data; + var prev_index = 0; + pattern.lastIndex = 0; + + while ((match_data = pattern.exec(self)) !== null) { + var segment = self.slice(prev_index, match_data.index); + result.push(segment); + + prev_index = pattern.lastIndex; + + if (match_data[0].length === 0) { + if (blank_pattern) { + /* explicitly split on JS's empty RE form.*/ + pattern = /(?:)/; + } + + result = self.split(pattern); + /* with "unlimited", ruby leaves a trail on blanks. */ + if (limit !== undefined && limit < 0 && blank_pattern) { + result.push(''); + } + + prev_index = undefined; + break; + } + + if (limit !== undefined && limit > 1 && result.length + 1 == limit) { + break; + } + } + + if (prev_index !== undefined) { + result.push(self.slice(prev_index, self.length)); + } + } + } + else { + var splitted = 0, start = 0, lim = 0; + + if (pattern === nil || pattern === undefined) { + pattern = ' ' + } else { + pattern = $scope.Opal.$try_convert(pattern, $scope.String, "to_str").$to_s(); + } + + var string = (pattern == ' ') ? self.replace(/[\r\n\t\v]\s+/g, ' ') + : self; + var cursor = -1; + while ((cursor = string.indexOf(pattern, start)) > -1 && cursor < string.length) { + if (splitted + 1 === limit) { + break; + } + + if (pattern == ' ' && cursor == start) { + start = cursor + 1; + continue; + } + + result.push(string.substr(start, pattern.length ? cursor - start : 1)); + splitted++; + + start = cursor + (pattern.length ? pattern.length : 1); + } + + if (string.length > 0 && (limit < 0 || string.length > start)) { + if (string.length == start) { + result.push(''); + } + else { + result.push(string.substr(start, string.length)); + } + } + } + + if (limit === undefined || limit === 0) { + while (result[result.length-1] === '') { + result.length = result.length - 1; + } + } + + if (limit > 0) { + var tail = result.slice(limit - 1).join(''); + result.splice(limit - 1, result.length - 1, tail); + } + + return result; + ; + }; + + def.$squeeze = function(sets) { + var self = this; + + sets = $slice.call(arguments, 0); + + if (sets.length === 0) { + return self.replace(/(.)\1+/g, '$1'); + } + + + var set = $scope.Opal.$coerce_to(sets[0], $scope.String, "to_str").$chars(); + + for (var i = 1, length = sets.length; i < length; i++) { + set = (set)['$&']($scope.Opal.$coerce_to(sets[i], $scope.String, "to_str").$chars()); + } + + if (set.length === 0) { + return self; + } + + return self.replace(new RegExp("([" + $scope.Regexp.$escape((set).$join()) + "])\\1+", "g"), "$1"); + ; }; def['$start_with?'] = function(prefixes) { var self = this; + prefixes = $slice.call(arguments, 0); for (var i = 0, length = prefixes.length; i < length; i++) { - var prefix = $scope.Opal.$coerce_to(prefixes[i], $scope.String, "to_str"); + var prefix = $scope.Opal.$coerce_to(prefixes[i], $scope.String, "to_str").$to_s(); if (self.indexOf(prefix) === 0) { return true; @@ -7534,12 +8644,14 @@ def.$strip = function() { var self = this; + return self.replace(/^\s*/, '').replace(/\s*$/, ''); }; - def.$sub = TMP_6 = function(pattern, replace) { - var self = this, $iter = TMP_6._p, block = $iter || nil; - TMP_6._p = null; + def.$sub = TMP_7 = function(pattern, replace) { + var self = this, $iter = TMP_7._p, block = $iter || nil; + + TMP_7._p = null; if (typeof(replace) === 'string') { // convert Ruby back reference to JavaScript back reference @@ -7603,6 +8715,7 @@ def.$sum = function(n) { var self = this; + if (n == null) { n = 16 } @@ -7619,6 +8732,7 @@ def.$swapcase = function() { var self = this; + var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) { return $1 ? $0.toUpperCase() : $0.toLowerCase(); @@ -7629,31 +8743,31 @@ } return self.$class().$new(str); - ; + }; - def.$to_a = function() { + def.$to_f = function() { var self = this; + - if (self.length === 0) { - return []; + if (self.charAt(0) === '_') { + return 0; } - return [self]; - ; - }; - - def.$to_f = function() { - var self = this; - - var result = parseFloat(self); + var result = parseFloat(self.replace(/_/g, '')); - return isNaN(result) ? 0 : result; - ; + if (isNaN(result) || result == Infinity || result == -Infinity) { + return 0; + } + else { + return result; + } + }; def.$to_i = function(base) { var self = this; + if (base == null) { base = 10 } @@ -7665,23 +8779,20 @@ } return result; - ; + }; def.$to_proc = function() { - var self = this; - - var name = '$' + self; + var $a, $b, TMP_8, self = this; - return function(arg) { - var meth = arg[name]; - return meth ? meth.call(arg) : arg.$method_missing(name); - }; - ; + return ($a = ($b = self).$proc, $a._p = (TMP_8 = function(recv, args){var self = TMP_8._s || this, $a; +if (recv == null) recv = nil;args = $slice.call(arguments, 1); + return ($a = recv).$send.apply($a, [self].concat(args))}, TMP_8._s = self, TMP_8), $a).call($b); }; def.$to_s = function() { var self = this; + return self.toString(); }; @@ -7691,6 +8802,7 @@ def.$tr = function(from, to) { var self = this; + if (from.length == 0 || from === to) { return self; @@ -7715,12 +8827,12 @@ var last_from = null; var in_range = false; for (var i = 0; i < from_length; i++) { - var char = from_chars[i]; + var ch = from_chars[i]; if (last_from == null) { - last_from = char; - from_chars_expanded.push(char); + last_from = ch; + from_chars_expanded.push(ch); } - else if (char === '-') { + else if (ch === '-') { if (last_from === '-') { from_chars_expanded.push('-'); from_chars_expanded.push('-'); @@ -7734,16 +8846,16 @@ } else if (in_range) { var start = last_from.charCodeAt(0) + 1; - var end = char.charCodeAt(0); + var end = ch.charCodeAt(0); for (var c = start; c < end; c++) { from_chars_expanded.push(String.fromCharCode(c)); } - from_chars_expanded.push(char); + from_chars_expanded.push(ch); in_range = null; last_from = null; } else { - from_chars_expanded.push(char); + from_chars_expanded.push(ch); } } @@ -7761,12 +8873,12 @@ var last_to = null; var in_range = false; for (var i = 0; i < to_length; i++) { - var char = to_chars[i]; + var ch = to_chars[i]; if (last_from == null) { - last_from = char; - to_chars_expanded.push(char); + last_from = ch; + to_chars_expanded.push(ch); } - else if (char === '-') { + else if (ch === '-') { if (last_to === '-') { to_chars_expanded.push('-'); to_chars_expanded.push('-'); @@ -7780,16 +8892,16 @@ } else if (in_range) { var start = last_from.charCodeAt(0) + 1; - var end = char.charCodeAt(0); + var end = ch.charCodeAt(0); for (var c = start; c < end; c++) { to_chars_expanded.push(String.fromCharCode(c)); } - to_chars_expanded.push(char); + to_chars_expanded.push(ch); in_range = null; last_from = null; } else { - to_chars_expanded.push(char); + to_chars_expanded.push(ch); } } @@ -7812,21 +8924,22 @@ var new_str = '' for (var i = 0, length = self.length; i < length; i++) { - var char = self.charAt(i); - var sub = subs[char]; + var ch = self.charAt(i); + var sub = subs[ch]; if (inverse) { - new_str += (sub == null ? global_sub : char); + new_str += (sub == null ? global_sub : ch); } else { - new_str += (sub != null ? sub : char); + new_str += (sub != null ? sub : ch); } } return new_str; - ; + }; def.$tr_s = function(from, to) { var self = this; + if (from.length == 0) { return self; @@ -7851,12 +8964,12 @@ var last_from = null; var in_range = false; for (var i = 0; i < from_length; i++) { - var char = from_chars[i]; + var ch = from_chars[i]; if (last_from == null) { - last_from = char; - from_chars_expanded.push(char); + last_from = ch; + from_chars_expanded.push(ch); } - else if (char === '-') { + else if (ch === '-') { if (last_from === '-') { from_chars_expanded.push('-'); from_chars_expanded.push('-'); @@ -7870,16 +8983,16 @@ } else if (in_range) { var start = last_from.charCodeAt(0) + 1; - var end = char.charCodeAt(0); + var end = ch.charCodeAt(0); for (var c = start; c < end; c++) { from_chars_expanded.push(String.fromCharCode(c)); } - from_chars_expanded.push(char); + from_chars_expanded.push(ch); in_range = null; last_from = null; } else { - from_chars_expanded.push(char); + from_chars_expanded.push(ch); } } @@ -7897,12 +9010,12 @@ var last_to = null; var in_range = false; for (var i = 0; i < to_length; i++) { - var char = to_chars[i]; + var ch = to_chars[i]; if (last_from == null) { - last_from = char; - to_chars_expanded.push(char); + last_from = ch; + to_chars_expanded.push(ch); } - else if (char === '-') { + else if (ch === '-') { if (last_to === '-') { to_chars_expanded.push('-'); to_chars_expanded.push('-'); @@ -7916,16 +9029,16 @@ } else if (in_range) { var start = last_from.charCodeAt(0) + 1; - var end = char.charCodeAt(0); + var end = ch.charCodeAt(0); for (var c = start; c < end; c++) { to_chars_expanded.push(String.fromCharCode(c)); } - to_chars_expanded.push(char); + to_chars_expanded.push(ch); in_range = null; last_from = null; } else { - to_chars_expanded.push(char); + to_chars_expanded.push(ch); } } @@ -7948,8 +9061,8 @@ var new_str = '' var last_substitute = null for (var i = 0, length = self.length; i < length; i++) { - var char = self.charAt(i); - var sub = subs[char] + var ch = self.charAt(i); + var sub = subs[ch] if (inverse) { if (sub == null) { if (last_substitute == null) { @@ -7958,7 +9071,7 @@ } } else { - new_str += char; + new_str += ch; last_substitute = null; } } @@ -7970,58 +9083,194 @@ } } else { - new_str += char; + new_str += ch; last_substitute = null; } } } return new_str; - ; + }; def.$upcase = function() { var self = this; + return self.toUpperCase(); }; def.$freeze = function() { var self = this; + return self; }; return (def['$frozen?'] = function() { var self = this; + return true; - }, nil); + }, nil) && 'frozen?'; })(self, null); return $opal.cdecl($scope, 'Symbol', $scope.String); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $gvars = $opal.gvars; + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + (function($base, $super) { + function $String(){}; + var self = $String = $klass($base, $super, 'String', $String); + + var def = self._proto, $scope = self._scope; + + return ($opal.defs(self, '$inherited', function(klass) { + var self = this, replace = nil; + + replace = $scope.Class.$new(($scope.String)._scope.Wrapper); + + klass._proto = replace._proto; + klass._proto._klass = klass; + klass._alloc = replace._alloc; + klass.__parent = ($scope.String)._scope.Wrapper; + + klass.$allocate = replace.$allocate; + klass.$new = replace.$new; + + }), nil) && 'inherited' + })(self, null); return (function($base, $super) { - function $MatchData(){}; - var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + function $Wrapper(){}; + var self = $Wrapper = $klass($base, $super, 'Wrapper', $Wrapper); - var def = $MatchData._proto, $scope = $MatchData._scope, TMP_1; - def.string = def.matches = def.begin = nil; - self.$attr_reader("post_match", "pre_match", "regexp", "string"); + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4; - $opal.defs(self, '$new', TMP_1 = function(regexp, match_groups) { - var self = this, $iter = TMP_1._p, $yield = $iter || nil, data = nil; + def.literal = nil; + $opal.defs(self, '$allocate', TMP_1 = function(string) { + var self = this, $iter = TMP_1._p, $yield = $iter || nil, obj = nil; + + if (string == null) { + string = "" + } TMP_1._p = null; - data = $opal.find_super_dispatcher(self, 'new', TMP_1, null, $MatchData).apply(self, [regexp, match_groups]); - $gvars["`"] = data.$pre_match(); - $gvars["'"] = data.$post_match(); - $gvars["~"] = data; - return data; + obj = $opal.find_super_dispatcher(self, 'allocate', TMP_1, null, $Wrapper).apply(self, []); + obj.literal = string; + return obj; }); - def.$initialize = function(regexp, match_groups) { - var self = this; - self.regexp = regexp; - self.begin = match_groups.index; - self.string = match_groups.input; + $opal.defs(self, '$new', TMP_2 = function(args) { + var $a, $b, self = this, $iter = TMP_2._p, block = $iter || nil, obj = nil; + + args = $slice.call(arguments, 0); + TMP_2._p = null; + obj = self.$allocate(); + ($a = ($b = obj).$initialize, $a._p = block.$to_proc(), $a).apply($b, [].concat(args)); + return obj; + }); + + $opal.defs(self, '$[]', function(objects) { + var self = this; + + objects = $slice.call(arguments, 0); + return self.$allocate(objects); + }); + + def.$initialize = function(string) { + var self = this; + + if (string == null) { + string = "" + } + return self.literal = string; + }; + + def.$method_missing = TMP_3 = function(args) { + var $a, $b, self = this, $iter = TMP_3._p, block = $iter || nil, result = nil; + + args = $slice.call(arguments, 0); + TMP_3._p = null; + result = ($a = ($b = self.literal).$__send__, $a._p = block.$to_proc(), $a).apply($b, [].concat(args)); + if ((($a = result._isString != null) !== nil && (!$a._isBoolean || $a == true))) { + if ((($a = result == self.literal) !== nil && (!$a._isBoolean || $a == true))) { + return self + } else { + return self.$class().$allocate(result) + } + } else { + return result + }; + }; + + def.$initialize_copy = function(other) { + var self = this; + + return self.literal = (other.literal).$clone(); + }; + + def['$respond_to?'] = TMP_4 = function(name) {var $zuper = $slice.call(arguments, 0); + var $a, self = this, $iter = TMP_4._p, $yield = $iter || nil; + + TMP_4._p = null; + return ((($a = $opal.find_super_dispatcher(self, 'respond_to?', TMP_4, $iter).apply(self, $zuper)) !== false && $a !== nil) ? $a : self.literal['$respond_to?'](name)); + }; + + def['$=='] = function(other) { + var self = this; + + return self.literal['$=='](other); + }; + + $opal.defn(self, '$eql?', def['$==']); + + $opal.defn(self, '$===', def['$==']); + + def.$to_s = function() { + var self = this; + + return self.literal; + }; + + def.$to_str = function() { + var self = this; + + return self; + }; + + return (def.$inspect = function() { + var self = this; + + return self.literal.$inspect(); + }, nil) && 'inspect'; + })($scope.String, null); +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $gvars = $opal.gvars; + + return (function($base, $super) { + function $MatchData(){}; + var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); + + var def = self._proto, $scope = self._scope, TMP_1; + + def.string = def.matches = def.begin = nil; + self.$attr_reader("post_match", "pre_match", "regexp", "string"); + + $opal.defs(self, '$new', TMP_1 = function(regexp, match_groups) { + var self = this, $iter = TMP_1._p, $yield = $iter || nil, data = nil; + + TMP_1._p = null; + data = $opal.find_super_dispatcher(self, 'new', TMP_1, null, $MatchData).apply(self, [regexp, match_groups]); + $gvars["`"] = data.$pre_match(); + $gvars["'"] = data.$post_match(); + $gvars["~"] = data; + return data; + }); + + def.$initialize = function(regexp, match_groups) { + var self = this; + + self.regexp = regexp; + self.begin = match_groups.index; + self.string = match_groups.input; self.pre_match = self.string.substr(0, regexp.lastIndex - match_groups[0].length); self.post_match = self.string.substr(regexp.lastIndex); self.matches = []; @@ -8041,31 +9290,38 @@ def['$[]'] = function(args) { var $a, self = this; + args = $slice.call(arguments, 0); return ($a = self.matches)['$[]'].apply($a, [].concat(args)); }; def['$=='] = function(other) { var $a, $b, $c, $d, self = this; - if (($a = $scope.MatchData['$==='](other)) === false || $a === nil) { - return false}; + + if ((($a = $scope.MatchData['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; return ($a = ($b = ($c = ($d = self.string == other.string, $d !== false && $d !== nil ?self.regexp == other.regexp : $d), $c !== false && $c !== nil ?self.pre_match == other.pre_match : $c), $b !== false && $b !== nil ?self.post_match == other.post_match : $b), $a !== false && $a !== nil ?self.begin == other.begin : $a); }; def.$begin = function(pos) { - var $a, $b, $c, self = this; - if (($a = ($b = ($c = pos['$=='](0), ($c === nil || $c === false)), $b !== false && $b !== nil ?($c = pos['$=='](1), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) { + var $a, $b, self = this; + + if ((($a = ($b = pos['$=='](0)['$!'](), $b !== false && $b !== nil ?pos['$=='](1)['$!']() : $b)) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "MatchData#begin only supports 0th element")}; return self.begin; }; def.$captures = function() { var self = this; + return self.matches.slice(1); }; def.$inspect = function() { var self = this; + var str = "#"; - }; - - def.$each_byte = function() { - var self = this; - return self.$raise($scope.NotImplementedError); - }; - - def.$getbyte = function() { - var self = this; - return self.$raise($scope.NotImplementedError); - }; - - return (def.$bytesize = function() { - var self = this; - return self.$raise($scope.NotImplementedError); - }, nil); - })(self, null); - ($a = ($b = $scope.Encoding).$register, $a._p = (TMP_4 = function(){var self = TMP_4._s || this, TMP_5; - $opal.defn(self, '$each_byte', TMP_5 = function(string) { - var $a, self = this, $iter = TMP_5._p, block = $iter || nil; - TMP_5._p = null; - - for (var i = 0, length = string.length; i < length; i++) { - var code = string.charCodeAt(i); - - if (code <= 0x7f) { - ((($a = $opal.$yield1(block, code)) === $breaker) ? $breaker.$v : $a); - } - else { - var encoded = encodeURIComponent(string.charAt(i)).substr(1).split('%'); - - for (var j = 0, encoded_length = encoded.length; j < encoded_length; j++) { - ((($a = $opal.$yield1(block, parseInt(encoded[j], 16))) === $breaker) ? $breaker.$v : $a); - } - } - } - - }); - return ($opal.defn(self, '$bytesize', function() { - var self = this; - return self.$bytes().$length(); - }), nil);}, TMP_4._s = self, TMP_4), $a).call($b, "UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})); - ($a = ($c = $scope.Encoding).$register, $a._p = (TMP_6 = function(){var self = TMP_6._s || this, TMP_7; - $opal.defn(self, '$each_byte', TMP_7 = function(string) { - var $a, self = this, $iter = TMP_7._p, block = $iter || nil; - TMP_7._p = null; - - for (var i = 0, length = string.length; i < length; i++) { - var code = string.charCodeAt(i); - - ((($a = $opal.$yield1(block, code & 0xff)) === $breaker) ? $breaker.$v : $a); - ((($a = $opal.$yield1(block, code >> 8)) === $breaker) ? $breaker.$v : $a); - } - - }); - return ($opal.defn(self, '$bytesize', function() { - var self = this; - return self.$bytes().$length(); - }), nil);}, TMP_6._s = self, TMP_6), $a).call($c, "UTF-16LE"); - ($a = ($d = $scope.Encoding).$register, $a._p = (TMP_8 = function(){var self = TMP_8._s || this, TMP_9; - $opal.defn(self, '$each_byte', TMP_9 = function(string) { - var $a, self = this, $iter = TMP_9._p, block = $iter || nil; - TMP_9._p = null; - - for (var i = 0, length = string.length; i < length; i++) { - ((($a = $opal.$yield1(block, string.charCodeAt(i) & 0xff)) === $breaker) ? $breaker.$v : $a); - } - - }); - return ($opal.defn(self, '$bytesize', function() { - var self = this; - return self.$bytes().$length(); - }), nil);}, TMP_8._s = self, TMP_8), $a).call($d, "ASCII-8BIT", $hash2(["aliases", "ascii"], {"aliases": ["BINARY"], "ascii": true})); - return (function($base, $super) { - function $String(){}; - var self = $String = $klass($base, $super, 'String', $String); - - var def = $String._proto, $scope = $String._scope, TMP_10; - def.encoding = nil; - def.encoding = ($scope.Encoding)._scope.UTF_16LE; - - def.$bytes = function() { - var self = this; - return self.$each_byte().$to_a(); - }; - - def.$bytesize = function() { - var self = this; - return self.encoding.$bytesize(self); - }; - - def.$each_byte = TMP_10 = function() { - var $a, $b, self = this, $iter = TMP_10._p, block = $iter || nil; - TMP_10._p = null; - if (block === nil) { - return self.$enum_for("each_byte")}; - ($a = ($b = self.encoding).$each_byte, $a._p = block.$to_proc(), $a).call($b, self); - return self; - }; - - def.$encoding = function() { - var self = this; - return self.encoding; - }; - - def.$force_encoding = function(encoding) { - var self = this; - encoding = $scope.Encoding.$find(encoding); - if (encoding['$=='](self.encoding)) { - return self}; - - var result = new native_string(self); - result.encoding = encoding; - - return result; - - }; - - return (def.$getbyte = function(idx) { - var self = this; - return self.encoding.$getbyte(self, idx); - }, nil); - })(self, null); -})(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + ; (function($base, $super) { function $Numeric(){}; var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); - var def = $Numeric._proto, $scope = $Numeric._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3, TMP_4, TMP_5, TMP_6; + self.$include($scope.Comparable); def._isNumber = true; - (function(self) { - var $scope = self._scope, def = self._proto; - return self.$undef_method("new") - })(self.$singleton_class()); - def.$coerce = function(other, type) { var self = this, $case = nil; + if (type == null) { type = "operation" } @@ -8361,6 +9422,7 @@ def.$send_coerced = function(method, other) { var $a, self = this, type = nil, $case = nil, a = nil, b = nil; + type = (function() {$case = method;if ("+"['$===']($case) || "-"['$===']($case) || "*"['$===']($case) || "/"['$===']($case) || "%"['$===']($case) || "&"['$===']($case) || "|"['$===']($case) || "^"['$===']($case) || "**"['$===']($case)) {return "operation"}else if (">"['$===']($case) || ">="['$===']($case) || "<"['$===']($case) || "<="['$===']($case) || "<=>"['$===']($case)) {return "comparison"}else { return nil }})(); $a = $opal.to_ary(self.$coerce(other, type)), a = ($a[0] == null ? nil : $a[0]), b = ($a[1] == null ? nil : $a[1]); return a.$__send__(method, b); @@ -8368,6 +9430,7 @@ def['$+'] = function(other) { var self = this; + if (other._isNumber) { return self + other; @@ -8380,6 +9443,7 @@ def['$-'] = function(other) { var self = this; + if (other._isNumber) { return self - other; @@ -8392,6 +9456,7 @@ def['$*'] = function(other) { var self = this; + if (other._isNumber) { return self * other; @@ -8404,6 +9469,7 @@ def['$/'] = function(other) { var self = this; + if (other._isNumber) { return self / other; @@ -8416,6 +9482,7 @@ def['$%'] = function(other) { var self = this; + if (other._isNumber) { if (other < 0 || self < 0) { @@ -8433,6 +9500,7 @@ def['$&'] = function(other) { var self = this; + if (other._isNumber) { return self & other; @@ -8445,6 +9513,7 @@ def['$|'] = function(other) { var self = this; + if (other._isNumber) { return self | other; @@ -8457,6 +9526,7 @@ def['$^'] = function(other) { var self = this; + if (other._isNumber) { return self ^ other; @@ -8469,6 +9539,7 @@ def['$<'] = function(other) { var self = this; + if (other._isNumber) { return self < other; @@ -8481,6 +9552,7 @@ def['$<='] = function(other) { var self = this; + if (other._isNumber) { return self <= other; @@ -8493,6 +9565,7 @@ def['$>'] = function(other) { var self = this; + if (other._isNumber) { return self > other; @@ -8505,6 +9578,7 @@ def['$>='] = function(other) { var self = this; + if (other._isNumber) { return self >= other; @@ -8517,6 +9591,7 @@ def['$<=>'] = function(other) { var self = this; + try { if (other._isNumber) { @@ -8526,7 +9601,7 @@ return self.$send_coerced("<=>", other); } - } catch ($err) {if ($scope.ArgumentError['$===']($err)) { + } catch ($err) {if ($opal.$rescue($err, [$scope.ArgumentError])) { return nil }else { throw $err; } }; @@ -8534,31 +9609,46 @@ def['$<<'] = function(count) { var self = this; + return self << count.$to_int(); }; def['$>>'] = function(count) { var self = this; + return self >> count.$to_int(); }; + def['$[]'] = function(bit) { + var self = this, min = nil, max = nil; + + bit = $scope.Opal['$coerce_to!'](bit, $scope.Integer, "to_int"); + min = ((2)['$**'](30))['$-@'](); + max = ((2)['$**'](30))['$-'](1); + return (bit < min || bit > max) ? 0 : (self >> bit) % 2; + }; + def['$+@'] = function() { var self = this; + return +self; }; def['$-@'] = function() { var self = this; + return -self; }; def['$~'] = function() { var self = this; + return ~self; }; def['$**'] = function(other) { var self = this; + if (other._isNumber) { return Math.pow(self, other); @@ -8571,6 +9661,7 @@ def['$=='] = function(other) { var self = this; + if (other._isNumber) { return self == Number(other); @@ -8586,32 +9677,39 @@ def.$abs = function() { var self = this; + return Math.abs(self); }; def.$ceil = function() { var self = this; + return Math.ceil(self); }; def.$chr = function() { var self = this; + return String.fromCharCode(self); }; def.$conj = function() { var self = this; + return self; }; $opal.defn(self, '$conjugate', def.$conj); def.$downto = TMP_1 = function(finish) { - var $a, self = this, $iter = TMP_1._p, block = $iter || nil; + var self = this, $iter = TMP_1._p, block = $iter || nil; + TMP_1._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("downto", finish)}; - + if (block !== false && block !== nil) { + } else { + return self.$enum_for("downto", finish) + }; + for (var i = self; i >= finish; i--) { if (block(i) === $breaker) { return $breaker.$v; @@ -8627,72 +9725,153 @@ def['$even?'] = function() { var self = this; + return self % 2 === 0; }; def.$floor = function() { var self = this; + return Math.floor(self); }; + def.$gcd = function(other) { + var $a, self = this; + + if ((($a = $scope.Integer['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "not an integer") + }; + + var min = Math.abs(self), + max = Math.abs(other); + + while (min > 0) { + var tmp = min; + + min = max % min; + max = tmp; + } + + return max; + + }; + + def.$gcdlcm = function(other) { + var self = this; + + return [self.$gcd(), self.$lcm()]; + }; + def.$hash = function() { var self = this; + return self.toString(); }; def['$integer?'] = function() { var self = this; + return self % 1 === 0; }; def['$is_a?'] = TMP_2 = function(klass) {var $zuper = $slice.call(arguments, 0); var $a, $b, self = this, $iter = TMP_2._p, $yield = $iter || nil; + TMP_2._p = null; - if (($a = (($b = klass['$==']($scope.Float)) ? $scope.Float['$==='](self) : $b)) !== false && $a !== nil) { + if ((($a = (($b = klass['$==']($scope.Fixnum)) ? $scope.Integer['$==='](self) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return true}; + if ((($a = (($b = klass['$==']($scope.Integer)) ? $scope.Integer['$==='](self) : $b)) !== nil && (!$a._isBoolean || $a == true))) { return true}; - if (($a = (($b = klass['$==']($scope.Integer)) ? $scope.Integer['$==='](self) : $b)) !== false && $a !== nil) { + if ((($a = (($b = klass['$==']($scope.Float)) ? $scope.Float['$==='](self) : $b)) !== nil && (!$a._isBoolean || $a == true))) { return true}; return $opal.find_super_dispatcher(self, 'is_a?', TMP_2, $iter).apply(self, $zuper); }; + $opal.defn(self, '$kind_of?', def['$is_a?']); + + def['$instance_of?'] = TMP_3 = function(klass) {var $zuper = $slice.call(arguments, 0); + var $a, $b, self = this, $iter = TMP_3._p, $yield = $iter || nil; + + TMP_3._p = null; + if ((($a = (($b = klass['$==']($scope.Fixnum)) ? $scope.Integer['$==='](self) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return true}; + if ((($a = (($b = klass['$==']($scope.Integer)) ? $scope.Integer['$==='](self) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return true}; + if ((($a = (($b = klass['$==']($scope.Float)) ? $scope.Float['$==='](self) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + return true}; + return $opal.find_super_dispatcher(self, 'instance_of?', TMP_3, $iter).apply(self, $zuper); + }; + + def.$lcm = function(other) { + var $a, self = this; + + if ((($a = $scope.Integer['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.TypeError, "not an integer") + }; + + if (self == 0 || other == 0) { + return 0; + } + else { + return Math.abs(self * other / self.$gcd(other)); + } + + }; + $opal.defn(self, '$magnitude', def.$abs); $opal.defn(self, '$modulo', def['$%']); def.$next = function() { var self = this; + return self + 1; }; def['$nonzero?'] = function() { var self = this; + return self == 0 ? nil : self; }; def['$odd?'] = function() { var self = this; + return self % 2 !== 0; }; def.$ord = function() { var self = this; + return self; }; def.$pred = function() { var self = this; + return self - 1; }; - def.$step = TMP_3 = function(limit, step) { - var $a, self = this, $iter = TMP_3._p, block = $iter || nil; + def.$round = function() { + var self = this; + + return Math.round(self); + }; + + def.$step = TMP_4 = function(limit, step) { + var $a, self = this, $iter = TMP_4._p, block = $iter || nil; + if (step == null) { step = 1 } - TMP_3._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("step", limit, step)}; - if (($a = step == 0) !== false && $a !== nil) { + TMP_4._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("step", limit, step) + }; + if ((($a = step == 0) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "step cannot be 0")}; var value = self; @@ -8715,11 +9894,14 @@ $opal.defn(self, '$succ', def.$next); - def.$times = TMP_4 = function() { - var $a, self = this, $iter = TMP_4._p, block = $iter || nil; - TMP_4._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("times")}; + def.$times = TMP_5 = function() { + var self = this, $iter = TMP_5._p, block = $iter || nil; + + TMP_5._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("times") + }; for (var i = 0; i < self; i++) { if (block(i) === $breaker) { @@ -8732,11 +9914,13 @@ def.$to_f = function() { var self = this; - return parseFloat(self); + + return self; }; def.$to_i = function() { var self = this; + return parseInt(self); }; @@ -8744,10 +9928,11 @@ def.$to_s = function(base) { var $a, $b, self = this; + if (base == null) { base = 10 } - if (($a = ((($b = base['$<'](2)) !== false && $b !== nil) ? $b : base['$>'](36))) !== false && $a !== nil) { + if ((($a = ((($b = base['$<'](2)) !== false && $b !== nil) ? $b : base['$>'](36))) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.ArgumentError, "base must be between 2 and 36")}; return self.toString(base); }; @@ -8756,16 +9941,20 @@ def.$divmod = function(rhs) { var self = this, q = nil, r = nil; + q = (self['$/'](rhs)).$floor(); r = self['$%'](rhs); return [q, r]; }; - def.$upto = TMP_5 = function(finish) { - var $a, self = this, $iter = TMP_5._p, block = $iter || nil; - TMP_5._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("upto", finish)}; + def.$upto = TMP_6 = function(finish) { + var self = this, $iter = TMP_6._p, block = $iter || nil; + + TMP_6._p = null; + if (block !== false && block !== nil) { + } else { + return self.$enum_for("upto", finish) + }; for (var i = self; i <= finish; i++) { if (block(i) === $breaker) { @@ -8778,83 +9967,152 @@ def['$zero?'] = function() { var self = this; + return self == 0; }; def.$size = function() { var self = this; + return 4; }; def['$nan?'] = function() { var self = this; + return isNaN(self); }; def['$finite?'] = function() { var self = this; - return self == Infinity || self == -Infinity; + + return self != Infinity && self != -Infinity; }; - return (def['$infinite?'] = function() { - var $a, self = this; - if (($a = self == Infinity) !== false && $a !== nil) { + def['$infinite?'] = function() { + var self = this; + + + if (self == Infinity) { return +1; - } else if (($a = self == -Infinity) !== false && $a !== nil) { + } + else if (self == -Infinity) { return -1; - } else { - return nil - }; - }, nil); + } + else { + return nil; + } + + }; + + def['$positive?'] = function() { + var self = this; + + return 1 / self > 0; + }; + + return (def['$negative?'] = function() { + var self = this; + + return 1 / self < 0; + }, nil) && 'negative?'; })(self, null); $opal.cdecl($scope, 'Fixnum', $scope.Numeric); (function($base, $super) { function $Integer(){}; var self = $Integer = $klass($base, $super, 'Integer', $Integer); - var def = $Integer._proto, $scope = $Integer._scope; + var def = self._proto, $scope = self._scope; + return ($opal.defs(self, '$===', function(other) { var self = this; - return !!(other._isNumber && (other % 1) == 0); - }), nil) + + + if (!other._isNumber) { + return false; + } + + return (other % 1) === 0; + + }), nil) && '===' })(self, $scope.Numeric); return (function($base, $super) { function $Float(){}; var self = $Float = $klass($base, $super, 'Float', $Float); - var def = $Float._proto, $scope = $Float._scope; + var def = self._proto, $scope = self._scope, $a; + $opal.defs(self, '$===', function(other) { var self = this; - return !!(other._isNumber && (other % 1) != 0); + + return !!other._isNumber; }); $opal.cdecl($scope, 'INFINITY', Infinity); - return $opal.cdecl($scope, 'NAN', NaN); + $opal.cdecl($scope, 'NAN', NaN); + + if ((($a = (typeof(Number.EPSILON) !== "undefined")) !== nil && (!$a._isBoolean || $a == true))) { + return $opal.cdecl($scope, 'EPSILON', Number.EPSILON) + } else { + return $opal.cdecl($scope, 'EPSILON', 2.2204460492503130808472633361816E-16) + }; })(self, $scope.Numeric); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + return (function($base, $super) { + function $Complex(){}; + var self = $Complex = $klass($base, $super, 'Complex', $Complex); + + var def = self._proto, $scope = self._scope; + + return nil; + })(self, $scope.Numeric) +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + return (function($base, $super) { + function $Rational(){}; + var self = $Rational = $klass($base, $super, 'Rational', $Rational); + + var def = self._proto, $scope = self._scope; + + return nil; + })(self, $scope.Numeric) +})(Opal); +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + return (function($base, $super) { function $Proc(){}; var self = $Proc = $klass($base, $super, 'Proc', $Proc); - var def = $Proc._proto, $scope = $Proc._scope, TMP_1, TMP_2; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2; + def._isProc = true; def.is_lambda = false; $opal.defs(self, '$new', TMP_1 = function() { - var $a, self = this, $iter = TMP_1._p, block = $iter || nil; + var self = this, $iter = TMP_1._p, block = $iter || nil; + TMP_1._p = null; - if (($a = block) === false || $a === nil) { - self.$raise($scope.ArgumentError, "tried to create a Proc object without a block")}; + if (block !== false && block !== nil) { + } else { + self.$raise($scope.ArgumentError, "tried to create a Proc object without a block") + }; return block; }); def.$call = TMP_2 = function(args) { var self = this, $iter = TMP_2._p, block = $iter || nil; + args = $slice.call(arguments, 0); TMP_2._p = null; @@ -8883,33 +10141,39 @@ def.$to_proc = function() { var self = this; + return self; }; def['$lambda?'] = function() { var self = this; + return !!self.is_lambda; }; return (def.$arity = function() { var self = this; + return self.length; - }, nil); + }, nil) && 'arity'; })(self, null) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + (function($base, $super) { function $Method(){}; var self = $Method = $klass($base, $super, 'Method', $Method); - var def = $Method._proto, $scope = $Method._scope, TMP_1; + var def = self._proto, $scope = self._scope, TMP_1; + def.method = def.receiver = def.owner = def.name = def.obj = nil; self.$attr_reader("owner", "receiver", "name"); def.$initialize = function(receiver, method, name) { var self = this; + self.receiver = receiver; self.owner = receiver.$class(); self.name = name; @@ -8918,11 +10182,13 @@ def.$arity = function() { var self = this; + return self.method.$arity(); }; def.$call = TMP_1 = function(args) { var self = this, $iter = TMP_1._p, block = $iter || nil; + args = $slice.call(arguments, 0); TMP_1._p = null; @@ -8936,29 +10202,34 @@ def.$unbind = function() { var self = this; + return $scope.UnboundMethod.$new(self.owner, self.method, self.name); }; def.$to_proc = function() { var self = this; + return self.method; }; return (def.$inspect = function() { var self = this; + return "#"; - }, nil); + }, nil) && 'inspect'; })(self, null); return (function($base, $super) { function $UnboundMethod(){}; var self = $UnboundMethod = $klass($base, $super, 'UnboundMethod', $UnboundMethod); - var def = $UnboundMethod._proto, $scope = $UnboundMethod._scope; + var def = self._proto, $scope = self._scope; + def.method = def.name = def.owner = nil; self.$attr_reader("owner", "name"); def.$initialize = function(owner, method, name) { var self = this; + self.owner = owner; self.method = method; return self.name = name; @@ -8966,28 +10237,34 @@ def.$arity = function() { var self = this; + return self.method.$arity(); }; def.$bind = function(object) { var self = this; + return $scope.Method.$new(object, self.method, self.name); }; return (def.$inspect = function() { var self = this; + return "#"; - }, nil); + }, nil) && 'inspect'; })(self, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + + ; return (function($base, $super) { function $Range(){}; var self = $Range = $klass($base, $super, 'Range', $Range); - var def = $Range._proto, $scope = $Range._scope, TMP_1, TMP_2, TMP_3; + var def = self._proto, $scope = self._scope, TMP_1, TMP_2, TMP_3; + def.begin = def.exclude = def.end = nil; self.$include($scope.Enumerable); @@ -8997,6 +10274,7 @@ def.$initialize = function(first, last, exclude) { var self = this; + if (exclude == null) { exclude = false } @@ -9007,6 +10285,7 @@ def['$=='] = function(other) { var self = this; + if (!other._isRange) { return false; @@ -9018,58 +10297,61 @@ }; - def['$==='] = function(obj) { - var self = this; - return self['$include?'](obj); - }; - - def['$cover?'] = function(value) { + def['$==='] = function(value) { var $a, $b, self = this; - return (($a = self.begin['$<='](value)) ? ((function() {if (($b = self.exclude) !== false && $b !== nil) { + + return (($a = self.begin['$<='](value)) ? ((function() {if ((($b = self.exclude) !== nil && (!$b._isBoolean || $b == true))) { return value['$<'](self.end) } else { return value['$<='](self.end) }; return nil; })()) : $a); }; - $opal.defn(self, '$last', def.$end); + $opal.defn(self, '$cover?', def['$===']); def.$each = TMP_1 = function() { - var $a, $b, $c, self = this, $iter = TMP_1._p, block = $iter || nil, current = nil, last = nil; + var $a, $b, self = this, $iter = TMP_1._p, block = $iter || nil, current = nil, last = nil; + TMP_1._p = null; - if (block === nil) { - return self.$enum_for("each")}; + if ((block !== nil)) { + } else { + return self.$enum_for("each") + }; current = self.begin; last = self.end; while (current['$<'](last)) { if ($opal.$yield1(block, current) === $breaker) return $breaker.$v; current = current.$succ();}; - if (($a = ($b = ($c = self.exclude, ($c === nil || $c === false)), $b !== false && $b !== nil ?current['$=='](last) : $b)) !== false && $a !== nil) { + if ((($a = ($b = self.exclude['$!'](), $b !== false && $b !== nil ?current['$=='](last) : $b)) !== nil && (!$a._isBoolean || $a == true))) { if ($opal.$yield1(block, current) === $breaker) return $breaker.$v}; return self; }; def['$eql?'] = function(other) { var $a, $b, self = this; - if (($a = $scope.Range['$==='](other)) === false || $a === nil) { - return false}; + + if ((($a = $scope.Range['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return false + }; return ($a = ($b = self.exclude['$==='](other['$exclude_end?']()), $b !== false && $b !== nil ?self.begin['$eql?'](other.$begin()) : $b), $a !== false && $a !== nil ?self.end['$eql?'](other.$end()) : $a); }; def['$exclude_end?'] = function() { var self = this; + return self.exclude; }; $opal.defn(self, '$first', def.$begin); - def['$include?'] = function(obj) { - var self = this; - return self['$cover?'](obj); - }; + $opal.defn(self, '$include?', def['$cover?']); + + $opal.defn(self, '$last', def.$end); def.$max = TMP_2 = function() {var $zuper = $slice.call(arguments, 0); var self = this, $iter = TMP_2._p, $yield = $iter || nil; + TMP_2._p = null; if (($yield !== nil)) { return $opal.find_super_dispatcher(self, 'max', TMP_2, $iter).apply(self, $zuper) @@ -9078,8 +10360,11 @@ }; }; + $opal.defn(self, '$member?', def['$cover?']); + def.$min = TMP_3 = function() {var $zuper = $slice.call(arguments, 0); var self = this, $iter = TMP_3._p, $yield = $iter || nil; + TMP_3._p = null; if (($yield !== nil)) { return $opal.find_super_dispatcher(self, 'min', TMP_3, $iter).apply(self, $zuper) @@ -9090,8 +10375,28 @@ $opal.defn(self, '$member?', def['$include?']); + def.$size = function() { + var $a, $b, self = this, _begin = nil, _end = nil, infinity = nil; + + _begin = self.begin; + _end = self.end; + if ((($a = self.exclude) !== nil && (!$a._isBoolean || $a == true))) { + _end = _end['$-'](1)}; + if ((($a = ($b = $scope.Numeric['$==='](_begin), $b !== false && $b !== nil ?$scope.Numeric['$==='](_end) : $b)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + return nil + }; + if (_end['$<'](_begin)) { + return 0}; + infinity = ($scope.Float)._scope.INFINITY; + if ((($a = ((($b = infinity['$=='](_begin.$abs())) !== false && $b !== nil) ? $b : _end.$abs()['$=='](infinity))) !== nil && (!$a._isBoolean || $a == true))) { + return infinity}; + return ((Math.abs(_end - _begin) + 1)).$to_i(); + }; + def.$step = function(n) { var self = this; + if (n == null) { n = 1 } @@ -9100,31 +10405,36 @@ def.$to_s = function() { var self = this; + return self.begin.$inspect() + (self.exclude ? '...' : '..') + self.end.$inspect(); }; return $opal.defn(self, '$inspect', def.$to_s); - })(self, null) + })(self, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; - (function($base, $super) { + + ; + return (function($base, $super) { function $Time(){}; var self = $Time = $klass($base, $super, 'Time', $Time); - var def = $Time._proto, $scope = $Time._scope; + var def = self._proto, $scope = self._scope; + self.$include($scope.Comparable); var days_of_week = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], short_days = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], short_months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], - long_months = ["January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + long_months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; ; $opal.defs(self, '$at', function(seconds, frac) { var self = this; + if (frac == null) { frac = 0 } @@ -9133,6 +10443,7 @@ $opal.defs(self, '$new', function(year, month, day, hour, minute, second, utc_offset) { var self = this; + switch (arguments.length) { case 1: @@ -9154,7 +10465,7 @@ return new Date(year, month - 1, day, hour, minute, second); case 7: - self.$raise($scope.NotImplementedError); + return new Date(year, month - 1, day, hour, minute, second); default: return new Date(); @@ -9164,6 +10475,7 @@ $opal.defs(self, '$local', function(year, month, day, hour, minute, second, millisecond) { var $a, self = this; + if (month == null) { month = nil } @@ -9182,7 +10494,7 @@ if (millisecond == null) { millisecond = nil } - if (($a = arguments.length === 10) !== false && $a !== nil) { + if ((($a = arguments.length === 10) !== nil && (!$a._isBoolean || $a == true))) { var args = $slice.call(arguments).reverse(); @@ -9193,125 +10505,145 @@ month = args[5]; year = args[4]; }; - year = (function() {if (($a = year['$kind_of?']($scope.String)) !== false && $a !== nil) { + year = (function() {if ((($a = year['$kind_of?']($scope.String)) !== nil && (!$a._isBoolean || $a == true))) { return year.$to_i() } else { return $scope.Opal.$coerce_to(year, $scope.Integer, "to_int") }; return nil; })(); - month = (function() {if (($a = month['$kind_of?']($scope.String)) !== false && $a !== nil) { + month = (function() {if ((($a = month['$kind_of?']($scope.String)) !== nil && (!$a._isBoolean || $a == true))) { return month.$to_i() } else { return $scope.Opal.$coerce_to(((($a = month) !== false && $a !== nil) ? $a : 1), $scope.Integer, "to_int") }; return nil; })(); - if (($a = month['$between?'](1, 12)) === false || $a === nil) { - self.$raise($scope.ArgumentError, "month out of range: " + (month))}; - day = (function() {if (($a = day['$kind_of?']($scope.String)) !== false && $a !== nil) { + if ((($a = month['$between?'](1, 12)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "month out of range: " + (month)) + }; + day = (function() {if ((($a = day['$kind_of?']($scope.String)) !== nil && (!$a._isBoolean || $a == true))) { return day.$to_i() } else { return $scope.Opal.$coerce_to(((($a = day) !== false && $a !== nil) ? $a : 1), $scope.Integer, "to_int") }; return nil; })(); - if (($a = day['$between?'](1, 31)) === false || $a === nil) { - self.$raise($scope.ArgumentError, "day out of range: " + (day))}; - hour = (function() {if (($a = hour['$kind_of?']($scope.String)) !== false && $a !== nil) { + if ((($a = day['$between?'](1, 31)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "day out of range: " + (day)) + }; + hour = (function() {if ((($a = hour['$kind_of?']($scope.String)) !== nil && (!$a._isBoolean || $a == true))) { return hour.$to_i() } else { return $scope.Opal.$coerce_to(((($a = hour) !== false && $a !== nil) ? $a : 0), $scope.Integer, "to_int") }; return nil; })(); - if (($a = hour['$between?'](0, 24)) === false || $a === nil) { - self.$raise($scope.ArgumentError, "hour out of range: " + (hour))}; - minute = (function() {if (($a = minute['$kind_of?']($scope.String)) !== false && $a !== nil) { + if ((($a = hour['$between?'](0, 24)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "hour out of range: " + (hour)) + }; + minute = (function() {if ((($a = minute['$kind_of?']($scope.String)) !== nil && (!$a._isBoolean || $a == true))) { return minute.$to_i() } else { return $scope.Opal.$coerce_to(((($a = minute) !== false && $a !== nil) ? $a : 0), $scope.Integer, "to_int") }; return nil; })(); - if (($a = minute['$between?'](0, 59)) === false || $a === nil) { - self.$raise($scope.ArgumentError, "minute out of range: " + (minute))}; - second = (function() {if (($a = second['$kind_of?']($scope.String)) !== false && $a !== nil) { + if ((($a = minute['$between?'](0, 59)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "minute out of range: " + (minute)) + }; + second = (function() {if ((($a = second['$kind_of?']($scope.String)) !== nil && (!$a._isBoolean || $a == true))) { return second.$to_i() } else { return $scope.Opal.$coerce_to(((($a = second) !== false && $a !== nil) ? $a : 0), $scope.Integer, "to_int") }; return nil; })(); - if (($a = second['$between?'](0, 59)) === false || $a === nil) { - self.$raise($scope.ArgumentError, "second out of range: " + (second))}; + if ((($a = second['$between?'](0, 59)) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.ArgumentError, "second out of range: " + (second)) + }; return ($a = self).$new.apply($a, [].concat([year, month, day, hour, minute, second].$compact())); }); $opal.defs(self, '$gm', function(year, month, day, hour, minute, second, utc_offset) { var $a, self = this; - if (($a = year['$nil?']()) !== false && $a !== nil) { + + if ((($a = year['$nil?']()) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.TypeError, "missing year (got nil)")}; - switch (arguments.length) { - case 1: - return new Date(Date.UTC(year, 0)); - - case 2: - return new Date(Date.UTC(year, month - 1)); - - case 3: - return new Date(Date.UTC(year, month - 1, day)); - - case 4: - return new Date(Date.UTC(year, month - 1, day, hour)); - - case 5: - return new Date(Date.UTC(year, month - 1, day, hour, minute)); - - case 6: - return new Date(Date.UTC(year, month - 1, day, hour, minute, second)); - - case 7: - self.$raise($scope.NotImplementedError); + if (month > 12 || day > 31 || hour > 24 || minute > 59 || second > 59) { + self.$raise($scope.ArgumentError); } - + + var date = new Date(Date.UTC(year, (month || 1) - 1, (day || 1), (hour || 0), (minute || 0), (second || 0))); + date.tz_offset = 0 + return date; + ; }); (function(self) { var $scope = self._scope, def = self._proto; + self._proto.$mktime = self._proto.$local; return self._proto.$utc = self._proto.$gm; })(self.$singleton_class()); $opal.defs(self, '$now', function() { var self = this; + return new Date(); }); def['$+'] = function(other) { var $a, self = this; - if (($a = $scope.Time['$==='](other)) !== false && $a !== nil) { + + if ((($a = $scope.Time['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { self.$raise($scope.TypeError, "time + time?")}; other = $scope.Opal.$coerce_to(other, $scope.Integer, "to_int"); - return new Date(self.getTime() + (other * 1000)); + + var result = new Date(self.getTime() + (other * 1000)); + result.tz_offset = self.tz_offset; + return result; + }; def['$-'] = function(other) { var $a, self = this; - if (($a = $scope.Time['$==='](other)) !== false && $a !== nil) { + + if ((($a = $scope.Time['$==='](other)) !== nil && (!$a._isBoolean || $a == true))) { return (self.getTime() - other.getTime()) / 1000; } else { other = $scope.Opal.$coerce_to(other, $scope.Integer, "to_int"); - return new Date(self.getTime() - (other * 1000)); + + var result = new Date(self.getTime() - (other * 1000)); + result.tz_offset = self.tz_offset; + return result; + }; }; def['$<=>'] = function(other) { var self = this; + return self.$to_f()['$<=>'](other.$to_f()); }; def['$=='] = function(other) { var self = this; + return self.$to_f() === other.$to_f(); }; + def.$asctime = function() { + var self = this; + + return self.$strftime("%a %b %e %H:%M:%S %Y"); + }; + + $opal.defn(self, '$ctime', def.$asctime); + def.$day = function() { var self = this; + return self.getDate(); }; def.$yday = function() { var self = this; + // http://javascript.about.com/library/bldayyear.htm var onejan = new Date(self.getFullYear(), 0, 1); @@ -9321,43 +10653,55 @@ def.$isdst = function() { var self = this; + return self.$raise($scope.NotImplementedError); }; def['$eql?'] = function(other) { var $a, self = this; + return ($a = other['$is_a?']($scope.Time), $a !== false && $a !== nil ?(self['$<=>'](other))['$zero?']() : $a); }; def['$friday?'] = function() { var self = this; + return self.getDay() === 5; }; def.$hour = function() { var self = this; + return self.getHours(); }; def.$inspect = function() { - var self = this; - return self.toString(); + var $a, self = this; + + if ((($a = self['$utc?']()) !== nil && (!$a._isBoolean || $a == true))) { + return self.$strftime("%Y-%m-%d %H:%M:%S UTC") + } else { + return self.$strftime("%Y-%m-%d %H:%M:%S %z") + }; }; $opal.defn(self, '$mday', def.$day); def.$min = function() { var self = this; + return self.getMinutes(); }; def.$mon = function() { var self = this; + return self.getMonth() + 1; }; def['$monday?'] = function() { var self = this; + return self.getDay() === 1; }; @@ -9365,22 +10709,26 @@ def['$saturday?'] = function() { var self = this; + return self.getDay() === 6; }; def.$sec = function() { var self = this; + return self.getSeconds(); }; def.$usec = function() { var self = this; + self.$warn("Microseconds are not supported"); return 0; }; def.$zone = function() { var self = this; + var string = self.toString(), result; @@ -9401,13 +10749,31 @@ }; + def.$getgm = function() { + var self = this; + + + var result = new Date(self.getTime()); + result.tz_offset = 0; + return result; + + }; + + def['$gmt?'] = function() { + var self = this; + + return self.tz_offset == 0; + }; + def.$gmt_offset = function() { var self = this; + return -self.getTimezoneOffset() * 60; }; def.$strftime = function(format) { var self = this; + return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) { var result = "", @@ -9637,26 +11003,31 @@ def['$sunday?'] = function() { var self = this; + return self.getDay() === 0; }; def['$thursday?'] = function() { var self = this; + return self.getDay() === 4; }; def.$to_a = function() { var self = this; + return [self.$sec(), self.$min(), self.$hour(), self.$day(), self.$month(), self.$year(), self.$wday(), self.$yday(), self.$isdst(), self.$zone()]; }; def.$to_f = function() { var self = this; + return self.getTime() / 1000; }; def.$to_i = function() { var self = this; + return parseInt(self.getTime() / 1000); }; @@ -9664,60 +11035,64 @@ def['$tuesday?'] = function() { var self = this; + return self.getDay() === 2; }; + $opal.defn(self, '$utc?', def['$gmt?']); + + def.$utc_offset = function() { + var self = this; + + return self.getTimezoneOffset() * -60; + }; + def.$wday = function() { var self = this; + return self.getDay(); }; def['$wednesday?'] = function() { var self = this; + return self.getDay() === 3; }; return (def.$year = function() { var self = this; - return self.getFullYear(); - }, nil); - })(self, null); - return (function($base, $super) { - function $Time(){}; - var self = $Time = $klass($base, $super, 'Time', $Time); - - var def = $Time._proto, $scope = $Time._scope; - $opal.defs(self, '$parse', function(str) { - var self = this; - return new Date(Date.parse(str)); - }); - return (def.$iso8601 = function() { - var self = this; - return self.$strftime("%FT%T%z"); - }, nil); + return self.getFullYear(); + }, nil) && 'year'; })(self, null); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass; + return (function($base, $super) { function $Struct(){}; var self = $Struct = $klass($base, $super, 'Struct', $Struct); - var def = $Struct._proto, $scope = $Struct._scope, TMP_1, TMP_8, TMP_10; + var def = self._proto, $scope = self._scope, TMP_1, TMP_8, TMP_10; + $opal.defs(self, '$new', TMP_1 = function(name, args) {var $zuper = $slice.call(arguments, 0); var $a, $b, $c, TMP_2, self = this, $iter = TMP_1._p, block = $iter || nil; + args = $slice.call(arguments, 1); TMP_1._p = null; - if (($a = self['$==']($scope.Struct)) === false || $a === nil) { - return $opal.find_super_dispatcher(self, 'new', TMP_1, $iter, $Struct).apply(self, $zuper)}; + if (self['$==']($scope.Struct)) { + } else { + return $opal.find_super_dispatcher(self, 'new', TMP_1, $iter, $Struct).apply(self, $zuper) + }; if (name['$[]'](0)['$=='](name['$[]'](0).$upcase())) { return $scope.Struct.$const_set(name, ($a = self).$new.apply($a, [].concat(args))) } else { args.$unshift(name); return ($b = ($c = $scope.Class).$new, $b._p = (TMP_2 = function(){var self = TMP_2._s || this, $a, $b, TMP_3, $c; - ($a = ($b = args).$each, $a._p = (TMP_3 = function(arg){var self = TMP_3._s || this;if (arg == null) arg = nil; + + ($a = ($b = args).$each, $a._p = (TMP_3 = function(arg){var self = TMP_3._s || this; +if (arg == null) arg = nil; return self.$define_struct_attribute(arg)}, TMP_3._s = self, TMP_3), $a).call($b); if (block !== false && block !== nil) { return ($a = ($c = self).$instance_eval, $a._p = block.$to_proc(), $a).call($c) @@ -9729,12 +11104,15 @@ $opal.defs(self, '$define_struct_attribute', function(name) { var $a, $b, TMP_4, $c, TMP_5, self = this; + if (self['$==']($scope.Struct)) { self.$raise($scope.ArgumentError, "you cannot define attributes to the Struct class")}; self.$members()['$<<'](name); ($a = ($b = self).$define_method, $a._p = (TMP_4 = function(){var self = TMP_4._s || this; + return self.$instance_variable_get("@" + (name))}, TMP_4._s = self, TMP_4), $a).call($b, name); - return ($a = ($c = self).$define_method, $a._p = (TMP_5 = function(value){var self = TMP_5._s || this;if (value == null) value = nil; + return ($a = ($c = self).$define_method, $a._p = (TMP_5 = function(value){var self = TMP_5._s || this; +if (value == null) value = nil; return self.$instance_variable_set("@" + (name), value)}, TMP_5._s = self, TMP_5), $a).call($c, "" + (name) + "="); }); @@ -9755,71 +11133,100 @@ return nil}; members = self.members; return ($a = ($b = klass).$instance_eval, $a._p = (TMP_6 = function(){var self = TMP_6._s || this; + return self.members = members}, TMP_6._s = self, TMP_6), $a).call($b); }); + (function(self) { + var $scope = self._scope, def = self._proto; + + return self._proto['$[]'] = self._proto.$new + })(self.$singleton_class()); + self.$include($scope.Enumerable); def.$initialize = function(args) { var $a, $b, TMP_7, self = this; + args = $slice.call(arguments, 0); - return ($a = ($b = self.$members()).$each_with_index, $a._p = (TMP_7 = function(name, index){var self = TMP_7._s || this;if (name == null) name = nil;if (index == null) index = nil; + return ($a = ($b = self.$members()).$each_with_index, $a._p = (TMP_7 = function(name, index){var self = TMP_7._s || this; +if (name == null) name = nil;if (index == null) index = nil; return self.$instance_variable_set("@" + (name), args['$[]'](index))}, TMP_7._s = self, TMP_7), $a).call($b); }; def.$members = function() { var self = this; + return self.$class().$members(); }; def['$[]'] = function(name) { var $a, self = this; - if (($a = $scope.Integer['$==='](name)) !== false && $a !== nil) { + + if ((($a = $scope.Integer['$==='](name)) !== nil && (!$a._isBoolean || $a == true))) { if (name['$>='](self.$members().$size())) { self.$raise($scope.IndexError, "offset " + (name) + " too large for struct(size:" + (self.$members().$size()) + ")")}; name = self.$members()['$[]'](name); - } else if (($a = self.$members()['$include?'](name.$to_sym())) === false || $a === nil) { - self.$raise($scope.NameError, "no member '" + (name) + "' in struct")}; + } else if ((($a = self.$members()['$include?'](name.$to_sym())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.NameError, "no member '" + (name) + "' in struct") + }; return self.$instance_variable_get("@" + (name)); }; def['$[]='] = function(name, value) { var $a, self = this; - if (($a = $scope.Integer['$==='](name)) !== false && $a !== nil) { + + if ((($a = $scope.Integer['$==='](name)) !== nil && (!$a._isBoolean || $a == true))) { if (name['$>='](self.$members().$size())) { self.$raise($scope.IndexError, "offset " + (name) + " too large for struct(size:" + (self.$members().$size()) + ")")}; name = self.$members()['$[]'](name); - } else if (($a = self.$members()['$include?'](name.$to_sym())) === false || $a === nil) { - self.$raise($scope.NameError, "no member '" + (name) + "' in struct")}; + } else if ((($a = self.$members()['$include?'](name.$to_sym())) !== nil && (!$a._isBoolean || $a == true))) { + } else { + self.$raise($scope.NameError, "no member '" + (name) + "' in struct") + }; return self.$instance_variable_set("@" + (name), value); }; def.$each = TMP_8 = function() { var $a, $b, TMP_9, self = this, $iter = TMP_8._p, $yield = $iter || nil; + TMP_8._p = null; - if ($yield === nil) { - return self.$enum_for("each")}; - return ($a = ($b = self.$members()).$each, $a._p = (TMP_9 = function(name){var self = TMP_9._s || this, $a;if (name == null) name = nil; + if (($yield !== nil)) { + } else { + return self.$enum_for("each") + }; + ($a = ($b = self.$members()).$each, $a._p = (TMP_9 = function(name){var self = TMP_9._s || this, $a; +if (name == null) name = nil; return $a = $opal.$yield1($yield, self['$[]'](name)), $a === $breaker ? $a : $a}, TMP_9._s = self, TMP_9), $a).call($b); + return self; }; def.$each_pair = TMP_10 = function() { var $a, $b, TMP_11, self = this, $iter = TMP_10._p, $yield = $iter || nil; + TMP_10._p = null; - if ($yield === nil) { - return self.$enum_for("each_pair")}; - return ($a = ($b = self.$members()).$each, $a._p = (TMP_11 = function(name){var self = TMP_11._s || this, $a;if (name == null) name = nil; + if (($yield !== nil)) { + } else { + return self.$enum_for("each_pair") + }; + ($a = ($b = self.$members()).$each, $a._p = (TMP_11 = function(name){var self = TMP_11._s || this, $a; +if (name == null) name = nil; return $a = $opal.$yieldX($yield, [name, self['$[]'](name)]), $a === $breaker ? $a : $a}, TMP_11._s = self, TMP_11), $a).call($b); + return self; }; def['$eql?'] = function(other) { var $a, $b, $c, TMP_12, self = this; - return ((($a = self.$hash()['$=='](other.$hash())) !== false && $a !== nil) ? $a : ($b = ($c = other.$each_with_index())['$all?'], $b._p = (TMP_12 = function(object, index){var self = TMP_12._s || this;if (object == null) object = nil;if (index == null) index = nil; + + return ((($a = self.$hash()['$=='](other.$hash())) !== false && $a !== nil) ? $a : ($b = ($c = other.$each_with_index())['$all?'], $b._p = (TMP_12 = function(object, index){var self = TMP_12._s || this; +if (object == null) object = nil;if (index == null) index = nil; return self['$[]'](self.$members()['$[]'](index))['$=='](object)}, TMP_12._s = self, TMP_12), $b).call($c)); }; def.$length = function() { var self = this; + return self.$members().$length(); }; @@ -9827,32 +11234,42 @@ def.$to_a = function() { var $a, $b, TMP_13, self = this; - return ($a = ($b = self.$members()).$map, $a._p = (TMP_13 = function(name){var self = TMP_13._s || this;if (name == null) name = nil; + + return ($a = ($b = self.$members()).$map, $a._p = (TMP_13 = function(name){var self = TMP_13._s || this; +if (name == null) name = nil; return self['$[]'](name)}, TMP_13._s = self, TMP_13), $a).call($b); }; $opal.defn(self, '$values', def.$to_a); - return (def.$inspect = function() { + def.$inspect = function() { var $a, $b, TMP_14, self = this, result = nil; + result = "#"); return result; - }, nil); + }; + + return $opal.defn(self, '$to_s', def.$inspect); })(self, null) })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $klass = $opal.klass, $module = $opal.module, $gvars = $opal.gvars; + if ($gvars.stdout == null) $gvars.stdout = nil; + if ($gvars.stderr == null) $gvars.stderr = nil; + (function($base, $super) { function $IO(){}; var self = $IO = $klass($base, $super, 'IO', $IO); - var def = $IO._proto, $scope = $IO._scope; + var def = self._proto, $scope = self._scope; + $opal.cdecl($scope, 'SEEK_SET', 0); $opal.cdecl($scope, 'SEEK_CUR', 1); @@ -9863,23 +11280,31 @@ var self = $module($base, 'Writable'); var def = self._proto, $scope = self._scope; + def['$<<'] = function(string) { var self = this; + self.$write(string); return self; }; def.$print = function(args) { var $a, $b, TMP_1, self = this; + if ($gvars[","] == null) $gvars[","] = nil; + args = $slice.call(arguments, 0); - return self.$write(($a = ($b = args).$map, $a._p = (TMP_1 = function(arg){var self = TMP_1._s || this;if (arg == null) arg = nil; + return self.$write(($a = ($b = args).$map, $a._p = (TMP_1 = function(arg){var self = TMP_1._s || this; +if (arg == null) arg = nil; return self.$String(arg)}, TMP_1._s = self, TMP_1), $a).call($b).$join($gvars[","])); }; def.$puts = function(args) { var $a, $b, TMP_2, self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + args = $slice.call(arguments, 0); - return self.$write(($a = ($b = args).$map, $a._p = (TMP_2 = function(arg){var self = TMP_2._s || this;if (arg == null) arg = nil; + return self.$write(($a = ($b = args).$map, $a._p = (TMP_2 = function(arg){var self = TMP_2._s || this; +if (arg == null) arg = nil; return self.$String(arg)}, TMP_2._s = self, TMP_2), $a).call($b).$join($gvars["/"])); }; ;$opal.donate(self, ["$<<", "$print", "$puts"]); @@ -9889,18 +11314,23 @@ var self = $module($base, 'Readable'); var def = self._proto, $scope = self._scope; + def.$readbyte = function() { var self = this; + return self.$getbyte(); }; def.$readchar = function() { var self = this; + return self.$getc(); }; def.$readline = function(sep) { var self = this; + if ($gvars["/"] == null) $gvars["/"] = nil; + if (sep == null) { sep = $gvars["/"] } @@ -9909,6 +11339,7 @@ def.$readpartial = function(integer, outbuf) { var self = this; + if (outbuf == null) { outbuf = nil } @@ -9917,693 +11348,64 @@ ;$opal.donate(self, ["$readbyte", "$readchar", "$readline", "$readpartial"]); })(self); })(self, null); - $opal.cdecl($scope, 'STDERR', $gvars["stderr"] = $scope.IO.$new()); - $opal.cdecl($scope, 'STDIN', $gvars["stdin"] = $scope.IO.$new()); - $opal.cdecl($scope, 'STDOUT', $gvars["stdout"] = $scope.IO.$new()); - $opal.defs($gvars["stdout"], '$puts', function(strs) { - var $a, self = this; - strs = $slice.call(arguments, 0); - - for (var i = 0; i < strs.length; i++) { - if (strs[i] instanceof Array) { - ($a = self).$puts.apply($a, [].concat((strs[i]))); - } - else { - console.log((strs[i]).$to_s()); - } - } - + $opal.cdecl($scope, 'STDERR', $gvars.stderr = $scope.IO.$new()); + $opal.cdecl($scope, 'STDIN', $gvars.stdin = $scope.IO.$new()); + $opal.cdecl($scope, 'STDOUT', $gvars.stdout = $scope.IO.$new()); + $opal.defs($gvars.stdout, '$write', function(string) { + var self = this; + + console.log(string.$to_s());; return nil; }); - return ($opal.defs($gvars["stderr"], '$puts', function(strs) { - var $a, self = this; - strs = $slice.call(arguments, 0); - - for (var i = 0; i < strs.length; i++) { - if (strs[i] instanceof Array) { - ($a = self).$puts.apply($a, [].concat((strs[i]))); - } - else { - console.warn((strs[i]).$to_s()); - } - } - + $opal.defs($gvars.stderr, '$write', function(string) { + var self = this; + + console.warn(string.$to_s());; return nil; - }), nil); + }); + $gvars.stdout.$extend(($scope.IO)._scope.Writable); + return $gvars.stderr.$extend(($scope.IO)._scope.Writable); })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; + $opal.defs(self, '$to_s', function() { var self = this; + return "main"; }); return ($opal.defs(self, '$include', function(mod) { var self = this; + return $scope.Object.$include(mod); - }), nil); + }), nil) && 'include'; })(Opal); -/* Generated by Opal 0.5.5 */ +/* Generated by Opal 0.6.2 */ (function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $module = $opal.module, $range = $opal.range, $hash2 = $opal.hash2, $klass = $opal.klass, $gvars = $opal.gvars; - (function($base) { - var self = $module($base, 'Native'); - - var def = self._proto, $scope = self._scope, TMP_1; - $opal.defs(self, '$is_a?', function(object, klass) { - var self = this; - - try { - return object instanceof $scope.Native.$try_convert(klass); - } - catch (e) { - return false; - } - ; - }); - - $opal.defs(self, '$try_convert', function(value) { - var self = this; - - if (self['$native?'](value)) { - return value; - } - else if (value['$respond_to?']("to_n")) { - return value.$to_n(); - } - else { - return nil; - } - ; - }); - - $opal.defs(self, '$convert', function(value) { - var self = this; - - if (self['$native?'](value)) { - return value; - } - else if (value['$respond_to?']("to_n")) { - return value.$to_n(); - } - else { - self.$raise($scope.ArgumentError, "the passed value isn't a native"); - } - ; - }); - - $opal.defs(self, '$call', TMP_1 = function(obj, key, args) { - var $a, $b, TMP_2, self = this, $iter = TMP_1._p, block = $iter || nil; - args = $slice.call(arguments, 2); - TMP_1._p = null; - - var prop = obj[key]; - - if (prop == null) { - return nil; - } - else if (prop instanceof Function) { - if (block !== nil) { - args.push(block); - } - - args = ($a = ($b = args).$map, $a._p = (TMP_2 = function(value){var self = TMP_2._s || this, $a, native$ = nil;if (value == null) value = nil; - native$ = self.$try_convert(value); - if (($a = nil['$==='](native$)) !== false && $a !== nil) { - return value - } else { - return native$ - };}, TMP_2._s = self, TMP_2), $a).call($b); - - return self.$Native(prop.apply(obj, args)); - } - else if (self['$native?'](prop)) { - return self.$Native(prop); - } - else { - return prop; - } - ; - }); - - (function($base) { - var self = $module($base, 'Helpers'); - - var def = self._proto, $scope = self._scope; - def.$alias_native = function(new$, old, options) { - var $a, $b, TMP_3, $c, TMP_4, $d, TMP_5, self = this, as = nil; - if (old == null) { - old = new$ - } - if (options == null) { - options = $hash2([], {}) - } - if (($a = old['$end_with?']("=")) !== false && $a !== nil) { - return ($a = ($b = self).$define_method, $a._p = (TMP_3 = function(value){var self = TMP_3._s || this; - if (self['native'] == null) self['native'] = nil; -if (value == null) value = nil; - self['native'][old['$[]']($range(0, -2, false))] = $scope.Native.$convert(value); - return value;}, TMP_3._s = self, TMP_3), $a).call($b, new$) - } else if (($a = as = options['$[]']("as")) !== false && $a !== nil) { - return ($a = ($c = self).$define_method, $a._p = (TMP_4 = function(args){var self = TMP_4._s || this, block, $a, $b, $c; - if (self['native'] == null) self['native'] = nil; -args = $slice.call(arguments, 0); - block = TMP_4._p || nil, TMP_4._p = null; - if (($a = value = ($b = ($c = $scope.Native).$call, $b._p = block.$to_proc(), $b).apply($c, [self['native'], old].concat(args))) !== false && $a !== nil) { - return as.$new(value.$to_n()) - } else { - return nil - }}, TMP_4._s = self, TMP_4), $a).call($c, new$) - } else { - return ($a = ($d = self).$define_method, $a._p = (TMP_5 = function(args){var self = TMP_5._s || this, block, $a, $b; - if (self['native'] == null) self['native'] = nil; -args = $slice.call(arguments, 0); - block = TMP_5._p || nil, TMP_5._p = null; - return ($a = ($b = $scope.Native).$call, $a._p = block.$to_proc(), $a).apply($b, [self['native'], old].concat(args))}, TMP_5._s = self, TMP_5), $a).call($d, new$) - }; - } - ;$opal.donate(self, ["$alias_native"]); - })(self); - - $opal.defs(self, '$included', function(klass) { - var self = this; - return klass.$extend($scope.Helpers); - }); - - def.$initialize = function(native$) { - var $a, self = this; - if (($a = $scope.Kernel['$native?'](native$)) === false || $a === nil) { - $scope.Kernel.$raise($scope.ArgumentError, "the passed value isn't native")}; - return self['native'] = native$; - }; - - def.$to_n = function() { - var self = this; - if (self['native'] == null) self['native'] = nil; - - return self['native']; - }; - ;$opal.donate(self, ["$initialize", "$to_n"]); - })(self); - (function($base) { - var self = $module($base, 'Kernel'); - - var def = self._proto, $scope = self._scope, TMP_6; - def['$native?'] = function(value) { - var self = this; - return value == null || !value._klass; - }; - - def.$Native = function(obj) { - var $a, self = this; - if (($a = obj == null) !== false && $a !== nil) { - return nil - } else if (($a = self['$native?'](obj)) !== false && $a !== nil) { - return ($scope.Native)._scope.Object.$new(obj) - } else { - return obj - }; - }; - - def.$Array = TMP_6 = function(object, args) { - var $a, $b, self = this, $iter = TMP_6._p, block = $iter || nil; - args = $slice.call(arguments, 1); - TMP_6._p = null; - - if (object == null || object === nil) { - return []; - } - else if (self['$native?'](object)) { - return ($a = ($b = ($scope.Native)._scope.Array).$new, $a._p = block.$to_proc(), $a).apply($b, [object].concat(args)).$to_a(); - } - else if (object['$respond_to?']("to_ary")) { - return object.$to_ary(); - } - else if (object['$respond_to?']("to_a")) { - return object.$to_a(); - } - else { - return [object]; - } - ; - }; - ;$opal.donate(self, ["$native?", "$Native", "$Array"]); - })(self); - (function($base, $super) { - function $Object(){}; - var self = $Object = $klass($base, $super, 'Object', $Object); - - var def = $Object._proto, $scope = $Object._scope, TMP_7, TMP_8, TMP_9, TMP_10; - def['native'] = nil; - self.$include($scope.Native); + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $gvars = $opal.gvars, $hash2 = $opal.hash2; - $opal.defn(self, '$==', function(other) { - var self = this; - return self['native'] === $scope.Native.$try_convert(other); - }); + $gvars["&"] = $gvars["~"] = $gvars["`"] = $gvars["'"] = nil; + $gvars[":"] = []; + $gvars["\""] = []; + $gvars["/"] = "\n"; + $gvars[","] = nil; + $opal.cdecl($scope, 'ARGV', []); + $opal.cdecl($scope, 'ARGF', $scope.Object.$new()); + $opal.cdecl($scope, 'ENV', $hash2([], {})); + $gvars.VERBOSE = false; + $gvars.DEBUG = false; + $gvars.SAFE = 0; + $opal.cdecl($scope, 'RUBY_PLATFORM', "opal"); + $opal.cdecl($scope, 'RUBY_ENGINE', "opal"); + $opal.cdecl($scope, 'RUBY_VERSION', "2.1.1"); + $opal.cdecl($scope, 'RUBY_ENGINE_VERSION', "0.6.1"); + return $opal.cdecl($scope, 'RUBY_RELEASE_DATE', "2014-04-15"); +})(Opal); +/* Generated by Opal 0.6.2 */ +(function($opal) { + var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice; - $opal.defn(self, '$has_key?', function(name) { - var self = this; - return self['native'].hasOwnProperty(name); - }); - - $opal.defn(self, '$key?', def['$has_key?']); - - $opal.defn(self, '$include?', def['$has_key?']); - - $opal.defn(self, '$member?', def['$has_key?']); - - $opal.defn(self, '$each', TMP_7 = function(args) { - var $a, self = this, $iter = TMP_7._p, $yield = $iter || nil; - args = $slice.call(arguments, 0); - TMP_7._p = null; - if (($yield !== nil)) { - - for (var key in self['native']) { - ((($a = $opal.$yieldX($yield, [key, self['native'][key]])) === $breaker) ? $breaker.$v : $a) - } - ; - return self; - } else { - return ($a = self).$method_missing.apply($a, ["each"].concat(args)) - }; - }); - - $opal.defn(self, '$[]', function(key) { - var $a, self = this; - - var prop = self['native'][key]; - - if (prop instanceof Function) { - return prop; - } - else { - return (($a = $opal.Object._scope.Native) == null ? $opal.cm('Native') : $a).$call(self['native'], key) - } - ; - }); - - $opal.defn(self, '$[]=', function(key, value) { - var $a, self = this, native$ = nil; - native$ = $scope.Native.$try_convert(value); - if (($a = native$ === nil) !== false && $a !== nil) { - return self['native'][key] = value; - } else { - return self['native'][key] = native$; - }; - }); - - $opal.defn(self, '$method_missing', TMP_8 = function(mid, args) { - var $a, $b, $c, self = this, $iter = TMP_8._p, block = $iter || nil; - args = $slice.call(arguments, 1); - TMP_8._p = null; - - if (mid.charAt(mid.length - 1) === '=') { - return self['$[]='](mid.$slice(0, mid.$length()['$-'](1)), args['$[]'](0)); - } - else { - return ($a = ($b = (($c = $opal.Object._scope.Native) == null ? $opal.cm('Native') : $c)).$call, $a._p = block.$to_proc(), $a).apply($b, [self['native'], mid].concat(args)); - } - ; - }); - - $opal.defn(self, '$nil?', function() { - var self = this; - return false; - }); - - $opal.defn(self, '$is_a?', function(klass) { - var self = this; - return klass['$==']($scope.Native); - }); - - $opal.defn(self, '$kind_of?', def['$is_a?']); - - $opal.defn(self, '$instance_of?', function(klass) { - var self = this; - return klass['$==']($scope.Native); - }); - - $opal.defn(self, '$class', function() { - var self = this; - return self._klass; - }); - - $opal.defn(self, '$to_a', TMP_9 = function(options) { - var $a, $b, self = this, $iter = TMP_9._p, block = $iter || nil; - if (options == null) { - options = $hash2([], {}) - } - TMP_9._p = null; - return ($a = ($b = ($scope.Native)._scope.Array).$new, $a._p = block.$to_proc(), $a).call($b, self['native'], options).$to_a(); - }); - - $opal.defn(self, '$to_ary', TMP_10 = function(options) { - var $a, $b, self = this, $iter = TMP_10._p, block = $iter || nil; - if (options == null) { - options = $hash2([], {}) - } - TMP_10._p = null; - return ($a = ($b = ($scope.Native)._scope.Array).$new, $a._p = block.$to_proc(), $a).call($b, self['native'], options); - }); - - return ($opal.defn(self, '$inspect', function() { - var self = this; - return "#"; - }), nil); - })($scope.Native, $scope.BasicObject); - (function($base, $super) { - function $Array(){}; - var self = $Array = $klass($base, $super, 'Array', $Array); - - var def = $Array._proto, $scope = $Array._scope, TMP_11, TMP_12; - def.named = def['native'] = def.get = def.block = def.set = def.length = nil; - self.$include($scope.Native); - - self.$include($scope.Enumerable); - - def.$initialize = TMP_11 = function(native$, options) { - var $a, self = this, $iter = TMP_11._p, block = $iter || nil; - if (options == null) { - options = $hash2([], {}) - } - TMP_11._p = null; - $opal.find_super_dispatcher(self, 'initialize', TMP_11, null).apply(self, [native$]); - self.get = ((($a = options['$[]']("get")) !== false && $a !== nil) ? $a : options['$[]']("access")); - self.named = options['$[]']("named"); - self.set = ((($a = options['$[]']("set")) !== false && $a !== nil) ? $a : options['$[]']("access")); - self.length = ((($a = options['$[]']("length")) !== false && $a !== nil) ? $a : "length"); - self.block = block; - if (($a = self.$length() == null) !== false && $a !== nil) { - return self.$raise($scope.ArgumentError, "no length found on the array-like object") - } else { - return nil - }; - }; - - def.$each = TMP_12 = function() { - var $a, self = this, $iter = TMP_12._p, block = $iter || nil; - TMP_12._p = null; - if (($a = block) === false || $a === nil) { - return self.$enum_for("each")}; - - for (var i = 0, length = self.$length(); i < length; i++) { - var value = $opal.$yield1(block, self['$[]'](i)); - - if (value === $breaker) { - return $breaker.$v; - } - } - ; - return self; - }; - - def['$[]'] = function(index) { - var $a, self = this, result = nil, $case = nil; - result = (function() {$case = index;if ($scope.String['$===']($case) || $scope.Symbol['$===']($case)) {if (($a = self.named) !== false && $a !== nil) { - return self['native'][self.named](index); - } else { - return self['native'][index]; - }}else if ($scope.Integer['$===']($case)) {if (($a = self.get) !== false && $a !== nil) { - return self['native'][self.get](index); - } else { - return self['native'][index]; - }}else { return nil }})(); - if (result !== false && result !== nil) { - if (($a = self.block) !== false && $a !== nil) { - return self.block.$call(result) - } else { - return self.$Native(result) - } - } else { - return nil - }; - }; - - def['$[]='] = function(index, value) { - var $a, self = this; - if (($a = self.set) !== false && $a !== nil) { - return self['native'][self.set](index, $scope.Native.$convert(value)); - } else { - return self['native'][index] = $scope.Native.$convert(value); - }; - }; - - def.$last = function(count) { - var $a, self = this, index = nil, result = nil; - if (count == null) { - count = nil - } - if (count !== false && count !== nil) { - index = self.$length()['$-'](1); - result = []; - while (index['$>='](0)) { - result['$<<'](self['$[]'](index)); - index = index['$-'](1);}; - return result; - } else { - return self['$[]'](self.$length()['$-'](1)) - }; - }; - - def.$length = function() { - var self = this; - return self['native'][self.length]; - }; - - def.$to_ary = function() { - var self = this; - return self; - }; - - return (def.$inspect = function() { - var self = this; - return self.$to_a().$inspect(); - }, nil); - })($scope.Native, null); - (function($base, $super) { - function $Numeric(){}; - var self = $Numeric = $klass($base, $super, 'Numeric', $Numeric); - - var def = $Numeric._proto, $scope = $Numeric._scope; - return (def.$to_n = function() { - var self = this; - return self.valueOf(); - }, nil) - })(self, null); - (function($base, $super) { - function $Proc(){}; - var self = $Proc = $klass($base, $super, 'Proc', $Proc); - - var def = $Proc._proto, $scope = $Proc._scope; - return (def.$to_n = function() { - var self = this; - return self; - }, nil) - })(self, null); - (function($base, $super) { - function $String(){}; - var self = $String = $klass($base, $super, 'String', $String); - - var def = $String._proto, $scope = $String._scope; - return (def.$to_n = function() { - var self = this; - return self.valueOf(); - }, nil) - })(self, null); - (function($base, $super) { - function $Regexp(){}; - var self = $Regexp = $klass($base, $super, 'Regexp', $Regexp); - - var def = $Regexp._proto, $scope = $Regexp._scope; - return (def.$to_n = function() { - var self = this; - return self.valueOf(); - }, nil) - })(self, null); - (function($base, $super) { - function $MatchData(){}; - var self = $MatchData = $klass($base, $super, 'MatchData', $MatchData); - - var def = $MatchData._proto, $scope = $MatchData._scope; - def.matches = nil; - return (def.$to_n = function() { - var self = this; - return self.matches; - }, nil) - })(self, null); - (function($base, $super) { - function $Struct(){}; - var self = $Struct = $klass($base, $super, 'Struct', $Struct); - - var def = $Struct._proto, $scope = $Struct._scope; - def.$initialize = function(args) { - var $a, $b, TMP_13, $c, TMP_14, self = this, object = nil; - args = $slice.call(arguments, 0); - if (($a = (($b = args.$length()['$=='](1)) ? self['$native?'](args['$[]'](0)) : $b)) !== false && $a !== nil) { - object = args['$[]'](0); - return ($a = ($b = self.$members()).$each, $a._p = (TMP_13 = function(name){var self = TMP_13._s || this;if (name == null) name = nil; - return self.$instance_variable_set("@" + (name), self.$Native(object[name]))}, TMP_13._s = self, TMP_13), $a).call($b); - } else { - return ($a = ($c = self.$members()).$each_with_index, $a._p = (TMP_14 = function(name, index){var self = TMP_14._s || this;if (name == null) name = nil;if (index == null) index = nil; - return self.$instance_variable_set("@" + (name), args['$[]'](index))}, TMP_14._s = self, TMP_14), $a).call($c) - }; - }; - - return (def.$to_n = function() { - var $a, $b, TMP_15, self = this, result = nil; - result = {}; - ($a = ($b = self).$each_pair, $a._p = (TMP_15 = function(name, value){var self = TMP_15._s || this;if (name == null) name = nil;if (value == null) value = nil; - return result[name] = value.$to_n();}, TMP_15._s = self, TMP_15), $a).call($b); - return result; - }, nil); - })(self, null); - (function($base, $super) { - function $Array(){}; - var self = $Array = $klass($base, $super, 'Array', $Array); - - var def = $Array._proto, $scope = $Array._scope; - return (def.$to_n = function() { - var self = this; - - var result = []; - - for (var i = 0, length = self.length; i < length; i++) { - var obj = self[i]; - - if ((obj)['$respond_to?']("to_n")) { - result.push((obj).$to_n()); - } - else { - result.push(obj); - } - } - - return result; - ; - }, nil) - })(self, null); - (function($base, $super) { - function $Boolean(){}; - var self = $Boolean = $klass($base, $super, 'Boolean', $Boolean); - - var def = $Boolean._proto, $scope = $Boolean._scope; - return (def.$to_n = function() { - var self = this; - return self.valueOf(); - }, nil) - })(self, null); - (function($base, $super) { - function $Time(){}; - var self = $Time = $klass($base, $super, 'Time', $Time); - - var def = $Time._proto, $scope = $Time._scope; - return (def.$to_n = function() { - var self = this; - return self; - }, nil) - })(self, null); - (function($base, $super) { - function $NilClass(){}; - var self = $NilClass = $klass($base, $super, 'NilClass', $NilClass); - - var def = $NilClass._proto, $scope = $NilClass._scope; - return (def.$to_n = function() { - var self = this; - return null; - }, nil) - })(self, null); - (function($base, $super) { - function $Hash(){}; - var self = $Hash = $klass($base, $super, 'Hash', $Hash); - - var def = $Hash._proto, $scope = $Hash._scope, TMP_16; - def.$initialize = TMP_16 = function(defaults) { - var self = this, $iter = TMP_16._p, block = $iter || nil; - TMP_16._p = null; - - if (defaults != null) { - if (defaults.constructor === Object) { - var map = self.map, - keys = self.keys; - - for (var key in defaults) { - var value = defaults[key]; - - if (value && value.constructor === Object) { - map[key] = $scope.Hash.$new(value); - } - else { - map[key] = self.$Native(defaults[key]); - } - - keys.push(key); - } - } - else { - self.none = defaults; - } - } - else if (block !== nil) { - self.proc = block; - } - - return self; - - }; - - return (def.$to_n = function() { - var self = this; - - var result = {}, - keys = self.keys, - map = self.map, - bucket, - value; - - for (var i = 0, length = keys.length; i < length; i++) { - var key = keys[i], - obj = map[key]; - - if ((obj)['$respond_to?']("to_n")) { - result[key] = (obj).$to_n(); - } - else { - result[key] = obj; - } - } - - return result; - ; - }, nil); - })(self, null); - (function($base, $super) { - function $Module(){}; - var self = $Module = $klass($base, $super, 'Module', $Module); - - var def = $Module._proto, $scope = $Module._scope; - return (def.$native_module = function() { - var self = this; - return Opal.global[self.$name()] = self; - }, nil) - })(self, null); - (function($base, $super) { - function $Class(){}; - var self = $Class = $klass($base, $super, 'Class', $Class); - - var def = $Class._proto, $scope = $Class._scope; - def.$native_alias = function(jsid, mid) { - var self = this; - return self._proto[jsid] = self._proto['$' + mid]; - }; - - return $opal.defn(self, '$native_class', def.$native_module); - })(self, null); - return $gvars["$"] = $gvars["global"] = self.$Native(Opal.global); -})(Opal); -/* Generated by Opal 0.5.5 */ -(function($opal) { - var self = $opal.top, $scope = $opal, nil = $opal.nil, $breaker = $opal.breaker, $slice = $opal.slice, $gvars = $opal.gvars, $hash2 = $opal.hash2; ; ; ; @@ -10631,20 +11433,7 @@ args = $slice.call(arguments, 0); ; ; ; - $gvars["&"] = $gvars["~"] = $gvars["`"] = $gvars["'"] = nil; - $gvars[":"] = []; - $gvars["\""] = []; - $gvars["/"] = "\n"; - $gvars[","] = " "; - $opal.cdecl($scope, 'ARGV', []); - $opal.cdecl($scope, 'ARGF', $scope.Object.$new()); - $opal.cdecl($scope, 'ENV', $hash2([], {})); - $gvars["VERBOSE"] = false; - $gvars["DEBUG"] = false; - $gvars["SAFE"] = 0; - $opal.cdecl($scope, 'RUBY_PLATFORM', "opal"); - $opal.cdecl($scope, 'RUBY_ENGINE', "opal"); - $opal.cdecl($scope, 'RUBY_VERSION', "1.9.3"); - $opal.cdecl($scope, 'RUBY_ENGINE_VERSION', "0.5.5"); - return $opal.cdecl($scope, 'RUBY_RELEASE_DATE', "2013-11-25"); + ; + ; + return true; })(Opal);