This repository has been archived by the owner on Apr 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a97fb97
commit 441c160
Showing
2 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
/* Generated by Opal 0.10.1 */ | ||
Opal.modules["asciidoctor/core_ext/factory"] = 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; | ||
|
||
Opal.add_stubs(['$resolve', '$is_a?', '$new', '$===', '$require', '$to_s', '$==', '$exist?', '$key?', '$[]=', '$[]']); | ||
return (function($base) { | ||
var $Asciidoctor, self = $Asciidoctor = $module($base, 'Asciidoctor'); | ||
|
||
var def = self.$$proto, $scope = self.$$scope; | ||
|
||
(function($base) { | ||
var $Converter, self = $Converter = $module($base, 'Converter'); | ||
|
||
var def = self.$$proto, $scope = self.$$scope; | ||
|
||
(function($base, $super) { | ||
function $Factory(){}; | ||
var self = $Factory = $klass($base, $super, 'Factory', $Factory); | ||
|
||
var def = self.$$proto, $scope = self.$$scope, TMP_1; | ||
|
||
return (Opal.defn(self, '$create', TMP_1 = function ːcreate(backend, opts) { | ||
var $a, $b, $c, self = this, converter = nil, base_converter = nil, $case = nil, revealjs_templates_path = nil; | ||
|
||
if (opts == null) { | ||
opts = $hash2([], {}); | ||
} | ||
if ((($a = (converter = self.$resolve(backend))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
if ((($a = converter['$is_a?'](Opal.get('Class'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
return converter.$new(backend, opts) | ||
} else { | ||
return converter | ||
}}; | ||
base_converter = (function() {$case = backend;if ("html5"['$===']($case)) {if ((($a = (function(){ try { return ((((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('Html5Converter'))) != null ? 'constant' : nil); } catch (err) { if (err.$$class === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
self.$require("asciidoctor/converter/html5".$to_s()) | ||
}; | ||
return $scope.get('Html5Converter').$new(backend, opts);}else if ("docbook5"['$===']($case)) {if ((($a = (function(){ try { return ((((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('DocBook5Converter'))) != null ? 'constant' : nil); } catch (err) { if (err.$$class === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
self.$require("asciidoctor/converter/docbook5".$to_s()) | ||
}; | ||
return $scope.get('DocBook5Converter').$new(backend, opts);}else if ("docbook45"['$===']($case)) {if ((($a = (function(){ try { return ((((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('DocBook45Converter'))) != null ? 'constant' : nil); } catch (err) { if (err.$$class === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
self.$require("asciidoctor/converter/docbook45".$to_s()) | ||
}; | ||
return $scope.get('DocBook45Converter').$new(backend, opts);}else if ("manpage"['$===']($case)) {if ((($a = (function(){ try { return ((((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('ManPageConverter'))) != null ? 'constant' : nil); } catch (err) { if (err.$$class === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
self.$require("asciidoctor/converter/manpage".$to_s()) | ||
}; | ||
return $scope.get('ManPageConverter').$new(backend, opts);}else { return nil }})(); | ||
if ((($a = (($b = backend['$==']("revealjs")) ? (((($c = $scope.get('JAVASCRIPT_PLATFORM')['$==']("node")) !== false && $c !== nil && $c != null) ? $c : $scope.get('JAVASCRIPT_PLATFORM')['$==']("node-electron"))) : backend['$==']("revealjs"))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
if ((($a = Opal.get('File')['$exist?'](revealjs_templates_path = "node_modules/asciidoctor-reveal.js/templates")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
if ((($a = opts['$key?']("template_dirs")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
opts['$[]=']("template_dirs", revealjs_templates_path) | ||
}}}; | ||
if ((($a = opts['$key?']("template_dirs")) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
return base_converter | ||
}; | ||
if ((($a = (function(){ try { return ((((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('TemplateConverter'))) != null ? 'constant' : nil); } catch (err) { if (err.$$class === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
self.$require("asciidoctor/converter/template".$to_s()) | ||
}; | ||
if ((($a = (function(){ try { return ((((((Opal.get('Asciidoctor')).$$scope.get('Converter'))).$$scope.get('CompositeConverter'))) != null ? 'constant' : nil); } catch (err) { if (err.$$class === Opal.NameError) { return nil; } else { throw(err); }}; })()) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
self.$require("asciidoctor/converter/composite".$to_s()) | ||
}; | ||
return $scope.get('TemplateConverter').$new(backend, opts['$[]']("template_dirs"), opts); | ||
}, TMP_1.$$arity = -2), nil) && 'create' | ||
})($scope.base, null) | ||
})($scope.base) | ||
})($scope.base) | ||
}; | ||
|
||
/* Generated by Opal 0.10.1 */ | ||
Opal.modules["asciidoctor/core_ext/template"] = function(Opal) { | ||
function $rb_plus(lhs, rhs) { | ||
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs); | ||
} | ||
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2; | ||
|
||
Opal.add_stubs(['$kind_of?', '$new', '$each', '$directory?', '$system_path', '$join', '$+', '$exist?', '$read', '$node_name', '$resolve_template', '$raise']); | ||
return (function($base) { | ||
var $Asciidoctor, self = $Asciidoctor = $module($base, 'Asciidoctor'); | ||
|
||
var def = self.$$proto, $scope = self.$$scope; | ||
|
||
(function($base, $super) { | ||
function $TemplateConverter(){}; | ||
var self = $TemplateConverter = $klass($base, $super, 'TemplateConverter', $TemplateConverter); | ||
|
||
var def = self.$$proto, $scope = self.$$scope, TMP_1, TMP_3, TMP_4; | ||
|
||
def.backend = def.engine = def.template_dirs = nil; | ||
Opal.defn(self, '$initialize', TMP_1 = function ːinitialize(backend, template_dirs, opts) { | ||
var $a, self = this; | ||
|
||
if (opts == null) { | ||
opts = $hash2([], {}); | ||
} | ||
self.backend = backend; | ||
self.engine = "jade"; | ||
if ((($a = template_dirs['$kind_of?']($scope.get('String'))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
return self.template_dirs = [template_dirs] | ||
} else { | ||
return self.template_dirs = template_dirs | ||
}; | ||
}, TMP_1.$$arity = -3); | ||
|
||
Opal.defn(self, '$resolve_template', TMP_3 = function ːresolve_template(name) {try { | ||
|
||
var $a, $b, TMP_2, self = this, path_resolver = nil, backend = nil, engine = nil; | ||
|
||
path_resolver = $scope.get('PathResolver').$new(); | ||
backend = self.backend; | ||
engine = self.engine; | ||
($a = ($b = self.template_dirs).$each, $a.$$p = (TMP_2 = function(template_dir){var self = TMP_2.$$s || this, $c, engine_dir = nil, backend_dir = nil, template = nil; | ||
if (template_dir == null) template_dir = nil; | ||
if ((($c = Opal.get('File')['$directory?'](template_dir = (path_resolver.$system_path(template_dir, nil)))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { | ||
} else { | ||
return nil; | ||
}; | ||
if (engine !== false && engine !== nil && engine != null) { | ||
if ((($c = Opal.get('File')['$directory?'](engine_dir = (Opal.get('File').$join(template_dir, engine)))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { | ||
template_dir = engine_dir}}; | ||
if ((($c = Opal.get('File')['$directory?'](backend_dir = (Opal.get('File').$join(template_dir, backend)))) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { | ||
template_dir = backend_dir}; | ||
template = Opal.get('File').$join(template_dir, $rb_plus($rb_plus(name, "."), engine)); | ||
if ((($c = Opal.get('File')['$exist?'](template)) !== nil && $c != null && (!$c.$$is_boolean || $c == true))) { | ||
Opal.ret(Opal.get('File').$read(template)) | ||
} else { | ||
return nil | ||
};}, TMP_2.$$s = self, TMP_2.$$arity = 1, TMP_2), $a).call($b); | ||
return nil; | ||
} catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; } | ||
}, TMP_3.$$arity = 1); | ||
|
||
return (Opal.defn(self, '$convert', TMP_4 = function ːconvert(node, template_name, opts) { | ||
var $a, self = this, template = nil; | ||
|
||
if (template_name == null) { | ||
template_name = nil; | ||
} | ||
if (opts == null) { | ||
opts = $hash2([], {}); | ||
} | ||
((($a = template_name) !== false && $a !== nil && $a != null) ? $a : template_name = node.$node_name()); | ||
if ((($a = (template = self.$resolve_template(template_name))) !== nil && $a != null && (!$a.$$is_boolean || $a == true))) { | ||
} else { | ||
self.$raise("Could not find a custom template to handle transform: " + (template_name)) | ||
}; | ||
|
||
if (typeof window !== 'undefined') { | ||
var jade = jade || window.jade; | ||
} else if (typeof require !== 'undefined') { | ||
var jade = jade || require('jade'); | ||
} | ||
var compiled = jade.compile(template, {pretty: true}); | ||
return compiled({ node: node }); | ||
|
||
}, TMP_4.$$arity = -2), nil) && 'convert'; | ||
})($scope.get('Converter'), (($scope.get('Converter')).$$scope.get('Base'))) | ||
})($scope.base) | ||
}; | ||
|
||
/* Generated by Opal 0.10.1 */ | ||
(function(Opal) { | ||
var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice; | ||
|
||
Opal.add_stubs(['$require']); | ||
self.$require("asciidoctor/core_ext/factory"); | ||
return self.$require("asciidoctor/core_ext/template"); | ||
})(Opal); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.