@asciidoctor/manpage-converter
Version:
Man(ual) page converter for Asciidoctor.js
881 lines (689 loc) • 50.1 kB
JavaScript
// UMD Module
(function (root, factory) {
if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory;
module.exports.register = factory;
} else if (typeof define === 'function' && define.amd) {
// AMD. Register a named module.
define('asciidoctor/docbook', ['asciidoctor'], function () {
return factory();
});
} else {
// Browser globals (root is window)
if (typeof root.Asciidoctor === 'undefined') {
throw new Error('Asciidoctor.js should be loaded before Asciidoctor ManPage.js');
}
root.Asciidoctor.DocBook = factory;
}
}(this, function () {
/* Generated by Opal 0.11.99.dev */
(function(Opal) {
function $rb_times(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
}
function $rb_gt(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
}
function $rb_plus(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
}
function $rb_minus(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
}
function $rb_ge(lhs, rhs) {
return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs >= rhs : lhs['$>='](rhs);
}
var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $module = Opal.module, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars;
Opal.add_stubs(['$register_for', '$*', '$init_backend_traits', '$attr?', '$raise', '$attr', '$<<', '$tr_s', '$manify', '$upcase', '$noheader', '$join', '$map', '$content', '$footnotes?', '$!', '$concat', '$footnotes', '$index', '$text', '$empty?', '$authors', '$>', '$size', '$each', '$name', '$[]', '$level', '$captioned_title', '$title', '$title?', '$enclose_content', '$items', '$+', '$blocks?', '$style', '$===', '$text?', '$alt', '$each_with_index', '$to_sym', '$start_with?', '$end_with?', '$slice', '$length', '$-', '$to_h', '$rows', '$[]=', '$==', '$chr', '$colspan', '$times', '$rowspan', '$>=', '$chop', '$media_uri', '$target', '$type', '$gsub', '$sub', '$attributes', '$catalog', '$document', '$xreftext', '$warn', '$logger', '$inspect', '$shift', '$split', '$write', '$private', '$fetch', '$rstrip', '$lstrip', '$content_model']);
return (function($base, $parent_nesting) {
var self = $module($base, 'Asciidoctor');
var $nesting = [self].concat($parent_nesting);
(function($base, $super, $parent_nesting) {
var self = $klass($base, $super, 'ManPageConverter');
var $nesting = [self].concat($parent_nesting), $ManPageConverter_initialize$1, $ManPageConverter_convert_document$2, $ManPageConverter_convert_embedded$6, $ManPageConverter_convert_section$8, $ManPageConverter_convert_admonition$9, $ManPageConverter_convert_colist$10, $ManPageConverter_convert_dlist$12, $ManPageConverter_convert_example$16, $ManPageConverter_convert_floating_title$17, $ManPageConverter_convert_image$18, $ManPageConverter_convert_listing$19, $ManPageConverter_convert_literal$20, $ManPageConverter_convert_sidebar$21, $ManPageConverter_convert_olist$22, $ManPageConverter_convert_open$24, $ManPageConverter_convert_paragraph$25, $ManPageConverter_convert_quote$26, $ManPageConverter_convert_stem$27, $ManPageConverter_convert_table$28, $ManPageConverter_convert_thematic_break$35, $ManPageConverter_convert_ulist$36, $ManPageConverter_convert_verse$38, $ManPageConverter_convert_video$39, $ManPageConverter_convert_inline_anchor$40, $ManPageConverter_convert_inline_break$41, $ManPageConverter_convert_inline_button$42, $ManPageConverter_convert_inline_callout$43, $ManPageConverter_convert_inline_footnote$44, $ManPageConverter_convert_inline_image$45, $ManPageConverter_convert_inline_indexterm$46, $ManPageConverter_convert_inline_kbd$47, $ManPageConverter_convert_inline_menu$48, $ManPageConverter_convert_inline_quoted$50, $ManPageConverter_write_alternate_pages$51, $ManPageConverter_manify$53, $ManPageConverter_enclose_content$55;
self.$$prototype.refs = nil;
self.$register_for("manpage");
Opal.const_set($nesting[0], 'WHITESPACE', "" + ($$($nesting, 'LF')) + ($$($nesting, 'TAB')) + " ");
Opal.const_set($nesting[0], 'ET', $rb_times(" ", 8));
Opal.const_set($nesting[0], 'ESC', "\u001b");
Opal.const_set($nesting[0], 'ESC_BS', "" + ($$($nesting, 'ESC')) + "\\");
Opal.const_set($nesting[0], 'ESC_FS', "" + ($$($nesting, 'ESC')) + ".");
Opal.const_set($nesting[0], 'LiteralBackslashRx', new RegExp("" + "(?:\\A|[^" + ($$($nesting, 'ESC')) + "])\\\\"));
Opal.const_set($nesting[0], 'LeadingPeriodRx', /^\./);
Opal.const_set($nesting[0], 'EscapedMacroRx', new RegExp("" + "^(?:" + ($$($nesting, 'ESC')) + "\\\\c\\n)?" + ($$($nesting, 'ESC')) + "\\.((?:URL|MTO) \".*?\" \".*?\" )( |[^\\s]*)(.*?)(?: *" + ($$($nesting, 'ESC')) + "\\\\c)?$"));
Opal.const_set($nesting[0], 'MockBoundaryRx', /<\/?BOUNDARY>/);
Opal.const_set($nesting[0], 'EmDashCharRefRx', /—(?:​)?/);
Opal.const_set($nesting[0], 'EllipsisCharRefRx', /…(?:​)?/);
Opal.const_set($nesting[0], 'WrappedIndentRx', new RegExp("" + ($$($nesting, 'CG_BLANK')) + "*" + ($$($nesting, 'LF')) + ($$($nesting, 'CG_BLANK')) + "*"));
Opal.def(self, '$initialize', $ManPageConverter_initialize$1 = function $$initialize(backend, opts) {
var self = this;
if (opts == null) {
opts = $hash2([], {});
};
self.backend = backend;
return self.$init_backend_traits($hash2(["basebackend", "filetype", "outfilesuffix", "supports_templates"], {"basebackend": "manpage", "filetype": "man", "outfilesuffix": ".man", "supports_templates": true}));
}, $ManPageConverter_initialize$1.$$arity = -2);
Opal.def(self, '$convert_document', $ManPageConverter_convert_document$2 = function $$convert_document(node) {
var $$3, $a, $$4, $$5, self = this, mantitle = nil, manvolnum = nil, manname = nil, manmanual = nil, mansource = nil, docdate = nil, result = nil, mannames = nil, authors = nil;
if ($truthy(node['$attr?']("mantitle"))) {
} else {
self.$raise("asciidoctor: ERROR: doctype must be set to manpage when using manpage backend")
};
mantitle = node.$attr("mantitle");
manvolnum = node.$attr("manvolnum", "1");
manname = node.$attr("manname", mantitle);
manmanual = node.$attr("manmanual");
mansource = node.$attr("mansource");
docdate = (function() {if ($truthy(node['$attr?']("reproducible"))) {
return nil
} else {
return node.$attr("docdate");
}; return nil; })();
result = ["" + "'\\\" t\n" + ".\\\" Title: " + (mantitle) + "\n" + ".\\\" Author: " + ((function() {if ($truthy(node['$attr?']("authors"))) {
return node.$attr("authors");
} else {
return "[see the \"AUTHOR(S)\" section]"
}; return nil; })()) + "\n" + ".\\\" Generator: Asciidoctor " + (node.$attr("asciidoctor-version"))];
if ($truthy(docdate)) {
result['$<<']("" + ".\\\" Date: " + (docdate))};
result['$<<']("" + ".\\\" Manual: " + ((function() {if ($truthy(manmanual)) {
return manmanual.$tr_s($$($nesting, 'WHITESPACE'), " ");
} else {
return "\\ \\&"
}; return nil; })()) + "\n" + ".\\\" Source: " + ((function() {if ($truthy(mansource)) {
return mansource.$tr_s($$($nesting, 'WHITESPACE'), " ");
} else {
return "\\ \\&"
}; return nil; })()) + "\n" + ".\\\" Language: English\n" + ".\\\"");
result['$<<']("" + ".TH \"" + (self.$manify(manname.$upcase())) + "\" \"" + (manvolnum) + "\" \"" + (docdate) + "\" \"" + ((function() {if ($truthy(mansource)) {
return self.$manify(mansource);
} else {
return "\\ \\&"
}; return nil; })()) + "\" \"" + ((function() {if ($truthy(manmanual)) {
return self.$manify(manmanual);
} else {
return "\\ \\&"
}; return nil; })()) + "\"");
result['$<<'](".ie \\n(.g .ds Aq \\(aq");
result['$<<'](".el .ds Aq '");
result['$<<'](".ss \\n[.ss] 0");
result['$<<'](".nh");
result['$<<'](".ad l");
result['$<<']("" + ".de URL\n" + "\\fI\\\\$2\\fP <\\\\$1>\\\\$3\n" + "..\n" + ".als MTO URL\n" + ".if \\n[.g] \\{\\\n" + ". mso www.tmac\n" + ". am URL\n" + ". ad l\n" + ". .\n" + ". am MTO\n" + ". ad l\n" + ". .");
result['$<<']("" + ". LINKSTYLE " + (node.$attr("man-linkstyle", "blue R < >")));
result['$<<'](".\\}");
if ($truthy(node.$noheader())) {
} else if ($truthy(node['$attr?']("manpurpose"))) {
mannames = node.$attr("mannames", [manname]);
result['$<<']("" + ".SH \"" + (node.$attr("manname-title", "NAME").$upcase()) + "\"\n" + ($send(mannames, 'map', [], ($$3 = function(n){var self = $$3.$$s || this;
if (n == null) {
n = nil;
};
return self.$manify(n);}, $$3.$$s = self, $$3.$$arity = 1, $$3)).$join(", ")) + " \\- " + (self.$manify(node.$attr("manpurpose"), $hash2(["whitespace"], {"whitespace": "normalize"}))));};
result['$<<'](node.$content());
if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) {
result['$<<'](".SH \"NOTES\"");
result.$concat($send(node.$footnotes(), 'map', [], ($$4 = function(fn){var self = $$4.$$s || this;
if (fn == null) {
fn = nil;
};
return "" + (fn.$index()) + ". " + (fn.$text());}, $$4.$$s = self, $$4.$$arity = 1, $$4)));};
if ($truthy((authors = node.$authors())['$empty?']())) {
} else if ($truthy($rb_gt(authors.$size(), 1))) {
result['$<<'](".SH \"AUTHORS\"");
$send(authors, 'each', [], ($$5 = function(author){var self = $$5.$$s || this;
if (author == null) {
author = nil;
};
return result['$<<']("" + ".sp\n" + (author.$name()));}, $$5.$$s = self, $$5.$$arity = 1, $$5));
} else {
result['$<<']("" + ".SH \"AUTHOR\"\n" + ".sp\n" + (authors['$[]'](0).$name()))
};
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_document$2.$$arity = 1);
Opal.def(self, '$convert_embedded', $ManPageConverter_convert_embedded$6 = function $$convert_embedded(node) {
var $a, $$7, self = this, result = nil;
result = [node.$content()];
if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) {
result['$<<'](".SH \"NOTES\"");
result.$concat($send(node.$footnotes(), 'map', [], ($$7 = function(fn){var self = $$7.$$s || this;
if (fn == null) {
fn = nil;
};
return "" + (fn.$index()) + ". " + (fn.$text());}, $$7.$$s = self, $$7.$$arity = 1, $$7)));};
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_embedded$6.$$arity = 1);
Opal.def(self, '$convert_section', $ManPageConverter_convert_section$8 = function $$convert_section(node) {
var self = this, result = nil, macro = nil, stitle = nil;
result = [];
if ($truthy($rb_gt(node.$level(), 1))) {
macro = "SS";
stitle = node.$captioned_title();
} else {
macro = "SH";
stitle = node.$title().$upcase();
};
result['$<<']("" + "." + (macro) + " \"" + (self.$manify(stitle)) + "\"\n" + (node.$content()));
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_section$8.$$arity = 1);
Opal.def(self, '$convert_admonition', $ManPageConverter_convert_admonition$9 = function $$convert_admonition(node) {
var self = this, result = nil;
result = [];
result['$<<']("" + ".if n .sp\n" + ".RS 4\n" + ".it 1 an-trap\n" + ".nr an-no-space-flag 1\n" + ".nr an-break-flag 1\n" + ".br\n" + ".ps +1\n" + ".B " + (node.$attr("textlabel")) + ((function() {if ($truthy(node['$title?']())) {
return "" + "\\fP: " + (self.$manify(node.$title()))
} else {
return ""
}; return nil; })()) + "\n" + ".ps -1\n" + ".br\n" + (self.$enclose_content(node)) + "\n" + ".sp .5v\n" + ".RE");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_admonition$9.$$arity = 1);
Opal.def(self, '$convert_colist', $ManPageConverter_convert_colist$10 = function $$convert_colist(node) {
var $$11, self = this, result = nil, num = nil;
result = [];
if ($truthy(node['$title?']())) {
result['$<<']("" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br")};
result['$<<']("" + ".TS\n" + "tab(:);\n" + "r lw(\\n(.lu*75u/100u).");
num = 0;
$send(node.$items(), 'each', [], ($$11 = function(item){var self = $$11.$$s || this;
if (item == null) {
item = nil;
};
result['$<<']("" + "\\fB(" + ((num = $rb_plus(num, 1))) + ")\\fP\\h'-2n':T{");
result['$<<'](self.$manify(item.$text(), $hash2(["whitespace"], {"whitespace": "normalize"})));
if ($truthy(item['$blocks?']())) {
result['$<<'](item.$content())};
return result['$<<']("T}");}, $$11.$$s = self, $$11.$$arity = 1, $$11));
result['$<<'](".TE");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_colist$10.$$arity = 1);
Opal.def(self, '$convert_dlist', $ManPageConverter_convert_dlist$12 = function $$convert_dlist(node) {
var $$13, self = this, result = nil, counter = nil;
result = [];
if ($truthy(node['$title?']())) {
result['$<<']("" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br")};
counter = 0;
$send(node.$items(), 'each', [], ($$13 = function(terms, dd){var self = $$13.$$s || this, $$14, $$15, $case = nil;
if (terms == null) {
terms = nil;
};
if (dd == null) {
dd = nil;
};
counter = $rb_plus(counter, 1);
$case = node.$style();
if ("qanda"['$===']($case)) {result['$<<']("" + ".sp\n" + (counter) + ". " + (self.$manify($send(terms, 'map', [], ($$14 = function(dt){var self = $$14.$$s || this;
if (dt == null) {
dt = nil;
};
return dt.$text();}, $$14.$$s = self, $$14.$$arity = 1, $$14)).$join(" "))) + "\n" + ".RS 4")}
else {result['$<<']("" + ".sp\n" + (self.$manify($send(terms, 'map', [], ($$15 = function(dt){var self = $$15.$$s || this;
if (dt == null) {
dt = nil;
};
return dt.$text();}, $$15.$$s = self, $$15.$$arity = 1, $$15)).$join(", "), $hash2(["whitespace"], {"whitespace": "normalize"}))) + "\n" + ".RS 4")};
if ($truthy(dd)) {
if ($truthy(dd['$text?']())) {
result['$<<'](self.$manify(dd.$text(), $hash2(["whitespace"], {"whitespace": "normalize"})))};
if ($truthy(dd['$blocks?']())) {
result['$<<'](dd.$content())};};
return result['$<<'](".RE");}, $$13.$$s = self, $$13.$$arity = 2, $$13));
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_dlist$12.$$arity = 1);
Opal.def(self, '$convert_example', $ManPageConverter_convert_example$16 = function $$convert_example(node) {
var self = this, result = nil;
result = [];
result['$<<']((function() {if ($truthy(node['$title?']())) {
return "" + ".sp\n" + ".B " + (self.$manify(node.$captioned_title())) + "\n" + ".br"
} else {
return ".sp"
}; return nil; })());
result['$<<']("" + ".RS 4\n" + (self.$enclose_content(node)) + "\n" + ".RE");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_example$16.$$arity = 1);
Opal.def(self, '$convert_floating_title', $ManPageConverter_convert_floating_title$17 = function $$convert_floating_title(node) {
var self = this;
return "" + ".SS \"" + (self.$manify(node.$title())) + "\""
}, $ManPageConverter_convert_floating_title$17.$$arity = 1);
Opal.def(self, '$convert_image', $ManPageConverter_convert_image$18 = function $$convert_image(node) {
var self = this, result = nil;
result = [];
result['$<<']((function() {if ($truthy(node['$title?']())) {
return "" + ".sp\n" + ".B " + (self.$manify(node.$captioned_title())) + "\n" + ".br"
} else {
return ".sp"
}; return nil; })());
result['$<<']("" + "[" + (node.$alt()) + "]");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_image$18.$$arity = 1);
Opal.def(self, '$convert_listing', $ManPageConverter_convert_listing$19 = function $$convert_listing(node) {
var self = this, result = nil;
result = [];
if ($truthy(node['$title?']())) {
result['$<<']("" + ".sp\n" + ".B " + (self.$manify(node.$captioned_title())) + "\n" + ".br")};
result['$<<']("" + ".sp\n" + ".if n .RS 4\n" + ".nf\n" + (self.$manify(node.$content(), $hash2(["whitespace"], {"whitespace": "preserve"}))) + "\n" + ".fi\n" + ".if n .RE");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_listing$19.$$arity = 1);
Opal.def(self, '$convert_literal', $ManPageConverter_convert_literal$20 = function $$convert_literal(node) {
var self = this, result = nil;
result = [];
if ($truthy(node['$title?']())) {
result['$<<']("" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br")};
result['$<<']("" + ".sp\n" + ".if n .RS 4\n" + ".nf\n" + (self.$manify(node.$content(), $hash2(["whitespace"], {"whitespace": "preserve"}))) + "\n" + ".fi\n" + ".if n .RE");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_literal$20.$$arity = 1);
Opal.def(self, '$convert_sidebar', $ManPageConverter_convert_sidebar$21 = function $$convert_sidebar(node) {
var self = this, result = nil;
result = [];
result['$<<']((function() {if ($truthy(node['$title?']())) {
return "" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br"
} else {
return ".sp"
}; return nil; })());
result['$<<']("" + ".RS 4\n" + (self.$enclose_content(node)) + "\n" + ".RE");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_sidebar$21.$$arity = 1);
Opal.def(self, '$convert_olist', $ManPageConverter_convert_olist$22 = function $$convert_olist(node) {
var $$23, self = this, result = nil;
result = [];
if ($truthy(node['$title?']())) {
result['$<<']("" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br")};
$send(node.$items(), 'each_with_index', [], ($$23 = function(item, idx){var self = $$23.$$s || this;
if (item == null) {
item = nil;
};
if (idx == null) {
idx = nil;
};
result['$<<']("" + ".sp\n" + ".RS 4\n" + ".ie n \\{\\\n" + "\\h'-04' " + ($rb_plus(idx, 1)) + ".\\h'+01'\\c\n" + ".\\}\n" + ".el \\{\\\n" + ". sp -1\n" + ". IP \" " + ($rb_plus(idx, 1)) + ".\" 4.2\n" + ".\\}\n" + (self.$manify(item.$text(), $hash2(["whitespace"], {"whitespace": "normalize"}))));
if ($truthy(item['$blocks?']())) {
result['$<<'](item.$content())};
return result['$<<'](".RE");}, $$23.$$s = self, $$23.$$arity = 2, $$23));
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_olist$22.$$arity = 1);
Opal.def(self, '$convert_open', $ManPageConverter_convert_open$24 = function $$convert_open(node) {
var self = this, $case = nil;
return (function() {$case = node.$style();
if ("abstract"['$===']($case) || "partintro"['$===']($case)) {return self.$enclose_content(node)}
else {return node.$content()}})()
}, $ManPageConverter_convert_open$24.$$arity = 1);
Opal.alias(self, "convert_page_break", "skip");
Opal.def(self, '$convert_paragraph', $ManPageConverter_convert_paragraph$25 = function $$convert_paragraph(node) {
var self = this;
if ($truthy(node['$title?']())) {
return "" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br\n" + (self.$manify(node.$content(), $hash2(["whitespace"], {"whitespace": "normalize"})))
} else {
return "" + ".sp\n" + (self.$manify(node.$content(), $hash2(["whitespace"], {"whitespace": "normalize"})))
}
}, $ManPageConverter_convert_paragraph$25.$$arity = 1);
Opal.alias(self, "convert_pass", "content_only");
Opal.alias(self, "convert_preamble", "content_only");
Opal.def(self, '$convert_quote', $ManPageConverter_convert_quote$26 = function $$convert_quote(node) {
var self = this, result = nil, attribution_line = nil;
result = [];
if ($truthy(node['$title?']())) {
result['$<<']("" + ".sp\n" + ".RS 3\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br\n" + ".RE")};
attribution_line = (function() {if ($truthy(node['$attr?']("citetitle"))) {
return "" + (node.$attr("citetitle")) + " "
} else {
return nil
}; return nil; })();
attribution_line = (function() {if ($truthy(node['$attr?']("attribution"))) {
return "" + (attribution_line) + "\\(em " + (node.$attr("attribution"))
} else {
return nil
}; return nil; })();
result['$<<']("" + ".RS 3\n" + ".ll -.6i\n" + (self.$enclose_content(node)) + "\n" + ".br\n" + ".RE\n" + ".ll");
if ($truthy(attribution_line)) {
result['$<<']("" + ".RS 5\n" + ".ll -.10i\n" + (attribution_line) + "\n" + ".RE\n" + ".ll")};
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_quote$26.$$arity = 1);
Opal.def(self, '$convert_stem', $ManPageConverter_convert_stem$27 = function $$convert_stem(node) {
var $a, $b, self = this, result = nil, open = nil, close = nil, equation = nil;
result = [];
result['$<<']((function() {if ($truthy(node['$title?']())) {
return "" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br"
} else {
return ".sp"
}; return nil; })());
$b = $$($nesting, 'BLOCK_MATH_DELIMITERS')['$[]'](node.$style().$to_sym()), $a = Opal.to_ary($b), (open = ($a[0] == null ? nil : $a[0])), (close = ($a[1] == null ? nil : $a[1])), $b;
if ($truthy(($truthy($a = (equation = node.$content())['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) {
equation = equation.$slice(open.$length(), $rb_minus($rb_minus(equation.$length(), open.$length()), close.$length()))};
result['$<<']("" + (self.$manify(equation, $hash2(["whitespace"], {"whitespace": "preserve"}))) + " (" + (node.$style()) + ")");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_stem$27.$$arity = 1);
Opal.def(self, '$convert_table', $ManPageConverter_convert_table$28 = function $$convert_table(node) {
var $$29, $$34, self = this, result = nil, row_header = nil, row_text = nil, row_index = nil;
result = [];
if ($truthy(node['$title?']())) {
result['$<<']("" + ".sp\n" + ".it 1 an-trap\n" + ".nr an-no-space-flag 1\n" + ".nr an-break-flag 1\n" + ".br\n" + ".B " + (self.$manify(node.$captioned_title())) + "\n")};
result['$<<']("" + ".TS\n" + "allbox tab(:);");
row_header = [];
row_text = [];
row_index = 0;
$send(node.$rows().$to_h(), 'each', [], ($$29 = function(tsec, rows){var self = $$29.$$s || this, $$30;
if (tsec == null) {
tsec = nil;
};
if (rows == null) {
rows = nil;
};
if ($truthy(rows['$empty?']())) {
return nil
} else {
return $send(rows, 'each', [], ($$30 = function(row){var self = $$30.$$s || this, $a, $$31, $writer = nil, remaining_cells = nil;
if (row == null) {
row = nil;
};
($truthy($a = row_header['$[]'](row_index)) ? $a : (($writer = [row_index, []]), $send(row_header, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
($truthy($a = row_text['$[]'](row_index)) ? $a : (($writer = [row_index, []]), $send(row_text, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
remaining_cells = row.$size();
$send(row, 'each_with_index', [], ($$31 = function(cell, cell_index){var self = $$31.$$s || this, $b, $$32, $$33, $logical_op_recvr_tmp_1 = nil, cell_halign = nil, $logical_op_recvr_tmp_2 = nil, $logical_op_recvr_tmp_3 = nil, $case = nil, cell_content = nil, $logical_op_recvr_tmp_4 = nil;
if (cell == null) {
cell = nil;
};
if (cell_index == null) {
cell_index = nil;
};
remaining_cells = $rb_minus(remaining_cells, 1);
$logical_op_recvr_tmp_1 = row_header['$[]'](row_index);
($truthy($b = $logical_op_recvr_tmp_1['$[]'](cell_index)) ? $b : (($writer = [cell_index, []]), $send($logical_op_recvr_tmp_1, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;
if (row_header['$[]'](row_index)['$[]'](cell_index)['$=='](["^t"])) {
row_text['$[]'](row_index)['$<<']("" + "T{" + ($$($nesting, 'LF')) + ".sp" + ($$($nesting, 'LF')) + "T}:")};
row_text['$[]'](row_index)['$<<']("" + "T{" + ($$($nesting, 'LF')) + ".sp" + ($$($nesting, 'LF')));
cell_halign = cell.$attr("halign", "left").$chr();
if (tsec['$==']("head")) {
if ($truthy(($truthy($b = row_header['$[]'](row_index)['$empty?']()) ? $b : row_header['$[]'](row_index)['$[]'](cell_index)['$empty?']()))) {
row_header['$[]'](row_index)['$[]'](cell_index)['$<<']("" + (cell_halign) + "tB")
} else {
$logical_op_recvr_tmp_2 = row_header['$[]'](row_index);
($truthy($b = $logical_op_recvr_tmp_2['$[]']($rb_plus(cell_index, 1))) ? $b : (($writer = [$rb_plus(cell_index, 1), []]), $send($logical_op_recvr_tmp_2, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;
row_header['$[]'](row_index)['$[]']($rb_plus(cell_index, 1))['$<<']("" + (cell_halign) + "tB");
};
row_text['$[]'](row_index)['$<<']("" + (self.$manify(cell.$text(), $hash2(["whitespace"], {"whitespace": "normalize"}))) + ($$($nesting, 'LF')));
} else if (tsec['$==']("body")) {
if ($truthy(($truthy($b = row_header['$[]'](row_index)['$empty?']()) ? $b : row_header['$[]'](row_index)['$[]'](cell_index)['$empty?']()))) {
row_header['$[]'](row_index)['$[]'](cell_index)['$<<']("" + (cell_halign) + "t")
} else {
$logical_op_recvr_tmp_3 = row_header['$[]'](row_index);
($truthy($b = $logical_op_recvr_tmp_3['$[]']($rb_plus(cell_index, 1))) ? $b : (($writer = [$rb_plus(cell_index, 1), []]), $send($logical_op_recvr_tmp_3, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;
row_header['$[]'](row_index)['$[]']($rb_plus(cell_index, 1))['$<<']("" + (cell_halign) + "t");
};
$case = cell.$style();
if ("asciidoc"['$===']($case)) {cell_content = cell.$content()}
else if ("literal"['$===']($case)) {cell_content = "" + ".nf" + ($$($nesting, 'LF')) + (self.$manify(cell.$text(), $hash2(["whitespace"], {"whitespace": "preserve"}))) + ($$($nesting, 'LF')) + ".fi"}
else {cell_content = self.$manify(cell.$content().$join(), $hash2(["whitespace"], {"whitespace": "normalize"}))};
row_text['$[]'](row_index)['$<<']("" + (cell_content) + ($$($nesting, 'LF')));
} else if (tsec['$==']("foot")) {
if ($truthy(($truthy($b = row_header['$[]'](row_index)['$empty?']()) ? $b : row_header['$[]'](row_index)['$[]'](cell_index)['$empty?']()))) {
row_header['$[]'](row_index)['$[]'](cell_index)['$<<']("" + (cell_halign) + "tB")
} else {
$logical_op_recvr_tmp_4 = row_header['$[]'](row_index);
($truthy($b = $logical_op_recvr_tmp_4['$[]']($rb_plus(cell_index, 1))) ? $b : (($writer = [$rb_plus(cell_index, 1), []]), $send($logical_op_recvr_tmp_4, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;
row_header['$[]'](row_index)['$[]']($rb_plus(cell_index, 1))['$<<']("" + (cell_halign) + "tB");
};
row_text['$[]'](row_index)['$<<']("" + (self.$manify(cell.$text(), $hash2(["whitespace"], {"whitespace": "normalize"}))) + ($$($nesting, 'LF')));};
if ($truthy(($truthy($b = cell.$colspan()) ? $rb_gt(cell.$colspan(), 1) : $b))) {
$send($rb_minus(cell.$colspan(), 1), 'times', [], ($$32 = function(i){var self = $$32.$$s || this, $c, $logical_op_recvr_tmp_5 = nil;
if (i == null) {
i = nil;
};
if ($truthy(($truthy($c = row_header['$[]'](row_index)['$empty?']()) ? $c : row_header['$[]'](row_index)['$[]'](cell_index)['$empty?']()))) {
return row_header['$[]'](row_index)['$[]']($rb_plus(cell_index, i))['$<<']("st")
} else {
$logical_op_recvr_tmp_5 = row_header['$[]'](row_index);
($truthy($c = $logical_op_recvr_tmp_5['$[]']($rb_plus($rb_plus(cell_index, 1), i))) ? $c : (($writer = [$rb_plus($rb_plus(cell_index, 1), i), []]), $send($logical_op_recvr_tmp_5, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;
return row_header['$[]'](row_index)['$[]']($rb_plus($rb_plus(cell_index, 1), i))['$<<']("st");
};}, $$32.$$s = self, $$32.$$arity = 1, $$32))};
if ($truthy(($truthy($b = cell.$rowspan()) ? $rb_gt(cell.$rowspan(), 1) : $b))) {
$send($rb_minus(cell.$rowspan(), 1), 'times', [], ($$33 = function(i){var self = $$33.$$s || this, $c, $logical_op_recvr_tmp_6 = nil, $logical_op_recvr_tmp_7 = nil;
if (i == null) {
i = nil;
};
($truthy($c = row_header['$[]']($rb_plus($rb_plus(row_index, 1), i))) ? $c : (($writer = [$rb_plus($rb_plus(row_index, 1), i), []]), $send(row_header, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
if ($truthy(($truthy($c = row_header['$[]']($rb_plus($rb_plus(row_index, 1), i))['$empty?']()) ? $c : row_header['$[]']($rb_plus($rb_plus(row_index, 1), i))['$[]'](cell_index)['$empty?']()))) {
$logical_op_recvr_tmp_6 = row_header['$[]']($rb_plus($rb_plus(row_index, 1), i));
($truthy($c = $logical_op_recvr_tmp_6['$[]'](cell_index)) ? $c : (($writer = [cell_index, []]), $send($logical_op_recvr_tmp_6, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;
return row_header['$[]']($rb_plus($rb_plus(row_index, 1), i))['$[]'](cell_index)['$<<']("^t");
} else {
$logical_op_recvr_tmp_7 = row_header['$[]']($rb_plus($rb_plus(row_index, 1), i));
($truthy($c = $logical_op_recvr_tmp_7['$[]']($rb_plus(cell_index, 1))) ? $c : (($writer = [$rb_plus(cell_index, 1), []]), $send($logical_op_recvr_tmp_7, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;
return row_header['$[]']($rb_plus($rb_plus(row_index, 1), i))['$[]']($rb_plus(cell_index, 1))['$<<']("^t");
};}, $$33.$$s = self, $$33.$$arity = 1, $$33))};
if ($truthy($rb_ge(remaining_cells, 1))) {
return row_text['$[]'](row_index)['$<<']("T}:")
} else {
return row_text['$[]'](row_index)['$<<']("" + "T}" + ($$($nesting, 'LF')))
};}, $$31.$$s = self, $$31.$$arity = 2, $$31));
return (row_index = $rb_plus(row_index, 1));}, $$30.$$s = self, $$30.$$arity = 1, $$30))
};}, $$29.$$s = self, $$29.$$arity = 2, $$29));
result['$<<']($$($nesting, 'LF'));
result['$<<']($rb_times("lt ", row_header['$[]'](0).$size()).$chop());
result['$<<']("" + "." + ($$($nesting, 'LF')));
$send(row_text, 'each', [], ($$34 = function(row){var self = $$34.$$s || this;
if (row == null) {
row = nil;
};
return result['$<<'](row.$join());}, $$34.$$s = self, $$34.$$arity = 1, $$34));
result['$<<']("" + ".TE" + ($$($nesting, 'LF')) + ".sp");
return result.$join();
}, $ManPageConverter_convert_table$28.$$arity = 1);
Opal.def(self, '$convert_thematic_break', $ManPageConverter_convert_thematic_break$35 = function $$convert_thematic_break(node) {
var self = this;
return "" + ".sp\n" + ".ce\n" + "\\l'\\n(.lu*25u/100u\\(ap'"
}, $ManPageConverter_convert_thematic_break$35.$$arity = 1);
Opal.alias(self, "convert_toc", "skip");
Opal.def(self, '$convert_ulist', $ManPageConverter_convert_ulist$36 = function $$convert_ulist(node) {
var $$37, self = this, result = nil;
result = [];
if ($truthy(node['$title?']())) {
result['$<<']("" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br")};
$send(node.$items(), 'map', [], ($$37 = function(item){var self = $$37.$$s || this;
if (item == null) {
item = nil;
};
result['$<<']("" + ".sp\n" + ".RS 4\n" + ".ie n \\{\\\n" + "\\h'-04'\\(bu\\h'+03'\\c\n" + ".\\}\n" + ".el \\{\\\n" + ". sp -1\n" + ". IP \\(bu 2.3\n" + ".\\}\n" + (self.$manify(item.$text(), $hash2(["whitespace"], {"whitespace": "normalize"}))));
if ($truthy(item['$blocks?']())) {
result['$<<'](item.$content())};
return result['$<<'](".RE");}, $$37.$$s = self, $$37.$$arity = 1, $$37));
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_ulist$36.$$arity = 1);
Opal.def(self, '$convert_verse', $ManPageConverter_convert_verse$38 = function $$convert_verse(node) {
var self = this, result = nil, attribution_line = nil;
result = [];
result['$<<']((function() {if ($truthy(node['$title?']())) {
return "" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br"
} else {
return ".sp"
}; return nil; })());
attribution_line = (function() {if ($truthy(node['$attr?']("citetitle"))) {
return "" + (node.$attr("citetitle")) + " "
} else {
return nil
}; return nil; })();
attribution_line = (function() {if ($truthy(node['$attr?']("attribution"))) {
return "" + (attribution_line) + "\\(em " + (node.$attr("attribution"))
} else {
return nil
}; return nil; })();
result['$<<']("" + ".sp\n" + ".nf\n" + (self.$manify(node.$content(), $hash2(["whitespace"], {"whitespace": "preserve"}))) + "\n" + ".fi\n" + ".br");
if ($truthy(attribution_line)) {
result['$<<']("" + ".in +.5i\n" + ".ll -.5i\n" + (attribution_line) + "\n" + ".in\n" + ".ll")};
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_verse$38.$$arity = 1);
Opal.def(self, '$convert_video', $ManPageConverter_convert_video$39 = function $$convert_video(node) {
var self = this, start_param = nil, end_param = nil, result = nil;
start_param = (function() {if ($truthy(node['$attr?']("start"))) {
return "" + "&start=" + (node.$attr("start"))
} else {
return ""
}; return nil; })();
end_param = (function() {if ($truthy(node['$attr?']("end"))) {
return "" + "&end=" + (node.$attr("end"))
} else {
return ""
}; return nil; })();
result = [];
result['$<<']((function() {if ($truthy(node['$title?']())) {
return "" + ".sp\n" + ".B " + (self.$manify(node.$title())) + "\n" + ".br"
} else {
return ".sp"
}; return nil; })());
result['$<<']("" + "<" + (node.$media_uri(node.$attr("target"))) + (start_param) + (end_param) + "> (video)");
return result.$join($$($nesting, 'LF'));
}, $ManPageConverter_convert_video$39.$$arity = 1);
Opal.def(self, '$convert_inline_anchor', $ManPageConverter_convert_inline_anchor$40 = function $$convert_inline_anchor(node) {
var $a, self = this, target = nil, $case = nil, macro = nil, text = nil, refid = nil, ref = nil;
target = node.$target();
return (function() {$case = node.$type();
if ("link"['$===']($case)) {
if ($truthy(target['$start_with?']("mailto:"))) {
macro = "MTO";
target = target.$slice(7, target.$length());
} else {
macro = "URL"
};
if ((text = node.$text())['$=='](target)) {
text = ""
} else {
text = text.$gsub("\"", "" + ($$($nesting, 'ESC_BS')) + "(dq")
};
if (macro['$==']("MTO")) {
target = target.$sub("@", "" + ($$($nesting, 'ESC_BS')) + "(at")};
return "" + ($$($nesting, 'ESC_BS')) + "c" + ($$($nesting, 'LF')) + ($$($nesting, 'ESC_FS')) + (macro) + " \"" + (target) + "\" \"" + (text) + "\" ";}
else if ("xref"['$===']($case)) {
if ($truthy((text = node.$text()))) {
} else {
refid = node.$attributes()['$[]']("refid");
if ($truthy($$($nesting, 'AbstractNode')['$===']((ref = (self.refs = ($truthy($a = self.refs) ? $a : node.$document().$catalog()['$[]']("refs")))['$[]'](refid))))) {
text = ($truthy($a = ref.$xreftext(node.$attr("xrefstyle", nil, true))) ? $a : "" + "[" + (refid) + "]")
} else {
text = "" + "[" + (refid) + "]"
};
};
return text;}
else if ("ref"['$===']($case) || "bibref"['$===']($case)) {return ""}
else {
self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect()));
return nil;}})();
}, $ManPageConverter_convert_inline_anchor$40.$$arity = 1);
Opal.def(self, '$convert_inline_break', $ManPageConverter_convert_inline_break$41 = function $$convert_inline_break(node) {
var self = this;
return "" + (node.$text()) + ($$($nesting, 'LF')) + ($$($nesting, 'ESC_FS')) + "br"
}, $ManPageConverter_convert_inline_break$41.$$arity = 1);
Opal.def(self, '$convert_inline_button', $ManPageConverter_convert_inline_button$42 = function $$convert_inline_button(node) {
var self = this;
return "" + ($$($nesting, 'ESC_BS')) + "fB[" + ($$($nesting, 'ESC_BS')) + "0" + (node.$text()) + ($$($nesting, 'ESC_BS')) + "0]" + ($$($nesting, 'ESC_BS')) + "fP"
}, $ManPageConverter_convert_inline_button$42.$$arity = 1);
Opal.def(self, '$convert_inline_callout', $ManPageConverter_convert_inline_callout$43 = function $$convert_inline_callout(node) {
var self = this;
return "" + ($$($nesting, 'ESC_BS')) + "fB(" + (node.$text()) + ")" + ($$($nesting, 'ESC_BS')) + "fP"
}, $ManPageConverter_convert_inline_callout$43.$$arity = 1);
Opal.def(self, '$convert_inline_footnote', $ManPageConverter_convert_inline_footnote$44 = function $$convert_inline_footnote(node) {
var self = this, index = nil;
if ($truthy((index = node.$attr("index")))) {
return "" + "[" + (index) + "]"
} else if (node.$type()['$==']("xref")) {
return "" + "[" + (node.$text()) + "]"
} else {
return nil
}
}, $ManPageConverter_convert_inline_footnote$44.$$arity = 1);
Opal.def(self, '$convert_inline_image', $ManPageConverter_convert_inline_image$45 = function $$convert_inline_image(node) {
var self = this;
if ($truthy(node['$attr?']("link"))) {
return "" + "[" + (node.$alt()) + "] <" + (node.$attr("link")) + ">"
} else {
return "" + "[" + (node.$alt()) + "]"
}
}, $ManPageConverter_convert_inline_image$45.$$arity = 1);
Opal.def(self, '$convert_inline_indexterm', $ManPageConverter_convert_inline_indexterm$46 = function $$convert_inline_indexterm(node) {
var self = this;
if (node.$type()['$==']("visible")) {
return node.$text()
} else {
return ""
}
}, $ManPageConverter_convert_inline_indexterm$46.$$arity = 1);
Opal.def(self, '$convert_inline_kbd', $ManPageConverter_convert_inline_kbd$47 = function $$convert_inline_kbd(node) {
var self = this, keys = nil;
if ((keys = node.$attr("keys")).$size()['$=='](1)) {
return keys['$[]'](0)
} else {
return keys.$join("" + ($$($nesting, 'ESC_BS')) + "0+" + ($$($nesting, 'ESC_BS')) + "0")
}
}, $ManPageConverter_convert_inline_kbd$47.$$arity = 1);
Opal.def(self, '$convert_inline_menu', $ManPageConverter_convert_inline_menu$48 = function $$convert_inline_menu(node) {
var $$49, self = this, caret = nil, menu = nil, submenus = nil, submenu_path = nil, menuitem = nil;
caret = "" + ($$($nesting, 'ESC_BS')) + "0" + ($$($nesting, 'ESC_BS')) + "(fc" + ($$($nesting, 'ESC_BS')) + "0";
menu = node.$attr("menu");
if ($truthy((submenus = node.$attr("submenus"))['$empty?']()['$!']())) {
submenu_path = $send(submenus, 'map', [], ($$49 = function(item){var self = $$49.$$s || this;
if (item == null) {
item = nil;
};
return "" + ($$($nesting, 'ESC_BS')) + "fI" + (item) + ($$($nesting, 'ESC_BS')) + "fP";}, $$49.$$s = self, $$49.$$arity = 1, $$49)).$join(caret);
return "" + ($$($nesting, 'ESC_BS')) + "fI" + (menu) + ($$($nesting, 'ESC_BS')) + "fP" + (caret) + (submenu_path) + (caret) + ($$($nesting, 'ESC_BS')) + "fI" + (node.$attr("menuitem")) + ($$($nesting, 'ESC_BS')) + "fP";
} else if ($truthy((menuitem = node.$attr("menuitem")))) {
return "" + ($$($nesting, 'ESC_BS')) + "fI" + (menu) + (caret) + (menuitem) + ($$($nesting, 'ESC_BS')) + "fP"
} else {
return "" + ($$($nesting, 'ESC_BS')) + "fI" + (menu) + ($$($nesting, 'ESC_BS')) + "fP"
};
}, $ManPageConverter_convert_inline_menu$48.$$arity = 1);
Opal.def(self, '$convert_inline_quoted', $ManPageConverter_convert_inline_quoted$50 = function $$convert_inline_quoted(node) {
var self = this, $case = nil;
return (function() {$case = node.$type();
if ("emphasis"['$===']($case)) {return "" + ($$($nesting, 'ESC_BS')) + "fI<BOUNDARY>" + (node.$text()) + "</BOUNDARY>" + ($$($nesting, 'ESC_BS')) + "fP"}
else if ("strong"['$===']($case)) {return "" + ($$($nesting, 'ESC_BS')) + "fB<BOUNDARY>" + (node.$text()) + "</BOUNDARY>" + ($$($nesting, 'ESC_BS')) + "fP"}
else if ("monospaced"['$===']($case)) {return "" + ($$($nesting, 'ESC_BS')) + "f(CR<BOUNDARY>" + (node.$text()) + "</BOUNDARY>" + ($$($nesting, 'ESC_BS')) + "fP"}
else if ("single"['$===']($case)) {return "" + ($$($nesting, 'ESC_BS')) + "(oq<BOUNDARY>" + (node.$text()) + "</BOUNDARY>" + ($$($nesting, 'ESC_BS')) + "(cq"}
else if ("double"['$===']($case)) {return "" + ($$($nesting, 'ESC_BS')) + "(lq<BOUNDARY>" + (node.$text()) + "</BOUNDARY>" + ($$($nesting, 'ESC_BS')) + "(rq"}
else {return node.$text()}})()
}, $ManPageConverter_convert_inline_quoted$50.$$arity = 1);
Opal.defs(self, '$write_alternate_pages', $ManPageConverter_write_alternate_pages$51 = function $$write_alternate_pages(mannames, manvolnum, target) {
var $a, $b, $$52, self = this, manvolext = nil, dir = nil, basename = nil;
if ($truthy(($truthy($a = mannames) ? $rb_gt(mannames.$size(), 1) : $a))) {
mannames.$shift();
manvolext = "" + "." + (manvolnum);
$b = $$$('::', 'File').$split(target), $a = Opal.to_ary($b), (dir = ($a[0] == null ? nil : $a[0])), (basename = ($a[1] == null ? nil : $a[1])), $b;
return $send(mannames, 'each', [], ($$52 = function(manname){var self = $$52.$$s || this;
if (manname == null) {
manname = nil;
};
return $$$('::', 'File').$write($$$('::', 'File').$join(dir, "" + (manname) + (manvolext)), "" + ".so " + (basename), $hash2(["mode"], {"mode": $$($nesting, 'FILE_WRITE_MODE')}));}, $$52.$$s = self, $$52.$$arity = 1, $$52));
} else {
return nil
}
}, $ManPageConverter_write_alternate_pages$51.$$arity = 3);
self.$private();
Opal.def(self, '$manify', $ManPageConverter_manify$53 = function $$manify(str, opts) {
var $$54, self = this, $case = nil;
if (opts == null) {
opts = $hash2([], {});
};
$case = opts.$fetch("whitespace", "collapse");
if ("preserve"['$===']($case)) {str = str.$gsub($$($nesting, 'TAB'), $$($nesting, 'ET'))}
else if ("normalize"['$===']($case)) {str = str.$gsub($$($nesting, 'WrappedIndentRx'), $$($nesting, 'LF'))}
else {str = str.$tr_s($$($nesting, 'WHITESPACE'), " ")};
str = $send(str.$gsub($$($nesting, 'LiteralBackslashRx'), "\\&(rs").$gsub($$($nesting, 'LeadingPeriodRx'), "\\\\&."), 'gsub', [$$($nesting, 'EscapedMacroRx')], ($$54 = function(){var self = $$54.$$s || this, $a, rest = nil;
if ($truthy((rest = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)).$lstrip())['$empty?']())) {
return "" + "." + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + "\"" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "\""
} else {
return "" + "." + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + "\"" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "\"" + ($$($nesting, 'LF')) + (rest)
}}, $$54.$$s = self, $$54.$$arity = 0, $$54)).$gsub("-", "\\-").$gsub("<", "<").$gsub(">", ">").$gsub(" ", "\\~").$gsub("©", "\\(co").$gsub("®", "\\(rg").$gsub("™", "\\(tm").$gsub(" ", " ").$gsub("–", "\\(en").$gsub($$($nesting, 'EmDashCharRefRx'), "\\(em").$gsub("‘", "\\(oq").$gsub("’", "\\(cq").$gsub("“", "\\(lq").$gsub("”", "\\(rq").$gsub($$($nesting, 'EllipsisCharRefRx'), "...").$gsub("←", "\\(<-").$gsub("→", "\\(->").$gsub("⇐", "\\(lA").$gsub("⇒", "\\(rA").$gsub("​", "\\:").$gsub("&", "&").$gsub("'", "\\(aq").$gsub($$($nesting, 'MockBoundaryRx'), "").$gsub($$($nesting, 'ESC_BS'), "\\").$gsub($$($nesting, 'ESC_FS'), ".").$rstrip();
if ($truthy(opts['$[]']("append_newline"))) {
return "" + (str) + ($$($nesting, 'LF'))
} else {
return str
};
}, $ManPageConverter_manify$53.$$arity = -2);
return (Opal.def(self, '$enclose_content', $ManPageConverter_enclose_content$55 = function $$enclose_content(node) {
var self = this;
if (node.$content_model()['$==']("compound")) {
return node.$content()
} else {
return "" + ".sp" + ($$($nesting, 'LF')) + (self.$manify(node.$content(), $hash2(["whitespace"], {"whitespace": "normalize"})))
}
}, $ManPageConverter_enclose_content$55.$$arity = 1), nil) && 'enclose_content';
})($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting)