asciidoc.asciidoctor.js Maven / Gradle / Ivy
Show all versions of http Show documentation
/* 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, $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;
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) {
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 self.$add(block['$[]'](o))}, TMP_2._s = self, TMP_2), $a).call($b, enum$)
} else {
return self.$merge(enum$)
};
};
def['$=='] = function(other) {
var $a, $b, TMP_3, self = this;
if (($a = self['$equal?'](other)) !== false && $a !== nil) {
return true
} else if (($a = other['$instance_of?'](self.$class())) !== false && $a !== nil) {
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) {
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;
return self.hash['$include?'](o)}, TMP_3._s = self, TMP_3), $a).call($b)
} else {
return false
};
};
def.$add = function(o) {
var self = this;
self.hash['$[]='](o, true);
return self;
};
$opal.defn(self, '$<<', def.$add);
def['$add?'] = function(o) {
var $a, self = this;
if (($a = self['$include?'](o)) !== false && $a !== nil) {
return nil
} else {
return self.$add(o)
};
};
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")};
($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);
};
$opal.defn(self, '$member?', def['$include?']);
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;
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();
};
$opal.defn(self, '$length', def.$size);
return (def.$to_a = function() {
var self = this;
return self.hash.$keys();
}, nil);
})(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
}
TMP_7._p = null;
return ($a = ($b = klass).$new, $a._p = block.$to_proc(), $a).apply($b, [self].concat(args));
}
;$opal.donate(self, ["$to_set"]);
})(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, $klass = $opal.klass;
return (function($base, $super) {
function $StringScanner(){};
var self = $StringScanner = $klass($base, $super, 'StringScanner', $StringScanner);
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");
self.$attr_reader("matched");
def.$initialize = function(string) {
var self = this;
self.string = string;
self.pos = 0;
self.matched = nil;
self.working = string;
return self.match = [];
};
def['$bol?'] = function() {
var self = this;
return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n";
};
def.$scan = function(regex) {
var self = this;
var regex = new RegExp('^' + regex.toString().substring(1, regex.toString().length - 1)),
result = regex.exec(self.working);
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;
return result[0];
}
else if (typeof(result) === 'string') {
self.pos += result.length;
self.working = self.working.substring(result.length);
return result;
}
else {
return nil;
}
;
};
def['$[]'] = function(idx) {
var self = this;
var match = self.match;
if (idx < 0) {
idx += match.length;
}
if (idx < 0 || idx >= match.length) {
return nil;
}
return match[idx];
;
};
def.$check = function(regex) {
var self = this;
var regexp = new RegExp('^' + regex.toString().substring(1, regex.toString().length - 1)),
result = regexp.exec(self.working);
if (result == null) {
return self.matched = nil;
}
return self.matched = result[0];
;
};
def.$peek = function(length) {
var self = this;
return self.working.substring(0, length);
};
def['$eos?'] = function() {
var self = this;
return self.working.length === 0;
};
def.$skip = function(re) {
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;
}
;
};
def.$get_byte = function() {
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);
}
else {
self.matched = nil;
}
return result;
;
};
$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);
})(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);
var def = $Dir._proto, $scope = $Dir._scope;
$opal.defs(self, '$pwd', function() {
var self = this;
return ".";
});
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);
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);
var def = $File._proto, $scope = $File._scope;
$opal.cdecl($scope, 'SEPARATOR', "/");
$opal.cdecl($scope, 'ALT_SEPARATOR', nil);
$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;
return path['$[]']($range(((((($a = path.$rindex(($scope.File)._scope.SEPARATOR)) !== false && $a !== nil) ? $a : -1))['$+'](1)), -1, false));
});
$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));
});
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');
var def = self._proto, $scope = self._scope;
(function($base) {
var self = $module($base, 'Debug');
var def = self._proto, $scope = self._scope, TMP_1;
self.show_debug = nil;
$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
};
});
$opal.defs(self, '$set_debug', function(value) {
var self = this;
return self.show_debug = value;
});
$opal.defs(self, '$show_debug_output?', function() {
var $a, $b, $c, 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")) ? ($c = $scope.ENV['$[]']("SUPPRESS_DEBUG")['$==']("true"), ($c === nil || $c === false)) : $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 */
(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;
$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');
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 ($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; }
};
});
$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))
};
});
$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);
};
});
$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);
});
$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"));
});
$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))
};
});
$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.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;
});
})(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, $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');
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": []}));
$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"))}));
self.$attr_reader("passthroughs");
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
}
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))
} else {
return text
};
};
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; })());
};
def.$apply_title_subs = function(title) {
var self = this;
return self.$apply_subs(title, $scope.SUBS['$[]']("title"));
};
def.$apply_header_subs = function(text) {
var self = this;
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?']("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;
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;
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;
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.$restore_passthroughs = function(text) {
var $a, $b, $c, TMP_6, self = this;
if (self.passthroughs == null) self.passthroughs = nil;
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;
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"));
};
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);
};
$opal.defn(self, '$sub_specialchars', def.$sub_specialcharacters);
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.$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;
};
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 }})()
};
};
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;
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
};
};
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;
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;
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;
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;
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;
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;
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.$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;
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;
};
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;
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;
};
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;
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"));
};
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 (($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"))
};
};
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())
}
} 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();
};
};
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})
};
};
def.$parse_attributes = function(attrline, posattrs, opts) {
var $a, self = this, block = nil;
if (self.document == null) self.document = nil;
if (posattrs == null) {
posattrs = ["role"]
}
if (opts == null) {
opts = $hash2([], {})
}
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("]", "]");
};
def.$normalize_string = function(str, unescape_brackets) {
var $a, self = this;
if (unescape_brackets == null) {
unescape_brackets = false
}
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, " ")
};
};
def.$unescape_brackets = function(str) {
var $a, self = this;
if (($a = str['$empty?']()) !== false && $a !== nil) {
return ""
} else {
return str.$gsub("]", "]")
};
};
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;
};
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"
}
if (defaults == null) {
defaults = nil
}
if (subject == null) {
subject = nil
}
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);
};
def.$resolve_pass_subs = function(subs) {
var self = this;
return self.$resolve_subs(subs, "inline", nil, "passthrough macro");
};
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 (highlighter == null) {
highlighter = nil
}
((($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)
})(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);
var def = $AbstractNode._proto, $scope = $AbstractNode._scope;
def.document = def.attributes = def.style = nil;
self.$include($scope.Substitutors);
self.$attr_reader("parent");
self.$attr_reader("document");
self.$attr_reader("context");
self.$attr_accessor("id");
self.$attr_reader("attributes");
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 = [];
};
def['$parent='] = function(parent) {
var self = this;
self.parent = parent;
self.document = parent.$document();
return nil;
};
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['$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))
};
};
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
};
};
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", "");
};
def['$option?'] = function(name) {
var self = this;
return self.attributes['$has_key?']("" + (name) + "-option");
};
def.$get_binding = function(template) {
var self = this;
return self.$binding();
};
def.$update_attributes = function(attributes) {
var self = this;
self.attributes.$update(attributes);
return nil;
};
def.$renderer = function() {
var self = this;
return self.document.$renderer();
};
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.$role = function() {
var $a, self = this;
return ((($a = self.attributes['$[]']("role")) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]']("role"));
};
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
};
};
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 []
};
};
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.$reftext = function() {
var $a, self = this;
return ((($a = self.attributes['$[]']("reftext")) !== false && $a !== nil) ? $a : self.document.$attributes()['$[]']("reftext"));
};
def.$short_tag_slash = function() {
var self = this;
if (self.document.$attributes()['$[]']("htmlsyntax")['$==']("xml")) {
return "/"
} else {
return nil
};
};
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")
};
};
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.$image_uri = function(target_image, asset_dir_key) {
var $a, $b, self = this;
if (asset_dir_key == null) {
asset_dir_key = "imagesdir"
}
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)
};
};
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
}
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"));
};
def.$read_asset = function(path, warn_on_failure) {
var $a, self = this;
if (warn_on_failure == null) {
warn_on_failure = false
}
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
}
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
}
if (jail == null) {
jail = nil
}
if (opts == null) {
opts = $hash2([], {})
}
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);
};
def.$normalize_asset_path = function(asset_ref, asset_name, autocorrect) {
var self = this;
if (asset_name == null) {
asset_name = "path"
}
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.$relative_path = function(filename) {
var self = this;
return $scope.PathResolver.$new().$relative_path(filename, self.document.$base_dir());
};
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);
})(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 $AbstractBlock(){};
var self = $AbstractBlock = $klass($base, $super, 'AbstractBlock', $AbstractBlock);
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");
self.$attr_reader("subs");
self.$attr_accessor("template_name");
self.$attr_reader("blocks");
self.$attr_accessor("level");
self.$attr_writer("title");
self.$attr_accessor("style");
self.$attr_accessor("caption");
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;
};
def['$context='] = function(context) {
var self = this;
self.context = context;
return self.template_name = "block_" + (context);
};
def.$render = function() {
var self = this;
self.document.$playback_attributes(self.attributes);
return self.$renderer().$render(self.template_name, self);
};
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);
};
def['$sub?'] = function(name) {
var self = this;
return self.subs['$include?'](name);
};
def['$title?'] = function() {
var $a, self = this;
return ($a = self.title.$to_s()['$empty?'](), ($a === nil || $a === false));
};
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)
} else {
return self.title
};
};
def.$captioned_title = function() {
var self = this;
return "" + (self.caption) + (self.$title());
};
def['$blocks?'] = function() {
var $a, self = this;
return ($a = self.blocks['$empty?'](), ($a === nil || $a === false));
};
def['$<<'] = function(block) {
var self = this;
return self.blocks['$<<'](block);
};
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.$remove_sub = function(sub) {
var self = this;
self.subs.$delete(sub);
return nil;
};
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.$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 (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');
var def = self._proto, $scope = self._scope;
(function($base, $super) {
function $AttributeList(){};
var self = $AttributeList = $klass($base, $super, 'AttributeList', $AttributeList);
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]*(,|$))/}));
$opal.cdecl($scope, 'UNESCAPE_PATTERNS', $hash2(["\\\"", "\\'"], {"\\\"": /\\"/, "\\'": /\\'/}));
$opal.cdecl($scope, 'SKIP_PATTERNS', $hash2(["blank", ","], {"blank": /[ \t]+/, ",": /[ \t]*(,|$)/}));
$opal.cdecl($scope, 'NAME_PATTERN', /[A-Za-z:_][A-Za-z:_\-\.]*/);
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.$parse_into = function(attributes, posattrs) {
var self = this;
if (posattrs == null) {
posattrs = []
}
return attributes.$update(self.$parse(posattrs));
};
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.$rekey = function(posattrs) {
var self = this;
return $scope.AttributeList.$rekey(self.attributes, posattrs);
};
$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;
});
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
}
if (pos_attrs == null) {
pos_attrs = []
}
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;
};
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);
};
};
def.$skip_blank = function() {
var self = this;
return self.scanner.$skip($scope.SKIP_PATTERNS['$[]']("blank"));
};
def.$skip_delimiter = function() {
var self = this;
return self.scanner.$skip($scope.SKIP_PATTERNS['$[]'](self.delimiter));
};
def.$scan_name = function() {
var self = this;
return self.scanner.$scan($scope.NAME_PATTERN);
};
def.$scan_to_delimiter = function() {
var self = this;
return self.scanner.$scan($scope.BOUNDARY_PATTERNS['$[]'](self.delimiter));
};
return (def.$scan_to_quote = function(quote) {
var self = this;
return self.scanner.$scan($scope.BOUNDARY_PATTERNS['$[]'](quote));
}, 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;
return (function($base) {
var self = $module($base, 'Asciidoctor');
var def = self._proto, $scope = self._scope;
(function($base, $super) {
function $Block(){};
var self = $Block = $klass($base, $super, 'Block', $Block);
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);
self.$attr_accessor("lines");
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.$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;}})();
};
def.$source = function() {
var self = this;
return self.lines['$*']($scope.EOL);
};
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);
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.$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;
};
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.$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, [])['$*'](" ");
};
def.$current_list = function() {
var self = this;
return self.lists['$[]'](self.list_index['$-'](1));
};
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.$rewind = function() {
var self = this;
self.list_index = 1;
self.co_index = 1;
return nil;
};
def.$generate_next_callout_id = function() {
var self = this;
return self.$generate_callout_id(self.list_index, self.co_index);
};
return (def.$generate_callout_id = function(list_index, co_index) {
var self = this;
return "CO" + (list_index) + "-" + (co_index);
}, 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, $gvars = $opal.gvars;
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 = $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"));
(function($base, $super) {
function $AttributeEntry(){};
var self = $AttributeEntry = $klass($base, $super, 'AttributeEntry', $AttributeEntry);
var def = $AttributeEntry._proto, $scope = $AttributeEntry._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?']()) !== false && $a !== nil) {
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);
})(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("extensions");
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
};
};
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)));
};
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?']($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.$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
}}})();
};
def['$footnotes?'] = function() {
var $a, self = this;
return ($a = self.references['$[]']("footnotes")['$empty?'](), ($a === nil || $a === false));
};
def.$footnotes = function() {
var self = this;
return self.references['$[]']("footnotes");
};
def['$nested?'] = function() {
var $a, self = this;
if (($a = self.parent_document) !== false && $a !== nil) {
return true
} else {
return false
};
};
def['$embedded?'] = function() {
var self = this;
return self.attributes['$has_key?']("embedded");
};
def['$extensions?'] = function() {
var $a, self = this;
if (($a = self.extensions) !== false && $a !== nil) {
return true
} else {
return false
};
};
def.$source = function() {
var $a, self = this;
if (($a = self.reader) !== false && $a !== nil) {
return self.reader.$source()
} else {
return nil
};
};
def.$source_lines = function() {
var $a, self = this;
if (($a = self.reader) !== false && $a !== nil) {
return self.reader.$source_lines()
} else {
return nil
};
};
def.$doctype = function() {
var self = this;
return self.attributes['$[]']("doctype");
};
def.$backend = function() {
var self = this;
return 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, $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()
} 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, $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);
};
def.$noheader = function() {
var self = this;
return self.attributes['$has_key?']("noheader");
};
def.$nofooter = function() {
var self = this;
return self.attributes['$has_key?']("nofooter");
};
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['$has_header?'] = function() {
var $a, self = this;
if (($a = self.header) !== false && $a !== nil) {
return true
} else {
return false
};
};
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 $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;
};
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)
};
};
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['$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
};
};
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;
};
};
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;
};
};
def['$attribute_locked?'] = function(name) {
var self = this;
return self.attribute_overrides['$has_key?'](name);
};
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)
};
};
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 = ""
}
} 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;
};
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);
};
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();
};
};
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)
})(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 $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");
self.$attr_reader("text");
self.$attr_reader("type");
self.$attr_accessor("target");
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"))
}
} else {
return nil
};
};
return (def.$render = function() {
var self = this;
return self.$renderer().$render(self.template_name, self).$chomp();
}, 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, $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 $Lexer(){};
var self = $Lexer = $klass($base, $super, 'Lexer', $Lexer);
var def = $Lexer._proto, $scope = $Lexer._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")) === 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;
});
$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);
});
$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")
};
});
$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]
};
} 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)]
};
};
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;;
};
} 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([], {});};
};
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
} 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([], {})
}
if (options == null) {
options = $hash2([], {})
}
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"
} 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};
} 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;
});
$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;
} 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};
};
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);
} 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_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}))
} 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}));
};
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;
});
$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.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))
} else {
list_block['$level='](1)
};
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();};
} else {
this_item_level = list_block.$level()
};
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;
});
$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;
});
$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;
});
$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;
});
$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
}
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);
} 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
} else {
return buffer.$last()
}; 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;
}
} else {
if (($b = within_nested_list) === false || $b === nil) {
buffer.$pop()};
buffer['$<<'](this_line);
has_text = true;
};
} 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);
};
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)
} 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;
});
$opal.defs(self, '$section_level', function(line) {
var self = this;
return $scope.SECTION_LEVELS['$[]'](line['$[]']($range(0, 0, false)));
});
$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 = ($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)))
} 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))) !== 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
} 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 (($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
};
});
$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)
} else {
return false
};
});
$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];
});
$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()
} else {
return line.$length()
};
});
$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;
});
$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
}
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)
} 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, $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;
});
$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();};
});
$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 nil
} else {
return parent.$document()
}; return nil; })(), attributes);
return true;
} else {
return false
};
});
$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];
});
$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
};
});
$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;
});
$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
};
});
$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;
});
$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()
} 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()
} 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, $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
} else {
return colspec.$to_i()
}; return nil; })();
rowspec = (function() {if (($a = rowspec.$to_s()['$empty?']()) !== false && $a !== nil) {
return 1
} 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];
});
$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")
} 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")) !== false && $a !== nil) {
self.$warn("asciidoctor: WARNING:" + ((function() {if (($a = reader['$nil?']()) !== false && $a !== nil) {
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['$==']("%"))) !== 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 }})();
} 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"))
} else {
parsed_style = nil
};
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(",")))['$*'](","))
} 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['$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?']);
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]);
};
def.$content = function() {
var self = this;
return self.blocks;
};
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);
(function($base, $super) {
function $ListItem(){};
var self = $ListItem = $klass($base, $super, 'ListItem', $ListItem);
var def = $ListItem._proto, $scope = $ListItem._scope, TMP_3;
def.text = def.blocks = def.context = 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 $a, self = this;
return ($a = self.text.$to_s()['$empty?'](), ($a === nil || $a === false));
};
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, $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 (($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');
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', "/");
$opal.cdecl($scope, 'BACKSLASH', "\\");
$opal.cdecl($scope, 'WIN_ROOT_RE', /^[a-zA-Z]:(?:\\|\/)/);
self.$attr_accessor("file_separator");
self.$attr_accessor("working_dir");
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; })()
};
};
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
} else {
return false
};
};
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.$to_s()['$empty?']()) !== false && $a !== nil) {
return ""};
if (($a = path['$include?']($scope.BACKSLASH)) !== false && $a !== nil) {
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 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
} 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))
} else {
return segments['$*']($scope.SLASH)
};
};
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
}
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)
} 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 (($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]);
} 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, $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
}
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)
} else {
return "" + (uri_prefix) + (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)) !== false && $a !== nil) {
offset = base_directory.$chomp(self.file_separator).$length()['$+'](1);
return filename['$[]']($range(offset, -1, false));
} else {
return filename
};
}, 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.$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;
};
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.$initialize = function(data, cursor, opts) {
var $a, self = this;
if (data == null) {
data = nil
}
if (cursor == null) {
cursor = nil
}
if (opts == null) {
opts = $hash2(["normalize"], {"normalize": false})
}
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 []
} else {
return (self.$prepare_lines(data, opts))
}; 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)
} else {
return data.$each_line().$to_a()
}
} else if (($a = opts['$[]']("normalize")) !== false && $a !== nil) {
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) !== false && $a !== nil) {
self.look_ahead = self.look_ahead['$+'](1)};
return line;
};
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));
};
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.$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
};
};
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.$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?']())) !== false && $a !== nil) {
return self.$shift()
} 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);
def.$read = function() {
var self = this;
return self.$read_lines()['$*']($scope.EOL);
};
def.$advance = function(direct) {
var $a, self = this;
if (direct == null) {
direct = true
}
return ($a = (self.$read_line(direct))['$nil?'](), ($a === nil || $a === false));
};
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?']()) !== 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);
} 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?']()) !== 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())
} 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?']()) !== 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())
} 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 $a, self = this;
return ($a = self['$has_more_lines?'](), ($a === nil || $a === false));
};
$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, 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([], {})
}
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;
} 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 = ($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() {
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);
};
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);
})(self, null);
(function($base, $super) {
function $PreprocessorReader(){};
var self = $PreprocessorReader = $klass($base, $super, 'PreprocessorReader', $PreprocessorReader);
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");
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_processors = nil;
};
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([], {})
}
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;
};
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;
}
} 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))) !== false && $a !== nil) {
return line
} else if (($a = self.include_stack['$empty?']()) !== false && $a !== nil) {
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, $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.$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.$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]);
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;
};
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)) !== 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
}
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;
};
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['$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 (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);
})(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 $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");
self.$attr_reader("eruby");
def.$initialize = function(view, backend, eruby) {
var self = this;
self.view = view;
self.backend = backend;
return self.eruby = eruby;
};
$opal.defs(self, '$inherited', function(klass) {
var $a, self = this;
if (self.template_classes == null) self.template_classes = nil;
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)
};
});
$opal.defs(self, '$template_classes', function() {
var self = this;
if (self.template_classes == null) self.template_classes = nil;
return self.template_classes;
});
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
};
};
def.$compact = function(str) {
var self = this;
return str.$gsub($scope.BLANK_LINE_PATTERN, "").$gsub($scope.LINE_FEED_ENTITY, $scope.EOL);
};
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.$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"
} else {
return "var"
}; 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 "";
};
def.$template = function() {
var self = this;
return "invoke_result";
};
;$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);
var def = $Renderer._proto, $scope = $Renderer._scope;
def.views = def.chomp_result = nil;
$opal.cdecl($scope, 'RE_ASCIIDOCTOR_NAMESPACE', /^Asciidoctor::/);
$opal.cdecl($scope, 'RE_TEMPLATE_CLASS_SUFFIX', /Template$/);
$opal.cdecl($scope, 'RE_CAMELCASE_BOUNDARY_1', /([[:upper:]]+)([[:upper:]][a-zA-Z])/);
$opal.cdecl($scope, 'RE_CAMELCASE_BOUNDARY_2', /([[:lower:]])([[:upper:]])/);
self.$attr_reader("compact");
self.$attr_reader("cache");
($opal.cvars['@@global_cache'] = nil);
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
};
};
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.$views = function() {
var self = this, readonly_views = nil;
readonly_views = self.views.$dup();
readonly_views.$freeze();
return readonly_views;
};
def.$register_view = function(view_name, tilt_template) {
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
};
};
$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() {
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()
} else {
return nil
};
});
$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) {
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)
};
};
def.$store = function(value, key) {
var self = this;
key = $slice.call(arguments, 1);
return self.cache['$[]='](key, value);
};
return (def.$clear = function() {
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);
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");
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, $c, 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"]);
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}
} else {
self.level = level
};
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;
};
$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")) !== 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;
} 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)
};
};
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;
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()) + "]"
} 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)
})(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 $Table(){};
var self = $Table = $klass($base, $super, 'Table', $Table);
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 = $Rows._proto, $scope = $Rows._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 (def['$[]'] = function(name) {
var self = this;
return self.$send(name);
}, nil);
})(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, $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
};
};
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.$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 (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);
(function($base, $super) {
function $Column(){};
var self = $Column = $klass($base, $super, 'Column', $Column);
var def = $Column._proto, $scope = $Column._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")) !== 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");
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, $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
};
};
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.$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 (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);
(function($base, $super) {
function $ParserContext(){};
var self = $ParserContext = $klass($base, $super, 'ParserContext', $ParserContext);
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");
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, $d, self = this;
if (attributes == null) {
attributes = $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))};
} else {
self.format = ($scope.Table)._scope.DEFAULT_DATA_FORMAT
};
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 = "!"
} else {
self.delimiter = attributes.$fetch("separator", ($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?']()) !== 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.$match_delimiter = function(line) {
var self = this;
return line.$match(self.delimiter_re);
};
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, $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);
};
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);
};
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 $a, self = this;
return ($a = self.cell_open, ($a === nil || $a === false));
};
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.$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()
} 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.$first());
};
return (def.$advance = function() {
var self = this;
return self.linenum = self.linenum['$+'](1);
}, nil);
})($scope.Table, 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, $klass = $opal.klass, $hash2 = $opal.hash2;
return (function($base, $super) {
function $Template(){};
var self = $Template = $klass($base, $super, 'Template', $Template);
var def = $Template._proto, $scope = $Template._scope, TMP_1;
def.name = def.body = nil;
self._cache = $hash2([], {});
$opal.defs(self, '$[]', function(name) {
var self = this;
if (self._cache == null) self._cache = nil;
return self._cache['$[]'](name);
});
$opal.defs(self, '$[]=', function(name, instance) {
var self = this;
if (self._cache == null) self._cache = nil;
return self._cache['$[]='](name, instance);
});
$opal.defs(self, '$paths', function() {
var self = this;
if (self._cache == null) self._cache = nil;
return self._cache.$keys();
});
self.$attr_reader("body");
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);
};
def.$inspect = function() {
var self = this;
return "#";
};
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());
};
return (function($base, $super) {
function $OutputBuffer(){};
var self = $OutputBuffer = $klass($base, $super, 'OutputBuffer', $OutputBuffer);
var def = $OutputBuffer._proto, $scope = $OutputBuffer._scope;
def.buffer = nil;
def.$initialize = function() {
var self = this;
return self.buffer = [];
};
def.$append = function(str) {
var self = this;
return self.buffer['$<<'](str);
};
def['$append='] = function(content) {
var self = this;
return self.buffer['$<<'](content);
};
return (def.$join = function() {
var self = this;
return self.buffer.$join();
}, nil);
})(self, null);
})(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, $module = $opal.module;
;
return (function($base, $super) {
function $ERB(){};
var self = $ERB = $klass($base, $super, 'ERB', $ERB);
var def = $ERB._proto, $scope = $ERB._scope;
return (function($base) {
var self = $module($base, 'Util');
var def = self._proto, $scope = self._scope;
var escapes = { '&': '&', '<': '<', '>': '>', '"': '"', "'": '''};
var escape_regexp = /[&<>"']/g;
def.$html_escape = function(str) {
var self = this;
return ("" + str).replace(escape_regexp, function (m) { return escapes[m] });
};
$opal.defn(self, '$h', def.$html_escape);
self.$module_function("h");
self.$module_function("html_escape");
;$opal.donate(self, ["$html_escape", "$h"]);
})(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");
if (($a = self.document['$attr?']("icons", "font")) !== false && $a !== nil) {
output_buffer.$append("\n");
} else if (($a = self.document['$attr?']("icons")) !== false && $a !== nil) {
output_buffer.$append("\n");
} else {
output_buffer.$append("\n");
output_buffer['$append=']((self.caption));
output_buffer.$append("");
};
output_buffer.$append("\n \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
\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")
})(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?', '$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 (font_icons !== false && font_icons !== nil) {
output_buffer.$append("");
output_buffer['$append=']((num));
output_buffer.$append("");
} else {
output_buffer.$append("");
};
output_buffer.$append(" \n");
output_buffer['$append=']((item.$text()));
return output_buffer.$append(" \n ");}, TMP_2._s = self, TMP_2), $a).call($b);
output_buffer.$append("\n
");
} else {
output_buffer.$append("\n");
($a = ($c = self.$items()).$each, $a._p = (TMP_3 = function(item){var self = TMP_3._s || this;if (item == null) item = nil;
output_buffer.$append("\n- \n
");
output_buffer['$append=']((item.$text()));
return output_buffer.$append("
\n ");}, TMP_3._s = self, TMP_3), $a).call($c);
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_colist")
})(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', '$each', '$text', '$nil?', '$text?', '$blocks?', '$content', '$dd', '$items', '$attr?', '$chomp', '$attr', '$option?', '$last', '$==', '$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_4, $d, TMP_6, $case = nil;
if (self.style == null) self.style = nil;
if (self.id == null) self.id = nil;
if (output_buffer == null) output_buffer = nil;
output_buffer.$append("");
output_buffer.$append("");
$case = self.style;if ("qanda"['$===']($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");
($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- ");
($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 ");}, 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");
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
")
} else {
return nil
};}, TMP_5._s = self, TMP_5), $a).call($b);
output_buffer.$append("\n \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 ");}, TMP_4._s = self, TMP_4), $a).call($c);
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- ");
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");
output_buffer['$append=']((self.$content()));
output_buffer.$append("
");
};
output_buffer.$append("\n\n\n");
return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_listing")
})(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?', '$option?', '$content', '$join']);
return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, $c;
if (self.id == null) self.id = 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("");};
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");
($a = ($b = self.$items()).$each, $a._p = (TMP_2 = function(item){var self = TMP_2._s || this, $a;if (item == null) item = nil;
output_buffer.$append("\n- \n
");
output_buffer['$append=']((item.$text()));
output_buffer.$append("
");
if (($a = item['$blocks?']()) !== false && $a !== nil) {
output_buffer.$append("\n");
output_buffer['$append=']((item.$content()));
output_buffer.$append("");};
return output_buffer.$append("\n ");}, TMP_2._s = self, TMP_2), $a).call($b);
output_buffer.$append("\n
\n\n");
return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_olist")
})(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', '$==', '$doctype', '$puts', '$append=', '$*', '$compact', '$role', '$title?', '$title', '$content', '$context', '$join']);
return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, $c, $d, $e;
if (self.style == null) self.style = nil;
if (self.parent == null) self.parent = nil;
if (self.document == null) self.document = nil;
if (self.id == null) self.id = nil;
if (self.level == null) self.level = nil;
if (output_buffer == null) output_buffer = nil;
output_buffer.$append("");
output_buffer.$append("");
if (self.style['$==']("abstract")) {
if (($a = (($b = self.parent['$=='](self.document)) ? self.document.$doctype()['$==']("book") : $b)) !== false && $a !== nil) {
self.$puts("asciidoctor: WARNING: abstract block cannot be used in a document without a title when doctype is book. 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");
}
} 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\n");
output_buffer['$append=']((self.$attr("toc-title")));
output_buffer.$append("\n");
output_buffer['$append='](((((($a = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $a))._scope.HTML5)._scope.DocumentTemplate.$outline(self.document, (self.$attr("toclevels", 2)).$to_i())));
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(" ");};
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 ");}, TMP_3._s = self, TMP_3), $a).call($c)
};
output_buffer.$append("\n ");
($a = ($d = ($e = ($f = ["head", "foot", "body"]).$select, $e._p = (TMP_9 = function(tsec){var self = TMP_9._s || this, $a;
if (self.rows == null) self.rows = nil;
if (tsec == null) tsec = nil;
return ($a = self.rows['$[]'](tsec)['$empty?'](), ($a === nil || $a === false))}, TMP_9._s = self, TMP_9), $e).call($f)).$each, $a._p = (TMP_4 = function(tsec){var self = TMP_4._s || this, $a, $b, TMP_5;
if (self.rows == null) self.rows = nil;
if (tsec == null) tsec = nil;
output_buffer.$append("\n");
($a = ($b = self.rows['$[]'](tsec)).$each, $a._p = (TMP_5 = function(row){var self = TMP_5._s || this, $a, $b, TMP_6;if (row == null) row = 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("");
output_buffer['$append='](((function() {if (tsec['$==']("head")) {
return "th"
} else {
return "td"
}; return nil; })()));
return 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 ");}, TMP_4._s = self, TMP_4), $a).call($d);};
output_buffer.$append("\n
\n");
return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_table")
})(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?', '$attr', '$title?', '$title', '$to_i', '$embedded?', '$append=', '$outline', '$join']);
return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, $c, $d, toc_id = nil, toc_role = nil, toc_title_id = nil, toc_title = nil, toc_levels = nil;
if (self.document == null) self.document = nil;
if (self.id == null) self.id = nil;
if (output_buffer == null) output_buffer = nil;
output_buffer.$append("");
output_buffer.$append("");
if (($a = self.document['$attr?']("toc")) !== false && $a !== nil) {
toc_id = self.id;
toc_role = (self.$attr("role", (self.document.$attr("toc-class", "toc"))));
toc_title_id = nil;
toc_title = (function() {if (($a = self['$title?']()) !== false && $a !== nil) {
return self.$title()
} else {
return (self.document.$attr("toc-title"))
}; return nil; })();
toc_levels = (function() {if (($a = (self['$attr?']("levels"))) !== false && $a !== nil) {
return (self.$attr("levels")).$to_i()
} else {
return (self.document.$attr("toclevels", 2)).$to_i()
}; return nil; })();
if (($a = ($b = ($c = toc_id, ($c === nil || $c === false)), $b !== false && $b !== nil ?(((($c = self.document['$embedded?']()) !== false && $c !== nil) ? $c : ($d = (self.document['$attr?']("toc-placement")), ($d === nil || $d === false)))) : $b)) !== false && $a !== nil) {
toc_id = "toc";
toc_title_id = "toctitle";};
output_buffer.$append("");
if (toc_title !== false && toc_title !== nil) {
output_buffer.$append("\n");
output_buffer['$append=']((toc_title));
output_buffer.$append("");};
output_buffer.$append("\n");
output_buffer['$append='](((($scope.Asciidoctor)._scope.HTML5)._scope.DocumentTemplate.$outline(self.document, toc_levels)));
output_buffer.$append("");};
output_buffer.$append("\n");
return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_toc")
})(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', '$option?', '$attr?', '$append=', '$*', '$compact', '$role', '$title?', '$title', '$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, checklist = nil, marker_checked = nil, marker_unchecked = nil, style_class = nil;
if (self.document == null) self.document = 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 = (checklist = (function() {if (($b = (self['$option?']("checklist"))) !== false && $b !== nil) {
return "checklist"
} else {
return nil
}; return nil; })())) !== false && $a !== nil) {
if (($a = self['$option?']("interactive")) !== false && $a !== nil) {
marker_checked = "";
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");
($a = ($b = self.$items()).$each, $a._p = (TMP_2 = function(item){var self = TMP_2._s || this, $a, $b;if (item == null) item = nil;
output_buffer.$append("\n- \n
");
if (($a = (($b = checklist !== false && checklist !== nil) ? (item['$attr?']("checkbox")) : $b)) !== false && $a !== nil) {
output_buffer.$append("");
output_buffer['$append='](("" + ((function() {if (($a = (item['$attr?']("checked"))) !== false && $a !== nil) {
return marker_checked
} else {
return marker_unchecked
}; return nil; })()) + " " + (item.$text())));
output_buffer.$append("");
} else {
output_buffer.$append("");
output_buffer['$append=']((item.$text()));
output_buffer.$append("");
};
output_buffer.$append("
");
if (($a = item['$blocks?']()) !== false && $a !== nil) {
output_buffer.$append("\n");
output_buffer['$append=']((item.$content()));
output_buffer.$append("");};
return output_buffer.$append("\n ");}, TMP_2._s = self, TMP_2), $a).call($b);
output_buffer.$append("\n
\n\n");
return output_buffer.$join();}, TMP_1._s = self, TMP_1), $a).call($b, "asciidoctor/backends/erb/html5/block_ulist")
})(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");
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 if ("youtube"['$===']($case)) {params = ["rel=0"];
if (($a = self['$attr?']("start")) !== false && $a !== nil) {
params['$<<']("start=" + (self.$attr("start")))};
if (($a = self['$attr?']("end")) !== false && $a !== nil) {
params['$<<']("end=" + (self.$attr("end")))};
if (($a = self['$option?']("autoplay")) !== false && $a !== nil) {
params['$<<']("autoplay=1")};
if (($a = self['$option?']("loop")) !== false && $a !== nil) {
params['$<<']("loop=1")};
if (($a = self['$option?']("nocontrols")) !== false && $a !== nil) {
params['$<<']("controls=0")};
src = "//www.youtube.com/embed/" + (self.$attr("target")) + "?" + (params['$*']("&"));
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\n");
($a = ($b = ["description", "keywords", "author", "copyright"]).$each, $a._p = (TMP_2 = function(key){var self = TMP_2._s || this, $a;if (key == null) key = nil;
if (($a = self['$attr?'](key)) !== false && $a !== nil) {
output_buffer.$append("\n");
} else {
return nil
}}, TMP_2._s = self, TMP_2), $a).call($b);
output_buffer.$append("\n");
output_buffer['$append=']((((($a = self.$doctitle($hash2(["sanitize"], {"sanitize": true}))) !== false && $a !== nil) ? $a : (self.$attr("untitled-label")))));
output_buffer.$append(" ");
if (($a = ((($c = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $c))._scope.DEFAULT_STYLESHEET_KEYS['$include?'](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");
} 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");
} else {
output_buffer.$append("\n");
}};
if (($a = self['$attr?']("icons", "font")) !== false && $a !== nil) {
if (($a = ($c = (self.$attr("iconfont-remote", ""))['$nil?'](), ($c === nil || $c === false))) !== false && $a !== nil) {
output_buffer.$append("\n");
} else {
output_buffer.$append("\n");
}};
$case = self.$attr("source-highlighter");if ("coderay"['$===']($case)) {if ((self.$attr("coderay-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 {
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 {
output_buffer.$append("\n");
}}}else if ("highlightjs"['$===']($case)) {output_buffer.$append("\n\n\n\n");}else if ("prettify"['$===']($case)) {output_buffer.$append("\n\n\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\n");
output_buffer['$append=']((self.$attr("toc-title")));
output_buffer.$append("\n");
output_buffer['$append='](((((($a = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $a))._scope.HTML5)._scope.DocumentTemplate.$outline(self, (self.$attr("toclevels", 2)).$to_i())));
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
");
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
");
if (($a = self['$attr?']("email_" + (idx))) !== false && $a !== nil) {
output_buffer.$append("\n");
output_buffer['$append=']((self.$sub_macros(self.$attr("email_" + (idx)))));
return output_buffer.$append("
");
} 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\n");
output_buffer['$append=']((self.$attr("toc-title")));
output_buffer.$append("\n");
output_buffer['$append='](((((($a = $opal.Object._scope.Asciidoctor) == null ? $opal.cm('Asciidoctor') : $a))._scope.HTML5)._scope.DocumentTemplate.$outline(self, (self.$attr("toclevels", 2)).$to_i())));
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=']((fn.$index()));
output_buffer.$append(". ");
output_buffer['$append=']((fn.$text()));
return output_buffer.$append("\n");}, TMP_4._s = self, TMP_4), $a).call($d);
output_buffer.$append("\n");};
output_buffer.$append("");
if (($a = self.$nofooter()) === false || $a === nil) {
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/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("");
output_buffer['$append=']((self.header.$title()));
output_buffer.$append("
");};
output_buffer.$append("");
output_buffer['$append=']((self.$content()));
output_buffer.$append("");
if (($a = ($b = self['$footnotes?'](), $b !== false && $b !== nil ?($c = (self['$attr?']("nofootnotes")), ($c === nil || $c === false)) : $b)) !== false && $a !== nil) {
output_buffer.$append("\n\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("(");
output_buffer['$append=']((self.text));
output_buffer.$append(")");
} else if (($a = self.document['$attr?']("icons")) !== false && $a !== nil) {
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_callout")
})(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=', '$join']);
return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, idx = nil;
if (self.type == null) self.type = nil;
if (self.id == null) self.id = nil;
if (output_buffer == null) output_buffer = nil;
output_buffer.$append("");
output_buffer.$append("");
idx = self.$attr("index");
if (self.type['$==']("xref")) {
output_buffer.$append("");
output_buffer['$append='](("[" + (idx) + "]"));
output_buffer.$append("");
} else {
output_buffer.$append("");
output_buffer['$append='](("[" + (idx) + "]"));
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_footnote")
})(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', '$==', '$<<', '$icon_uri', '$image_uri', '$join', '$map']);
return ($a = ($b = $scope.Template).$new, $a._p = (TMP_1 = function(output_buffer){var self = TMP_1._s || this, $a, $b, $c, TMP_2, style_class = nil, title_attr = nil, img = nil, img_src = nil, img_attrs = nil;
if (self.type == null) self.type = nil;
if (self.document == null) self.document = nil;
if (self.target == null) self.target = nil;
if (output_buffer == null) output_buffer = nil;
output_buffer.$append("");
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)) + "\""
} 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
} 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 " ▸ "}, TMP_2._s = self, TMP_2), $a).call($b).$join().$chop();
output_buffer.$append(" ");
} else if (($a = ($c = menuitem['$nil?'](), ($c === nil || $c === false))) !== false && $a !== nil) {
output_buffer.$append(" ");
} else {
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("");
output_buffer['$append='](("" + (anchor) + (link_start) + (self.$title()) + (link_end)));
output_buffer.$append("
\n");
output_buffer['$append=']((self.$content()));
output_buffer.$append("");
} else {
snum = (function() {if (($a = ($b = ($c = self.numbered, $c !== false && $c !== nil ?self.caption['$nil?']() : $c), $b !== false && $b !== nil ?slevel['$<=']((self.document.$attr("sectnumlevels", 3)).$to_i()) : $b)) !== false && $a !== nil) {
return "" + (self.$sectnum()) + " "
} else {
return nil
}; return nil; })();
hlevel = slevel['$+'](1);
output_buffer.$append("\n");
output_buffer['$append='](("" + (anchor) + (link_start) + (snum) + (self.$captioned_title()) + (link_end)));
output_buffer.$append(" ");
if (slevel['$=='](1)) {
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("");
};
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;
})(Opal);
/* Generated by Opal 0.5.5 */
(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")};
$opal.cdecl($scope, 'RUBY_ENGINE_OPAL', ($scope.RUBY_ENGINE['$==']("opal")));
$opal.cdecl($scope, 'RUBY_ENGINE_JRUBY', ($scope.RUBY_ENGINE['$==']("jruby")));
;
if (($a = $scope.RUBY_ENGINE_OPAL) !== false && $a !== nil) {
;
;
;
;};
$gvars[":"].$unshift($scope.File.$dirname("asciidoctor"));
return (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) {
;
;
;
;
;};
(function($base) {
var self = $module($base, 'SafeMode');
var def = self._proto, $scope = self._scope;
$opal.cdecl($scope, 'UNSAFE', 0);
$opal.cdecl($scope, 'SAFE', 1);
$opal.cdecl($scope, 'SERVER', 10);
$opal.cdecl($scope, 'SECURE', 20);
})(self);
(function($base) {
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;
(function(self) {
var $scope = self._scope, def = self._proto;
return self.$attr_accessor("strict_verbatim_paragraphs")
})(self.$singleton_class());
self.underline_style_section_titles = true;
(function(self) {
var $scope = self._scope, def = self._proto;
return self.$attr_accessor("underline_style_section_titles")
})(self.$singleton_class());
self.unwrap_standalone_preamble = true;
(function(self) {
var $scope = self._scope, def = self._proto;
return self.$attr_accessor("unwrap_standalone_preamble")
})(self.$singleton_class());
self.attribute_missing = "skip";
(function(self) {
var $scope = self._scope, def = self._proto;
return self.$attr_accessor("attribute_missing")
})(self.$singleton_class());
self.attribute_undefined = "drop-line";
(function(self) {
var $scope = self._scope, def = self._proto;
return self.$attr_accessor("attribute_undefined")
})(self.$singleton_class());
self.markdown_syntax = true;
(function(self) {
var $scope = self._scope, def = self._proto;
return self.$attr_accessor("markdown_syntax")
})(self.$singleton_class());
})(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($scope.LIB_PATH));
$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, '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 = (($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', "xefxbbxbf".$bytes().$to_a());
$opal.cdecl($scope, 'BOM_BYTES_UTF_16LE', "xffxfe".$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_VERSION) == null ? $opal.cm('RUBY_VERSION') : $a)['$<']("1.9"));
$opal.cdecl($scope, 'EOL', "\n");
$opal.cdecl($scope, 'LINE_SPLIT', /\n/);
$opal.cdecl($scope, 'DEFAULT_DOCTYPE', "article");
$opal.cdecl($scope, 'DEFAULT_BACKEND', "html5");
$opal.cdecl($scope, 'DEFAULT_STYLESHEET_KEYS', ["", "DEFAULT"].$to_set());
$opal.cdecl($scope, 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css");
$opal.cdecl($scope, 'BACKEND_ALIASES', $hash2(["html", "docbook"], {"html": "html5", "docbook": "docbook45"}));
$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, 'ASCIIDOC_EXTENSIONS', $hash2([".asciidoc", ".adoc", ".ad", ".asc", ".txt"], {".asciidoc": true, ".adoc": true, ".ad": true, ".asc": true, ".txt": true}));
$opal.cdecl($scope, 'SECTION_LEVELS', $hash2(["=", "-", "~", "^", "+"], {"=": 0, "-": 1, "~": 2, "^": 3, "+": 4}));
$opal.cdecl($scope, 'ADMONITION_STYLES', ["NOTE", "TIP", "IMPORTANT", "WARNING", "CAUTION"].$to_set());
$opal.cdecl($scope, 'PARAGRAPH_STYLES', ["comment", "example", "literal", "listing", "normal", "pass", "quote", "sidebar", "source", "verse", "abstract", "partintro"].$to_set());
$opal.cdecl($scope, 'VERBATIM_STYLES', ["literal", "listing", "source", "verse"].$to_set());
$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;
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, '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) {
$opal.cdecl($scope, 'CC_ALPHA', "a-zA-Z");
$opal.cdecl($scope, 'CC_ALNUM', "a-zA-Z0-9");
$opal.cdecl($scope, 'CC_BLANK', "[ \t]");
$opal.cdecl($scope, 'CC_GRAPH', "[x21-x7E]");
$opal.cdecl($scope, 'CC_EOL', "(?=\n|$)");
} else {
$opal.cdecl($scope, 'CC_ALPHA', "[:alpha:]");
$opal.cdecl($scope, 'CC_ALNUM', "[:alnum:]");
$opal.cdecl($scope, 'CC_BLANK', "[[:blank:]]");
$opal.cdecl($scope, 'CC_GRAPH', "[[:graph:]]");
$opal.cdecl($scope, 'CC_EOL', "$");
};
$opal.cdecl($scope, 'BLANK_LINE_PATTERN', (new RegExp("^" + $scope.CC_BLANK + "*\\n")));
$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, '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("^(?:\\d+>" + $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("^(\\d+)>" + $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, '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, 'SPECIAL_CHARS', $hash2(["<", ">", "&"], {"<": "<", ">": ">", "&": "&"}));
$opal.cdecl($scope, 'SPECIAL_CHARS_PATTERN', (new RegExp("[" + $scope.SPECIAL_CHARS.$keys().$join() + "]")));
$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, '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.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.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.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.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);
});
if (($a = (($d = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $d)) === false || $a === nil) {
;
;};
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
if (($a = (($d = $opal.Object._scope.RUBY_ENGINE_OPAL) == null ? $opal.cm('RUBY_ENGINE_OPAL') : $d)) !== false && $a !== nil) {
};
})(self);
})(Opal);
© 2015 - 2024 Weber Informatics LLC | Privacy Policy