diff --git a/README.md b/README.md
index fb4bed84..204b63c8 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,3 @@
# ThoughtSpot Documentation Site
-This repository contains an Antora playbook project for building the documentation site for the ThoughtSpot at docs.thoughtspot.com and cloud-docs.thoughtspot.com.
+This repository contains the Antora playbook project for building the ThoughtSpot documentation site at docs.thoughtspot.com and cloud-docs.thoughtspot.com.
diff --git a/antora-playbook.yml b/antora-playbook.yml
index 1fe97654..ceb6e931 100644
--- a/antora-playbook.yml
+++ b/antora-playbook.yml
@@ -1,7 +1,9 @@
site:
- title: ThoughtSpot Software Documentation
- url: https://docs-thoughtspot-com.netlify.app/software
+ title: ThoughtSpot Documentation
+ url: https://docs.thoughtspot.com
start_page: home::index.adoc
+ keys:
+ google_analytics: UA-44946579-2
content:
sources:
# embedding empty credentials in the URL disables the Edit this Page link for any page created from this repository
@@ -9,8 +11,29 @@ content:
branches: HEAD
start_path: home
- url: git@github.com:thoughtspot/thoughtspot-docs.git
- branches: ['6.0', '6.1', '6.2', '6.3']
+ # Software docs branches
+ branches: ['6.0', '6.1', '6.2', '6.3', '7.0', '7.1', '7.2', '8.4.1.sw', '8.8.1.sw', '9.0.1.sw', '9.5.0.sw', '9.8.0.sw']
start_path: software/
+ - url: git@github.com:thoughtspot/thoughtspot-docs.git
+ # Cloud docs branches
+ branches: ['10.0.0.cl', '10.1.0.cl', '10.3.0.cl', '10.4.0.cl']
+ start_path: cloud/
+ - url: git@github.com:thoughtspot/thoughtspot-docs.git
+ # Mobile docs branches
+ branches: [ '3.0.0.mb']
+ start_path: mobile/
+ - url: git@github.com:thoughtspot/thoughtspot-docs.git
+ # Spotter docs branch
+ branches: ['1.0.0.cp']
+ start_path: spotter/
+ - url: git@github.com:thoughtspot/visual-embed-sdk.git
+ # dev docs branches
+ branches: ['7.1.1-sw-docs', '7.2-sw-docs']
+ start_path: docs/software
+ - url: git@github.com:thoughtspot/thoughtspot-docs.git
+ # Seekwell docs branches
+ branches: ['seekwell']
+ start_path: seekwell/
urls:
latest_version_segment_strategy: redirect:to
latest_version_segment: latest
@@ -25,15 +48,20 @@ ui:
snapshot: true
asciidoc:
attributes:
- software: true
- cloud: false
+ #software: true
+ #cloud: false
+ page-company: ThoughtSpot
tabs: tabs
+ support-url: https://community.thoughtspot.com/customers/s/contactsupport[ThoughtSpot Support^]
+ seekwell: SeekWell
+ latest: 10.1.0.cl
+ cl-subscription-agreement: https://www.thoughtspot.com/legal/thoughtspot-cloud-subscription-agreement[subscription agreement^]
extensions:
- - "@djencks/asciidoctor-tabset-block"
+ - '@asciidoctor/tabs'
output:
clean: true
- dir: build/software
+ dir: build/
runtime:
fetch: true
log:
- level: error
+ level: error
diff --git a/build-snippets.js b/build-snippets.js
index 287e13f3..b1605a5a 100644
--- a/build-snippets.js
+++ b/build-snippets.js
@@ -10,13 +10,13 @@ const outputFolder = 'embed-snippets'
console.log(`folder: ${folder}, basePath: ${basePath}, outputPath: ${outputPath}`)
-const docsBaseUrl = 'https://docs.thoughtspot.com/latest'
+const docsBaseUrl = 'https://docs.thoughtspot.com/'
const embedTemplate = `
-
-
+
+
+
+
+
+
+
+
+ ThoughtSpot Software
+ ThoughtSpot Cloud
+
+
+ Who installs and manages
+ Customer
+ ThoughtSpot
+
+
+ Falcon in-memory database
+ Yes
+ No
+
+
+ Cluster scale
+ Multi-node clusters
+ Single node or 3 node for HA
+
+
+ Connect to cloud data warehouses
+ Yes
+ Yes
+
+
+ Search Data
+ Yes
+ Yes
+
+
+ SpotIQ Auto Analyze
+ Yes
+ Yes
+
+
+ Visualize
+ (Answers, Liveboards, follow and related features)
+ Yes
+ Yes
+
+
+ Mobile app
+ Yes
+ Yes
+
+
+ Data workspace
+ Yes*
+ Yes
+
+
+ SpotApps
+ Yes*
+ Yes
+
+
+ KPI charts
+ Yes
+ Yes
+
+
+ ThoughtSpot Embedded
+ Yes**
+ Yes
+
+
+ ThoughtSpot Sage: AI/GPT-assisted features
+ No
+ Yes
+
+
+ Monitor, anomaly detection, contextual explain change
+ No
+ Yes
+
+
+ Eureka (search Answers)
+ No
+ Yes
+
+
+ ThoughtSpot Sync (SeekWell Destinations)
+ No
+ Yes
+
+
+ * SpotApps must be manually installed in Software.
+
+
+ ** Available as an option for Software starting with the 8.4.x.sw release.
+
+
+
+
+
+
+
+
++++
diff --git a/home/modules/ROOT/pages/product-matrix.adoc b/home/modules/ROOT/pages/product-matrix.adoc
new file mode 100644
index 00000000..54cdf185
--- /dev/null
+++ b/home/modules/ROOT/pages/product-matrix.adoc
@@ -0,0 +1,121 @@
+[.conceal-title]
+= {empty}
+:page-layout: snippet
+
+++++
+
+++++
+
+++++
+
+
+
+
+ ThoughtSpot Software
+ ThoughtSpot Cloud
+
+
+ Who installs and manages
+ Customer
+ ThoughtSpot
+
+
+ Falcon in-memory database
+ Yes
+ No
+
+
+ Cluster scale
+ Multi-node clusters
+ Single node or 3 node for HA
+
+
+ Connect to cloud data warehouses
+ Yes
+ Yes
+
+
+ Search Data
+ Yes
+ Yes
+
+
+ SpotIQ Auto Analyze
+ Yes
+ Yes
+
+
+ Visualize
+ (Answers, Liveboards, follow and related features)
+ Yes
+ Yes
+
+
+ Mobile app
+ Yes
+ Yes
+
+
+ Data workspace
+ Yes*
+ Yes
+
+
+ SpotApps
+ Yes*
+ Yes
+
+
+ KPI charts
+ Yes
+ Yes
+
+
+ ThoughtSpot Embedded
+ Yes**
+ Yes
+
+
+ ThoughtSpot Sage: AI/GPT-assisted features
+ No
+ Yes
+
+
+ Monitor, anomaly detection, contextual explain change
+ No
+ Yes
+
+
+ Eureka (search Answers)
+ No
+ Yes
+
+
+ ThoughtSpot Sync (SeekWell Destinations)
+ No
+ Yes
+
+
+ * SpotApps must be manually installed in Software.
+
+
+** Available as an option for Software starting with the 8.4.x.sw release.
+
+
+
+
+
+++++
diff --git a/home/modules/ROOT/pages/robots.txt b/home/modules/ROOT/pages/robots.txt
new file mode 100644
index 00000000..e53ba301
--- /dev/null
+++ b/home/modules/ROOT/pages/robots.txt
@@ -0,0 +1 @@
+# Algolia-Crawler-Verif: E4E8AD1E2F7362AB
diff --git a/home/modules/ROOT/pages/survey_thanks.adoc b/home/modules/ROOT/pages/survey_thanks.adoc
new file mode 100644
index 00000000..883e0fcb
--- /dev/null
+++ b/home/modules/ROOT/pages/survey_thanks.adoc
@@ -0,0 +1,30 @@
+:page-layout: snippet
+
+++++
+
+
+
+
+
+
+
+
+
+
Thanks!
+
+
+
Thanks for your feedback!
+
+
+++++
diff --git a/lib/asciidoctor-performance-patch.js b/lib/asciidoctor-performance-patch.js
new file mode 100644
index 00000000..91a41e73
--- /dev/null
+++ b/lib/asciidoctor-performance-patch.js
@@ -0,0 +1,23 @@
+'use strict'
+
+// Fixes a performance issue with Asciidoctor.js 2 when used with Node.js 10
+module.exports = () => {
+ const Asciidoctor = global.Opal.Asciidoctor
+
+ Asciidoctor.Reader.prototype.$shift = function () {
+ this.lineno++
+ if (this.look_ahead) this.look_ahead--
+ return this.lines.shift()
+ }
+
+ Asciidoctor.PreprocessorReader.prototype.$shift = function () {
+ this.lineno++
+ if (this.look_ahead) this.look_ahead--
+ const line = this.lines.shift()
+ if (this.unescape_next_line) {
+ this.unescape_next_line = false
+ return line.substr(1)
+ }
+ return line
+ }
+}
diff --git a/netlify.toml b/netlify.toml
index 39eda8c2..0813af56 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -1,8 +1,429 @@
[build.environment]
CI = "true"
-NODE_VERSION = "10"
-# WARNING netlify-build ignores NPM_FLAGS when installing plugins, so use low-level NPM_CONFIG_ flag instead
-#NPM_FLAGS = "--no-optional"
+NODE_VERSION = "16"
+NODE_OPTIONS= "--max-old-space-size=8096"
NPM_CONFIG_OPTIONAL = "false"
ANTORA_CACHE_DIR = "node_modules/.cache/antora"
-NODE_OPTIONS = "--max-old-space-size=4096"
+
+[build]
+command = "node_modules/.bin/antora antora-playbook.yml --stacktrace --log-format=pretty"
+
+# security policies
+[[headers]]
+ for = "/*"
+[headers.values]
+ Content-Security-Policy = "default-src * 'unsafe-eval' 'unsafe-inline' data: filesystem: about: blob:;"
+
+# all redirects for site - test
+
+# redirect for product connectivity check start
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/blanknetworkconnect.png"
+ to = "https://docs.thoughtspot.com/software/latest/_images/blanknetworkconnect.png"
+ status = 301
+ force = true
+
+# redirect any netlify address url to real address
+# redirect for home of sw and cloud docs
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/8.8.1.sw.cu2?pendo=1"
+ to = "https://docs.thoughtspot.com/ghyer95y3/software/8.8.1.sw?pendo=1"
+ status = 301
+ force = true # COMMENT: global redirect for 9.7.0.cl old doc site url to latest cloud
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/cloud/9.12.5.cl/notes.html"
+ to = "https://docs.thoughtspot.com/cloud/latest/notes"
+ status = 301
+ force = true # COMMENT: redirect 9.10.5.cl release notes to 9.10.0.cl until prod cluster upgradeds
+
+# For Gilead redirects from old cloud-docs url, checkout the thoughtspot.github.io repo check out the ts8.nov.cl branch and add/update the redirects in the netlify.toml file, then merge them and make sure the cloud-docs.thoughtspo.tcom site in Netlify re-deploys.
+
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/8.4.1.sw.cu1/release/help-center"
+ to = "https://docs.thoughtspot.com/software/8.4.1.sw/help-center"
+ status = 301
+ force = true # COMMENT: ensure that we always redirect
+
+# rewrite to publish older hidden doc version for Candian Tire - begin
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/cloud/9.3.0.cl/*"
+ to = "https://9-3-0-cl-docs-archive.netlify.app/cloud/9.3.0.cl/:splat"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/9.3.0.cl/release/help-center"
+ to = "https://docs.thoughtspot.com/cloud/9.3.0.cl/help-center"
+ status = 301
+ force = true # COMMENT: ensure that we always redirect
+
+# rewrite to publish older hidden doc version - end
+
+# rewrite to publish gartner at hidden doc version - begin
+
+[[redirects]]
+from = "https://docs.thoughtspot.com/cloud/9.9.0.cl/*"
+to = "https://ts-9-9-0-cl.netlify.app/cloud/9.9.0.cl/:splat"
+status = 200
+force = true # COMMENT: ensure that we always redirect
+
+# rewrite to publish gartner at hidden doc version - end
+
+# rewrites for help - start
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/8.8.1.sw.cu1/*"
+ to = "https://docs.thoughtspot.com/software/8.8.1.sw/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 8.8.1.sw.cu1 to sw 8.8.1.sw
+
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/8.8.1.sw.cu1/"
+ to = "https://docs.thoughtspot.com/ghyer95y3/software/8.8.1.sw/"
+ status = 301
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/8.4.1.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/8.4.1.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/8.4.1.sw.cu1/"
+ to = "https://help-software-thoughtspot.netlify.app/software/8.4.1.sw/"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/8.8.1.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/8.8.1.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/9.0.0.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/9.0.0.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/9.0.1.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/9.0.1.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/9.5.0.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/9.5.0.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/9.5.1.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/9.5.1.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/9.8.0.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/9.8.0.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/9.11.0.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/9.11.0.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/10.0.0.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/10.0.0.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/10.0.1.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/10.0.1.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/10.5.0.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/10.5.0.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/10.5.1.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/10.5.1.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/10.11.0.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/10.11.0.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/11.0.1.sw/"
+ to = "https://help-software-thoughtspot.netlify.app/software/11.0.1.sw/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/10.3.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/10.3.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/10.2.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/10.2.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/10.1.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/10.1.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/10.0.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/10.0.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.12.5.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.12.5.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.12.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.12.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.10.5.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.10.5.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.10.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.10.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.9.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.9.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.8.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.8.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.7.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.7.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.6.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.6.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.5.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.4.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.4.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.4.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.3.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.3.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.2.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.2.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.1.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.1.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/9.0.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/9.0.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/8.10.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/8.10.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/8.9.0.cl/"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/8.9.0.cl/index_help"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+# Algolia pendo search test rewrite for cloud
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/cloud/*"
+ to = "https://help-cloud-thoughtspot.netlify.app/cloud/:splat"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+# Algolia pendo search test rewrite for cloud
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/software/*"
+ to = "https://help-software-thoughtspot.netlify.app/software/:splat"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+# Algolia pendo search test rewrite for cloud
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/sitemap-cloud.xml"
+ to = "https://help-cloud-thoughtspot.netlify.app/sitemap-cloud.xml"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+# Algolia pendo search test rewrite for sitemaps cloud
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/ghyer95y3/sitemap-software.xml"
+ to = "https://help-software-thoughtspot.netlify.app/sitemap-software.xml"
+ status = 200
+ force = true # COMMENT: ensure that we always redirect
+
+# Algolia pendo search test rewrite for sitemaps software
+
+# rewrites for help - end
+
+# confirmation email redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/latest/welcome-intro.html"
+ to = "https://docs.thoughtspot.com/software/latest/deployment-sw"
+ status = 301
+ force = true # COMMENT: ensure that we always redirect
+
+# redirect for EA custom sorting in 9.8.0.cl
+
+# [[redirects]]
+# from = "https://docs.thoughtspot.com/cloud/9.8.0.cl/customSorting"
+# to = "https://docs.thoughtspot.com/cloud/latest/worksheet-create"
+# status = 301
+# force = true # COMMENT: ensure that we always redirect
+
+# site-wide redirects
+
+# 8.10.0.cl uprade page to 8.9.0.cl (until customer cluster upgrade)
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/cloud/8.10.0.cl/upgrade"
+ to = "https://docs.thoughtspot.com/cloud/latest/upgrade"
+ status = 301
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/8.8.0.sw/*"
+ to = "https://la-docs.thoughtspot.com/software/8.8.0.sw/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 8.8.0.sw to LA docs site
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/9.8.0.sw/*"
+ to = "https://docs.thoughtspot.com/software/latest/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 9.8.0.sw to sw latest
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/9.5.0.sw.cu1/*"
+ to = "https://docs.thoughtspot.com/software/latest/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 9.5.0.sw.cu1 to sw latest
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/9.0.1.sw.cu1/*"
+ to = "https://docs.thoughtspot.com/software/9.0.1.sw/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 9.0.1.sw.cu1 to sw 9.0.1.sw
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/8.8.1.sw.cu1/*"
+ to = "https://docs.thoughtspot.com/software/8.8.1.sw/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 8.8.1.sw.cu1 to sw 8.8.1.sw
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/8.8.1.sw.CU1/*"
+ to = "https://docs.thoughtspot.com/software/8.8.1.sw/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 8.8.1.sw.CU1 to sw 8.8.1.sw
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/8.4.1.sw.cu1/*"
+ to = "https://docs.thoughtspot.com/software/8.4.1.sw/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 8.4.1.sw.cu1 to sw 8.4.1.sw
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/software/8.4.1.sw.CU1/*"
+ to = "https://docs.thoughtspot.com/software/8.4.1.sw/:splat"
+ status = 301
+ force = true # COMMENT: global redirect for 8.4.1.sw.CU1 to sw 8.4.1.sw
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/cloud/9.10.5.cl/*"
+ to = "https://docs.thoughtspot.com/cloud/latest/:splat"
+ status = 301
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/cloud/9.12.5.cl/*"
+ to = "https://docs.thoughtspot.com/cloud/latest/:splat"
+ status = 301
+ force = true # COMMENT: ensure that we always redirect
+
+[[redirects]]
+ from = "https://docs.thoughtspot.com/cloud/9.7.0.cl/*"
+ to = "https://docs.thoughtspot.com/cloud/latest/:splat"
+ status = 301
+ force = true # COMMENT: ensure that we always redirect
+
diff --git a/node_modules/.bin/antora b/node_modules/.bin/antora
deleted file mode 120000
index 2d813b0b..00000000
--- a/node_modules/.bin/antora
+++ /dev/null
@@ -1 +0,0 @@
-../@antora/cli/bin/antora
\ No newline at end of file
diff --git a/node_modules/.bin/crc32 b/node_modules/.bin/crc32
deleted file mode 120000
index 9f8b79c5..00000000
--- a/node_modules/.bin/crc32
+++ /dev/null
@@ -1 +0,0 @@
-../crc-32/bin/crc32.njs
\ No newline at end of file
diff --git a/node_modules/.bin/handlebars b/node_modules/.bin/handlebars
deleted file mode 120000
index fb7d090f..00000000
--- a/node_modules/.bin/handlebars
+++ /dev/null
@@ -1 +0,0 @@
-../handlebars/bin/handlebars
\ No newline at end of file
diff --git a/node_modules/.bin/isogit b/node_modules/.bin/isogit
deleted file mode 120000
index 25cb356a..00000000
--- a/node_modules/.bin/isogit
+++ /dev/null
@@ -1 +0,0 @@
-../isomorphic-git/cli.cjs
\ No newline at end of file
diff --git a/node_modules/.bin/js-yaml b/node_modules/.bin/js-yaml
deleted file mode 120000
index 9dbd010d..00000000
--- a/node_modules/.bin/js-yaml
+++ /dev/null
@@ -1 +0,0 @@
-../js-yaml/bin/js-yaml.js
\ No newline at end of file
diff --git a/node_modules/.bin/json5 b/node_modules/.bin/json5
deleted file mode 120000
index 217f3798..00000000
--- a/node_modules/.bin/json5
+++ /dev/null
@@ -1 +0,0 @@
-../json5/lib/cli.js
\ No newline at end of file
diff --git a/node_modules/.bin/pino b/node_modules/.bin/pino
deleted file mode 120000
index 9855bfce..00000000
--- a/node_modules/.bin/pino
+++ /dev/null
@@ -1 +0,0 @@
-../pino/bin.js
\ No newline at end of file
diff --git a/node_modules/.bin/pino-pretty b/node_modules/.bin/pino-pretty
deleted file mode 120000
index 8a5f3e70..00000000
--- a/node_modules/.bin/pino-pretty
+++ /dev/null
@@ -1 +0,0 @@
-../pino-pretty/bin.js
\ No newline at end of file
diff --git a/node_modules/.bin/printj b/node_modules/.bin/printj
deleted file mode 120000
index 2a58c10f..00000000
--- a/node_modules/.bin/printj
+++ /dev/null
@@ -1 +0,0 @@
-../printj/bin/printj.njs
\ No newline at end of file
diff --git a/node_modules/.bin/sha.js b/node_modules/.bin/sha.js
deleted file mode 120000
index 3c761051..00000000
--- a/node_modules/.bin/sha.js
+++ /dev/null
@@ -1 +0,0 @@
-../sha.js/bin.js
\ No newline at end of file
diff --git a/node_modules/.bin/uglifyjs b/node_modules/.bin/uglifyjs
deleted file mode 120000
index fef3468b..00000000
--- a/node_modules/.bin/uglifyjs
+++ /dev/null
@@ -1 +0,0 @@
-../uglify-js/bin/uglifyjs
\ No newline at end of file
diff --git a/node_modules/@antora/asciidoc-loader/LICENSE b/node_modules/@antora/asciidoc-loader/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/asciidoc-loader/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/asciidoc-loader/README.md b/node_modules/@antora/asciidoc-loader/README.md
deleted file mode 100644
index e7a74548..00000000
--- a/node_modules/@antora/asciidoc-loader/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Antora AsciiDoc Loader
-
-The AsciiDoc Loader is a reusable library for handling AsciiDoc content in Antora.
-It loads AsciiDoc content into an AsciiDoc Document object (AST) for use in an Antora documentation pipeline.
-
-The AsciiDoc loader wraps [Asciidoctor.js](https://asciidoctor.org/docs/asciidoctor.js/) and adds several extensions that enable AsciiDoc to work in an Antora environment.
-These extensions include:
-
-* An include processor that resolves files from the content catalog.
-* A cross reference converter that resolves references between pages based on Antora's page reference system.
-* Automatic resolution of paths to images and attachments.
-* Implicit document attributes that pass information from the Antora environment.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/asciidoc-loader/lib/constants.js b/node_modules/@antora/asciidoc-loader/lib/constants.js
deleted file mode 100644
index d3474f2c..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/constants.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-
-module.exports = Object.freeze({
- $Antora () {},
- EXAMPLES_DIR_TOKEN: 'example$',
- PARTIALS_DIR_TOKEN: 'partial$',
-})
diff --git a/node_modules/@antora/asciidoc-loader/lib/converter/create.js b/node_modules/@antora/asciidoc-loader/lib/converter/create.js
deleted file mode 100644
index ac6161ff..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/converter/create.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict'
-
-const convertImageRef = require('./../image/convert-image-ref')
-const convertPageRef = require('./../xref/convert-page-ref')
-const defineHtml5Converter = require('./html5')
-
-/**
- * Creates an HTML5 converter instance with Antora enhancements.
- *
- * @memberof asciidoc-loader
- *
- * @param {File} file - The virtual file whose contents is an AsciiDoc source document.
- * @param {ContentCatalog} contentCatalog - The catalog of all virtual content files in the site.
- * @param {Object} config - AsciiDoc processor configuration options.
- *
- * @returns {Converter} An enhanced instance of Asciidoctor's HTML5 converter.
- */
-function createConverter (file, contentCatalog, config) {
- const relativizePageRefs = config.relativizePageRefs !== false
- return defineHtml5Converter().$new('html5', undefined, {
- onImageRef: (resourceSpec) => convertImageRef(resourceSpec, file, contentCatalog),
- onPageRef: (pageSpec, content) => convertPageRef(pageSpec, content, file, contentCatalog, relativizePageRefs),
- })
-}
-
-module.exports = createConverter
diff --git a/node_modules/@antora/asciidoc-loader/lib/converter/html5.js b/node_modules/@antora/asciidoc-loader/lib/converter/html5.js
deleted file mode 100644
index 68764f29..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/converter/html5.js
+++ /dev/null
@@ -1,117 +0,0 @@
-'use strict'
-
-const Opal = global.Opal
-const { $Antora } = require('../constants')
-const $logger = Symbol('logger')
-const $imageRefCallback = Symbol('imageRefCallback')
-const $pageRefCallback = Symbol('pageRefCallback')
-const converterFor = Opal.Asciidoctor.Converter.$for.bind(Opal.Asciidoctor.Converter)
-
-let classDef
-
-const defineHtml5Converter = () => {
- const superclass = converterFor('html5')
- if (classDef) {
- if (classDef.$superclass() !== superclass) {
- Object.setPrototypeOf(classDef.$$prototype, (classDef.$$super = superclass).$$prototype)
- }
- return classDef
- }
-
- classDef = Opal.klass(Opal.Antora || Opal.module(null, 'Antora', $Antora), superclass, 'Html5Converter')
-
- Opal.defn(classDef, '$initialize', function initialize (backend, opts, callbacks) {
- Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), [backend, opts])
- this[$pageRefCallback] = callbacks.onPageRef
- this[$imageRefCallback] = callbacks.onImageRef
- })
-
- Opal.defn(classDef, '$convert_inline_anchor', function convertInlineAnchor (node) {
- if (node.getType() === 'xref') {
- let callback
- let refSpec =
- node.getAttribute('path', undefined, false) ||
- // NOTE detect and convert self reference into a page reference
- (node.target === '#' &&
- node.getText() == null &&
- node.getAttribute('refid', undefined, false) == null &&
- node.getDocument().getAttribute('page-relative-src-path'))
- if (refSpec && (callback = this[$pageRefCallback])) {
- const attrs = node.getAttributes()
- const fragment = attrs.fragment
- if (fragment) refSpec += '#' + fragment
- const { content, target, internal, unresolved } = callback(refSpec, node.getText())
- let type
- if (internal) {
- type = 'xref'
- attrs.path = undefined
- attrs.fragment = attrs.refid = fragment
- } else {
- type = 'link'
- if (unresolved) {
- const logger = this[$logger] || (this[$logger] = this.$logger())
- let msg = 'target of xref not found: ' + refSpec
- const loc = node.getParent().getSourceLocation()
- if (loc) msg = this.$message_with_context(msg, Opal.hash2(['source_location'], { source_location: loc }))
- logger.error(msg)
- attrs.role = `page unresolved${attrs.role ? ' ' + attrs.role : ''}`
- } else {
- attrs.role = `page${attrs.role ? ' ' + attrs.role : ''}`
- }
- }
- const attributes = Opal.hash2(Object.keys(attrs), attrs)
- const options = Opal.hash2(['type', 'target', 'attributes'], { type, target, attributes })
- node = Opal.Asciidoctor.Inline.$new(node.getParent(), 'anchor', content, options)
- }
- }
- return Opal.send(this, Opal.find_super_dispatcher(this, 'convert_inline_anchor', convertInlineAnchor), [node])
- })
-
- Opal.defn(classDef, '$convert_image', function convertImage (node) {
- return Opal.send(this, Opal.find_super_dispatcher(this, 'convert_image', convertImage), [
- transformImageNode(this, node, node.getAttribute('target')),
- ])
- })
-
- Opal.defn(classDef, '$convert_inline_image', function convertInlineImage (node) {
- return Opal.send(this, Opal.find_super_dispatcher(this, 'convert_inline_image', convertInlineImage), [
- transformImageNode(this, node, node.getTarget()),
- ])
- })
-
- return classDef
-}
-
-function transformImageNode (converter, node, imageTarget) {
- if (matchesResourceSpec(imageTarget)) {
- const imageRefCallback = converter[$imageRefCallback]
- if (imageRefCallback) {
- const alt = node.getAttribute('alt', undefined, false)
- if (node.isAttribute('default-alt', alt, false)) node.setAttribute('alt', alt.split(/[@:]/).pop())
- Opal.defs(node, '$image_uri', (imageSpec) => imageRefCallback(imageSpec) || imageSpec)
- }
- }
- if (node.hasAttribute('xref')) {
- const refSpec = node.getAttribute('xref', '', false)
- if (refSpec.charAt() === '#') {
- node.setAttribute('link', refSpec)
- } else if (refSpec.endsWith('.adoc') || ~refSpec.indexOf('.adoc#')) {
- const pageRefCallback = converter[$pageRefCallback]
- if (pageRefCallback) {
- const { target, unresolved } = pageRefCallback(refSpec, '[image]')
- const role = node.getAttribute('role', undefined, false)
- node.setAttribute('role', `link-page${unresolved ? ' link-unresolved' : ''}${role ? ' ' + role : ''}`)
- node.setAttribute('link', target)
- }
- } else {
- node.setAttribute('link', '#' + refSpec)
- }
- }
- return node
-}
-
-function matchesResourceSpec (target) {
- return !(~target.indexOf(':') && (~target.indexOf('://') || (target.startsWith('data:') && ~target.indexOf(','))))
-}
-
-module.exports = defineHtml5Converter
diff --git a/node_modules/@antora/asciidoc-loader/lib/create-extension-registry.js b/node_modules/@antora/asciidoc-loader/lib/create-extension-registry.js
deleted file mode 100644
index e6a5e0b4..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/create-extension-registry.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict'
-
-const IncludeProcessor = require('./include/include-processor')
-
-/**
- * Creates an extension registry instance that provides extensions to integrate AsciiDoc into Antora.
- *
- * This registry includes a built-in include processor that resolves the target of include directives
- * to files in Antora's virtual content catalog.
- *
- * @memberof asciidoc-loader
- *
- * @param {Asciidoctor} asciidoctor - Asciidoctor API.
- * @param {Object} callbacks - Callback functions.
- * @param {Function} callbacks.onInclude - A function that resolves the target of an include.
- *
- * @returns {Registry} An instance of Asciidoctor's extension registry.
- */
-function createExtensionRegistry (asciidoctor, callbacks) {
- const registry = asciidoctor.Extensions.create()
- registry.includeProcessor(IncludeProcessor.$new(callbacks.onInclude))
- return registry
-}
-
-module.exports = createExtensionRegistry
diff --git a/node_modules/@antora/asciidoc-loader/lib/image/convert-image-ref.js b/node_modules/@antora/asciidoc-loader/lib/image/convert-image-ref.js
deleted file mode 100644
index 99959658..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/image/convert-image-ref.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-const computeRelativeUrlPath = require('../util/compute-relative-url-path')
-
-function convertImageRef (resourceSpec, currentPage, contentCatalog) {
- const image = contentCatalog.resolveResource(resourceSpec, currentPage.src, 'image', ['image'])
- if (image) return computeRelativeUrlPath(currentPage.pub.url, image.pub.url)
-}
-
-module.exports = convertImageRef
diff --git a/node_modules/@antora/asciidoc-loader/lib/include/include-processor.js b/node_modules/@antora/asciidoc-loader/lib/include/include-processor.js
deleted file mode 100644
index 7160e4e6..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/include/include-processor.js
+++ /dev/null
@@ -1,262 +0,0 @@
-'use strict'
-
-const Opal = global.Opal
-
-const { $Antora } = require('../constants')
-const DBL_COLON = '::'
-const DBL_SQUARE = '[]'
-const NEWLINE_RX = /\r\n?|\n/
-const TAG_DIRECTIVE_RX = /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m
-
-const IncludeProcessor = (() => {
- const $callback = Symbol('callback')
- const classDef = Opal.klass(
- Opal.Antora || Opal.module(null, 'Antora', $Antora),
- Opal.Asciidoctor.Extensions.IncludeProcessor,
- 'IncludeProcessor'
- )
-
- Opal.defn(classDef, '$initialize', function initialize (callback) {
- Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize))
- this[$callback] = callback
- })
-
- Opal.defn(classDef, '$process', function (doc, reader, target, attrs) {
- if (reader.maxdepth === Opal.nil) return
- const sourceCursor = reader.$cursor_at_prev_line()
- if (reader.$include_depth() >= Opal.hash_get(reader.maxdepth, 'curr')) {
- log('error', `maximum include depth of ${Opal.hash_get(reader.maxdepth, 'rel')} exceeded`, reader, sourceCursor)
- return
- }
- const resolvedFile = this[$callback](doc, target, sourceCursor)
- if (resolvedFile) {
- let includeContents
- let linenums
- let tags
- let startLineNum
- if ((linenums = getLines(attrs))) {
- ;[includeContents, startLineNum] = filterLinesByLineNumbers(reader, target, resolvedFile, linenums)
- } else if ((tags = getTags(attrs))) {
- ;[includeContents, startLineNum] = filterLinesByTags(reader, target, resolvedFile, tags, sourceCursor)
- } else {
- includeContents = resolvedFile.contents
- startLineNum = 1
- }
- Opal.hash_put(attrs, 'partial-option', '')
- // eslint-disable-next-line no-new-wrappers
- const file = Object.assign(new String(resolvedFile.file), {
- src: resolvedFile.src,
- parent: { file: reader.file, lineno: reader.lineno - 1 },
- })
- reader.pushInclude(includeContents, file, resolvedFile.path, startLineNum, attrs)
- } else {
- if (attrs['$key?']('optional-option')) {
- log('info', `optional include dropped because include file not found: ${target}`, reader, sourceCursor)
- } else {
- log('error', `target of include not found: ${target}`, reader, sourceCursor)
- reader.$unshift(`Unresolved include directive in ${sourceCursor.file} - include::${target}[]`)
- }
- }
- })
-
- return classDef
-})()
-
-function getLines (attrs) {
- if (attrs['$key?']('lines')) {
- const lines = attrs['$[]']('lines')
- if (lines) {
- const linenums = []
- let filtered
- ;(~lines.indexOf(',') ? lines.split(',') : lines.split(';'))
- .filter((it) => it)
- .forEach((linedef) => {
- filtered = true
- let delim
- let from
- if (~(delim = linedef.indexOf('..'))) {
- from = linedef.substr(0, delim)
- let to = linedef.substr(delim + 2)
- if ((to = parseInt(to, 10) || -1) > 0) {
- if ((from = parseInt(from, 10) || -1) > 0) {
- for (let i = from; i <= to; i++) linenums.push(i)
- }
- } else if (to === -1 && (from = parseInt(from, 10) || -1) > 0) {
- linenums.push(from, Infinity)
- }
- } else if ((from = parseInt(linedef, 10) || -1) > 0) {
- linenums.push(from)
- }
- })
- if (linenums.length) return [...new Set(linenums.sort((a, b) => a - b))]
- if (filtered) return []
- }
- }
-}
-
-function getTags (attrs) {
- if (attrs['$key?']('tag')) {
- const tag = attrs['$[]']('tag')
- if (tag && tag !== '!') {
- return tag.charAt() === '!' ? new Map().set(tag.substr(1), false) : new Map().set(tag, true)
- }
- } else if (attrs['$key?']('tags')) {
- const tags = attrs['$[]']('tags')
- if (tags) {
- const result = new Map()
- let any = false
- tags.split(~tags.indexOf(',') ? ',' : ';').forEach((tag) => {
- if (tag && tag !== '!') {
- any = true
- tag.charAt() === '!' ? result.set(tag.substr(1), false) : result.set(tag, true)
- }
- })
- if (any) return result
- }
- }
-}
-
-function filterLinesByLineNumbers (reader, target, file, linenums) {
- let lineNum = 0
- let startLineNum
- let selectRest
- const lines = []
- file.contents.split(NEWLINE_RX).some((line) => {
- lineNum++
- if (selectRest || (selectRest = linenums[0] === Infinity)) {
- if (!startLineNum) startLineNum = lineNum
- lines.push(line)
- } else {
- if (linenums[0] === lineNum) {
- if (!startLineNum) startLineNum = lineNum
- linenums.shift()
- lines.push(line)
- }
- if (!linenums.length) return true
- }
- })
- return [lines, startLineNum || 1]
-}
-
-function filterLinesByTags (reader, target, file, tags, sourceCursor) {
- let selectingDefault, selecting, wildcard
- const globstar = tags.get('**')
- const star = tags.get('*')
- if (globstar === undefined) {
- if (star === undefined) {
- selectingDefault = selecting = !mapContainsValue(tags, true)
- } else {
- if ((wildcard = star) || tags.keys().next().value !== '*') {
- selectingDefault = selecting = false
- } else {
- selectingDefault = selecting = !wildcard
- }
- tags.delete('*')
- }
- } else {
- tags.delete('**')
- selectingDefault = selecting = globstar
- if (star === undefined) {
- if (!globstar && tags.values().next().value === false) wildcard = true
- } else {
- tags.delete('*')
- wildcard = star
- }
- }
-
- const lines = []
- const tagStack = []
- const foundTags = []
- let activeTag
- let lineNum = 0
- let startLineNum
- file.contents.split(NEWLINE_RX).forEach((line) => {
- lineNum++
- let m
- if (~line.indexOf(DBL_COLON) && ~line.indexOf(DBL_SQUARE) && (m = line.match(TAG_DIRECTIVE_RX))) {
- const thisTag = m[2]
- if (m[1]) {
- if (thisTag === activeTag) {
- tagStack.shift()
- ;[activeTag, selecting] = tagStack.length ? tagStack[0] : [undefined, selectingDefault]
- } else if (tags.has(thisTag)) {
- const idx = tagStack.findIndex(([name]) => name === thisTag)
- if (~idx) {
- tagStack.splice(idx, 1)
- log(
- 'warn',
- `mismatched end tag (expected '${activeTag}' but found '${thisTag}') ` +
- `at line ${lineNum} of include file: ${file.file})`,
- reader,
- sourceCursor,
- createIncludeCursor(reader, file, target, lineNum)
- )
- } else {
- log(
- 'warn',
- `unexpected end tag '${thisTag}' at line ${lineNum} of include file: ${file.file}`,
- reader,
- sourceCursor,
- createIncludeCursor(reader, file, target, lineNum)
- )
- }
- }
- } else if (tags.has(thisTag)) {
- foundTags.push(thisTag)
- tagStack.unshift([(activeTag = thisTag), (selecting = tags.get(thisTag)), lineNum])
- } else if (wildcard !== undefined) {
- selecting = activeTag && !selecting ? false : wildcard
- tagStack.unshift([(activeTag = thisTag), selecting, lineNum])
- }
- } else if (selecting) {
- if (!startLineNum) startLineNum = lineNum
- lines.push(line)
- }
- })
- if (tagStack.length) {
- tagStack.forEach(([tagName, _, tagLineNum]) =>
- log(
- 'warn',
- `detected unclosed tag '${tagName}' starting at line ${tagLineNum} of include file: ${file.file}`,
- reader,
- sourceCursor,
- createIncludeCursor(reader, file, target, tagLineNum)
- )
- )
- }
- if (foundTags.length) foundTags.forEach((name) => tags.delete(name))
- if (tags.size) {
- log(
- 'warn',
- `tag${tags.size > 1 ? 's' : ''} '${[...tags.keys()].join(', ')}' not found in include file: ${file.file}`,
- reader,
- sourceCursor,
- createIncludeCursor(reader, file, target, 0)
- )
- }
- return [lines, startLineNum || 1]
-}
-
-function createIncludeCursor (reader, { file, src }, path, lineno) {
- return reader.$create_include_cursor(
- // eslint-disable-next-line no-new-wrappers
- Object.assign(new String(file), { src, parent: { file: reader.file, lineno: reader.lineno - 1 } }),
- path,
- lineno
- )
-}
-
-function log (severity, message, reader, sourceCursor, includeCursor = undefined) {
- const opts = includeCursor
- ? { source_location: sourceCursor, include_location: includeCursor }
- : { source_location: sourceCursor }
- reader.$logger()['$' + severity](reader.$message_with_context(message, Opal.hash(opts)))
-}
-
-function mapContainsValue (map, value) {
- for (const v of map.values()) {
- if (v === value) return true
- }
-}
-
-module.exports = IncludeProcessor
diff --git a/node_modules/@antora/asciidoc-loader/lib/include/resolve-include-file.js b/node_modules/@antora/asciidoc-loader/lib/include/resolve-include-file.js
deleted file mode 100644
index 634b17c6..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/include/resolve-include-file.js
+++ /dev/null
@@ -1,68 +0,0 @@
-'use strict'
-
-const { posix: path } = require('path')
-const splitOnce = require('../util/split-once')
-
-const { EXAMPLES_DIR_TOKEN, PARTIALS_DIR_TOKEN } = require('../constants')
-const RESOURCE_ID_DETECTOR_RX = /[$:@]/
-
-/**
- * Resolves the specified target of an include directive to a virtual file in the content catalog.
- *
- * @memberof asciidoc-loader
- *
- * @param {String} target - The target of the include directive to resolve.
- * @param {File} page - The outermost virtual file from which the include originated (not
- * necessarily the current file).
- * @param {Cursor} cursor - The cursor of the reader for file that contains the include directive.
- * @param {ContentCatalog} catalog - The content catalog that contains the virtual files in the site.
- * @returns {Object} A map containing the file, path, and contents of the resolved file.
- */
-function resolveIncludeFile (target, page, cursor, catalog) {
- const src = (cursor.file || {}).src || page.src
- let resolved
- let family
- let relative
- // @deprecated interpret non-URL target as resource ID starting in Antora 4
- if (RESOURCE_ID_DETECTOR_RX.test(target)) {
- // NOTE support legacy {partialsdir} and {examplesdir} prefixes (same as resource ID w/ only family and relative)
- if (target.startsWith(PARTIALS_DIR_TOKEN) || target.startsWith(EXAMPLES_DIR_TOKEN)) {
- ;[family, relative] = splitOnce(target, '$')
- if (relative.charAt() === '/') relative = relative.substr(1)
- resolved = catalog.getById({
- component: src.component,
- version: src.version,
- module: src.module,
- family,
- relative,
- })
- // NOTE require family segment for now
- } else if (~target.indexOf('$')) {
- resolved = catalog.resolveResource(target, extractResourceId(src))
- }
- } else {
- resolved = catalog.getByPath({
- component: src.component,
- version: src.version,
- // QUESTION does cursor.dir always contain the value we expect?
- path: path.join(cursor.dir.toString(), target),
- })
- }
- if (resolved) {
- const resolvedSrc = resolved.src
- return {
- src: resolvedSrc,
- file: resolvedSrc.path,
- path: resolvedSrc.basename,
- // NOTE src.contents holds AsciiDoc source for page marked as a partial
- // QUESTION should we only use src.contents if family is 'page' and mediaType is 'text/asciidoc'?
- contents: (resolvedSrc.contents || resolved.contents || '').toString(),
- }
- }
-}
-
-function extractResourceId ({ component, version, module: module_, family, relative }) {
- return { component, version, module: module_, family, relative }
-}
-
-module.exports = resolveIncludeFile
diff --git a/node_modules/@antora/asciidoc-loader/lib/index.js b/node_modules/@antora/asciidoc-loader/lib/index.js
deleted file mode 100644
index 7913979e..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-
-/**
- * AsciiDoc Loader component for Antora
- *
- * Uses Asciidoctor.js to load AsciiDoc content in a way that integrates tightly
- * with the Antora environment. It resolves include files, page references, and
- * image references to files in Antora's virtual content catalog.
- *
- * @namespace asciidoc-loader
- */
-module.exports = require('./load-asciidoc')
diff --git a/node_modules/@antora/asciidoc-loader/lib/load-asciidoc.js b/node_modules/@antora/asciidoc-loader/lib/load-asciidoc.js
deleted file mode 100644
index c3627ffa..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/load-asciidoc.js
+++ /dev/null
@@ -1,212 +0,0 @@
-'use strict'
-
-const asciidoctor = require('@asciidoctor/core')()
-const Opal = global.Opal
-const Extensions = asciidoctor.Extensions
-const createConverter = require('./converter/create')
-const createExtensionRegistry = require('./create-extension-registry')
-const LoggerAdapter = require('./logger/adapter')
-const ospath = require('path')
-const { posix: path } = ospath
-const resolveIncludeFile = require('./include/resolve-include-file')
-
-const BLANK_LINE_BUF = Buffer.from('\n\n')
-const DOCTITLE_MARKER_BUF = Buffer.from('= ')
-const DOT_RELATIVE_RX = new RegExp(`^\\.{1,2}[/${ospath.sep.replace('/', '').replace('\\', '\\\\')}]`)
-const { EXAMPLES_DIR_TOKEN, PARTIALS_DIR_TOKEN } = require('./constants')
-const EXTENSION_DSL_TYPES = Extensions.$constants(false).filter((name) => name.endsWith('Dsl'))
-
-/**
- * Loads the AsciiDoc source from the specified file into a Document object.
- *
- * Uses the Asciidoctor.js load API to parse the source of the file into an Asciidoctor Document object. Sets options
- * and attributes that provide integration with the Antora environment. Options include a custom converter and extension
- * registry to handle page references and include directives, respectively. It also assigns attributes that provide
- * context either for the author (e.g., env=site) or pipeline (e.g., docfile).
- *
- * @memberof asciidoc-loader
- *
- * @param {File} file - The virtual file whose contents is an AsciiDoc source document.
- * @param {ContentCatalog} [contentCatalog=undefined] - The catalog of all virtual content files in the site.
- * @param {Object} [config={}] - AsciiDoc processor configuration options.
- * @param {Object} [config.attributes={}] - Shared AsciiDoc attributes to assign to the document.
- * @param {Array
} [config.extensions=[]] - Self-registering AsciiDoc processor extension functions.
- * @param {Boolean} [config.relativizePageRefs=true] - Configures the AsciiDoc processor to generate relative page
- * references (relative to the current page) instead of root relative (relative to the site root).
- *
- * @returns {Document} An Asciidoctor Document object created from the source of the specified file.
- */
-function loadAsciiDoc (file, contentCatalog = undefined, config = {}) {
- const { family, relative, extname = path.extname(relative) } = file.src
- const intrinsicAttrs = {
- docname: (family === 'nav' ? 'nav$' : '') + relative.substr(0, relative.length - extname.length),
- docfile: file.path,
- // NOTE docdir implicitly sets base_dir on document; Opal only expands value to absolute path if it starts with ./
- docdir: file.dirname,
- docfilesuffix: extname,
- imagesdir: path.join(file.pub.moduleRootPath, '_images'),
- attachmentsdir: path.join(file.pub.moduleRootPath, '_attachments'),
- examplesdir: EXAMPLES_DIR_TOKEN,
- partialsdir: PARTIALS_DIR_TOKEN,
- }
- const attributes = Object.assign(
- family === 'page' ? { 'page-partial': '@' } : {},
- config.attributes,
- intrinsicAttrs,
- computePageAttrs(file.src, contentCatalog)
- )
- const extensionRegistry = createExtensionRegistry(asciidoctor, {
- onInclude: contentCatalog
- ? (doc, target, cursor) => resolveIncludeFile(target, file, cursor, contentCatalog)
- : () => undefined,
- })
- const extensions = config.extensions || []
- if (extensions.length) extensions.forEach((ext) => ext.register(extensionRegistry, { file, contentCatalog, config }))
- const loggerAdapter = LoggerAdapter.logger.noop ? false : LoggerAdapter.$new(file.src)
- const opts = { attributes, extension_registry: extensionRegistry, safe: 'safe', logger: loggerAdapter }
- if (config.doctype) opts.doctype = config.doctype
- if (config.sourcemap) opts.sourcemap = true
- let contents = file.contents
- if (config.headerOnly) {
- opts.parse_header_only = true
- const firstBlankLineIdx = contents.indexOf(BLANK_LINE_BUF)
- if (~firstBlankLineIdx) {
- const partialContents = contents.slice(0, firstBlankLineIdx)
- const doctitleIdx = partialContents.indexOf(DOCTITLE_MARKER_BUF)
- if (!doctitleIdx || partialContents[doctitleIdx - 1] === 10) contents = partialContents
- }
- } else if (contentCatalog) {
- attributes.relfilesuffix = '.adoc' // NOTE relfilesuffix must be set for page-to-page xrefs to work correctly
- opts.converter = createConverter(file, contentCatalog, config)
- }
- const doc = asciidoctor.load(contents.toString(), opts)
- if (extensions.length) freeExtensions()
- return doc
-}
-
-// QUESTION should we soft set the page-id attribute?
-function computePageAttrs ({ component: componentName, version, module: module_, relative, origin }, contentCatalog) {
- const attrs = {}
- attrs['page-component-name'] = componentName
- attrs['page-component-version'] = attrs['page-version'] = version
- const component = contentCatalog && contentCatalog.getComponent(componentName)
- if (component) {
- const componentVersion = component.versions.find((it) => it.version === version)
- if (componentVersion) attrs['page-component-display-version'] = componentVersion.displayVersion
- attrs['page-component-title'] = component.title
- }
- attrs['page-module'] = module_
- attrs['page-relative-src-path'] = relative
- if (origin) {
- attrs['page-origin-type'] = origin.type
- attrs['page-origin-url'] = origin.url
- attrs['page-origin-start-path'] = origin.startPath
- if (origin.branch) {
- attrs['page-origin-refname'] = attrs['page-origin-branch'] = origin.branch
- attrs['page-origin-reftype'] = 'branch'
- } else {
- attrs['page-origin-refname'] = attrs['page-origin-tag'] = origin.tag
- attrs['page-origin-reftype'] = 'tag'
- }
- if (origin.worktree) {
- attrs['page-origin-worktree'] = origin.worktree
- attrs['page-origin-refhash'] = '(worktree)'
- } else {
- attrs['page-origin-refhash'] = origin.refhash
- }
- }
- return attrs
-}
-
-function extractAsciiDocMetadata (doc) {
- const metadata = { attributes: doc.getAttributes() }
- if (doc.hasHeader()) {
- const doctitle = (metadata.doctitle = doc.getDocumentTitle())
- const xreftext = (metadata.xreftext = doc.$reftext().$to_s() || doctitle)
- const navtitle = doc.getAttribute('navtitle')
- metadata.navtitle = navtitle ? doc.$apply_reftext_subs(navtitle) : xreftext
- }
- return metadata
-}
-
-/**
- * Resolves a global AsciiDoc configuration object from data in the playbook.
- *
- * Reads data from the asciidoc category of the playbook and resolves it into a global AsciiDoc configuration object
- * that can be used by the loadAsciiDoc function. This configuration object consists of built-in attributes as well as a
- * shallow clone of the data from the asciidoc category in the playbook.
- *
- * The main purpose of this function is to resolve extension references in the playbook to extension
- * functions. If the extension is scoped, the function is stored in this object. If the extension is global, it is
- * registered with the global extension registry, then discarded.
- *
- * @memberof asciidoc-loader
- *
- * @param {Object} playbook - The configuration object for Antora (default: {}).
- * @param {Object} playbook.asciidoc - The AsciiDoc configuration data in the playbook.
- *
- * @returns {Object} A resolved configuration object to be used by the loadAsciiDoc function.
- */
-function resolveAsciiDocConfig (playbook = {}) {
- const attributes = {
- env: 'site',
- 'env-site': '',
- 'site-gen': 'antora',
- 'site-gen-antora': '',
- 'attribute-missing': 'warn',
- 'data-uri': null,
- icons: 'font',
- sectanchors: '',
- 'source-highlighter': 'highlight.js',
- }
- if (playbook.site) {
- const site = playbook.site
- if (site.title) attributes['site-title'] = site.title
- if (site.url) attributes['site-url'] = site.url
- }
- if (!playbook.asciidoc) return { attributes }
- // TODO process !name attributes
- const { extensions, ...config } = Object.assign({ attributes }, playbook.asciidoc, {
- attributes: Object.assign(attributes, playbook.asciidoc.attributes),
- })
- if (extensions && extensions.length) {
- const scopedExtensions = extensions.reduce((accum, extensionPath) => {
- if (extensionPath.charAt() === '.' && DOT_RELATIVE_RX.test(extensionPath)) {
- // NOTE require resolves a dot-relative path relative to current file; resolve relative to playbook dir instead
- extensionPath = ospath.resolve(playbook.dir || '.', extensionPath)
- } else if (!ospath.isAbsolute(extensionPath)) {
- // NOTE appending node_modules prevents require from looking elsewhere before looking in these paths
- const paths = [playbook.dir || '.', ospath.dirname(__dirname)].map((root) => ospath.join(root, 'node_modules'))
- extensionPath = require.resolve(extensionPath, { paths })
- }
- const extension = require(extensionPath)
- if ('register' in extension) {
- accum.push(extension)
- } else if (!isExtensionRegistered(extension, Extensions)) {
- // QUESTION should we assign an antora-specific group name?
- Extensions.register(extension)
- }
- return accum
- }, [])
- if (scopedExtensions.length) config.extensions = scopedExtensions
- }
- return config
-}
-
-function isExtensionRegistered (ext, registry) {
- return Object.values(registry.getGroups()).includes(ext)
-}
-
-/**
- * Low-level operation to free objects from memory that have been weaved into an extension DSL module
- */
-function freeExtensions () {
- EXTENSION_DSL_TYPES.forEach((type) => (Opal.const_get_local(Extensions, type).$$iclasses.length = 0))
-}
-
-module.exports = Object.assign(loadAsciiDoc, {
- loadAsciiDoc,
- extractAsciiDocMetadata,
- resolveAsciiDocConfig,
- resolveConfig: resolveAsciiDocConfig, // @deprecated scheduled to be removed in Antora 4
-})
diff --git a/node_modules/@antora/asciidoc-loader/lib/logger/adapter.js b/node_modules/@antora/asciidoc-loader/lib/logger/adapter.js
deleted file mode 100644
index c1b8c315..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/logger/adapter.js
+++ /dev/null
@@ -1,87 +0,0 @@
-'use strict'
-
-const Opal = global.Opal
-const logger = require('@antora/logger')('asciidoctor')
-
-const { $Antora } = require('../constants')
-
-const LoggerAdapter = (() => {
- const classDef = Opal.klass(Opal.Antora || Opal.module(null, 'Antora', $Antora), Opal.Logger, 'LoggerAdapter')
-
- const severityMap = ((Severity) =>
- new Map(
- Severity.$constants().reduce(
- (accum, name) => {
- const lowerName = name.toLowerCase()
- if (lowerName === 'unknown') return accum
- const val = Severity[name]
- return accum.concat([
- [lowerName, val],
- [val, lowerName],
- ])
- },
- [
- ['silent', Infinity],
- [Infinity, 'silent'],
- ]
- )
- ))(classDef.$superclass().Severity)
-
- Opal.defn(classDef, '$initialize', function initialize (context) {
- Opal.send(this, Opal.find_super_dispatcher(this, 'initialize', initialize), [Opal.nil])
- const delegate = logger.unwrap()
- this.level = severityMap.get(delegate.level) || severityMap.get('info')
- this.failureLevel = severityMap.get(delegate.failureLevel) || Infinity
- this.context = context
- this.delegate = delegate
- })
-
- Opal.defn(classDef, '$add', function add (severity, message, progname) {
- if (severity < this.level) {
- if (severity >= this.failureLevel) this.delegate.setFailOnExit()
- return true
- }
- if (message === Opal.nil) {
- const block = add.$$p
- if (block) {
- message = block()
- add.$$p = null
- } else {
- message = progname
- }
- }
- if (message.$$is_hash) message = Object.assign({}, message.$$smap)
- const logMethod = severityMap.get(severity) || 'info'
- const logObject = { file: this.context }
- if (message.text != null) {
- let loc
- if ((loc = message.include_location)) {
- message = message.text.replace(/ (of|in) include file: .+/, ' $1 include file')
- } else {
- loc = message.source_location
- message = message.text
- }
- if (loc) {
- const file = loc.file
- if (file.src) {
- logObject.file = file.src
- logObject.line = loc.lineno || undefined
- const stack = (logObject.stack = [])
- let ancestor = { file }
- while ((ancestor = ancestor.file.parent)) {
- stack.push({ file: ancestor.file.src || this.context, line: ancestor.lineno })
- }
- //if (stack.length > 10) stack.splice(0, stack.length - 10)
- } else {
- logObject.line = loc.lineno
- }
- }
- }
- this.delegate[logMethod](logObject, message)
- return true
- })
-
- return classDef
-})()
-
-module.exports = Object.assign(LoggerAdapter, { logger })
diff --git a/node_modules/@antora/asciidoc-loader/lib/util/compute-relative-url-path.js b/node_modules/@antora/asciidoc-loader/lib/util/compute-relative-url-path.js
deleted file mode 100644
index 74ab7934..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/util/compute-relative-url-path.js
+++ /dev/null
@@ -1,34 +0,0 @@
-'use strict'
-
-const { posix: path } = require('path')
-
-/**
- * Computes the shortest relative path between two URLs.
- *
- * This function takes into account directory index URLs and extensionless
- * URLs. It assumes it's working with root-relative URLs, not qualified URLs
- * with potentially different hosts.
- *
- * @memberof asciidoc-loader
- *
- * @param {String} from - The root-relative start URL.
- * @param {String} to - The root-relative target URL.
- * @param {String} [hash=''] - The URL hash to append to the URL (not #).
- *
- * @returns {String} The shortest relative path to travel from the start URL to the target URL.
- */
-function computeRelativeUrlPath (from, to, hash = '') {
- if (to.charAt() === '/') {
- return to === from
- ? hash || (isDir(to) ? './' : path.basename(to))
- : (path.relative(path.dirname(from + '.'), to) || '.') + (isDir(to) ? '/' + hash : hash)
- } else {
- return to + hash
- }
-}
-
-function isDir (str) {
- return str.charAt(str.length - 1) === '/'
-}
-
-module.exports = computeRelativeUrlPath
diff --git a/node_modules/@antora/asciidoc-loader/lib/util/split-once.js b/node_modules/@antora/asciidoc-loader/lib/util/split-once.js
deleted file mode 100644
index 18dd5a3e..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/util/split-once.js
+++ /dev/null
@@ -1,18 +0,0 @@
-'use strict'
-
-/**
- * Splits the specified string at the first occurrence of the specified separator.
- *
- * @memberof asciidoc-loader
- *
- * @param {String} string - The string to split.
- * @param {String} separator - A single character on which to split the string.
- * @returns {String[]} A 2-element Array that contains the string before and after the separator, if
- * the separator is found, otherwise a single-element Array that contains the original string.
- */
-function splitOnce (string, separator) {
- const separatorIdx = string.indexOf(separator)
- return ~separatorIdx ? [string.substr(0, separatorIdx), string.substr(separatorIdx + 1)] : [string]
-}
-
-module.exports = splitOnce
diff --git a/node_modules/@antora/asciidoc-loader/lib/xref/convert-page-ref.js b/node_modules/@antora/asciidoc-loader/lib/xref/convert-page-ref.js
deleted file mode 100644
index c76d5e44..00000000
--- a/node_modules/@antora/asciidoc-loader/lib/xref/convert-page-ref.js
+++ /dev/null
@@ -1,60 +0,0 @@
-'use strict'
-
-const computeRelativeUrlPath = require('../util/compute-relative-url-path')
-
-/**
- * Converts the specified page reference to the data necessary to build an HTML link.
- *
- * Parses the page reference (page ID and optional fragment), resolves the corresponding file from
- * the content catalog, then grabs its publication (root-relative) path. If the relativize param is
- * true, transforms the root-relative path to a relative path from the current page to the target
- * page. Uses the resulting path to create the href for an HTML link that points to the published
- * target page.
- *
- * @memberof asciidoc-loader
- *
- * @param {String} refSpec - The target of a page xref macro, which is a page ID spec with an optional
- * fragment identifier.
- * @param {String} content - The content (i.e., formatted text) of the link (undefined if not specified).
- * @param {File} currentPage - The virtual file for the current page, which serves as the context.
- * @param {ContentCatalog} contentCatalog - The content catalog that contains the virtual files in the site.
- * @param {Boolean} [relativize=true] - Compute the target relative to the current page.
- * @returns {Object} A map ({ content, target, internal, unresolved }) containing the resolved
- * content and target to make an HTML link, and hints to indicate if the reference is either
- * internal or unresolved.
- */
-function convertPageRef (refSpec, content, currentPage, contentCatalog, relativize = true) {
- let pageSpec
- let hash
- let target
- let targetPage
- if (~(hash = refSpec.indexOf('#'))) {
- pageSpec = refSpec.substr(0, hash)
- hash = refSpec.substr(hash)
- } else {
- pageSpec = refSpec
- hash = ''
- }
- if (!((targetPage = contentCatalog.resolvePage(pageSpec, currentPage.src)) && targetPage.pub)) {
- return { content: content || refSpec, target: '#' + refSpec, unresolved: true }
- }
- if (relativize) {
- target = computeRelativeUrlPath(currentPage.pub.url, targetPage.pub.url, hash)
- if (target === hash) return { content, target, internal: true }
- } else {
- target = targetPage.pub.url + hash
- }
- if (!content) {
- if (hash) {
- content = pageSpec + hash
- } else {
- content =
- (currentPage.src.family === 'nav'
- ? (targetPage.asciidoc || {}).navtitle
- : (targetPage.asciidoc || {}).xreftext) || pageSpec
- }
- }
- return { content, target }
-}
-
-module.exports = convertPageRef
diff --git a/node_modules/@antora/asciidoc-loader/package.json b/node_modules/@antora/asciidoc-loader/package.json
deleted file mode 100644
index 7a721b95..00000000
--- a/node_modules/@antora/asciidoc-loader/package.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "_from": "@antora/asciidoc-loader@3.0.0-alpha.7",
- "_id": "@antora/asciidoc-loader@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-PyHNhwQ+4cfB9TrWrIJnxfOGiGmwFnSuZlLqLEe99rnIl2TY6IG8E8pbcak5TzqOM8HJoGtGIx52yZ2hF7a+rw==",
- "_location": "/@antora/asciidoc-loader",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/asciidoc-loader@3.0.0-alpha.7",
- "name": "@antora/asciidoc-loader",
- "escapedName": "@antora%2fasciidoc-loader",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/document-converter",
- "/@antora/navigation-builder",
- "/@antora/redirect-producer",
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/asciidoc-loader/-/asciidoc-loader-3.0.0-alpha.7.tgz",
- "_shasum": "ae7486607d4d9a304a03696f88e856596a916a43",
- "_spec": "@antora/asciidoc-loader@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- },
- {
- "name": "Guillaume Grossetie",
- "email": "g.grossetie@gmail.com"
- },
- {
- "name": "David Jencks",
- "email": "djencks@apache.org"
- }
- ],
- "dependencies": {
- "@antora/logger": "3.0.0-alpha.7",
- "@asciidoctor/core": "~2.2"
- },
- "deprecated": false,
- "description": "Loads AsciiDoc content into an Asciidoctor Document object (AST) for use in an Antora documentation pipeline.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "asciidoc",
- "asciidoctor",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/asciidoc-loader",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/cli/LICENSE b/node_modules/@antora/cli/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/cli/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/cli/README.md b/node_modules/@antora/cli/README.md
deleted file mode 100644
index c959629e..00000000
--- a/node_modules/@antora/cli/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-# Antora CLI
-
-The command line interface (CLI) for Antora.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-To run Antora, you need both the CLI and a site generator pipeline.
-Once these packages are installed, you can use the `antora` command to generate your site.
-
-## How to Install
-
-Let's start by installing the CLI.
-
-```sh
-npm install -g @antora/cli
-```
-
-This package adds the `antora` command to your PATH.
-You can check by running:
-
-```sh
-antora -v
-```
-
-Next, install a site generator.
-The default site generator will be sufficient for most users.
-
-```sh
-npm install -g @antora/site-generator-default
-```
-
-The `antora` command (specifically the implicit `generate` subcommand) will look for this package by default.
-
-## How to Use
-
-To run Antora, you'll need a playbook file and at least one content (source) repository.
-Consult the [quickstart](https://docs.antora.org/antora/latest/install-and-run-quickstart/) to find an example.
-
-Once you have your content sources set up, just point the `antora` command at your playbook file:
-
-```sh
-antora antora-playbook.yml
-```
-
-The `antora` command will output the generated site to the _build/site_ folder by default.
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/cli/bin/antora b/node_modules/@antora/cli/bin/antora
deleted file mode 100755
index 0152346a..00000000
--- a/node_modules/@antora/cli/bin/antora
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/usr/bin/env node
-
-'use strict'
-
-require('..')()
diff --git a/node_modules/@antora/cli/lib/cli.js b/node_modules/@antora/cli/lib/cli.js
deleted file mode 100644
index b836343b..00000000
--- a/node_modules/@antora/cli/lib/cli.js
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/bin/env node
-
-'use strict'
-
-const cli = require('./commander')
-// Q: can we ask the playbook builder for the config schema?
-const configSchema = require('@antora/playbook-builder/lib/config/schema')
-const convict = require('@antora/playbook-builder/lib/solitary-convict')
-const { finalizeLogger } = require('@antora/logger')
-const ospath = require('path')
-
-const DOT_RELATIVE_RX = new RegExp(`^\\.{1,2}[/${ospath.sep.replace('/', '').replace('\\', '\\\\')}]`)
-const { version: VERSION } = require('../package.json')
-
-async function run (argv = process.argv) {
- const args = argv.slice(2)
- return cli.parseAsync(args.length ? args : ['help'], { from: 'user' })
-}
-
-function exitWithError (err, showStack, msg = undefined) {
- if (!msg) msg = err.message || err
- if (showStack) {
- let stack
- if ((stack = err.backtrace)) {
- msg = [`error: ${msg}`, ...stack.slice(1)].join('\n')
- } else if ((stack = err.stack)) {
- msg = stack.startsWith(`${err.name}: ${msg}\n`) ? stack : [msg, ...stack.split('\n').slice(1)].join('\n')
- } else {
- msg = `error: ${msg} (no stack)`
- }
- console.error(msg)
- } else {
- console.error(`error: ${msg}\nAdd the --stacktrace option to see the cause.`)
- }
- process.exit(1)
-}
-
-function getTTYColumns () {
- return process.env.COLUMNS || process.stdout.columns || 80
-}
-
-function requireLibraries (requirePaths) {
- if (requirePaths) requirePaths.forEach((requirePath) => requireLibrary(requirePath))
-}
-
-function requireLibrary (requirePath, cwd = process.cwd()) {
- if (requirePath.charAt() === '.' && DOT_RELATIVE_RX.test(requirePath)) {
- // NOTE require resolves a dot-relative path relative to current file; resolve relative to cwd instead
- requirePath = ospath.resolve(requirePath)
- } else if (!ospath.isAbsolute(requirePath)) {
- // NOTE appending node_modules prevents require from looking elsewhere before looking in these paths
- const paths = [cwd, ospath.dirname(__dirname)].map((start) => ospath.join(start, 'node_modules'))
- requirePath = require.resolve(requirePath, { paths })
- }
- return require(requirePath)
-}
-
-cli
- .allowExcessArguments(false)
- .configureOutput({ getOutHelpWidth: getTTYColumns, getErrHelpWidth: getTTYColumns })
- .storeOptionsAsProperties()
- .name('antora')
- .version(VERSION, '-v, --version', 'Output the version number.')
- .description('A modular, multi-repository documentation site generator for AsciiDoc.')
- .usage('[options] [[command] [args]]')
- .helpOption('-h, --help', 'Output usage information.')
- .addHelpText(
- 'after',
- function () {
- const name = this.name()
- return this.createHelp().wrap(
- ` \nRun '${name} --help' to see options and examples for a command (e.g., ${name} generate --help).`,
- getTTYColumns(),
- 0
- )
- }.bind(cli)
- )
- .option('-r, --require ', 'Require library (aka node module) or script before executing command.')
- .on('option:require', (requirePath) => (cli.requirePaths = [...(cli.requirePaths || []), requirePath]))
- .option('--stacktrace', 'Print the stacktrace to the console if the application fails.')
-
-cli
- .command('generate ', { isDefault: true })
- .description('Generate a documentation site specified in .')
- .optionsFromConvict(convict(configSchema), { exclude: 'playbook' })
- .addOption(
- cli
- .createOption('--generator ', 'The site generator library.')
- .default('@antora/site-generator-default', '@antora/site-generator-default')
- )
- .action(async (playbookFile, options, command) => {
- try {
- requireLibraries(cli.requirePaths)
- } catch (err) {
- exitWithError(err, cli.stacktrace)
- }
- const generator = options.generator
- let generateSite
- try {
- generateSite = requireLibrary(generator, ospath.resolve(playbookFile, '..'))
- } catch (err) {
- let msg = 'Generator not found or failed to load.'
- if (generator && generator.charAt() !== '.') msg += ` Try installing the '${generator}' package.`
- exitWithError(err, cli.stacktrace, msg)
- }
- const args = cli.rawArgs.slice(cli.rawArgs.indexOf(command.name()) + 1)
- args.splice(args.indexOf(playbookFile), 0, '--playbook')
- // TODO support passing a preloaded convict config as third option; gets new args and env
- return generateSite(args, process.env)
- .then(finalizeLogger)
- .then((failOnExit) => process.exit(failOnExit ? 1 : process.exitCode))
- .catch((err) => finalizeLogger().then(() => exitWithError(err, cli.stacktrace)))
- })
- .options.sort((a, b) => a.long.localeCompare(b.long))
-
-cli.command('help [command]', { hidden: true }).action((name, options, command) => {
- if (name) {
- const helpCommand = cli.commands.find((candidate) => candidate.name() === name)
- if (helpCommand) {
- helpCommand.help()
- } else {
- console.error(
- `'${name}' is not a valid command in ${cli.name()}. See '${cli.name()} --help' for a list of commands.`
- )
- process.exit(1)
- }
- } else {
- cli.help()
- }
-})
-
-cli.command('version', { hidden: true }).action(() => cli.emit('option:version'))
-
-module.exports = run
diff --git a/node_modules/@antora/cli/lib/commander.js b/node_modules/@antora/cli/lib/commander.js
deleted file mode 100644
index a56c110e..00000000
--- a/node_modules/@antora/cli/lib/commander.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict'
-
-const commander = require('commander')
-require('./commander/options-from-convict')
-
-module.exports = commander
diff --git a/node_modules/@antora/cli/lib/commander/options-from-convict.js b/node_modules/@antora/cli/lib/commander/options-from-convict.js
deleted file mode 100644
index 3a2eae48..00000000
--- a/node_modules/@antora/cli/lib/commander/options-from-convict.js
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict'
-
-const { Command } = require('commander')
-
-Command.prototype.optionsFromConvict = function (convictConfig, opts = {}) {
- let exclude = opts.exclude
- if (exclude && !Array.isArray(exclude)) exclude = [exclude]
- getOptions(convictConfig).forEach(({ name, form, description, default: default_, choices }) => {
- if (exclude && exclude.includes(name)) return
- this.addOption(
- choices
- ? this.createOption(form, description)
- .default(default_, default_)
- .choices(choices)
- : this.createOption(form, description).default(default_, default_)
- )
- })
- return this
-}
-
-function getOptions (config) {
- //return collectOptions(config._schema._cvtProperties).sort((a, b) => a.name.localeCompare(b.name))
- return collectOptions(config._schema._cvtProperties)
-}
-
-function collectOptions (props, context = undefined) {
- return Object.entries(props).reduce((accum, [key, value]) => {
- if ('_cvtProperties' in value) {
- accum.push(...collectOptions(value._cvtProperties, context ? `${context}.${key}` : key))
- } else if ('arg' in value) {
- const { arg, format, default: default_ } = value
- const option = { name: arg, form: `--${arg}`, description: value.doc, format: format }
- if (Array.isArray(format)) {
- option.form += ' '
- option.choices = Object.defineProperty(format.slice(0), 'map', { value: () => format })
- } else if (format !== 'boolean') {
- option.form += ` <${arg.substr(arg.lastIndexOf('-') + 1, arg.length)}>`
- }
- if (default_ === null) {
- //option.mandatory = true
- option.description += ' (required)'
- } else if (default_ && default_.constructor !== Object) {
- option.default = default_
- }
- accum.push(option)
- //if (format === 'boolean') accum.push({ form: `--no-${arg}`, format: format })
- }
- return accum
- }, [])
-}
diff --git a/node_modules/@antora/cli/package.json b/node_modules/@antora/cli/package.json
deleted file mode 100644
index 947c282c..00000000
--- a/node_modules/@antora/cli/package.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "_from": "@antora/cli@3.0.0-alpha.7",
- "_id": "@antora/cli@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-DQSochNSvJIA2FEfRLvYXxL/LzpNcFgwB7ehJ+SCW/yAf3SEuKQo02L3FDVeLb9UtPx8dDdn74/yd+LMOzWJzw==",
- "_location": "/@antora/cli",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/cli@3.0.0-alpha.7",
- "name": "@antora/cli",
- "escapedName": "@antora%2fcli",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "#DEV:/"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/cli/-/cli-3.0.0-alpha.7.tgz",
- "_shasum": "6c850f5ddd5f9eff7764d317646a73bd5fa48794",
- "_spec": "@antora/cli@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bin": {
- "antora": "bin/antora"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- }
- ],
- "dependencies": {
- "@antora/logger": "3.0.0-alpha.7",
- "@antora/playbook-builder": "3.0.0-alpha.7",
- "commander": "~7.2"
- },
- "deprecated": false,
- "description": "The command line interface for Antora.",
- "devDependencies": {
- "@antora/site-publisher": "3.0.0-alpha.7",
- "convict": "~6.1",
- "kapok-js": "~0.10"
- },
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "bin/",
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "cli",
- "generator",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/cli.js",
- "name": "@antora/cli",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/content-aggregator/LICENSE b/node_modules/@antora/content-aggregator/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/content-aggregator/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/content-aggregator/README.md b/node_modules/@antora/content-aggregator/README.md
deleted file mode 100644
index 0f3a99d2..00000000
--- a/node_modules/@antora/content-aggregator/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Antora Content Aggregator
-
-The Content Aggregator is a component in Antora responsible for fetching and aggregating content distributed across multiple local and remote git repositories for use in an Antora documentation pipeline.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/content-aggregator/lib/aggregate-content.js b/node_modules/@antora/content-aggregator/lib/aggregate-content.js
deleted file mode 100644
index 5fcd14fc..00000000
--- a/node_modules/@antora/content-aggregator/lib/aggregate-content.js
+++ /dev/null
@@ -1,1038 +0,0 @@
-'use strict'
-
-const camelCaseKeys = require('camelcase-keys')
-const { createHash } = require('crypto')
-const createHttpPlugin = require('./git-plugin-http')
-const decodeUint8Data = require('./decode-uint8-data')
-const EventEmitter = require('events')
-const expandPath = require('@antora/expand-path-helper')
-const File = require('./file')
-const flattenDeep = require('./flatten-deep')
-const fs = require('fs')
-const { promises: fsp } = fs
-const getCacheDir = require('cache-directory')
-const GitCredentialManagerStore = require('./git-credential-manager-store')
-const git = require('isomorphic-git')
-const { NotFoundError, ObjectTypeError, UnknownTransportError, UrlParseError } = git.Errors
-const invariably = { false: () => false, void: () => undefined, emptyArray: () => [] }
-const { makeRe: makePicomatchRx } = require('picomatch')
-const matcher = require('matcher')
-const MultiProgress = require('multi-progress')
-const ospath = require('path')
-const { posix: path } = ospath
-const posixify = ospath.sep === '\\' ? (p) => p.replace(/\\/g, '/') : undefined
-const { fs: resolvePathGlobsFs, git: resolvePathGlobsGit } = require('./resolve-path-globs')
-const { Transform } = require('stream')
-const map = (transform, flush = undefined) => new Transform({ objectMode: true, transform, flush })
-const vfs = require('vinyl-fs')
-const yaml = require('js-yaml')
-
-const {
- COMPONENT_DESC_FILENAME,
- CONTENT_CACHE_FOLDER,
- CONTENT_GLOB,
- FILE_MODES,
- GIT_CORE,
- GIT_OPERATION_LABEL_LENGTH,
- GIT_PROGRESS_PHASES,
- PICOMATCH_VERSION_OPTS,
- SYMLINK_FILE_MODE,
- VALID_STATE_FILENAME,
-} = require('./constants')
-
-const ANY_SEPARATOR_RX = /[:/]/
-const CSV_RX = /\s*,\s*/
-const VENTILATED_CSV_RX = /\s*,\s+/
-const EDIT_URL_TEMPLATE_VAR_RX = /\{(web_url|ref(?:hash|name)|path)\}/g
-const GIT_SUFFIX_RX = /(?:(?:(?:\.git)?\/)?\.git|\/)$/
-const GIT_URI_DETECTOR_RX = /:(?:\/\/|[^/\\])/
-const HEADS_DIR_RX = /^heads\//
-const HOSTED_GIT_REPO_RX = /^(?:https?:\/\/|.+@)(git(?:hub|lab)\.com|bitbucket\.org|pagure\.io)[/:](.+?)(?:\.git)?$/
-const HTTP_ERROR_CODE_RX = new RegExp('^' + git.Errors.HttpError.code + '$', 'i')
-const PATH_SEPARATOR_RX = /[/]/g
-const SHORTEN_REF_RX = /^refs\/(?:heads|remotes\/[^/]+|tags)\//
-const SPACE_RX = / /g
-const SUPERFLUOUS_SEPARATORS_RX = /^\/+|\/+$|\/+(?=\/)/g
-const URL_AUTH_CLEANER_RX = /^(https?:\/\/)[^/@]*@/
-const URL_AUTH_EXTRACTOR_RX = /^(https?:\/\/)(?:([^/:@]+)?(?::([^/@]+)?)?@)?(.*)/
-
-/**
- * Aggregates files from the specified content sources so they can be loaded
- * into Antora's virtual file catalog.
- *
- * Currently assumes each source points to a local or remote git repository.
- * Clones the repository, if necessary, then walks the git tree (or worktree) of
- * the specified branches and tags, starting from the specified start path(s).
- * Creates a virtual file containing the contents and location metadata for each
- * file matched. The files are then roughly organized by component version.
- *
- * @memberof content-aggregator
- *
- * @param {Object} playbook - The configuration object for Antora.
- * @param {Object} playbook.dir - The working directory of the playbook.
- * @param {Object} playbook.runtime - The runtime configuration object for Antora.
- * @param {String} [playbook.runtime.cacheDir=undefined] - The base cache directory.
- * @param {Boolean} [playbook.runtime.fetch=undefined] - Whether to fetch
- * updates from managed git repositories.
- * @param {Boolean} [playbook.runtime.quiet=false] - Whether to be suppress progress
- * bars that show progress of clone and fetch operations.
- * @param {Array} playbook.git - The git configuration object for Antora.
- * @param {Boolean} [playbook.git.ensureGitSuffix=true] - Whether the .git
- * suffix is automatically appended to each repository URL, if missing.
- * @param {Array} playbook.content - An array of content sources.
- *
- * @returns {Promise} A map of files organized by component version.
- */
-function aggregateContent (playbook) {
- const startDir = playbook.dir || '.'
- const { branches, editUrl, tags, sources } = playbook.content
- const { cacheDir, fetch, quiet } = playbook.runtime
- return ensureCacheDir(cacheDir, startDir).then((resolvedCacheDir) => {
- const gitPlugins = loadGitPlugins(
- Object.assign({ ensureGitSuffix: true }, playbook.git),
- playbook.network || {},
- startDir
- )
- const sourcesByUrl = sources.reduce(
- (accum, source) => accum.set(source.url, [...(accum.get(source.url) || []), source]),
- new Map()
- )
- const progress = !quiet && createProgress(sourcesByUrl.keys(), process.stdout)
- return Promise.all(
- [...sourcesByUrl.entries()].map(([url, sources]) =>
- loadRepository(url, {
- cacheDir: resolvedCacheDir,
- gitPlugins,
- fetchTags: tagsSpecified(sources, tags),
- progress,
- fetch,
- startDir,
- }).then(({ repo, authStatus }) =>
- Promise.all(
- sources.map((source) => {
- source = Object.assign({ branches, editUrl, tags }, source)
- // NOTE if repository is managed (has a url), we can assume the remote name is origin
- // TODO if the repo has no remotes, then remoteName should be undefined
- const remoteName = repo.url ? 'origin' : source.remote || 'origin'
- return collectFilesFromSource(source, repo, remoteName, authStatus)
- })
- )
- )
- )
- )
- .then(buildAggregate)
- .catch((err) => {
- progress && progress.terminate()
- throw err
- })
- })
-}
-
-function buildAggregate (componentVersionBuckets) {
- const aggregateMap = flattenDeep(componentVersionBuckets).reduce((accum, batch) => {
- const key = batch.version + '@' + batch.name
- const entry = accum.get(key)
- return accum.set(key, entry ? Object.assign(entry, batch, { files: [...entry.files, ...batch.files] }) : batch)
- }, new Map())
- return [...aggregateMap.values()]
-}
-
-async function loadRepository (url, opts) {
- let dir
- let repo
- let authStatus
- if (~url.indexOf(':') && GIT_URI_DETECTOR_RX.test(url)) {
- let displayUrl
- let credentials
- ;({ displayUrl, url, credentials } = extractCredentials(url))
- const { cacheDir, fetch, fetchTags, gitPlugins, progress } = opts
- dir = ospath.join(cacheDir, generateCloneFolderName(displayUrl))
- // NOTE the presence of the url property on the repo object implies the repository is remote
- repo = { cache: {}, dir, fs, gitdir: dir, noCheckout: true, url }
- const validStateFile = ospath.join(dir, VALID_STATE_FILENAME)
- try {
- await fsp.access(validStateFile)
- if (fetch) {
- await fsp.unlink(validStateFile)
- const fetchOpts = buildFetchOptions(repo, progress, displayUrl, credentials, gitPlugins, fetchTags, 'fetch')
- await git
- .fetch(fetchOpts)
- .then(() => {
- const credentialManager = gitPlugins.credentialManager
- authStatus = credentials ? 'auth-embedded' : credentialManager.status({ url }) ? 'auth-required' : undefined
- return git.setConfig(Object.assign({ path: 'remote.origin.private', value: authStatus }, repo))
- })
- .catch((fetchErr) => {
- if (fetchOpts.onProgress) fetchOpts.onProgress.finish(fetchErr)
- if (HTTP_ERROR_CODE_RX.test(fetchErr.code) && fetchErr.data.statusCode === 401) fetchErr.rethrow = true
- throw fetchErr
- })
- .then(() => fsp.writeFile(validStateFile, '').catch(invariably.void))
- .then(() => fetchOpts.onProgress && fetchOpts.onProgress.finish())
- } else {
- authStatus = await git.getConfig(Object.assign({ path: 'remote.origin.private' }, repo))
- }
- } catch (gitErr) {
- await rmdir(dir)
- if (gitErr.rethrow) throw transformGitCloneError(gitErr, displayUrl)
- const fetchOpts = buildFetchOptions(repo, progress, displayUrl, credentials, gitPlugins, fetchTags, 'clone')
- await git
- .clone(fetchOpts)
- .then(() => git.resolveRef(Object.assign({ ref: 'HEAD', depth: 1 }, repo)))
- .then(() => {
- const credentialManager = gitPlugins.credentialManager
- authStatus = credentials ? 'auth-embedded' : credentialManager.status({ url }) ? 'auth-required' : undefined
- return git.setConfig(Object.assign({ path: 'remote.origin.private', value: authStatus }, repo))
- })
- .catch(async (cloneErr) => {
- await rmdir(dir)
- // FIXME triggering the error handler here causes assertion problems in the test suite
- //if (fetchOpts.onProgress) fetchOpts.onProgress.finish(cloneErr)
- throw transformGitCloneError(cloneErr, displayUrl)
- })
- .then(() => fsp.writeFile(validStateFile, '').catch(invariably.void))
- .then(() => fetchOpts.onProgress && fetchOpts.onProgress.finish())
- }
- } else if (await isDirectory((dir = expandPath(url, '~+', opts.startDir)))) {
- repo = (await isDirectory(ospath.join(dir, '.git')))
- ? { cache: {}, dir, fs }
- : { cache: {}, dir, fs, gitdir: dir, noCheckout: true }
- try {
- await git.resolveRef(Object.assign({ ref: 'HEAD', depth: 1 }, repo))
- } catch {
- throw new Error(
- `Local content source must be a git repository: ${dir}${url !== dir ? ' (url: ' + url + ')' : ''}`
- )
- }
- } else {
- throw new Error(`Local content source does not exist: ${dir}${url !== dir ? ' (url: ' + url + ')' : ''}`)
- }
- return { repo, authStatus }
-}
-
-function extractCredentials (url) {
- if ((url.startsWith('https://') || url.startsWith('http://')) && ~url.indexOf('@')) {
- // Common oauth2 formats: (QUESTION should we try to coerce token only into one of these formats?)
- // GitHub: :x-oauth-basic@ (or @)
- // GitHub App: x-access-token:@
- // GitLab: oauth2:@
- // BitBucket: x-token-auth:@
- const [, scheme, username, password, rest] = url.match(URL_AUTH_EXTRACTOR_RX)
- const displayUrl = (url = scheme + rest)
- // NOTE if only username is present, assume it's an oauth token and set password to empty string
- const credentials = username ? { username, password: password || '' } : {}
- return { displayUrl, url, credentials }
- } else if (url.startsWith('git@')) {
- return { displayUrl: url, url: 'https://' + url.substr(4).replace(':', '/') }
- } else {
- return { displayUrl: url, url }
- }
-}
-
-async function collectFilesFromSource (source, repo, remoteName, authStatus) {
- const originUrl = repo.url || (await resolveRemoteUrl(repo, remoteName))
- return selectReferences(source, repo, remoteName).then((refs) =>
- Promise.all(refs.map((ref) => collectFilesFromReference(source, repo, remoteName, authStatus, ref, originUrl)))
- )
-}
-
-// QUESTION should we resolve HEAD to a ref eagerly to avoid having to do a match on it?
-async function selectReferences (source, repo, remote) {
- let { branches: branchPatterns, tags: tagPatterns, worktrees: worktreePatterns = '.' } = source
- const isBare = repo.noCheckout
- const refs = new Map()
- if (tagPatterns) {
- tagPatterns = Array.isArray(tagPatterns)
- ? tagPatterns.map((pattern) => String(pattern))
- : String(tagPatterns).split(CSV_RX)
- if (tagPatterns.length) {
- const tags = await git.listTags(repo)
- for (const shortname of tags.length ? matcher(tags, tagPatterns) : tags) {
- // NOTE tags are stored using symbol keys to distinguish them from branches
- refs.set(Symbol(shortname), { shortname, fullname: 'tags/' + shortname, type: 'tag' })
- }
- }
- }
- if (branchPatterns) {
- if (worktreePatterns) {
- if (worktreePatterns === '.') {
- worktreePatterns = ['.']
- } else if (worktreePatterns === true) {
- worktreePatterns = ['.', '*']
- } else {
- worktreePatterns = Array.isArray(worktreePatterns)
- ? worktreePatterns.map((pattern) => String(pattern))
- : String(worktreePatterns).split(CSV_RX)
- }
- }
- const branchPatternsString = String(branchPatterns)
- if (branchPatternsString === 'HEAD' || branchPatternsString === '.') {
- const currentBranch = await getCurrentBranchName(repo, remote)
- if (currentBranch) {
- branchPatterns = [currentBranch]
- } else {
- if (!isBare) {
- // NOTE current branch is undefined when HEAD is detached
- const ref = { shortname: 'HEAD', fullname: 'HEAD', type: 'branch', detached: true }
- if (worktreePatterns[0] === '.') ref.head = repo.dir
- refs.set('HEAD', ref)
- }
- return [...refs.values()]
- }
- } else if (
- (branchPatterns = Array.isArray(branchPatterns)
- ? branchPatterns.map((pattern) => String(pattern))
- : branchPatternsString.split(CSV_RX)).length
- ) {
- let headBranchIdx
- // NOTE we can assume at least two entries if HEAD or . are present
- if (~(headBranchIdx = branchPatterns.indexOf('HEAD')) || ~(headBranchIdx = branchPatterns.indexOf('.'))) {
- const currentBranch = await getCurrentBranchName(repo, remote)
- if (currentBranch) {
- // NOTE ignore if current branch is already in list
- if (~branchPatterns.indexOf(currentBranch)) {
- branchPatterns.splice(headBranchIdx, 1)
- } else {
- branchPatterns[headBranchIdx] = currentBranch
- }
- } else {
- if (!isBare) {
- // NOTE current branch is undefined when HEAD is detached
- const ref = { shortname: 'HEAD', fullname: 'HEAD', type: 'branch', detached: true }
- if (worktreePatterns[0] === '.' && (worktreePatterns = worktreePatterns.slice(1))) ref.head = repo.dir
- refs.set('HEAD', ref)
- }
- branchPatterns.splice(headBranchIdx, 1)
- }
- }
- } else {
- return [...refs.values()]
- }
- // NOTE isomorphic-git includes HEAD in list of remote branches (see https://isomorphic-git.org/docs/listBranches)
- const remoteBranches = (await git.listBranches(Object.assign({ remote }, repo))).filter((it) => it !== 'HEAD')
- if (remoteBranches.length) {
- for (const shortname of matcher(remoteBranches, branchPatterns)) {
- refs.set(shortname, { shortname, fullname: path.join('remotes', remote, shortname), type: 'branch', remote })
- }
- }
- // NOTE only consider local branches if repo has a worktree or there are no remote tracking branches
- if (!isBare) {
- const localBranches = await git.listBranches(repo)
- if (localBranches.length) {
- const worktrees = await findWorktrees(repo, worktreePatterns)
- for (const shortname of matcher(localBranches, branchPatterns)) {
- const ref = { shortname, fullname: 'heads/' + shortname, type: 'branch' }
- if (worktrees.has(shortname)) ref.head = worktrees.get(shortname)
- refs.set(shortname, ref)
- }
- }
- } else if (!remoteBranches.length) {
- // QUESTION should local branches be used if the only remote branch is HEAD?
- const localBranches = await git.listBranches(repo)
- for (const shortname of localBranches.length ? matcher(localBranches, branchPatterns) : localBranches) {
- refs.set(shortname, { shortname, fullname: 'heads/' + shortname, type: 'branch' })
- }
- }
- }
- return [...refs.values()]
-}
-
-/**
- * Returns the current branch name unless the HEAD is detached.
- */
-function getCurrentBranchName (repo, remote) {
- let refPromise
- if (repo.noCheckout) {
- refPromise = git
- .resolveRef(Object.assign({ ref: 'refs/remotes/' + remote + '/HEAD', depth: 2 }, repo))
- .catch(() => git.resolveRef(Object.assign({ ref: 'HEAD', depth: 2 }, repo)))
- } else {
- refPromise = git.resolveRef(Object.assign({ ref: 'HEAD', depth: 2 }, repo))
- }
- return refPromise.then((ref) => (ref.startsWith('refs/') ? ref.replace(SHORTEN_REF_RX, '') : undefined))
-}
-
-async function collectFilesFromReference (source, repo, remoteName, authStatus, ref, originUrl) {
- const url = repo.url
- const displayUrl = url || repo.dir
- const { version, editUrl } = source
- const worktreePath = ref.head
- if (!worktreePath) {
- ref.oid = await git.resolveRef(
- Object.assign(ref.detached ? { ref: 'HEAD', depth: 1 } : { ref: 'refs/' + ref.fullname }, repo)
- )
- }
- if ('startPaths' in source) {
- let startPaths
- startPaths = Array.isArray((startPaths = source.startPaths))
- ? startPaths.map(coerceToString).map(cleanStartPath)
- : (startPaths = coerceToString(startPaths)) && startPaths.split(VENTILATED_CSV_RX).map(cleanStartPath)
- startPaths = await (worktreePath
- ? resolvePathGlobsFs(worktreePath, startPaths)
- : resolvePathGlobsGit(repo, ref.oid, startPaths))
- if (!startPaths.length) {
- const refInfo = `ref: ${ref.fullname.replace(HEADS_DIR_RX, '')}${worktreePath ? ' ' : ''}`
- throw new Error(`no start paths found in ${displayUrl} (${refInfo})`)
- }
- return Promise.all(
- startPaths.map((startPath) =>
- collectFilesFromStartPath(startPath, repo, authStatus, ref, worktreePath, originUrl, editUrl, version)
- )
- )
- }
- const startPath = cleanStartPath(coerceToString(source.startPath))
- return collectFilesFromStartPath(startPath, repo, authStatus, ref, worktreePath, originUrl, editUrl, version)
-}
-
-function collectFilesFromStartPath (startPath, repo, authStatus, ref, worktreePath, originUrl, editUrl, version) {
- return (worktreePath
- ? readFilesFromWorktree(worktreePath, startPath)
- : readFilesFromGitTree(repo, ref.oid, startPath)
- )
- .then((files) => {
- const componentVersionBucket = loadComponentDescriptor(files, ref, version)
- const origin = computeOrigin(originUrl, authStatus, ref, startPath, worktreePath, editUrl)
- componentVersionBucket.files = files.map((file) => assignFileProperties(file, origin))
- return componentVersionBucket
- })
- .catch((err) => {
- const refInfo = `ref: ${ref.fullname.replace(HEADS_DIR_RX, '')}${worktreePath ? ' ' : ''}`
- const pathInfo = !startPath || err.message.startsWith('the start path ') ? '' : ' | path: ' + startPath
- throw Object.assign(err, { message: `${err.message} in ${repo.url || repo.dir} (${refInfo}${pathInfo})` })
- })
-}
-
-function readFilesFromWorktree (worktreePath, startPath) {
- const cwd = ospath.join(worktreePath, startPath)
- return fsp
- .stat(cwd)
- .catch(() => {
- throw new Error(`the start path '${startPath}' does not exist`)
- })
- .then((stat) => {
- if (!stat.isDirectory()) throw new Error(`the start path '${startPath}' is not a directory`)
- return new Promise((resolve, reject) =>
- vfs
- .src(CONTENT_GLOB, { cwd, follow: true, removeBOM: false })
- .on('error', (err) => {
- if (err.code === 'ENOENT' && err.syscall === 'stat') {
- try {
- if (fs.lstatSync(err.path).isSymbolicLink()) {
- err.message = `Broken symbolic link detected at ${ospath.relative(cwd, err.path)}`
- }
- } catch {}
- } else if (err.code === 'ELOOP') {
- err.message = `Symbolic link cycle detected at ${ospath.relative(cwd, err.path)}`
- }
- reject(err)
- })
- .pipe(relativizeFiles())
- .pipe(collectFiles(resolve))
- )
- })
-}
-
-/**
- * Transforms the path of every file in the stream to a relative posix path.
- *
- * Applies a mapping function to all files in the stream so they end up with a
- * posixified path relative to the file's base instead of the filesystem root.
- * This mapper also filters out any directories (indicated by file.isNull())
- * that got caught up in the glob.
- */
-function relativizeFiles () {
- return map((file, enc, next) => {
- if (file.isNull()) {
- next()
- } else {
- next(
- null,
- new File({
- path: posixify ? posixify(file.relative) : file.relative,
- contents: file.contents,
- stat: file.stat,
- src: { abspath: file.path },
- })
- )
- }
- })
-}
-
-function collectFiles (done) {
- const accum = []
- return map(
- (file, enc, next) => {
- accum.push(file)
- next()
- },
- () => done(accum)
- )
-}
-
-function readFilesFromGitTree (repo, oid, startPath) {
- return git
- .readTree(Object.assign({ oid }, repo))
- .then((root) =>
- getGitTreeAtStartPath(repo, oid, startPath).then((start) =>
- srcGitTree(repo, Object.assign(root, { dirname: '' }), start)
- )
- )
-}
-
-function getGitTreeAtStartPath (repo, oid, startPath) {
- return git
- .readTree(Object.assign({ oid, filepath: startPath }, repo))
- .catch((err) => {
- const m = err instanceof ObjectTypeError && err.data.expected === 'tree' ? 'is not a directory' : 'does not exist'
- throw new Error(`the start path '${startPath}' ${m}`)
- })
- .then((result) => Object.assign(result, { dirname: startPath }))
-}
-
-function srcGitTree (repo, root, start) {
- return new Promise((resolve, reject) => {
- const files = []
- createGitTreeWalker(repo, root, filterGitEntry)
- .on('entry', (entry) => files.push(entryToFile(entry)))
- .on('error', reject)
- .on('end', () => resolve(Promise.all(files)))
- .walk(start)
- })
-}
-
-function createGitTreeWalker (repo, root, filter) {
- return Object.assign(new EventEmitter(), {
- walk (start) {
- return (
- visitGitTree(this, repo, root, filter, start)
- .then(() => this.emit('end'))
- // NOTE if error is thrown, promises already being resolved won't halt
- .catch((err) => this.emit('error', err))
- )
- },
- })
-}
-
-function visitGitTree (emitter, repo, root, filter, parent, dirname = '', following = new Set()) {
- const reads = []
- for (const entry of parent.tree) {
- const filterVerdict = filter(entry)
- if (filterVerdict) {
- const vfilePath = dirname ? path.join(dirname, entry.path) : entry.path
- if (entry.type === 'tree') {
- reads.push(
- git.readTree(Object.assign({ oid: entry.oid }, repo)).then((subtree) => {
- Object.assign(subtree, { dirname: path.join(parent.dirname, entry.path) })
- return visitGitTree(emitter, repo, root, filter, subtree, vfilePath, following)
- })
- )
- } else if (entry.type === 'blob') {
- let mode
- if (entry.mode === SYMLINK_FILE_MODE) {
- reads.push(
- readGitSymlink(repo, root, parent, entry, following)
- .catch((err) => {
- // NOTE this error could be caught after promise chain has already been rejected
- if (err instanceof NotFoundError) {
- err.message = `Broken symbolic link detected at ${vfilePath}`
- } else if (err.code === 'SymbolicLinkCycleError') {
- err.message = `Symbolic link cycle detected at ${vfilePath}`
- }
- throw err
- })
- .then((target) => {
- if (target.type === 'tree') {
- return visitGitTree(emitter, repo, root, filter, target, vfilePath, new Set(following).add(entry.oid))
- } else if (target.type === 'blob' && filterVerdict === true && (mode = FILE_MODES[target.mode])) {
- emitter.emit('entry', Object.assign({ mode, oid: target.oid, path: vfilePath }, repo))
- }
- })
- )
- } else if ((mode = FILE_MODES[entry.mode])) {
- emitter.emit('entry', Object.assign({ mode, oid: entry.oid, path: vfilePath }, repo))
- }
- }
- }
- }
- return Promise.all(reads)
-}
-
-function readGitSymlink (repo, root, parent, { oid }, following) {
- if (following.size !== (following = new Set(following).add(oid)).size) {
- return git.readBlob(Object.assign({ oid }, repo)).then(({ blob: target }) => {
- target = posixify && process.env.NODE_ENV === 'test' ? posixify(decodeUint8Data(target)) : decodeUint8Data(target)
- let targetParent
- if (parent.dirname) {
- const dirname = parent.dirname + '/'
- target = path.join(dirname, target)
- if (target.startsWith(dirname)) {
- target = target.substr(dirname.length)
- targetParent = parent
- } else {
- targetParent = root
- }
- } else {
- target = path.normalize(target)
- targetParent = root
- }
- return readGitObjectAtPath(repo, root, targetParent, target.split('/'), following)
- })
- }
- const err = { name: 'SymbolicLinkCycleError', code: 'SymbolicLinkCycleError', oid }
- return Promise.reject(Object.assign(new Error(`Symbolic link cycle found at oid: ${err.oid}`), err))
-}
-
-// QUESTION: could we use this to resolve the start path too?
-function readGitObjectAtPath (repo, root, parent, pathSegments, following) {
- const firstPathSegment = pathSegments[0]
- for (const entry of parent.tree) {
- if (entry.path === firstPathSegment) {
- return entry.type === 'tree'
- ? git.readTree(Object.assign({ oid: entry.oid }, repo)).then((subtree) => {
- Object.assign(subtree, { dirname: path.join(parent.dirname, entry.path) })
- return (pathSegments = pathSegments.slice(1)).length
- ? readGitObjectAtPath(repo, root, subtree, pathSegments, following)
- : Object.assign(subtree, { type: 'tree' })
- })
- : entry.mode === SYMLINK_FILE_MODE
- ? readGitSymlink(repo, root, parent, entry, following)
- : Promise.resolve(entry)
- }
- }
- return Promise.reject(new NotFoundError(`No file or directory found at "${parent.oid}:${pathSegments.join('/')}"`))
-}
-
-/**
- * Returns true (or 'treeOnly' if the entry is a symlink tree) if the entry
- * should be processed or false if it should be skipped. An entry with a path
- * (basename) that begins with dot ('.') is marked as skipped.
- */
-function filterGitEntry (entry) {
- const entryPath = entry.path
- if (entryPath.charAt() === '.') return false
- if (entry.type === 'tree') return entry.mode === SYMLINK_FILE_MODE ? 'treeOnly' : true
- return entryPath.charAt(entryPath.length - 1) !== '~'
-}
-
-function entryToFile (entry) {
- return git.readBlob(entry).then(({ blob: contents }) => {
- const stat = new fs.Stats()
- stat.mode = entry.mode
- stat.mtime = undefined
- stat.size = contents.byteLength
- contents = Buffer.from(contents.buffer)
- return new File({ path: entry.path, contents, stat })
- })
-}
-
-function loadComponentDescriptor (files, ref, version) {
- const descriptorFileIdx = files.findIndex((file) => file.path === COMPONENT_DESC_FILENAME)
- if (descriptorFileIdx < 0) throw new Error(`${COMPONENT_DESC_FILENAME} not found`)
- const descriptorFile = files[descriptorFileIdx]
- files.splice(descriptorFileIdx, 1)
- let data
- try {
- data = yaml.load(descriptorFile.contents.toString())
- } catch (err) {
- throw Object.assign(err, { message: `${COMPONENT_DESC_FILENAME} has invalid syntax; ${err.message}` })
- }
- if (data.name == null) throw new Error(`${COMPONENT_DESC_FILENAME} is missing a name`)
- const name = (data.name = String(data.name))
- if (name === '.' || name === '..' || ~name.indexOf('/')) {
- throw new Error(`name in ${COMPONENT_DESC_FILENAME} cannot have path segments: ${name}`)
- }
- if ('version' in data) version = data.version
- if (!version) {
- if (version === undefined) throw new Error(`${COMPONENT_DESC_FILENAME} is missing a version`)
- version = ''
- } else if (version === true) {
- version = ref.shortname.replace(PATH_SEPARATOR_RX, '-')
- } else if (version.constructor === Object) {
- const refname = ref.shortname
- let matched
- if (refname in version) {
- matched = version[refname]
- } else if (
- !Object.entries(version).some(([pattern, replacement]) => {
- const result = refname.replace(makePicomatchRx(pattern, PICOMATCH_VERSION_OPTS), '\0' + replacement)
- if (result === refname) return false
- matched = result.substr(1)
- return true
- })
- ) {
- matched = refname
- }
- if (matched === '.' || matched === '..') {
- throw new Error(`version in ${COMPONENT_DESC_FILENAME} cannot have path segments: ${matched}`)
- }
- version = matched.replace(PATH_SEPARATOR_RX, '-')
- } else if ((version = String(version)) === '.' || version === '..' || ~version.indexOf('/')) {
- throw new Error(`version in ${COMPONENT_DESC_FILENAME} cannot have path segments: ${version}`)
- }
- data.version = version
- return camelCaseKeys(data, { deep: true, stopPaths: ['asciidoc'] })
-}
-
-function computeOrigin (url, authStatus, ref, startPath, worktreePath = undefined, editUrl = true) {
- const { shortname: refname, oid: refhash, type: reftype } = ref
- const remote = !url.startsWith('file://')
- const origin = { type: 'git', refname, startPath }
- if (authStatus) origin.private = authStatus
- origin[reftype] = refname
- if (worktreePath) {
- if (remote) origin.url = url
- origin.fileUriPattern =
- (posixify ? 'file:///' + posixify(worktreePath) : 'file://' + worktreePath) + path.join('/', startPath, '%s')
- origin.worktree = worktreePath
- } else {
- origin.url = url
- origin.refhash = refhash
- }
- if (remote) origin.webUrl = url.replace(GIT_SUFFIX_RX, '')
- if (editUrl === true) {
- let match
- if (url && (match = url.match(HOSTED_GIT_REPO_RX))) {
- const host = match[1]
- let action
- let category = ''
- if (host === 'pagure.io') {
- action = 'blob'
- category = 'f'
- } else if (host === 'bitbucket.org') {
- action = 'src'
- } else {
- action = reftype === 'branch' ? 'edit' : 'blob'
- }
- origin.editUrlPattern = 'https://' + path.join(match[1], match[2], action, refname, category, startPath, '%s')
- }
- } else if (editUrl) {
- const vars = {
- path: () => (startPath ? path.join(startPath, '%s') : '%s'),
- refhash: () => refhash,
- refname: () => refname,
- web_url: () => origin.webUrl || '',
- }
- origin.editUrlPattern = editUrl.replace(EDIT_URL_TEMPLATE_VAR_RX, (_, name) => vars[name]())
- }
- return origin
-}
-
-function assignFileProperties (file, origin) {
- if (!file.src) file.src = {}
- Object.assign(file.src, { path: file.path, basename: file.basename, stem: file.stem, extname: file.extname, origin })
- if (origin.fileUriPattern) {
- const fileUri = origin.fileUriPattern.replace('%s', file.src.path)
- file.src.fileUri = ~fileUri.indexOf(' ') ? fileUri.replace(SPACE_RX, '%20') : fileUri
- }
- if (origin.editUrlPattern) {
- const editUrl = origin.editUrlPattern.replace('%s', file.src.path)
- file.src.editUrl = ~editUrl.indexOf(' ') ? editUrl.replace(SPACE_RX, '%20') : editUrl
- }
- return file
-}
-
-function buildFetchOptions (repo, progress, displayUrl, credentialsFromUrl, gitPlugins, fetchTags, operation) {
- const { credentialManager, http, urlRouter } = gitPlugins
- const onAuth = resolveCredentials.bind(credentialManager, new Map().set(undefined, credentialsFromUrl))
- const onAuthFailure = onAuth
- const onAuthSuccess = (url) => credentialManager.approved({ url })
- const opts = Object.assign({ corsProxy: false, depth: 1, http, onAuth, onAuthFailure, onAuthSuccess }, repo)
- if (urlRouter) opts.url = urlRouter.ensureGitSuffix(opts.url)
- if (progress) opts.onProgress = createProgressListener(progress, displayUrl, operation)
- if (operation === 'fetch') {
- opts.prune = true
- if (fetchTags) opts.tags = opts.pruneTags = true
- } else if (!fetchTags) {
- opts.noTags = true
- }
- return opts
-}
-
-function createProgress (urls, term) {
- if (term.isTTY && term.columns > 59) {
- let maxUrlLength = 0
- for (const url of urls) {
- if (~url.indexOf(':') && GIT_URI_DETECTOR_RX.test(url)) {
- const urlLength = extractCredentials(url).displayUrl.length
- if (urlLength > maxUrlLength) maxUrlLength = urlLength
- }
- }
- const progress = new MultiProgress(term)
- // NOTE remove the width of the operation, then partition the difference between the url and bar
- progress.maxLabelWidth = Math.min(Math.ceil((term.columns - GIT_OPERATION_LABEL_LENGTH) / 2), maxUrlLength)
- return progress
- }
-}
-
-function createProgressListener (progress, progressLabel, operation) {
- const progressBar = progress.newBar(formatProgressBar(progressLabel, progress.maxLabelWidth, operation), {
- complete: '#',
- incomplete: '-',
- renderThrottle: 25,
- total: 100,
- })
- const ticks = progressBar.stream.columns - progressBar.fmt.replace(':bar', '').length
- // NOTE leave room for indeterminate progress at end of bar; this isn't strictly needed for a bare clone
- progressBar.scaleFactor = Math.max(0, (ticks - 1) / ticks)
- progressBar.tick(0)
- return Object.assign(onGitProgress.bind(progressBar), { finish: onGitComplete.bind(progressBar) })
-}
-
-function formatProgressBar (label, maxLabelWidth, operation) {
- const paddingSize = maxLabelWidth - label.length
- let padding = ''
- if (paddingSize < 0) {
- label = '...' + label.substr(-paddingSize + 3)
- } else if (paddingSize) {
- padding = ' '.repeat(paddingSize)
- }
- // NOTE assume operation has a fixed length
- return `[${operation}] ${label}${padding} [:bar]`
-}
-
-function onGitProgress ({ phase, loaded, total }) {
- const phaseIdx = GIT_PROGRESS_PHASES.indexOf(phase)
- if (~phaseIdx) {
- const scaleFactor = this.scaleFactor
- let ratio = ((loaded / total) * scaleFactor) / GIT_PROGRESS_PHASES.length
- if (phaseIdx) ratio += (phaseIdx * scaleFactor) / GIT_PROGRESS_PHASES.length
- // NOTE: updates are automatically throttled based on renderThrottle option
- this.update(ratio > scaleFactor ? scaleFactor : ratio)
- }
-}
-
-function onGitComplete (err) {
- if (err) {
- // TODO: could use progressBar.interrupt() to replace bar with message instead
- this.chars.incomplete = '?'
- this.update(0)
- // NOTE: force progress bar to update regardless of throttle setting
- this.render(undefined, true)
- } else {
- this.update(1)
- }
-}
-
-function resolveCredentials (credentialsFromUrlHolder, url, auth) {
- const credentialsFromUrl = credentialsFromUrlHolder.get()
- if ('Authorization' in auth.headers) {
- if (!credentialsFromUrl) return this.rejected({ url, auth })
- credentialsFromUrlHolder.clear()
- } else if (credentialsFromUrl) {
- return credentialsFromUrl
- } else {
- auth = undefined
- }
- return this.fill({ url }).then((credentials) =>
- credentials
- ? { username: credentials.token || credentials.username, password: credentials.token ? '' : credentials.password }
- : this.rejected({ url, auth })
- )
-}
-
-/**
- * Generates a safe, unique folder name for a git URL.
- *
- * The purpose of this function is generate a safe, unique folder name for the cloned
- * repository that gets stored in the cache directory.
- *
- * The generated folder name follows the pattern: --.git
- *
- * @param {String} url - The repository URL to convert.
- * @returns {String} The generated folder name.
- */
-function generateCloneFolderName (url) {
- let normalizedUrl = url.toLowerCase()
- if (posixify) normalizedUrl = posixify(normalizedUrl)
- normalizedUrl = normalizedUrl.replace(GIT_SUFFIX_RX, '')
- const basename = normalizedUrl.split(ANY_SEPARATOR_RX).pop()
- const hash = createHash('sha1')
- hash.update(normalizedUrl)
- return basename + '-' + hash.digest('hex') + '.git'
-}
-
-/**
- * Resolve the HTTP URL of the specified remote for the given repository, removing embedded auth if present.
- *
- * @param {Repository} repo - The repository on which to operate.
- * @param {String} remoteName - The name of the remote to resolve.
- * @returns {String} The URL of the specified remote, if present.
- */
-function resolveRemoteUrl (repo, remoteName) {
- return git.getConfig(Object.assign({ path: 'remote.' + remoteName + '.url' }, repo)).then((url) => {
- if (!url) return posixify ? 'file:///' + posixify(repo.dir) : 'file://' + repo.dir
- if (url.startsWith('https://') || url.startsWith('http://')) {
- return ~url.indexOf('@') ? url.replace(URL_AUTH_CLEANER_RX, '$1') : url
- } else if (url.startsWith('git@')) {
- return 'https://' + url.substr(4).replace(':', '/')
- }
- })
-}
-
-/**
- * Checks whether the specified URL matches a directory on the local filesystem.
- *
- * @param {String} url - The URL to check.
- * @return {Boolean} A flag indicating whether the URL matches a directory on the local filesystem.
- */
-function isDirectory (url) {
- return fsp
- .stat(url)
- .then((stat) => stat.isDirectory())
- .catch(invariably.false)
-}
-
-/**
- * Removes the specified directory (including all of its contents) or file.
- * Equivalent to fs.promises.rmdir(dir, { recursive: true }) in Node 12.
- */
-function rmdir (dir) {
- return fsp
- .readdir(dir, { withFileTypes: true })
- .then((lst) =>
- Promise.all(
- lst.map((it) =>
- it.isDirectory()
- ? rmdir(ospath.join(dir, it.name))
- : fsp.unlink(ospath.join(dir, it.name)).catch((unlinkErr) => {
- if (unlinkErr.code !== 'ENOENT') throw unlinkErr
- })
- )
- )
- )
- .then(() => fsp.rmdir(dir))
- .catch((err) => {
- if (err.code === 'ENOENT') return
- if (err.code === 'ENOTDIR') {
- return fsp.unlink(dir).catch((unlinkErr) => {
- if (unlinkErr.code !== 'ENOENT') throw unlinkErr
- })
- }
- throw err
- })
-}
-
-function tagsSpecified (sources, defaultTags) {
- return ~sources.findIndex((source) => {
- const tags = source.tags || defaultTags || []
- return Array.isArray(tags) ? tags.length : true
- })
-}
-
-function loadGitPlugins (gitConfig, networkConfig, startDir) {
- const plugins = (git.cores || git.default.cores || new Map()).get(GIT_CORE) || new Map()
- let credentialManager, urlRouter
- if ((credentialManager = plugins.get('credentialManager'))) {
- if (typeof credentialManager.configure === 'function') {
- credentialManager.configure({ config: gitConfig.credentials, startDir })
- }
- if (typeof credentialManager.status !== 'function') Object.assign(credentialManager, { status () {} })
- } else {
- credentialManager = new GitCredentialManagerStore().configure({ config: gitConfig.credentials, startDir })
- }
- if (gitConfig.ensureGitSuffix) urlRouter = { ensureGitSuffix: (url) => (url.endsWith('.git') ? url : url + '.git') }
- const http = plugins.get('http') || createHttpPlugin(networkConfig, 'git/isomorphic-git@' + git.version())
- return { credentialManager, http, urlRouter }
-}
-
-/**
- * Expands the content cache directory path and ensures it exists.
- *
- * @param {String} preferredCacheDir - The preferred cache directory. If the value is undefined,
- * the user's cache folder is used.
- * @param {String} startDir - The directory to use in place of a leading '.' segment.
- *
- * @returns {Promise} A promise that resolves to the absolute content cache directory.
- */
-function ensureCacheDir (preferredCacheDir, startDir) {
- // QUESTION should fallback directory be relative to cwd, playbook dir, or tmpdir?
- const baseCacheDir =
- preferredCacheDir == null
- ? getCacheDir('antora' + (process.env.NODE_ENV === 'test' ? '-test' : '')) || ospath.resolve('.antora/cache')
- : expandPath(preferredCacheDir, '~+', startDir)
- const cacheDir = ospath.join(baseCacheDir, CONTENT_CACHE_FOLDER)
- return fsp
- .mkdir(cacheDir, { recursive: true })
- .then(() => cacheDir)
- .catch((err) => {
- throw Object.assign(err, { message: `Failed to create content cache directory: ${cacheDir}; ${err.message}` })
- })
-}
-
-function transformGitCloneError (err, displayUrl) {
- let wrappedMsg
- let trimMessage
- if (HTTP_ERROR_CODE_RX.test(err.code)) {
- switch (err.data.statusCode) {
- case 401:
- wrappedMsg = err.rejected
- ? 'Content repository not found or credentials were rejected'
- : 'Content repository not found or requires credentials'
- break
- case 404:
- wrappedMsg = 'Content repository not found'
- break
- default:
- wrappedMsg = err.message
- trimMessage = true
- }
- } else if (err instanceof UrlParseError || err instanceof UnknownTransportError) {
- wrappedMsg = 'Content source uses an unsupported transport protocol'
- } else if (err.code === 'ENOTFOUND') {
- wrappedMsg = `Content repository host could not be resolved: ${err.hostname}`
- } else {
- wrappedMsg = `${err.name}: ${err.message}`
- trimMessage = true
- }
- if (trimMessage) {
- wrappedMsg = ~(wrappedMsg = wrappedMsg.trimRight()).indexOf('. ') ? wrappedMsg : wrappedMsg.replace(/\.$/, '')
- }
- const wrappedErr = new Error(`${wrappedMsg} (url: ${displayUrl})`)
- wrappedErr.stack += `\nCaused by: ${err.stack || 'unknown'}`
- return wrappedErr
-}
-
-function coerceToString (value) {
- return value == null ? '' : String(value)
-}
-
-function cleanStartPath (value) {
- return value && ~value.indexOf('/') ? value.replace(SUPERFLUOUS_SEPARATORS_RX, '') : value
-}
-
-function findWorktrees (repo, patterns) {
- if (!patterns.length) return new Map()
- const linkedOnly = patterns[0] === '.' ? !(patterns = patterns.slice(1)) : true
- let worktreesDir
- return (patterns.length
- ? fsp
- .readdir((worktreesDir = ospath.join(repo.dir, '.git', 'worktrees')))
- .catch(invariably.emptyArray)
- .then((worktreeNames) => matcher(worktreeNames, [...patterns]))
- .then((worktreeNames) =>
- worktreeNames.length
- ? Promise.all(
- worktreeNames.map((worktreeName) => {
- const gitdir = ospath.resolve(worktreesDir, worktreeName)
- // NOTE uses name of worktree as branch name if HEAD is detached
- return git
- .currentBranch(Object.assign({}, repo, { gitdir }))
- .then((branch = worktreeName) =>
- fsp
- .readFile(ospath.join(gitdir, 'gitdir'), 'utf8')
- .then((contents) => ({ branch, dir: ospath.dirname(contents.trimRight()) }))
- )
- })
- ).then((entries) => entries.reduce((accum, it) => accum.set(it.branch, it.dir), new Map()))
- : new Map()
- )
- : Promise.resolve(new Map())
- ).then((worktrees) =>
- linkedOnly
- ? worktrees
- : git.currentBranch(repo).then((branch) => (branch ? worktrees.set(branch, repo.dir) : worktrees))
- )
-}
-
-module.exports = aggregateContent
-module.exports._computeOrigin = computeOrigin
diff --git a/node_modules/@antora/content-aggregator/lib/constants.js b/node_modules/@antora/content-aggregator/lib/constants.js
deleted file mode 100644
index 9179b31e..00000000
--- a/node_modules/@antora/content-aggregator/lib/constants.js
+++ /dev/null
@@ -1,25 +0,0 @@
-'use strict'
-
-module.exports = Object.freeze({
- COMPONENT_DESC_FILENAME: 'antora.yml',
- CONTENT_CACHE_FOLDER: 'content/2',
- CONTENT_GLOB: '**/*[!~]',
- FILE_MODES: { 100644: 0o100666 & ~process.umask(), 100755: 0o100777 & ~process.umask() },
- GIT_CORE: 'antora',
- GIT_OPERATION_LABEL_LENGTH: 8,
- GIT_PROGRESS_PHASES: ['Counting objects', 'Compressing objects', 'Receiving objects', 'Resolving deltas'],
- PICOMATCH_VERSION_OPTS: {
- bash: true,
- debug: false,
- dot: true,
- fastpaths: false,
- lookbehinds: false,
- noextglob: true,
- noglobstar: true,
- nonegate: true,
- noquantifiers: true,
- strictSlashes: true,
- },
- SYMLINK_FILE_MODE: '120000',
- VALID_STATE_FILENAME: 'valid',
-})
diff --git a/node_modules/@antora/content-aggregator/lib/decode-uint8-data.js b/node_modules/@antora/content-aggregator/lib/decode-uint8-data.js
deleted file mode 100644
index 7c9926ad..00000000
--- a/node_modules/@antora/content-aggregator/lib/decode-uint8-data.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict'
-
-module.exports = (({ StringDecoder }) => {
- const decoder = new StringDecoder()
- return decoder.write.bind(decoder)
-})(require('string_decoder'))
diff --git a/node_modules/@antora/content-aggregator/lib/file.js b/node_modules/@antora/content-aggregator/lib/file.js
deleted file mode 100644
index 3fe11708..00000000
--- a/node_modules/@antora/content-aggregator/lib/file.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict'
-
-const Vinyl = require('vinyl')
-
-class File extends Vinyl {
- get path () {
- return this.history[this.history.length - 1]
- }
-
- set path (path_) {
- this.history.push(path_)
- }
-
- get relative () {
- return this.history[this.history.length - 1]
- }
-}
-
-module.exports = File
diff --git a/node_modules/@antora/content-aggregator/lib/flatten-deep.js b/node_modules/@antora/content-aggregator/lib/flatten-deep.js
deleted file mode 100644
index 28e51f41..00000000
--- a/node_modules/@antora/content-aggregator/lib/flatten-deep.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-function flattenDeep (array, accum = []) {
- const len = array.length
- for (let i = 0, it; i < len; i++) {
- Array.isArray((it = array[i])) ? flattenDeep(it, accum) : accum.push(it)
- }
- return accum
-}
-
-module.exports = flattenDeep
diff --git a/node_modules/@antora/content-aggregator/lib/git-credential-manager-store.js b/node_modules/@antora/content-aggregator/lib/git-credential-manager-store.js
deleted file mode 100644
index 9b65890a..00000000
--- a/node_modules/@antora/content-aggregator/lib/git-credential-manager-store.js
+++ /dev/null
@@ -1,115 +0,0 @@
-'use strict'
-
-const { homedir } = require('os')
-const expandPath = require('@antora/expand-path-helper')
-const { promises: fsp } = require('fs')
-const ospath = require('path')
-
-class GitCredentialManagerStore {
- configure ({ config, startDir }) {
- this.entries = undefined
- this.urls = {}
- if ((this.contents = (config = config || {}).contents)) {
- this.path = undefined
- } else if (config.path) {
- this.path = expandPath(config.path, '~+', startDir)
- } else {
- this.path = undefined
- }
- return this
- }
-
- async load () {
- if (this.entries) return this.entries
- return (this.entries = new Promise((resolve) => {
- let contentsPromise
- let delimiter = '\n'
- if (this.contents) {
- contentsPromise = Promise.resolve(this.contents)
- delimiter = /[,\n]/
- } else if (this.path) {
- contentsPromise = fsp
- .access(this.path)
- .then(() => fsp.readFile(this.path, 'utf8'))
- .catch(() => undefined)
- } else {
- const homeGitCredentialsPath = ospath.join(homedir(), '.git-credentials')
- const xdgConfigGitCredentialsPath = ospath.join(
- process.env.XDG_CONFIG_HOME || ospath.join(homedir(), '.config'),
- 'git',
- 'credentials'
- )
- contentsPromise = fsp
- .access(homeGitCredentialsPath)
- .then(() => fsp.readFile(homeGitCredentialsPath, 'utf8'))
- .catch(() =>
- fsp
- .access(xdgConfigGitCredentialsPath)
- .then(() => fsp.readFile(xdgConfigGitCredentialsPath, 'utf8'))
- .catch(() => undefined)
- )
- }
- contentsPromise.then((contents) => {
- if (contents) {
- resolve(
- contents
- .trim()
- .split(delimiter)
- .reduce((accum, url) => {
- try {
- const { username, password, hostname, pathname } = new URL(url)
- let credentials
- if (password) {
- credentials = { username: decodeURIComponent(username), password: decodeURIComponent(password) }
- } else if (username) {
- credentials = { username: decodeURIComponent(username), password: '' }
- } else {
- return accum
- }
- if (pathname === '/') {
- accum[hostname] = credentials
- } else {
- accum[hostname + pathname] = credentials
- if (!pathname.endsWith('.git')) accum[hostname + pathname + '.git'] = credentials
- }
- } catch {}
- return accum
- }, {})
- )
- } else {
- resolve({})
- }
- })
- }))
- }
-
- async fill ({ url }) {
- this.urls[url] = 'requested'
- return this.load().then((entries) => {
- if (!Object.keys(entries).length) return
- const { hostname, pathname } = new URL(url)
- return entries[hostname + pathname] || entries[hostname]
- })
- }
-
- async approved ({ url }) {
- this.urls[url] = 'approved'
- }
-
- async rejected ({ url, auth }) {
- this.urls[url] = 'rejected'
- const statusCode = 401
- const statusMessage = 'HTTP Basic: Access Denied'
- const err = new Error(`HTTP Error: ${statusCode} ${statusMessage}`)
- err.name = err.code = 'HttpError'
- err.data = { statusCode, statusMessage }
- if (auth) err.rejected = true
- throw err
- }
-
- status ({ url }) {
- return this.urls[url]
- }
-}
-
-module.exports = GitCredentialManagerStore
diff --git a/node_modules/@antora/content-aggregator/lib/git-plugin-http.js b/node_modules/@antora/content-aggregator/lib/git-plugin-http.js
deleted file mode 100644
index 33b886ba..00000000
--- a/node_modules/@antora/content-aggregator/lib/git-plugin-http.js
+++ /dev/null
@@ -1,62 +0,0 @@
-'use strict'
-
-const get = require('simple-get')
-
-function distillResponse (res) {
- const { url, method, statusCode, statusMessage, headers } = res
- return { url, method, statusCode, statusMessage, headers, body: res }
-}
-
-async function mergeBuffers (data) {
- if (!Array.isArray(data)) return data
- if (data.length === 1 && data[0] instanceof Buffer) return data[0]
- const buffers = []
- let offset = 0
- let size = 0
- for await (const chunk of data) {
- buffers.push(chunk)
- size += chunk.byteLength
- }
- data = new Uint8Array(size)
- for (const buffer of buffers) {
- data.set(buffer, offset)
- offset += buffer.byteLength
- }
- return Buffer.from(data.buffer)
-}
-
-module.exports = ({ httpProxy, httpsProxy, noProxy }, userAgent) => {
- if (httpsProxy || httpProxy) {
- const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent')
- const shouldProxy = require('should-proxy')
- return {
- async request ({ url, method, headers, body }) {
- headers['user-agent'] = userAgent
- body = await mergeBuffers(body)
- const proxy = url.startsWith('https:')
- ? { ProxyAgent: HttpsProxyAgent, url: httpsProxy }
- : { ProxyAgent: HttpProxyAgent, url: httpProxy }
- let agent
- if (proxy.url && shouldProxy(url, { no_proxy: noProxy })) {
- // see https://github.com/delvedor/hpagent/issues/18
- const { protocol, hostname, port, username, password } = new URL(proxy.url)
- const proxyUrl = { protocol, hostname, port, username: username || null, password: password || null }
- agent = new proxy.ProxyAgent({ proxy: proxyUrl })
- }
- return new Promise((resolve, reject) =>
- get({ url, method, agent, headers, body }, (err, res) => (err ? reject(err) : resolve(distillResponse(res))))
- )
- },
- }
- } else {
- return {
- async request ({ url, method, headers, body }) {
- headers['user-agent'] = userAgent
- body = await mergeBuffers(body)
- return new Promise((resolve, reject) =>
- get({ url, method, headers, body }, (err, res) => (err ? reject(err) : resolve(distillResponse(res))))
- )
- },
- }
- }
-}
diff --git a/node_modules/@antora/content-aggregator/lib/index.js b/node_modules/@antora/content-aggregator/lib/index.js
deleted file mode 100644
index a9f18c1e..00000000
--- a/node_modules/@antora/content-aggregator/lib/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-
-/**
- * Content Aggregator component for Antora
- *
- * Responsible for aggregating the content from multiple repositories and
- * references into a raw aggregate of virtual files that can be organized by a
- * subsequent step in the pipeline.
- *
- * @namespace content-aggregator
- */
-module.exports = require('./aggregate-content')
diff --git a/node_modules/@antora/content-aggregator/lib/resolve-path-globs.js b/node_modules/@antora/content-aggregator/lib/resolve-path-globs.js
deleted file mode 100644
index bfd2a000..00000000
--- a/node_modules/@antora/content-aggregator/lib/resolve-path-globs.js
+++ /dev/null
@@ -1,167 +0,0 @@
-'use strict'
-
-const { expand: expandBraces } = require('braces')
-const flattenDeep = require('./flatten-deep')
-const { promises: fsp } = require('fs')
-const git = require('isomorphic-git')
-const invariably = { true: () => true, false: () => false, void: () => undefined, emptyArray: () => [] }
-const { makeRe: makePicomatchRx } = require('picomatch')
-
-const RX_ESCAPE_EXCEPT_GLOB = /[.+?^${}()|[\]\\]/g
-const RX_MAGIC_DETECTOR = /[*{]/
-const RX_QUESTION_MARK = /\?/g
-const PICOMATCH_OPTS = { nobracket: true, noextglob: true, noglobstar: true, noquantifiers: true }
-const PICOMATCH_NEGATED_OPTS = { nobracket: true, noextglob: true, noquantifiers: true }
-
-function resolvePathGlobs (base, patterns, listDirents, retrievePath, tree = { path: '' }) {
- return patterns.reduce((paths, pattern) => {
- if (pattern.charAt() === '!') {
- return paths.then((resolvedPaths) => {
- if (resolvedPaths.length) {
- if (~pattern.indexOf('?')) pattern = pattern.replace(RX_QUESTION_MARK, '\\?')
- const rx = makePicomatchRx(pattern, PICOMATCH_NEGATED_OPTS)
- return resolvedPaths.filter(rx.test.bind(rx))
- } else {
- return resolvedPaths
- }
- })
- } else if (RX_MAGIC_DETECTOR.test(pattern)) {
- return glob(base, pattern.split('/'), listDirents, retrievePath, tree).then((nestedPaths) =>
- paths.then((resolvedPaths) => [...resolvedPaths, ...nestedPaths])
- )
- }
- return paths.then((resolvedPaths) => [...resolvedPaths, pattern])
- }, Promise.resolve([]))
-}
-
-async function glob (base, patternSegments, listDirents, retrievePath, { oid, path, globbed }) {
- let patternSegment = patternSegments[0]
- patternSegments = patternSegments.slice(1)
- if (RX_MAGIC_DETECTOR.test(patternSegment)) {
- let isMatch
- let explicit
- if (patternSegment === '*') {
- isMatch = (it) => it.charAt() !== '.'
- } else if (~patternSegment.indexOf('{')) {
- if (globbed) {
- if (patternSegment.charAt() === '!') patternSegment = '\\' + patternSegment
- if (~patternSegment.indexOf('?')) patternSegment = patternSegment.replace(RX_QUESTION_MARK, '\\?')
- isMatch = (isMatch = makePicomatchRx(patternSegment, PICOMATCH_OPTS)).test.bind(isMatch)
- } else if (~patternSegment.indexOf('*')) {
- const [wildPatterns, literals] = expandBraces(patternSegment).reduce(
- ([wild, literal], it) => (~it.indexOf('*') ? [[...wild, it], literal] : [wild, [...literal, it]]),
- [[], []]
- )
- isMatch = (isMatch = makeAlternationMatcherRx(wildPatterns)).test.bind(isMatch)
- explicit = new Set(literals)
- } else {
- return expandBraces(patternSegment).map((it) => joinPath(path, it))
- }
- } else {
- isMatch = (isMatch = makeMatcherRx(patternSegment)).test.bind(isMatch)
- }
- let dirents = await listDirents(base, oid || path)
- if (explicit) dirents = dirents.filter((dirent) => !explicit.has(dirent.name))
- const discovered = flattenDeep(
- await Promise.all(
- dirents.map((dirent) =>
- dirent.isDirectory() && isMatch(dirent.name)
- ? patternSegments.length
- ? glob(base, patternSegments, listDirents, retrievePath, {
- oid: dirent.oid,
- path: joinPath(path, dirent.name),
- globbed: true,
- })
- : joinPath(path, dirent.name)
- : []
- )
- )
- )
- return explicit ? [...[...explicit].map((it) => joinPath(path, it)), ...discovered] : discovered
- } else {
- const [magicBase, nextSegment] = extractMagicBase(patternSegments, patternSegment)
- patternSegment = magicBase
- if (nextSegment) {
- const obj = await retrievePath(base, { oid, path }, patternSegment)
- if (obj) {
- return glob(base, patternSegments, listDirents, retrievePath, {
- oid: obj.oid,
- path: joinPath(path, patternSegment),
- })
- } else if ((patternSegment += '/' + patternSegments.join('/')).indexOf('{')) {
- return expandBraces(patternSegment).map((it) => joinPath(path, it))
- } else {
- return [joinPath(path, patternSegment)]
- }
- } else if (globbed) {
- return (await retrievePath(base, { oid, path }, patternSegment)) ? [joinPath(path, patternSegment)] : []
- } else {
- return [joinPath(path, patternSegment)]
- }
- }
-}
-
-function regexpEscapeWithGlob (str) {
- // we don't escape "-" since it's meaningless in a literal
- return str.replace(RX_ESCAPE_EXCEPT_GLOB, '\\$&').replace('*', '.*')
-}
-
-function extractMagicBase (patternSegments, base) {
- let nextSegment
- if (patternSegments.length) {
- while ((nextSegment = patternSegments[0])) {
- if (RX_MAGIC_DETECTOR.test(nextSegment)) break
- base += '/' + patternSegments.shift()
- }
- }
- return [base, nextSegment]
-}
-
-function listDirentsFs (base, path) {
- return readdirWithFileTypes(base + '/' + path)
-}
-
-function listDirentsGit (repo, treeOid) {
- return git
- .readTree(Object.assign({ oid: treeOid, filepath: '' }, repo))
- .then(({ tree: entries }) =>
- entries.map(({ type, oid, path: name }) => ({ name, oid, isDirectory: invariably[type === 'tree'] }))
- )
- .catch(invariably.emptyArray)
-}
-
-function makeAlternationMatcherRx (patterns) {
- return new RegExp('^(?:' + patterns.map(patternToRx).join('|') + ')$')
-}
-
-function makeMatcherRx (pattern) {
- return new RegExp('^' + patternToRx(pattern) + '$')
-}
-
-function patternToRx (pattern) {
- return (pattern.charAt() === '.' ? '' : '(?!\\.)') + regexpEscapeWithGlob(pattern)
-}
-
-function readdirWithFileTypes (dir) {
- return fsp.readdir(dir, { withFileTypes: true }).catch(invariably.emptyArray)
-}
-
-function retrievePathFs (base, { path }, subpath) {
- return fsp
- .access(base + '/' + joinPath(path, subpath))
- .then(invariably.true)
- .catch(invariably.false)
-}
-
-function retrievePathGit (repo, { oid }, filepath) {
- return git.readObject(Object.assign({ oid, filepath, format: 'deflated' }, repo)).catch(invariably.void)
-}
-
-function joinPath (parent, child) {
- return parent ? parent + '/' + child : child
-}
-
-module.exports = {
- fs: (baseDir, patterns) => resolvePathGlobs(baseDir, patterns, listDirentsFs, retrievePathFs),
- git: (repo, oid, patterns) => resolvePathGlobs(repo, patterns, listDirentsGit, retrievePathGit, { oid }),
-}
diff --git a/node_modules/@antora/content-aggregator/package.json b/node_modules/@antora/content-aggregator/package.json
deleted file mode 100644
index d2b0f1aa..00000000
--- a/node_modules/@antora/content-aggregator/package.json
+++ /dev/null
@@ -1,97 +0,0 @@
-{
- "_from": "@antora/content-aggregator@3.0.0-alpha.7",
- "_id": "@antora/content-aggregator@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-YV98rAHCHQXTTAVovHl+RtGfU11mBhSB4rrlmpu2aZGAkSw8x2FMwAx72wJMkIhkWXmGQYdjS2g9jOXcYqjlCA==",
- "_location": "/@antora/content-aggregator",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/content-aggregator@3.0.0-alpha.7",
- "name": "@antora/content-aggregator",
- "escapedName": "@antora%2fcontent-aggregator",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/content-aggregator/-/content-aggregator-3.0.0-alpha.7.tgz",
- "_shasum": "7784a1191f07a63baace58673d67ad6749ac787a",
- "_spec": "@antora/content-aggregator@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- },
- {
- "name": "Hubert SABLONNIÈRE",
- "email": "hubert.sablonniere@gmail.com"
- },
- {
- "name": "Balachandran Sivakumar",
- "email": "balachandran@balachandran.org"
- }
- ],
- "dependencies": {
- "@antora/expand-path-helper": "~1.0",
- "braces": "~3.0",
- "cache-directory": "~2.0",
- "camelcase-keys": "~6.2",
- "hpagent": "~0.1.0",
- "isomorphic-git": "~1.8",
- "js-yaml": "~4.1",
- "matcher": "~4.0",
- "multi-progress": "~4.0",
- "picomatch": "~2.3",
- "progress": "~2.0",
- "should-proxy": "~1.0",
- "simple-get": "~4.0",
- "vinyl": "~2.2",
- "vinyl-fs": "~3.0"
- },
- "deprecated": false,
- "description": "Fetches and aggregates content from distributed sources for use in an Antora documentation pipeline.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "git",
- "isomorphic-git",
- "content",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/content-aggregator",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/content-classifier/LICENSE b/node_modules/@antora/content-classifier/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/content-classifier/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/content-classifier/README.md b/node_modules/@antora/content-classifier/README.md
deleted file mode 100644
index 05a78065..00000000
--- a/node_modules/@antora/content-classifier/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Antora Content Classifier
-
-The Content Classifier is a component in Antora responsible for organizing aggregated content into a virtual file catalog for use in an Antora documentation pipeline.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/content-classifier/lib/classify-content.js b/node_modules/@antora/content-classifier/lib/classify-content.js
deleted file mode 100644
index 568e4df8..00000000
--- a/node_modules/@antora/content-classifier/lib/classify-content.js
+++ /dev/null
@@ -1,166 +0,0 @@
-'use strict'
-
-const ContentCatalog = require('./content-catalog')
-
-/**
- * Organizes the raw aggregate of virtual files into a {ContentCatalog}.
- *
- * @memberof content-classifier
- *
- * @param {Object} playbook - The configuration object for Antora.
- * @param {Object} playbook.site - Site-related configuration data.
- * @param {String} playbook.site.startPage - The start page for the site; redirects from base URL.
- * @param {Object} playbook.urls - URL settings for the site.
- * @param {String} playbook.urls.htmlExtensionStyle - The style to use when computing page URLs.
- * @param {Object} aggregate - The raw aggregate of virtual file objects to be classified.
- * @param {Object} [siteAsciiDocConfig={}] - Site-wide AsciiDoc processor configuration options.
- * @returns {ContentCatalog} A structured catalog of content components and virtual content files.
- */
-function classifyContent (playbook, aggregate, siteAsciiDocConfig = {}) {
- const contentCatalog = new ContentCatalog(playbook)
- aggregate
- .reduce((accum, componentVersionData) => {
- const { name, version } = componentVersionData
- // drop startPage to defer registration of start page
- // drop files since they aren't needed to register component version
- const { files, startPage, ...descriptor } = Object.assign({}, componentVersionData, {
- asciidoc: resolveAsciiDocConfig(siteAsciiDocConfig, componentVersionData),
- })
- return new Map(accum).set(
- contentCatalog.registerComponentVersion(name, version, descriptor),
- componentVersionData
- )
- }, new Map())
- .forEach((componentVersionData, componentVersion) => {
- const { name, version } = componentVersion
- const { files, nav, startPage } = componentVersionData
- delete componentVersionData.files // clean up memory
- files.forEach((file) => allocateSrc(file, name, version, nav) && contentCatalog.addFile(file))
- contentCatalog.registerComponentVersionStartPage(name, componentVersion, startPage)
- })
- contentCatalog.registerSiteStartPage(playbook.site.startPage)
- return contentCatalog
-}
-
-function allocateSrc (file, component, version, nav) {
- const extname = file.src.extname
- const filepath = file.path
- const navInfo = nav && getNavInfo(filepath, nav)
- const pathSegments = filepath.split('/')
- if (navInfo) {
- if (extname !== '.adoc') return // ignore file
- file.nav = navInfo
- file.src.family = 'nav'
- if (pathSegments[0] === 'modules' && pathSegments.length > 2) {
- file.src.module = pathSegments[1]
- // relative to modules/
- file.src.relative = pathSegments.slice(2).join('/')
- file.src.moduleRootPath = calculateRootPath(pathSegments.length - 3)
- } else {
- // relative to root
- file.src.relative = filepath
- }
- } else if (pathSegments[0] === 'modules') {
- let familyFolder = pathSegments[2]
- switch (familyFolder) {
- case 'pages':
- // this location for partials is deprecated; warn starting in Antora 3.x
- if (pathSegments[3] === '_partials') {
- file.src.family = 'partial'
- // relative to modules//pages/_partials (deprecated)
- file.src.relative = pathSegments.slice(4).join('/')
- } else if (extname === '.adoc') {
- file.src.family = 'page'
- // relative to modules//pages
- file.src.relative = pathSegments.slice(3).join('/')
- } else {
- return // ignore file
- }
- break
- case 'assets':
- switch ((familyFolder = pathSegments[3])) {
- case 'attachments':
- case 'images':
- if (!extname) return // ignore file
- file.src.family = familyFolder.substr(0, familyFolder.length - 1)
- // relative to modules//assets/s
- file.src.relative = pathSegments.slice(4).join('/')
- break
- default:
- return // ignore file
- }
- break
- case 'attachments':
- case 'images':
- if (!extname) return
- file.src.family = familyFolder.substr(0, familyFolder.length - 1)
- // relative to modules//s
- file.src.relative = pathSegments.slice(3).join('/')
- break
- case 'examples':
- case 'partials':
- file.src.family = familyFolder.substr(0, familyFolder.length - 1)
- // relative to modules//s
- file.src.relative = pathSegments.slice(3).join('/')
- break
- default:
- return // ignore file
- }
- file.src.module = pathSegments[1]
- file.src.moduleRootPath = calculateRootPath(pathSegments.length - 3)
- } else {
- return // ignore file
- }
- file.src.component = component
- file.src.version = version
- return true
-}
-
-/**
- * Return navigation properties if this file is registered as a navigation file.
- *
- * @param {String} filepath - The path of the virtual file to match.
- * @param {Array} nav - The array of navigation entries from the component descriptor.
- *
- * @returns {Object} An object of properties, which includes the navigation
- * index, if this file is a navigation file, or undefined if it's not.
- */
-function getNavInfo (filepath, nav) {
- const index = nav.findIndex((candidate) => candidate === filepath)
- if (~index) return { index }
-}
-
-function resolveAsciiDocConfig (siteAsciiDocConfig, { asciidoc }) {
- const scopedAttributes = (asciidoc || {}).attributes
- if (scopedAttributes) {
- const siteAttributes = siteAsciiDocConfig.attributes
- if (siteAttributes) {
- const attributes = Object.keys(scopedAttributes).reduce((accum, name) => {
- if (name in siteAttributes) {
- const currentVal = siteAttributes[name]
- if (currentVal === false || String(currentVal).endsWith('@')) accum[name] = scopedAttributes[name]
- } else {
- accum[name] = scopedAttributes[name]
- }
- return accum
- }, {})
- return Object.keys(attributes).length
- ? Object.assign({}, siteAsciiDocConfig, { attributes: Object.assign({}, siteAttributes, attributes) })
- : siteAsciiDocConfig
- } else {
- return Object.assign({}, siteAsciiDocConfig, { attributes: scopedAttributes })
- }
- } else {
- return siteAsciiDocConfig
- }
-}
-
-function calculateRootPath (depth) {
- return depth
- ? Array(depth)
- .fill('..')
- .join('/')
- : '.'
-}
-
-module.exports = classifyContent
diff --git a/node_modules/@antora/content-classifier/lib/constants.js b/node_modules/@antora/content-classifier/lib/constants.js
deleted file mode 100644
index 378497b7..00000000
--- a/node_modules/@antora/content-classifier/lib/constants.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict'
-
-module.exports = Object.freeze({
- START_ALIAS_ID: Object.freeze({ component: '', version: '', module: '', family: 'alias', relative: 'index.adoc' }),
- START_PAGE_ID: Object.freeze({ component: '', version: '', module: '', family: 'page', relative: 'index.adoc' }),
-})
diff --git a/node_modules/@antora/content-classifier/lib/content-catalog.js b/node_modules/@antora/content-classifier/lib/content-catalog.js
deleted file mode 100644
index 76b5aa74..00000000
--- a/node_modules/@antora/content-classifier/lib/content-catalog.js
+++ /dev/null
@@ -1,565 +0,0 @@
-'use strict'
-
-const File = require('./file')
-const logger = require('./logger')
-const { lookup: resolveMimeType } = require('./mime-types-with-asciidoc')
-const parseResourceId = require('./util/parse-resource-id')
-const { posix: path } = require('path')
-const resolveResource = require('./util/resolve-resource')
-const versionCompare = require('./util/version-compare-desc')
-
-const { START_ALIAS_ID, START_PAGE_ID } = require('./constants')
-const SPACE_RX = / /g
-
-const $components = Symbol('components')
-const $files = Symbol('files')
-
-class ContentCatalog {
- constructor (playbook = {}) {
- this[$components] = new Map()
- this[$files] = new Map()
- const urls = playbook.urls || {}
- this.htmlUrlExtensionStyle = urls.htmlExtensionStyle || 'default'
- this.urlRedirectFacility = urls.redirectFacility || 'static'
- this.latestVersionUrlSegment = urls.latestVersionSegment
- this.latestPrereleaseVersionUrlSegment = urls.latestPrereleaseVersionSegment
- if (this.latestVersionUrlSegment == null && this.latestPrereleaseVersionUrlSegment == null) {
- this.latestVersionUrlSegmentStrategy = undefined
- } else {
- this.latestVersionUrlSegmentStrategy = urls.latestVersionSegmentStrategy || 'replace'
- if (this.latestVersionUrlSegmentStrategy === 'redirect:from') {
- if (!this.latestVersionUrlSegment) this.latestVersionUrlSegment = undefined
- if (!this.latestPrereleaseVersionUrlSegment) {
- this.latestPrereleaseVersionUrlSegment = undefined
- if (!this.latestVersionUrlSegment) this.latestVersionUrlSegmentStrategy = undefined
- }
- }
- }
- }
-
- /**
- * Registers a new component version with the content catalog. Also registers the component if it does not yet exist.
- *
- * @param {String} name - The name of the component to which this component version belongs.
- * @param {String} version - The version of the component to register.
- * @param {Object} [descriptor={}] - The configuration data for the component version.
- * @param {Object} [descriptor.asciidoc=undefined] - The AsciiDoc configuration for this component version.
- * @param {String} [descriptor.displayVersion=version] - The display version for this component version.
- * @param {Boolean|String} [descriptor.prerelease=undefined] - The prerelease flag for this version. If the value
- * is a String, it implies true and is appended to the display version, separated if necessary by a space.
- * @param {Boolean|String} [descriptor.startPage=undefined] - The page specifier for the start page. The start page
- * is only registered if this property is truthy. A String value will be used to resolve a start page within this
- * component version. A true value is a special case to tell this method to register the default start page and is
- * intended for testing.
- * @param {String} [descriptor.title=name] - The title for this component version.
- */
- registerComponentVersion (name, version, descriptor = {}) {
- const { asciidoc, displayVersion, prerelease, startPage: startPageSpec, title } = descriptor
- const componentVersion = { displayVersion: displayVersion || version || 'default', title: title || name, version }
- Object.defineProperty(componentVersion, 'name', { value: name, enumerable: true })
- if (prerelease) {
- componentVersion.prerelease = prerelease
- if (!displayVersion && prerelease.constructor === String) {
- if (version) {
- const ch0 = prerelease.charAt()
- componentVersion.displayVersion = `${version}${ch0 === '-' || ch0 === '.' ? '' : ' '}${prerelease}`
- } else {
- componentVersion.displayVersion = prerelease
- }
- }
- }
- if (asciidoc) componentVersion.asciidoc = asciidoc
- const component = this[$components].get(name)
- if (component) {
- const componentVersions = component.versions
- const insertIdx = componentVersions.findIndex(({ version: candidate }) => {
- if (candidate === version) throw new Error(`Duplicate version detected for component ${name}: ${version}`)
- return versionCompare(candidate, version) > 0
- })
- if (~insertIdx) {
- componentVersions.splice(insertIdx, 0, componentVersion)
- } else {
- componentVersions.push(componentVersion)
- }
- if ((component.latest = componentVersions.find((candidate) => !candidate.prerelease))) {
- if (componentVersions[0] !== component.latest) component.latestPrerelease = componentVersions[0]
- } else {
- component.latest = componentVersions[0]
- }
- } else {
- this[$components].set(
- name,
- Object.defineProperties(
- { name, latest: componentVersion, versions: [componentVersion] },
- {
- asciidoc: {
- get () {
- return this.latest.asciidoc
- },
- },
- title: {
- get () {
- return this.latest.title
- },
- },
- url: {
- get () {
- return this.latest.url
- },
- },
- }
- )
- )
- }
- if (startPageSpec) {
- this.registerComponentVersionStartPage(name, componentVersion, startPageSpec === true ? undefined : startPageSpec)
- }
- return componentVersion
- }
-
- addFile (file) {
- const src = file.src
- let family = src.family
- const key = generateKey(src)
- if (this[$files].has(key)) {
- if (family === 'alias') {
- throw new Error(`Duplicate alias: ${generateResourceSpec(src)}`)
- } else {
- const details = [this.getById(src), file].map((it, idx) => ` ${idx + 1}: ${getFileLocation(it)}`).join('\n')
- if (family === 'nav') {
- throw new Error(`Duplicate nav in ${src.version}@${src.component}: ${file.path}\n${details}`)
- } else {
- throw new Error(`Duplicate ${family}: ${generateResourceSpec(src)}\n${details}`)
- }
- }
- }
- // NOTE: if the path property is not set, assume the src likely needs to be prepared
- // another option is to assume that if the file is not a vinyl object, the src likely needs to be prepared
- // a vinyl object is one indication the file was created and prepared by the content aggregator
- //if (!src.path) prepareSrc(src)
- //if (!File.isVinyl(file)) file = new File(file)
- if (!File.isVinyl(file)) {
- prepareSrc(src)
- file = new File(file)
- }
- if (family === 'alias') {
- src.mediaType = 'text/asciidoc'
- file.mediaType = 'text/html'
- // NOTE: an alias masquerades as the target file
- family = file.rel.src.family
- // QUESTION: should we preserve the mediaType property on file if already defined?
- } else if (!(file.mediaType = src.mediaType) && !('mediaType' in src)) {
- file.mediaType = src.mediaType = resolveMimeType(src.extname) || (family === 'page' ? 'text/asciidoc' : undefined)
- }
- let publishable
- let versionSegment
- if (file.out) {
- publishable = true
- } else if ('out' in file) {
- delete file.out
- } else if (
- (family === 'page' || family === 'image' || family === 'attachment') &&
- ('/' + src.relative).indexOf('/_') < 0
- ) {
- publishable = true
- versionSegment = computeVersionSegment.bind(this)(src.component, src.version)
- file.out = computeOut(src, family, versionSegment, this.htmlUrlExtensionStyle)
- }
- if (!file.pub && (publishable || family === 'nav')) {
- if (versionSegment == null) versionSegment = computeVersionSegment.bind(this)(src.component, src.version)
- file.pub = computePub(src, file.out, family, versionSegment, this.htmlUrlExtensionStyle)
- }
- this[$files].set(key, file)
- return file
- }
-
- findBy (criteria) {
- const criteriaEntries = Object.entries(criteria)
- const accum = []
- for (const candidate of this[$files].values()) {
- const candidateSrc = candidate.src
- if (criteriaEntries.every(([key, val]) => candidateSrc[key] === val)) accum.push(candidate)
- }
- return accum
- }
-
- getById ({ component, version, module: module_, family, relative }) {
- return this[$files].get(generateKey({ component, version, module: module_, family, relative }))
- }
-
- getByPath ({ component, version, path: path_ }) {
- for (const candidate of this[$files].values()) {
- if (candidate.path === path_ && candidate.src.component === component && candidate.src.version === version) {
- return candidate
- }
- }
- }
-
- getComponent (name) {
- return this[$components].get(name)
- }
-
- getComponentVersion (component, version) {
- return (component.versions || (this.getComponent(component) || {}).versions || []).find(
- ({ version: candidate }) => candidate === version
- )
- }
-
- getComponents () {
- return [...this[$components].values()]
- }
-
- getComponentsSortedBy (property) {
- return this.getComponents().sort((a, b) => a[property].localeCompare(b[property]))
- }
-
- getFiles () {
- return [...this[$files].values()]
- }
-
- getPages (filter) {
- const accum = []
- if (filter) {
- for (const candidate of this[$files].values()) {
- if (candidate.src.family === 'page' && filter(candidate)) accum.push(candidate)
- }
- } else {
- for (const candidate of this[$files].values()) {
- if (candidate.src.family === 'page') accum.push(candidate)
- }
- }
- return accum
- }
-
- // TODO add `follow` argument to control whether alias is followed
- getSiteStartPage () {
- return this.getById(START_PAGE_ID) || (this.getById(START_ALIAS_ID) || {}).rel
- }
-
- registerComponentVersionStartPage (name, componentVersion, startPageSpec = undefined) {
- let version = componentVersion.version
- if (version == null) {
- // QUESTION: should we warn or throw error if component version cannot be found?
- if (!(componentVersion = this.getComponentVersion(name, componentVersion))) return
- version = componentVersion.version
- }
- let startPage
- let startPageSrc
- const indexPageId = { component: name, version, module: 'ROOT', family: 'page', relative: 'index.adoc' }
- if (startPageSpec) {
- if (
- (startPage = this.resolvePage(startPageSpec, indexPageId)) &&
- (startPageSrc = startPage.src).component === name &&
- startPageSrc.version === version
- ) {
- if ((startPageSrc.module !== 'ROOT' || startPageSrc.relative !== 'index.adoc') && !this.getById(indexPageId)) {
- this.addFile({ src: Object.assign({}, indexPageId, { family: 'alias' }), rel: startPage })
- }
- } else {
- // TODO pass componentVersion as logObject
- logger.warn(
- 'Start page specified for %s@%s %s: %s',
- version,
- name,
- startPage === false ? 'has invalid syntax' : 'not found',
- startPageSpec
- )
- startPage = this.getById(indexPageId)
- }
- } else {
- startPage = this.getById(indexPageId)
- }
- if (startPage) {
- componentVersion.url = startPage.pub.url
- } else {
- // QUESTION: should we warn if the default start page cannot be found?
- const versionSegment = computeVersionSegment.bind(this)(name, version)
- componentVersion.url = computePub(
- (startPageSrc = prepareSrc(Object.assign({}, indexPageId, { family: 'page' }))),
- computeOut(startPageSrc, startPageSrc.family, versionSegment, this.htmlUrlExtensionStyle),
- startPageSrc.family,
- versionSegment,
- this.htmlUrlExtensionStyle
- ).url
- }
-
- const symbolicVersionAlias = createSymbolicVersionAlias(
- name,
- version,
- computeVersionSegment.bind(this)(name, version, 'alias'),
- this.latestVersionUrlSegmentStrategy
- )
- if (symbolicVersionAlias) this.addFile(symbolicVersionAlias)
- }
-
- registerSiteStartPage (startPageSpec) {
- if (!startPageSpec) return
- const rel = this.resolvePage(startPageSpec)
- if (rel) {
- return this.addFile({ src: Object.assign({}, START_ALIAS_ID), rel })
- } else if (rel === false) {
- logger.warn('Start page specified for site has invalid syntax: %s', startPageSpec)
- } else if (~startPageSpec.indexOf(':')) {
- logger.warn('Start page specified for site not found: %s', startPageSpec)
- } else {
- logger.warn('Missing component name in start page for site: %s', startPageSpec)
- }
- }
-
- // QUESTION should this be addPageAlias?
- registerPageAlias (spec, target) {
- // .adoc file extension will be required on ID spec for page alias starting in Antora 4 (possibly in Antora 3)
- const inferredSpec = spec.endsWith('.adoc') ? undefined : spec + '.adoc'
- const src = parseResourceId(inferredSpec || spec, target.src, 'page', ['page'])
- // QUESTION should we throw an error if alias is invalid?
- if (!src || (inferredSpec && src.relative === '.adoc')) return
- const component = this.getComponent(src.component)
- if (component) {
- // NOTE version is not set when alias specifies a component, but not a version
- if (src.version == null) src.version = component.latest.version
- const existingPage = this.getById(src)
- if (existingPage) {
- throw new Error(
- existingPage === target
- ? `Page cannot define alias that references itself: ${generateResourceSpec(src)}` +
- ` (specified as: ${spec})\n source: ${getFileLocation(existingPage)}`
- : `Page alias cannot reference an existing page: ${generateResourceSpec(src)} (specified as: ${spec})\n` +
- ` source: ${getFileLocation(target)}\n` +
- ` existing page: ${getFileLocation(existingPage)}`
- )
- }
- const existingAlias = this.getById(Object.assign({}, src, { family: 'alias' }))
- if (existingAlias) {
- throw new Error(
- `Duplicate alias: ${generateResourceSpec(src)} (specified as: ${spec})\n` +
- ` source: ${getFileLocation(target)}`
- )
- }
- } else if (src.version == null) {
- // QUESTION should we skip registering alias in this case?
- src.version = ''
- }
- src.family = 'alias'
- // NOTE the redirect producer will populate contents when the redirect facility is 'static'
- const alias = this.addFile({ src, rel: target })
- // NOTE record the first alias this target claims as the preferred one
- if (!target.rel) target.rel = alias
- return alias
- }
-
- /**
- * Attempts to resolve a string contextual page ID spec to a file in the catalog.
- *
- * Parses the specified contextual page ID spec into a page ID object, then attempts to lookup a
- * file with this page ID in the catalog. If a component is specified, but not a version, the
- * latest version of the component stored in the catalog is used. If a file cannot be resolved,
- * the function returns undefined. If the spec does not match the page ID syntax, this function
- * throws an error.
- *
- * @param {String} spec - The contextual page ID spec (e.g., version@component:module:topic/page.adoc).
- * @param {ContentCatalog} catalog - The content catalog in which to resolve the page file.
- * @param {Object} [ctx={}] - The context to use to qualified the contextual page ID.
- *
- * @return {File} The virtual file to which the contextual page ID spec refers, or undefined if the
- * file cannot be resolved.
- */
- resolvePage (spec, context = {}) {
- return this.resolveResource(spec, context, 'page', ['page'])
- }
-
- resolveResource (spec, context = {}, defaultFamily = undefined, permittedFamilies = undefined) {
- return resolveResource(spec, this, context, defaultFamily, permittedFamilies)
- }
-
- exportToModel () {
- return [
- this.findBy,
- { name: 'getAll', bind: (to) => this.getAll.bind(to) },
- this.getById,
- this.getComponent,
- this.getComponentVersion,
- this.getComponents,
- this.getComponentsSortedBy,
- this.getFiles,
- this.getPages,
- this.getSiteStartPage,
- this.resolvePage,
- this.resolveResource,
- ].reduce((proxy, method) => (proxy[method.name] = method.bind(this)) && proxy, new (class ContentCatalogProxy {})())
- }
-}
-
-/**
- * @deprecated superceded by getFiles(); scheduled to be removed in Antora 4
- */
-ContentCatalog.prototype.getAll = ContentCatalog.prototype.getFiles
-
-function generateKey ({ component, version, module: module_, family, relative }) {
- return `${version}@${component}:${module_}:${family}$${relative}`
-}
-
-function generateResourceSpec ({ component, version, module: module_, family, relative }, shorthand = true) {
- return (
- `${version}@${component}:${shorthand && module_ === 'ROOT' ? '' : module_}:` +
- (family === 'page' || family === 'alias' ? '' : `${family}$`) +
- relative
- )
-}
-
-function prepareSrc (src) {
- let { basename, extname, stem } = src
- let update
- if (basename == null) {
- update = true
- basename = path.basename(src.relative)
- }
- if (stem == null) {
- update = true
- if (extname == null) {
- if (~(extname = basename.lastIndexOf('.'))) {
- stem = basename.substr(0, extname)
- extname = basename.substr(extname)
- } else {
- stem = basename
- extname = ''
- }
- } else {
- stem = basename.substr(0, basename.length - extname.length)
- }
- } else if (extname == null) {
- update = true
- extname = basename.substr(stem.length)
- }
- return update ? Object.assign(src, { basename, extname, stem }) : src
-}
-
-function computeOut (src, family, version, htmlUrlExtensionStyle) {
- let { component, module: module_, basename, extname, relative, stem } = src
- if (module_ === 'ROOT') module_ = ''
- let indexifyPathSegment = ''
- let familyPathSegment = ''
-
- if (family === 'page') {
- if (stem !== 'index' && htmlUrlExtensionStyle === 'indexify') {
- basename = 'index.html'
- indexifyPathSegment = stem
- } else if (extname === '.adoc') {
- basename = stem + '.html'
- }
- } else if (family === 'image') {
- familyPathSegment = '_images'
- } else if (family === 'attachment') {
- familyPathSegment = '_attachments'
- }
-
- const modulePath = path.join(component, version, module_)
- const dirname = path.join(modulePath, familyPathSegment, path.dirname(relative), indexifyPathSegment)
- const path_ = path.join(dirname, basename)
- const moduleRootPath = path.relative(dirname, modulePath) || '.'
- const rootPath = path.relative(dirname, '') || '.'
-
- return { dirname, basename, path: path_, moduleRootPath, rootPath }
-}
-
-function computePub (src, out, family, version, htmlUrlExtensionStyle) {
- const pub = {}
- let url
- if (family === 'nav') {
- const urlSegments = version ? [src.component, version] : [src.component]
- if (src.module && src.module !== 'ROOT') urlSegments.push(src.module)
- // an artificial URL used for resolving page references in navigation model
- url = '/' + urlSegments.join('/') + '/'
- pub.moduleRootPath = '.'
- } else if (family === 'page') {
- const urlSegments = out.path.split('/')
- const lastUrlSegmentIdx = urlSegments.length - 1
- if (htmlUrlExtensionStyle === 'drop') {
- // drop just the .html extension or, if the filename is index.html, the whole segment
- const lastUrlSegment = urlSegments[lastUrlSegmentIdx]
- urlSegments[lastUrlSegmentIdx] =
- lastUrlSegment === 'index.html' ? '' : lastUrlSegment.substr(0, lastUrlSegment.length - 5)
- } else if (htmlUrlExtensionStyle === 'indexify') {
- urlSegments[lastUrlSegmentIdx] = ''
- }
- url = '/' + urlSegments.join('/')
- } else {
- url = '/' + out.path
- if (family === 'alias' && !src.relative.length) pub.splat = true
- }
-
- pub.url = ~url.indexOf(' ') ? url.replace(SPACE_RX, '%20') : url
-
- if (out) {
- pub.moduleRootPath = out.moduleRootPath
- pub.rootPath = out.rootPath
- }
-
- return pub
-}
-
-function computeVersionSegment (name, version, mode) {
- if (mode === 'original') return !version || version === 'master' ? '' : version
- const strategy = this.latestVersionUrlSegmentStrategy
- // NOTE: special exception; revisit in Antora 3
- if (!version || version === 'master') {
- if (mode !== 'alias') return ''
- if (strategy === 'redirect:to') return
- }
- if (strategy === 'redirect:to' || strategy === (mode === 'alias' ? 'redirect:from' : 'replace')) {
- const component = this.getComponent(name)
- const componentVersion = component && this.getComponentVersion(component, version)
- if (componentVersion) {
- const segment =
- componentVersion === component.latest
- ? this.latestVersionUrlSegment
- : componentVersion === component.latestPrerelease
- ? this.latestPrereleaseVersionUrlSegment
- : undefined
- return segment == null ? version : segment
- }
- }
- return version
-}
-
-function createSymbolicVersionAlias (component, version, symbolicVersionSegment, strategy) {
- if (symbolicVersionSegment == null || symbolicVersionSegment === version) return
- const family = 'alias'
- const baseVersionAliasSrc = { component, module: 'ROOT', family, relative: '', basename: '', stem: '', extname: '' }
- const symbolicVersionAliasSrc = Object.assign({}, baseVersionAliasSrc, { version: symbolicVersionSegment })
- const symbolicVersionAlias = {
- src: symbolicVersionAliasSrc,
- pub: computePub(
- symbolicVersionAliasSrc,
- computeOut(symbolicVersionAliasSrc, family, symbolicVersionSegment),
- family
- ),
- }
- const originalVersionAliasSrc = Object.assign({}, baseVersionAliasSrc, { version })
- const originalVersionSegment = computeVersionSegment(component, version, 'original')
- const originalVersionAlias = {
- src: originalVersionAliasSrc,
- pub: computePub(
- originalVersionAliasSrc,
- computeOut(originalVersionAliasSrc, family, originalVersionSegment),
- family
- ),
- }
- if (strategy === 'redirect:to') {
- originalVersionAlias.out = undefined
- originalVersionAlias.rel = symbolicVersionAlias
- return originalVersionAlias
- } else {
- symbolicVersionAlias.out = undefined
- symbolicVersionAlias.rel = originalVersionAlias
- return symbolicVersionAlias
- }
-}
-
-function getFileLocation ({ path: path_, src: { abspath, origin } }) {
- return (
- abspath ||
- (origin ? `${path.join(origin.startPath, path_)} in ${origin.url} (ref: ${origin.branch || origin.tag})` : path_)
- )
-}
-
-module.exports = ContentCatalog
diff --git a/node_modules/@antora/content-classifier/lib/file.js b/node_modules/@antora/content-classifier/lib/file.js
deleted file mode 100644
index 3fe11708..00000000
--- a/node_modules/@antora/content-classifier/lib/file.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'use strict'
-
-const Vinyl = require('vinyl')
-
-class File extends Vinyl {
- get path () {
- return this.history[this.history.length - 1]
- }
-
- set path (path_) {
- this.history.push(path_)
- }
-
- get relative () {
- return this.history[this.history.length - 1]
- }
-}
-
-module.exports = File
diff --git a/node_modules/@antora/content-classifier/lib/index.js b/node_modules/@antora/content-classifier/lib/index.js
deleted file mode 100644
index 1501b698..00000000
--- a/node_modules/@antora/content-classifier/lib/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-
-/**
- * Content Classifier component for Antora
- *
- * Organizes virtual files in the raw aggregate into a virtual content
- * catalog. This catalog can be used by other components in Antora to find
- * files by select properties, such as family, component, or version.
- *
- * @namespace content-classifier
- */
-module.exports = require('./classify-content')
diff --git a/node_modules/@antora/content-classifier/lib/logger.js b/node_modules/@antora/content-classifier/lib/logger.js
deleted file mode 100644
index 3cafb475..00000000
--- a/node_modules/@antora/content-classifier/lib/logger.js
+++ /dev/null
@@ -1,3 +0,0 @@
-'use strict'
-
-module.exports = require('@antora/logger')(require('../package.json').name)
diff --git a/node_modules/@antora/content-classifier/lib/mime-types-with-asciidoc.js b/node_modules/@antora/content-classifier/lib/mime-types-with-asciidoc.js
deleted file mode 100644
index 1e964ed7..00000000
--- a/node_modules/@antora/content-classifier/lib/mime-types-with-asciidoc.js
+++ /dev/null
@@ -1,8 +0,0 @@
-'use strict'
-
-const mimeTypes = require('mime-types')
-
-mimeTypes.types.adoc = 'text/asciidoc'
-mimeTypes.extensions['text/asciidoc'] = ['adoc']
-
-module.exports = mimeTypes
diff --git a/node_modules/@antora/content-classifier/lib/util/parse-resource-id.js b/node_modules/@antora/content-classifier/lib/util/parse-resource-id.js
deleted file mode 100644
index 33cdfde2..00000000
--- a/node_modules/@antora/content-classifier/lib/util/parse-resource-id.js
+++ /dev/null
@@ -1,68 +0,0 @@
-'use strict'
-
-// matches pattern version@component:module:family$relative
-// ex. 1.0@antora:asciidoc:syntax/lists.adoc
-const RESOURCE_ID_RX = /^(?:([^@:$]+)@)?(?:(?:([^@:$]+):)?(?:([^@:$]+))?:)?(?:([^@:$]+)\$)?([^:$][^@:$]*)$/
-const RESOURCE_ID_RX_GROUP = { version: 1, component: 2, module: 3, family: 4, relative: 5 }
-
-/**
- * Parses a contextual resource ID spec into a file src object.
- *
- * Parses the specified resource ID spec to produce a resource ID object (an identifier shorthand
- * that corresponds to the identity stored in the src property of a virtual file). If a context
- * object is provided, it will be used to qualify the identifier, populating the component, version,
- * and/or module properties, as necessary.
- *
- * * If a component is specified, but a version is not, the version remains undefined.
- * * If a component is specified, but a module is not, the module defaults to "ROOT".
- * * If the family is not specified, the default family is used.
- * * If the family is specified, it is validated against the permitted families.
- *
- * @memberof content-classifier
- *
- * @param {String} spec - The contextual resource ID spec (e.g., version@component:module:family$relative).
- * @param {Object} [ctx={}] - The src context.
- * @param {String} [defaultFamily='page'] - The default family to use if family is not specified in the spec.
- * This value is always used instead of family value provided by the ctx.
- * @param {Array} [permittedFamilies=undefined] - An optional array of family names to allow.
- *
- * @returns {Object} A resource ID object that can be used to look up the file in the content
- * catalog. If the spec is malformed, the return value is undefined.
- */
-function parseResourceId (spec, ctx = {}, defaultFamily = 'page', permittedFamilies = undefined) {
- const match = spec.match(RESOURCE_ID_RX)
- if (!match) return
-
- let version = match[RESOURCE_ID_RX_GROUP.version]
- let component = match[RESOURCE_ID_RX_GROUP.component]
- let module_ = match[RESOURCE_ID_RX_GROUP.module]
- let family = match[RESOURCE_ID_RX_GROUP.family]
- let relative = match[RESOURCE_ID_RX_GROUP.relative]
-
- if (version === '_') version = ''
-
- if (component) {
- if (!module_) module_ = 'ROOT'
- } else {
- component = ctx.component
- if (version == null) version = ctx.version
- if (!module_) module_ = ctx.module
- }
-
- if (family) {
- if (permittedFamilies && !permittedFamilies.includes(family)) family = undefined
- } else {
- family = defaultFamily
- }
-
- if (~relative.indexOf('/')) {
- relative = relative
- .split('/')
- .filter((it) => it && it !== '.' && it !== '..')
- .join('/')
- }
-
- return { component, version, module: module_, family, relative }
-}
-
-module.exports = parseResourceId
diff --git a/node_modules/@antora/content-classifier/lib/util/resolve-resource.js b/node_modules/@antora/content-classifier/lib/util/resolve-resource.js
deleted file mode 100644
index a9dc5a03..00000000
--- a/node_modules/@antora/content-classifier/lib/util/resolve-resource.js
+++ /dev/null
@@ -1,44 +0,0 @@
-'use strict'
-
-const parseResourceId = require('./parse-resource-id')
-
-/**
- * Attempts to resolve a contextual resource ID spec to a file in the catalog.
- *
- * Parses the specified contextual resource ID spec into a resource ID object using parseResourceId,
- * then attempts to locate a file with this resource ID in the catalog. If a component is specified, but
- * not a version, the latest version of the component is used from the catalog. If a file cannot be
- * resolved, and the family is "page", then the search is attempted again for an "alias". If a file
- * still cannot be found, the function returns undefined. If the spec does not match the resource ID
- * syntax, or the specified family is not permitted, this function returns false.
- *
- * @memberof content-classifier
- *
- * @param {String} spec - The contextual resource ID spec (e.g., version@component:module:family$relative).
- * @param {ContentCatalog} catalog - The content catalog in which to resolve the page file.
- * @param {Object} [ctx={}] - The src context.
- * @param {String} [defaultFamily=undefined] - The default family to use if family is not specified in spec.
- * The value "page" is used if not specified. This value is always used instead of family value provided by the ctx.
- * @param {Array} [permittedFamilies=undefined] - An optional array of family names to allow.
- *
- * @return {File} The virtual file to which the contextual resource ID spec refers, undefined if
- * the file cannot be resolved, or false if the resource ID spec is invalid.
- */
-function resolveResource (spec, catalog, ctx = {}, defaultFamily = undefined, permittedFamilies = undefined) {
- const id = parseResourceId(spec, ctx, defaultFamily, permittedFamilies)
-
- if (!id || !id.family) return false
- if (id.version == null) {
- const component = catalog.getComponent(id.component)
- if (!component) return
- id.version = component.latest.version
- }
- if (!id.module) id.module = 'ROOT'
-
- return (
- catalog.getById(id) ||
- (id.family === 'page' ? (catalog.getById(Object.assign({}, id, { family: 'alias' })) || {}).rel : undefined)
- )
-}
-
-module.exports = resolveResource
diff --git a/node_modules/@antora/content-classifier/lib/util/version-compare-desc.js b/node_modules/@antora/content-classifier/lib/util/version-compare-desc.js
deleted file mode 100644
index 222e0cf8..00000000
--- a/node_modules/@antora/content-classifier/lib/util/version-compare-desc.js
+++ /dev/null
@@ -1,86 +0,0 @@
-'use strict'
-
-const NUMBERS = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
-const { isInteger } = Number
-
-/**
- * An augmented semantic version comparison function.
- *
- * Augments the semantic version comparison algorithm with the following enhancements:
- *
- * * Discard the leading "v" character, if present and the version string is a semantic version.
- * * Compare non-semantic versions as strings in reverse alphabetical order (e.g., xenial comes before trusty).
- * * Compare semantic versions in descending order (e.g., 2.0.0 comes before 1.0.0).
- *
- * This function assumes that the string is a semantic version if it begins with a number (or a "v"
- * followed by a number) and contains a "." character or it's a parsable number.
- *
- * @param {String} a - The left version string.
- * @param {String} b - The right version string.
- * @returns 0 if the versions match, -1 if a is greater, or 1 if b is greater.
- */
-function versionCompareDesc (a, b) {
- if (a === b) return 0
- if (a && b) {
- const semverA = resolveSemver(a)
- const semverB = resolveSemver(b)
- if (semverA) {
- return semverB ? -semverCompare(semverA, semverB) : 1
- } else {
- return semverB ? -1 : -a.localeCompare(b, 'en', { numeric: true })
- }
- }
- return a ? 1 : -1
-}
-
-function resolveSemver (str) {
- const chr0 = str.charAt()
- if (chr0 === 'v') {
- if (isDigit(str.charAt(1)) && (str = str.substr(1)) && (~str.indexOf('.') || isDigit(str.charAt()))) {
- return str
- }
- } else if (isDigit(chr0) && (~str.indexOf('.') || isInteger(Number(str)))) {
- return str
- }
-}
-
-function isDigit (chr) {
- return NUMBERS.includes(chr)
-}
-
-function semverCompare (a, b) {
- let preA
- let preB
- const preOffsetA = a.indexOf('-')
- const preOffsetB = b.indexOf('-')
- if (~preOffsetA) {
- preA = a.substr(preOffsetA + 1)
- a = a.substr(0, preOffsetA)
- }
- if (~preOffsetB) {
- preB = b.substr(preOffsetB + 1)
- b = b.substr(0, preOffsetB)
- }
- const numsA = a.split('.')
- const numsB = b.split('.')
- for (let i = 0; i < 3; i++) {
- const numA = Number(numsA[i] || 0)
- const numB = Number(numsB[i] || 0)
- if (numA > numB) {
- return 1
- } else if (numB > numA) {
- return -1
- } else if (isNaN(numA)) {
- if (!isNaN(numB)) return -1
- } else if (isNaN(numB)) {
- return 1
- }
- }
- if (preA == null) {
- return preB == null ? 0 : 1
- } else {
- return preB == null ? -1 : preA.localeCompare(preB, 'en', { numeric: true })
- }
-}
-
-module.exports = versionCompareDesc
diff --git a/node_modules/@antora/content-classifier/package.json b/node_modules/@antora/content-classifier/package.json
deleted file mode 100644
index bac950d2..00000000
--- a/node_modules/@antora/content-classifier/package.json
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "_from": "@antora/content-classifier@3.0.0-alpha.7",
- "_id": "@antora/content-classifier@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-/hb5MN6ynBdHzvA54cPWbo4/68QrA6/K/zROPh0V/x71OqqYcoC6Qtu3KIaFqBk/XmNCqbXWxMUISl+H5W++tQ==",
- "_location": "/@antora/content-classifier",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/content-classifier@3.0.0-alpha.7",
- "name": "@antora/content-classifier",
- "escapedName": "@antora%2fcontent-classifier",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/site-generator-default",
- "/@antora/site-mapper"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/content-classifier/-/content-classifier-3.0.0-alpha.7.tgz",
- "_shasum": "e564ff2be46a672e88e5551fb67d3f70ced7c436",
- "_spec": "@antora/content-classifier@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- },
- {
- "name": "Hubert SABLONNIÈRE",
- "email": "hubert.sablonniere@gmail.com"
- }
- ],
- "dependencies": {
- "@antora/logger": "3.0.0-alpha.7",
- "mime-types": "~2.1",
- "vinyl": "~2.2"
- },
- "deprecated": false,
- "description": "Organizes aggregated content into a virtual file catalog for use in an Antora documentation pipeline.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "content",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/content-classifier",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/document-converter/LICENSE b/node_modules/@antora/document-converter/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/document-converter/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/document-converter/README.md b/node_modules/@antora/document-converter/README.md
deleted file mode 100644
index 01ce257b..00000000
--- a/node_modules/@antora/document-converter/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Antora Document Converter
-
-The Document Converter is a component in Antora responsible for converting AsciiDoc documents to embeddable HTML for use in an Antora documentation pipeline.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/document-converter/lib/convert-document.js b/node_modules/@antora/document-converter/lib/convert-document.js
deleted file mode 100644
index 0899fa38..00000000
--- a/node_modules/@antora/document-converter/lib/convert-document.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict'
-
-const { loadAsciiDoc, extractAsciiDocMetadata } = require('@antora/asciidoc-loader')
-
-/**
- * Converts the contents on the specified file from AsciiDoc to embedded HTML.
- *
- * It first delegates to the AsciiDoc Loader to load the AsciiDoc contents on
- * the specified virtual file to a Document object. It then grabs the document
- * attributes from that Document and assigns them to the asciidoc.attributes
- * property on the file. If the document has a document header, it assigns the
- * doctitle, xreftext, and navtitle to the asciidoc property on that file. If
- * the page-partial attributes is set, it backs up the AsciiDoc source on the
- * src.contents property. It then converts the Document to embedded HTML, wraps
- * it in a Buffer, and assigns it to the contents property on the file. Finally,
- * the mediaType property is updated to 'text/html'.
- *
- * @memberof document-converter
- *
- * @param {File} file - The virtual file whose contents is an AsciiDoc source document.
- * @param {ContentCatalog} [contentCatalog=undefined] - The catalog of all virtual content files in the site.
- * @param {Object} [asciidocConfig={}] - AsciiDoc processor configuration options specific to this file.
- *
- * @returns {File} The virtual file that was converted.
- */
-function convertDocument (file, contentCatalog = undefined, asciidocConfig = {}) {
- const doc = loadAsciiDoc(file, contentCatalog, asciidocConfig)
- if (!file.asciidoc) {
- file.asciidoc = extractAsciiDocMetadata(doc)
- if (doc.hasAttribute('page-partial')) file.src.contents = file.contents
- }
- file.contents = Buffer.from(doc.convert())
- file.mediaType = 'text/html'
- return file
-}
-
-module.exports = convertDocument
diff --git a/node_modules/@antora/document-converter/lib/convert-documents.js b/node_modules/@antora/document-converter/lib/convert-documents.js
deleted file mode 100644
index 0694ba8c..00000000
--- a/node_modules/@antora/document-converter/lib/convert-documents.js
+++ /dev/null
@@ -1,77 +0,0 @@
-'use strict'
-
-const convertDocument = require('./convert-document')
-const { loadAsciiDoc, extractAsciiDocMetadata } = require('@antora/asciidoc-loader')
-
-/**
- * Converts the contents of publishable pages with the media type text/asciidoc
- * in the content catalog to embedded HTML.
- *
- * First finds all publishable AsciiDoc files (identified by the media type
- * text/asciidoc) in the page family in the content catalog. Then runs through
- * all those files and loads the document header into the asciidoc property on
- * the file and registers any page aliases. If the page-partial attribute is
- * set, it backs up the AsciiDoc source to the src.contents property. It then
- * runs through all the pages again and converts the contents to embedded HTML
- * by delegating to the convertDocument function. The function then returns all
- * the files in the page family (even those which don't have the media type
- * text/asciidoc). All the files returned from this function are intended to be
- * composed (i.e., wrapped in an HTML layout) by the page composer.
- *
- * @memberof document-converter
- *
- * @param {ContentCatalog} contentCatalog - The catalog of all virtual content files in the site.
- * @param {Object} [siteAsciiDocConfig={}] - Site-wide AsciiDoc processor configuration options.
- *
- * @returns {Array} The publishable virtual files in the page family taken from the content catalog.
- */
-function convertDocuments (contentCatalog, siteAsciiDocConfig = {}) {
- const mainAsciiDocConfigs = new Map()
- contentCatalog.getComponents().forEach(({ name: component, versions }) => {
- versions.forEach(({ version, asciidoc }) => {
- mainAsciiDocConfigs.set(buildCacheKey({ component, version }), asciidoc)
- })
- })
- const headerAsciiDocConfigs = new Map()
- const headerOverrides = { extensions: [], headerOnly: true }
- for (const [cacheKey, mainAsciiDocConfig] of mainAsciiDocConfigs) {
- headerAsciiDocConfigs.set(cacheKey, Object.assign({}, mainAsciiDocConfig, headerOverrides))
- }
- return contentCatalog
- .getPages((page) => page.out)
- .map((page) => {
- if (page.mediaType === 'text/asciidoc') {
- const asciidocConfig = headerAsciiDocConfigs.get(buildCacheKey(page.src))
- const { attributes } = (page.asciidoc = extractAsciiDocMetadata(
- loadAsciiDoc(page, contentCatalog, asciidocConfig || Object.assign({}, siteAsciiDocConfig, headerOverrides))
- ))
- Object.defineProperty(page, 'title', {
- get () {
- return this.asciidoc.doctitle
- },
- })
- registerPageAliases(attributes['page-aliases'], page, contentCatalog)
- if ('page-partial' in attributes) page.src.contents = page.contents
- }
- return page
- })
- .map((page) =>
- page.mediaType === 'text/asciidoc'
- ? convertDocument(page, contentCatalog, mainAsciiDocConfigs.get(buildCacheKey(page.src)) || siteAsciiDocConfig)
- : page
- )
- .map((page) => delete page.src.contents && page)
-}
-
-function buildCacheKey ({ component, version }) {
- return version + '@' + component
-}
-
-function registerPageAliases (aliases, targetFile, contentCatalog) {
- if (!aliases) return
- return aliases
- .split(',')
- .forEach((spec) => (spec = spec.trim()) && contentCatalog.registerPageAlias(spec, targetFile))
-}
-
-module.exports = Object.assign(convertDocuments, { convertDocuments, convertDocument })
diff --git a/node_modules/@antora/document-converter/lib/index.js b/node_modules/@antora/document-converter/lib/index.js
deleted file mode 100644
index 104f2851..00000000
--- a/node_modules/@antora/document-converter/lib/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-
-/**
- * Document Converter component for Antora
- *
- * Using the AsciiDoc Loader, converts the contents of AsciiDoc files to
- * embedded HTML and assigns AsciiDoc-related metadata, such as page attributes,
- * to the file.
- *
- * @namespace document-converter
- */
-module.exports = require('./convert-documents')
diff --git a/node_modules/@antora/document-converter/package.json b/node_modules/@antora/document-converter/package.json
deleted file mode 100644
index 9c7ed5b8..00000000
--- a/node_modules/@antora/document-converter/package.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "_from": "@antora/document-converter@3.0.0-alpha.7",
- "_id": "@antora/document-converter@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-nEs5idWvVDw1Ynq0IiqhgMxHSjxfFHgSgd2EW6M9Wam3nxBSMwzQ7G+QqkMLDnzJfk2HbAYseRlIMikyVMc5aQ==",
- "_location": "/@antora/document-converter",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/document-converter@3.0.0-alpha.7",
- "name": "@antora/document-converter",
- "escapedName": "@antora%2fdocument-converter",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/document-converter/-/document-converter-3.0.0-alpha.7.tgz",
- "_shasum": "2bd565ef08d34384f8091cf98dbcad5985f012ab",
- "_spec": "@antora/document-converter@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- },
- {
- "name": "Guillaume Grossetie",
- "email": "g.grossetie@gmail.com"
- },
- {
- "name": "Hubert SABLONNIÈRE",
- "email": "hubert.sablonniere@gmail.com"
- }
- ],
- "dependencies": {
- "@antora/asciidoc-loader": "3.0.0-alpha.7"
- },
- "deprecated": false,
- "description": "Converts AsciiDoc documents to embeddable HTML for use in an Antora documentation pipeline.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "asciidoc",
- "asciidoctor",
- "converter",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/document-converter",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/expand-path-helper/CHANGELOG.adoc b/node_modules/@antora/expand-path-helper/CHANGELOG.adoc
deleted file mode 100644
index 8468264f..00000000
--- a/node_modules/@antora/expand-path-helper/CHANGELOG.adoc
+++ /dev/null
@@ -1,31 +0,0 @@
-= Changelog
-
-This document provides a summary of all notable changes by release.
-For a detailed view of what's changed, refer to the repository's https://gitlab.com/antora/expand-path-helper/commits/master[commit history].
-
-== 1.0.0 (2018-02-27)
-
-* initial stable release
-* test cases when parameters are explicitly undefined
-
-== 1.0.0-rc.3 (2018-02-23)
-
-* BREAKING: change order of parameters to `path, start = '~+', dot = '.'`
-* link leading dot segment to start value by default
-* allow both start and dot parameters to accept an arbitrary path
-* allow start and dot parameters to be controlled independently
-* rewrite tests to match new parameter order
-* update API doc and README
-* clarify in README that function generates paths which are system dependent
-* add npm package badge to README
-
-== 1.0.0-rc.2 (2018-02-22)
-
-* add third argument to make default prefix for relative path configurable
-* use `+~` as default value for default prefix
-* add API docs and more examples to README
-* switch README to AsciiDoc; add scripts to include Markdown version in package
-
-== 1.0.0-rc.1 (2018-02-22)
-
-* initial release
diff --git a/node_modules/@antora/expand-path-helper/LICENSE b/node_modules/@antora/expand-path-helper/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/expand-path-helper/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/expand-path-helper/README.md b/node_modules/@antora/expand-path-helper/README.md
deleted file mode 100644
index 274e96ed..00000000
--- a/node_modules/@antora/expand-path-helper/README.md
+++ /dev/null
@@ -1,111 +0,0 @@
-# @antora/expand-path-helper
-
-A module for Node.js that provides a helper function to expand a path to an absolute path.
-This function expands the first segment if it matches a shorthand expression, dot (`.`), tilde (`~`), or tilde plus (`~+`).
-The expanded path is system dependent.
-Developed for use in Antora.
-
-## Install
-
-```sh
-$ npm i @antora/expand-path-helper
-```
-
-or
-
-```sh
-$ yarn add @antora/expand-path-helper
-```
-
-## API
-
-```js
-function expandPath (path, start = '~+', dot = '.') { ... }
-```
-
-Converts path to an absolute path.
-
-* `path` - The path to expand.
-This parameter is required and must not be falsy.
-* `start` - The starting directory from which to anchor a relative path.
-This parameter is optional.
-It defaults to the current working directory of the process (`~+`).
-* `dot` - The value to use to replace a leading dot (`.`) segment.
-This parameter is optional.
-If the value of this parameter is itself `.`, which is the default, it uses the value of the start parameter.
-
-The main purpose of this function is path expansion.
-If the first segment of the path, the value of the start parameter, or the value of the dot parameter matches `~` or `~+`, that value is expanded to the user's home directory or current working directory, respectively.
-If the first segment of the path matches `.`, that value is replaced with the value of the dot parameter after being expanded.
-
-## Usage
-
-The output of `expandPath` depends on the system on which it is run (specifically on the `path.sep` value).
-
-### *nix
-
-```js
-const expandPath = require('@antora/expand-path-helper')
-
-expandPath('/absolute/path')
-//=> /absolute/path
-
-expandPath('foo/bar')
-//=> /current/directory/foo/bar
-
-expandPath('./foo/bar')
-//=> /current/directory/foo/bar
-
-expandPath('~/foo/bar')
-//=> /home/user/foo/bar
-
-expandPath('~+/foo/bar')
-//=> /current/directory/foo/bar
-
-expandPath('foo/bar', '/start/dir')
-//=> /start/dir/foo/bar
-
-expandPath('./foo/bar', '/start/dir')
-//=> /start/dir/foo/bar
-
-expandPath('./foo/bar', '~+', '/start/dir')
-//=> /start/dir/foo/bar
-```
-
-### Windows
-
-```js
-const expandPath = require('@antora/expand-path-helper')
-
-expandPath('C:\\absolute\\path')
-//=> C:\absolute\path
-
-expandPath('foo\\bar')
-//=> C:\current\directory\foo\bar
-
-expandPath('.\\foo\\bar')
-//=> C:\current\directory\foo\bar
-
-expandPath('~\\foo\\bar')
-//=> C:\Users\user\foo\bar
-
-expandPath('~+\\foo\\bar')
-//=> C:\current\directory\foo\bar
-
-expandPath('foo\\bar', 'C:\\start\\dir')
-//=> C:\start\dir\foo\bar
-
-expandPath('.\\foo\\bar', 'C:\\start\\dir')
-//=> C:\start\dir\foo\bar
-
-expandPath('.\\foo\\bar', '~+', 'C:\\start\\dir')
-//=> C:\start\dir\foo\bar
-```
-
-On Windows, the input path may contain forward slashes, but the expanded path will always have backslashes.
-
-## Copyright and License
-
-Copyright (C) 2018 OpenDevise Inc. and the Antora Project.
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/expand-path-helper/lib/index.js b/node_modules/@antora/expand-path-helper/lib/index.js
deleted file mode 100644
index 5e81330d..00000000
--- a/node_modules/@antora/expand-path-helper/lib/index.js
+++ /dev/null
@@ -1,59 +0,0 @@
-'use strict'
-
-const { cwd } = process
-const { homedir } = require('os')
-const { isAbsolute, join, normalize, resolve, sep } = require('path')
-
-const SEPARATOR_CC = sep === '\\' ? '[/\\\\]' : '/'
-const DOT_RELATIVE_RX = new RegExp(`^\\.${SEPARATOR_CC}`)
-const HOME_RELATIVE_RX = new RegExp(`^~${SEPARATOR_CC}`)
-const PWD_RELATIVE_RX = new RegExp(`^~\\+${SEPARATOR_CC}`)
-
-/**
- * Converts path to an absolute path.
- *
- * If path is absolute, its value is normalized. If the first segment of path
- * is a tilde (~), that segment is replaced with the home directory of the
- * current user. If the first segment of path is a tilde followed by a plus
- * (~+), that segment is replaced with the current working directory of the
- * process. If path is relative, path is resolved starting from start. If path
- * has a leading dot (.) segment, that segment is replaced with dot after that
- * value is expanded.
- *
- * @param {String} path - The path to expand.
- * @param {String} [start='~+'] - The path to use as a starting point for a
- * relative path. Unless absolute, the value will first be expanded starting
- * from the current working directory of the process.
- * @param {String} [dot='.'] - The value used to replace a leading dot segment.
- * If the value is '.', then the start value is used.
- *
- * @returns {String} An absolute path.
- */
-function expandPath (path, start = '~+', dot = '.') {
- if (path === '.') {
- if (dot === '.') dot = start
- return dot === '~' ? homedir() : (dot === '~+' ? cwd() : resolve(dot))
- } else if (path === '~') {
- return homedir()
- } else if (path === '~+') {
- return cwd()
- } else if (!path) {
- throw new TypeError('path must be a string. Received ' + path)
- }
- const ch0 = path.charAt()
- if (ch0 === '.') {
- if (DOT_RELATIVE_RX.test(path) && dot !== '.') start = dot
- } else if (ch0 === '~') {
- if (HOME_RELATIVE_RX.test(path)) {
- return join(homedir(), path.substr(2))
- } else if (PWD_RELATIVE_RX.test(path)) {
- return join(cwd(), path.substr(3))
- }
- } else if (isAbsolute(path)) {
- return normalize(path)
- }
- if (start === '.') start = dot
- return start === '~+' ? join(cwd(), path) : (start === '~' ? join(homedir(), path) : resolve(start, path))
-}
-
-module.exports = expandPath
diff --git a/node_modules/@antora/expand-path-helper/package.json b/node_modules/@antora/expand-path-helper/package.json
deleted file mode 100644
index cf3332cf..00000000
--- a/node_modules/@antora/expand-path-helper/package.json
+++ /dev/null
@@ -1,93 +0,0 @@
-{
- "_from": "@antora/expand-path-helper@~1.0",
- "_id": "@antora/expand-path-helper@1.0.0",
- "_inBundle": false,
- "_integrity": "sha512-hg3y6M3OvRTb7jtLAnwwloYDxafbyKYttcf16kGCXvP7Wqosh7c+Ag+ltaZ7VSebpzpphO/umb/BXdpU7rxapw==",
- "_location": "/@antora/expand-path-helper",
- "_phantomChildren": {},
- "_requested": {
- "type": "range",
- "registry": true,
- "raw": "@antora/expand-path-helper@~1.0",
- "name": "@antora/expand-path-helper",
- "escapedName": "@antora%2fexpand-path-helper",
- "scope": "@antora",
- "rawSpec": "~1.0",
- "saveSpec": null,
- "fetchSpec": "~1.0"
- },
- "_requiredBy": [
- "/@antora/content-aggregator",
- "/@antora/logger",
- "/@antora/site-publisher",
- "/@antora/ui-loader"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/expand-path-helper/-/expand-path-helper-1.0.0.tgz",
- "_shasum": "3bfd6938ab86d4709af8d869cbf3bb17b8fe8912",
- "_spec": "@antora/expand-path-helper@~1.0",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/logger",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/expand-path-helper/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- }
- ],
- "deprecated": false,
- "description": "A helper function to expand a path to an absolute path, including expanding the first segment if it matches a shorthand expression, dot (.), tilde (~), or tilde plus (~+).",
- "devDependencies": {
- "chai": "^4.1.2",
- "eslint": "^4.18.0",
- "eslint-config-standard": "^11.0.0",
- "eslint-plugin-import": "^2.8.0",
- "eslint-plugin-node": "^6.0.0",
- "eslint-plugin-promise": "^3.6.0",
- "eslint-plugin-standard": "^3.0.1",
- "mocha": "^5.0.1",
- "nyc": "^11.5.0"
- },
- "files": [
- "lib/"
- ],
- "homepage": "https://gitlab.com/antora/expand-path-helper#readme",
- "keywords": [
- "path",
- "absolute",
- "relative",
- "pwd",
- "home"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/expand-path-helper",
- "nyc": {
- "cache": true,
- "cacheDir": "node_modules/.cache/nyc",
- "include": [
- "lib/**/*.js"
- ],
- "reporter": [
- "lcov"
- ]
- },
- "publishConfig": {
- "access": "public"
- },
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/expand-path-helper.git"
- },
- "scripts": {
- "cov": "nyc _mocha test",
- "lint": "eslint **/*.js",
- "test": "_mocha test"
- },
- "version": "1.0.0"
-}
diff --git a/node_modules/@antora/logger/LICENSE b/node_modules/@antora/logger/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/logger/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/logger/README.md b/node_modules/@antora/logger/README.md
deleted file mode 100644
index 3632694e..00000000
--- a/node_modules/@antora/logger/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Antora Logger
-
-The Logger is a component in Antora responsible for providing the infrastructure for logging, shaping, and reporting application messages.
-The logger is typically configured once per run of Antora.
-Each component then gets its own logger, which is a proxy of a named child of the root logger.
-Messages can be emitted in a structured (JSON) log format so they can be piped to a separate application for processing/transport or emitted in a pretty format to make them easier for an author to comprehend.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/logger/lib/index.js b/node_modules/@antora/logger/lib/index.js
deleted file mode 100644
index 692537fa..00000000
--- a/node_modules/@antora/logger/lib/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-'use strict'
-
-/**
- * Logger component for Antora
- *
- * Responsible for providing the infrastructure for logging, shaping, and
- * reporting application messages. The logger is typically configured once per
- * run of Antora. Each component then gets its own logger, which is a proxy of
- * a named child of the root logger. Messages can be emitted in a structured
- * (JSON) log format so they can be piped to a separate application for
- * processing/transport or emitted in a pretty format to make them easier for
- * an author to comprehend.
- *
- * @namespace logger
- */
-module.exports = require('./logger')
diff --git a/node_modules/@antora/logger/lib/logger.js b/node_modules/@antora/logger/lib/logger.js
deleted file mode 100644
index f5799b8d..00000000
--- a/node_modules/@antora/logger/lib/logger.js
+++ /dev/null
@@ -1,218 +0,0 @@
-'use strict'
-
-const { EventEmitter, once } = require('events')
-const expandPath = require('@antora/expand-path-helper')
-const fs = require('fs')
-const ospath = require('path')
-const { posix: path } = ospath
-const {
- destination: buildDest,
- levels: { labels: levelLabels, values: levelValues },
- symbols: { streamSym },
- pino,
-} = require('pino')
-
-const closedLogger = { closed: true }
-const finalizers = []
-const INF = Infinity
-const minLevel = levelLabels[Math.min.apply(null, Object.keys(levelLabels))]
-const noopLogger = pino({ base: null, enabled: false, timestamp: false }, {})
-const rootLoggerHolder = new Map()
-const standardStreams = { 1: 'stdout', 2: 'stderr', stderr: 2, stdout: 1 }
-
-function close () {
- const rootLogger = rootLoggerHolder.get() || closedLogger
- if (rootLogger.closed) return
- const strm = Object.assign(rootLogger, closedLogger)[streamSym]
- if (strm instanceof EventEmitter && typeof strm.end === 'function' && (strm._buf || !(strm.fd in standardStreams))) {
- const waitForClose = once(strm, 'close').catch(() => undefined)
- strm.end()
- finalizers.push(waitForClose)
- }
-}
-
-function configure ({ name, level = 'info', levelFormat, failureLevel = 'silent', format, destination } = {}, baseDir) {
- const silent = (levelValues[level] || (level === 'all' ? (level = minLevel) : INF)) === INF
- if (silent && (levelValues[failureLevel] || INF) === INF && (rootLoggerHolder.get() || {}).noop) return module.exports
- close()
- const prettyPrint = format === 'pretty'
- let colorize, dest
- if (!(silent || typeof (destination || (destination = {})).write === 'function')) {
- const { file, append = true, bufferSize, ...destOpts } = destination
- if (bufferSize != null) destOpts.minLength = bufferSize
- if (file && !(dest = standardStreams[file])) {
- dest = expandPath(file, '~+', baseDir)
- try {
- fs.mkdirSync(ospath.dirname(dest), { recursive: true })
- if (!append) fs.unlinkSync(dest)
- } catch {}
- } else if (process.env.NODE_ENV !== 'test') {
- colorize = true
- }
- destination = buildDest(prettyPrint ? dest || 2 : Object.assign({ sync: true }, destOpts, { dest: dest || 1 }))
- }
- const logger = addFailOnExitHooks(
- silent
- ? Object.assign(Object.create(Object.getPrototypeOf(noopLogger)), noopLogger)
- : pino(
- {
- name,
- base: {},
- level,
- formatters: { level: levelFormat === 'number' ? (_, level) => ({ level }) : (level) => ({ level }) },
- hooks: {
- // NOTE logMethod only called if log level is enabled
- logMethod (args, method) {
- const arg0 = args[0]
- if (arg0.constructor === Object) {
- const { file, line, stack, ...obj } = arg0
- // NOTE we assume file key is a file.src object
- args[0] = file ? Object.assign(obj, reshapeFileForLog(arg0)) : obj
- }
- method.apply(this, args)
- },
- },
- prettyPrint: prettyPrint && {
- customPrettifiers: {
- file: ({ path: path_, line }) => (line == null ? path_ : `${path_}:${line}`),
- stack: (stack, _, log) => {
- let prevSource = log.source
- return stack
- .map(({ file: { path: path_, line }, source }) => {
- const file = `${path_}:${line}`
- const repeatSource =
- prevSource &&
- source.url === prevSource.url &&
- source.refname === prevSource.refname &&
- source.startPath === prevSource.startPath
- prevSource = source
- if (repeatSource) return `\n file: ${file}`
- const { url, worktree, refname, startPath } = source
- source = worktree
- ? `${worktree} (refname: ${refname} ${startPath ? ', start path: ' + startPath : ''})`
- : `${url || ''} (refname: ${refname}${startPath ? ', start path: ' + startPath : ''})`
- return `\n file: ${file}\n source: ${source}`
- })
- .join('')
- },
- source: ({ url, worktree, refname, startPath }) =>
- worktree
- ? `${worktree} (refname: ${refname} ${startPath ? ', start path: ' + startPath : ''})`
- : `${url || ''} (refname: ${refname}${startPath ? ', start path: ' + startPath : ''})`,
- },
- suppressFlushSyncWarning: true,
- translateTime: 'SYS:HH:MM:ss.l', // Q: do we really need ms? should we honor DATE_FORMAT env var?
- ...(colorize ? undefined : { colorize: false }),
- },
- },
- destination
- ),
- failureLevel
- )
- rootLoggerHolder.set(undefined, logger)
- return module.exports
-}
-
-function get (name) {
- if (name === null) return rootLoggerHolder.get()
- return new Proxy(noopLogger, {
- resolveTarget () {
- if ((this.ownRootLogger || closedLogger).closed) {
- if ((this.ownRootLogger = rootLoggerHolder.get() || closedLogger).closed) {
- ;(this.ownRootLogger = configure().get(null)).warn(
- 'logger not configured; creating logger with default settings'
- )
- }
- this.target = undefined
- }
- return this.target || (this.target = name ? this.ownRootLogger.child({ name }) : this.ownRootLogger)
- },
- get (_, property) {
- return property === 'unwrap' ? () => this.resolveTarget() : this.resolveTarget()[property]
- },
- set (_, property, value) {
- this.resolveTarget()[property] = value
- return true
- },
- })
-}
-
-function finalize () {
- close()
- return Promise.all(finalizers.splice(0, finalizers.length)).then(() => (rootLoggerHolder.get() || {}).failOnExit)
-}
-
-function reshapeFileForLog ({ file: { abspath, origin, path: vpath }, line, stack }) {
- if (origin) {
- const { url, refname, startPath, worktree } = origin
- const logObject = {
- file: { path: abspath || path.join(startPath, vpath), line },
- source: worktree
- ? { url, worktree, refname, startPath: startPath || undefined }
- : { url, refname, startPath: startPath || undefined },
- }
- if (stack) logObject.stack = stack.map(reshapeFileForLog)
- return logObject
- }
- return stack ? { file: { path: vpath, line }, stack: stack.map(reshapeFileForLog) } : { file: { path: vpath, line } }
-}
-
-function addFailOnExitHooks (logger, failureLevel = undefined) {
- let failureLevelVal
- if (failureLevel === undefined) {
- failureLevelVal = logger.failureLevelVal
- } else {
- logger.failureLevelVal = failureLevelVal = levelValues[failureLevel] || INF
- Object.defineProperty(logger, 'failureLevel', {
- enumerable: true,
- get () {
- return levelLabels[this.failureLevelVal]
- },
- })
- logger.setFailOnExit = setFailOnExit.bind(logger)
- logger.child = ((method) =>
- function (bindings) {
- return addFailOnExitHooks(method.call(this, bindings))
- })(logger.child)
- }
- Object.defineProperty(logger, 'noop', {
- enumerable: true,
- get () {
- return this.levelVal === INF && this.failureLevelVal === INF
- },
- })
- if (failureLevelVal !== INF) {
- for (const [levelName, levelVal] of Object.entries(levelValues)) {
- if (levelVal >= failureLevelVal) logger[levelName] = decorateWithSetFailOnExit(logger[levelName])
- }
- }
- return logger
-}
-
-function decorateWithSetFailOnExit (method) {
- return method.name === 'noop'
- ? callSetFailOnExit
- : function (...args) {
- this.setFailOnExit()
- method.apply(this, args)
- }
-}
-
-function callSetFailOnExit () {
- this.setFailOnExit()
-}
-
-function setFailOnExit () {
- this.failOnExit = true
-}
-
-module.exports = Object.assign(get, {
- close,
- closeLogger: close,
- configure,
- configureLogger: configure,
- finalize,
- finalizeLogger: finalize,
- get,
- getLogger: get,
-})
diff --git a/node_modules/@antora/logger/package.json b/node_modules/@antora/logger/package.json
deleted file mode 100644
index 23ee184c..00000000
--- a/node_modules/@antora/logger/package.json
+++ /dev/null
@@ -1,80 +0,0 @@
-{
- "_from": "@antora/logger@3.0.0-alpha.7",
- "_id": "@antora/logger@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-NiqhWmaynK/MfhRAPO7BDesPUoCqPobjn+dOMhWoDIFZeqPpYpe8PKnqK1WSA1VQMnRSbwZBqa68RhJdK+RQmg==",
- "_location": "/@antora/logger",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/logger@3.0.0-alpha.7",
- "name": "@antora/logger",
- "escapedName": "@antora%2flogger",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/asciidoc-loader",
- "/@antora/cli",
- "/@antora/content-classifier",
- "/@antora/page-composer",
- "/@antora/playbook-builder"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/logger/-/logger-3.0.0-alpha.7.tgz",
- "_shasum": "37ab32a2ca7836d9afe05335ab37dc2a970d4a86",
- "_spec": "@antora/logger@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/cli",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- }
- ],
- "dependencies": {
- "@antora/expand-path-helper": "~1.0",
- "pino": "~6.11",
- "pino-pretty": "~5.1"
- },
- "deprecated": false,
- "description": "The logger for Antora.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "logger",
- "logging",
- "generator",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/logger",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/navigation-builder/LICENSE b/node_modules/@antora/navigation-builder/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/navigation-builder/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/navigation-builder/README.md b/node_modules/@antora/navigation-builder/README.md
deleted file mode 100644
index 800ffe46..00000000
--- a/node_modules/@antora/navigation-builder/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Antora Navigation Builder
-
-The Navigation Builder is a component in Antora responsible for building a navigation catalog sourced from navigation files.
-This navigation catalog can be used to add site navigation to pages in an Antora documentation pipeline.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/navigation-builder/lib/build-navigation.js b/node_modules/@antora/navigation-builder/lib/build-navigation.js
deleted file mode 100644
index 786fde7d..00000000
--- a/node_modules/@antora/navigation-builder/lib/build-navigation.js
+++ /dev/null
@@ -1,122 +0,0 @@
-'use strict'
-
-const loadAsciiDoc = require('@antora/asciidoc-loader')
-const NavigationCatalog = require('./navigation-catalog')
-
-const LINK_RX = /(.+?)<\/a>/
-
-/**
- * Builds a {NavigationCatalog} from files in the navigation family that are
- * stored in the content catalog.
- *
- * Queries the content catalog for files in the navigation family. Then uses
- * the AsciiDoc Loader component to parse the source of each file into an
- * Asciidoctor Document object. It then looks in each file for one or more nested
- * unordered lists, which are used to build the navigation trees. It then
- * combines those trees in sorted order as a navigation set, which gets
- * stored in the navigation catalog by component/version pair.
- *
- * @memberof navigation-builder
- *
- * @param {ContentCatalog} [contentCatalog=undefined] - The content catalog
- * that provides access to the virtual files in the site.
- * @param {Object} [asciidocConfig={}] - AsciiDoc processor configuration options. Extensions are not propagated.
- * Sets the relativizePageRefs option to false before passing to the loadAsciiDoc function.
- * @param {Object} [asciidocConfig.attributes={}] - Shared AsciiDoc attributes to assign to the document.
- *
- * @returns {NavigationCatalog} A navigation catalog built from the navigation files in the content catalog.
- */
-function buildNavigation (contentCatalog, siteAsciiDocConfig = {}) {
- const navCatalog = new NavigationCatalog()
- const navAsciiDocConfig = { doctype: 'article', extensions: [], relativizePageRefs: false }
- contentCatalog
- .findBy({ family: 'nav' })
- .reduce((accum, navFile) => {
- const { component, version } = navFile.src
- const key = version + '@' + component
- const val = accum.get(key)
- if (val) return new Map(accum).set(key, Object.assign({}, val, { navFiles: [...val.navFiles, navFile] }))
- const componentVersion = contentCatalog.getComponentVersion(component, version)
- const asciidocConfig = Object.assign({}, componentVersion.asciidoc || siteAsciiDocConfig, navAsciiDocConfig)
- return new Map(accum).set(key, { component, version, componentVersion, asciidocConfig, navFiles: [navFile] })
- }, new Map())
- .forEach(({ component, version, componentVersion, asciidocConfig, navFiles }) => {
- const trees = navFiles.reduce((accum, navFile) => {
- accum.push(...loadNavigationFile(navFile, contentCatalog, asciidocConfig))
- return accum
- }, [])
- componentVersion.navigation = navCatalog.addNavigation(component, version, trees)
- })
- return navCatalog
-}
-
-function loadNavigationFile (navFile, contentCatalog, asciidocConfig) {
- const lists = loadAsciiDoc(navFile, contentCatalog, asciidocConfig).blocks.filter((b) => b.getContext() === 'ulist')
- if (!lists.length) return []
- const index = navFile.nav.index
- return lists.map((list, idx) => {
- const tree = buildNavigationTree(list.getTitle(), list.getItems())
- tree.root = true
- tree.order = idx ? parseFloat((index + idx / lists.length).toFixed(4)) : index
- return tree
- })
-}
-
-function getChildListItems (listItem) {
- const blocks = listItem.getBlocks()
- const candidate = blocks[0]
- if (candidate) {
- if (blocks.length === 1 && candidate.getContext() === 'ulist') {
- return candidate.getItems()
- } else {
- let context
- return blocks.reduce((accum, block) => {
- if (
- (context = block.getContext()) === 'ulist' ||
- (context === 'open' && (block = block.getBlocks()[0]) && block.getContext() === 'ulist')
- ) {
- accum.push(...block.getItems())
- }
- return accum
- }, [])
- }
- } else {
- return []
- }
-}
-
-function buildNavigationTree (formattedContent, items) {
- const entry = formattedContent ? partitionContent(formattedContent) : {}
- if (items.length) entry.items = items.map((item) => buildNavigationTree(item.getText(), getChildListItems(item)))
- return entry
-}
-
-// atomize? distill? decompose?
-function partitionContent (content) {
- if (~content.indexOf(' candidate.order >= tree.order)
- ~insertIdx ? navigation.splice(insertIdx, 0, tree) : navigation.push(tree)
- return navigation
- }
-
- addNavigation (component, version, trees) {
- return (this[$sets][generateKey(component, version)] = trees.sort((a, b) => a.order - b.order))
- }
-
- getNavigation (component, version) {
- return this[$sets][generateKey(component, version)]
- }
-}
-
-function generateKey (component, version) {
- return version + '@' + component
-}
-
-module.exports = NavigationCatalog
diff --git a/node_modules/@antora/navigation-builder/package.json b/node_modules/@antora/navigation-builder/package.json
deleted file mode 100644
index 8bd07cbe..00000000
--- a/node_modules/@antora/navigation-builder/package.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
- "_from": "@antora/navigation-builder@3.0.0-alpha.7",
- "_id": "@antora/navigation-builder@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-69FU/9JNKxvG0N3fQJkSyVi2jkxBmRUV3hLAFkJ6W0k+Memn6L4BVauHCUWBDOK8jIhO/WuAdhkLM0zfQbG8vg==",
- "_location": "/@antora/navigation-builder",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/navigation-builder@3.0.0-alpha.7",
- "name": "@antora/navigation-builder",
- "escapedName": "@antora%2fnavigation-builder",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/navigation-builder/-/navigation-builder-3.0.0-alpha.7.tgz",
- "_shasum": "12454e84cc17ab50e0260149aa9b9450c436809c",
- "_spec": "@antora/navigation-builder@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- }
- ],
- "dependencies": {
- "@antora/asciidoc-loader": "3.0.0-alpha.7"
- },
- "deprecated": false,
- "description": "Builds a navigation catalog from navigation files for adding site navigation to pages in an Antora documentation pipeline.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "navigation",
- "asciidoc",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/navigation-builder",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/page-composer/LICENSE b/node_modules/@antora/page-composer/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/page-composer/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/page-composer/README.md b/node_modules/@antora/page-composer/README.md
deleted file mode 100644
index d2265be5..00000000
--- a/node_modules/@antora/page-composer/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Antora Page Composer
-
-The Page Composer is a component in Antora responsible for wrapping the embeddable HTML contents of each page file from the content catalog in an HTML page layout.
-This step yields the standalone HTML pages in the generated site produced by an Antora documentation pipeline.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/page-composer/lib/build-ui-model.js b/node_modules/@antora/page-composer/lib/build-ui-model.js
deleted file mode 100644
index e60da004..00000000
--- a/node_modules/@antora/page-composer/lib/build-ui-model.js
+++ /dev/null
@@ -1,293 +0,0 @@
-'use strict'
-
-const { posix: path } = require('path')
-
-const { DEFAULT_LAYOUT_NAME } = require('./constants')
-const { version: VERSION } = require('../package.json')
-
-function buildBaseUiModel (playbook, contentCatalog, env) {
- const contentCatalogModel = contentCatalog.exportToModel()
- return {
- antoraVersion: VERSION,
- contentCatalog: contentCatalogModel,
- env,
- site: buildSiteUiModel(playbook, contentCatalogModel),
- }
-}
-
-function buildUiModel (baseUiModel, file, contentCatalog, navigationCatalog) {
- const siteUiModel = baseUiModel.site
- const siteRootPath = file.pub.rootPath || siteUiModel.path || ''
- const uiRootPath = siteRootPath + siteUiModel.ui.url
- return Object.assign({}, baseUiModel, {
- page: buildPageUiModel(siteUiModel, file, contentCatalog, navigationCatalog),
- siteRootPath,
- uiRootPath,
- })
-}
-
-function buildSiteUiModel (playbook, contentCatalog) {
- const model = { title: playbook.site.title }
-
- let siteUrl = playbook.site.url
- if (siteUrl) {
- if (siteUrl === '/') {
- model.url = siteUrl
- model.path = ''
- } else {
- if (siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1)
- if (siteUrl.charAt() === '/') {
- model.path = siteUrl
- } else if ((model.path = new URL(siteUrl).pathname) === '/') {
- model.path = ''
- }
- model.url = siteUrl
- }
- }
-
- const startPage = contentCatalog.getSiteStartPage()
- if (startPage) model.homeUrl = startPage.pub.url
-
- model.components = contentCatalog.getComponentsSortedBy('title').reduce((map, it) => (map[it.name] = it) && map, {})
- // NOTE: duplicate site.keys since original is frozen
- model.keys = Object.assign({}, playbook.site.keys)
-
- const uiConfig = playbook.ui
- model.ui = {
- url: path.resolve('/', uiConfig.outputDir),
- defaultLayout: uiConfig.defaultLayout || DEFAULT_LAYOUT_NAME,
- }
-
- return model
-}
-
-function buildPageUiModel (siteUiModel, file, contentCatalog, navigationCatalog) {
- const src = file.src
- if (src.stem === '404' && !src.component) return { layout: '404', title: file.title }
- const { component: component_, version, module: module_, relative: relativeSrcPath, origin, editUrl, fileUri } = src
-
- // QUESTION should attributes be scoped to AsciiDoc, or should this work regardless of markup language? file.data?
- const asciidoc = file.asciidoc || {}
- const attributes = asciidoc.attributes || {}
- const pageAttributes = Object.entries(attributes).reduce((accum, [name, val]) => {
- if (name.startsWith('page-')) accum[name.substr(5)] = val
- return accum
- }, {})
-
- const url = file.pub.url
- const component = contentCatalog.getComponent(component_)
- const componentVersion = contentCatalog.getComponentVersion(component, version)
- // QUESTION can we cache versions on file.rel so only computed once per page version lineage?
- const versions = component.versions.length > 1 ? getPageVersions(file, component, contentCatalog) : undefined
- const title = file.title || asciidoc.doctitle
-
- const model = {
- contents: file.contents,
- layout: pageAttributes.layout || siteUiModel.ui.defaultLayout,
- title,
- url,
- author: attributes.author,
- description: attributes.description,
- keywords: attributes.keywords,
- role: attributes.docrole,
- attributes: pageAttributes,
- component,
- version,
- displayVersion: componentVersion.displayVersion,
- componentVersion,
- module: module_,
- relativeSrcPath,
- origin,
- versions,
- editUrl,
- fileUri,
- home: url === siteUiModel.homeUrl,
- }
-
- if (navigationCatalog) attachNavProperties(model, url, title, navigationCatalog.getNavigation(component_, version))
-
- if (versions) {
- Object.defineProperty(model, 'latest', {
- get () {
- return this.versions.find((candidate) => candidate.latest)
- },
- })
- }
-
- // NOTE site URL has already been normalized at this point
- const siteUrl = siteUiModel.url
- if (siteUrl && siteUrl.charAt() !== '/') {
- if (versions) {
- let latestReached
- // NOTE latest not guaranteed to match latest component version since the page may be missing in that version
- const latest = versions.find((it) => (latestReached || (latestReached = it.latest)) && !it.missing)
- // NOTE latest can be undefined if page is only in prerelease and the prerelease version is not the latest version
- if (latest && !latest.prerelease) {
- let canonicalUrl = latest.url
- if (canonicalUrl === url || canonicalUrl.charAt() === '/') canonicalUrl = siteUrl + canonicalUrl
- model.canonicalUrl = file.pub.canonicalUrl = canonicalUrl
- }
- } else if (!componentVersion.prerelease) {
- model.canonicalUrl = file.pub.canonicalUrl = siteUrl + url
- }
- }
-
- return model
-}
-
-// QUESTION should this function go in ContentCatalog?
-function getPageVersions (page, component, contentCatalog) {
- let basePageId = page.src
- const componentVersions = component.versions
- const pageVersion = basePageId.version
- const thisVersionIdx = componentVersions.findIndex(({ version }) => version === pageVersion)
- const thisVersion = componentVersions[thisVersionIdx]
- const newerVersions = componentVersions.slice(0, thisVersionIdx)
- const olderVersions = componentVersions.slice(thisVersionIdx + 1)
- const latestVersion = component.latest
- let pageVersions = newerVersions
- .reverse()
- .reduce((accum, componentVersion) => {
- let relPage
- const relPageId = Object.assign({}, basePageId, { version: componentVersion.version })
- if (
- !(relPage = contentCatalog.getById(relPageId)) &&
- (relPage = (contentCatalog.getById((relPageId.family = 'alias') && relPageId) || {}).rel)
- ) {
- // NOTE: don't follow alias that falls outside of component version
- if (relPage.src.version === relPageId.version && relPage.src.component === relPageId.component) {
- // NOTE: keep searching from target of alias
- basePageId = relPage.src
- } else {
- // QUESTION: should we mark the page as missing or link outside the component version?
- //relPage = undefined
- }
- }
- accum.push(
- Object.assign(
- componentVersion === latestVersion ? { latest: true } : {},
- componentVersion,
- relPage ? { url: relPage.pub.url } : { missing: true }
- )
- )
- return accum
- }, [])
- .reverse()
- pageVersions.push(
- Object.assign(thisVersion === latestVersion ? { latest: true } : {}, thisVersion, { url: page.pub.url })
- )
- basePageId = page.src
- let prevPage = page
- pageVersions = olderVersions.reduce((accum, componentVersion) => {
- let relPage
- let primaryAliasSrc
- const relPageId = Object.assign({}, basePageId, { version: componentVersion.version })
- if ((relPage = contentCatalog.getById(relPageId))) {
- prevPage = relPage
- } else if (
- prevPage &&
- (primaryAliasSrc = (prevPage.rel || {}).src) &&
- // NOTE: if alias is located in different component or version, it doesn't give us any useful information
- primaryAliasSrc.version === prevPage.src.version &&
- primaryAliasSrc.component === prevPage.src.component
- ) {
- relPageId.module = primaryAliasSrc.module
- relPageId.relative = primaryAliasSrc.relative
- if ((relPage = contentCatalog.getById(relPageId))) {
- // NOTE: keep searching from target of alias
- basePageId = (prevPage = relPage).src
- } else if ((relPage = (contentCatalog.getById((relPageId.family = 'alias') && relPageId) || {}).rel)) {
- // NOTE: don't follow alias that falls outside of component version
- if (relPage.src.version === relPageId.version && relPage.src.component === relPageId.component) {
- // NOTE: keep searching from target of alias
- basePageId = (prevPage = relPage).src
- } else {
- // QUESTION: should we update version on prevPage so older versions can continue to follow it?
- prevPage = undefined
- // QUESTION: should we mark the page as missing or link outside the component version?
- //relPage = undefined
- }
- }
- }
- accum.push(
- Object.assign(
- componentVersion === latestVersion ? { latest: true } : {},
- componentVersion,
- relPage ? { url: relPage.pub.url } : { missing: true }
- )
- )
- return accum
- }, pageVersions)
- return pageVersions
-}
-
-function attachNavProperties (model, currentUrl, title, navigation = []) {
- if (!(model.navigation = navigation).length) return
- const startPageUrl = model.componentVersion.url
- const { match, ancestors, previous, next } = findNavItem({ ancestors: [], seekNext: true, currentUrl }, navigation)
- if (match) {
- // QUESTION should we filter out component start page from the breadcrumbs?
- const breadcrumbs = ancestors.filter((item) => 'content' in item).reverse()
- const parent = breadcrumbs.find((item) => item.urlType === 'internal')
- breadcrumbs.reverse().push(match)
- model.breadcrumbs = breadcrumbs
- if (parent) model.parent = parent
- if (previous) {
- model.previous = previous
- } else if (currentUrl !== startPageUrl) {
- model.previous = { content: model.componentVersion.title, url: startPageUrl, urlType: 'internal', discrete: true }
- }
- if (next) model.next = next
- } else {
- const orphan = { content: title, url: currentUrl, urlType: 'internal', discrete: true }
- if (title) model.breadcrumbs = [orphan]
- if (currentUrl === startPageUrl) {
- const { next: first } = findNavItem({ ancestors: [], match: orphan, seekNext: true, currentUrl }, navigation)
- if (first) model.next = first
- }
- }
-}
-
-function findNavItem (correlated, siblings, root = true, siblingIdx = 0, candidate = undefined) {
- if (!(candidate = candidate || siblings[siblingIdx])) {
- return correlated
- } else if (correlated.match) {
- if (candidate.urlType === 'internal' && !matchesPage(candidate, correlated.currentUrl)) {
- correlated.next = candidate
- return correlated
- }
- } else if (candidate.urlType === 'internal') {
- if (matchesPage(candidate, correlated.currentUrl)) {
- correlated.match = candidate
- if (!correlated.seekNext) return correlated
- } else if (!(correlated.previous && matchesPage(candidate, correlated.previous.url, correlated.previous.hash))) {
- correlated.previous = candidate
- }
- }
- const children = candidate.items || []
- if (children.length) {
- const ancestors = correlated.ancestors
- correlated = findNavItem(
- correlated.match ? correlated : Object.assign({}, correlated, { ancestors: [...ancestors, candidate] }),
- children,
- false
- )
- if (correlated.match) {
- if (!correlated.seekNext || correlated.next) return correlated
- } else {
- correlated.ancestors = ancestors
- }
- }
- if (++siblingIdx < siblings.length) {
- correlated = findNavItem(correlated, siblings, root, siblingIdx)
- } else if (root && !correlated.match) {
- delete correlated.previous
- }
- return correlated
-}
-
-function matchesPage (candidate, url, hash = undefined) {
- return candidate.url === (hash ? url.substr(0, url.length - hash.length) : url) + (candidate.hash || '')
-}
-
-module.exports = { buildBaseUiModel, buildSiteUiModel, buildPageUiModel, buildUiModel }
diff --git a/node_modules/@antora/page-composer/lib/constants.js b/node_modules/@antora/page-composer/lib/constants.js
deleted file mode 100644
index b7c0db80..00000000
--- a/node_modules/@antora/page-composer/lib/constants.js
+++ /dev/null
@@ -1,5 +0,0 @@
-'use strict'
-
-module.exports = Object.freeze({
- DEFAULT_LAYOUT_NAME: 'default',
-})
diff --git a/node_modules/@antora/page-composer/lib/create-page-composer.js b/node_modules/@antora/page-composer/lib/create-page-composer.js
deleted file mode 100644
index b0b8156e..00000000
--- a/node_modules/@antora/page-composer/lib/create-page-composer.js
+++ /dev/null
@@ -1,101 +0,0 @@
-'use strict'
-
-const { buildBaseUiModel, buildUiModel } = require('./build-ui-model')
-const handlebars = require('handlebars')
-const logger = require('./logger')
-const relativize = require('./helpers/relativize')
-const resolvePage = require('./helpers/resolve-page')
-const resolvePageURL = require('./helpers/resolve-page-url')
-const requireFromString = require('require-from-string')
-
-/**
- * Generates a function to wrap the page contents in a page layout.
- *
- * Compiles the Handlebars layouts, along with the partials and helpers, and
- * builds the shared site UI model. Passes these objects to a generated
- * function, which can then be used to apply a layout template to pages.
- *
- * @memberof page-composer
- *
- * @param {Object} playbook - The configuration object for Antora.
- * @param {ContentCatalog} contentCatalog - The content catalog
- * that provides access to the virtual files in the site.
- * @param {UiCatalog} uiCatalog - The file catalog
- * that provides access to the UI files for the site.
- * @param {Object} [env=process.env] - A map of environment variables.
- * @returns {Function} A function to compose a page (i.e., wrap the embeddable
- * HTML contents in a standalone page layout).
- */
-function createPageComposer (playbook, contentCatalog, uiCatalog, env = process.env) {
- handlebars.registerHelper('relativize', relativize)
- handlebars.registerHelper('resolvePage', resolvePage)
- handlebars.registerHelper('resolvePageURL', resolvePageURL)
- uiCatalog
- .findByType('helper')
- .forEach(({ path, stem, contents }) =>
- handlebars.registerHelper(stem, requireFromString(contents.toString(), path))
- )
- uiCatalog.findByType('partial').forEach(({ stem, contents }) => handlebars.registerPartial(stem, contents.toString()))
- const layouts = uiCatalog
- .findByType('layout')
- .reduce(
- (accum, { path: srcName, stem, contents }) =>
- accum.set(stem, handlebars.compile(contents.toString(), { preventIndent: true, srcName })),
- new Map()
- )
- return createPageComposerInternal(buildBaseUiModel(playbook, contentCatalog, env), layouts)
-}
-
-function createPageComposerInternal (baseUiModel, layouts) {
- /**
- * Wraps the embeddable HTML contents of the specified file in a page layout.
- *
- * Builds a UI model from the file and its context, executes on the specified
- * page layout on that model, and assigns the result to the contents property
- * of the file. If no layout is specified on the file, the default layout is
- * used.
- *
- * @memberof page-composer
- *
- * @param {File} file - The virtual file the contains embeddable HTML
- * contents to wrap in a layout.
- * @param {ContentCatalog} _contentCatalog - The content catalog
- * that provides access to the virtual files in the site (ignored).
- * @param {NavigationCatalog} navigationCatalog - The navigation catalog
- * that provides access to the navigation for each component version.
- * @returns {File} The file whose contents were wrapped in the specified page layout.
- */
- return function composePage (file, _contentCatalog, navigationCatalog) {
- // QUESTION should we pass the playbook to the uiModel?
- const uiModel = buildUiModel(baseUiModel, file, baseUiModel.contentCatalog, navigationCatalog)
- let layout = uiModel.page.layout
- if (!layouts.has(layout)) {
- if (layout === '404') throw new Error('404 layout not found')
- const defaultLayout = uiModel.site.ui.defaultLayout
- if (defaultLayout === layout) {
- throw new Error(`${layout} layout not found`)
- } else if (!layouts.has(defaultLayout)) {
- throw new Error(`Neither ${layout} layout or fallback ${defaultLayout} layout found`)
- }
- logger.warn("page layout '%s' specified by page not found; using default layout", layout)
- layout = defaultLayout
- }
- // QUESTION should we call trim() on result?
- try {
- file.contents = Buffer.from(layouts.get(layout)(uiModel))
- } catch (err) {
- throw transformHandlebarsError(err, layout)
- }
- return file
- }
-}
-
-function transformHandlebarsError ({ message, stack }, layout) {
- const m = stack.match(/^ *at Object\.ret \[as (.+?)\]/m)
- const templatePath = `${m ? 'partials/' + m[1] : 'layouts/' + layout}.hbs`
- const err = new Error(`${message}${~message.indexOf('\n') ? '\n^ ' : ' '}in UI template ${templatePath}`)
- err.stack = [err.toString(), stack.substr(message.length + 8)].join('\n')
- return err
-}
-
-module.exports = createPageComposer
diff --git a/node_modules/@antora/page-composer/lib/helpers/relativize.js b/node_modules/@antora/page-composer/lib/helpers/relativize.js
deleted file mode 100644
index 039ac6a4..00000000
--- a/node_modules/@antora/page-composer/lib/helpers/relativize.js
+++ /dev/null
@@ -1,23 +0,0 @@
-'use strict'
-
-const { posix: path } = require('path')
-
-module.exports = (to, { data }) => {
- if (!to) return '#'
- if (to.charAt() !== '/') return to
- const from = data.root.page.url
- if (!from) return (data.root.site.path || '') + to
- let hash = ''
- const hashIdx = to.indexOf('#')
- if (~hashIdx) {
- hash = to.substr(hashIdx)
- to = to.substr(0, hashIdx)
- }
- return to === from
- ? hash || (isDir(to) ? './' : path.basename(to))
- : (path.relative(path.dirname(from + '.'), to) || '.') + (isDir(to) ? '/' + hash : hash)
-}
-
-function isDir (str) {
- return str.charAt(str.length - 1) === '/'
-}
diff --git a/node_modules/@antora/page-composer/lib/helpers/resolve-page-url.js b/node_modules/@antora/page-composer/lib/helpers/resolve-page-url.js
deleted file mode 100644
index 3f887e8b..00000000
--- a/node_modules/@antora/page-composer/lib/helpers/resolve-page-url.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-module.exports = (spec, { data, hash: context }) => {
- if (!spec) return
- const { contentCatalog, page } = data.root
- if (page.component) {
- context = Object.assign({ component: page.component.name, version: page.version, module: page.module }, context)
- }
- const file = contentCatalog.resolvePage(spec, context)
- if (file) return file.pub.url
-}
diff --git a/node_modules/@antora/page-composer/lib/helpers/resolve-page.js b/node_modules/@antora/page-composer/lib/helpers/resolve-page.js
deleted file mode 100644
index a4c70a93..00000000
--- a/node_modules/@antora/page-composer/lib/helpers/resolve-page.js
+++ /dev/null
@@ -1,14 +0,0 @@
-'use strict'
-
-const { buildPageUiModel } = require('./../build-ui-model')
-
-module.exports = (spec, { data, hash: context }) => {
- if (!spec) return
- const { contentCatalog, page, site } = data.root
- const raw = 'model' in context && (context.model ? !delete context.model : delete context.model)
- if (page.component) {
- context = Object.assign({ component: page.component.name, version: page.version, module: page.module }, context)
- }
- const file = contentCatalog.resolvePage(spec, context)
- if (file) return raw ? file : buildPageUiModel(site, file, contentCatalog)
-}
diff --git a/node_modules/@antora/page-composer/lib/index.js b/node_modules/@antora/page-composer/lib/index.js
deleted file mode 100644
index 92654ea8..00000000
--- a/node_modules/@antora/page-composer/lib/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-/**
- * Page Composer component for Antora
- *
- * Wraps the embedded HTML contents of a page file in the content catalog in
- * a standalone page layout.
- *
- * @namespace page-composer
- */
-module.exports = require('./create-page-composer')
diff --git a/node_modules/@antora/page-composer/lib/logger.js b/node_modules/@antora/page-composer/lib/logger.js
deleted file mode 100644
index 3cafb475..00000000
--- a/node_modules/@antora/page-composer/lib/logger.js
+++ /dev/null
@@ -1,3 +0,0 @@
-'use strict'
-
-module.exports = require('@antora/logger')(require('../package.json').name)
diff --git a/node_modules/@antora/page-composer/package.json b/node_modules/@antora/page-composer/package.json
deleted file mode 100644
index 71c2b3c7..00000000
--- a/node_modules/@antora/page-composer/package.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "_from": "@antora/page-composer@3.0.0-alpha.7",
- "_id": "@antora/page-composer@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-XaujKukaXrulIIiG+dXLieISHxElmNzU/1QRdbBKbUgABtrpTz+HegEXLHzav5Q/d8IBB7xWylN2u8bzbhJLEg==",
- "_location": "/@antora/page-composer",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/page-composer@3.0.0-alpha.7",
- "name": "@antora/page-composer",
- "escapedName": "@antora%2fpage-composer",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/page-composer/-/page-composer-3.0.0-alpha.7.tgz",
- "_shasum": "13ee73e8c66dcf16d4d621b2c1041c77e0b1eca8",
- "_spec": "@antora/page-composer@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- }
- ],
- "dependencies": {
- "@antora/logger": "3.0.0-alpha.7",
- "handlebars": "~4.7",
- "require-from-string": "~2.0"
- },
- "deprecated": false,
- "description": "Wraps the embeddable HTML contents of each page file from the content catalog in a page layout to yield standalone pages in an Antora documentation pipeline.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "handlebars",
- "html",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/page-composer",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/playbook-builder/LICENSE b/node_modules/@antora/playbook-builder/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/playbook-builder/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/playbook-builder/README.md b/node_modules/@antora/playbook-builder/README.md
deleted file mode 100644
index b028d38a..00000000
--- a/node_modules/@antora/playbook-builder/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Antora Playbook Builder
-
-The Playbook Builder is the configuration component for Antora.
-It's responsible for building a playbook object from user input that's then used for configuring components in an Antora generator pipeline.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/playbook-builder/lib/build-playbook.js b/node_modules/@antora/playbook-builder/lib/build-playbook.js
deleted file mode 100644
index b7e737cd..00000000
--- a/node_modules/@antora/playbook-builder/lib/build-playbook.js
+++ /dev/null
@@ -1,103 +0,0 @@
-'use strict'
-
-const camelCaseKeys = require('camelcase-keys')
-const { configureLogger } = require('@antora/logger')
-const convict = require('./solitary-convict')
-const fs = require('fs')
-const { hasOwnProperty } = Object.prototype
-const ospath = require('path')
-
-/**
- * Builds a playbook object according to the provided schema from the specified
- * arguments and environment variables.
- *
- * Accepts an array of command line arguments (in the form of option flags and
- * switches) and a map of environment variables and translates this data into a
- * playbook object according the the specified schema. If no schema is
- * specified, the default schema provided by this package is used.
- *
- * @memberof playbook-builder
- *
- * @param {Array} [args=[]] - An array of arguments in the form of command line
- * option flags and switches. Should begin with the first flag or switch.
- * @param {Object} [env={}] - A map of environment variables.
- * @param {Object} [schema=undefined] - A convict configuration schema.
- *
- * @returns {Object} A playbook object containing a hierarchical structure that
- * mirrors the configuration schema. With the exception of the top-level asciidoc
- * key and its descendants, all keys in the playbook are camelCased.
- */
-function buildPlaybook (args = [], env = {}, schema = undefined) {
- const config = loadConvictConfig(args, env, schema)
-
- const relSpecFilePath = config.get('playbook')
- if (relSpecFilePath) {
- let absSpecFilePath = ospath.resolve(relSpecFilePath)
- if (ospath.extname(absSpecFilePath)) {
- if (!fs.existsSync(absSpecFilePath)) {
- let details = ''
- if (relSpecFilePath !== absSpecFilePath) {
- details = ` (path: ${relSpecFilePath}${ospath.isAbsolute(relSpecFilePath) ? '' : ', cwd: ' + process.cwd()})`
- }
- throw new Error(`playbook file not found at ${absSpecFilePath}${details}`)
- }
- } else if (fs.existsSync(absSpecFilePath + '.yml')) {
- absSpecFilePath += '.yml'
- } else if (fs.existsSync(absSpecFilePath + '.json')) {
- absSpecFilePath += '.json'
- } else if (fs.existsSync(absSpecFilePath + '.toml')) {
- absSpecFilePath += '.toml'
- } else {
- const details = `(path: ${relSpecFilePath}${ospath.isAbsolute(relSpecFilePath) ? '' : ', cwd: ' + process.cwd()})`
- throw new Error(
- `playbook file not found at ${absSpecFilePath}.yml, ${absSpecFilePath}.json, or ${absSpecFilePath}.toml ` +
- details
- )
- }
- config.loadFile(absSpecFilePath)
- if (relSpecFilePath !== absSpecFilePath) config.set('playbook', absSpecFilePath)
- }
-
- config.validate({ allowed: 'strict' })
-
- return exportModel(config)
-}
-
-function loadConvictConfig (args, env, customSchema) {
- return convict(customSchema || require('./config/schema'), { args, env })
-}
-
-function freeze (o) {
- let v
- for (const k in o) hasOwnProperty.call(o, k) && (Object.isFrozen((v = o[k])) || freeze(v))
- return Object.freeze(o)
-}
-
-function exportModel (config) {
- const schemaProperties = config._schema._cvtProperties
- const data = config.getProperties()
- if (
- 'site' in schemaProperties &&
- 'keys' in schemaProperties.site._cvtProperties &&
- '__private__google_analytics_key' in schemaProperties.site._cvtProperties
- ) {
- const site = data.site
- if (site.__private__google_analytics_key != null) site.keys.google_analytics = site.__private__google_analytics_key
- delete site.__private__google_analytics_key
- }
- const playbook = camelCaseKeys(data, { deep: true, stopPaths: ['asciidoc'] })
- playbook.dir = playbook.playbook ? ospath.dirname((playbook.file = playbook.playbook)) : process.cwd()
- const runtime = (playbook.runtime || false).constructor === Object && playbook.runtime
- if (runtime) {
- const log = (runtime.log || false).constructor === Object && runtime.log
- if (runtime.silent) {
- if (runtime.quiet === false) runtime.quiet = true
- if (log && 'level' in log) log.level = 'silent'
- }
- if (log) configureLogger(log, playbook.dir)
- }
- delete playbook.playbook
- return freeze(playbook)
-}
-
-module.exports = buildPlaybook
diff --git a/node_modules/@antora/playbook-builder/lib/config/schema.js b/node_modules/@antora/playbook-builder/lib/config/schema.js
deleted file mode 100644
index 90a715ee..00000000
--- a/node_modules/@antora/playbook-builder/lib/config/schema.js
+++ /dev/null
@@ -1,311 +0,0 @@
-'use strict'
-
-module.exports = {
- playbook: {
- doc: 'Location of the playbook file.',
- format: String,
- default: undefined,
- arg: 'playbook',
- },
- site: {
- start_page: {
- doc: 'The start page for the site, redirected from the site index.',
- format: String,
- default: undefined,
- arg: 'start-page',
- },
- title: {
- doc: 'The title of the site.',
- format: String,
- default: undefined,
- arg: 'title',
- },
- url: {
- doc: 'The base URL (absolute URL or pathname) of the published site. Should not include a trailing slash.',
- format: 'url-or-pathname',
- default: undefined,
- arg: 'url',
- env: 'URL',
- },
- robots: {
- doc: 'Controls generation of robots.txt if site.url is set (allowed values: allow, disallow, or custom string).',
- format: String,
- default: undefined,
- },
- keys: {
- doc: 'An API key (in the form name=value) to pass to the UI model. May be specified multiple times.',
- format: 'primitive-map',
- default: {},
- arg: 'key',
- },
- // NOTE used to map arg and env for site.keys.google_analytics key
- __private__google_analytics_key: {
- doc: [
- 'The Google Analytics account key.',
- '(Deprecated; will be removed in Antora 4; define using --key google-analytics= instead)',
- ].join('\n'),
- format: String,
- default: undefined,
- arg: 'google-analytics-key',
- env: 'GOOGLE_ANALYTICS_KEY',
- },
- },
- content: {
- branches: {
- doc: 'The default branch pattern to use when no specific pattern is provided.',
- format: Array,
- default: ['HEAD', 'v*'],
- },
- edit_url: {
- doc: 'The default edit URL setting when no specific setting is provided.',
- format: 'boolean-or-string',
- default: true,
- },
- sources: {
- doc: 'The list of git repositories + branch patterns to use.',
- format: Array,
- default: [],
- },
- tags: {
- doc: 'The default tag pattern to use when no specific pattern is provided.',
- format: Array,
- default: undefined,
- },
- },
- ui: {
- bundle: {
- url: {
- doc: 'The URL of the UI bundle. Can be a path on the local filesystem.',
- format: String,
- arg: 'ui-bundle-url',
- default: null,
- },
- snapshot: {
- doc: 'Whether the bundle URL points to a snapshot that changes over time.',
- format: Boolean,
- default: false,
- },
- start_path: {
- doc: 'The relative path inside the bundle from which to start reading files.',
- format: String,
- default: '',
- },
- },
- output_dir: {
- doc: 'The output directory path relative to the site root where the UI files should be written.',
- format: String,
- default: '_',
- },
- default_layout: {
- doc: 'The default layout to apply to pages that do not specify a layout.',
- format: String,
- default: undefined,
- },
- supplemental_files: {
- doc: 'Supplemental file list or a directory of files to append to the UI bundle.',
- format: 'dir-or-virtual-files',
- default: undefined,
- },
- },
- asciidoc: {
- attributes: {
- doc: 'A document attribute to set on each page. May be specified multiple times.',
- format: 'map',
- default: {},
- arg: 'attribute',
- },
- extensions: {
- doc: 'A list of require paths for registering extensions per instance of the AsciiDoc processor.',
- format: Array,
- default: [],
- },
- sourcemap: {
- doc: 'Enables the sourcemap option on the AsciiDoc processor, which adds file and line information to blocks.',
- format: Boolean,
- default: false,
- arg: 'asciidoc-sourcemap',
- },
- },
- git: {
- credentials: {
- path: {
- doc: 'The path to a git credentials file matching the format used by git-credential-store.',
- format: String,
- default: undefined,
- arg: 'git-credentials-path',
- env: 'GIT_CREDENTIALS_PATH',
- },
- contents: {
- doc: 'The git credentials data matching the format used by git-credentials-store (optionally comma-separated).',
- format: String,
- default: undefined,
- env: 'GIT_CREDENTIALS',
- },
- },
- ensure_git_suffix: {
- doc: 'Instructs the git client to automatically append .git to the repository URL if absent.',
- format: Boolean,
- default: true,
- },
- },
- network: {
- http_proxy: {
- doc: 'The URL of the proxy to use for HTTP URLs.',
- format: 'url',
- default: undefined,
- arg: 'http-proxy',
- env: 'http_proxy',
- },
- https_proxy: {
- doc: 'The URL of the proxy to use for HTTPS URLs.',
- format: 'url',
- default: undefined,
- arg: 'https-proxy',
- env: 'https_proxy',
- },
- no_proxy: {
- doc: 'A comma-separated list of domains and IPs that should not be proxied.',
- format: String,
- default: undefined,
- arg: 'noproxy',
- env: 'no_proxy',
- },
- },
- runtime: {
- cache_dir: {
- doc: 'The cache directory. (default: antora folder under cache dir for current user)',
- format: String,
- default: undefined,
- arg: 'cache-dir',
- env: 'ANTORA_CACHE_DIR',
- },
- fetch: {
- doc: 'Download updates from remote resources. Includes content repositories and the UI bundle.',
- format: Boolean,
- default: false,
- arg: 'fetch',
- },
- quiet: {
- doc: 'Do not write any messages to stdout.',
- format: Boolean,
- default: false,
- arg: 'quiet',
- },
- silent: {
- doc: 'Suppress all messages.',
- format: Boolean,
- default: false,
- arg: 'silent',
- },
- log: {
- level: {
- doc: 'Set the minimum log level of messages that get logged.',
- format: ['all', 'debug', 'info', 'warn', 'error', 'fatal', 'silent'],
- default: 'warn',
- arg: 'log-level',
- env: 'ANTORA_LOG_LEVEL',
- },
- level_format: {
- doc: 'Set the format to use for the log level in structured log messages.',
- format: ['number', 'label'],
- default: 'label',
- arg: 'log-level-format',
- env: 'ANTORA_LOG_LEVEL_FORMAT',
- },
- failure_level: {
- doc: 'Set the log level tolerance that, when exceeded, will cause the application to fail on exit.',
- format: ['warn', 'error', 'fatal', 'none'],
- default: 'fatal',
- arg: 'log-failure-level',
- env: 'ANTORA_LOG_FAILURE_LEVEL',
- },
- format: new Proxy(
- {
- doc: 'Set the format of log messages. Defaults to json if CI=true, pretty otherwise.',
- format: ['json', 'pretty'],
- default: undefined,
- arg: 'log-format',
- env: 'ANTORA_LOG_FORMAT',
- },
- {
- get (target, property) {
- if (property !== 'default') return target[property]
- return process.env.CI === 'true' || process.env.NODE_ENV === 'test' ? 'json' : 'pretty'
- },
- }
- ),
- destination: {
- file: {
- doc: 'Write log messages to this file or stream. Defaults to stderr if format is pretty, stdout otherwise.',
- format: String,
- default: undefined,
- arg: 'log-file',
- env: 'ANTORA_LOG_FILE',
- },
- append: {
- doc: 'Whether to append messages to the log file if it already exists.',
- format: Boolean,
- default: true,
- },
- buffer_size: {
- doc: 'The size of the log buffer that must be exceeded before writing a chunk to the destination.',
- format: Number,
- default: 0,
- },
- sync: {
- doc: 'Whether to immediately flush messages to the destination when the buffer size is exceeded.',
- format: Boolean,
- default: true,
- },
- },
- },
- },
- urls: {
- html_extension_style: {
- doc: 'The user-facing URL extension to use for HTML pages.',
- format: ['default', 'drop', 'indexify'],
- default: 'default',
- arg: 'html-url-extension-style',
- },
- latest_version_segment_strategy: {
- doc: 'The strategy to use for cloaking the latest version or prerelease version segment in the URL.',
- format: ['replace', 'redirect:to', 'redirect:from'],
- default: undefined,
- },
- latest_prerelease_version_segment: {
- doc: 'The value to use instead of the latest prerelease version segment in the URL.',
- format: String,
- default: undefined,
- },
- latest_version_segment: {
- doc: 'The value to use instead of the latest version segment in the URL.',
- format: String,
- default: undefined,
- },
- redirect_facility: {
- doc: 'The facility for handling page alias and start page redirections.',
- format: ['disabled', 'httpd', 'netlify', 'nginx', 'static'],
- default: 'static',
- arg: 'redirect-facility',
- },
- },
- output: {
- clean: {
- doc: 'Remove destination path before publishing (fs only).',
- format: Boolean,
- default: false,
- arg: 'clean',
- },
- dir: {
- doc: 'The directory where the site should be published. (default: build/site)',
- format: String,
- default: undefined,
- arg: 'to-dir',
- },
- destinations: {
- doc: 'A list of destinations where the generated site should be published.',
- format: Array,
- default: undefined,
- },
- },
-}
diff --git a/node_modules/@antora/playbook-builder/lib/index.js b/node_modules/@antora/playbook-builder/lib/index.js
deleted file mode 100644
index ff37416c..00000000
--- a/node_modules/@antora/playbook-builder/lib/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-/**
- * Playbook Builder component for Antora
- *
- * Builds a configuration object called a playbook from user input. The playbook
- * is used for configuring successive documentation components in Antora.
- *
- * @namespace playbook-builder
- */
-module.exports = require('./build-playbook')
diff --git a/node_modules/@antora/playbook-builder/lib/solitary-convict.js b/node_modules/@antora/playbook-builder/lib/solitary-convict.js
deleted file mode 100644
index a6a387e4..00000000
--- a/node_modules/@antora/playbook-builder/lib/solitary-convict.js
+++ /dev/null
@@ -1,137 +0,0 @@
-'use strict'
-
-const convict = require('convict')
-const json = require('json5')
-const toml = require('@iarna/toml')
-const yaml = require('js-yaml')
-
-const ARGS_SCANNER_RX = /(?:([^=,]+)|(?==))(?:,|$|=(|("|').*?\3|[^,]+)(?:,|$))/g
-const PRIMITIVE_TYPES = [Boolean, Number, String]
-
-/**
- * A convict function wrapper that registers custom formats and parsers and
- * isolates the configuration from the process environment by default.
- */
-function solitaryConvict (schema, opts) {
- registerFormats(convict)
- registerParsers(convict)
- return convict(schema, opts || { args: [], env: {} })
-}
-
-function registerParsers (convict) {
- convict.addParser([
- { extension: 'json', parse: json.parse },
- { extension: 'toml', parse: toml.parse },
- { extension: 'yaml', parse: yaml.load },
- { extension: 'yml', parse: yaml.load },
- {
- extension: '*',
- parse: () => {
- throw new Error('Unexpected playbook file type (must be yml, json, or toml')
- },
- },
- ])
-}
-
-function registerFormats (convict) {
- convict.addFormat({
- name: 'map',
- validate: (val) => {
- if (!(val == null || val.constructor === Object)) throw new Error('must be a map (i.e., key/value pairs)')
- },
- coerce: (val, config, name) => {
- if (config == null) return val
- const accum = config.has(name) ? config.get(name) : {}
- let match
- ARGS_SCANNER_RX.lastIndex = 0
- while ((match = ARGS_SCANNER_RX.exec(val))) {
- const [, k, v] = match
- if (k) accum[k] = v ? (v === '-' ? '-' : yaml.load(v)) : ''
- }
- return accum
- },
- })
- convict.addFormat({
- name: 'primitive-map',
- validate: (val) => {
- if (val == null) return
- if (
- !(
- val.constructor === Object &&
- Object.entries(val).every(([k, v]) => k && (!v || ~PRIMITIVE_TYPES.indexOf(v.constructor)))
- )
- ) {
- throw new Error('must be a primitive map (i.e., key/value pairs, primitive values only)')
- }
- },
- coerce: (val, config, name) => {
- if (config == null) return val
- const accum = config.has(name) ? config.get(name) : {}
- let match
- ARGS_SCANNER_RX.lastIndex = 0
- while ((match = ARGS_SCANNER_RX.exec(val))) {
- const [, k, v] = match
- if (k) {
- let parsed
- if (v && v !== '-') {
- parsed = yaml.load(v)
- if (parsed && PRIMITIVE_TYPES.indexOf(parsed.constructor) < 0) parsed = v
- } else {
- parsed = v || ''
- }
- accum[~k.indexOf('-') ? k.replace(/-/g, '_') : k] = parsed
- }
- }
- return accum
- },
- })
- convict.addFormat({
- name: 'boolean-or-string',
- validate: (val) => {
- if (!(val == null || val.constructor === String || val.constructor === Boolean)) {
- throw new Error('must be a boolean or string')
- }
- },
- })
- convict.addFormat({
- name: 'dir-or-virtual-files',
- validate: (val) => {
- if (!(val == null || val.constructor === String || Array.isArray(val))) {
- throw new Error('must be a directory path or list of virtual files')
- }
- },
- })
- convict.addFormat({
- name: 'url',
- validate: (val) => {
- if (val == null) return
- if (val.constructor !== String) throw new Error('must be a string')
- let protocol
- try {
- protocol = new URL(val).protocol
- } catch {
- throw new Error('must be a valid URL')
- }
- if (!(protocol === 'https:' || protocol === 'http:')) throw new Error('must be an HTTP or HTTPS URL')
- },
- })
- convict.addFormat({
- name: 'url-or-pathname',
- validate: (val) => {
- if (val == null) return
- if (val.constructor !== String) throw new Error('must be a string')
- let parsedUrl
- try {
- parsedUrl = new URL((val.charAt() === '/' ? 'https://example.org' : '') + val)
- } catch {
- throw new Error('must be a valid URL or a pathname (i.e., root-relative path)')
- }
- if (parsedUrl.protocol !== 'https:' && parsedUrl.protocol !== 'http:') {
- throw new Error('must be an HTTP or HTTPS URL or a pathname (i.e., root-relative path)')
- }
- if (~parsedUrl.pathname.indexOf('%20')) throw new Error('pathname segment must not contain spaces')
- },
- })
-}
-
-module.exports = solitaryConvict
diff --git a/node_modules/@antora/playbook-builder/package.json b/node_modules/@antora/playbook-builder/package.json
deleted file mode 100644
index 7147001d..00000000
--- a/node_modules/@antora/playbook-builder/package.json
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "_from": "@antora/playbook-builder@3.0.0-alpha.7",
- "_id": "@antora/playbook-builder@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-qussIcBunzaRsPagED3IifFnWcc9okFnq+eyyN8FEF40AOyH/ZkSJvkyb//GPdfsa8rELj0BRvIrdUMiefIH/A==",
- "_location": "/@antora/playbook-builder",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/playbook-builder@3.0.0-alpha.7",
- "name": "@antora/playbook-builder",
- "escapedName": "@antora%2fplaybook-builder",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/cli",
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/playbook-builder/-/playbook-builder-3.0.0-alpha.7.tgz",
- "_shasum": "f8d6b6b69e0a697352d0957f52a7632ff53822f4",
- "_spec": "@antora/playbook-builder@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/cli",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- },
- {
- "name": "Hubert SABLONNIÈRE",
- "email": "hubert.sablonniere@gmail.com"
- }
- ],
- "dependencies": {
- "@antora/logger": "3.0.0-alpha.7",
- "@iarna/toml": "~2.2",
- "camelcase-keys": "~6.2",
- "convict": "~6.1",
- "js-yaml": "~4.1",
- "json5": "~2.2"
- },
- "deprecated": false,
- "description": "Builds a playbook object from user input for configuring successive documentation components in an Antora pipeline.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "config",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/playbook-builder",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/redirect-producer/LICENSE b/node_modules/@antora/redirect-producer/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/redirect-producer/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/redirect-producer/README.md b/node_modules/@antora/redirect-producer/README.md
deleted file mode 100644
index 908b2053..00000000
--- a/node_modules/@antora/redirect-producer/README.md
+++ /dev/null
@@ -1,17 +0,0 @@
-# Antora Redirect Producer
-
-The redirect producer is the component in Antora responsible for producing redirects (HTTP redirections) to a given page from its registered aliases.
-These redirects are derived from alias entries in the content catalog.
-
-This component can produce redirects using different facilities.
-If the deployment environment does not offer redirect capabilities, Antora can output static HTML redirect pages (for client-side redirection).
-If redirect capabilities are available in the deployment environment, such as rewrite rules in nginx, Antora can output a suitable server configuration file (for server-side redirection).
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/redirect-producer/lib/index.js b/node_modules/@antora/redirect-producer/lib/index.js
deleted file mode 100644
index a73f6deb..00000000
--- a/node_modules/@antora/redirect-producer/lib/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-'use strict'
-
-/**
- * Redirect Producer component for Antora
- *
- * Produces HTTP redirection configuration suitable for the redirect facility
- * provided by the target environment (e.g., static bounce pages, nginx
- * rewrite rules, mod_rewrite rules, netlify redirects file, etc.).
- */
-module.exports = require('./produce-redirects')
diff --git a/node_modules/@antora/redirect-producer/lib/produce-redirects.js b/node_modules/@antora/redirect-producer/lib/produce-redirects.js
deleted file mode 100644
index 17ea1633..00000000
--- a/node_modules/@antora/redirect-producer/lib/produce-redirects.js
+++ /dev/null
@@ -1,152 +0,0 @@
-'use strict'
-
-const computeRelativeUrlPath = require('@antora/asciidoc-loader/lib/util/compute-relative-url-path')
-const File = require('vinyl')
-
-const ENCODED_SPACE_RX = /%20/g
-
-/**
- * Produces redirects (HTTP redirections) for registered page aliases.
- *
- * Iterates over files in the alias family from the content catalog and creates artifacts that
- * handle redirects from the URL of each alias to the target URL. The artifact that is created
- * depends on the redirect facility in use. If the redirect facility is static (the default), this
- * function populates the contents of the alias file with an HTML redirect page (i.e., bounce page).
- * If the redirect facility is nginx, this function creates and returns an nginx configuration file
- * that contains rewrite rules for each alias. If the redirect facility is disabled, this function
- * unpublishes the alias files by removing the out property on each alias file.
- *
- * @memberof redirect-producer
- *
- * @param {Object} playbook - The configuration object for Antora.
- * @param {Object} playbook.site - Site-related configuration data.
- * @param {String} playbook.site.url - The base URL of the site.
- * @param {String} playbook.urls - URL-related configuration data.
- * @param {String} playbook.urls.redirectFacility - The redirect facility for
- * which redirect configuration is being produced.
- * @param {ContentCatalog} contentCatalog - The content catalog that provides
- * access to the virtual content files (i.e., pages) in the site.
- * @returns {Array} An array of File objects that contain rewrite configuration for the web server.
- */
-function produceRedirects (playbook, contentCatalog) {
- const aliases = contentCatalog.findBy({ family: 'alias' })
- if (!aliases.length) return []
- let siteUrl = playbook.site.url
- if (siteUrl) {
- if (siteUrl === '/') siteUrl = ''
- else if (siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1)
- }
- switch (playbook.urls.redirectFacility) {
- case 'httpd':
- return createHttpdHtaccess(aliases, extractUrlPath(siteUrl))
- case 'netlify':
- return createNetlifyRedirects(
- aliases,
- extractUrlPath(siteUrl),
- (playbook.urls.htmlExtensionStyle || 'default') === 'default'
- )
- case 'nginx':
- return createNginxRewriteConf(aliases, extractUrlPath(siteUrl))
- case 'static':
- return populateStaticRedirectFiles(
- aliases.filter((it) => it.out),
- siteUrl
- )
- default:
- return unpublish(aliases)
- }
-}
-
-function extractUrlPath (url) {
- if (url) {
- if (url.charAt() === '/') return url
- const urlPath = new URL(url).pathname
- return urlPath === '/' ? '' : urlPath
- } else {
- return ''
- }
-}
-
-function createHttpdHtaccess (files, urlPath) {
- const rules = files.reduce((accum, file) => {
- delete file.out
- let fromUrl = file.pub.url
- fromUrl = ~fromUrl.indexOf('%20') ? `'${urlPath}${fromUrl.replace(ENCODED_SPACE_RX, ' ')}'` : urlPath + fromUrl
- let toUrl = file.rel.pub.url
- toUrl = ~toUrl.indexOf('%20') ? `'${urlPath}${toUrl.replace(ENCODED_SPACE_RX, ' ')}'` : urlPath + toUrl
- // see https://httpd.apache.org/docs/current/en/mod/mod_alias.html#redirect
- // NOTE: redirect rule for directory prefix does not require trailing slash
- accum.push(`Redirect ${file.pub.splat ? '302' : '301'} ${fromUrl} ${toUrl}`)
- return accum
- }, [])
- return [new File({ contents: Buffer.from(rules.join('\n') + '\n'), out: { path: '.htaccess' } })]
-}
-
-// NOTE: a trailing slash on the pathname will be ignored
-// see https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash
-// however, we keep it when generating the rules for clarity
-function createNetlifyRedirects (files, urlPath, includeDirectoryRedirects = false) {
- const rules = files.reduce((accum, file) => {
- delete file.out
- const fromUrl = urlPath + file.pub.url
- const toUrl = urlPath + file.rel.pub.url
- if (file.pub.splat) {
- accum.push(`${fromUrl}/* ${toUrl}/:splat 302!`)
- } else {
- accum.push(`${fromUrl} ${toUrl} 301!`)
- if (includeDirectoryRedirects && fromUrl.endsWith('/index.html')) {
- accum.push(`${fromUrl.substr(0, fromUrl.length - 10)} ${toUrl} 301!`)
- }
- }
- return accum
- }, [])
- return [new File({ contents: Buffer.from(rules.join('\n') + '\n'), out: { path: '_redirects' } })]
-}
-
-function createNginxRewriteConf (files, urlPath) {
- const rules = files.map((file) => {
- delete file.out
- let fromUrl = file.pub.url
- fromUrl = ~fromUrl.indexOf('%20') ? `'${urlPath}${fromUrl.replace(ENCODED_SPACE_RX, ' ')}'` : urlPath + fromUrl
- let toUrl = file.rel.pub.url
- toUrl = ~toUrl.indexOf('%20') ? `'${urlPath}${toUrl.replace(ENCODED_SPACE_RX, ' ')}'` : urlPath + toUrl
- if (file.pub.splat) {
- return `location ^~ ${fromUrl}/ { rewrite ^${regexpEscape(fromUrl)}/(.*)$ ${regexpEscape(toUrl)}/$1 redirect; }`
- } else {
- return `location = ${fromUrl} { return 301 ${toUrl}; }`
- }
- })
- return [new File({ contents: Buffer.from(rules.join('\n') + '\n'), out: { path: '.etc/nginx/rewrite.conf' } })]
-}
-
-function populateStaticRedirectFiles (files, siteUrl) {
- files.forEach((file) => (file.contents = Buffer.from(createStaticRedirectContents(file, siteUrl) + '\n')))
- return []
-}
-
-function createStaticRedirectContents (file, siteUrl) {
- const targetUrl = file.rel.pub.url
- const relativeUrl = computeRelativeUrlPath(file.pub.url, targetUrl)
- const canonicalUrl = siteUrl && siteUrl.charAt() !== '/' ? siteUrl + targetUrl : undefined
- const canonicalLink = canonicalUrl ? ` \n` : ''
- return `
-
-${canonicalLink}
-
-
-Redirect Notice
-Redirect Notice
-The page you requested has been relocated to ${canonicalUrl || relativeUrl} .
`
-}
-
-function unpublish (files) {
- files.forEach((file) => delete file.out)
- return []
-}
-
-function regexpEscape (str) {
- // we don't escape "-" since it's meaningless in a literal
- return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
-}
-
-module.exports = produceRedirects
diff --git a/node_modules/@antora/redirect-producer/package.json b/node_modules/@antora/redirect-producer/package.json
deleted file mode 100644
index 64aaa68f..00000000
--- a/node_modules/@antora/redirect-producer/package.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
- "_from": "@antora/redirect-producer@3.0.0-alpha.7",
- "_id": "@antora/redirect-producer@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-4iRjkgnt6vy32oVAqHXJuUdTs5wOPATacXejQZPzuccC9tQFCS4XXu0EGopbj7iaD9Ou0IyljYU+oasNemCmww==",
- "_location": "/@antora/redirect-producer",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/redirect-producer@3.0.0-alpha.7",
- "name": "@antora/redirect-producer",
- "escapedName": "@antora%2fredirect-producer",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/redirect-producer/-/redirect-producer-3.0.0-alpha.7.tgz",
- "_shasum": "e7c4b2ab82d7d4239c1b9c245a58f7069e07ef1d",
- "_spec": "@antora/redirect-producer@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- }
- ],
- "dependencies": {
- "@antora/asciidoc-loader": "3.0.0-alpha.7",
- "vinyl": "~2.2"
- },
- "deprecated": false,
- "description": "Produces redirects (HTTP redirections) for pages in an Antora site.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "redirects",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/redirect-producer",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/site-generator-default/LICENSE b/node_modules/@antora/site-generator-default/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/site-generator-default/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/site-generator-default/README.md b/node_modules/@antora/site-generator-default/README.md
deleted file mode 100644
index 4015681f..00000000
--- a/node_modules/@antora/site-generator-default/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Antora Default Site Generator
-
-This is the default site generator pipeline for Antora.
-This pipeline is invoked by the `generate` command of Antora's CLI to produce and publish static documentation sites.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/site-generator-default/lib/generate-site.js b/node_modules/@antora/site-generator-default/lib/generate-site.js
deleted file mode 100644
index e072fd78..00000000
--- a/node_modules/@antora/site-generator-default/lib/generate-site.js
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict'
-
-const aggregateContent = require('@antora/content-aggregator')
-const buildNavigation = require('@antora/navigation-builder')
-const buildPlaybook = require('@antora/playbook-builder')
-const classifyContent = require('@antora/content-classifier')
-const convertDocuments = require('@antora/document-converter')
-const createPageComposer = require('@antora/page-composer')
-const loadUi = require('@antora/ui-loader')
-const mapSite = require('@antora/site-mapper')
-const produceRedirects = require('@antora/redirect-producer')
-const publishSite = require('@antora/site-publisher')
-const { resolveAsciiDocConfig } = require('@antora/asciidoc-loader')
-
-async function generateSite (args, env) {
- const playbook = buildPlaybook(args, env)
- const asciidocConfig = resolveAsciiDocConfig(playbook)
- const [contentCatalog, uiCatalog] = await Promise.all([
- aggregateContent(playbook).then((contentAggregate) => classifyContent(playbook, contentAggregate, asciidocConfig)),
- loadUi(playbook),
- ])
- const pages = convertDocuments(contentCatalog, asciidocConfig)
- const navigationCatalog = buildNavigation(contentCatalog, asciidocConfig)
- const composePage = createPageComposer(playbook, contentCatalog, uiCatalog, env)
- pages.forEach((page) => composePage(page, contentCatalog, navigationCatalog))
- const siteFiles = [...mapSite(playbook, pages), ...produceRedirects(playbook, contentCatalog)]
- if (playbook.site.url) siteFiles.push(composePage(create404Page()))
- const siteCatalog = { getFiles: () => siteFiles }
- return publishSite(playbook, [contentCatalog, uiCatalog, siteCatalog]).then((publications) => {
- if (!playbook.runtime.quiet && process.stdout.isTTY) {
- process.stdout.write('Site generation complete!\n')
- publications.forEach(
- ({ fileUri }) => fileUri && process.stdout.write(`View the site by visiting ${fileUri} in a browser.\n`)
- )
- }
- return publications
- })
-}
-
-function create404Page () {
- return {
- title: 'Page Not Found',
- mediaType: 'text/html',
- src: { stem: '404' },
- out: { path: '404.html' },
- pub: { url: '/404.html', rootPath: '' },
- }
-}
-
-module.exports = generateSite
diff --git a/node_modules/@antora/site-generator-default/lib/index.js b/node_modules/@antora/site-generator-default/lib/index.js
deleted file mode 100644
index bc13001e..00000000
--- a/node_modules/@antora/site-generator-default/lib/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict'
-
-/**
- * Default Site Generator component for Antora
- *
- * Runs an Antora pipeline using the default set of components with a focus on
- * producing and publishing a documentation site. This component represents
- * just one way the Antora components can be organized into a site generation
- * pipeline.
- *
- * @namespace site-generator-default
- */
-module.exports = require('./generate-site')
diff --git a/node_modules/@antora/site-generator-default/package.json b/node_modules/@antora/site-generator-default/package.json
deleted file mode 100644
index 7b65ae00..00000000
--- a/node_modules/@antora/site-generator-default/package.json
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "_from": "@antora/site-generator-default@3.0.0-alpha.7",
- "_id": "@antora/site-generator-default@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-Pz3wwFpc0J3kax7VTOTaFn+7mAJCa2KUNdES3o1K/7sGTuVeDYlYrE+W7Pd59ZwjWu0WPf4mIOV2ny1H5Ag1jw==",
- "_location": "/@antora/site-generator-default",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/site-generator-default@3.0.0-alpha.7",
- "name": "@antora/site-generator-default",
- "escapedName": "@antora%2fsite-generator-default",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "#DEV:/"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/site-generator-default/-/site-generator-default-3.0.0-alpha.7.tgz",
- "_shasum": "6dcef7025596cc972e5a5e55f3ae750a1af89f6c",
- "_spec": "@antora/site-generator-default@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- }
- ],
- "dependencies": {
- "@antora/asciidoc-loader": "3.0.0-alpha.7",
- "@antora/content-aggregator": "3.0.0-alpha.7",
- "@antora/content-classifier": "3.0.0-alpha.7",
- "@antora/document-converter": "3.0.0-alpha.7",
- "@antora/navigation-builder": "3.0.0-alpha.7",
- "@antora/page-composer": "3.0.0-alpha.7",
- "@antora/playbook-builder": "3.0.0-alpha.7",
- "@antora/redirect-producer": "3.0.0-alpha.7",
- "@antora/site-mapper": "3.0.0-alpha.7",
- "@antora/site-publisher": "3.0.0-alpha.7",
- "@antora/ui-loader": "3.0.0-alpha.7"
- },
- "deprecated": false,
- "description": "The default site generator pipeline for producing and publishing static documentation sites with Antora.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "generator",
- "pipeline",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/site-generator-default",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/site-mapper/LICENSE b/node_modules/@antora/site-mapper/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/site-mapper/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/site-mapper/README.md b/node_modules/@antora/site-mapper/README.md
deleted file mode 100644
index fec50c80..00000000
--- a/node_modules/@antora/site-mapper/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Antora Site Mapper
-
-The Site Mapper is a component in Antora responsible for generating the sitemap files for the site.
-These files, which are intended to be read by crawlers, provide a list of all published pages by URL.
-The sitemap entries are partitioned by component into sitemap index files, which are then referenced by the main sitemap file.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/site-mapper/lib/index.js b/node_modules/@antora/site-mapper/lib/index.js
deleted file mode 100644
index 0fd3bc58..00000000
--- a/node_modules/@antora/site-mapper/lib/index.js
+++ /dev/null
@@ -1,12 +0,0 @@
-'use strict'
-
-/**
- * Site Mapper component for Antora
- *
- * Maps the site by creating sitemap files. These files, which are intended to be read by crawlers,
- * provide a list of all published pages by URL. The sitemap entries are partitioned by component
- * into sitemap index files, which are then referenced by the main sitemap file.
- *
- * @namespace site-mapper
- */
-module.exports = require('./map-site')
diff --git a/node_modules/@antora/site-mapper/lib/map-site.js b/node_modules/@antora/site-mapper/lib/map-site.js
deleted file mode 100644
index 6ef8f265..00000000
--- a/node_modules/@antora/site-mapper/lib/map-site.js
+++ /dev/null
@@ -1,152 +0,0 @@
-'use strict'
-
-const File = require('vinyl')
-const versionCompare = require('@antora/content-classifier/lib/util/version-compare-desc')
-
-const XML_DECL = ''
-const SITEMAPS_NS = 'http://www.sitemaps.org/schemas/sitemap/0.9'
-const SITEMAP_STEM = 'sitemap'
-const SITEMAP_PREFIX = 'sitemap-'
-
-/**
- * Maps the site by creating sitemap files.
- *
- * Iterates over the specified pages and creates sitemap files that list the
- * URLs for these pages. If there's only one component, all the entries are
- * added to a sitemap.xml file that gets published to the root of the site. If
- * there's more than one component, the sitemaps are partitioned into separate
- * files by component (e.g., sitemap-component-name.xml). The URL of those
- * component sitemaps are listed in the sitemap.xml index file that gets
- * published to the root of the site.
- *
- * The entries are listed in alphabetical order by URL. URLs with newer
- * versions are listed before URLs of older versions according to the semantic
- * versioning-based sorting algorithm used in Antora.
- *
- * The sitemaps are only created if a url for the site has been defined to
- * the site.url property in the playbook.
- *
- * If the site.robots key is set in the playbook, this function generates a
- * robots.txt file from that value. If the value matches the string 'allow' the
- * function creates a robots.txt file that allows access from all user agents
- * to all paths. If the value matches the string 'disallow', the function
- * creates a robots.txt file that disallows access from all user agents to all
- * paths. Otherwise, if the value is non-empty (i.e., a custom string), the
- * function creates a robots.txt file using that value.
- *
- * @memberof site-mapper
- *
- * @param {Object} playbook - The configuration object for Antora.
- * @param {Object} playbook.site - Site-related configuration data.
- * @param {String} playbook.site.url - The base URL of the site.
- * @param {Array} pages - The publishable pages to to map.
- * @returns {Array} An array of File objects that represent the sitemaps.
- */
-function mapSite (playbook, pages) {
- let siteUrl = playbook.site.url
- if (!(siteUrl && pages.length)) return []
- const robots = playbook.site.robots
- if (siteUrl.charAt() === '/') return robots ? [createRobotsExclusionFile(robots)] : []
- if (siteUrl.charAt(siteUrl.length - 1) === '/') siteUrl = siteUrl.substr(0, siteUrl.length - 1)
- const lastmodISO = new Date().toISOString()
- let sitemaps = pages.reduce((accum, file) => {
- const componentSitemap = getSitemapForComponent(siteUrl, accum, file.src.component)
- const version = file.src.version
- componentSitemap.entries.push({
- url: file.pub.url,
- version,
- lastmodISO,
- })
- componentSitemap.versions.add(version)
- return accum
- }, new Map())
- sitemaps = [...sitemaps.keys()]
- .sort((a, b) => a.localeCompare(b))
- .map((component) => {
- const sitemap = sitemaps.get(component)
- let sitemapEntries = sitemap.entries
- delete sitemap.entries
- sitemapEntries.sort((a, b) => a.url.localeCompare(b.url))
- if (sitemap.versions.size > 1) sitemapEntries.sort((a, b) => versionCompare(a.version, b.version))
- delete sitemap.versions
- sitemapEntries = sitemapEntries.map(createUrlElement.bind(null, siteUrl))
- sitemap.contents = Buffer.from(createSitemapDocument(sitemapEntries) + '\n')
- return sitemap
- })
- let sitemapIndex
- if (sitemaps.length > 1) {
- const sitemapIndexEntries = sitemaps.map(createSitemapElement.bind(null, siteUrl))
- sitemapIndex = new File({ contents: Buffer.from(createSitemapIndexDocument(sitemapIndexEntries) + '\n') })
- sitemaps.unshift(sitemapIndex)
- } else {
- sitemapIndex = sitemaps[0]
- }
- const basename = SITEMAP_STEM + '.xml'
- sitemapIndex.out = { path: basename }
- sitemapIndex.pub = { url: '/' + basename }
- return robots ? [...sitemaps, createRobotsExclusionFile(robots)] : sitemaps
-}
-
-function getSitemapForComponent (siteUrl, sitemaps, component) {
- if (sitemaps.has(component)) {
- return sitemaps.get(component)
- } else {
- const basename = `${SITEMAP_PREFIX}${component}.xml`
- const componentSitemap = new File({
- entries: [],
- out: { path: basename },
- pub: { url: '/' + basename },
- versions: new Set(),
- })
- sitemaps.set(component, componentSitemap)
- return componentSitemap
- }
-}
-
-function createSitemapElement (siteUrl, sitemap) {
- return `
-${siteUrl}${escapeHtml(sitemap.pub.url)}
- `
-}
-
-function createSitemapIndexDocument (entries) {
- return `${XML_DECL}
-
-${entries.join('\n')}
- `
-}
-
-function createUrlElement (siteUrl, entry) {
- return `
-${siteUrl}${escapeHtml(entry.url)}
-${entry.lastmodISO}
- `
-}
-
-function createSitemapDocument (entries) {
- return `${XML_DECL}
-
-${entries.join('\n')}
- `
-}
-
-function createRobotsExclusionFile (robots) {
- if (robots === 'allow') {
- robots = 'User-agent: *\nAllow: /'
- } else if (robots === 'disallow') {
- robots = 'User-agent: *\nDisallow: /'
- } else {
- robots = robots.trimRight()
- }
- return new File({
- out: { path: 'robots.txt' },
- pub: { url: '/robots.txt' },
- contents: Buffer.from(robots + '\n'),
- })
-}
-
-function escapeHtml (str) {
- return str.replace(/&/g, '&').replace(/=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "sitemap",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/site-mapper",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/site-publisher/LICENSE b/node_modules/@antora/site-publisher/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/site-publisher/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/site-publisher/README.md b/node_modules/@antora/site-publisher/README.md
deleted file mode 100644
index 97b01680..00000000
--- a/node_modules/@antora/site-publisher/README.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Antora Site Publisher
-
-The Site Publisher is a component in Antora responsible for publishing (i.e., writing) the generated files to the destination(s) specified in the playbook.
-More than one destination may be specified, and this component supports different destination types (via providers) such as a filesystem directory or an archive file.
-Custom providers can be used to add support for additional destinations.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/site-publisher/lib/constants.js b/node_modules/@antora/site-publisher/lib/constants.js
deleted file mode 100644
index 71ec8257..00000000
--- a/node_modules/@antora/site-publisher/lib/constants.js
+++ /dev/null
@@ -1,6 +0,0 @@
-'use strict'
-
-module.exports = Object.freeze({
- DEFAULT_DEST_FS: './build/site',
- DEFAULT_DEST_ARCHIVE: './build/site.zip',
-})
diff --git a/node_modules/@antora/site-publisher/lib/index.js b/node_modules/@antora/site-publisher/lib/index.js
deleted file mode 100644
index 46282a6c..00000000
--- a/node_modules/@antora/site-publisher/lib/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-/**
- * Site Publisher component for Antora
- *
- * Publishes the files generated in an Antora documentation pipeline to the
- * destination(s) specified in the playbook.
- *
- * @namespace site-publisher
- */
-module.exports = require('./publish-site')
diff --git a/node_modules/@antora/site-publisher/lib/providers/archive.js b/node_modules/@antora/site-publisher/lib/providers/archive.js
deleted file mode 100644
index 079dee9a..00000000
--- a/node_modules/@antora/site-publisher/lib/providers/archive.js
+++ /dev/null
@@ -1,17 +0,0 @@
-'use strict'
-
-const expandPath = require('@antora/expand-path-helper')
-const publishStream = require('./common/publish-stream')
-const { dest: vzipDest } = require('gulp-vinyl-zip')
-
-const { DEFAULT_DEST_ARCHIVE } = require('../constants.js')
-
-// FIXME right now we're assuming the archive is a zip
-function publishToArchive (config, files, playbook) {
- const destFile = config.path || DEFAULT_DEST_ARCHIVE
- const absDestFile = expandPath(destFile, '~+', playbook.dir || '.')
- const report = { provider: 'archive', path: destFile, resolvedPath: absDestFile }
- return publishStream(vzipDest(absDestFile), files).then(() => report)
-}
-
-module.exports = publishToArchive
diff --git a/node_modules/@antora/site-publisher/lib/providers/common/publish-stream.js b/node_modules/@antora/site-publisher/lib/providers/common/publish-stream.js
deleted file mode 100644
index 8492cc70..00000000
--- a/node_modules/@antora/site-publisher/lib/providers/common/publish-stream.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict'
-
-/**
- * Pipes the stream of files to the specified Vinyl destination adapter.
- *
- * Pipes a stream of virtual files to the specified Vinyl destination adapter
- * (a stream transform function) and returns a Promise that resolves when the
- * stream ends.
- *
- * @memberof site-publisher
- *
- * @param {Function} destAdapter - A Vinyl destination adapter, preconfigured to
- * write to a destination (e.g., `require('vinyl-fs').dest('path/to/dir')`).
- * @param {Readable} files - A Readable stream of virtual files to publish.
- * @returns {Promise} A promise that resolves when the stream has ended.
- */
-function publishStream (destAdapter, files) {
- return new Promise((resolve, reject) =>
- files
- .pipe(destAdapter)
- .on('error', reject)
- .on('end', resolve)
- )
-}
-
-module.exports = publishStream
diff --git a/node_modules/@antora/site-publisher/lib/providers/fs.js b/node_modules/@antora/site-publisher/lib/providers/fs.js
deleted file mode 100644
index 0c290528..00000000
--- a/node_modules/@antora/site-publisher/lib/providers/fs.js
+++ /dev/null
@@ -1,58 +0,0 @@
-'use strict'
-
-const expandPath = require('@antora/expand-path-helper')
-const { promises: fsp } = require('fs')
-const ospath = require('path')
-const posixify = ospath.sep === '\\' ? (p) => p.replace(/\\/g, '/') : undefined
-const publishStream = require('./common/publish-stream')
-const { dest: vfsDest } = require('vinyl-fs')
-
-const { DEFAULT_DEST_FS } = require('../constants.js')
-
-function publishToFs (config, files, playbook) {
- const destDir = config.path || DEFAULT_DEST_FS
- const absDestDir = expandPath(destDir, '~+', playbook.dir || '.')
- const report = {
- provider: 'fs',
- path: destDir,
- resolvedPath: absDestDir,
- fileUri: 'file://' + (posixify ? '/' + posixify(absDestDir) : absDestDir),
- }
- return config.clean
- ? rmdir(absDestDir)
- .then(() => publishStream(vfsDest(absDestDir), files))
- .then(() => report)
- : publishStream(vfsDest(absDestDir), files).then(() => report)
-}
-
-/**
- * Removes the specified directory (including all of its contents) or file.
- * Equivalent to fs.promises.rmdir(dir, { recursive: true }) in Node 12.
- */
-function rmdir (dir) {
- return fsp
- .readdir(dir, { withFileTypes: true })
- .then((lst) =>
- Promise.all(
- lst.map((it) =>
- it.isDirectory()
- ? rmdir(ospath.join(dir, it.name))
- : fsp.unlink(ospath.join(dir, it.name)).catch((unlinkErr) => {
- if (unlinkErr.code !== 'ENOENT') throw unlinkErr
- })
- )
- )
- )
- .then(() => fsp.rmdir(dir))
- .catch((err) => {
- if (err.code === 'ENOENT') return
- if (err.code === 'ENOTDIR') {
- return fsp.unlink(dir).catch((unlinkErr) => {
- if (unlinkErr.code !== 'ENOENT') throw unlinkErr
- })
- }
- throw err
- })
-}
-
-module.exports = publishToFs
diff --git a/node_modules/@antora/site-publisher/lib/publish-site.js b/node_modules/@antora/site-publisher/lib/publish-site.js
deleted file mode 100644
index 3825a8fe..00000000
--- a/node_modules/@antora/site-publisher/lib/publish-site.js
+++ /dev/null
@@ -1,99 +0,0 @@
-'use strict'
-
-const ReadableOutputFileArray = require('./readable-output-file-array')
-const requireProvider = require('./require-provider')()
-
-const { DEFAULT_DEST_FS } = require('./constants.js')
-
-/**
- * Publishes all publishable files in the specified catalogs using the
- * destination providers specified in the playbook.
- *
- * This function starts by retrieving all publishable files from the specified
- * collection of catalogs (currently those files with an out property). It then
- * resolves the publish function for each destination provider specified in the
- * playbook (i.e., `output.destinations`). If the provider is not known, the
- * publish function for that provider is resolved by requiring a module (or
- * relative path) having the same name as the provider. Once the publish
- * function is resolved, the configuration specified in the playbook for that
- * provider is bound to the function as its first argument. This function then
- * iterates over all publish providers and passes a Readable of the publishable
- * files as the second argument and the playbook as the third. The path of each
- * file has been updated to match the `out.path` value (currently by
- * instantiating a copy of the file).
- *
- * If a directory is specified directly on the output property of the playbook
- * (i.e., `output.dir`), that directory is used to create or override the first
- * fs provider in the list of destinations. If the clean property is set directly
- * on the output property of the playbook (i.e., `output.clean`), the clean
- * property is added to the configuration for each provider.
- *
- * @memberof site-publisher
- *
- * @param {Object} playbook - The configuration object for Antora that provides
- * access to the output destinations.
- * @param {Array} catalogs - The collection of catalogs from which to retrieve the
- * publishable virtual files.
- * @returns Nothing.
- */
-// QUESTION should this function return a report of virtual files that were published (by provider)
-async function publishSite (playbook, catalogs) {
- const output = playbook.output
- const destinations = getDestinations(output)
-
- if (!destinations.length) return []
-
- const clean = output.clean
- const publishers = destinations.map((destination) => {
- const { provider, options } = resolveDestination(destination, clean)
- switch (provider) {
- case 'archive':
- case 'fs':
- return require('./providers/' + provider).bind(null, options)
- default:
- try {
- return requireProvider(provider, playbook.dir || '.').bind(null, options)
- } catch {
- throw new Error('Unsupported destination provider: ' + provider)
- }
- }
- })
-
- // Q: add getPublishableFiles / getOutFiles; return a stream? or getOutFilesAsStream?
- const filesToPublish = catalogs.reduce((accum, catalog) => {
- // remove fallback check for getFiles on site catalog in Antora 4
- accum.push(...(catalog.getFiles || catalog.getAll).apply(catalog).filter((file) => file.out))
- return accum
- }, [])
-
- return Promise.all(publishers.map((publish) => publish(new ReadableOutputFileArray(filesToPublish), playbook)))
-}
-
-function getDestinations (output) {
- let destinations = output.destinations
- if (output.dir) {
- if (destinations && destinations.length) {
- destinations = destinations.slice(0)
- const primaryFsDestIdx = destinations.findIndex(({ provider: candidate }) => candidate === 'fs')
- if (~primaryFsDestIdx) {
- ;(destinations[primaryFsDestIdx] = Object.assign({}, destinations[primaryFsDestIdx])).path = output.dir
- } else {
- destinations.unshift({ provider: 'fs', path: output.dir })
- }
- } else {
- destinations = [{ provider: 'fs', path: output.dir }]
- }
- } else if (!destinations) {
- destinations = [{ provider: 'fs', path: DEFAULT_DEST_FS }]
- }
-
- return destinations
-}
-
-function resolveDestination (destination, clean) {
- const { provider, ...options } = destination
- if (clean) options.clean = true
- return { provider, options }
-}
-
-module.exports = publishSite
diff --git a/node_modules/@antora/site-publisher/lib/readable-output-file-array.js b/node_modules/@antora/site-publisher/lib/readable-output-file-array.js
deleted file mode 100644
index ddb81ee0..00000000
--- a/node_modules/@antora/site-publisher/lib/readable-output-file-array.js
+++ /dev/null
@@ -1,30 +0,0 @@
-'use strict'
-
-const { Readable } = require('stream')
-const Vinyl = require('vinyl')
-
-class File extends Vinyl {
- get relative () {
- return this.path
- }
-}
-
-class ReadableOutputFileArray extends Readable {
- constructor (array) {
- super({ objectMode: true })
- this.array = array.slice(0)
- }
-
- _read (size) {
- const read = this.array.splice(0, size)
- while (read.length) this.push(toOutputFile(read.shift()))
- if (!this.array.length) this.push(null)
- }
-}
-
-function toOutputFile (file) {
- // Q: do we also need to clone contents and stat?
- return new File({ contents: file.contents, path: file.out.path, stat: file.stat })
-}
-
-module.exports = ReadableOutputFileArray
diff --git a/node_modules/@antora/site-publisher/lib/require-provider.js b/node_modules/@antora/site-publisher/lib/require-provider.js
deleted file mode 100644
index 9369664e..00000000
--- a/node_modules/@antora/site-publisher/lib/require-provider.js
+++ /dev/null
@@ -1,51 +0,0 @@
-'use strict'
-
-const ospath = require('path')
-
-const DOT_RELATIVE_RX = new RegExp(`^\\.{1,2}[/${ospath.sep.replace('/', '').replace('\\', '\\\\')}]`)
-
-/**
- * Generates a function to resolve and require a custom provider.
- *
- * @memberof site-publisher
- *
- * @returns {Function} A function to require a provider.
- */
-function createRequireProvider () {
- const requestCache = new Map()
- /**
- * Requires a provider, first resolving the path if necessary.
- *
- * If the request is an absolute path, that value is used as is. If the
- * request begins with a dot (.), the value is resolved relative to the
- * specified base directory. Otherwise, the request is resolved as the name
- * of a node module, a search which includes the node_modules folder in the
- * specified base directory. The resolved value is then passed to the require
- * function and the result returned.
- *
- * @param {String} request - The path or module name to resolve.
- * @param {String} requireBase - The absolute path from which to resolve a
- * relative path or module name.
- *
- * @returns {Object} The object returned by calling require on the resolved path.
- */
- return function requireProvider (request, requireBase) {
- let resolved = requestCache.get(request)
- if (!resolved) {
- if (request.charAt() === '.' && DOT_RELATIVE_RX.test(request)) {
- resolved = ospath.resolve(requireBase, request)
- } else if (ospath.isAbsolute(request)) {
- resolved = request
- } else {
- // NOTE appending node_modules prevents require from looking elsewhere before looking in these paths
- const paths = [requireBase, ospath.dirname(__dirname)].map((start) => ospath.join(start, 'node_modules'))
- resolved = require.resolve(request, { paths })
- }
- requestCache.set(request, resolved)
- }
-
- return require(resolved)
- }
-}
-
-module.exports = createRequireProvider
diff --git a/node_modules/@antora/site-publisher/package.json b/node_modules/@antora/site-publisher/package.json
deleted file mode 100644
index d6d3661a..00000000
--- a/node_modules/@antora/site-publisher/package.json
+++ /dev/null
@@ -1,76 +0,0 @@
-{
- "_from": "@antora/site-publisher@3.0.0-alpha.7",
- "_id": "@antora/site-publisher@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-ia2YzE+L00mWtXbDt59Azcvo+4ZM97wiorsxeSBGjT7tFKqO0+BJiZfTwIvEyNPNar7tDvDQj7j996S57DN83A==",
- "_location": "/@antora/site-publisher",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/site-publisher@3.0.0-alpha.7",
- "name": "@antora/site-publisher",
- "escapedName": "@antora%2fsite-publisher",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/site-publisher/-/site-publisher-3.0.0-alpha.7.tgz",
- "_shasum": "a28e7e1558250c339ebe06429146b3e9917f84d5",
- "_spec": "@antora/site-publisher@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- }
- ],
- "dependencies": {
- "@antora/expand-path-helper": "~1.0",
- "gulp-vinyl-zip": "~2.2",
- "vinyl": "~2.2",
- "vinyl-fs": "~3.0"
- },
- "deprecated": false,
- "description": "Publishes the files generated in an Antora documentation pipeline to the destination(s) specified in the playbook.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "publisher",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/site-publisher",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@antora/ui-loader/LICENSE b/node_modules/@antora/ui-loader/LICENSE
deleted file mode 100644
index a612ad98..00000000
--- a/node_modules/@antora/ui-loader/LICENSE
+++ /dev/null
@@ -1,373 +0,0 @@
-Mozilla Public License Version 2.0
-==================================
-
-1. Definitions
---------------
-
-1.1. "Contributor"
- means each individual or legal entity that creates, contributes to
- the creation of, or owns Covered Software.
-
-1.2. "Contributor Version"
- means the combination of the Contributions of others (if any) used
- by a Contributor and that particular Contributor's Contribution.
-
-1.3. "Contribution"
- means Covered Software of a particular Contributor.
-
-1.4. "Covered Software"
- means Source Code Form to which the initial Contributor has attached
- the notice in Exhibit A, the Executable Form of such Source Code
- Form, and Modifications of such Source Code Form, in each case
- including portions thereof.
-
-1.5. "Incompatible With Secondary Licenses"
- means
-
- (a) that the initial Contributor has attached the notice described
- in Exhibit B to the Covered Software; or
-
- (b) that the Covered Software was made available under the terms of
- version 1.1 or earlier of the License, but not also under the
- terms of a Secondary License.
-
-1.6. "Executable Form"
- means any form of the work other than Source Code Form.
-
-1.7. "Larger Work"
- means a work that combines Covered Software with other material, in
- a separate file or files, that is not Covered Software.
-
-1.8. "License"
- means this document.
-
-1.9. "Licensable"
- means having the right to grant, to the maximum extent possible,
- whether at the time of the initial grant or subsequently, any and
- all of the rights conveyed by this License.
-
-1.10. "Modifications"
- means any of the following:
-
- (a) any file in Source Code Form that results from an addition to,
- deletion from, or modification of the contents of Covered
- Software; or
-
- (b) any new file in Source Code Form that contains any Covered
- Software.
-
-1.11. "Patent Claims" of a Contributor
- means any patent claim(s), including without limitation, method,
- process, and apparatus claims, in any patent Licensable by such
- Contributor that would be infringed, but for the grant of the
- License, by the making, using, selling, offering for sale, having
- made, import, or transfer of either its Contributions or its
- Contributor Version.
-
-1.12. "Secondary License"
- means either the GNU General Public License, Version 2.0, the GNU
- Lesser General Public License, Version 2.1, the GNU Affero General
- Public License, Version 3.0, or any later versions of those
- licenses.
-
-1.13. "Source Code Form"
- means the form of the work preferred for making modifications.
-
-1.14. "You" (or "Your")
- means an individual or a legal entity exercising rights under this
- License. For legal entities, "You" includes any entity that
- controls, is controlled by, or is under common control with You. For
- purposes of this definition, "control" means (a) the power, direct
- or indirect, to cause the direction or management of such entity,
- whether by contract or otherwise, or (b) ownership of more than
- fifty percent (50%) of the outstanding shares or beneficial
- ownership of such entity.
-
-2. License Grants and Conditions
---------------------------------
-
-2.1. Grants
-
-Each Contributor hereby grants You a world-wide, royalty-free,
-non-exclusive license:
-
-(a) under intellectual property rights (other than patent or trademark)
- Licensable by such Contributor to use, reproduce, make available,
- modify, display, perform, distribute, and otherwise exploit its
- Contributions, either on an unmodified basis, with Modifications, or
- as part of a Larger Work; and
-
-(b) under Patent Claims of such Contributor to make, use, sell, offer
- for sale, have made, import, and otherwise transfer either its
- Contributions or its Contributor Version.
-
-2.2. Effective Date
-
-The licenses granted in Section 2.1 with respect to any Contribution
-become effective for each Contribution on the date the Contributor first
-distributes such Contribution.
-
-2.3. Limitations on Grant Scope
-
-The licenses granted in this Section 2 are the only rights granted under
-this License. No additional rights or licenses will be implied from the
-distribution or licensing of Covered Software under this License.
-Notwithstanding Section 2.1(b) above, no patent license is granted by a
-Contributor:
-
-(a) for any code that a Contributor has removed from Covered Software;
- or
-
-(b) for infringements caused by: (i) Your and any other third party's
- modifications of Covered Software, or (ii) the combination of its
- Contributions with other software (except as part of its Contributor
- Version); or
-
-(c) under Patent Claims infringed by Covered Software in the absence of
- its Contributions.
-
-This License does not grant any rights in the trademarks, service marks,
-or logos of any Contributor (except as may be necessary to comply with
-the notice requirements in Section 3.4).
-
-2.4. Subsequent Licenses
-
-No Contributor makes additional grants as a result of Your choice to
-distribute the Covered Software under a subsequent version of this
-License (see Section 10.2) or under the terms of a Secondary License (if
-permitted under the terms of Section 3.3).
-
-2.5. Representation
-
-Each Contributor represents that the Contributor believes its
-Contributions are its original creation(s) or it has sufficient rights
-to grant the rights to its Contributions conveyed by this License.
-
-2.6. Fair Use
-
-This License is not intended to limit any rights You have under
-applicable copyright doctrines of fair use, fair dealing, or other
-equivalents.
-
-2.7. Conditions
-
-Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
-in Section 2.1.
-
-3. Responsibilities
--------------------
-
-3.1. Distribution of Source Form
-
-All distribution of Covered Software in Source Code Form, including any
-Modifications that You create or to which You contribute, must be under
-the terms of this License. You must inform recipients that the Source
-Code Form of the Covered Software is governed by the terms of this
-License, and how they can obtain a copy of this License. You may not
-attempt to alter or restrict the recipients' rights in the Source Code
-Form.
-
-3.2. Distribution of Executable Form
-
-If You distribute Covered Software in Executable Form then:
-
-(a) such Covered Software must also be made available in Source Code
- Form, as described in Section 3.1, and You must inform recipients of
- the Executable Form how they can obtain a copy of such Source Code
- Form by reasonable means in a timely manner, at a charge no more
- than the cost of distribution to the recipient; and
-
-(b) You may distribute such Executable Form under the terms of this
- License, or sublicense it under different terms, provided that the
- license for the Executable Form does not attempt to limit or alter
- the recipients' rights in the Source Code Form under this License.
-
-3.3. Distribution of a Larger Work
-
-You may create and distribute a Larger Work under terms of Your choice,
-provided that You also comply with the requirements of this License for
-the Covered Software. If the Larger Work is a combination of Covered
-Software with a work governed by one or more Secondary Licenses, and the
-Covered Software is not Incompatible With Secondary Licenses, this
-License permits You to additionally distribute such Covered Software
-under the terms of such Secondary License(s), so that the recipient of
-the Larger Work may, at their option, further distribute the Covered
-Software under the terms of either this License or such Secondary
-License(s).
-
-3.4. Notices
-
-You may not remove or alter the substance of any license notices
-(including copyright notices, patent notices, disclaimers of warranty,
-or limitations of liability) contained within the Source Code Form of
-the Covered Software, except that You may alter any license notices to
-the extent required to remedy known factual inaccuracies.
-
-3.5. Application of Additional Terms
-
-You may choose to offer, and to charge a fee for, warranty, support,
-indemnity or liability obligations to one or more recipients of Covered
-Software. However, You may do so only on Your own behalf, and not on
-behalf of any Contributor. You must make it absolutely clear that any
-such warranty, support, indemnity, or liability obligation is offered by
-You alone, and You hereby agree to indemnify every Contributor for any
-liability incurred by such Contributor as a result of warranty, support,
-indemnity or liability terms You offer. You may include additional
-disclaimers of warranty and limitations of liability specific to any
-jurisdiction.
-
-4. Inability to Comply Due to Statute or Regulation
----------------------------------------------------
-
-If it is impossible for You to comply with any of the terms of this
-License with respect to some or all of the Covered Software due to
-statute, judicial order, or regulation then You must: (a) comply with
-the terms of this License to the maximum extent possible; and (b)
-describe the limitations and the code they affect. Such description must
-be placed in a text file included with all distributions of the Covered
-Software under this License. Except to the extent prohibited by statute
-or regulation, such description must be sufficiently detailed for a
-recipient of ordinary skill to be able to understand it.
-
-5. Termination
---------------
-
-5.1. The rights granted under this License will terminate automatically
-if You fail to comply with any of its terms. However, if You become
-compliant, then the rights granted under this License from a particular
-Contributor are reinstated (a) provisionally, unless and until such
-Contributor explicitly and finally terminates Your grants, and (b) on an
-ongoing basis, if such Contributor fails to notify You of the
-non-compliance by some reasonable means prior to 60 days after You have
-come back into compliance. Moreover, Your grants from a particular
-Contributor are reinstated on an ongoing basis if such Contributor
-notifies You of the non-compliance by some reasonable means, this is the
-first time You have received notice of non-compliance with this License
-from such Contributor, and You become compliant prior to 30 days after
-Your receipt of the notice.
-
-5.2. If You initiate litigation against any entity by asserting a patent
-infringement claim (excluding declaratory judgment actions,
-counter-claims, and cross-claims) alleging that a Contributor Version
-directly or indirectly infringes any patent, then the rights granted to
-You by any and all Contributors for the Covered Software under Section
-2.1 of this License shall terminate.
-
-5.3. In the event of termination under Sections 5.1 or 5.2 above, all
-end user license agreements (excluding distributors and resellers) which
-have been validly granted by You or Your distributors under this License
-prior to termination shall survive termination.
-
-************************************************************************
-* *
-* 6. Disclaimer of Warranty *
-* ------------------------- *
-* *
-* Covered Software is provided under this License on an "as is" *
-* basis, without warranty of any kind, either expressed, implied, or *
-* statutory, including, without limitation, warranties that the *
-* Covered Software is free of defects, merchantable, fit for a *
-* particular purpose or non-infringing. The entire risk as to the *
-* quality and performance of the Covered Software is with You. *
-* Should any Covered Software prove defective in any respect, You *
-* (not any Contributor) assume the cost of any necessary servicing, *
-* repair, or correction. This disclaimer of warranty constitutes an *
-* essential part of this License. No use of any Covered Software is *
-* authorized under this License except under this disclaimer. *
-* *
-************************************************************************
-
-************************************************************************
-* *
-* 7. Limitation of Liability *
-* -------------------------- *
-* *
-* Under no circumstances and under no legal theory, whether tort *
-* (including negligence), contract, or otherwise, shall any *
-* Contributor, or anyone who distributes Covered Software as *
-* permitted above, be liable to You for any direct, indirect, *
-* special, incidental, or consequential damages of any character *
-* including, without limitation, damages for lost profits, loss of *
-* goodwill, work stoppage, computer failure or malfunction, or any *
-* and all other commercial damages or losses, even if such party *
-* shall have been informed of the possibility of such damages. This *
-* limitation of liability shall not apply to liability for death or *
-* personal injury resulting from such party's negligence to the *
-* extent applicable law prohibits such limitation. Some *
-* jurisdictions do not allow the exclusion or limitation of *
-* incidental or consequential damages, so this exclusion and *
-* limitation may not apply to You. *
-* *
-************************************************************************
-
-8. Litigation
--------------
-
-Any litigation relating to this License may be brought only in the
-courts of a jurisdiction where the defendant maintains its principal
-place of business and such litigation shall be governed by laws of that
-jurisdiction, without reference to its conflict-of-law provisions.
-Nothing in this Section shall prevent a party's ability to bring
-cross-claims or counter-claims.
-
-9. Miscellaneous
-----------------
-
-This License represents the complete agreement concerning the subject
-matter hereof. If any provision of this License is held to be
-unenforceable, such provision shall be reformed only to the extent
-necessary to make it enforceable. Any law or regulation which provides
-that the language of a contract shall be construed against the drafter
-shall not be used to construe this License against a Contributor.
-
-10. Versions of the License
----------------------------
-
-10.1. New Versions
-
-Mozilla Foundation is the license steward. Except as provided in Section
-10.3, no one other than the license steward has the right to modify or
-publish new versions of this License. Each version will be given a
-distinguishing version number.
-
-10.2. Effect of New Versions
-
-You may distribute the Covered Software under the terms of the version
-of the License under which You originally received the Covered Software,
-or under the terms of any subsequent version published by the license
-steward.
-
-10.3. Modified Versions
-
-If you create software not governed by this License, and you want to
-create a new license for such software, you may create and use a
-modified version of this License if you rename the license and remove
-any references to the name of the license steward (except to note that
-such modified license differs from this License).
-
-10.4. Distributing Source Code Form that is Incompatible With Secondary
-Licenses
-
-If You choose to distribute Source Code Form that is Incompatible With
-Secondary Licenses under the terms of this version of the License, the
-notice described in Exhibit B of this License must be attached.
-
-Exhibit A - Source Code Form License Notice
--------------------------------------------
-
- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-If it is not possible or desirable to put the notice in a particular
-file, then You may include the notice in a location (such as a LICENSE
-file in a relevant directory) where a recipient would be likely to look
-for such a notice.
-
-You may add additional accurate notices of copyright ownership.
-
-Exhibit B - "Incompatible With Secondary Licenses" Notice
----------------------------------------------------------
-
- This Source Code Form is "Incompatible With Secondary Licenses", as
- defined by the Mozilla Public License, v. 2.0.
diff --git a/node_modules/@antora/ui-loader/README.md b/node_modules/@antora/ui-loader/README.md
deleted file mode 100644
index bd4ec99e..00000000
--- a/node_modules/@antora/ui-loader/README.md
+++ /dev/null
@@ -1,13 +0,0 @@
-# Antora UI Loader
-
-The UI Loader is a component in Antora responsible for downloading and caching the UI bundle, then extracting and loading the files from that bundle into a UI catalog.
-The UI files are combined with the content files at the end of the Antora documentation pipeline to produce a complete site.
-
-[Antora](https://antora.org) is a modular static site generator designed for creating documentation sites from AsciiDoc documents.
-Its site generator pipeline aggregates documents from versioned content repositories and processes them using [Asciidoctor](https://asciidoctor.org).
-
-## Copyright and License
-
-Copyright (C) 2017-present [OpenDevise Inc.](https://opendevise.com) and the [Antora Project](https://antora.org).
-
-Use of this software is granted under the terms of the [Mozilla Public License Version 2.0](https://www.mozilla.org/en-US/MPL/2.0/) (MPL-2.0).
diff --git a/node_modules/@antora/ui-loader/lib/constants.js b/node_modules/@antora/ui-loader/lib/constants.js
deleted file mode 100644
index 09ca453f..00000000
--- a/node_modules/@antora/ui-loader/lib/constants.js
+++ /dev/null
@@ -1,7 +0,0 @@
-'use strict'
-
-module.exports = Object.freeze({
- SUPPLEMENTAL_FILES_GLOB: '**/*',
- UI_CACHE_FOLDER: 'ui',
- UI_DESC_FILENAME: 'ui.yml',
-})
diff --git a/node_modules/@antora/ui-loader/lib/file.js b/node_modules/@antora/ui-loader/lib/file.js
deleted file mode 100644
index 8302c039..00000000
--- a/node_modules/@antora/ui-loader/lib/file.js
+++ /dev/null
@@ -1,43 +0,0 @@
-'use strict'
-
-const { Readable } = require('stream')
-const { Stats } = require('fs')
-const Vinyl = require('vinyl')
-
-const DEFAULT_FILE_MODE = 0o100666 & ~process.umask()
-
-class File extends Vinyl {
- get path () {
- return this.history[this.history.length - 1]
- }
-
- set path (path_) {
- this.history.push(path_)
- }
-
- get relative () {
- return this.history[this.history.length - 1]
- }
-}
-
-class MemoryFile extends File {
- constructor (file) {
- const contents = file.contents || Buffer.alloc(0)
- const stat = Object.assign(new Stats(), { mode: DEFAULT_FILE_MODE, mtime: undefined, size: contents.length })
- super(Object.assign({}, file, { contents, stat }))
- }
-}
-
-class ReadableFile extends Readable {
- constructor (file) {
- super({ objectMode: true })
- this._file = file
- }
-
- _read () {
- this.push(this._file)
- this._file = null
- }
-}
-
-module.exports = { File, MemoryFile, ReadableFile }
diff --git a/node_modules/@antora/ui-loader/lib/index.js b/node_modules/@antora/ui-loader/lib/index.js
deleted file mode 100644
index bc170fda..00000000
--- a/node_modules/@antora/ui-loader/lib/index.js
+++ /dev/null
@@ -1,11 +0,0 @@
-'use strict'
-
-/**
- * UI Loader component for Antora
- *
- * Loads the UI files from the specified bundle and makes them available
- * through the UiCatalog.
- *
- * @namespace ui-loader
- */
-module.exports = require('./load-ui')
diff --git a/node_modules/@antora/ui-loader/lib/load-ui.js b/node_modules/@antora/ui-loader/lib/load-ui.js
deleted file mode 100644
index 299e03ab..00000000
--- a/node_modules/@antora/ui-loader/lib/load-ui.js
+++ /dev/null
@@ -1,378 +0,0 @@
-'use strict'
-
-const camelCaseKeys = require('camelcase-keys')
-const concat = require('simple-concat')
-const { createHash } = require('crypto')
-const expandPath = require('@antora/expand-path-helper')
-const { File, MemoryFile, ReadableFile } = require('./file')
-const { promises: fsp } = require('fs')
-const { concat: get } = require('simple-get')
-const getCacheDir = require('cache-directory')
-const minimatchAll = require('minimatch-all')
-const ospath = require('path')
-const { posix: path } = ospath
-const posixify = ospath.sep === '\\' ? (p) => p.replace(/\\/g, '/') : undefined
-const { Transform } = require('stream')
-const map = (transform, flush = undefined) => new Transform({ objectMode: true, transform, flush })
-const UiCatalog = require('./ui-catalog')
-const yaml = require('js-yaml')
-const vfs = require('vinyl-fs')
-const vzip = require('gulp-vinyl-zip')
-
-const { UI_CACHE_FOLDER, UI_DESC_FILENAME, SUPPLEMENTAL_FILES_GLOB } = require('./constants')
-const URI_SCHEME_RX = /^https?:\/\//
-const EXT_RX = /\.[a-z]{2,3}$/
-
-/**
- * Loads the files in the specified UI bundle (zip archive) into a UiCatalog,
- * first downloading the bundle if necessary.
- *
- * Looks for UI bundle at the path specified in the ui.bundle.url property of
- * the playbook. If the path is a URI, it downloads the file and caches it at a
- * unique path to avoid this step in future calls. It then reads all the files
- * from the bundle into memory, skipping any files that fall outside of the
- * start path specified in the ui.startPath property of the playbook. Finally,
- * it classifies the files and adds them to a UiCatalog, which is then
- * returned.
- *
- * @memberof ui-loader
- * @param {Object} playbook - The configuration object for Antora.
- * @param {Object} playbook.dir - The working directory of the playbook.
- * @param {Object} playbook.runtime - The runtime configuration object for Antora.
- * @param {String} [playbook.runtime.cacheDir=undefined] - The base cache directory.
- * @param {Boolean} [playbook.runtime.fetch=false] - Forces the bundle to be
- * retrieved if configured as a snapshot.
- * @param {Object} playbook.network - The network configuration object for Antora.
- * @param {String} [playbook.network.httpProxy=undefined] - The URL of the proxy to use for HTTP URLs.
- * @param {String} [playbook.network.httpsProxy=undefined] - The URL of the proxy to use for HTTPS URLs.
- * @param {String} [playbook.network.noProxy=undefined] - The list of domains and IPs that should not be proxied.
- * @param {Object} playbook.ui - The UI configuration object for Antora.
- * @param {String} playbook.ui.bundle - The UI bundle configuration.
- * @param {String} playbook.ui.bundle.url - The path (relative or absolute) or URI
- * of the UI bundle to use.
- * @param {String} [playbook.ui.bundle.startPath=''] - The path inside the bundle from
- * which to start reading files.
- * @param {Boolean} [playbook.ui.bundle.snapshot=false] - Whether to treat the
- * bundle URL as a snapshot (i.e., retrieve again if playbook.runtime.fetch is
- * true).
- * @param {Array} [playbook.ui.supplementalFiles=undefined] - An array of
- * additional files to overlay onto the files from the UI bundle.
- * @param {String} [playbook.ui.outputDir='_'] - The path relative to the site root
- * where the UI files should be published.
- *
- * @returns {UiCatalog} A catalog of UI files which were read from the bundle.
- */
-async function loadUi (playbook) {
- const startDir = playbook.dir || '.'
- const { bundle, supplementalFiles: supplementalFilesSpec, outputDir } = playbook.ui
- const bundleUrl = bundle.url
- let resolveBundle
- if (isUrl(bundleUrl)) {
- const { cacheDir, fetch } = playbook.runtime || {}
- resolveBundle = ensureCacheDir(cacheDir, startDir).then((absCacheDir) => {
- const cachePath = ospath.join(absCacheDir, `${sha1(bundleUrl)}.zip`)
- return fetch && bundle.snapshot
- ? downloadBundle(bundleUrl, cachePath, createAgent(bundleUrl, playbook.network || {}))
- : fsp
- .stat(cachePath)
- .then((stat) => new File({ path: cachePath, stat }))
- .catch(() => downloadBundle(bundleUrl, cachePath, createAgent(bundleUrl, playbook.network || {})))
- })
- } else {
- const localPath = expandPath(bundleUrl, '~+', startDir)
- resolveBundle = fsp
- .stat(localPath)
- .then((stat) => new File({ path: localPath, stat }))
- .catch(() => {
- throw new Error(
- `Specified UI ${path.extname(localPath) ? 'bundle' : 'directory'} does not exist: ` +
- (bundleUrl === localPath ? bundleUrl : `${localPath} (resolved from url: ${bundleUrl})`)
- )
- })
- }
- const files = await Promise.all([
- resolveBundle.then((bundleFile) =>
- new Promise((resolve, reject) =>
- bundleFile.isDirectory()
- ? vfs
- .src('**/*', { cwd: bundleFile.path, removeBOM: false })
- .on('error', reject)
- .pipe(relativizeFiles())
- .pipe(collectFiles(resolve))
- : vzip
- .src(bundleFile.path)
- .on('error', (err) => reject(Object.assign(err, { message: `not a valid zip file; ${err.message}` })))
- .pipe(selectFilesStartingFrom(bundle.startPath))
- .pipe(bufferizeContents())
- .on('error', reject)
- .pipe(collectFiles(resolve))
- ).catch((err) => {
- const wrapped = new Error(
- `Failed to read UI ${bundleFile.isDirectory() ? 'directory' : 'bundle'}: ` +
- (bundleUrl === bundleFile.path ? bundleUrl : `${bundleFile.path} (resolved from url: ${bundleUrl})`)
- )
- wrapped.stack += '\nCaused by: ' + (err.stack || 'unknown')
- throw wrapped
- })
- ),
- srcSupplementalFiles(supplementalFilesSpec, startDir),
- ]).then(([bundleFiles, supplementalFiles]) => mergeFiles(bundleFiles, supplementalFiles))
- const config = loadConfig(files, outputDir)
- const catalog = new UiCatalog()
- files.forEach((file) => classifyFile(file, config) && catalog.addFile(file))
- return catalog
-}
-
-function isUrl (string) {
- return ~string.indexOf('://') && URI_SCHEME_RX.test(string)
-}
-
-function sha1 (string) {
- const shasum = createHash('sha1')
- shasum.update(string)
- return shasum.digest('hex')
-}
-
-/**
- * Resolves the content cache directory and ensures it exists.
- *
- * @param {String} customCacheDir - The custom base cache directory. If the value is undefined,
- * the user's cache folder is used.
- * @param {String} startDir - The directory from which to resolve a leading '.' segment.
- *
- * @returns {Promise} A promise that resolves to the absolute ui cache directory.
- */
-function ensureCacheDir (customCacheDir, startDir) {
- // QUESTION should fallback directory be relative to cwd, playbook dir, or tmpdir?
- const baseCacheDir =
- customCacheDir == null
- ? getCacheDir('antora' + (process.env.NODE_ENV === 'test' ? '-test' : '')) || ospath.resolve('.antora/cache')
- : expandPath(customCacheDir, '~+', startDir)
- const cacheDir = ospath.join(baseCacheDir, UI_CACHE_FOLDER)
- return fsp
- .mkdir(cacheDir, { recursive: true })
- .then(() => cacheDir)
- .catch((err) => {
- throw Object.assign(err, { message: `Failed to create UI cache directory: ${cacheDir}; ${err.message}` })
- })
-}
-
-function createAgent (url, { httpProxy, httpsProxy, noProxy }) {
- if (httpsProxy || httpProxy) {
- const { HttpProxyAgent, HttpsProxyAgent } = require('hpagent')
- const proxy = url.startsWith('https:')
- ? { ProxyAgent: HttpsProxyAgent, url: httpsProxy }
- : { ProxyAgent: HttpProxyAgent, url: httpProxy }
- if (proxy.url && require('should-proxy')(url, { no_proxy: noProxy })) {
- // see https://github.com/delvedor/hpagent/issues/18
- const { protocol, hostname, port, username, password } = new URL(proxy.url)
- const proxyUrl = { protocol, hostname, port, username: username || null, password: password || null }
- return new proxy.ProxyAgent({ proxy: proxyUrl })
- }
- }
-}
-
-function downloadBundle (url, to, agent) {
- return new Promise((resolve, reject) => {
- get({ url, agent }, (err, response, contents) => {
- if (err) reject(err)
- if (response.statusCode !== 200) {
- const message = `Response code ${response.statusCode} (${response.statusMessage})`
- return reject(Object.assign(new Error(message), { name: 'HTTPError' }))
- }
- new ReadableFile(new MemoryFile({ path: ospath.basename(to), contents }))
- .pipe(vzip.src())
- .on('error', (err) =>
- reject(Object.assign(err, { message: `not a valid zip file; ${err.message}`, summary: 'Invalid UI bundle' }))
- )
- .on('finish', function () {
- fsp
- .mkdir(ospath.dirname(to), { recursive: true })
- .then(() => fsp.writeFile(to, contents))
- .then(() => resolve(new File({ path: to, stat: { isDirectory: () => false } })))
- })
- })
- }).catch((err) => {
- const wrapped = new Error(`${err.summary || 'Failed to download UI bundle'}: ${url}`)
- wrapped.stack += '\nCaused by: ' + (err.stack || 'unknown')
- throw wrapped
- })
-}
-
-function selectFilesStartingFrom (startPath) {
- if (!startPath || (startPath = path.join('/', startPath + '/')) === '/') {
- return map((file, _, next) => {
- if (file.isNull()) {
- next()
- } else {
- next(
- null,
- new File({ path: posixify ? posixify(file.path) : file.path, contents: file.contents, stat: file.stat })
- )
- }
- })
- } else {
- startPath = startPath.substr(1)
- const startPathOffset = startPath.length
- return map((file, _, next) => {
- if (file.isNull()) {
- next()
- } else {
- const path_ = posixify ? posixify(file.path) : file.path
- if (path_.length > startPathOffset && path_.startsWith(startPath)) {
- next(null, new File({ path: path_.substr(startPathOffset), contents: file.contents, stat: file.stat }))
- } else {
- next()
- }
- }
- })
- }
-}
-
-function bufferizeContents () {
- return map((file, _, next) => {
- // NOTE gulp-vinyl-zip automatically converts the contents of an empty file to a Buffer
- if (file.isStream()) {
- concat(file.contents, (err, contents) => {
- if (err) return next(err)
- file.stat.size = (file.contents = contents).length
- next(null, file)
- })
- } else {
- file.stat.size = file.contents.length
- next(null, file)
- }
- })
-}
-
-function collectFiles (done) {
- const files = new Map()
- return map(
- (file, _, next) => {
- files.set(file.path, file)
- next()
- },
- () => done(files)
- )
-}
-
-function srcSupplementalFiles (filesSpec, startDir) {
- if (!filesSpec) {
- return new Map()
- } else if (Array.isArray(filesSpec)) {
- return Promise.all(
- filesSpec.reduce((accum, { path: path_, contents: contents_ }) => {
- if (!path_) {
- return accum
- } else if (contents_) {
- if (~contents_.indexOf('\n') || !EXT_RX.test(contents_)) {
- accum.push(new MemoryFile({ path: path_, contents: Buffer.from(contents_) }))
- } else {
- contents_ = expandPath(contents_, '~+', startDir)
- accum.push(
- fsp
- .stat(contents_)
- .then((stat) => fsp.readFile(contents_).then((contents) => new File({ path: path_, contents, stat })))
- )
- }
- } else {
- accum.push(new MemoryFile({ path: path_ }))
- }
- return accum
- }, [])
- ).then((files) => files.reduce((accum, file) => accum.set(file.path, file) && accum, new Map()))
- } else {
- const cwd = expandPath(filesSpec, '~+', startDir)
- return fsp
- .access(cwd)
- .then(
- () =>
- new Promise((resolve, reject) =>
- vfs
- .src(SUPPLEMENTAL_FILES_GLOB, { cwd, dot: true, removeBOM: false })
- .on('error', reject)
- .pipe(relativizeFiles())
- .pipe(collectFiles(resolve))
- )
- )
- .catch((err) => {
- // Q: should we skip unreadable files?
- throw Object.assign(err, { message: `problem encountered while reading ui.supplemental_files: ${err.message}` })
- })
- }
-}
-
-function relativizeFiles () {
- return map((file, _, next) => {
- if (file.isNull()) {
- next()
- } else {
- const path_ = posixify ? posixify(file.relative) : file.relative
- next(null, new File({ cwd: file.cwd, path: path_, contents: file.contents, stat: file.stat, local: true }))
- }
- })
-}
-
-function mergeFiles (files, supplementalFiles) {
- if (supplementalFiles.size) supplementalFiles.forEach((file) => files.set(file.path, file))
- return files
-}
-
-function loadConfig (files, outputDir) {
- const configFile = files.get(UI_DESC_FILENAME)
- if (configFile) {
- files.delete(UI_DESC_FILENAME)
- const config = camelCaseKeys(yaml.load(configFile.contents.toString()), { deep: true })
- if (outputDir !== undefined) config.outputDir = outputDir
- const staticFiles = config.staticFiles
- if (staticFiles) {
- if (!Array.isArray(staticFiles)) {
- config.staticFiles = [staticFiles]
- } else if (staticFiles.length === 0) {
- delete config.staticFiles
- }
- }
- return config
- } else {
- return { outputDir }
- }
-}
-
-function classifyFile (file, config) {
- if (config.staticFiles && isStaticFile(file, config.staticFiles)) {
- file.type = 'static'
- file.out = resolveOut(file, '')
- } else if (file.local && ~('/' + file.relative).indexOf('/.')) {
- file = undefined
- } else {
- file.type = resolveType(file)
- if (file.type === 'asset') file.out = resolveOut(file, config.outputDir)
- }
- return file
-}
-
-function isStaticFile (file, staticFiles) {
- return minimatchAll(file.path, staticFiles)
-}
-
-function resolveType (file) {
- const firstPathSegment = file.path.split('/', 1)[0]
- if (firstPathSegment === 'layouts') {
- return 'layout'
- } else if (firstPathSegment === 'helpers') {
- return 'helper'
- } else if (firstPathSegment === 'partials') {
- return 'partial'
- } else {
- return 'asset'
- }
-}
-
-function resolveOut (file, outputDir = '_') {
- let dirname = path.join(outputDir, file.dirname)
- if (dirname.charAt() === '/') dirname = dirname.substr(1)
- const basename = file.basename
- return { dirname, basename, path: path.join(dirname, basename) }
-}
-
-module.exports = loadUi
diff --git a/node_modules/@antora/ui-loader/lib/ui-catalog.js b/node_modules/@antora/ui-loader/lib/ui-catalog.js
deleted file mode 100644
index a533c963..00000000
--- a/node_modules/@antora/ui-loader/lib/ui-catalog.js
+++ /dev/null
@@ -1,40 +0,0 @@
-'use strict'
-
-const $files = Symbol('files')
-
-class UiCatalog {
- constructor () {
- this[$files] = new Map()
- }
-
- getFiles () {
- return [...this[$files].values()]
- }
-
- addFile (file) {
- const key = generateKey(file)
- if (this[$files].has(key)) {
- throw new Error('Duplicate file')
- }
- this[$files].set(key, file)
- }
-
- findByType (type) {
- const accum = []
- for (const candidate of this[$files].values()) {
- if (candidate.type === type) accum.push(candidate)
- }
- return accum
- }
-}
-
-/**
- * @deprecated superceded by getFiles(); scheduled to be removed in Antora 4
- */
-UiCatalog.prototype.getAll = UiCatalog.prototype.getFiles
-
-function generateKey ({ type, path }) {
- return type + '$' + path
-}
-
-module.exports = UiCatalog
diff --git a/node_modules/@antora/ui-loader/package.json b/node_modules/@antora/ui-loader/package.json
deleted file mode 100644
index f58175d9..00000000
--- a/node_modules/@antora/ui-loader/package.json
+++ /dev/null
@@ -1,93 +0,0 @@
-{
- "_from": "@antora/ui-loader@3.0.0-alpha.7",
- "_id": "@antora/ui-loader@3.0.0-alpha.7",
- "_inBundle": false,
- "_integrity": "sha512-IjS0y2VJ3InMs10nEi1GcwVwh3CR/2teJwifiJOi+5S1uJ1QjSZTc231YIKdtVieZQ18swTxtfrZi2nJ5VPFfA==",
- "_location": "/@antora/ui-loader",
- "_phantomChildren": {},
- "_requested": {
- "type": "version",
- "registry": true,
- "raw": "@antora/ui-loader@3.0.0-alpha.7",
- "name": "@antora/ui-loader",
- "escapedName": "@antora%2fui-loader",
- "scope": "@antora",
- "rawSpec": "3.0.0-alpha.7",
- "saveSpec": null,
- "fetchSpec": "3.0.0-alpha.7"
- },
- "_requiredBy": [
- "/@antora/site-generator-default"
- ],
- "_resolved": "https://registry.npmjs.org/@antora/ui-loader/-/ui-loader-3.0.0-alpha.7.tgz",
- "_shasum": "5fbed2a021627881f97b8cd3c16454d1e40926b1",
- "_spec": "@antora/ui-loader@3.0.0-alpha.7",
- "_where": "/Users/mark.plummer/repos/docs.thoughtspot.com/node_modules/@antora/site-generator-default",
- "author": {
- "name": "OpenDevise Inc.",
- "url": "https://opendevise.com"
- },
- "bugs": {
- "url": "https://gitlab.com/antora/antora/issues"
- },
- "bundleDependencies": false,
- "contributors": [
- {
- "name": "Dan Allen",
- "email": "dan@opendevise.com"
- },
- {
- "name": "Sarah White",
- "email": "sarah@opendevise.com"
- },
- {
- "name": "Hubert SABLONNIÈRE",
- "email": "hubert.sablonniere@gmail.com"
- },
- {
- "name": "Guillaume Grossetie",
- "email": "g.grossetie@gmail.com"
- }
- ],
- "dependencies": {
- "@antora/expand-path-helper": "~1.0",
- "cache-directory": "~2.0",
- "camelcase-keys": "~6.2",
- "gulp-vinyl-zip": "~2.2",
- "hpagent": "~0.1.0",
- "js-yaml": "~4.1",
- "minimatch-all": "~1.1",
- "should-proxy": "~1.0",
- "simple-concat": "~1.0",
- "simple-get": "~4.0",
- "vinyl": "~2.2",
- "vinyl-fs": "~3.0"
- },
- "deprecated": false,
- "description": "Downloads a UI bundle, if necessary, and loads the files into a UI catalog for use in an Antora documentation pipeline.",
- "engines": {
- "node": ">=10.17.0"
- },
- "files": [
- "lib/"
- ],
- "gitHead": "fbd597b3680474f2083cda8a7facf1e2848c08e0",
- "homepage": "https://antora.org",
- "keywords": [
- "antora",
- "antora-component",
- "ui",
- "theme",
- "documentation",
- "static site",
- "web publishing"
- ],
- "license": "MPL-2.0",
- "main": "lib/index.js",
- "name": "@antora/ui-loader",
- "repository": {
- "type": "git",
- "url": "git+https://gitlab.com/antora/antora.git"
- },
- "version": "3.0.0-alpha.7"
-}
diff --git a/node_modules/@asciidoctor/core/LICENSE b/node_modules/@asciidoctor/core/LICENSE
deleted file mode 100644
index 617359bc..00000000
--- a/node_modules/@asciidoctor/core/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License
-
-Copyright (C) 2019 Dan Allen, Guillaume Grossetie, Anthonny Quérouil and the Asciidoctor Project
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/node_modules/@asciidoctor/core/README.md b/node_modules/@asciidoctor/core/README.md
deleted file mode 100644
index 727fb3d5..00000000
--- a/node_modules/@asciidoctor/core/README.md
+++ /dev/null
@@ -1,47 +0,0 @@
-# Asciidoctor core
-
-This package provides Asciidoctor core functionality:
-
-- parser
-- built-in converters
-- extensions
-
-## Install
-
- $ npm i @asciidoctor/core --save
-
-## Usage
-
-Here is a simple example that converts AsciiDoc to HTML5:
-
-**sample.js**
-
-```javascript
-const asciidoctor = require('@asciidoctor/core')() // <1>
-const content = 'http://asciidoctor.org[*Asciidoctor*] ' +
- 'running on https://opalrb.com[_Opal_] ' +
- 'brings AsciiDoc to Node.js!'
-const html = asciidoctor.convert(content) // <2>
-console.log(html) // <3>
-```
-- <1> Instantiate the Asciidoctor.js library
-- <2> Convert AsciiDoc content to HTML5 using Asciidoctor.js
-- <3> Print the HTML5 output to the console
-
-Save the file as _sample.js_ and run it using the `node` command:
-
- $ node sample.js
-
-You should see the following output in your terminal:
-
-```html
-
-```
-
-If you want to know more about Asciidoctor.js, please read the [User Manual](https://asciidoctor-docs.netlify.com/asciidoctor.js/).
-
-## Changelog
-
-Refer to the [CHANGELOG](https://github.com/asciidoctor/asciidoctor.js/blob/master/CHANGELOG.adoc) for a complete list of changes.
diff --git a/node_modules/@asciidoctor/core/dist/browser/asciidoctor.js b/node_modules/@asciidoctor/core/dist/browser/asciidoctor.js
deleted file mode 100644
index 58f7bf77..00000000
--- a/node_modules/@asciidoctor/core/dist/browser/asciidoctor.js
+++ /dev/null
@@ -1,46907 +0,0 @@
-/**
- * @license Asciidoctor.js 2.2.4 | MIT | https://github.com/asciidoctor/asciidoctor.js
- */
-(function(undefined) {
- // @note
- // A few conventions for the documentation of this file:
- // 1. Always use "//" (in contrast with "/**/")
- // 2. The syntax used is Yardoc (yardoc.org), which is intended for Ruby (se below)
- // 3. `@param` and `@return` types should be preceded by `JS.` when referring to
- // JavaScript constructors (e.g. `JS.Function`) otherwise Ruby is assumed.
- // 4. `nil` and `null` being unambiguous refer to the respective
- // objects/values in Ruby and JavaScript
- // 5. This is still WIP :) so please give feedback and suggestions on how
- // to improve or for alternative solutions
- //
- // The way the code is digested before going through Yardoc is a secret kept
- // in the docs repo (https://github.com/opal/docs/tree/master).
-
- var global_object = this, console;
-
- // Detect the global object
- if (typeof(global) !== 'undefined') { global_object = global; }
- if (typeof(window) !== 'undefined') { global_object = window; }
-
- // Setup a dummy console object if missing
- if (typeof(global_object.console) === 'object') {
- console = global_object.console;
- } else if (global_object.console == null) {
- console = global_object.console = {};
- } else {
- console = {};
- }
-
- if (!('log' in console)) { console.log = function () {}; }
- if (!('warn' in console)) { console.warn = console.log; }
-
- if (typeof(global_object.Opal) !== 'undefined') {
- console.warn('Opal already loaded. Loading twice can cause troubles, please fix your setup.');
- return global_object.Opal;
- }
-
- var nil;
-
- // The actual class for BasicObject
- var BasicObject;
-
- // The actual Object class.
- // The leading underscore is to avoid confusion with window.Object()
- var _Object;
-
- // The actual Module class
- var Module;
-
- // The actual Class class
- var Class;
-
- // The Opal object that is exposed globally
- var Opal = this.Opal = {};
-
- // This is a useful reference to global object inside ruby files
- Opal.global = global_object;
- global_object.Opal = Opal;
-
- // Configure runtime behavior with regards to require and unsupported fearures
- Opal.config = {
- missing_require_severity: 'error', // error, warning, ignore
- unsupported_features_severity: 'warning', // error, warning, ignore
- enable_stack_trace: true // true, false
- }
-
- // Minify common function calls
- var $hasOwn = Object.hasOwnProperty;
- var $bind = Function.prototype.bind;
- var $setPrototype = Object.setPrototypeOf;
- var $slice = Array.prototype.slice;
- var $splice = Array.prototype.splice;
-
- // Nil object id is always 4
- var nil_id = 4;
-
- // Generates even sequential numbers greater than 4
- // (nil_id) to serve as unique ids for ruby objects
- var unique_id = nil_id;
-
- // Return next unique id
- Opal.uid = function() {
- unique_id += 2;
- return unique_id;
- };
-
- // Retrieve or assign the id of an object
- Opal.id = function(obj) {
- if (obj.$$is_number) return (obj * 2)+1;
- if (obj.$$id != null) {
- return obj.$$id;
- };
- $defineProperty(obj, '$$id', Opal.uid());
- return obj.$$id;
- };
-
- // Globals table
- Opal.gvars = {};
-
- // Exit function, this should be replaced by platform specific implementation
- // (See nodejs and chrome for examples)
- Opal.exit = function(status) { if (Opal.gvars.DEBUG) console.log('Exited with status '+status); };
-
- // keeps track of exceptions for $!
- Opal.exceptions = [];
-
- // @private
- // Pops an exception from the stack and updates `$!`.
- Opal.pop_exception = function() {
- Opal.gvars["!"] = Opal.exceptions.pop() || nil;
- }
-
- // Inspect any kind of object, including non Ruby ones
- Opal.inspect = function(obj) {
- if (obj === undefined) {
- return "undefined";
- }
- else if (obj === null) {
- return "null";
- }
- else if (!obj.$$class) {
- return obj.toString();
- }
- else {
- return obj.$inspect();
- }
- }
-
- function $defineProperty(object, name, initialValue) {
- if (typeof(object) === "string") {
- // Special case for:
- // s = "string"
- // def s.m; end
- // String class is the only class that:
- // + compiles to JS primitive
- // + allows method definition directly on instances
- // numbers, true, false and nil do not support it.
- object[name] = initialValue;
- } else {
- Object.defineProperty(object, name, {
- value: initialValue,
- enumerable: false,
- configurable: true,
- writable: true
- });
- }
- }
-
- Opal.defineProperty = $defineProperty;
-
- Opal.slice = $slice;
-
-
- // Truth
- // -----
-
- Opal.truthy = function(val) {
- return (val !== nil && val != null && (!val.$$is_boolean || val == true));
- };
-
- Opal.falsy = function(val) {
- return (val === nil || val == null || (val.$$is_boolean && val == false))
- };
-
-
- // Constants
- // ---------
- //
- // For future reference:
- // - The Rails autoloading guide (http://guides.rubyonrails.org/v5.0/autoloading_and_reloading_constants.html)
- // - @ConradIrwin's 2012 post on “Everything you ever wanted to know about constant lookup in Ruby” (http://cirw.in/blog/constant-lookup.html)
- //
- // Legend of MRI concepts/names:
- // - constant reference (cref): the module/class that acts as a namespace
- // - nesting: the namespaces wrapping the current scope, e.g. nesting inside
- // `module A; module B::C; end; end` is `[B::C, A]`
-
- // Get the constant in the scope of the current cref
- function const_get_name(cref, name) {
- if (cref) return cref.$$const[name];
- }
-
- // Walk up the nesting array looking for the constant
- function const_lookup_nesting(nesting, name) {
- var i, ii, result, constant;
-
- if (nesting.length === 0) return;
-
- // If the nesting is not empty the constant is looked up in its elements
- // and in order. The ancestors of those elements are ignored.
- for (i = 0, ii = nesting.length; i < ii; i++) {
- constant = nesting[i].$$const[name];
- if (constant != null) return constant;
- }
- }
-
- // Walk up the ancestors chain looking for the constant
- function const_lookup_ancestors(cref, name) {
- var i, ii, result, ancestors;
-
- if (cref == null) return;
-
- ancestors = Opal.ancestors(cref);
-
- for (i = 0, ii = ancestors.length; i < ii; i++) {
- if (ancestors[i].$$const && $hasOwn.call(ancestors[i].$$const, name)) {
- return ancestors[i].$$const[name];
- }
- }
- }
-
- // Walk up Object's ancestors chain looking for the constant,
- // but only if cref is missing or a module.
- function const_lookup_Object(cref, name) {
- if (cref == null || cref.$$is_module) {
- return const_lookup_ancestors(_Object, name);
- }
- }
-
- // Call const_missing if nothing else worked
- function const_missing(cref, name, skip_missing) {
- if (!skip_missing) {
- return (cref || _Object).$const_missing(name);
- }
- }
-
- // Look for the constant just in the current cref or call `#const_missing`
- Opal.const_get_local = function(cref, name, skip_missing) {
- var result;
-
- if (cref == null) return;
-
- if (cref === '::') cref = _Object;
-
- if (!cref.$$is_module && !cref.$$is_class) {
- throw new Opal.TypeError(cref.toString() + " is not a class/module");
- }
-
- result = const_get_name(cref, name); if (result != null) return result;
- result = const_missing(cref, name, skip_missing); if (result != null) return result;
- }
-
- // Look for the constant relative to a cref or call `#const_missing` (when the
- // constant is prefixed by `::`).
- Opal.const_get_qualified = function(cref, name, skip_missing) {
- var result, cache, cached, current_version = Opal.const_cache_version;
-
- if (cref == null) return;
-
- if (cref === '::') cref = _Object;
-
- if (!cref.$$is_module && !cref.$$is_class) {
- throw new Opal.TypeError(cref.toString() + " is not a class/module");
- }
-
- if ((cache = cref.$$const_cache) == null) {
- $defineProperty(cref, '$$const_cache', Object.create(null));
- cache = cref.$$const_cache;
- }
- cached = cache[name];
-
- if (cached == null || cached[0] !== current_version) {
- ((result = const_get_name(cref, name)) != null) ||
- ((result = const_lookup_ancestors(cref, name)) != null);
- cache[name] = [current_version, result];
- } else {
- result = cached[1];
- }
-
- return result != null ? result : const_missing(cref, name, skip_missing);
- };
-
- // Initialize the top level constant cache generation counter
- Opal.const_cache_version = 1;
-
- // Look for the constant in the open using the current nesting and the nearest
- // cref ancestors or call `#const_missing` (when the constant has no :: prefix).
- Opal.const_get_relative = function(nesting, name, skip_missing) {
- var cref = nesting[0], result, current_version = Opal.const_cache_version, cache, cached;
-
- if ((cache = nesting.$$const_cache) == null) {
- $defineProperty(nesting, '$$const_cache', Object.create(null));
- cache = nesting.$$const_cache;
- }
- cached = cache[name];
-
- if (cached == null || cached[0] !== current_version) {
- ((result = const_get_name(cref, name)) != null) ||
- ((result = const_lookup_nesting(nesting, name)) != null) ||
- ((result = const_lookup_ancestors(cref, name)) != null) ||
- ((result = const_lookup_Object(cref, name)) != null);
-
- cache[name] = [current_version, result];
- } else {
- result = cached[1];
- }
-
- return result != null ? result : const_missing(cref, name, skip_missing);
- };
-
- // Register the constant on a cref and opportunistically set the name of
- // unnamed classes/modules.
- Opal.const_set = function(cref, name, value) {
- if (cref == null || cref === '::') cref = _Object;
-
- if (value.$$is_a_module) {
- if (value.$$name == null || value.$$name === nil) value.$$name = name;
- if (value.$$base_module == null) value.$$base_module = cref;
- }
-
- cref.$$const = (cref.$$const || Object.create(null));
- cref.$$const[name] = value;
-
- // Add a short helper to navigate constants manually.
- // @example
- // Opal.$$.Regexp.$$.IGNORECASE
- cref.$$ = cref.$$const;
-
- Opal.const_cache_version++;
-
- // Expose top level constants onto the Opal object
- if (cref === _Object) Opal[name] = value;
-
- // Name new class directly onto current scope (Opal.Foo.Baz = klass)
- $defineProperty(cref, name, value);
-
- return value;
- };
-
- // Get all the constants reachable from a given cref, by default will include
- // inherited constants.
- Opal.constants = function(cref, inherit) {
- if (inherit == null) inherit = true;
-
- var module, modules = [cref], module_constants, i, ii, constants = {}, constant;
-
- if (inherit) modules = modules.concat(Opal.ancestors(cref));
- if (inherit && cref.$$is_module) modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object));
-
- for (i = 0, ii = modules.length; i < ii; i++) {
- module = modules[i];
-
- // Don not show Objects constants unless we're querying Object itself
- if (cref !== _Object && module == _Object) break;
-
- for (constant in module.$$const) {
- constants[constant] = true;
- }
- }
-
- return Object.keys(constants);
- };
-
- // Remove a constant from a cref.
- Opal.const_remove = function(cref, name) {
- Opal.const_cache_version++;
-
- if (cref.$$const[name] != null) {
- var old = cref.$$const[name];
- delete cref.$$const[name];
- return old;
- }
-
- if (cref.$$autoload != null && cref.$$autoload[name] != null) {
- delete cref.$$autoload[name];
- return nil;
- }
-
- throw Opal.NameError.$new("constant "+cref+"::"+cref.$name()+" not defined");
- };
-
-
- // Modules & Classes
- // -----------------
-
- // A `class Foo; end` expression in ruby is compiled to call this runtime
- // method which either returns an existing class of the given name, or creates
- // a new class in the given `base` scope.
- //
- // If a constant with the given name exists, then we check to make sure that
- // it is a class and also that the superclasses match. If either of these
- // fail, then we raise a `TypeError`. Note, `superclass` may be null if one
- // was not specified in the ruby code.
- //
- // We pass a constructor to this method of the form `function ClassName() {}`
- // simply so that classes show up with nicely formatted names inside debuggers
- // in the web browser (or node/sprockets).
- //
- // The `scope` is the current `self` value where the class is being created
- // from. We use this to get the scope for where the class should be created.
- // If `scope` is an object (not a class/module), we simple get its class and
- // use that as the scope instead.
- //
- // @param scope [Object] where the class is being created
- // @param superclass [Class,null] superclass of the new class (may be null)
- // @param id [String] the name of the class to be created
- // @param constructor [JS.Function] function to use as constructor
- //
- // @return new [Class] or existing ruby class
- //
- Opal.allocate_class = function(name, superclass) {
- var klass, constructor;
-
- if (superclass != null && superclass.$$bridge) {
- // Inheritance from bridged classes requires
- // calling original JS constructors
- constructor = function() {
- var args = $slice.call(arguments),
- self = new ($bind.apply(superclass.$$constructor, [null].concat(args)))();
-
- // and replacing a __proto__ manually
- $setPrototype(self, klass.$$prototype);
- return self;
- }
- } else {
- constructor = function(){};
- }
-
- if (name) {
- $defineProperty(constructor, 'displayName', '::'+name);
- }
-
- klass = constructor;
-
- $defineProperty(klass, '$$name', name);
- $defineProperty(klass, '$$constructor', constructor);
- $defineProperty(klass, '$$prototype', constructor.prototype);
- $defineProperty(klass, '$$const', {});
- $defineProperty(klass, '$$is_class', true);
- $defineProperty(klass, '$$is_a_module', true);
- $defineProperty(klass, '$$super', superclass);
- $defineProperty(klass, '$$cvars', {});
- $defineProperty(klass, '$$own_included_modules', []);
- $defineProperty(klass, '$$own_prepended_modules', []);
- $defineProperty(klass, '$$ancestors', []);
- $defineProperty(klass, '$$ancestors_cache_version', null);
-
- $defineProperty(klass.$$prototype, '$$class', klass);
-
- // By default if there are no singleton class methods
- // __proto__ is Class.prototype
- // Later singleton methods generate a singleton_class
- // and inject it into ancestors chain
- if (Opal.Class) {
- $setPrototype(klass, Opal.Class.prototype);
- }
-
- if (superclass != null) {
- $setPrototype(klass.$$prototype, superclass.$$prototype);
-
- if (superclass.$$meta) {
- // If superclass has metaclass then we have explicitely inherit it.
- Opal.build_class_singleton_class(klass);
- }
- };
-
- return klass;
- }
-
-
- function find_existing_class(scope, name) {
- // Try to find the class in the current scope
- var klass = const_get_name(scope, name);
-
- // If the class exists in the scope, then we must use that
- if (klass) {
- // Make sure the existing constant is a class, or raise error
- if (!klass.$$is_class) {
- throw Opal.TypeError.$new(name + " is not a class");
- }
-
- return klass;
- }
- }
-
- function ensureSuperclassMatch(klass, superclass) {
- if (klass.$$super !== superclass) {
- throw Opal.TypeError.$new("superclass mismatch for class " + klass.$$name);
- }
- }
-
- Opal.klass = function(scope, superclass, name) {
- var bridged;
-
- if (scope == null) {
- // Global scope
- scope = _Object;
- } else if (!scope.$$is_class && !scope.$$is_module) {
- // Scope is an object, use its class
- scope = scope.$$class;
- }
-
- // If the superclass is not an Opal-generated class then we're bridging a native JS class
- if (superclass != null && !superclass.hasOwnProperty('$$is_class')) {
- bridged = superclass;
- superclass = _Object;
- }
-
- var klass = find_existing_class(scope, name);
-
- if (klass) {
- if (superclass) {
- // Make sure existing class has same superclass
- ensureSuperclassMatch(klass, superclass);
- }
- return klass;
- }
-
- // Class doesn't exist, create a new one with given superclass...
-
- // Not specifying a superclass means we can assume it to be Object
- if (superclass == null) {
- superclass = _Object;
- }
-
- // Create the class object (instance of Class)
- klass = Opal.allocate_class(name, superclass);
- Opal.const_set(scope, name, klass);
-
- // Call .inherited() hook with new class on the superclass
- if (superclass.$inherited) {
- superclass.$inherited(klass);
- }
-
- if (bridged) {
- Opal.bridge(bridged, klass);
- }
-
- return klass;
- }
-
- // Define new module (or return existing module). The given `scope` is basically
- // the current `self` value the `module` statement was defined in. If this is
- // a ruby module or class, then it is used, otherwise if the scope is a ruby
- // object then that objects real ruby class is used (e.g. if the scope is the
- // main object, then the top level `Object` class is used as the scope).
- //
- // If a module of the given name is already defined in the scope, then that
- // instance is just returned.
- //
- // If there is a class of the given name in the scope, then an error is
- // generated instead (cannot have a class and module of same name in same scope).
- //
- // Otherwise, a new module is created in the scope with the given name, and that
- // new instance is returned back (to be referenced at runtime).
- //
- // @param scope [Module, Class] class or module this definition is inside
- // @param id [String] the name of the new (or existing) module
- //
- // @return [Module]
- Opal.allocate_module = function(name) {
- var constructor = function(){};
- if (name) {
- $defineProperty(constructor, 'displayName', name+'.$$constructor');
- }
-
- var module = constructor;
-
- if (name)
- $defineProperty(constructor, 'displayName', name+'.constructor');
-
- $defineProperty(module, '$$name', name);
- $defineProperty(module, '$$prototype', constructor.prototype);
- $defineProperty(module, '$$const', {});
- $defineProperty(module, '$$is_module', true);
- $defineProperty(module, '$$is_a_module', true);
- $defineProperty(module, '$$cvars', {});
- $defineProperty(module, '$$iclasses', []);
- $defineProperty(module, '$$own_included_modules', []);
- $defineProperty(module, '$$own_prepended_modules', []);
- $defineProperty(module, '$$ancestors', [module]);
- $defineProperty(module, '$$ancestors_cache_version', null);
-
- $setPrototype(module, Opal.Module.prototype);
-
- return module;
- }
-
- function find_existing_module(scope, name) {
- var module = const_get_name(scope, name);
- if (module == null && scope === _Object) module = const_lookup_ancestors(_Object, name);
-
- if (module) {
- if (!module.$$is_module && module !== _Object) {
- throw Opal.TypeError.$new(name + " is not a module");
- }
- }
-
- return module;
- }
-
- Opal.module = function(scope, name) {
- var module;
-
- if (scope == null) {
- // Global scope
- scope = _Object;
- } else if (!scope.$$is_class && !scope.$$is_module) {
- // Scope is an object, use its class
- scope = scope.$$class;
- }
-
- module = find_existing_module(scope, name);
-
- if (module) {
- return module;
- }
-
- // Module doesnt exist, create a new one...
- module = Opal.allocate_module(name);
- Opal.const_set(scope, name, module);
-
- return module;
- }
-
- // Return the singleton class for the passed object.
- //
- // If the given object alredy has a singleton class, then it will be stored on
- // the object as the `$$meta` property. If this exists, then it is simply
- // returned back.
- //
- // Otherwise, a new singleton object for the class or object is created, set on
- // the object at `$$meta` for future use, and then returned.
- //
- // @param object [Object] the ruby object
- // @return [Class] the singleton class for object
- Opal.get_singleton_class = function(object) {
- if (object.$$meta) {
- return object.$$meta;
- }
-
- if (object.hasOwnProperty('$$is_class')) {
- return Opal.build_class_singleton_class(object);
- } else if (object.hasOwnProperty('$$is_module')) {
- return Opal.build_module_singletin_class(object);
- } else {
- return Opal.build_object_singleton_class(object);
- }
- };
-
- // Build the singleton class for an existing class. Class object are built
- // with their singleton class already in the prototype chain and inheriting
- // from their superclass object (up to `Class` itself).
- //
- // NOTE: Actually in MRI a class' singleton class inherits from its
- // superclass' singleton class which in turn inherits from Class.
- //
- // @param klass [Class]
- // @return [Class]
- Opal.build_class_singleton_class = function(klass) {
- var superclass, meta;
-
- if (klass.$$meta) {
- return klass.$$meta;
- }
-
- // The singleton_class superclass is the singleton_class of its superclass;
- // but BasicObject has no superclass (its `$$super` is null), thus we
- // fallback on `Class`.
- superclass = klass === BasicObject ? Class : Opal.get_singleton_class(klass.$$super);
-
- meta = Opal.allocate_class(null, superclass, function(){});
-
- $defineProperty(meta, '$$is_singleton', true);
- $defineProperty(meta, '$$singleton_of', klass);
- $defineProperty(klass, '$$meta', meta);
- $setPrototype(klass, meta.$$prototype);
- // Restoring ClassName.class
- $defineProperty(klass, '$$class', Opal.Class);
-
- return meta;
- };
-
- Opal.build_module_singletin_class = function(mod) {
- if (mod.$$meta) {
- return mod.$$meta;
- }
-
- var meta = Opal.allocate_class(null, Opal.Module, function(){});
-
- $defineProperty(meta, '$$is_singleton', true);
- $defineProperty(meta, '$$singleton_of', mod);
- $defineProperty(mod, '$$meta', meta);
- $setPrototype(mod, meta.$$prototype);
- // Restoring ModuleName.class
- $defineProperty(mod, '$$class', Opal.Module);
-
- return meta;
- }
-
- // Build the singleton class for a Ruby (non class) Object.
- //
- // @param object [Object]
- // @return [Class]
- Opal.build_object_singleton_class = function(object) {
- var superclass = object.$$class,
- klass = Opal.allocate_class(nil, superclass, function(){});
-
- $defineProperty(klass, '$$is_singleton', true);
- $defineProperty(klass, '$$singleton_of', object);
-
- delete klass.$$prototype.$$class;
-
- $defineProperty(object, '$$meta', klass);
-
- $setPrototype(object, object.$$meta.$$prototype);
-
- return klass;
- };
-
- Opal.is_method = function(prop) {
- return (prop[0] === '$' && prop[1] !== '$');
- }
-
- Opal.instance_methods = function(mod) {
- var exclude = [], results = [], ancestors = Opal.ancestors(mod);
-
- for (var i = 0, l = ancestors.length; i < l; i++) {
- var ancestor = ancestors[i],
- proto = ancestor.$$prototype;
-
- if (proto.hasOwnProperty('$$dummy')) {
- proto = proto.$$define_methods_on;
- }
-
- var props = Object.getOwnPropertyNames(proto);
-
- for (var j = 0, ll = props.length; j < ll; j++) {
- var prop = props[j];
-
- if (Opal.is_method(prop)) {
- var method_name = prop.slice(1),
- method = proto[prop];
-
- if (method.$$stub && exclude.indexOf(method_name) === -1) {
- exclude.push(method_name);
- }
-
- if (!method.$$stub && results.indexOf(method_name) === -1 && exclude.indexOf(method_name) === -1) {
- results.push(method_name);
- }
- }
- }
- }
-
- return results;
- }
-
- Opal.own_instance_methods = function(mod) {
- var results = [],
- proto = mod.$$prototype;
-
- if (proto.hasOwnProperty('$$dummy')) {
- proto = proto.$$define_methods_on;
- }
-
- var props = Object.getOwnPropertyNames(proto);
-
- for (var i = 0, length = props.length; i < length; i++) {
- var prop = props[i];
-
- if (Opal.is_method(prop)) {
- var method = proto[prop];
-
- if (!method.$$stub) {
- var method_name = prop.slice(1);
- results.push(method_name);
- }
- }
- }
-
- return results;
- }
-
- Opal.methods = function(obj) {
- return Opal.instance_methods(Opal.get_singleton_class(obj));
- }
-
- Opal.own_methods = function(obj) {
- return Opal.own_instance_methods(Opal.get_singleton_class(obj));
- }
-
- Opal.receiver_methods = function(obj) {
- var mod = Opal.get_singleton_class(obj);
- var singleton_methods = Opal.own_instance_methods(mod);
- var instance_methods = Opal.own_instance_methods(mod.$$super);
- return singleton_methods.concat(instance_methods);
- }
-
- // Returns an object containing all pairs of names/values
- // for all class variables defined in provided +module+
- // and its ancestors.
- //
- // @param module [Module]
- // @return [Object]
- Opal.class_variables = function(module) {
- var ancestors = Opal.ancestors(module),
- i, length = ancestors.length,
- result = {};
-
- for (i = length - 1; i >= 0; i--) {
- var ancestor = ancestors[i];
-
- for (var cvar in ancestor.$$cvars) {
- result[cvar] = ancestor.$$cvars[cvar];
- }
- }
-
- return result;
- }
-
- // Sets class variable with specified +name+ to +value+
- // in provided +module+
- //
- // @param module [Module]
- // @param name [String]
- // @param value [Object]
- Opal.class_variable_set = function(module, name, value) {
- var ancestors = Opal.ancestors(module),
- i, length = ancestors.length;
-
- for (i = length - 2; i >= 0; i--) {
- var ancestor = ancestors[i];
-
- if ($hasOwn.call(ancestor.$$cvars, name)) {
- ancestor.$$cvars[name] = value;
- return value;
- }
- }
-
- module.$$cvars[name] = value;
-
- return value;
- }
-
- function isRoot(proto) {
- return proto.hasOwnProperty('$$iclass') && proto.hasOwnProperty('$$root');
- }
-
- function own_included_modules(module) {
- var result = [], mod, proto = Object.getPrototypeOf(module.$$prototype);
-
- while (proto) {
- if (proto.hasOwnProperty('$$class')) {
- // superclass
- break;
- }
- mod = protoToModule(proto);
- if (mod) {
- result.push(mod);
- }
- proto = Object.getPrototypeOf(proto);
- }
-
- return result;
- }
-
- function own_prepended_modules(module) {
- var result = [], mod, proto = Object.getPrototypeOf(module.$$prototype);
-
- if (module.$$prototype.hasOwnProperty('$$dummy')) {
- while (proto) {
- if (proto === module.$$prototype.$$define_methods_on) {
- break;
- }
-
- mod = protoToModule(proto);
- if (mod) {
- result.push(mod);
- }
-
- proto = Object.getPrototypeOf(proto);
- }
- }
-
- return result;
- }
-
-
- // The actual inclusion of a module into a class.
- //
- // ## Class `$$parent` and `iclass`
- //
- // To handle `super` calls, every class has a `$$parent`. This parent is
- // used to resolve the next class for a super call. A normal class would
- // have this point to its superclass. However, if a class includes a module
- // then this would need to take into account the module. The module would
- // also have to then point its `$$parent` to the actual superclass. We
- // cannot modify modules like this, because it might be included in more
- // then one class. To fix this, we actually insert an `iclass` as the class'
- // `$$parent` which can then point to the superclass. The `iclass` acts as
- // a proxy to the actual module, so the `super` chain can then search it for
- // the required method.
- //
- // @param module [Module] the module to include
- // @param includer [Module] the target class to include module into
- // @return [null]
- Opal.append_features = function(module, includer) {
- var module_ancestors = Opal.ancestors(module);
- var iclasses = [];
-
- if (module_ancestors.indexOf(includer) !== -1) {
- throw Opal.ArgumentError.$new('cyclic include detected');
- }
-
- for (var i = 0, length = module_ancestors.length; i < length; i++) {
- var ancestor = module_ancestors[i], iclass = create_iclass(ancestor);
- $defineProperty(iclass, '$$included', true);
- iclasses.push(iclass);
- }
- var includer_ancestors = Opal.ancestors(includer),
- chain = chain_iclasses(iclasses),
- start_chain_after,
- end_chain_on;
-
- if (includer_ancestors.indexOf(module) === -1) {
- // first time include
-
- // includer -> chain.first -> ...chain... -> chain.last -> includer.parent
- start_chain_after = includer.$$prototype;
- end_chain_on = Object.getPrototypeOf(includer.$$prototype);
- } else {
- // The module has been already included,
- // we don't need to put it into the ancestors chain again,
- // but this module may have new included modules.
- // If it's true we need to copy them.
- //
- // The simplest way is to replace ancestors chain from
- // parent
- // |
- // `module` iclass (has a $$root flag)
- // |
- // ...previos chain of module.included_modules ...
- // |
- // "next ancestor" (has a $$root flag or is a real class)
- //
- // to
- // parent
- // |
- // `module` iclass (has a $$root flag)
- // |
- // ...regenerated chain of module.included_modules
- // |
- // "next ancestor" (has a $$root flag or is a real class)
- //
- // because there are no intermediate classes between `parent` and `next ancestor`.
- // It doesn't break any prototypes of other objects as we don't change class references.
-
- var proto = includer.$$prototype, parent = proto, module_iclass = Object.getPrototypeOf(parent);
-
- while (module_iclass != null) {
- if (isRoot(module_iclass) && module_iclass.$$module === module) {
- break;
- }
-
- parent = module_iclass;
- module_iclass = Object.getPrototypeOf(module_iclass);
- }
-
- var next_ancestor = Object.getPrototypeOf(module_iclass);
-
- // skip non-root iclasses (that were recursively included)
- while (next_ancestor.hasOwnProperty('$$iclass') && !isRoot(next_ancestor)) {
- next_ancestor = Object.getPrototypeOf(next_ancestor);
- }
-
- start_chain_after = parent;
- end_chain_on = next_ancestor;
- }
-
- $setPrototype(start_chain_after, chain.first);
- $setPrototype(chain.last, end_chain_on);
-
- // recalculate own_included_modules cache
- includer.$$own_included_modules = own_included_modules(includer);
-
- Opal.const_cache_version++;
- }
-
- Opal.prepend_features = function(module, prepender) {
- // Here we change the ancestors chain from
- //
- // prepender
- // |
- // parent
- //
- // to:
- //
- // dummy(prepender)
- // |
- // iclass(module)
- // |
- // iclass(prepender)
- // |
- // parent
- var module_ancestors = Opal.ancestors(module);
- var iclasses = [];
-
- if (module_ancestors.indexOf(prepender) !== -1) {
- throw Opal.ArgumentError.$new('cyclic prepend detected');
- }
-
- for (var i = 0, length = module_ancestors.length; i < length; i++) {
- var ancestor = module_ancestors[i], iclass = create_iclass(ancestor);
- $defineProperty(iclass, '$$prepended', true);
- iclasses.push(iclass);
- }
-
- var chain = chain_iclasses(iclasses),
- dummy_prepender = prepender.$$prototype,
- previous_parent = Object.getPrototypeOf(dummy_prepender),
- prepender_iclass,
- start_chain_after,
- end_chain_on;
-
- if (dummy_prepender.hasOwnProperty('$$dummy')) {
- // The module already has some prepended modules
- // which means that we don't need to make it "dummy"
- prepender_iclass = dummy_prepender.$$define_methods_on;
- } else {
- // Making the module "dummy"
- prepender_iclass = create_dummy_iclass(prepender);
- flush_methods_in(prepender);
- $defineProperty(dummy_prepender, '$$dummy', true);
- $defineProperty(dummy_prepender, '$$define_methods_on', prepender_iclass);
-
- // Converting
- // dummy(prepender) -> previous_parent
- // to
- // dummy(prepender) -> iclass(prepender) -> previous_parent
- $setPrototype(dummy_prepender, prepender_iclass);
- $setPrototype(prepender_iclass, previous_parent);
- }
-
- var prepender_ancestors = Opal.ancestors(prepender);
-
- if (prepender_ancestors.indexOf(module) === -1) {
- // first time prepend
-
- start_chain_after = dummy_prepender;
-
- // next $$root or prepender_iclass or non-$$iclass
- end_chain_on = Object.getPrototypeOf(dummy_prepender);
- while (end_chain_on != null) {
- if (
- end_chain_on.hasOwnProperty('$$root') ||
- end_chain_on === prepender_iclass ||
- !end_chain_on.hasOwnProperty('$$iclass')
- ) {
- break;
- }
-
- end_chain_on = Object.getPrototypeOf(end_chain_on);
- }
- } else {
- throw Opal.RuntimeError.$new("Prepending a module multiple times is not supported");
- }
-
- $setPrototype(start_chain_after, chain.first);
- $setPrototype(chain.last, end_chain_on);
-
- // recalculate own_prepended_modules cache
- prepender.$$own_prepended_modules = own_prepended_modules(prepender);
-
- Opal.const_cache_version++;
- }
-
- function flush_methods_in(module) {
- var proto = module.$$prototype,
- props = Object.getOwnPropertyNames(proto);
-
- for (var i = 0; i < props.length; i++) {
- var prop = props[i];
- if (Opal.is_method(prop)) {
- delete proto[prop];
- }
- }
- }
-
- function create_iclass(module) {
- var iclass = create_dummy_iclass(module);
-
- if (module.$$is_module) {
- module.$$iclasses.push(iclass);
- }
-
- return iclass;
- }
-
- // Dummy iclass doesn't receive updates when the module gets a new method.
- function create_dummy_iclass(module) {
- var iclass = {},
- proto = module.$$prototype;
-
- if (proto.hasOwnProperty('$$dummy')) {
- proto = proto.$$define_methods_on;
- }
-
- var props = Object.getOwnPropertyNames(proto),
- length = props.length, i;
-
- for (i = 0; i < length; i++) {
- var prop = props[i];
- $defineProperty(iclass, prop, proto[prop]);
- }
-
- $defineProperty(iclass, '$$iclass', true);
- $defineProperty(iclass, '$$module', module);
-
- return iclass;
- }
-
- function chain_iclasses(iclasses) {
- var length = iclasses.length, first = iclasses[0];
-
- $defineProperty(first, '$$root', true);
-
- if (length === 1) {
- return { first: first, last: first };
- }
-
- var previous = first;
-
- for (var i = 1; i < length; i++) {
- var current = iclasses[i];
- $setPrototype(previous, current);
- previous = current;
- }
-
-
- return { first: iclasses[0], last: iclasses[length - 1] };
- }
-
- // For performance, some core Ruby classes are toll-free bridged to their
- // native JavaScript counterparts (e.g. a Ruby Array is a JavaScript Array).
- //
- // This method is used to setup a native constructor (e.g. Array), to have
- // its prototype act like a normal Ruby class. Firstly, a new Ruby class is
- // created using the native constructor so that its prototype is set as the
- // target for the new class. Note: all bridged classes are set to inherit
- // from Object.
- //
- // Example:
- //
- // Opal.bridge(self, Function);
- //
- // @param klass [Class] the Ruby class to bridge
- // @param constructor [JS.Function] native JavaScript constructor to use
- // @return [Class] returns the passed Ruby class
- //
- Opal.bridge = function(native_klass, klass) {
- if (native_klass.hasOwnProperty('$$bridge')) {
- throw Opal.ArgumentError.$new("already bridged");
- }
-
- var klass_to_inject, klass_reference;
-
- klass_to_inject = klass.$$super || Opal.Object;
- klass_reference = klass;
- var original_prototype = klass.$$prototype;
-
- // constructor is a JS function with a prototype chain like:
- // - constructor
- // - super
- //
- // What we need to do is to inject our class (with its prototype chain)
- // between constructor and super. For example, after injecting ::Object
- // into JS String we get:
- //
- // - constructor (window.String)
- // - Opal.Object
- // - Opal.Kernel
- // - Opal.BasicObject
- // - super (window.Object)
- // - null
- //
- $defineProperty(native_klass, '$$bridge', klass);
- $setPrototype(native_klass.prototype, (klass.$$super || Opal.Object).$$prototype);
- $defineProperty(klass, '$$prototype', native_klass.prototype);
-
- $defineProperty(klass.$$prototype, '$$class', klass);
- $defineProperty(klass, '$$constructor', native_klass);
- $defineProperty(klass, '$$bridge', true);
- };
-
- function protoToModule(proto) {
- if (proto.hasOwnProperty('$$dummy')) {
- return;
- } else if (proto.hasOwnProperty('$$iclass')) {
- return proto.$$module;
- } else if (proto.hasOwnProperty('$$class')) {
- return proto.$$class;
- }
- }
-
- function own_ancestors(module) {
- return module.$$own_prepended_modules.concat([module]).concat(module.$$own_included_modules);
- }
-
- // The Array of ancestors for a given module/class
- Opal.ancestors = function(module) {
- if (!module) { return []; }
-
- if (module.$$ancestors_cache_version === Opal.const_cache_version) {
- return module.$$ancestors;
- }
-
- var result = [], i, mods, length;
-
- for (i = 0, mods = own_ancestors(module), length = mods.length; i < length; i++) {
- result.push(mods[i]);
- }
-
- if (module.$$super) {
- for (i = 0, mods = Opal.ancestors(module.$$super), length = mods.length; i < length; i++) {
- result.push(mods[i]);
- }
- }
-
- module.$$ancestors_cache_version = Opal.const_cache_version;
- module.$$ancestors = result;
-
- return result;
- }
-
- Opal.included_modules = function(module) {
- var result = [], mod = null, proto = Object.getPrototypeOf(module.$$prototype);
-
- for (; proto && Object.getPrototypeOf(proto); proto = Object.getPrototypeOf(proto)) {
- mod = protoToModule(proto);
- if (mod && mod.$$is_module && proto.$$iclass && proto.$$included) {
- result.push(mod);
- }
- }
-
- return result;
- }
-
-
- // Method Missing
- // --------------
-
- // Methods stubs are used to facilitate method_missing in opal. A stub is a
- // placeholder function which just calls `method_missing` on the receiver.
- // If no method with the given name is actually defined on an object, then it
- // is obvious to say that the stub will be called instead, and then in turn
- // method_missing will be called.
- //
- // When a file in ruby gets compiled to javascript, it includes a call to
- // this function which adds stubs for every method name in the compiled file.
- // It should then be safe to assume that method_missing will work for any
- // method call detected.
- //
- // Method stubs are added to the BasicObject prototype, which every other
- // ruby object inherits, so all objects should handle method missing. A stub
- // is only added if the given property name (method name) is not already
- // defined.
- //
- // Note: all ruby methods have a `$` prefix in javascript, so all stubs will
- // have this prefix as well (to make this method more performant).
- //
- // Opal.add_stubs(["$foo", "$bar", "$baz="]);
- //
- // All stub functions will have a private `$$stub` property set to true so
- // that other internal methods can detect if a method is just a stub or not.
- // `Kernel#respond_to?` uses this property to detect a methods presence.
- //
- // @param stubs [Array] an array of method stubs to add
- // @return [undefined]
- Opal.add_stubs = function(stubs) {
- var proto = Opal.BasicObject.$$prototype;
-
- for (var i = 0, length = stubs.length; i < length; i++) {
- var stub = stubs[i], existing_method = proto[stub];
-
- if (existing_method == null || existing_method.$$stub) {
- Opal.add_stub_for(proto, stub);
- }
- }
- };
-
- // Add a method_missing stub function to the given prototype for the
- // given name.
- //
- // @param prototype [Prototype] the target prototype
- // @param stub [String] stub name to add (e.g. "$foo")
- // @return [undefined]
- Opal.add_stub_for = function(prototype, stub) {
- var method_missing_stub = Opal.stub_for(stub);
- $defineProperty(prototype, stub, method_missing_stub);
- };
-
- // Generate the method_missing stub for a given method name.
- //
- // @param method_name [String] The js-name of the method to stub (e.g. "$foo")
- // @return [undefined]
- Opal.stub_for = function(method_name) {
- function method_missing_stub() {
- // Copy any given block onto the method_missing dispatcher
- this.$method_missing.$$p = method_missing_stub.$$p;
-
- // Set block property to null ready for the next call (stop false-positives)
- method_missing_stub.$$p = null;
-
- // call method missing with correct args (remove '$' prefix on method name)
- var args_ary = new Array(arguments.length);
- for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = arguments[i]; }
-
- return this.$method_missing.apply(this, [method_name.slice(1)].concat(args_ary));
- }
-
- method_missing_stub.$$stub = true;
-
- return method_missing_stub;
- };
-
-
- // Methods
- // -------
-
- // Arity count error dispatcher for methods
- //
- // @param actual [Fixnum] number of arguments given to method
- // @param expected [Fixnum] expected number of arguments
- // @param object [Object] owner of the method +meth+
- // @param meth [String] method name that got wrong number of arguments
- // @raise [ArgumentError]
- Opal.ac = function(actual, expected, object, meth) {
- var inspect = '';
- if (object.$$is_a_module) {
- inspect += object.$$name + '.';
- }
- else {
- inspect += object.$$class.$$name + '#';
- }
- inspect += meth;
-
- throw Opal.ArgumentError.$new('[' + inspect + '] wrong number of arguments(' + actual + ' for ' + expected + ')');
- };
-
- // Arity count error dispatcher for blocks
- //
- // @param actual [Fixnum] number of arguments given to block
- // @param expected [Fixnum] expected number of arguments
- // @param context [Object] context of the block definition
- // @raise [ArgumentError]
- Opal.block_ac = function(actual, expected, context) {
- var inspect = "`block in " + context + "'";
-
- throw Opal.ArgumentError.$new(inspect + ': wrong number of arguments (' + actual + ' for ' + expected + ')');
- };
-
- // Super dispatcher
- Opal.find_super_dispatcher = function(obj, mid, current_func, defcheck, defs) {
- var jsid = '$' + mid, ancestors, super_method;
-
- if (obj.hasOwnProperty('$$meta')) {
- ancestors = Opal.ancestors(obj.$$meta);
- } else {
- ancestors = Opal.ancestors(obj.$$class);
- }
-
- var current_index = ancestors.indexOf(current_func.$$owner);
-
- for (var i = current_index + 1; i < ancestors.length; i++) {
- var ancestor = ancestors[i],
- proto = ancestor.$$prototype;
-
- if (proto.hasOwnProperty('$$dummy')) {
- proto = proto.$$define_methods_on;
- }
-
- if (proto.hasOwnProperty(jsid)) {
- var method = proto[jsid];
-
- if (!method.$$stub) {
- super_method = method;
- }
- break;
- }
- }
-
- if (!defcheck && super_method == null && Opal.Kernel.$method_missing === obj.$method_missing) {
- // method_missing hasn't been explicitly defined
- throw Opal.NoMethodError.$new('super: no superclass method `'+mid+"' for "+obj, mid);
- }
-
- return super_method;
- };
-
- // Iter dispatcher for super in a block
- Opal.find_iter_super_dispatcher = function(obj, jsid, current_func, defcheck, implicit) {
- var call_jsid = jsid;
-
- if (!current_func) {
- throw Opal.RuntimeError.$new("super called outside of method");
- }
-
- if (implicit && current_func.$$define_meth) {
- throw Opal.RuntimeError.$new("implicit argument passing of super from method defined by define_method() is not supported. Specify all arguments explicitly");
- }
-
- if (current_func.$$def) {
- call_jsid = current_func.$$jsid;
- }
-
- return Opal.find_super_dispatcher(obj, call_jsid, current_func, defcheck);
- };
-
- // Used to return as an expression. Sometimes, we can't simply return from
- // a javascript function as if we were a method, as the return is used as
- // an expression, or even inside a block which must "return" to the outer
- // method. This helper simply throws an error which is then caught by the
- // method. This approach is expensive, so it is only used when absolutely
- // needed.
- //
- Opal.ret = function(val) {
- Opal.returner.$v = val;
- throw Opal.returner;
- };
-
- // Used to break out of a block.
- Opal.brk = function(val, breaker) {
- breaker.$v = val;
- throw breaker;
- };
-
- // Builds a new unique breaker, this is to avoid multiple nested breaks to get
- // in the way of each other.
- Opal.new_brk = function() {
- return new Error('unexpected break');
- };
-
- // handles yield calls for 1 yielded arg
- Opal.yield1 = function(block, arg) {
- if (typeof(block) !== "function") {
- throw Opal.LocalJumpError.$new("no block given");
- }
-
- var has_mlhs = block.$$has_top_level_mlhs_arg,
- has_trailing_comma = block.$$has_trailing_comma_in_args;
-
- if (block.length > 1 || ((has_mlhs || has_trailing_comma) && block.length === 1)) {
- arg = Opal.to_ary(arg);
- }
-
- if ((block.length > 1 || (has_trailing_comma && block.length === 1)) && arg.$$is_array) {
- return block.apply(null, arg);
- }
- else {
- return block(arg);
- }
- };
-
- // handles yield for > 1 yielded arg
- Opal.yieldX = function(block, args) {
- if (typeof(block) !== "function") {
- throw Opal.LocalJumpError.$new("no block given");
- }
-
- if (block.length > 1 && args.length === 1) {
- if (args[0].$$is_array) {
- return block.apply(null, args[0]);
- }
- }
-
- if (!args.$$is_array) {
- var args_ary = new Array(args.length);
- for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; }
-
- return block.apply(null, args_ary);
- }
-
- return block.apply(null, args);
- };
-
- // Finds the corresponding exception match in candidates. Each candidate can
- // be a value, or an array of values. Returns null if not found.
- Opal.rescue = function(exception, candidates) {
- for (var i = 0; i < candidates.length; i++) {
- var candidate = candidates[i];
-
- if (candidate.$$is_array) {
- var result = Opal.rescue(exception, candidate);
-
- if (result) {
- return result;
- }
- }
- else if (candidate === Opal.JS.Error) {
- return candidate;
- }
- else if (candidate['$==='](exception)) {
- return candidate;
- }
- }
-
- return null;
- };
-
- Opal.is_a = function(object, klass) {
- if (klass != null && object.$$meta === klass || object.$$class === klass) {
- return true;
- }
-
- if (object.$$is_number && klass.$$is_number_class) {
- return true;
- }
-
- var i, length, ancestors = Opal.ancestors(object.$$is_class ? Opal.get_singleton_class(object) : (object.$$meta || object.$$class));
-
- for (i = 0, length = ancestors.length; i < length; i++) {
- if (ancestors[i] === klass) {
- return true;
- }
- }
-
- return false;
- };
-
- // Helpers for extracting kwsplats
- // Used for: { **h }
- Opal.to_hash = function(value) {
- if (value.$$is_hash) {
- return value;
- }
- else if (value['$respond_to?']('to_hash', true)) {
- var hash = value.$to_hash();
- if (hash.$$is_hash) {
- return hash;
- }
- else {
- throw Opal.TypeError.$new("Can't convert " + value.$$class +
- " to Hash (" + value.$$class + "#to_hash gives " + hash.$$class + ")");
- }
- }
- else {
- throw Opal.TypeError.$new("no implicit conversion of " + value.$$class + " into Hash");
- }
- };
-
- // Helpers for implementing multiple assignment
- // Our code for extracting the values and assigning them only works if the
- // return value is a JS array.
- // So if we get an Array subclass, extract the wrapped JS array from it
-
- // Used for: a, b = something (no splat)
- Opal.to_ary = function(value) {
- if (value.$$is_array) {
- return value;
- }
- else if (value['$respond_to?']('to_ary', true)) {
- var ary = value.$to_ary();
- if (ary === nil) {
- return [value];
- }
- else if (ary.$$is_array) {
- return ary;
- }
- else {
- throw Opal.TypeError.$new("Can't convert " + value.$$class +
- " to Array (" + value.$$class + "#to_ary gives " + ary.$$class + ")");
- }
- }
- else {
- return [value];
- }
- };
-
- // Used for: a, b = *something (with splat)
- Opal.to_a = function(value) {
- if (value.$$is_array) {
- // A splatted array must be copied
- return value.slice();
- }
- else if (value['$respond_to?']('to_a', true)) {
- var ary = value.$to_a();
- if (ary === nil) {
- return [value];
- }
- else if (ary.$$is_array) {
- return ary;
- }
- else {
- throw Opal.TypeError.$new("Can't convert " + value.$$class +
- " to Array (" + value.$$class + "#to_a gives " + ary.$$class + ")");
- }
- }
- else {
- return [value];
- }
- };
-
- // Used for extracting keyword arguments from arguments passed to
- // JS function. If provided +arguments+ list doesn't have a Hash
- // as a last item, returns a blank Hash.
- //
- // @param parameters [Array]
- // @return [Hash]
- //
- Opal.extract_kwargs = function(parameters) {
- var kwargs = parameters[parameters.length - 1];
- if (kwargs != null && kwargs['$respond_to?']('to_hash', true)) {
- $splice.call(parameters, parameters.length - 1, 1);
- return kwargs.$to_hash();
- }
- else {
- return Opal.hash2([], {});
- }
- }
-
- // Used to get a list of rest keyword arguments. Method takes the given
- // keyword args, i.e. the hash literal passed to the method containing all
- // keyword arguemnts passed to method, as well as the used args which are
- // the names of required and optional arguments defined. This method then
- // just returns all key/value pairs which have not been used, in a new
- // hash literal.
- //
- // @param given_args [Hash] all kwargs given to method
- // @param used_args [Object] all keys used as named kwargs
- // @return [Hash]
- //
- Opal.kwrestargs = function(given_args, used_args) {
- var keys = [],
- map = {},
- key = null,
- given_map = given_args.$$smap;
-
- for (key in given_map) {
- if (!used_args[key]) {
- keys.push(key);
- map[key] = given_map[key];
- }
- }
-
- return Opal.hash2(keys, map);
- };
-
- // Calls passed method on a ruby object with arguments and block:
- //
- // Can take a method or a method name.
- //
- // 1. When method name gets passed it invokes it by its name
- // and calls 'method_missing' when object doesn't have this method.
- // Used internally by Opal to invoke method that takes a block or a splat.
- // 2. When method (i.e. method body) gets passed, it doesn't trigger 'method_missing'
- // because it doesn't know the name of the actual method.
- // Used internally by Opal to invoke 'super'.
- //
- // @example
- // var my_array = [1, 2, 3, 4]
- // Opal.send(my_array, 'length') # => 4
- // Opal.send(my_array, my_array.$length) # => 4
- //
- // Opal.send(my_array, 'reverse!') # => [4, 3, 2, 1]
- // Opal.send(my_array, my_array['$reverse!']') # => [4, 3, 2, 1]
- //
- // @param recv [Object] ruby object
- // @param method [Function, String] method body or name of the method
- // @param args [Array] arguments that will be passed to the method call
- // @param block [Function] ruby block
- // @return [Object] returning value of the method call
- Opal.send = function(recv, method, args, block) {
- var body = (typeof(method) === 'string') ? recv['$'+method] : method;
-
- if (body != null) {
- if (typeof block === 'function') {
- body.$$p = block;
- }
- return body.apply(recv, args);
- }
-
- return recv.$method_missing.apply(recv, [method].concat(args));
- }
-
- Opal.lambda = function(block) {
- block.$$is_lambda = true;
- return block;
- }
-
- // Used to define methods on an object. This is a helper method, used by the
- // compiled source to define methods on special case objects when the compiler
- // can not determine the destination object, or the object is a Module
- // instance. This can get called by `Module#define_method` as well.
- //
- // ## Modules
- //
- // Any method defined on a module will come through this runtime helper.
- // The method is added to the module body, and the owner of the method is
- // set to be the module itself. This is used later when choosing which
- // method should show on a class if more than 1 included modules define
- // the same method. Finally, if the module is in `module_function` mode,
- // then the method is also defined onto the module itself.
- //
- // ## Classes
- //
- // This helper will only be called for classes when a method is being
- // defined indirectly; either through `Module#define_method`, or by a
- // literal `def` method inside an `instance_eval` or `class_eval` body. In
- // either case, the method is simply added to the class' prototype. A special
- // exception exists for `BasicObject` and `Object`. These two classes are
- // special because they are used in toll-free bridged classes. In each of
- // these two cases, extra work is required to define the methods on toll-free
- // bridged class' prototypes as well.
- //
- // ## Objects
- //
- // If a simple ruby object is the object, then the method is simply just
- // defined on the object as a singleton method. This would be the case when
- // a method is defined inside an `instance_eval` block.
- //
- // @param obj [Object, Class] the actual obj to define method for
- // @param jsid [String] the JavaScript friendly method name (e.g. '$foo')
- // @param body [JS.Function] the literal JavaScript function used as method
- // @return [null]
- //
- Opal.def = function(obj, jsid, body) {
- // Special case for a method definition in the
- // top-level namespace
- if (obj === Opal.top) {
- Opal.defn(Opal.Object, jsid, body)
- }
- // if instance_eval is invoked on a module/class, it sets inst_eval_mod
- else if (!obj.$$eval && obj.$$is_a_module) {
- Opal.defn(obj, jsid, body);
- }
- else {
- Opal.defs(obj, jsid, body);
- }
- };
-
- // Define method on a module or class (see Opal.def).
- Opal.defn = function(module, jsid, body) {
- body.displayName = jsid;
- body.$$owner = module;
-
- var proto = module.$$prototype;
- if (proto.hasOwnProperty('$$dummy')) {
- proto = proto.$$define_methods_on;
- }
- $defineProperty(proto, jsid, body);
-
- if (module.$$is_module) {
- if (module.$$module_function) {
- Opal.defs(module, jsid, body)
- }
-
- for (var i = 0, iclasses = module.$$iclasses, length = iclasses.length; i < length; i++) {
- var iclass = iclasses[i];
- $defineProperty(iclass, jsid, body);
- }
- }
-
- var singleton_of = module.$$singleton_of;
- if (module.$method_added && !module.$method_added.$$stub && !singleton_of) {
- module.$method_added(jsid.substr(1));
- }
- else if (singleton_of && singleton_of.$singleton_method_added && !singleton_of.$singleton_method_added.$$stub) {
- singleton_of.$singleton_method_added(jsid.substr(1));
- }
- }
-
- // Define a singleton method on the given object (see Opal.def).
- Opal.defs = function(obj, jsid, body) {
- if (obj.$$is_string || obj.$$is_number) {
- throw Opal.TypeError.$new("can't define singleton");
- }
- Opal.defn(Opal.get_singleton_class(obj), jsid, body)
- };
-
- // Called from #remove_method.
- Opal.rdef = function(obj, jsid) {
- if (!$hasOwn.call(obj.$$prototype, jsid)) {
- throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name());
- }
-
- delete obj.$$prototype[jsid];
-
- if (obj.$$is_singleton) {
- if (obj.$$prototype.$singleton_method_removed && !obj.$$prototype.$singleton_method_removed.$$stub) {
- obj.$$prototype.$singleton_method_removed(jsid.substr(1));
- }
- }
- else {
- if (obj.$method_removed && !obj.$method_removed.$$stub) {
- obj.$method_removed(jsid.substr(1));
- }
- }
- };
-
- // Called from #undef_method.
- Opal.udef = function(obj, jsid) {
- if (!obj.$$prototype[jsid] || obj.$$prototype[jsid].$$stub) {
- throw Opal.NameError.$new("method '" + jsid.substr(1) + "' not defined in " + obj.$name());
- }
-
- Opal.add_stub_for(obj.$$prototype, jsid);
-
- if (obj.$$is_singleton) {
- if (obj.$$prototype.$singleton_method_undefined && !obj.$$prototype.$singleton_method_undefined.$$stub) {
- obj.$$prototype.$singleton_method_undefined(jsid.substr(1));
- }
- }
- else {
- if (obj.$method_undefined && !obj.$method_undefined.$$stub) {
- obj.$method_undefined(jsid.substr(1));
- }
- }
- };
-
- function is_method_body(body) {
- return (typeof(body) === "function" && !body.$$stub);
- }
-
- Opal.alias = function(obj, name, old) {
- var id = '$' + name,
- old_id = '$' + old,
- body = obj.$$prototype['$' + old],
- alias;
-
- // When running inside #instance_eval the alias refers to class methods.
- if (obj.$$eval) {
- return Opal.alias(Opal.get_singleton_class(obj), name, old);
- }
-
- if (!is_method_body(body)) {
- var ancestor = obj.$$super;
-
- while (typeof(body) !== "function" && ancestor) {
- body = ancestor[old_id];
- ancestor = ancestor.$$super;
- }
-
- if (!is_method_body(body) && obj.$$is_module) {
- // try to look into Object
- body = Opal.Object.$$prototype[old_id]
- }
-
- if (!is_method_body(body)) {
- throw Opal.NameError.$new("undefined method `" + old + "' for class `" + obj.$name() + "'")
- }
- }
-
- // If the body is itself an alias use the original body
- // to keep the max depth at 1.
- if (body.$$alias_of) body = body.$$alias_of;
-
- // We need a wrapper because otherwise properties
- // would be ovrewritten on the original body.
- alias = function() {
- var block = alias.$$p, args, i, ii;
-
- args = new Array(arguments.length);
- for(i = 0, ii = arguments.length; i < ii; i++) {
- args[i] = arguments[i];
- }
-
- if (block != null) { alias.$$p = null }
-
- return Opal.send(this, body, args, block);
- };
-
- // Try to make the browser pick the right name
- alias.displayName = name;
- alias.length = body.length;
- alias.$$arity = body.$$arity;
- alias.$$parameters = body.$$parameters;
- alias.$$source_location = body.$$source_location;
- alias.$$alias_of = body;
- alias.$$alias_name = name;
-
- Opal.defn(obj, id, alias);
-
- return obj;
- };
-
- Opal.alias_native = function(obj, name, native_name) {
- var id = '$' + name,
- body = obj.$$prototype[native_name];
-
- if (typeof(body) !== "function" || body.$$stub) {
- throw Opal.NameError.$new("undefined native method `" + native_name + "' for class `" + obj.$name() + "'")
- }
-
- Opal.defn(obj, id, body);
-
- return obj;
- };
-
-
- // Hashes
- // ------
-
- Opal.hash_init = function(hash) {
- hash.$$smap = Object.create(null);
- hash.$$map = Object.create(null);
- hash.$$keys = [];
- };
-
- Opal.hash_clone = function(from_hash, to_hash) {
- to_hash.$$none = from_hash.$$none;
- to_hash.$$proc = from_hash.$$proc;
-
- for (var i = 0, keys = from_hash.$$keys, smap = from_hash.$$smap, len = keys.length, key, value; i < len; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- Opal.hash_put(to_hash, key, value);
- }
- };
-
- Opal.hash_put = function(hash, key, value) {
- if (key.$$is_string) {
- if (!$hasOwn.call(hash.$$smap, key)) {
- hash.$$keys.push(key);
- }
- hash.$$smap[key] = value;
- return;
- }
-
- var key_hash, bucket, last_bucket;
- key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash();
-
- if (!$hasOwn.call(hash.$$map, key_hash)) {
- bucket = {key: key, key_hash: key_hash, value: value};
- hash.$$keys.push(bucket);
- hash.$$map[key_hash] = bucket;
- return;
- }
-
- bucket = hash.$$map[key_hash];
-
- while (bucket) {
- if (key === bucket.key || key['$eql?'](bucket.key)) {
- last_bucket = undefined;
- bucket.value = value;
- break;
- }
- last_bucket = bucket;
- bucket = bucket.next;
- }
-
- if (last_bucket) {
- bucket = {key: key, key_hash: key_hash, value: value};
- hash.$$keys.push(bucket);
- last_bucket.next = bucket;
- }
- };
-
- Opal.hash_get = function(hash, key) {
- if (key.$$is_string) {
- if ($hasOwn.call(hash.$$smap, key)) {
- return hash.$$smap[key];
- }
- return;
- }
-
- var key_hash, bucket;
- key_hash = hash.$$by_identity ? Opal.id(key) : key.$hash();
-
- if ($hasOwn.call(hash.$$map, key_hash)) {
- bucket = hash.$$map[key_hash];
-
- while (bucket) {
- if (key === bucket.key || key['$eql?'](bucket.key)) {
- return bucket.value;
- }
- bucket = bucket.next;
- }
- }
- };
-
- Opal.hash_delete = function(hash, key) {
- var i, keys = hash.$$keys, length = keys.length, value;
-
- if (key.$$is_string) {
- if (!$hasOwn.call(hash.$$smap, key)) {
- return;
- }
-
- for (i = 0; i < length; i++) {
- if (keys[i] === key) {
- keys.splice(i, 1);
- break;
- }
- }
-
- value = hash.$$smap[key];
- delete hash.$$smap[key];
- return value;
- }
-
- var key_hash = key.$hash();
-
- if (!$hasOwn.call(hash.$$map, key_hash)) {
- return;
- }
-
- var bucket = hash.$$map[key_hash], last_bucket;
-
- while (bucket) {
- if (key === bucket.key || key['$eql?'](bucket.key)) {
- value = bucket.value;
-
- for (i = 0; i < length; i++) {
- if (keys[i] === bucket) {
- keys.splice(i, 1);
- break;
- }
- }
-
- if (last_bucket && bucket.next) {
- last_bucket.next = bucket.next;
- }
- else if (last_bucket) {
- delete last_bucket.next;
- }
- else if (bucket.next) {
- hash.$$map[key_hash] = bucket.next;
- }
- else {
- delete hash.$$map[key_hash];
- }
-
- return value;
- }
- last_bucket = bucket;
- bucket = bucket.next;
- }
- };
-
- Opal.hash_rehash = function(hash) {
- for (var i = 0, length = hash.$$keys.length, key_hash, bucket, last_bucket; i < length; i++) {
-
- if (hash.$$keys[i].$$is_string) {
- continue;
- }
-
- key_hash = hash.$$keys[i].key.$hash();
-
- if (key_hash === hash.$$keys[i].key_hash) {
- continue;
- }
-
- bucket = hash.$$map[hash.$$keys[i].key_hash];
- last_bucket = undefined;
-
- while (bucket) {
- if (bucket === hash.$$keys[i]) {
- if (last_bucket && bucket.next) {
- last_bucket.next = bucket.next;
- }
- else if (last_bucket) {
- delete last_bucket.next;
- }
- else if (bucket.next) {
- hash.$$map[hash.$$keys[i].key_hash] = bucket.next;
- }
- else {
- delete hash.$$map[hash.$$keys[i].key_hash];
- }
- break;
- }
- last_bucket = bucket;
- bucket = bucket.next;
- }
-
- hash.$$keys[i].key_hash = key_hash;
-
- if (!$hasOwn.call(hash.$$map, key_hash)) {
- hash.$$map[key_hash] = hash.$$keys[i];
- continue;
- }
-
- bucket = hash.$$map[key_hash];
- last_bucket = undefined;
-
- while (bucket) {
- if (bucket === hash.$$keys[i]) {
- last_bucket = undefined;
- break;
- }
- last_bucket = bucket;
- bucket = bucket.next;
- }
-
- if (last_bucket) {
- last_bucket.next = hash.$$keys[i];
- }
- }
- };
-
- Opal.hash = function() {
- var arguments_length = arguments.length, args, hash, i, length, key, value;
-
- if (arguments_length === 1 && arguments[0].$$is_hash) {
- return arguments[0];
- }
-
- hash = new Opal.Hash();
- Opal.hash_init(hash);
-
- if (arguments_length === 1 && arguments[0].$$is_array) {
- args = arguments[0];
- length = args.length;
-
- for (i = 0; i < length; i++) {
- if (args[i].length !== 2) {
- throw Opal.ArgumentError.$new("value not of length 2: " + args[i].$inspect());
- }
-
- key = args[i][0];
- value = args[i][1];
-
- Opal.hash_put(hash, key, value);
- }
-
- return hash;
- }
-
- if (arguments_length === 1) {
- args = arguments[0];
- for (key in args) {
- if ($hasOwn.call(args, key)) {
- value = args[key];
-
- Opal.hash_put(hash, key, value);
- }
- }
-
- return hash;
- }
-
- if (arguments_length % 2 !== 0) {
- throw Opal.ArgumentError.$new("odd number of arguments for Hash");
- }
-
- for (i = 0; i < arguments_length; i += 2) {
- key = arguments[i];
- value = arguments[i + 1];
-
- Opal.hash_put(hash, key, value);
- }
-
- return hash;
- };
-
- // A faster Hash creator for hashes that just use symbols and
- // strings as keys. The map and keys array can be constructed at
- // compile time, so they are just added here by the constructor
- // function.
- //
- Opal.hash2 = function(keys, smap) {
- var hash = new Opal.Hash();
-
- hash.$$smap = smap;
- hash.$$map = Object.create(null);
- hash.$$keys = keys;
-
- return hash;
- };
-
- // Create a new range instance with first and last values, and whether the
- // range excludes the last value.
- //
- Opal.range = function(first, last, exc) {
- var range = new Opal.Range();
- range.begin = first;
- range.end = last;
- range.excl = exc;
-
- return range;
- };
-
- // Get the ivar name for a given name.
- // Mostly adds a trailing $ to reserved names.
- //
- Opal.ivar = function(name) {
- if (
- // properties
- name === "constructor" ||
- name === "displayName" ||
- name === "__count__" ||
- name === "__noSuchMethod__" ||
- name === "__parent__" ||
- name === "__proto__" ||
-
- // methods
- name === "hasOwnProperty" ||
- name === "valueOf"
- )
- {
- return name + "$";
- }
-
- return name;
- };
-
-
- // Regexps
- // -------
-
- // Escape Regexp special chars letting the resulting string be used to build
- // a new Regexp.
- //
- Opal.escape_regexp = function(str) {
- return str.replace(/([-[\]\/{}()*+?.^$\\| ])/g, '\\$1')
- .replace(/[\n]/g, '\\n')
- .replace(/[\r]/g, '\\r')
- .replace(/[\f]/g, '\\f')
- .replace(/[\t]/g, '\\t');
- };
-
- // Create a global Regexp from a RegExp object and cache the result
- // on the object itself ($$g attribute).
- //
- Opal.global_regexp = function(pattern) {
- if (pattern.global) {
- return pattern; // RegExp already has the global flag
- }
- if (pattern.$$g == null) {
- pattern.$$g = new RegExp(pattern.source, (pattern.multiline ? 'gm' : 'g') + (pattern.ignoreCase ? 'i' : ''));
- } else {
- pattern.$$g.lastIndex = null; // reset lastIndex property
- }
- return pattern.$$g;
- };
-
- // Create a global multiline Regexp from a RegExp object and cache the result
- // on the object itself ($$gm or $$g attribute).
- //
- Opal.global_multiline_regexp = function(pattern) {
- var result;
- if (pattern.multiline) {
- if (pattern.global) {
- return pattern; // RegExp already has the global and multiline flag
- }
- // we are using the $$g attribute because the Regexp is already multiline
- if (pattern.$$g != null) {
- result = pattern.$$g;
- } else {
- result = pattern.$$g = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : ''));
- }
- } else if (pattern.$$gm != null) {
- result = pattern.$$gm;
- } else {
- result = pattern.$$gm = new RegExp(pattern.source, 'gm' + (pattern.ignoreCase ? 'i' : ''));
- }
- result.lastIndex = null; // reset lastIndex property
- return result;
- };
-
- // Require system
- // --------------
-
- Opal.modules = {};
- Opal.loaded_features = ['corelib/runtime'];
- Opal.current_dir = '.';
- Opal.require_table = {'corelib/runtime': true};
-
- Opal.normalize = function(path) {
- var parts, part, new_parts = [], SEPARATOR = '/';
-
- if (Opal.current_dir !== '.') {
- path = Opal.current_dir.replace(/\/*$/, '/') + path;
- }
-
- path = path.replace(/^\.\//, '');
- path = path.replace(/\.(rb|opal|js)$/, '');
- parts = path.split(SEPARATOR);
-
- for (var i = 0, ii = parts.length; i < ii; i++) {
- part = parts[i];
- if (part === '') continue;
- (part === '..') ? new_parts.pop() : new_parts.push(part)
- }
-
- return new_parts.join(SEPARATOR);
- };
-
- Opal.loaded = function(paths) {
- var i, l, path;
-
- for (i = 0, l = paths.length; i < l; i++) {
- path = Opal.normalize(paths[i]);
-
- if (Opal.require_table[path]) {
- continue;
- }
-
- Opal.loaded_features.push(path);
- Opal.require_table[path] = true;
- }
- };
-
- Opal.load = function(path) {
- path = Opal.normalize(path);
-
- Opal.loaded([path]);
-
- var module = Opal.modules[path];
-
- if (module) {
- module(Opal);
- }
- else {
- var severity = Opal.config.missing_require_severity;
- var message = 'cannot load such file -- ' + path;
-
- if (severity === "error") {
- if (Opal.LoadError) {
- throw Opal.LoadError.$new(message)
- } else {
- throw message
- }
- }
- else if (severity === "warning") {
- console.warn('WARNING: LoadError: ' + message);
- }
- }
-
- return true;
- };
-
- Opal.require = function(path) {
- path = Opal.normalize(path);
-
- if (Opal.require_table[path]) {
- return false;
- }
-
- return Opal.load(path);
- };
-
-
- // Strings
- // -------
-
- Opal.encodings = Object.create(null);
-
- // Sets the encoding on a string, will treat string literals as frozen strings
- // raising a FrozenError.
- // @param str [String] the string on which the encoding should be set.
- // @param name [String] the canonical name of the encoding
- Opal.set_encoding = function(str, name) {
- if (typeof str === 'string')
- throw Opal.FrozenError.$new("can't modify frozen String");
-
- var encoding = Opal.encodings[name];
-
- if (encoding === str.encoding) { return str; }
-
- str.encoding = encoding;
-
- return str;
- };
-
- // @returns a String object with the encoding set from a string literal
- Opal.enc = function(str, name) {
- var dup = new String(str);
- Opal.set_encoding(dup, name);
- dup.internal_encoding = dup.encoding;
- return dup
- }
-
-
- // Initialization
- // --------------
- function $BasicObject() {};
- function $Object() {};
- function $Module() {};
- function $Class() {};
-
- Opal.BasicObject = BasicObject = Opal.allocate_class('BasicObject', null, $BasicObject);
- Opal.Object = _Object = Opal.allocate_class('Object', Opal.BasicObject, $Object);
- Opal.Module = Module = Opal.allocate_class('Module', Opal.Object, $Module);
- Opal.Class = Class = Opal.allocate_class('Class', Opal.Module, $Class);
-
- $setPrototype(Opal.BasicObject, Opal.Class.$$prototype);
- $setPrototype(Opal.Object, Opal.Class.$$prototype);
- $setPrototype(Opal.Module, Opal.Class.$$prototype);
- $setPrototype(Opal.Class, Opal.Class.$$prototype);
-
- // BasicObject can reach itself, avoid const_set to skip the $$base_module logic
- BasicObject.$$const["BasicObject"] = BasicObject;
-
- // Assign basic constants
- Opal.const_set(_Object, "BasicObject", BasicObject);
- Opal.const_set(_Object, "Object", _Object);
- Opal.const_set(_Object, "Module", Module);
- Opal.const_set(_Object, "Class", Class);
-
- // Fix booted classes to have correct .class value
- BasicObject.$$class = Class;
- _Object.$$class = Class;
- Module.$$class = Class;
- Class.$$class = Class;
-
- // Forward .toString() to #to_s
- $defineProperty(_Object.$$prototype, 'toString', function() {
- var to_s = this.$to_s();
- if (to_s.$$is_string && typeof(to_s) === 'object') {
- // a string created using new String('string')
- return to_s.valueOf();
- } else {
- return to_s;
- }
- });
-
- // Make Kernel#require immediately available as it's needed to require all the
- // other corelib files.
- $defineProperty(_Object.$$prototype, '$require', Opal.require);
-
- // Add a short helper to navigate constants manually.
- // @example
- // Opal.$$.Regexp.$$.IGNORECASE
- Opal.$$ = _Object.$$;
-
- // Instantiate the main object
- Opal.top = new _Object();
- Opal.top.$to_s = Opal.top.$inspect = function() { return 'main' };
-
-
- // Nil
- function $NilClass() {};
- Opal.NilClass = Opal.allocate_class('NilClass', Opal.Object, $NilClass);
- Opal.const_set(_Object, 'NilClass', Opal.NilClass);
- nil = Opal.nil = new Opal.NilClass();
- nil.$$id = nil_id;
- nil.call = nil.apply = function() { throw Opal.LocalJumpError.$new('no block given'); };
-
- // Errors
- Opal.breaker = new Error('unexpected break (old)');
- Opal.returner = new Error('unexpected return');
- TypeError.$$super = Error;
-}).call(this);
-Opal.loaded(["corelib/runtime.js"]);
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/helpers"] = function(Opal) {
- 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, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$new', '$class', '$===', '$respond_to?', '$raise', '$type_error', '$__send__', '$coerce_to', '$nil?', '$<=>', '$coerce_to!', '$!=', '$[]', '$upcase']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Opal');
-
- var $nesting = [self].concat($parent_nesting), $Opal_bridge$1, $Opal_type_error$2, $Opal_coerce_to$3, $Opal_coerce_to$excl$4, $Opal_coerce_to$ques$5, $Opal_try_convert$6, $Opal_compare$7, $Opal_destructure$8, $Opal_respond_to$ques$9, $Opal_inspect_obj$10, $Opal_instance_variable_name$excl$11, $Opal_class_variable_name$excl$12, $Opal_const_name$excl$13, $Opal_pristine$14;
-
-
- Opal.defs(self, '$bridge', $Opal_bridge$1 = function $$bridge(constructor, klass) {
- var self = this;
-
- return Opal.bridge(constructor, klass);
- }, $Opal_bridge$1.$$arity = 2);
- Opal.defs(self, '$type_error', $Opal_type_error$2 = function $$type_error(object, type, method, coerced) {
- var $a, self = this;
-
-
-
- if (method == null) {
- method = nil;
- };
-
- if (coerced == null) {
- coerced = nil;
- };
- if ($truthy(($truthy($a = method) ? coerced : $a))) {
- return $$($nesting, 'TypeError').$new("" + "can't convert " + (object.$class()) + " into " + (type) + " (" + (object.$class()) + "#" + (method) + " gives " + (coerced.$class()) + ")")
- } else {
- return $$($nesting, 'TypeError').$new("" + "no implicit conversion of " + (object.$class()) + " into " + (type))
- };
- }, $Opal_type_error$2.$$arity = -3);
- Opal.defs(self, '$coerce_to', $Opal_coerce_to$3 = function $$coerce_to(object, type, method) {
- var self = this;
-
-
- if ($truthy(type['$==='](object))) {
- return object};
- if ($truthy(object['$respond_to?'](method))) {
- } else {
- self.$raise(self.$type_error(object, type))
- };
- return object.$__send__(method);
- }, $Opal_coerce_to$3.$$arity = 3);
- Opal.defs(self, '$coerce_to!', $Opal_coerce_to$excl$4 = function(object, type, method) {
- var self = this, coerced = nil;
-
-
- coerced = self.$coerce_to(object, type, method);
- if ($truthy(type['$==='](coerced))) {
- } else {
- self.$raise(self.$type_error(object, type, method, coerced))
- };
- return coerced;
- }, $Opal_coerce_to$excl$4.$$arity = 3);
- Opal.defs(self, '$coerce_to?', $Opal_coerce_to$ques$5 = function(object, type, method) {
- var self = this, coerced = nil;
-
-
- if ($truthy(object['$respond_to?'](method))) {
- } else {
- return nil
- };
- coerced = self.$coerce_to(object, type, method);
- if ($truthy(coerced['$nil?']())) {
- return nil};
- if ($truthy(type['$==='](coerced))) {
- } else {
- self.$raise(self.$type_error(object, type, method, coerced))
- };
- return coerced;
- }, $Opal_coerce_to$ques$5.$$arity = 3);
- Opal.defs(self, '$try_convert', $Opal_try_convert$6 = function $$try_convert(object, type, method) {
- var self = this;
-
-
- if ($truthy(type['$==='](object))) {
- return object};
- if ($truthy(object['$respond_to?'](method))) {
- return object.$__send__(method)
- } else {
- return nil
- };
- }, $Opal_try_convert$6.$$arity = 3);
- Opal.defs(self, '$compare', $Opal_compare$7 = function $$compare(a, b) {
- var self = this, compare = nil;
-
-
- compare = a['$<=>'](b);
- if ($truthy(compare === nil)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (a.$class()) + " with " + (b.$class()) + " failed")};
- return compare;
- }, $Opal_compare$7.$$arity = 2);
- Opal.defs(self, '$destructure', $Opal_destructure$8 = function $$destructure(args) {
- var self = this;
-
-
- if (args.length == 1) {
- return args[0];
- }
- else if (args.$$is_array) {
- return args;
- }
- else {
- var args_ary = new Array(args.length);
- for(var i = 0, l = args_ary.length; i < l; i++) { args_ary[i] = args[i]; }
-
- return args_ary;
- }
-
- }, $Opal_destructure$8.$$arity = 1);
- Opal.defs(self, '$respond_to?', $Opal_respond_to$ques$9 = function(obj, method, include_all) {
- var self = this;
-
-
-
- if (include_all == null) {
- include_all = false;
- };
-
- if (obj == null || !obj.$$class) {
- return false;
- }
- ;
- return obj['$respond_to?'](method, include_all);
- }, $Opal_respond_to$ques$9.$$arity = -3);
- Opal.defs(self, '$inspect_obj', $Opal_inspect_obj$10 = function $$inspect_obj(obj) {
- var self = this;
-
- return Opal.inspect(obj);
- }, $Opal_inspect_obj$10.$$arity = 1);
- Opal.defs(self, '$instance_variable_name!', $Opal_instance_variable_name$excl$11 = function(name) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str");
- if ($truthy(/^@[a-zA-Z_][a-zA-Z0-9_]*?$/.test(name))) {
- } else {
- self.$raise($$($nesting, 'NameError').$new("" + "'" + (name) + "' is not allowed as an instance variable name", name))
- };
- return name;
- }, $Opal_instance_variable_name$excl$11.$$arity = 1);
- Opal.defs(self, '$class_variable_name!', $Opal_class_variable_name$excl$12 = function(name) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str");
- if ($truthy(name.length < 3 || name.slice(0,2) !== '@@')) {
- self.$raise($$($nesting, 'NameError').$new("" + "`" + (name) + "' is not allowed as a class variable name", name))};
- return name;
- }, $Opal_class_variable_name$excl$12.$$arity = 1);
- Opal.defs(self, '$const_name!', $Opal_const_name$excl$13 = function(const_name) {
- var self = this;
-
-
- const_name = $$($nesting, 'Opal')['$coerce_to!'](const_name, $$($nesting, 'String'), "to_str");
- if ($truthy(const_name['$[]'](0)['$!='](const_name['$[]'](0).$upcase()))) {
- self.$raise($$($nesting, 'NameError'), "" + "wrong constant name " + (const_name))};
- return const_name;
- }, $Opal_const_name$excl$13.$$arity = 1);
- Opal.defs(self, '$pristine', $Opal_pristine$14 = function $$pristine(owner_class, $a) {
- var $post_args, method_names, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- method_names = $post_args;;
-
- var method_name, method;
- for (var i = method_names.length - 1; i >= 0; i--) {
- method_name = method_names[i];
- method = owner_class.$$prototype['$'+method_name];
-
- if (method && !method.$$stub) {
- method.$$pristine = true;
- }
- }
- ;
- return nil;
- }, $Opal_pristine$14.$$arity = -2);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/module"] = function(Opal) {
- function $rb_lt(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);
- }
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $lambda = Opal.lambda, $range = Opal.range, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$module_eval', '$to_proc', '$===', '$raise', '$equal?', '$<', '$>', '$nil?', '$attr_reader', '$attr_writer', '$class_variable_name!', '$new', '$const_name!', '$=~', '$inject', '$split', '$const_get', '$==', '$!~', '$start_with?', '$bind', '$call', '$class', '$append_features', '$included', '$name', '$cover?', '$size', '$merge', '$compile', '$proc', '$any?', '$prepend_features', '$prepended', '$to_s', '$__id__', '$constants', '$include?', '$copy_class_variables', '$copy_constants']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Module');
-
- var $nesting = [self].concat($parent_nesting), $Module_allocate$1, $Module_initialize$2, $Module_$eq_eq_eq$3, $Module_$lt$4, $Module_$lt_eq$5, $Module_$gt$6, $Module_$gt_eq$7, $Module_$lt_eq_gt$8, $Module_alias_method$9, $Module_alias_native$10, $Module_ancestors$11, $Module_append_features$12, $Module_attr_accessor$13, $Module_attr_reader$14, $Module_attr_writer$15, $Module_autoload$16, $Module_class_variables$17, $Module_class_variable_get$18, $Module_class_variable_set$19, $Module_class_variable_defined$ques$20, $Module_remove_class_variable$21, $Module_constants$22, $Module_constants$23, $Module_nesting$24, $Module_const_defined$ques$25, $Module_const_get$26, $Module_const_missing$28, $Module_const_set$29, $Module_public_constant$30, $Module_define_method$31, $Module_remove_method$33, $Module_singleton_class$ques$34, $Module_include$35, $Module_included_modules$36, $Module_include$ques$37, $Module_instance_method$38, $Module_instance_methods$39, $Module_included$40, $Module_extended$41, $Module_extend_object$42, $Module_method_added$43, $Module_method_removed$44, $Module_method_undefined$45, $Module_module_eval$46, $Module_module_exec$48, $Module_method_defined$ques$49, $Module_module_function$50, $Module_name$51, $Module_prepend$52, $Module_prepend_features$53, $Module_prepended$54, $Module_remove_const$55, $Module_to_s$56, $Module_undef_method$57, $Module_instance_variables$58, $Module_dup$59, $Module_copy_class_variables$60, $Module_copy_constants$61;
-
-
- Opal.defs(self, '$allocate', $Module_allocate$1 = function $$allocate() {
- var self = this;
-
-
- var module = Opal.allocate_module(nil, function(){});
- // Link the prototype of Module subclasses
- if (self !== Opal.Module) Object.setPrototypeOf(module, self.$$prototype);
- return module;
-
- }, $Module_allocate$1.$$arity = 0);
-
- Opal.def(self, '$initialize', $Module_initialize$2 = function $$initialize() {
- var $iter = $Module_initialize$2.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Module_initialize$2.$$p = null;
-
-
- if ($iter) $Module_initialize$2.$$p = null;;
- if ((block !== nil)) {
- return $send(self, 'module_eval', [], block.$to_proc())
- } else {
- return nil
- };
- }, $Module_initialize$2.$$arity = 0);
-
- Opal.def(self, '$===', $Module_$eq_eq_eq$3 = function(object) {
- var self = this;
-
-
- if ($truthy(object == null)) {
- return false};
- return Opal.is_a(object, self);;
- }, $Module_$eq_eq_eq$3.$$arity = 1);
-
- Opal.def(self, '$<', $Module_$lt$4 = function(other) {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Module')['$==='](other))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "compared with non class/module")
- };
-
- var working = self,
- ancestors,
- i, length;
-
- if (working === other) {
- return false;
- }
-
- for (i = 0, ancestors = Opal.ancestors(self), length = ancestors.length; i < length; i++) {
- if (ancestors[i] === other) {
- return true;
- }
- }
-
- for (i = 0, ancestors = Opal.ancestors(other), length = ancestors.length; i < length; i++) {
- if (ancestors[i] === self) {
- return false;
- }
- }
-
- return nil;
- ;
- }, $Module_$lt$4.$$arity = 1);
-
- Opal.def(self, '$<=', $Module_$lt_eq$5 = function(other) {
- var $a, self = this;
-
- return ($truthy($a = self['$equal?'](other)) ? $a : $rb_lt(self, other))
- }, $Module_$lt_eq$5.$$arity = 1);
-
- Opal.def(self, '$>', $Module_$gt$6 = function(other) {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Module')['$==='](other))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "compared with non class/module")
- };
- return $rb_lt(other, self);
- }, $Module_$gt$6.$$arity = 1);
-
- Opal.def(self, '$>=', $Module_$gt_eq$7 = function(other) {
- var $a, self = this;
-
- return ($truthy($a = self['$equal?'](other)) ? $a : $rb_gt(self, other))
- }, $Module_$gt_eq$7.$$arity = 1);
-
- Opal.def(self, '$<=>', $Module_$lt_eq_gt$8 = function(other) {
- var self = this, lt = nil;
-
-
-
- if (self === other) {
- return 0;
- }
- ;
- if ($truthy($$($nesting, 'Module')['$==='](other))) {
- } else {
- return nil
- };
- lt = $rb_lt(self, other);
- if ($truthy(lt['$nil?']())) {
- return nil};
- if ($truthy(lt)) {
- return -1
- } else {
- return 1
- };
- }, $Module_$lt_eq_gt$8.$$arity = 1);
-
- Opal.def(self, '$alias_method', $Module_alias_method$9 = function $$alias_method(newname, oldname) {
- var self = this;
-
-
- Opal.alias(self, newname, oldname);
- return self;
- }, $Module_alias_method$9.$$arity = 2);
-
- Opal.def(self, '$alias_native', $Module_alias_native$10 = function $$alias_native(mid, jsid) {
- var self = this;
-
-
-
- if (jsid == null) {
- jsid = mid;
- };
- Opal.alias_native(self, mid, jsid);
- return self;
- }, $Module_alias_native$10.$$arity = -2);
-
- Opal.def(self, '$ancestors', $Module_ancestors$11 = function $$ancestors() {
- var self = this;
-
- return Opal.ancestors(self);
- }, $Module_ancestors$11.$$arity = 0);
-
- Opal.def(self, '$append_features', $Module_append_features$12 = function $$append_features(includer) {
- var self = this;
-
-
- Opal.append_features(self, includer);
- return self;
- }, $Module_append_features$12.$$arity = 1);
-
- Opal.def(self, '$attr_accessor', $Module_attr_accessor$13 = function $$attr_accessor($a) {
- var $post_args, names, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- names = $post_args;;
- $send(self, 'attr_reader', Opal.to_a(names));
- return $send(self, 'attr_writer', Opal.to_a(names));
- }, $Module_attr_accessor$13.$$arity = -1);
- Opal.alias(self, "attr", "attr_accessor");
-
- Opal.def(self, '$attr_reader', $Module_attr_reader$14 = function $$attr_reader($a) {
- var $post_args, names, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- names = $post_args;;
-
- var proto = self.$$prototype;
-
- for (var i = names.length - 1; i >= 0; i--) {
- var name = names[i],
- id = '$' + name,
- ivar = Opal.ivar(name);
-
- // the closure here is needed because name will change at the next
- // cycle, I wish we could use let.
- var body = (function(ivar) {
- return function() {
- if (this[ivar] == null) {
- return nil;
- }
- else {
- return this[ivar];
- }
- };
- })(ivar);
-
- // initialize the instance variable as nil
- Opal.defineProperty(proto, ivar, nil);
-
- body.$$parameters = [];
- body.$$arity = 0;
-
- Opal.defn(self, id, body);
- }
- ;
- return nil;
- }, $Module_attr_reader$14.$$arity = -1);
-
- Opal.def(self, '$attr_writer', $Module_attr_writer$15 = function $$attr_writer($a) {
- var $post_args, names, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- names = $post_args;;
-
- var proto = self.$$prototype;
-
- for (var i = names.length - 1; i >= 0; i--) {
- var name = names[i],
- id = '$' + name + '=',
- ivar = Opal.ivar(name);
-
- // the closure here is needed because name will change at the next
- // cycle, I wish we could use let.
- var body = (function(ivar){
- return function(value) {
- return this[ivar] = value;
- }
- })(ivar);
-
- body.$$parameters = [['req']];
- body.$$arity = 1;
-
- // initialize the instance variable as nil
- Opal.defineProperty(proto, ivar, nil);
-
- Opal.defn(self, id, body);
- }
- ;
- return nil;
- }, $Module_attr_writer$15.$$arity = -1);
-
- Opal.def(self, '$autoload', $Module_autoload$16 = function $$autoload(const$, path) {
- var self = this;
-
-
- if (self.$$autoload == null) self.$$autoload = {};
- Opal.const_cache_version++;
- self.$$autoload[const$] = path;
- return nil;
-
- }, $Module_autoload$16.$$arity = 2);
-
- Opal.def(self, '$class_variables', $Module_class_variables$17 = function $$class_variables() {
- var self = this;
-
- return Object.keys(Opal.class_variables(self));
- }, $Module_class_variables$17.$$arity = 0);
-
- Opal.def(self, '$class_variable_get', $Module_class_variable_get$18 = function $$class_variable_get(name) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$class_variable_name!'](name);
-
- var value = Opal.class_variables(self)[name];
- if (value == null) {
- self.$raise($$($nesting, 'NameError').$new("" + "uninitialized class variable " + (name) + " in " + (self), name))
- }
- return value;
- ;
- }, $Module_class_variable_get$18.$$arity = 1);
-
- Opal.def(self, '$class_variable_set', $Module_class_variable_set$19 = function $$class_variable_set(name, value) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$class_variable_name!'](name);
- return Opal.class_variable_set(self, name, value);;
- }, $Module_class_variable_set$19.$$arity = 2);
-
- Opal.def(self, '$class_variable_defined?', $Module_class_variable_defined$ques$20 = function(name) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$class_variable_name!'](name);
- return Opal.class_variables(self).hasOwnProperty(name);;
- }, $Module_class_variable_defined$ques$20.$$arity = 1);
-
- Opal.def(self, '$remove_class_variable', $Module_remove_class_variable$21 = function $$remove_class_variable(name) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$class_variable_name!'](name);
-
- if (Opal.hasOwnProperty.call(self.$$cvars, name)) {
- var value = self.$$cvars[name];
- delete self.$$cvars[name];
- return value;
- } else {
- self.$raise($$($nesting, 'NameError'), "" + "cannot remove " + (name) + " for " + (self))
- }
- ;
- }, $Module_remove_class_variable$21.$$arity = 1);
-
- Opal.def(self, '$constants', $Module_constants$22 = function $$constants(inherit) {
- var self = this;
-
-
-
- if (inherit == null) {
- inherit = true;
- };
- return Opal.constants(self, inherit);;
- }, $Module_constants$22.$$arity = -1);
- Opal.defs(self, '$constants', $Module_constants$23 = function $$constants(inherit) {
- var self = this;
-
-
- ;
-
- if (inherit == null) {
- var nesting = (self.$$nesting || []).concat(Opal.Object),
- constant, constants = {},
- i, ii;
-
- for(i = 0, ii = nesting.length; i < ii; i++) {
- for (constant in nesting[i].$$const) {
- constants[constant] = true;
- }
- }
- return Object.keys(constants);
- } else {
- return Opal.constants(self, inherit)
- }
- ;
- }, $Module_constants$23.$$arity = -1);
- Opal.defs(self, '$nesting', $Module_nesting$24 = function $$nesting() {
- var self = this;
-
- return self.$$nesting || [];
- }, $Module_nesting$24.$$arity = 0);
-
- Opal.def(self, '$const_defined?', $Module_const_defined$ques$25 = function(name, inherit) {
- var self = this;
-
-
-
- if (inherit == null) {
- inherit = true;
- };
- name = $$($nesting, 'Opal')['$const_name!'](name);
- if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) {
- } else {
- self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name))
- };
-
- var module, modules = [self], module_constants, i, ii;
-
- // Add up ancestors if inherit is true
- if (inherit) {
- modules = modules.concat(Opal.ancestors(self));
-
- // Add Object's ancestors if it's a module – modules have no ancestors otherwise
- if (self.$$is_module) {
- modules = modules.concat([Opal.Object]).concat(Opal.ancestors(Opal.Object));
- }
- }
-
- for (i = 0, ii = modules.length; i < ii; i++) {
- module = modules[i];
- if (module.$$const[name] != null) {
- return true;
- }
- }
-
- return false;
- ;
- }, $Module_const_defined$ques$25.$$arity = -2);
-
- Opal.def(self, '$const_get', $Module_const_get$26 = function $$const_get(name, inherit) {
- var $$27, self = this;
-
-
-
- if (inherit == null) {
- inherit = true;
- };
- name = $$($nesting, 'Opal')['$const_name!'](name);
-
- if (name.indexOf('::') === 0 && name !== '::'){
- name = name.slice(2);
- }
- ;
- if ($truthy(name.indexOf('::') != -1 && name != '::')) {
- return $send(name.$split("::"), 'inject', [self], ($$27 = function(o, c){var self = $$27.$$s || this;
-
-
-
- if (o == null) {
- o = nil;
- };
-
- if (c == null) {
- c = nil;
- };
- return o.$const_get(c);}, $$27.$$s = self, $$27.$$arity = 2, $$27))};
- if ($truthy(name['$=~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP')))) {
- } else {
- self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name))
- };
-
- if (inherit) {
- return $$([self], name);
- } else {
- return Opal.const_get_local(self, name);
- }
- ;
- }, $Module_const_get$26.$$arity = -2);
-
- Opal.def(self, '$const_missing', $Module_const_missing$28 = function $$const_missing(name) {
- var self = this, full_const_name = nil;
-
-
-
- if (self.$$autoload) {
- var file = self.$$autoload[name];
-
- if (file) {
- self.$require(file);
-
- return self.$const_get(name);
- }
- }
- ;
- full_const_name = (function() {if (self['$==']($$($nesting, 'Object'))) {
- return name
- } else {
- return "" + (self) + "::" + (name)
- }; return nil; })();
- return self.$raise($$($nesting, 'NameError').$new("" + "uninitialized constant " + (full_const_name), name));
- }, $Module_const_missing$28.$$arity = 1);
-
- Opal.def(self, '$const_set', $Module_const_set$29 = function $$const_set(name, value) {
- var $a, self = this;
-
-
- name = $$($nesting, 'Opal')['$const_name!'](name);
- if ($truthy(($truthy($a = name['$!~']($$$($$($nesting, 'Opal'), 'CONST_NAME_REGEXP'))) ? $a : name['$start_with?']("::")))) {
- self.$raise($$($nesting, 'NameError').$new("" + "wrong constant name " + (name), name))};
- Opal.const_set(self, name, value);
- return value;
- }, $Module_const_set$29.$$arity = 2);
-
- Opal.def(self, '$public_constant', $Module_public_constant$30 = function $$public_constant(const_name) {
- var self = this;
-
- return nil
- }, $Module_public_constant$30.$$arity = 1);
-
- Opal.def(self, '$define_method', $Module_define_method$31 = function $$define_method(name, method) {
- var $iter = $Module_define_method$31.$$p, block = $iter || nil, $a, $$32, self = this, $case = nil;
-
- if ($iter) $Module_define_method$31.$$p = null;
-
-
- if ($iter) $Module_define_method$31.$$p = null;;
- ;
- if ($truthy(method === undefined && block === nil)) {
- self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block")};
- block = ($truthy($a = block) ? $a : (function() {$case = method;
- if ($$($nesting, 'Proc')['$===']($case)) {return method}
- else if ($$($nesting, 'Method')['$===']($case)) {return method.$to_proc().$$unbound}
- else if ($$($nesting, 'UnboundMethod')['$===']($case)) {return $lambda(($$32 = function($b){var self = $$32.$$s || this, $post_args, args, bound = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- bound = method.$bind(self);
- return $send(bound, 'call', Opal.to_a(args));}, $$32.$$s = self, $$32.$$arity = -1, $$32))}
- else {return self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (block.$class()) + " (expected Proc/Method)")}})());
-
- var id = '$' + name;
-
- block.$$jsid = name;
- block.$$s = null;
- block.$$def = block;
- block.$$define_meth = true;
-
- Opal.defn(self, id, block);
-
- return name;
- ;
- }, $Module_define_method$31.$$arity = -2);
-
- Opal.def(self, '$remove_method', $Module_remove_method$33 = function $$remove_method($a) {
- var $post_args, names, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- names = $post_args;;
-
- for (var i = 0, length = names.length; i < length; i++) {
- Opal.rdef(self, "$" + names[i]);
- }
- ;
- return self;
- }, $Module_remove_method$33.$$arity = -1);
-
- Opal.def(self, '$singleton_class?', $Module_singleton_class$ques$34 = function() {
- var self = this;
-
- return !!self.$$is_singleton;
- }, $Module_singleton_class$ques$34.$$arity = 0);
-
- Opal.def(self, '$include', $Module_include$35 = function $$include($a) {
- var $post_args, mods, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- mods = $post_args;;
-
- for (var i = mods.length - 1; i >= 0; i--) {
- var mod = mods[i];
-
- if (!mod.$$is_module) {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)");
- }
-
- (mod).$append_features(self);
- (mod).$included(self);
- }
- ;
- return self;
- }, $Module_include$35.$$arity = -1);
-
- Opal.def(self, '$included_modules', $Module_included_modules$36 = function $$included_modules() {
- var self = this;
-
- return Opal.included_modules(self);
- }, $Module_included_modules$36.$$arity = 0);
-
- Opal.def(self, '$include?', $Module_include$ques$37 = function(mod) {
- var self = this;
-
-
- if (!mod.$$is_module) {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)");
- }
-
- var i, ii, mod2, ancestors = Opal.ancestors(self);
-
- for (i = 0, ii = ancestors.length; i < ii; i++) {
- mod2 = ancestors[i];
- if (mod2 === mod && mod2 !== self) {
- return true;
- }
- }
-
- return false;
-
- }, $Module_include$ques$37.$$arity = 1);
-
- Opal.def(self, '$instance_method', $Module_instance_method$38 = function $$instance_method(name) {
- var self = this;
-
-
- var meth = self.$$prototype['$' + name];
-
- if (!meth || meth.$$stub) {
- self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$name()) + "'", name));
- }
-
- return $$($nesting, 'UnboundMethod').$new(self, meth.$$owner || self, meth, name);
-
- }, $Module_instance_method$38.$$arity = 1);
-
- Opal.def(self, '$instance_methods', $Module_instance_methods$39 = function $$instance_methods(include_super) {
- var self = this;
-
-
-
- if (include_super == null) {
- include_super = true;
- };
-
- if ($truthy(include_super)) {
- return Opal.instance_methods(self);
- } else {
- return Opal.own_instance_methods(self);
- }
- ;
- }, $Module_instance_methods$39.$$arity = -1);
-
- Opal.def(self, '$included', $Module_included$40 = function $$included(mod) {
- var self = this;
-
- return nil
- }, $Module_included$40.$$arity = 1);
-
- Opal.def(self, '$extended', $Module_extended$41 = function $$extended(mod) {
- var self = this;
-
- return nil
- }, $Module_extended$41.$$arity = 1);
-
- Opal.def(self, '$extend_object', $Module_extend_object$42 = function $$extend_object(object) {
- var self = this;
-
- return nil
- }, $Module_extend_object$42.$$arity = 1);
-
- Opal.def(self, '$method_added', $Module_method_added$43 = function $$method_added($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $Module_method_added$43.$$arity = -1);
-
- Opal.def(self, '$method_removed', $Module_method_removed$44 = function $$method_removed($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $Module_method_removed$44.$$arity = -1);
-
- Opal.def(self, '$method_undefined', $Module_method_undefined$45 = function $$method_undefined($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $Module_method_undefined$45.$$arity = -1);
-
- Opal.def(self, '$module_eval', $Module_module_eval$46 = function $$module_eval($a) {
- var $iter = $Module_module_eval$46.$$p, block = $iter || nil, $post_args, args, $b, $$47, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil;
-
- if ($iter) $Module_module_eval$46.$$p = null;
-
-
- if ($iter) $Module_module_eval$46.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) {
-
- if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) {
- } else {
- $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)")
- };
- $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b;
- default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true});
- compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options);
- compiled = $$($nesting, 'Opal').$compile(string, compiling_options);
- block = $send($$($nesting, 'Kernel'), 'proc', [], ($$47 = function(){var self = $$47.$$s || this;
-
-
- return (function(self) {
- return eval(compiled);
- })(self)
- }, $$47.$$s = self, $$47.$$arity = 0, $$47));
- } else if ($truthy(args['$any?']())) {
- $$($nesting, 'Kernel').$raise($$($nesting, 'ArgumentError'), "" + ("" + "wrong number of arguments (" + (args.$size()) + " for 0)") + "\n\n NOTE:If you want to enable passing a String argument please add \"require 'opal-parser'\" to your script\n")};
-
- var old = block.$$s,
- result;
-
- block.$$s = null;
- result = block.apply(self, [self]);
- block.$$s = old;
-
- return result;
- ;
- }, $Module_module_eval$46.$$arity = -1);
- Opal.alias(self, "class_eval", "module_eval");
-
- Opal.def(self, '$module_exec', $Module_module_exec$48 = function $$module_exec($a) {
- var $iter = $Module_module_exec$48.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $Module_module_exec$48.$$p = null;
-
-
- if ($iter) $Module_module_exec$48.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- if (block === nil) {
- self.$raise($$($nesting, 'LocalJumpError'), "no block given")
- }
-
- var block_self = block.$$s, result;
-
- block.$$s = null;
- result = block.apply(self, args);
- block.$$s = block_self;
-
- return result;
- ;
- }, $Module_module_exec$48.$$arity = -1);
- Opal.alias(self, "class_exec", "module_exec");
-
- Opal.def(self, '$method_defined?', $Module_method_defined$ques$49 = function(method) {
- var self = this;
-
-
- var body = self.$$prototype['$' + method];
- return (!!body) && !body.$$stub;
-
- }, $Module_method_defined$ques$49.$$arity = 1);
-
- Opal.def(self, '$module_function', $Module_module_function$50 = function $$module_function($a) {
- var $post_args, methods, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- methods = $post_args;;
-
- if (methods.length === 0) {
- self.$$module_function = true;
- }
- else {
- for (var i = 0, length = methods.length; i < length; i++) {
- var meth = methods[i],
- id = '$' + meth,
- func = self.$$prototype[id];
-
- Opal.defs(self, id, func);
- }
- }
-
- return self;
- ;
- }, $Module_module_function$50.$$arity = -1);
-
- Opal.def(self, '$name', $Module_name$51 = function $$name() {
- var self = this;
-
-
- if (self.$$full_name) {
- return self.$$full_name;
- }
-
- var result = [], base = self;
-
- while (base) {
- // Give up if any of the ancestors is unnamed
- if (base.$$name === nil || base.$$name == null) return nil;
-
- result.unshift(base.$$name);
-
- base = base.$$base_module;
-
- if (base === Opal.Object) {
- break;
- }
- }
-
- if (result.length === 0) {
- return nil;
- }
-
- return self.$$full_name = result.join('::');
-
- }, $Module_name$51.$$arity = 0);
-
- Opal.def(self, '$prepend', $Module_prepend$52 = function $$prepend($a) {
- var $post_args, mods, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- mods = $post_args;;
-
- if (mods.length === 0) {
- self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (given 0, expected 1+)")
- }
-
- for (var i = mods.length - 1; i >= 0; i--) {
- var mod = mods[i];
-
- if (!mod.$$is_module) {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)");
- }
-
- (mod).$prepend_features(self);
- (mod).$prepended(self);
- }
- ;
- return self;
- }, $Module_prepend$52.$$arity = -1);
-
- Opal.def(self, '$prepend_features', $Module_prepend_features$53 = function $$prepend_features(prepender) {
- var self = this;
-
-
-
- if (!self.$$is_module) {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (self.$class()) + " (expected Module)");
- }
-
- Opal.prepend_features(self, prepender)
- ;
- return self;
- }, $Module_prepend_features$53.$$arity = 1);
-
- Opal.def(self, '$prepended', $Module_prepended$54 = function $$prepended(mod) {
- var self = this;
-
- return nil
- }, $Module_prepended$54.$$arity = 1);
-
- Opal.def(self, '$remove_const', $Module_remove_const$55 = function $$remove_const(name) {
- var self = this;
-
- return Opal.const_remove(self, name);
- }, $Module_remove_const$55.$$arity = 1);
-
- Opal.def(self, '$to_s', $Module_to_s$56 = function $$to_s() {
- var $a, self = this;
-
- return ($truthy($a = Opal.Module.$name.call(self)) ? $a : "" + "#<" + (self.$$is_module ? 'Module' : 'Class') + ":0x" + (self.$__id__().$to_s(16)) + ">")
- }, $Module_to_s$56.$$arity = 0);
-
- Opal.def(self, '$undef_method', $Module_undef_method$57 = function $$undef_method($a) {
- var $post_args, names, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- names = $post_args;;
-
- for (var i = 0, length = names.length; i < length; i++) {
- Opal.udef(self, "$" + names[i]);
- }
- ;
- return self;
- }, $Module_undef_method$57.$$arity = -1);
-
- Opal.def(self, '$instance_variables', $Module_instance_variables$58 = function $$instance_variables() {
- var self = this, consts = nil;
-
-
- consts = (Opal.Module.$$nesting = $nesting, self.$constants());
-
- var result = [];
-
- for (var name in self) {
- if (self.hasOwnProperty(name) && name.charAt(0) !== '$' && name !== 'constructor' && !consts['$include?'](name)) {
- result.push('@' + name);
- }
- }
-
- return result;
- ;
- }, $Module_instance_variables$58.$$arity = 0);
-
- Opal.def(self, '$dup', $Module_dup$59 = function $$dup() {
- var $iter = $Module_dup$59.$$p, $yield = $iter || nil, self = this, copy = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Module_dup$59.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
- copy = $send(self, Opal.find_super_dispatcher(self, 'dup', $Module_dup$59, false), $zuper, $iter);
- copy.$copy_class_variables(self);
- copy.$copy_constants(self);
- return copy;
- }, $Module_dup$59.$$arity = 0);
-
- Opal.def(self, '$copy_class_variables', $Module_copy_class_variables$60 = function $$copy_class_variables(other) {
- var self = this;
-
-
- for (var name in other.$$cvars) {
- self.$$cvars[name] = other.$$cvars[name];
- }
-
- }, $Module_copy_class_variables$60.$$arity = 1);
- return (Opal.def(self, '$copy_constants', $Module_copy_constants$61 = function $$copy_constants(other) {
- var self = this;
-
-
- var name, other_constants = other.$$const;
-
- for (name in other_constants) {
- Opal.const_set(self, name, other_constants[name]);
- }
-
- }, $Module_copy_constants$61.$$arity = 1), nil) && 'copy_constants';
- })($nesting[0], null, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/class"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send;
-
- Opal.add_stubs(['$require', '$class_eval', '$to_proc', '$initialize_copy', '$allocate', '$name', '$to_s']);
-
- self.$require("corelib/module");
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Class');
-
- var $nesting = [self].concat($parent_nesting), $Class_new$1, $Class_allocate$2, $Class_inherited$3, $Class_initialize_dup$4, $Class_new$5, $Class_superclass$6, $Class_to_s$7;
-
-
- Opal.defs(self, '$new', $Class_new$1 = function(superclass) {
- var $iter = $Class_new$1.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Class_new$1.$$p = null;
-
-
- if ($iter) $Class_new$1.$$p = null;;
-
- if (superclass == null) {
- superclass = $$($nesting, 'Object');
- };
-
- if (!superclass.$$is_class) {
- throw Opal.TypeError.$new("superclass must be a Class");
- }
-
- var klass = Opal.allocate_class(nil, superclass);
- superclass.$inherited(klass);
- (function() {if ((block !== nil)) {
- return $send((klass), 'class_eval', [], block.$to_proc())
- } else {
- return nil
- }; return nil; })()
- return klass;
- ;
- }, $Class_new$1.$$arity = -1);
-
- Opal.def(self, '$allocate', $Class_allocate$2 = function $$allocate() {
- var self = this;
-
-
- var obj = new self.$$constructor();
- obj.$$id = Opal.uid();
- return obj;
-
- }, $Class_allocate$2.$$arity = 0);
-
- Opal.def(self, '$inherited', $Class_inherited$3 = function $$inherited(cls) {
- var self = this;
-
- return nil
- }, $Class_inherited$3.$$arity = 1);
-
- Opal.def(self, '$initialize_dup', $Class_initialize_dup$4 = function $$initialize_dup(original) {
- var self = this;
-
-
- self.$initialize_copy(original);
-
- self.$$name = null;
- self.$$full_name = null;
- ;
- }, $Class_initialize_dup$4.$$arity = 1);
-
- Opal.def(self, '$new', $Class_new$5 = function($a) {
- var $iter = $Class_new$5.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $Class_new$5.$$p = null;
-
-
- if ($iter) $Class_new$5.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- var object = self.$allocate();
- Opal.send(object, object.$initialize, args, block);
- return object;
- ;
- }, $Class_new$5.$$arity = -1);
-
- Opal.def(self, '$superclass', $Class_superclass$6 = function $$superclass() {
- var self = this;
-
- return self.$$super || nil;
- }, $Class_superclass$6.$$arity = 0);
- return (Opal.def(self, '$to_s', $Class_to_s$7 = function $$to_s() {
- var $iter = $Class_to_s$7.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $Class_to_s$7.$$p = null;
-
- var singleton_of = self.$$singleton_of;
-
- if (singleton_of && (singleton_of.$$is_a_module)) {
- return "" + "#";
- }
- else if (singleton_of) {
- // a singleton class created from an object
- return "" + "#>";
- }
- return $send(self, Opal.find_super_dispatcher(self, 'to_s', $Class_to_s$7, false), [], null);
-
- }, $Class_to_s$7.$$arity = 0), nil) && 'to_s';
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/basic_object"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $hash2 = Opal.hash2, $send = Opal.send;
-
- Opal.add_stubs(['$==', '$!', '$nil?', '$cover?', '$size', '$raise', '$merge', '$compile', '$proc', '$any?', '$inspect', '$new']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'BasicObject');
-
- var $nesting = [self].concat($parent_nesting), $BasicObject_initialize$1, $BasicObject_$eq_eq$2, $BasicObject_eql$ques$3, $BasicObject___id__$4, $BasicObject___send__$5, $BasicObject_$excl$6, $BasicObject_$not_eq$7, $BasicObject_instance_eval$8, $BasicObject_instance_exec$10, $BasicObject_singleton_method_added$11, $BasicObject_singleton_method_removed$12, $BasicObject_singleton_method_undefined$13, $BasicObject_class$14, $BasicObject_method_missing$15;
-
-
-
- Opal.def(self, '$initialize', $BasicObject_initialize$1 = function $$initialize($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $BasicObject_initialize$1.$$arity = -1);
-
- Opal.def(self, '$==', $BasicObject_$eq_eq$2 = function(other) {
- var self = this;
-
- return self === other;
- }, $BasicObject_$eq_eq$2.$$arity = 1);
-
- Opal.def(self, '$eql?', $BasicObject_eql$ques$3 = function(other) {
- var self = this;
-
- return self['$=='](other)
- }, $BasicObject_eql$ques$3.$$arity = 1);
- Opal.alias(self, "equal?", "==");
-
- Opal.def(self, '$__id__', $BasicObject___id__$4 = function $$__id__() {
- var self = this;
-
-
- if (self.$$id != null) {
- return self.$$id;
- }
- Opal.defineProperty(self, '$$id', Opal.uid());
- return self.$$id;
-
- }, $BasicObject___id__$4.$$arity = 0);
-
- Opal.def(self, '$__send__', $BasicObject___send__$5 = function $$__send__(symbol, $a) {
- var $iter = $BasicObject___send__$5.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $BasicObject___send__$5.$$p = null;
-
-
- if ($iter) $BasicObject___send__$5.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
-
- var func = self['$' + symbol]
-
- if (func) {
- if (block !== nil) {
- func.$$p = block;
- }
-
- return func.apply(self, args);
- }
-
- if (block !== nil) {
- self.$method_missing.$$p = block;
- }
-
- return self.$method_missing.apply(self, [symbol].concat(args));
- ;
- }, $BasicObject___send__$5.$$arity = -2);
-
- Opal.def(self, '$!', $BasicObject_$excl$6 = function() {
- var self = this;
-
- return false
- }, $BasicObject_$excl$6.$$arity = 0);
-
- Opal.def(self, '$!=', $BasicObject_$not_eq$7 = function(other) {
- var self = this;
-
- return self['$=='](other)['$!']()
- }, $BasicObject_$not_eq$7.$$arity = 1);
-
- Opal.def(self, '$instance_eval', $BasicObject_instance_eval$8 = function $$instance_eval($a) {
- var $iter = $BasicObject_instance_eval$8.$$p, block = $iter || nil, $post_args, args, $b, $$9, self = this, string = nil, file = nil, _lineno = nil, default_eval_options = nil, compiling_options = nil, compiled = nil;
-
- if ($iter) $BasicObject_instance_eval$8.$$p = null;
-
-
- if ($iter) $BasicObject_instance_eval$8.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy(($truthy($b = block['$nil?']()) ? !!Opal.compile : $b))) {
-
- if ($truthy($range(1, 3, false)['$cover?'](args.$size()))) {
- } else {
- $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "wrong number of arguments (0 for 1..3)")
- };
- $b = [].concat(Opal.to_a(args)), (string = ($b[0] == null ? nil : $b[0])), (file = ($b[1] == null ? nil : $b[1])), (_lineno = ($b[2] == null ? nil : $b[2])), $b;
- default_eval_options = $hash2(["file", "eval"], {"file": ($truthy($b = file) ? $b : "(eval)"), "eval": true});
- compiling_options = Opal.hash({ arity_check: false }).$merge(default_eval_options);
- compiled = $$$('::', 'Opal').$compile(string, compiling_options);
- block = $send($$$('::', 'Kernel'), 'proc', [], ($$9 = function(){var self = $$9.$$s || this;
-
-
- return (function(self) {
- return eval(compiled);
- })(self)
- }, $$9.$$s = self, $$9.$$arity = 0, $$9));
- } else if ($truthy(args['$any?']())) {
- $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "" + "wrong number of arguments (" + (args.$size()) + " for 0)")};
-
- var old = block.$$s,
- result;
-
- block.$$s = null;
-
- // Need to pass $$eval so that method definitions know if this is
- // being done on a class/module. Cannot be compiler driven since
- // send(:instance_eval) needs to work.
- if (self.$$is_a_module) {
- self.$$eval = true;
- try {
- result = block.call(self, self);
- }
- finally {
- self.$$eval = false;
- }
- }
- else {
- result = block.call(self, self);
- }
-
- block.$$s = old;
-
- return result;
- ;
- }, $BasicObject_instance_eval$8.$$arity = -1);
-
- Opal.def(self, '$instance_exec', $BasicObject_instance_exec$10 = function $$instance_exec($a) {
- var $iter = $BasicObject_instance_exec$10.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $BasicObject_instance_exec$10.$$p = null;
-
-
- if ($iter) $BasicObject_instance_exec$10.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy(block)) {
- } else {
- $$$('::', 'Kernel').$raise($$$('::', 'ArgumentError'), "no block given")
- };
-
- var block_self = block.$$s,
- result;
-
- block.$$s = null;
-
- if (self.$$is_a_module) {
- self.$$eval = true;
- try {
- result = block.apply(self, args);
- }
- finally {
- self.$$eval = false;
- }
- }
- else {
- result = block.apply(self, args);
- }
-
- block.$$s = block_self;
-
- return result;
- ;
- }, $BasicObject_instance_exec$10.$$arity = -1);
-
- Opal.def(self, '$singleton_method_added', $BasicObject_singleton_method_added$11 = function $$singleton_method_added($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $BasicObject_singleton_method_added$11.$$arity = -1);
-
- Opal.def(self, '$singleton_method_removed', $BasicObject_singleton_method_removed$12 = function $$singleton_method_removed($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $BasicObject_singleton_method_removed$12.$$arity = -1);
-
- Opal.def(self, '$singleton_method_undefined', $BasicObject_singleton_method_undefined$13 = function $$singleton_method_undefined($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $BasicObject_singleton_method_undefined$13.$$arity = -1);
-
- Opal.def(self, '$class', $BasicObject_class$14 = function() {
- var self = this;
-
- return self.$$class;
- }, $BasicObject_class$14.$$arity = 0);
- return (Opal.def(self, '$method_missing', $BasicObject_method_missing$15 = function $$method_missing(symbol, $a) {
- var $iter = $BasicObject_method_missing$15.$$p, block = $iter || nil, $post_args, args, self = this, message = nil;
-
- if ($iter) $BasicObject_method_missing$15.$$p = null;
-
-
- if ($iter) $BasicObject_method_missing$15.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
- message = (function() {if ($truthy(self.$inspect && !self.$inspect.$$stub)) {
- return "" + "undefined method `" + (symbol) + "' for " + (self.$inspect()) + ":" + (self.$$class)
- } else {
- return "" + "undefined method `" + (symbol) + "' for " + (self.$$class)
- }; return nil; })();
- return $$$('::', 'Kernel').$raise($$$('::', 'NoMethodError').$new(message, symbol));
- }, $BasicObject_method_missing$15.$$arity = -2), nil) && 'method_missing';
- })($nesting[0], null, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/kernel"] = function(Opal) {
- function $rb_le(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, $truthy = Opal.truthy, $gvars = Opal.gvars, $hash2 = Opal.hash2, $send = Opal.send, $klass = Opal.klass;
-
- Opal.add_stubs(['$raise', '$new', '$inspect', '$!', '$=~', '$==', '$object_id', '$class', '$coerce_to?', '$<<', '$allocate', '$copy_instance_variables', '$copy_singleton_methods', '$initialize_clone', '$initialize_copy', '$define_method', '$singleton_class', '$to_proc', '$initialize_dup', '$for', '$empty?', '$pop', '$call', '$coerce_to', '$append_features', '$extend_object', '$extended', '$__id__', '$to_s', '$instance_variable_name!', '$respond_to?', '$to_int', '$coerce_to!', '$Integer', '$nil?', '$===', '$enum_for', '$result', '$any?', '$print', '$format', '$puts', '$each', '$<=', '$length', '$[]', '$exception', '$is_a?', '$rand', '$respond_to_missing?', '$try_convert!', '$expand_path', '$join', '$start_with?', '$new_seed', '$srand', '$sym', '$arg', '$open', '$include']);
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'Kernel');
-
- var $nesting = [self].concat($parent_nesting), $Kernel_method_missing$1, $Kernel_$eq_tilde$2, $Kernel_$excl_tilde$3, $Kernel_$eq_eq_eq$4, $Kernel_$lt_eq_gt$5, $Kernel_method$6, $Kernel_methods$7, $Kernel_public_methods$8, $Kernel_Array$9, $Kernel_at_exit$10, $Kernel_caller$11, $Kernel_class$12, $Kernel_copy_instance_variables$13, $Kernel_copy_singleton_methods$14, $Kernel_clone$15, $Kernel_initialize_clone$16, $Kernel_define_singleton_method$17, $Kernel_dup$18, $Kernel_initialize_dup$19, $Kernel_enum_for$20, $Kernel_equal$ques$21, $Kernel_exit$22, $Kernel_extend$23, $Kernel_hash$24, $Kernel_initialize_copy$25, $Kernel_inspect$26, $Kernel_instance_of$ques$27, $Kernel_instance_variable_defined$ques$28, $Kernel_instance_variable_get$29, $Kernel_instance_variable_set$30, $Kernel_remove_instance_variable$31, $Kernel_instance_variables$32, $Kernel_Integer$33, $Kernel_Float$34, $Kernel_Hash$35, $Kernel_is_a$ques$36, $Kernel_itself$37, $Kernel_lambda$38, $Kernel_load$39, $Kernel_loop$40, $Kernel_nil$ques$42, $Kernel_printf$43, $Kernel_proc$44, $Kernel_puts$45, $Kernel_p$46, $Kernel_print$48, $Kernel_warn$49, $Kernel_raise$50, $Kernel_rand$51, $Kernel_respond_to$ques$52, $Kernel_respond_to_missing$ques$53, $Kernel_require$54, $Kernel_require_relative$55, $Kernel_require_tree$56, $Kernel_singleton_class$57, $Kernel_sleep$58, $Kernel_srand$59, $Kernel_String$60, $Kernel_tap$61, $Kernel_to_proc$62, $Kernel_to_s$63, $Kernel_catch$64, $Kernel_throw$65, $Kernel_open$66, $Kernel_yield_self$67;
-
-
-
- Opal.def(self, '$method_missing', $Kernel_method_missing$1 = function $$method_missing(symbol, $a) {
- var $iter = $Kernel_method_missing$1.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $Kernel_method_missing$1.$$p = null;
-
-
- if ($iter) $Kernel_method_missing$1.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
- return self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `" + (symbol) + "' for " + (self.$inspect()), symbol, args));
- }, $Kernel_method_missing$1.$$arity = -2);
-
- Opal.def(self, '$=~', $Kernel_$eq_tilde$2 = function(obj) {
- var self = this;
-
- return false
- }, $Kernel_$eq_tilde$2.$$arity = 1);
-
- Opal.def(self, '$!~', $Kernel_$excl_tilde$3 = function(obj) {
- var self = this;
-
- return self['$=~'](obj)['$!']()
- }, $Kernel_$excl_tilde$3.$$arity = 1);
-
- Opal.def(self, '$===', $Kernel_$eq_eq_eq$4 = function(other) {
- var $a, self = this;
-
- return ($truthy($a = self.$object_id()['$=='](other.$object_id())) ? $a : self['$=='](other))
- }, $Kernel_$eq_eq_eq$4.$$arity = 1);
-
- Opal.def(self, '$<=>', $Kernel_$lt_eq_gt$5 = function(other) {
- var self = this;
-
-
- // set guard for infinite recursion
- self.$$comparable = true;
-
- var x = self['$=='](other);
-
- if (x && x !== nil) {
- return 0;
- }
-
- return nil;
-
- }, $Kernel_$lt_eq_gt$5.$$arity = 1);
-
- Opal.def(self, '$method', $Kernel_method$6 = function $$method(name) {
- var self = this;
-
-
- var meth = self['$' + name];
-
- if (!meth || meth.$$stub) {
- self.$raise($$($nesting, 'NameError').$new("" + "undefined method `" + (name) + "' for class `" + (self.$class()) + "'", name));
- }
-
- return $$($nesting, 'Method').$new(self, meth.$$owner || self.$class(), meth, name);
-
- }, $Kernel_method$6.$$arity = 1);
-
- Opal.def(self, '$methods', $Kernel_methods$7 = function $$methods(all) {
- var self = this;
-
-
-
- if (all == null) {
- all = true;
- };
-
- if ($truthy(all)) {
- return Opal.methods(self);
- } else {
- return Opal.own_methods(self);
- }
- ;
- }, $Kernel_methods$7.$$arity = -1);
-
- Opal.def(self, '$public_methods', $Kernel_public_methods$8 = function $$public_methods(all) {
- var self = this;
-
-
-
- if (all == null) {
- all = true;
- };
-
- if ($truthy(all)) {
- return Opal.methods(self);
- } else {
- return Opal.receiver_methods(self);
- }
- ;
- }, $Kernel_public_methods$8.$$arity = -1);
-
- Opal.def(self, '$Array', $Kernel_Array$9 = function $$Array(object) {
- var self = this;
-
-
- var coerced;
-
- if (object === nil) {
- return [];
- }
-
- if (object.$$is_array) {
- return object;
- }
-
- coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_ary");
- if (coerced !== nil) { return coerced; }
-
- coerced = $$($nesting, 'Opal')['$coerce_to?'](object, $$($nesting, 'Array'), "to_a");
- if (coerced !== nil) { return coerced; }
-
- return [object];
-
- }, $Kernel_Array$9.$$arity = 1);
-
- Opal.def(self, '$at_exit', $Kernel_at_exit$10 = function $$at_exit() {
- var $iter = $Kernel_at_exit$10.$$p, block = $iter || nil, $a, self = this;
- if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil;
-
- if ($iter) $Kernel_at_exit$10.$$p = null;
-
-
- if ($iter) $Kernel_at_exit$10.$$p = null;;
- $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []);
- return $gvars.__at_exit__['$<<'](block);
- }, $Kernel_at_exit$10.$$arity = 0);
-
- Opal.def(self, '$caller', $Kernel_caller$11 = function $$caller($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return [];
- }, $Kernel_caller$11.$$arity = -1);
-
- Opal.def(self, '$class', $Kernel_class$12 = function() {
- var self = this;
-
- return self.$$class;
- }, $Kernel_class$12.$$arity = 0);
-
- Opal.def(self, '$copy_instance_variables', $Kernel_copy_instance_variables$13 = function $$copy_instance_variables(other) {
- var self = this;
-
-
- var keys = Object.keys(other), i, ii, name;
- for (i = 0, ii = keys.length; i < ii; i++) {
- name = keys[i];
- if (name.charAt(0) !== '$' && other.hasOwnProperty(name)) {
- self[name] = other[name];
- }
- }
-
- }, $Kernel_copy_instance_variables$13.$$arity = 1);
-
- Opal.def(self, '$copy_singleton_methods', $Kernel_copy_singleton_methods$14 = function $$copy_singleton_methods(other) {
- var self = this;
-
-
- var i, name, names, length;
-
- if (other.hasOwnProperty('$$meta')) {
- var other_singleton_class = Opal.get_singleton_class(other);
- var self_singleton_class = Opal.get_singleton_class(self);
- names = Object.getOwnPropertyNames(other_singleton_class.$$prototype);
-
- for (i = 0, length = names.length; i < length; i++) {
- name = names[i];
- if (Opal.is_method(name)) {
- self_singleton_class.$$prototype[name] = other_singleton_class.$$prototype[name];
- }
- }
-
- self_singleton_class.$$const = Object.assign({}, other_singleton_class.$$const);
- Object.setPrototypeOf(
- self_singleton_class.$$prototype,
- Object.getPrototypeOf(other_singleton_class.$$prototype)
- );
- }
-
- for (i = 0, names = Object.getOwnPropertyNames(other), length = names.length; i < length; i++) {
- name = names[i];
- if (name.charAt(0) === '$' && name.charAt(1) !== '$' && other.hasOwnProperty(name)) {
- self[name] = other[name];
- }
- }
-
- }, $Kernel_copy_singleton_methods$14.$$arity = 1);
-
- Opal.def(self, '$clone', $Kernel_clone$15 = function $$clone($kwargs) {
- var freeze, self = this, copy = nil;
-
-
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- freeze = $kwargs.$$smap["freeze"];
- if (freeze == null) {
- freeze = true
- };
- copy = self.$class().$allocate();
- copy.$copy_instance_variables(self);
- copy.$copy_singleton_methods(self);
- copy.$initialize_clone(self);
- return copy;
- }, $Kernel_clone$15.$$arity = -1);
-
- Opal.def(self, '$initialize_clone', $Kernel_initialize_clone$16 = function $$initialize_clone(other) {
- var self = this;
-
- return self.$initialize_copy(other)
- }, $Kernel_initialize_clone$16.$$arity = 1);
-
- Opal.def(self, '$define_singleton_method', $Kernel_define_singleton_method$17 = function $$define_singleton_method(name, method) {
- var $iter = $Kernel_define_singleton_method$17.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Kernel_define_singleton_method$17.$$p = null;
-
-
- if ($iter) $Kernel_define_singleton_method$17.$$p = null;;
- ;
- return $send(self.$singleton_class(), 'define_method', [name, method], block.$to_proc());
- }, $Kernel_define_singleton_method$17.$$arity = -2);
-
- Opal.def(self, '$dup', $Kernel_dup$18 = function $$dup() {
- var self = this, copy = nil;
-
-
- copy = self.$class().$allocate();
- copy.$copy_instance_variables(self);
- copy.$initialize_dup(self);
- return copy;
- }, $Kernel_dup$18.$$arity = 0);
-
- Opal.def(self, '$initialize_dup', $Kernel_initialize_dup$19 = function $$initialize_dup(other) {
- var self = this;
-
- return self.$initialize_copy(other)
- }, $Kernel_initialize_dup$19.$$arity = 1);
-
- Opal.def(self, '$enum_for', $Kernel_enum_for$20 = function $$enum_for($a, $b) {
- var $iter = $Kernel_enum_for$20.$$p, block = $iter || nil, $post_args, method, args, self = this;
-
- if ($iter) $Kernel_enum_for$20.$$p = null;
-
-
- if ($iter) $Kernel_enum_for$20.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- if ($post_args.length > 0) {
- method = $post_args[0];
- $post_args.splice(0, 1);
- }
- if (method == null) {
- method = "each";
- };
-
- args = $post_args;;
- return $send($$($nesting, 'Enumerator'), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc());
- }, $Kernel_enum_for$20.$$arity = -1);
- Opal.alias(self, "to_enum", "enum_for");
-
- Opal.def(self, '$equal?', $Kernel_equal$ques$21 = function(other) {
- var self = this;
-
- return self === other;
- }, $Kernel_equal$ques$21.$$arity = 1);
-
- Opal.def(self, '$exit', $Kernel_exit$22 = function $$exit(status) {
- var $a, self = this, block = nil;
- if ($gvars.__at_exit__ == null) $gvars.__at_exit__ = nil;
-
-
-
- if (status == null) {
- status = true;
- };
- $gvars.__at_exit__ = ($truthy($a = $gvars.__at_exit__) ? $a : []);
- while (!($truthy($gvars.__at_exit__['$empty?']()))) {
-
- block = $gvars.__at_exit__.$pop();
- block.$call();
- };
-
- if (status.$$is_boolean) {
- status = status ? 0 : 1;
- } else {
- status = $$($nesting, 'Opal').$coerce_to(status, $$($nesting, 'Integer'), "to_int")
- }
-
- Opal.exit(status);
- ;
- return nil;
- }, $Kernel_exit$22.$$arity = -1);
-
- Opal.def(self, '$extend', $Kernel_extend$23 = function $$extend($a) {
- var $post_args, mods, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- mods = $post_args;;
-
- var singleton = self.$singleton_class();
-
- for (var i = mods.length - 1; i >= 0; i--) {
- var mod = mods[i];
-
- if (!mod.$$is_module) {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((mod).$class()) + " (expected Module)");
- }
-
- (mod).$append_features(singleton);
- (mod).$extend_object(self);
- (mod).$extended(self);
- }
- ;
- return self;
- }, $Kernel_extend$23.$$arity = -1);
-
- Opal.def(self, '$hash', $Kernel_hash$24 = function $$hash() {
- var self = this;
-
- return self.$__id__()
- }, $Kernel_hash$24.$$arity = 0);
-
- Opal.def(self, '$initialize_copy', $Kernel_initialize_copy$25 = function $$initialize_copy(other) {
- var self = this;
-
- return nil
- }, $Kernel_initialize_copy$25.$$arity = 1);
-
- Opal.def(self, '$inspect', $Kernel_inspect$26 = function $$inspect() {
- var self = this;
-
- return self.$to_s()
- }, $Kernel_inspect$26.$$arity = 0);
-
- Opal.def(self, '$instance_of?', $Kernel_instance_of$ques$27 = function(klass) {
- var self = this;
-
-
- if (!klass.$$is_class && !klass.$$is_module) {
- self.$raise($$($nesting, 'TypeError'), "class or module required");
- }
-
- return self.$$class === klass;
-
- }, $Kernel_instance_of$ques$27.$$arity = 1);
-
- Opal.def(self, '$instance_variable_defined?', $Kernel_instance_variable_defined$ques$28 = function(name) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$instance_variable_name!'](name);
- return Opal.hasOwnProperty.call(self, name.substr(1));;
- }, $Kernel_instance_variable_defined$ques$28.$$arity = 1);
-
- Opal.def(self, '$instance_variable_get', $Kernel_instance_variable_get$29 = function $$instance_variable_get(name) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$instance_variable_name!'](name);
-
- var ivar = self[Opal.ivar(name.substr(1))];
-
- return ivar == null ? nil : ivar;
- ;
- }, $Kernel_instance_variable_get$29.$$arity = 1);
-
- Opal.def(self, '$instance_variable_set', $Kernel_instance_variable_set$30 = function $$instance_variable_set(name, value) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$instance_variable_name!'](name);
- return self[Opal.ivar(name.substr(1))] = value;;
- }, $Kernel_instance_variable_set$30.$$arity = 2);
-
- Opal.def(self, '$remove_instance_variable', $Kernel_remove_instance_variable$31 = function $$remove_instance_variable(name) {
- var self = this;
-
-
- name = $$($nesting, 'Opal')['$instance_variable_name!'](name);
-
- var key = Opal.ivar(name.substr(1)),
- val;
- if (self.hasOwnProperty(key)) {
- val = self[key];
- delete self[key];
- return val;
- }
- ;
- return self.$raise($$($nesting, 'NameError'), "" + "instance variable " + (name) + " not defined");
- }, $Kernel_remove_instance_variable$31.$$arity = 1);
-
- Opal.def(self, '$instance_variables', $Kernel_instance_variables$32 = function $$instance_variables() {
- var self = this;
-
-
- var result = [], ivar;
-
- for (var name in self) {
- if (self.hasOwnProperty(name) && name.charAt(0) !== '$') {
- if (name.substr(-1) === '$') {
- ivar = name.slice(0, name.length - 1);
- } else {
- ivar = name;
- }
- result.push('@' + ivar);
- }
- }
-
- return result;
-
- }, $Kernel_instance_variables$32.$$arity = 0);
-
- Opal.def(self, '$Integer', $Kernel_Integer$33 = function $$Integer(value, base) {
- var self = this;
-
-
- ;
-
- var i, str, base_digits;
-
- if (!value.$$is_string) {
- if (base !== undefined) {
- self.$raise($$($nesting, 'ArgumentError'), "base specified for non string value")
- }
- if (value === nil) {
- self.$raise($$($nesting, 'TypeError'), "can't convert nil into Integer")
- }
- if (value.$$is_number) {
- if (value === Infinity || value === -Infinity || isNaN(value)) {
- self.$raise($$($nesting, 'FloatDomainError'), value)
- }
- return Math.floor(value);
- }
- if (value['$respond_to?']("to_int")) {
- i = value.$to_int();
- if (i !== nil) {
- return i;
- }
- }
- return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Integer'), "to_i");
- }
-
- if (value === "0") {
- return 0;
- }
-
- if (base === undefined) {
- base = 0;
- } else {
- base = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int");
- if (base === 1 || base < 0 || base > 36) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))
- }
- }
-
- str = value.toLowerCase();
-
- str = str.replace(/(\d)_(?=\d)/g, '$1');
-
- str = str.replace(/^(\s*[+-]?)(0[bodx]?)/, function (_, head, flag) {
- switch (flag) {
- case '0b':
- if (base === 0 || base === 2) {
- base = 2;
- return head;
- }
- case '0':
- case '0o':
- if (base === 0 || base === 8) {
- base = 8;
- return head;
- }
- case '0d':
- if (base === 0 || base === 10) {
- base = 10;
- return head;
- }
- case '0x':
- if (base === 0 || base === 16) {
- base = 16;
- return head;
- }
- }
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"")
- });
-
- base = (base === 0 ? 10 : base);
-
- base_digits = '0-' + (base <= 10 ? base - 1 : '9a-' + String.fromCharCode(97 + (base - 11)));
-
- if (!(new RegExp('^\\s*[+-]?[' + base_digits + ']+\\s*$')).test(str)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"")
- }
-
- i = parseInt(str, base);
-
- if (isNaN(i)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Integer(): \"" + (value) + "\"")
- }
-
- return i;
- ;
- }, $Kernel_Integer$33.$$arity = -2);
-
- Opal.def(self, '$Float', $Kernel_Float$34 = function $$Float(value) {
- var self = this;
-
-
- var str;
-
- if (value === nil) {
- self.$raise($$($nesting, 'TypeError'), "can't convert nil into Float")
- }
-
- if (value.$$is_string) {
- str = value.toString();
-
- str = str.replace(/(\d)_(?=\d)/g, '$1');
-
- //Special case for hex strings only:
- if (/^\s*[-+]?0[xX][0-9a-fA-F]+\s*$/.test(str)) {
- return self.$Integer(str);
- }
-
- if (!/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/.test(str)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid value for Float(): \"" + (value) + "\"")
- }
-
- return parseFloat(str);
- }
-
- return $$($nesting, 'Opal')['$coerce_to!'](value, $$($nesting, 'Float'), "to_f");
-
- }, $Kernel_Float$34.$$arity = 1);
-
- Opal.def(self, '$Hash', $Kernel_Hash$35 = function $$Hash(arg) {
- var $a, self = this;
-
-
- if ($truthy(($truthy($a = arg['$nil?']()) ? $a : arg['$==']([])))) {
- return $hash2([], {})};
- if ($truthy($$($nesting, 'Hash')['$==='](arg))) {
- return arg};
- return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'Hash'), "to_hash");
- }, $Kernel_Hash$35.$$arity = 1);
-
- Opal.def(self, '$is_a?', $Kernel_is_a$ques$36 = function(klass) {
- var self = this;
-
-
- if (!klass.$$is_class && !klass.$$is_module) {
- self.$raise($$($nesting, 'TypeError'), "class or module required");
- }
-
- return Opal.is_a(self, klass);
-
- }, $Kernel_is_a$ques$36.$$arity = 1);
-
- Opal.def(self, '$itself', $Kernel_itself$37 = function $$itself() {
- var self = this;
-
- return self
- }, $Kernel_itself$37.$$arity = 0);
- Opal.alias(self, "kind_of?", "is_a?");
-
- Opal.def(self, '$lambda', $Kernel_lambda$38 = function $$lambda() {
- var $iter = $Kernel_lambda$38.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Kernel_lambda$38.$$p = null;
-
-
- if ($iter) $Kernel_lambda$38.$$p = null;;
- return Opal.lambda(block);;
- }, $Kernel_lambda$38.$$arity = 0);
-
- Opal.def(self, '$load', $Kernel_load$39 = function $$load(file) {
- var self = this;
-
-
- file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str");
- return Opal.load(file);
- }, $Kernel_load$39.$$arity = 1);
-
- Opal.def(self, '$loop', $Kernel_loop$40 = function $$loop() {
- var $$41, $a, $iter = $Kernel_loop$40.$$p, $yield = $iter || nil, self = this, e = nil;
-
- if ($iter) $Kernel_loop$40.$$p = null;
-
- if (($yield !== nil)) {
- } else {
- return $send(self, 'enum_for', ["loop"], ($$41 = function(){var self = $$41.$$s || this;
-
- return $$$($$($nesting, 'Float'), 'INFINITY')}, $$41.$$s = self, $$41.$$arity = 0, $$41))
- };
- while ($truthy(true)) {
-
- try {
- Opal.yieldX($yield, [])
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StopIteration')])) {e = $err;
- try {
- return e.$result()
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- };
- return self;
- }, $Kernel_loop$40.$$arity = 0);
-
- Opal.def(self, '$nil?', $Kernel_nil$ques$42 = function() {
- var self = this;
-
- return false
- }, $Kernel_nil$ques$42.$$arity = 0);
- Opal.alias(self, "object_id", "__id__");
-
- Opal.def(self, '$printf', $Kernel_printf$43 = function $$printf($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy(args['$any?']())) {
- self.$print($send(self, 'format', Opal.to_a(args)))};
- return nil;
- }, $Kernel_printf$43.$$arity = -1);
-
- Opal.def(self, '$proc', $Kernel_proc$44 = function $$proc() {
- var $iter = $Kernel_proc$44.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Kernel_proc$44.$$p = null;
-
-
- if ($iter) $Kernel_proc$44.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to create Proc object without a block")
- };
- block.$$is_lambda = false;
- return block;
- }, $Kernel_proc$44.$$arity = 0);
-
- Opal.def(self, '$puts', $Kernel_puts$45 = function $$puts($a) {
- var $post_args, strs, self = this;
- if ($gvars.stdout == null) $gvars.stdout = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- strs = $post_args;;
- return $send($gvars.stdout, 'puts', Opal.to_a(strs));
- }, $Kernel_puts$45.$$arity = -1);
-
- Opal.def(self, '$p', $Kernel_p$46 = function $$p($a) {
- var $post_args, args, $$47, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- $send(args, 'each', [], ($$47 = function(obj){var self = $$47.$$s || this;
- if ($gvars.stdout == null) $gvars.stdout = nil;
-
-
-
- if (obj == null) {
- obj = nil;
- };
- return $gvars.stdout.$puts(obj.$inspect());}, $$47.$$s = self, $$47.$$arity = 1, $$47));
- if ($truthy($rb_le(args.$length(), 1))) {
- return args['$[]'](0)
- } else {
- return args
- };
- }, $Kernel_p$46.$$arity = -1);
-
- Opal.def(self, '$print', $Kernel_print$48 = function $$print($a) {
- var $post_args, strs, self = this;
- if ($gvars.stdout == null) $gvars.stdout = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- strs = $post_args;;
- return $send($gvars.stdout, 'print', Opal.to_a(strs));
- }, $Kernel_print$48.$$arity = -1);
-
- Opal.def(self, '$warn', $Kernel_warn$49 = function $$warn($a) {
- var $post_args, strs, $b, self = this;
- if ($gvars.VERBOSE == null) $gvars.VERBOSE = nil;
- if ($gvars.stderr == null) $gvars.stderr = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- strs = $post_args;;
- if ($truthy(($truthy($b = $gvars.VERBOSE['$nil?']()) ? $b : strs['$empty?']()))) {
- return nil
- } else {
- return $send($gvars.stderr, 'puts', Opal.to_a(strs))
- };
- }, $Kernel_warn$49.$$arity = -1);
-
- Opal.def(self, '$raise', $Kernel_raise$50 = function $$raise(exception, string, _backtrace) {
- var self = this;
- if ($gvars["!"] == null) $gvars["!"] = nil;
-
-
- ;
-
- if (string == null) {
- string = nil;
- };
-
- if (_backtrace == null) {
- _backtrace = nil;
- };
-
- if (exception == null && $gvars["!"] !== nil) {
- throw $gvars["!"];
- }
- if (exception == null) {
- exception = $$($nesting, 'RuntimeError').$new();
- }
- else if (exception.$$is_string) {
- exception = $$($nesting, 'RuntimeError').$new(exception);
- }
- // using respond_to? and not an undefined check to avoid method_missing matching as true
- else if (exception.$$is_class && exception['$respond_to?']("exception")) {
- exception = exception.$exception(string);
- }
- else if (exception['$is_a?']($$($nesting, 'Exception'))) {
- // exception is fine
- }
- else {
- exception = $$($nesting, 'TypeError').$new("exception class/object expected");
- }
-
- if ($gvars["!"] !== nil) {
- Opal.exceptions.push($gvars["!"]);
- }
-
- $gvars["!"] = exception;
-
- throw exception;
- ;
- }, $Kernel_raise$50.$$arity = -1);
- Opal.alias(self, "fail", "raise");
-
- Opal.def(self, '$rand', $Kernel_rand$51 = function $$rand(max) {
- var self = this;
-
-
- ;
-
- if (max === undefined) {
- return $$$($$($nesting, 'Random'), 'DEFAULT').$rand();
- }
-
- if (max.$$is_number) {
- if (max < 0) {
- max = Math.abs(max);
- }
-
- if (max % 1 !== 0) {
- max = max.$to_i();
- }
-
- if (max === 0) {
- max = undefined;
- }
- }
- ;
- return $$$($$($nesting, 'Random'), 'DEFAULT').$rand(max);
- }, $Kernel_rand$51.$$arity = -1);
-
- Opal.def(self, '$respond_to?', $Kernel_respond_to$ques$52 = function(name, include_all) {
- var self = this;
-
-
-
- if (include_all == null) {
- include_all = false;
- };
- if ($truthy(self['$respond_to_missing?'](name, include_all))) {
- return true};
-
- var body = self['$' + name];
-
- if (typeof(body) === "function" && !body.$$stub) {
- return true;
- }
- ;
- return false;
- }, $Kernel_respond_to$ques$52.$$arity = -2);
-
- Opal.def(self, '$respond_to_missing?', $Kernel_respond_to_missing$ques$53 = function(method_name, include_all) {
- var self = this;
-
-
-
- if (include_all == null) {
- include_all = false;
- };
- return false;
- }, $Kernel_respond_to_missing$ques$53.$$arity = -2);
-
- Opal.def(self, '$require', $Kernel_require$54 = function $$require(file) {
- var self = this;
-
-
- file = $$($nesting, 'Opal')['$coerce_to!'](file, $$($nesting, 'String'), "to_str");
- return Opal.require(file);
- }, $Kernel_require$54.$$arity = 1);
-
- Opal.def(self, '$require_relative', $Kernel_require_relative$55 = function $$require_relative(file) {
- var self = this;
-
-
- $$($nesting, 'Opal')['$try_convert!'](file, $$($nesting, 'String'), "to_str");
- file = $$($nesting, 'File').$expand_path($$($nesting, 'File').$join(Opal.current_file, "..", file));
- return Opal.require(file);
- }, $Kernel_require_relative$55.$$arity = 1);
-
- Opal.def(self, '$require_tree', $Kernel_require_tree$56 = function $$require_tree(path) {
- var self = this;
-
-
- var result = [];
-
- path = $$($nesting, 'File').$expand_path(path)
- path = Opal.normalize(path);
- if (path === '.') path = '';
- for (var name in Opal.modules) {
- if ((name)['$start_with?'](path)) {
- result.push([name, Opal.require(name)]);
- }
- }
-
- return result;
-
- }, $Kernel_require_tree$56.$$arity = 1);
- Opal.alias(self, "send", "__send__");
- Opal.alias(self, "public_send", "__send__");
-
- Opal.def(self, '$singleton_class', $Kernel_singleton_class$57 = function $$singleton_class() {
- var self = this;
-
- return Opal.get_singleton_class(self);
- }, $Kernel_singleton_class$57.$$arity = 0);
-
- Opal.def(self, '$sleep', $Kernel_sleep$58 = function $$sleep(seconds) {
- var self = this;
-
-
-
- if (seconds == null) {
- seconds = nil;
- };
-
- if (seconds === nil) {
- self.$raise($$($nesting, 'TypeError'), "can't convert NilClass into time interval")
- }
- if (!seconds.$$is_number) {
- self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (seconds.$class()) + " into time interval")
- }
- if (seconds < 0) {
- self.$raise($$($nesting, 'ArgumentError'), "time interval must be positive")
- }
- var get_time = Opal.global.performance ?
- function() {return performance.now()} :
- function() {return new Date()}
-
- var t = get_time();
- while (get_time() - t <= seconds * 1000);
- return seconds;
- ;
- }, $Kernel_sleep$58.$$arity = -1);
-
- Opal.def(self, '$srand', $Kernel_srand$59 = function $$srand(seed) {
- var self = this;
-
-
-
- if (seed == null) {
- seed = $$($nesting, 'Random').$new_seed();
- };
- return $$($nesting, 'Random').$srand(seed);
- }, $Kernel_srand$59.$$arity = -1);
-
- Opal.def(self, '$String', $Kernel_String$60 = function $$String(str) {
- var $a, self = this;
-
- return ($truthy($a = $$($nesting, 'Opal')['$coerce_to?'](str, $$($nesting, 'String'), "to_str")) ? $a : $$($nesting, 'Opal')['$coerce_to!'](str, $$($nesting, 'String'), "to_s"))
- }, $Kernel_String$60.$$arity = 1);
-
- Opal.def(self, '$tap', $Kernel_tap$61 = function $$tap() {
- var $iter = $Kernel_tap$61.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Kernel_tap$61.$$p = null;
-
-
- if ($iter) $Kernel_tap$61.$$p = null;;
- Opal.yield1(block, self);
- return self;
- }, $Kernel_tap$61.$$arity = 0);
-
- Opal.def(self, '$to_proc', $Kernel_to_proc$62 = function $$to_proc() {
- var self = this;
-
- return self
- }, $Kernel_to_proc$62.$$arity = 0);
-
- Opal.def(self, '$to_s', $Kernel_to_s$63 = function $$to_s() {
- var self = this;
-
- return "" + "#<" + (self.$class()) + ":0x" + (self.$__id__().$to_s(16)) + ">"
- }, $Kernel_to_s$63.$$arity = 0);
-
- Opal.def(self, '$catch', $Kernel_catch$64 = function(sym) {
- var $iter = $Kernel_catch$64.$$p, $yield = $iter || nil, self = this, e = nil;
-
- if ($iter) $Kernel_catch$64.$$p = null;
- try {
- return Opal.yieldX($yield, []);
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'UncaughtThrowError')])) {e = $err;
- try {
-
- if (e.$sym()['$=='](sym)) {
- return e.$arg()};
- return self.$raise();
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }
- }, $Kernel_catch$64.$$arity = 1);
-
- Opal.def(self, '$throw', $Kernel_throw$65 = function($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return self.$raise($$($nesting, 'UncaughtThrowError'), args);
- }, $Kernel_throw$65.$$arity = -1);
-
- Opal.def(self, '$open', $Kernel_open$66 = function $$open($a) {
- var $iter = $Kernel_open$66.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $Kernel_open$66.$$p = null;
-
-
- if ($iter) $Kernel_open$66.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return $send($$($nesting, 'File'), 'open', Opal.to_a(args), block.$to_proc());
- }, $Kernel_open$66.$$arity = -1);
-
- Opal.def(self, '$yield_self', $Kernel_yield_self$67 = function $$yield_self() {
- var $$68, $iter = $Kernel_yield_self$67.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $Kernel_yield_self$67.$$p = null;
-
- if (($yield !== nil)) {
- } else {
- return $send(self, 'enum_for', ["yield_self"], ($$68 = function(){var self = $$68.$$s || this;
-
- return 1}, $$68.$$s = self, $$68.$$arity = 0, $$68))
- };
- return Opal.yield1($yield, self);;
- }, $Kernel_yield_self$67.$$arity = 0);
- })($nesting[0], $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Object');
-
- var $nesting = [self].concat($parent_nesting);
-
- return self.$include($$($nesting, 'Kernel'))
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/error"] = function(Opal) {
- function $rb_plus(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);
- }
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $module = Opal.module, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$new', '$clone', '$to_s', '$empty?', '$class', '$raise', '$+', '$attr_reader', '$[]', '$>', '$length', '$inspect']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Exception');
-
- var $nesting = [self].concat($parent_nesting), $Exception_new$1, $Exception_exception$2, $Exception_initialize$3, $Exception_backtrace$4, $Exception_exception$5, $Exception_message$6, $Exception_inspect$7, $Exception_set_backtrace$8, $Exception_to_s$9;
-
- self.$$prototype.message = nil;
-
- var stack_trace_limit;
- Opal.defs(self, '$new', $Exception_new$1 = function($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- var message = (args.length > 0) ? args[0] : nil;
- var error = new self.$$constructor(message);
- error.name = self.$$name;
- error.message = message;
- Opal.send(error, error.$initialize, args);
-
- // Error.captureStackTrace() will use .name and .toString to build the
- // first line of the stack trace so it must be called after the error
- // has been initialized.
- // https://nodejs.org/dist/latest-v6.x/docs/api/errors.html
- if (Opal.config.enable_stack_trace && Error.captureStackTrace) {
- // Passing Kernel.raise will cut the stack trace from that point above
- Error.captureStackTrace(error, stack_trace_limit);
- }
-
- return error;
- ;
- }, $Exception_new$1.$$arity = -1);
- stack_trace_limit = self.$new;
- Opal.defs(self, '$exception', $Exception_exception$2 = function $$exception($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return $send(self, 'new', Opal.to_a(args));
- }, $Exception_exception$2.$$arity = -1);
-
- Opal.def(self, '$initialize', $Exception_initialize$3 = function $$initialize($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return self.message = (args.length > 0) ? args[0] : nil;;
- }, $Exception_initialize$3.$$arity = -1);
-
- Opal.def(self, '$backtrace', $Exception_backtrace$4 = function $$backtrace() {
- var self = this;
-
-
- if (self.backtrace) {
- // nil is a valid backtrace
- return self.backtrace;
- }
-
- var backtrace = self.stack;
-
- if (typeof(backtrace) === 'string') {
- return backtrace.split("\n").slice(0, 15);
- }
- else if (backtrace) {
- return backtrace.slice(0, 15);
- }
-
- return [];
-
- }, $Exception_backtrace$4.$$arity = 0);
-
- Opal.def(self, '$exception', $Exception_exception$5 = function $$exception(str) {
- var self = this;
-
-
-
- if (str == null) {
- str = nil;
- };
-
- if (str === nil || self === str) {
- return self;
- }
-
- var cloned = self.$clone();
- cloned.message = str;
- return cloned;
- ;
- }, $Exception_exception$5.$$arity = -1);
-
- Opal.def(self, '$message', $Exception_message$6 = function $$message() {
- var self = this;
-
- return self.$to_s()
- }, $Exception_message$6.$$arity = 0);
-
- Opal.def(self, '$inspect', $Exception_inspect$7 = function $$inspect() {
- var self = this, as_str = nil;
-
-
- as_str = self.$to_s();
- if ($truthy(as_str['$empty?']())) {
- return self.$class().$to_s()
- } else {
- return "" + "#<" + (self.$class().$to_s()) + ": " + (self.$to_s()) + ">"
- };
- }, $Exception_inspect$7.$$arity = 0);
-
- Opal.def(self, '$set_backtrace', $Exception_set_backtrace$8 = function $$set_backtrace(backtrace) {
- var self = this;
-
-
- var valid = true, i, ii;
-
- if (backtrace === nil) {
- self.backtrace = nil;
- } else if (backtrace.$$is_string) {
- self.backtrace = [backtrace];
- } else {
- if (backtrace.$$is_array) {
- for (i = 0, ii = backtrace.length; i < ii; i++) {
- if (!backtrace[i].$$is_string) {
- valid = false;
- break;
- }
- }
- } else {
- valid = false;
- }
-
- if (valid === false) {
- self.$raise($$($nesting, 'TypeError'), "backtrace must be Array of String")
- }
-
- self.backtrace = backtrace;
- }
-
- return backtrace;
-
- }, $Exception_set_backtrace$8.$$arity = 1);
- return (Opal.def(self, '$to_s', $Exception_to_s$9 = function $$to_s() {
- var $a, $b, self = this;
-
- return ($truthy($a = ($truthy($b = self.message) ? self.message.$to_s() : $b)) ? $a : self.$class().$to_s())
- }, $Exception_to_s$9.$$arity = 0), nil) && 'to_s';
- })($nesting[0], Error, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'ScriptError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'Exception'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'SyntaxError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'ScriptError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'LoadError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'ScriptError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NotImplementedError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'ScriptError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'SystemExit');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'Exception'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NoMemoryError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'Exception'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'SignalException');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'Exception'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Interrupt');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'Exception'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'SecurityError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'Exception'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'StandardError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'Exception'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'EncodingError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'ZeroDivisionError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NameError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NoMethodError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'NameError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'RuntimeError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'FrozenError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'RuntimeError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'LocalJumpError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'TypeError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'ArgumentError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'IndexError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'StopIteration');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'IndexError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'KeyError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'IndexError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'RangeError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'FloatDomainError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'RangeError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'IOError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'SystemCallError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Errno');
-
- var $nesting = [self].concat($parent_nesting);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'EINVAL');
-
- var $nesting = [self].concat($parent_nesting), $EINVAL_new$10;
-
- return (Opal.defs(self, '$new', $EINVAL_new$10 = function(name) {
- var $iter = $EINVAL_new$10.$$p, $yield = $iter || nil, self = this, message = nil;
-
- if ($iter) $EINVAL_new$10.$$p = null;
-
-
- if (name == null) {
- name = nil;
- };
- message = "Invalid argument";
- if ($truthy(name)) {
- message = $rb_plus(message, "" + " - " + (name))};
- return $send(self, Opal.find_super_dispatcher(self, 'new', $EINVAL_new$10, false, self.$$class.$$prototype), [message], null);
- }, $EINVAL_new$10.$$arity = -1), nil) && 'new'
- })($nesting[0], $$($nesting, 'SystemCallError'), $nesting)
- })($nesting[0], $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'UncaughtThrowError');
-
- var $nesting = [self].concat($parent_nesting), $UncaughtThrowError_initialize$11;
-
- self.$$prototype.sym = nil;
-
- self.$attr_reader("sym", "arg");
- return (Opal.def(self, '$initialize', $UncaughtThrowError_initialize$11 = function $$initialize(args) {
- var $iter = $UncaughtThrowError_initialize$11.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $UncaughtThrowError_initialize$11.$$p = null;
-
- self.sym = args['$[]'](0);
- if ($truthy($rb_gt(args.$length(), 1))) {
- self.arg = args['$[]'](1)};
- return $send(self, Opal.find_super_dispatcher(self, 'initialize', $UncaughtThrowError_initialize$11, false), ["" + "uncaught throw " + (self.sym.$inspect())], null);
- }, $UncaughtThrowError_initialize$11.$$arity = 1), nil) && 'initialize';
- })($nesting[0], $$($nesting, 'ArgumentError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NameError');
-
- var $nesting = [self].concat($parent_nesting), $NameError_initialize$12;
-
-
- self.$attr_reader("name");
- return (Opal.def(self, '$initialize', $NameError_initialize$12 = function $$initialize(message, name) {
- var $iter = $NameError_initialize$12.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $NameError_initialize$12.$$p = null;
-
-
- if (name == null) {
- name = nil;
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $NameError_initialize$12, false), [message], null);
- return (self.name = name);
- }, $NameError_initialize$12.$$arity = -2), nil) && 'initialize';
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NoMethodError');
-
- var $nesting = [self].concat($parent_nesting), $NoMethodError_initialize$13;
-
-
- self.$attr_reader("args");
- return (Opal.def(self, '$initialize', $NoMethodError_initialize$13 = function $$initialize(message, name, args) {
- var $iter = $NoMethodError_initialize$13.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $NoMethodError_initialize$13.$$p = null;
-
-
- if (name == null) {
- name = nil;
- };
-
- if (args == null) {
- args = [];
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $NoMethodError_initialize$13, false), [message, name], null);
- return (self.args = args);
- }, $NoMethodError_initialize$13.$$arity = -2), nil) && 'initialize';
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'StopIteration');
-
- var $nesting = [self].concat($parent_nesting);
-
- return self.$attr_reader("result")
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'KeyError');
-
- var $nesting = [self].concat($parent_nesting), $KeyError_initialize$14, $KeyError_receiver$15, $KeyError_key$16;
-
- self.$$prototype.receiver = self.$$prototype.key = nil;
-
-
- Opal.def(self, '$initialize', $KeyError_initialize$14 = function $$initialize(message, $kwargs) {
- var receiver, key, $iter = $KeyError_initialize$14.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $KeyError_initialize$14.$$p = null;
-
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- receiver = $kwargs.$$smap["receiver"];
- if (receiver == null) {
- receiver = nil
- };
-
- key = $kwargs.$$smap["key"];
- if (key == null) {
- key = nil
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $KeyError_initialize$14, false), [message], null);
- self.receiver = receiver;
- return (self.key = key);
- }, $KeyError_initialize$14.$$arity = -2);
-
- Opal.def(self, '$receiver', $KeyError_receiver$15 = function $$receiver() {
- var $a, self = this;
-
- return ($truthy($a = self.receiver) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no receiver is available"))
- }, $KeyError_receiver$15.$$arity = 0);
- return (Opal.def(self, '$key', $KeyError_key$16 = function $$key() {
- var $a, self = this;
-
- return ($truthy($a = self.key) ? $a : self.$raise($$($nesting, 'ArgumentError'), "no key is available"))
- }, $KeyError_key$16.$$arity = 0), nil) && 'key';
- })($nesting[0], null, $nesting);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'JS');
-
- var $nesting = [self].concat($parent_nesting);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Error');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/constants"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
-
- Opal.const_set($nesting[0], 'RUBY_PLATFORM', "opal");
- Opal.const_set($nesting[0], 'RUBY_ENGINE', "opal");
- Opal.const_set($nesting[0], 'RUBY_VERSION', "2.5.1");
- Opal.const_set($nesting[0], 'RUBY_ENGINE_VERSION', "0.11.99.dev");
- Opal.const_set($nesting[0], 'RUBY_RELEASE_DATE', "2018-12-25");
- Opal.const_set($nesting[0], 'RUBY_PATCHLEVEL', 0);
- Opal.const_set($nesting[0], 'RUBY_REVISION', 0);
- Opal.const_set($nesting[0], 'RUBY_COPYRIGHT', "opal - Copyright (C) 2013-2018 Adam Beynon and the Opal contributors");
- return Opal.const_set($nesting[0], 'RUBY_DESCRIPTION', "" + "opal " + ($$($nesting, 'RUBY_ENGINE_VERSION')) + " (" + ($$($nesting, 'RUBY_RELEASE_DATE')) + " revision " + ($$($nesting, 'RUBY_REVISION')) + ")");
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["opal/base"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$require']);
-
- self.$require("corelib/runtime");
- self.$require("corelib/helpers");
- self.$require("corelib/module");
- self.$require("corelib/class");
- self.$require("corelib/basic_object");
- self.$require("corelib/kernel");
- self.$require("corelib/error");
- return self.$require("corelib/constants");
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/nil"] = function(Opal) {
- function $rb_gt(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, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$raise', '$name', '$new', '$>', '$length', '$Rational']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NilClass');
-
- var $nesting = [self].concat($parent_nesting), $NilClass_$excl$2, $NilClass_$$3, $NilClass_$$4, $NilClass_$$5, $NilClass_$eq_eq$6, $NilClass_dup$7, $NilClass_clone$8, $NilClass_inspect$9, $NilClass_nil$ques$10, $NilClass_singleton_class$11, $NilClass_to_a$12, $NilClass_to_h$13, $NilClass_to_i$14, $NilClass_to_s$15, $NilClass_to_c$16, $NilClass_rationalize$17, $NilClass_to_r$18, $NilClass_instance_variables$19;
-
-
- self.$$prototype.$$meta = self;
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $allocate$1;
-
-
-
- Opal.def(self, '$allocate', $allocate$1 = function $$allocate() {
- var self = this;
-
- return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name()))
- }, $allocate$1.$$arity = 0);
-
-
- Opal.udef(self, '$' + "new");;
- return nil;;
- })(Opal.get_singleton_class(self), $nesting);
-
- Opal.def(self, '$!', $NilClass_$excl$2 = function() {
- var self = this;
-
- return true
- }, $NilClass_$excl$2.$$arity = 0);
-
- Opal.def(self, '$&', $NilClass_$$3 = function(other) {
- var self = this;
-
- return false
- }, $NilClass_$$3.$$arity = 1);
-
- Opal.def(self, '$|', $NilClass_$$4 = function(other) {
- var self = this;
-
- return other !== false && other !== nil;
- }, $NilClass_$$4.$$arity = 1);
-
- Opal.def(self, '$^', $NilClass_$$5 = function(other) {
- var self = this;
-
- return other !== false && other !== nil;
- }, $NilClass_$$5.$$arity = 1);
-
- Opal.def(self, '$==', $NilClass_$eq_eq$6 = function(other) {
- var self = this;
-
- return other === nil;
- }, $NilClass_$eq_eq$6.$$arity = 1);
-
- Opal.def(self, '$dup', $NilClass_dup$7 = function $$dup() {
- var self = this;
-
- return nil
- }, $NilClass_dup$7.$$arity = 0);
-
- Opal.def(self, '$clone', $NilClass_clone$8 = function $$clone($kwargs) {
- var freeze, self = this;
-
-
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- freeze = $kwargs.$$smap["freeze"];
- if (freeze == null) {
- freeze = true
- };
- return nil;
- }, $NilClass_clone$8.$$arity = -1);
-
- Opal.def(self, '$inspect', $NilClass_inspect$9 = function $$inspect() {
- var self = this;
-
- return "nil"
- }, $NilClass_inspect$9.$$arity = 0);
-
- Opal.def(self, '$nil?', $NilClass_nil$ques$10 = function() {
- var self = this;
-
- return true
- }, $NilClass_nil$ques$10.$$arity = 0);
-
- Opal.def(self, '$singleton_class', $NilClass_singleton_class$11 = function $$singleton_class() {
- var self = this;
-
- return $$($nesting, 'NilClass')
- }, $NilClass_singleton_class$11.$$arity = 0);
-
- Opal.def(self, '$to_a', $NilClass_to_a$12 = function $$to_a() {
- var self = this;
-
- return []
- }, $NilClass_to_a$12.$$arity = 0);
-
- Opal.def(self, '$to_h', $NilClass_to_h$13 = function $$to_h() {
- var self = this;
-
- return Opal.hash();
- }, $NilClass_to_h$13.$$arity = 0);
-
- Opal.def(self, '$to_i', $NilClass_to_i$14 = function $$to_i() {
- var self = this;
-
- return 0
- }, $NilClass_to_i$14.$$arity = 0);
- Opal.alias(self, "to_f", "to_i");
-
- Opal.def(self, '$to_s', $NilClass_to_s$15 = function $$to_s() {
- var self = this;
-
- return ""
- }, $NilClass_to_s$15.$$arity = 0);
-
- Opal.def(self, '$to_c', $NilClass_to_c$16 = function $$to_c() {
- var self = this;
-
- return $$($nesting, 'Complex').$new(0, 0)
- }, $NilClass_to_c$16.$$arity = 0);
-
- Opal.def(self, '$rationalize', $NilClass_rationalize$17 = function $$rationalize($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy($rb_gt(args.$length(), 1))) {
- self.$raise($$($nesting, 'ArgumentError'))};
- return self.$Rational(0, 1);
- }, $NilClass_rationalize$17.$$arity = -1);
-
- Opal.def(self, '$to_r', $NilClass_to_r$18 = function $$to_r() {
- var self = this;
-
- return self.$Rational(0, 1)
- }, $NilClass_to_r$18.$$arity = 0);
- return (Opal.def(self, '$instance_variables', $NilClass_instance_variables$19 = function $$instance_variables() {
- var self = this;
-
- return []
- }, $NilClass_instance_variables$19.$$arity = 0), nil) && 'instance_variables';
- })($nesting[0], null, $nesting);
- return Opal.const_set($nesting[0], 'NIL', nil);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/boolean"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$raise', '$name']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Boolean');
-
- var $nesting = [self].concat($parent_nesting), $Boolean___id__$2, $Boolean_$excl$3, $Boolean_$$4, $Boolean_$$5, $Boolean_$$6, $Boolean_$eq_eq$7, $Boolean_singleton_class$8, $Boolean_to_s$9, $Boolean_dup$10, $Boolean_clone$11;
-
-
- Opal.defineProperty(self.$$prototype, '$$is_boolean', true);
- Opal.defineProperty(self.$$prototype, '$$meta', self);
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $allocate$1;
-
-
-
- Opal.def(self, '$allocate', $allocate$1 = function $$allocate() {
- var self = this;
-
- return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name()))
- }, $allocate$1.$$arity = 0);
-
-
- Opal.udef(self, '$' + "new");;
- return nil;;
- })(Opal.get_singleton_class(self), $nesting);
-
- Opal.def(self, '$__id__', $Boolean___id__$2 = function $$__id__() {
- var self = this;
-
- return self.valueOf() ? 2 : 0;
- }, $Boolean___id__$2.$$arity = 0);
- Opal.alias(self, "object_id", "__id__");
-
- Opal.def(self, '$!', $Boolean_$excl$3 = function() {
- var self = this;
-
- return self != true;
- }, $Boolean_$excl$3.$$arity = 0);
-
- Opal.def(self, '$&', $Boolean_$$4 = function(other) {
- var self = this;
-
- return (self == true) ? (other !== false && other !== nil) : false;
- }, $Boolean_$$4.$$arity = 1);
-
- Opal.def(self, '$|', $Boolean_$$5 = function(other) {
- var self = this;
-
- return (self == true) ? true : (other !== false && other !== nil);
- }, $Boolean_$$5.$$arity = 1);
-
- Opal.def(self, '$^', $Boolean_$$6 = function(other) {
- var self = this;
-
- return (self == true) ? (other === false || other === nil) : (other !== false && other !== nil);
- }, $Boolean_$$6.$$arity = 1);
-
- Opal.def(self, '$==', $Boolean_$eq_eq$7 = function(other) {
- var self = this;
-
- return (self == true) === other.valueOf();
- }, $Boolean_$eq_eq$7.$$arity = 1);
- Opal.alias(self, "equal?", "==");
- Opal.alias(self, "eql?", "==");
-
- Opal.def(self, '$singleton_class', $Boolean_singleton_class$8 = function $$singleton_class() {
- var self = this;
-
- return $$($nesting, 'Boolean')
- }, $Boolean_singleton_class$8.$$arity = 0);
-
- Opal.def(self, '$to_s', $Boolean_to_s$9 = function $$to_s() {
- var self = this;
-
- return (self == true) ? 'true' : 'false';
- }, $Boolean_to_s$9.$$arity = 0);
-
- Opal.def(self, '$dup', $Boolean_dup$10 = function $$dup() {
- var self = this;
-
- return self
- }, $Boolean_dup$10.$$arity = 0);
- return (Opal.def(self, '$clone', $Boolean_clone$11 = function $$clone($kwargs) {
- var freeze, self = this;
-
-
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- freeze = $kwargs.$$smap["freeze"];
- if (freeze == null) {
- freeze = true
- };
- return self;
- }, $Boolean_clone$11.$$arity = -1), nil) && 'clone';
- })($nesting[0], Boolean, $nesting);
- Opal.const_set($nesting[0], 'TrueClass', $$($nesting, 'Boolean'));
- Opal.const_set($nesting[0], 'FalseClass', $$($nesting, 'Boolean'));
- Opal.const_set($nesting[0], 'TRUE', true);
- return Opal.const_set($nesting[0], 'FALSE', false);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/comparable"] = function(Opal) {
- function $rb_gt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
- }
- function $rb_lt(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, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$===', '$>', '$<', '$equal?', '$<=>', '$normalize', '$raise', '$class']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Comparable');
-
- var $nesting = [self].concat($parent_nesting), $Comparable_normalize$1, $Comparable_$eq_eq$2, $Comparable_$gt$3, $Comparable_$gt_eq$4, $Comparable_$lt$5, $Comparable_$lt_eq$6, $Comparable_between$ques$7, $Comparable_clamp$8;
-
-
- Opal.defs(self, '$normalize', $Comparable_normalize$1 = function $$normalize(what) {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Integer')['$==='](what))) {
- return what};
- if ($truthy($rb_gt(what, 0))) {
- return 1};
- if ($truthy($rb_lt(what, 0))) {
- return -1};
- return 0;
- }, $Comparable_normalize$1.$$arity = 1);
-
- Opal.def(self, '$==', $Comparable_$eq_eq$2 = function(other) {
- var self = this, cmp = nil;
-
- try {
-
- if ($truthy(self['$equal?'](other))) {
- return true};
-
- if (self["$<=>"] == Opal.Kernel["$<=>"]) {
- return false;
- }
-
- // check for infinite recursion
- if (self.$$comparable) {
- delete self.$$comparable;
- return false;
- }
- ;
- if ($truthy((cmp = self['$<=>'](other)))) {
- } else {
- return false
- };
- return $$($nesting, 'Comparable').$normalize(cmp) == 0;
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- return false
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }
- }, $Comparable_$eq_eq$2.$$arity = 1);
-
- Opal.def(self, '$>', $Comparable_$gt$3 = function(other) {
- var self = this, cmp = nil;
-
-
- if ($truthy((cmp = self['$<=>'](other)))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")
- };
- return $$($nesting, 'Comparable').$normalize(cmp) > 0;
- }, $Comparable_$gt$3.$$arity = 1);
-
- Opal.def(self, '$>=', $Comparable_$gt_eq$4 = function(other) {
- var self = this, cmp = nil;
-
-
- if ($truthy((cmp = self['$<=>'](other)))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")
- };
- return $$($nesting, 'Comparable').$normalize(cmp) >= 0;
- }, $Comparable_$gt_eq$4.$$arity = 1);
-
- Opal.def(self, '$<', $Comparable_$lt$5 = function(other) {
- var self = this, cmp = nil;
-
-
- if ($truthy((cmp = self['$<=>'](other)))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")
- };
- return $$($nesting, 'Comparable').$normalize(cmp) < 0;
- }, $Comparable_$lt$5.$$arity = 1);
-
- Opal.def(self, '$<=', $Comparable_$lt_eq$6 = function(other) {
- var self = this, cmp = nil;
-
-
- if ($truthy((cmp = self['$<=>'](other)))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")
- };
- return $$($nesting, 'Comparable').$normalize(cmp) <= 0;
- }, $Comparable_$lt_eq$6.$$arity = 1);
-
- Opal.def(self, '$between?', $Comparable_between$ques$7 = function(min, max) {
- var self = this;
-
-
- if ($rb_lt(self, min)) {
- return false};
- if ($rb_gt(self, max)) {
- return false};
- return true;
- }, $Comparable_between$ques$7.$$arity = 2);
-
- Opal.def(self, '$clamp', $Comparable_clamp$8 = function $$clamp(min, max) {
- var self = this, cmp = nil;
-
-
- cmp = min['$<=>'](max);
- if ($truthy(cmp)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (min.$class()) + " with " + (max.$class()) + " failed")
- };
- if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(cmp), 0))) {
- self.$raise($$($nesting, 'ArgumentError'), "min argument must be smaller than max argument")};
- if ($truthy($rb_lt($$($nesting, 'Comparable').$normalize(self['$<=>'](min)), 0))) {
- return min};
- if ($truthy($rb_gt($$($nesting, 'Comparable').$normalize(self['$<=>'](max)), 0))) {
- return max};
- return self;
- }, $Comparable_clamp$8.$$arity = 2);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/regexp"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$nil?', '$[]', '$raise', '$escape', '$options', '$to_str', '$new', '$join', '$coerce_to!', '$!', '$match', '$coerce_to?', '$begin', '$coerce_to', '$=~', '$attr_reader', '$===', '$inspect', '$to_a']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'RegexpError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Regexp');
-
- var $nesting = [self].concat($parent_nesting), $Regexp_$eq_eq$6, $Regexp_$eq_eq_eq$7, $Regexp_$eq_tilde$8, $Regexp_inspect$9, $Regexp_match$10, $Regexp_match$ques$11, $Regexp_$$12, $Regexp_source$13, $Regexp_options$14, $Regexp_casefold$ques$15;
-
-
- Opal.const_set($nesting[0], 'IGNORECASE', 1);
- Opal.const_set($nesting[0], 'EXTENDED', 2);
- Opal.const_set($nesting[0], 'MULTILINE', 4);
- Opal.defineProperty(self.$$prototype, '$$is_regexp', true);
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $allocate$1, $escape$2, $last_match$3, $union$4, $new$5;
-
-
-
- Opal.def(self, '$allocate', $allocate$1 = function $$allocate() {
- var $iter = $allocate$1.$$p, $yield = $iter || nil, self = this, allocated = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $allocate$1.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
- allocated = $send(self, Opal.find_super_dispatcher(self, 'allocate', $allocate$1, false), $zuper, $iter);
- allocated.uninitialized = true;
- return allocated;
- }, $allocate$1.$$arity = 0);
-
- Opal.def(self, '$escape', $escape$2 = function $$escape(string) {
- var self = this;
-
- return Opal.escape_regexp(string);
- }, $escape$2.$$arity = 1);
-
- Opal.def(self, '$last_match', $last_match$3 = function $$last_match(n) {
- var self = this;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
-
-
- if (n == null) {
- n = nil;
- };
- if ($truthy(n['$nil?']())) {
- return $gvars["~"]
- } else {
- return $gvars["~"]['$[]'](n)
- };
- }, $last_match$3.$$arity = -1);
- Opal.alias(self, "quote", "escape");
-
- Opal.def(self, '$union', $union$4 = function $$union($a) {
- var $post_args, parts, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- parts = $post_args;;
-
- var is_first_part_array, quoted_validated, part, options, each_part_options;
- if (parts.length == 0) {
- return /(?!)/;
- }
- // return fast if there's only one element
- if (parts.length == 1 && parts[0].$$is_regexp) {
- return parts[0];
- }
- // cover the 2 arrays passed as arguments case
- is_first_part_array = parts[0].$$is_array;
- if (parts.length > 1 && is_first_part_array) {
- self.$raise($$($nesting, 'TypeError'), "no implicit conversion of Array into String")
- }
- // deal with splat issues (related to https://github.com/opal/opal/issues/858)
- if (is_first_part_array) {
- parts = parts[0];
- }
- options = undefined;
- quoted_validated = [];
- for (var i=0; i < parts.length; i++) {
- part = parts[i];
- if (part.$$is_string) {
- quoted_validated.push(self.$escape(part));
- }
- else if (part.$$is_regexp) {
- each_part_options = (part).$options();
- if (options != undefined && options != each_part_options) {
- self.$raise($$($nesting, 'TypeError'), "All expressions must use the same options")
- }
- options = each_part_options;
- quoted_validated.push('('+part.source+')');
- }
- else {
- quoted_validated.push(self.$escape((part).$to_str()));
- }
- }
- ;
- return self.$new((quoted_validated).$join("|"), options);
- }, $union$4.$$arity = -1);
- return (Opal.def(self, '$new', $new$5 = function(regexp, options) {
- var self = this;
-
-
- ;
-
- if (regexp.$$is_regexp) {
- return new RegExp(regexp);
- }
-
- regexp = $$($nesting, 'Opal')['$coerce_to!'](regexp, $$($nesting, 'String'), "to_str");
-
- if (regexp.charAt(regexp.length - 1) === '\\' && regexp.charAt(regexp.length - 2) !== '\\') {
- self.$raise($$($nesting, 'RegexpError'), "" + "too short escape sequence: /" + (regexp) + "/")
- }
-
- if (options === undefined || options['$!']()) {
- return new RegExp(regexp);
- }
-
- if (options.$$is_number) {
- var temp = '';
- if ($$($nesting, 'IGNORECASE') & options) { temp += 'i'; }
- if ($$($nesting, 'MULTILINE') & options) { temp += 'm'; }
- options = temp;
- }
- else {
- options = 'i';
- }
-
- return new RegExp(regexp, options);
- ;
- }, $new$5.$$arity = -2), nil) && 'new';
- })(Opal.get_singleton_class(self), $nesting);
-
- Opal.def(self, '$==', $Regexp_$eq_eq$6 = function(other) {
- var self = this;
-
- return other instanceof RegExp && self.toString() === other.toString();
- }, $Regexp_$eq_eq$6.$$arity = 1);
-
- Opal.def(self, '$===', $Regexp_$eq_eq_eq$7 = function(string) {
- var self = this;
-
- return self.$match($$($nesting, 'Opal')['$coerce_to?'](string, $$($nesting, 'String'), "to_str")) !== nil
- }, $Regexp_$eq_eq_eq$7.$$arity = 1);
-
- Opal.def(self, '$=~', $Regexp_$eq_tilde$8 = function(string) {
- var $a, self = this;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
- return ($truthy($a = self.$match(string)) ? $gvars["~"].$begin(0) : $a)
- }, $Regexp_$eq_tilde$8.$$arity = 1);
- Opal.alias(self, "eql?", "==");
-
- Opal.def(self, '$inspect', $Regexp_inspect$9 = function $$inspect() {
- var self = this;
-
-
- var regexp_format = /^\/(.*)\/([^\/]*)$/;
- var value = self.toString();
- var matches = regexp_format.exec(value);
- if (matches) {
- var regexp_pattern = matches[1];
- var regexp_flags = matches[2];
- var chars = regexp_pattern.split('');
- var chars_length = chars.length;
- var char_escaped = false;
- var regexp_pattern_escaped = '';
- for (var i = 0; i < chars_length; i++) {
- var current_char = chars[i];
- if (!char_escaped && current_char == '/') {
- regexp_pattern_escaped = regexp_pattern_escaped.concat('\\');
- }
- regexp_pattern_escaped = regexp_pattern_escaped.concat(current_char);
- if (current_char == '\\') {
- if (char_escaped) {
- // does not over escape
- char_escaped = false;
- } else {
- char_escaped = true;
- }
- } else {
- char_escaped = false;
- }
- }
- return '/' + regexp_pattern_escaped + '/' + regexp_flags;
- } else {
- return value;
- }
-
- }, $Regexp_inspect$9.$$arity = 0);
-
- Opal.def(self, '$match', $Regexp_match$10 = function $$match(string, pos) {
- var $iter = $Regexp_match$10.$$p, block = $iter || nil, self = this;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
- if ($iter) $Regexp_match$10.$$p = null;
-
-
- if ($iter) $Regexp_match$10.$$p = null;;
- ;
-
- if (self.uninitialized) {
- self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp")
- }
-
- if (pos === undefined) {
- if (string === nil) return ($gvars["~"] = nil);
- var m = self.exec($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"));
- if (m) {
- ($gvars["~"] = $$($nesting, 'MatchData').$new(self, m));
- return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]);
- } else {
- return ($gvars["~"] = nil);
- }
- }
-
- pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int");
-
- if (string === nil) {
- return ($gvars["~"] = nil);
- }
-
- string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str");
-
- if (pos < 0) {
- pos += string.length;
- if (pos < 0) {
- return ($gvars["~"] = nil);
- }
- }
-
- // global RegExp maintains state, so not using self/this
- var md, re = Opal.global_regexp(self);
-
- while (true) {
- md = re.exec(string);
- if (md === null) {
- return ($gvars["~"] = nil);
- }
- if (md.index >= pos) {
- ($gvars["~"] = $$($nesting, 'MatchData').$new(re, md));
- return block === nil ? $gvars["~"] : Opal.yield1(block, $gvars["~"]);
- }
- re.lastIndex = md.index + 1;
- }
- ;
- }, $Regexp_match$10.$$arity = -2);
-
- Opal.def(self, '$match?', $Regexp_match$ques$11 = function(string, pos) {
- var self = this;
-
-
- ;
-
- if (self.uninitialized) {
- self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp")
- }
-
- if (pos === undefined) {
- return string === nil ? false : self.test($$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str"));
- }
-
- pos = $$($nesting, 'Opal').$coerce_to(pos, $$($nesting, 'Integer'), "to_int");
-
- if (string === nil) {
- return false;
- }
-
- string = $$($nesting, 'Opal').$coerce_to(string, $$($nesting, 'String'), "to_str");
-
- if (pos < 0) {
- pos += string.length;
- if (pos < 0) {
- return false;
- }
- }
-
- // global RegExp maintains state, so not using self/this
- var md, re = Opal.global_regexp(self);
-
- md = re.exec(string);
- if (md === null || md.index < pos) {
- return false;
- } else {
- return true;
- }
- ;
- }, $Regexp_match$ques$11.$$arity = -2);
-
- Opal.def(self, '$~', $Regexp_$$12 = function() {
- var self = this;
- if ($gvars._ == null) $gvars._ = nil;
-
- return self['$=~']($gvars._)
- }, $Regexp_$$12.$$arity = 0);
-
- Opal.def(self, '$source', $Regexp_source$13 = function $$source() {
- var self = this;
-
- return self.source;
- }, $Regexp_source$13.$$arity = 0);
-
- Opal.def(self, '$options', $Regexp_options$14 = function $$options() {
- var self = this;
-
-
- if (self.uninitialized) {
- self.$raise($$($nesting, 'TypeError'), "uninitialized Regexp")
- }
- var result = 0;
- // should be supported in IE6 according to https://msdn.microsoft.com/en-us/library/7f5z26w4(v=vs.94).aspx
- if (self.multiline) {
- result |= $$($nesting, 'MULTILINE');
- }
- if (self.ignoreCase) {
- result |= $$($nesting, 'IGNORECASE');
- }
- return result;
-
- }, $Regexp_options$14.$$arity = 0);
-
- Opal.def(self, '$casefold?', $Regexp_casefold$ques$15 = function() {
- var self = this;
-
- return self.ignoreCase;
- }, $Regexp_casefold$ques$15.$$arity = 0);
- return Opal.alias(self, "to_s", "source");
- })($nesting[0], RegExp, $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'MatchData');
-
- var $nesting = [self].concat($parent_nesting), $MatchData_initialize$16, $MatchData_$$$17, $MatchData_offset$18, $MatchData_$eq_eq$19, $MatchData_begin$20, $MatchData_end$21, $MatchData_captures$22, $MatchData_inspect$23, $MatchData_length$24, $MatchData_to_a$25, $MatchData_to_s$26, $MatchData_values_at$27;
-
- self.$$prototype.matches = nil;
-
- self.$attr_reader("post_match", "pre_match", "regexp", "string");
-
- Opal.def(self, '$initialize', $MatchData_initialize$16 = function $$initialize(regexp, match_groups) {
- var self = this;
-
-
- $gvars["~"] = self;
- self.regexp = regexp;
- self.begin = match_groups.index;
- self.string = match_groups.input;
- self.pre_match = match_groups.input.slice(0, match_groups.index);
- self.post_match = match_groups.input.slice(match_groups.index + match_groups[0].length);
- self.matches = [];
-
- for (var i = 0, length = match_groups.length; i < length; i++) {
- var group = match_groups[i];
-
- if (group == null) {
- self.matches.push(nil);
- }
- else {
- self.matches.push(group);
- }
- }
- ;
- }, $MatchData_initialize$16.$$arity = 2);
-
- Opal.def(self, '$[]', $MatchData_$$$17 = function($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return $send(self.matches, '[]', Opal.to_a(args));
- }, $MatchData_$$$17.$$arity = -1);
-
- Opal.def(self, '$offset', $MatchData_offset$18 = function $$offset(n) {
- var self = this;
-
-
- if (n !== 0) {
- self.$raise($$($nesting, 'ArgumentError'), "MatchData#offset only supports 0th element")
- }
- return [self.begin, self.begin + self.matches[n].length];
-
- }, $MatchData_offset$18.$$arity = 1);
-
- Opal.def(self, '$==', $MatchData_$eq_eq$19 = function(other) {
- var $a, $b, $c, $d, self = this;
-
-
- if ($truthy($$($nesting, 'MatchData')['$==='](other))) {
- } else {
- return false
- };
- return ($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = self.string == other.string) ? self.regexp.toString() == other.regexp.toString() : $d)) ? self.pre_match == other.pre_match : $c)) ? self.post_match == other.post_match : $b)) ? self.begin == other.begin : $a);
- }, $MatchData_$eq_eq$19.$$arity = 1);
- Opal.alias(self, "eql?", "==");
-
- Opal.def(self, '$begin', $MatchData_begin$20 = function $$begin(n) {
- var self = this;
-
-
- if (n !== 0) {
- self.$raise($$($nesting, 'ArgumentError'), "MatchData#begin only supports 0th element")
- }
- return self.begin;
-
- }, $MatchData_begin$20.$$arity = 1);
-
- Opal.def(self, '$end', $MatchData_end$21 = function $$end(n) {
- var self = this;
-
-
- if (n !== 0) {
- self.$raise($$($nesting, 'ArgumentError'), "MatchData#end only supports 0th element")
- }
- return self.begin + self.matches[n].length;
-
- }, $MatchData_end$21.$$arity = 1);
-
- Opal.def(self, '$captures', $MatchData_captures$22 = function $$captures() {
- var self = this;
-
- return self.matches.slice(1)
- }, $MatchData_captures$22.$$arity = 0);
-
- Opal.def(self, '$inspect', $MatchData_inspect$23 = function $$inspect() {
- var self = this;
-
-
- var str = "#";
-
- }, $MatchData_inspect$23.$$arity = 0);
-
- Opal.def(self, '$length', $MatchData_length$24 = function $$length() {
- var self = this;
-
- return self.matches.length
- }, $MatchData_length$24.$$arity = 0);
- Opal.alias(self, "size", "length");
-
- Opal.def(self, '$to_a', $MatchData_to_a$25 = function $$to_a() {
- var self = this;
-
- return self.matches
- }, $MatchData_to_a$25.$$arity = 0);
-
- Opal.def(self, '$to_s', $MatchData_to_s$26 = function $$to_s() {
- var self = this;
-
- return self.matches[0]
- }, $MatchData_to_s$26.$$arity = 0);
- return (Opal.def(self, '$values_at', $MatchData_values_at$27 = function $$values_at($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- var i, a, index, values = [];
-
- for (i = 0; i < args.length; i++) {
-
- if (args[i].$$is_range) {
- a = (args[i]).$to_a();
- a.unshift(i, 1);
- Array.prototype.splice.apply(args, a);
- }
-
- index = $$($nesting, 'Opal')['$coerce_to!'](args[i], $$($nesting, 'Integer'), "to_int");
-
- if (index < 0) {
- index += self.matches.length;
- if (index < 0) {
- values.push(nil);
- continue;
- }
- }
-
- values.push(self.matches[index]);
- }
-
- return values;
- ;
- }, $MatchData_values_at$27.$$arity = -1), nil) && 'values_at';
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/string"] = function(Opal) {
- function $rb_divide(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);
- }
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$require', '$include', '$coerce_to?', '$coerce_to', '$raise', '$===', '$format', '$to_s', '$respond_to?', '$to_str', '$<=>', '$==', '$=~', '$new', '$force_encoding', '$casecmp', '$empty?', '$ljust', '$ceil', '$/', '$+', '$rjust', '$floor', '$to_a', '$each_char', '$to_proc', '$coerce_to!', '$copy_singleton_methods', '$initialize_clone', '$initialize_dup', '$enum_for', '$size', '$chomp', '$[]', '$to_i', '$each_line', '$class', '$match', '$match?', '$captures', '$proc', '$succ', '$escape']);
-
- self.$require("corelib/comparable");
- self.$require("corelib/regexp");
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'String');
-
- var $nesting = [self].concat($parent_nesting), $String___id__$1, $String_try_convert$2, $String_new$3, $String_initialize$4, $String_$percent$5, $String_$$6, $String_$plus$7, $String_$lt_eq_gt$8, $String_$eq_eq$9, $String_$eq_tilde$10, $String_$$$11, $String_b$12, $String_capitalize$13, $String_casecmp$14, $String_casecmp$ques$15, $String_center$16, $String_chars$17, $String_chomp$18, $String_chop$19, $String_chr$20, $String_clone$21, $String_dup$22, $String_count$23, $String_delete$24, $String_delete_prefix$25, $String_delete_suffix$26, $String_downcase$27, $String_each_char$28, $String_each_line$30, $String_empty$ques$31, $String_end_with$ques$32, $String_gsub$33, $String_hash$34, $String_hex$35, $String_include$ques$36, $String_index$37, $String_inspect$38, $String_intern$39, $String_lines$40, $String_length$41, $String_ljust$42, $String_lstrip$43, $String_ascii_only$ques$44, $String_match$45, $String_match$ques$46, $String_next$47, $String_oct$48, $String_ord$49, $String_partition$50, $String_reverse$51, $String_rindex$52, $String_rjust$53, $String_rpartition$54, $String_rstrip$55, $String_scan$56, $String_split$57, $String_squeeze$58, $String_start_with$ques$59, $String_strip$60, $String_sub$61, $String_sum$62, $String_swapcase$63, $String_to_f$64, $String_to_i$65, $String_to_proc$66, $String_to_s$68, $String_tr$69, $String_tr_s$70, $String_upcase$71, $String_upto$72, $String_instance_variables$73, $String__load$74, $String_unicode_normalize$75, $String_unicode_normalized$ques$76, $String_unpack$77, $String_unpack1$78;
-
-
- self.$include($$($nesting, 'Comparable'));
-
- Opal.defineProperty(self.$$prototype, '$$is_string', true);
-
- Opal.defineProperty(self.$$prototype, '$$cast', function(string) {
- var klass = this.$$class;
- if (klass.$$constructor === String) {
- return string;
- } else {
- return new klass.$$constructor(string);
- }
- });
- ;
-
- Opal.def(self, '$__id__', $String___id__$1 = function $$__id__() {
- var self = this;
-
- return self.toString();
- }, $String___id__$1.$$arity = 0);
- Opal.alias(self, "object_id", "__id__");
- Opal.defs(self, '$try_convert', $String_try_convert$2 = function $$try_convert(what) {
- var self = this;
-
- return $$($nesting, 'Opal')['$coerce_to?'](what, $$($nesting, 'String'), "to_str")
- }, $String_try_convert$2.$$arity = 1);
- Opal.defs(self, '$new', $String_new$3 = function(str) {
- var self = this;
-
-
-
- if (str == null) {
- str = "";
- };
- str = $$($nesting, 'Opal').$coerce_to(str, $$($nesting, 'String'), "to_str");
- return new self.$$constructor(str);;
- }, $String_new$3.$$arity = -1);
-
- Opal.def(self, '$initialize', $String_initialize$4 = function $$initialize(str) {
- var self = this;
-
-
- ;
-
- if (str === undefined) {
- return self;
- }
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), "Mutable strings are not supported in Opal.");
- }, $String_initialize$4.$$arity = -1);
-
- Opal.def(self, '$%', $String_$percent$5 = function(data) {
- var self = this;
-
- if ($truthy($$($nesting, 'Array')['$==='](data))) {
- return $send(self, 'format', [self].concat(Opal.to_a(data)))
- } else {
- return self.$format(self, data)
- }
- }, $String_$percent$5.$$arity = 1);
-
- Opal.def(self, '$*', $String_$$6 = function(count) {
- var self = this;
-
-
- count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int");
-
- if (count < 0) {
- self.$raise($$($nesting, 'ArgumentError'), "negative argument")
- }
-
- if (count === 0) {
- return self.$$cast('');
- }
-
- var result = '',
- string = self.toString();
-
- // All credit for the bit-twiddling magic code below goes to Mozilla
- // polyfill implementation of String.prototype.repeat() posted here:
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
-
- if (string.length * count >= 1 << 28) {
- self.$raise($$($nesting, 'RangeError'), "multiply count must not overflow maximum string size")
- }
-
- for (;;) {
- if ((count & 1) === 1) {
- result += string;
- }
- count >>>= 1;
- if (count === 0) {
- break;
- }
- string += string;
- }
-
- return self.$$cast(result);
-
- }, $String_$$6.$$arity = 1);
-
- Opal.def(self, '$+', $String_$plus$7 = function(other) {
- var self = this;
-
-
- other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str");
- return self + other.$to_s();
- }, $String_$plus$7.$$arity = 1);
-
- Opal.def(self, '$<=>', $String_$lt_eq_gt$8 = function(other) {
- var self = this;
-
- if ($truthy(other['$respond_to?']("to_str"))) {
-
- other = other.$to_str().$to_s();
- return self > other ? 1 : (self < other ? -1 : 0);;
- } else {
-
- var cmp = other['$<=>'](self);
-
- if (cmp === nil) {
- return nil;
- }
- else {
- return cmp > 0 ? -1 : (cmp < 0 ? 1 : 0);
- }
-
- }
- }, $String_$lt_eq_gt$8.$$arity = 1);
-
- Opal.def(self, '$==', $String_$eq_eq$9 = function(other) {
- var self = this;
-
-
- if (other.$$is_string) {
- return self.toString() === other.toString();
- }
- if ($$($nesting, 'Opal')['$respond_to?'](other, "to_str")) {
- return other['$=='](self);
- }
- return false;
-
- }, $String_$eq_eq$9.$$arity = 1);
- Opal.alias(self, "eql?", "==");
- Opal.alias(self, "===", "==");
-
- Opal.def(self, '$=~', $String_$eq_tilde$10 = function(other) {
- var self = this;
-
-
- if (other.$$is_string) {
- self.$raise($$($nesting, 'TypeError'), "type mismatch: String given");
- }
-
- return other['$=~'](self);
-
- }, $String_$eq_tilde$10.$$arity = 1);
-
- Opal.def(self, '$[]', $String_$$$11 = function(index, length) {
- var self = this;
-
-
- ;
-
- var size = self.length, exclude;
-
- if (index.$$is_range) {
- exclude = index.excl;
- length = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int");
- index = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int");
-
- if (Math.abs(index) > size) {
- return nil;
- }
-
- if (index < 0) {
- index += size;
- }
-
- if (length < 0) {
- length += size;
- }
-
- if (!exclude) {
- length += 1;
- }
-
- length = length - index;
-
- if (length < 0) {
- length = 0;
- }
-
- return self.$$cast(self.substr(index, length));
- }
-
-
- if (index.$$is_string) {
- if (length != null) {
- self.$raise($$($nesting, 'TypeError'))
- }
- return self.indexOf(index) !== -1 ? self.$$cast(index) : nil;
- }
-
-
- if (index.$$is_regexp) {
- var match = self.match(index);
-
- if (match === null) {
- ($gvars["~"] = nil)
- return nil;
- }
-
- ($gvars["~"] = $$($nesting, 'MatchData').$new(index, match))
-
- if (length == null) {
- return self.$$cast(match[0]);
- }
-
- length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int");
-
- if (length < 0 && -length < match.length) {
- return self.$$cast(match[length += match.length]);
- }
-
- if (length >= 0 && length < match.length) {
- return self.$$cast(match[length]);
- }
-
- return nil;
- }
-
-
- index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int");
-
- if (index < 0) {
- index += size;
- }
-
- if (length == null) {
- if (index >= size || index < 0) {
- return nil;
- }
- return self.$$cast(self.substr(index, 1));
- }
-
- length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int");
-
- if (length < 0) {
- return nil;
- }
-
- if (index > size || index < 0) {
- return nil;
- }
-
- return self.$$cast(self.substr(index, length));
- ;
- }, $String_$$$11.$$arity = -2);
- Opal.alias(self, "byteslice", "[]");
-
- Opal.def(self, '$b', $String_b$12 = function $$b() {
- var self = this;
-
- return self.$force_encoding("binary")
- }, $String_b$12.$$arity = 0);
-
- Opal.def(self, '$capitalize', $String_capitalize$13 = function $$capitalize() {
- var self = this;
-
- return self.$$cast(self.charAt(0).toUpperCase() + self.substr(1).toLowerCase());
- }, $String_capitalize$13.$$arity = 0);
-
- Opal.def(self, '$casecmp', $String_casecmp$14 = function $$casecmp(other) {
- var self = this;
-
-
- if ($truthy(other['$respond_to?']("to_str"))) {
- } else {
- return nil
- };
- other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str").$to_s();
-
- var ascii_only = /^[\x00-\x7F]*$/;
- if (ascii_only.test(self) && ascii_only.test(other)) {
- self = self.toLowerCase();
- other = other.toLowerCase();
- }
- ;
- return self['$<=>'](other);
- }, $String_casecmp$14.$$arity = 1);
-
- Opal.def(self, '$casecmp?', $String_casecmp$ques$15 = function(other) {
- var self = this;
-
-
- var cmp = self.$casecmp(other);
- if (cmp === nil) {
- return nil;
- } else {
- return cmp === 0;
- }
-
- }, $String_casecmp$ques$15.$$arity = 1);
-
- Opal.def(self, '$center', $String_center$16 = function $$center(width, padstr) {
- var self = this;
-
-
-
- if (padstr == null) {
- padstr = " ";
- };
- width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int");
- padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s();
- if ($truthy(padstr['$empty?']())) {
- self.$raise($$($nesting, 'ArgumentError'), "zero width padding")};
- if ($truthy(width <= self.length)) {
- return self};
-
- var ljustified = self.$ljust($rb_divide($rb_plus(width, self.length), 2).$ceil(), padstr),
- rjustified = self.$rjust($rb_divide($rb_plus(width, self.length), 2).$floor(), padstr);
-
- return self.$$cast(rjustified + ljustified.slice(self.length));
- ;
- }, $String_center$16.$$arity = -2);
-
- Opal.def(self, '$chars', $String_chars$17 = function $$chars() {
- var $iter = $String_chars$17.$$p, block = $iter || nil, self = this;
-
- if ($iter) $String_chars$17.$$p = null;
-
-
- if ($iter) $String_chars$17.$$p = null;;
- if ($truthy(block)) {
- } else {
- return self.$each_char().$to_a()
- };
- return $send(self, 'each_char', [], block.$to_proc());
- }, $String_chars$17.$$arity = 0);
-
- Opal.def(self, '$chomp', $String_chomp$18 = function $$chomp(separator) {
- var self = this;
- if ($gvars["/"] == null) $gvars["/"] = nil;
-
-
-
- if (separator == null) {
- separator = $gvars["/"];
- };
- if ($truthy(separator === nil || self.length === 0)) {
- return self};
- separator = $$($nesting, 'Opal')['$coerce_to!'](separator, $$($nesting, 'String'), "to_str").$to_s();
-
- var result;
-
- if (separator === "\n") {
- result = self.replace(/\r?\n?$/, '');
- }
- else if (separator === "") {
- result = self.replace(/(\r?\n)+$/, '');
- }
- else if (self.length >= separator.length) {
- var tail = self.substr(self.length - separator.length, separator.length);
-
- if (tail === separator) {
- result = self.substr(0, self.length - separator.length);
- }
- }
-
- if (result != null) {
- return self.$$cast(result);
- }
- ;
- return self;
- }, $String_chomp$18.$$arity = -1);
-
- Opal.def(self, '$chop', $String_chop$19 = function $$chop() {
- var self = this;
-
-
- var length = self.length, result;
-
- if (length <= 1) {
- result = "";
- } else if (self.charAt(length - 1) === "\n" && self.charAt(length - 2) === "\r") {
- result = self.substr(0, length - 2);
- } else {
- result = self.substr(0, length - 1);
- }
-
- return self.$$cast(result);
-
- }, $String_chop$19.$$arity = 0);
-
- Opal.def(self, '$chr', $String_chr$20 = function $$chr() {
- var self = this;
-
- return self.charAt(0);
- }, $String_chr$20.$$arity = 0);
-
- Opal.def(self, '$clone', $String_clone$21 = function $$clone() {
- var self = this, copy = nil;
-
-
- copy = self.slice();
- copy.$copy_singleton_methods(self);
- copy.$initialize_clone(self);
- return copy;
- }, $String_clone$21.$$arity = 0);
-
- Opal.def(self, '$dup', $String_dup$22 = function $$dup() {
- var self = this, copy = nil;
-
-
- copy = self.slice();
- copy.$initialize_dup(self);
- return copy;
- }, $String_dup$22.$$arity = 0);
-
- Opal.def(self, '$count', $String_count$23 = function $$count($a) {
- var $post_args, sets, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- sets = $post_args;;
-
- if (sets.length === 0) {
- self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)")
- }
- var char_class = char_class_from_char_sets(sets);
- if (char_class === null) {
- return 0;
- }
- return self.length - self.replace(new RegExp(char_class, 'g'), '').length;
- ;
- }, $String_count$23.$$arity = -1);
-
- Opal.def(self, '$delete', $String_delete$24 = function($a) {
- var $post_args, sets, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- sets = $post_args;;
-
- if (sets.length === 0) {
- self.$raise($$($nesting, 'ArgumentError'), "ArgumentError: wrong number of arguments (0 for 1+)")
- }
- var char_class = char_class_from_char_sets(sets);
- if (char_class === null) {
- return self;
- }
- return self.$$cast(self.replace(new RegExp(char_class, 'g'), ''));
- ;
- }, $String_delete$24.$$arity = -1);
-
- Opal.def(self, '$delete_prefix', $String_delete_prefix$25 = function $$delete_prefix(prefix) {
- var self = this;
-
-
- if (!prefix.$$is_string) {
- (prefix = $$($nesting, 'Opal').$coerce_to(prefix, $$($nesting, 'String'), "to_str"))
- }
-
- if (self.slice(0, prefix.length) === prefix) {
- return self.$$cast(self.slice(prefix.length));
- } else {
- return self;
- }
-
- }, $String_delete_prefix$25.$$arity = 1);
-
- Opal.def(self, '$delete_suffix', $String_delete_suffix$26 = function $$delete_suffix(suffix) {
- var self = this;
-
-
- if (!suffix.$$is_string) {
- (suffix = $$($nesting, 'Opal').$coerce_to(suffix, $$($nesting, 'String'), "to_str"))
- }
-
- if (self.slice(self.length - suffix.length) === suffix) {
- return self.$$cast(self.slice(0, self.length - suffix.length));
- } else {
- return self;
- }
-
- }, $String_delete_suffix$26.$$arity = 1);
-
- Opal.def(self, '$downcase', $String_downcase$27 = function $$downcase() {
- var self = this;
-
- return self.$$cast(self.toLowerCase());
- }, $String_downcase$27.$$arity = 0);
-
- Opal.def(self, '$each_char', $String_each_char$28 = function $$each_char() {
- var $iter = $String_each_char$28.$$p, block = $iter || nil, $$29, self = this;
-
- if ($iter) $String_each_char$28.$$p = null;
-
-
- if ($iter) $String_each_char$28.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each_char"], ($$29 = function(){var self = $$29.$$s || this;
-
- return self.$size()}, $$29.$$s = self, $$29.$$arity = 0, $$29))
- };
-
- for (var i = 0, length = self.length; i < length; i++) {
- Opal.yield1(block, self.charAt(i));
- }
- ;
- return self;
- }, $String_each_char$28.$$arity = 0);
-
- Opal.def(self, '$each_line', $String_each_line$30 = function $$each_line(separator) {
- var $iter = $String_each_line$30.$$p, block = $iter || nil, self = this;
- if ($gvars["/"] == null) $gvars["/"] = nil;
-
- if ($iter) $String_each_line$30.$$p = null;
-
-
- if ($iter) $String_each_line$30.$$p = null;;
-
- if (separator == null) {
- separator = $gvars["/"];
- };
- if ((block !== nil)) {
- } else {
- return self.$enum_for("each_line", separator)
- };
-
- if (separator === nil) {
- Opal.yield1(block, self);
-
- return self;
- }
-
- separator = $$($nesting, 'Opal').$coerce_to(separator, $$($nesting, 'String'), "to_str")
-
- var a, i, n, length, chomped, trailing, splitted;
-
- if (separator.length === 0) {
- for (a = self.split(/(\n{2,})/), i = 0, n = a.length; i < n; i += 2) {
- if (a[i] || a[i + 1]) {
- var value = (a[i] || "") + (a[i + 1] || "");
- Opal.yield1(block, self.$$cast(value));
- }
- }
-
- return self;
- }
-
- chomped = self.$chomp(separator);
- trailing = self.length != chomped.length;
- splitted = chomped.split(separator);
-
- for (i = 0, length = splitted.length; i < length; i++) {
- if (i < length - 1 || trailing) {
- Opal.yield1(block, self.$$cast(splitted[i] + separator));
- }
- else {
- Opal.yield1(block, self.$$cast(splitted[i]));
- }
- }
- ;
- return self;
- }, $String_each_line$30.$$arity = -1);
-
- Opal.def(self, '$empty?', $String_empty$ques$31 = function() {
- var self = this;
-
- return self.length === 0;
- }, $String_empty$ques$31.$$arity = 0);
-
- Opal.def(self, '$end_with?', $String_end_with$ques$32 = function($a) {
- var $post_args, suffixes, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- suffixes = $post_args;;
-
- for (var i = 0, length = suffixes.length; i < length; i++) {
- var suffix = $$($nesting, 'Opal').$coerce_to(suffixes[i], $$($nesting, 'String'), "to_str").$to_s();
-
- if (self.length >= suffix.length &&
- self.substr(self.length - suffix.length, suffix.length) == suffix) {
- return true;
- }
- }
- ;
- return false;
- }, $String_end_with$ques$32.$$arity = -1);
- Opal.alias(self, "equal?", "===");
-
- Opal.def(self, '$gsub', $String_gsub$33 = function $$gsub(pattern, replacement) {
- var $iter = $String_gsub$33.$$p, block = $iter || nil, self = this;
-
- if ($iter) $String_gsub$33.$$p = null;
-
-
- if ($iter) $String_gsub$33.$$p = null;;
- ;
-
- if (replacement === undefined && block === nil) {
- return self.$enum_for("gsub", pattern);
- }
-
- var result = '', match_data = nil, index = 0, match, _replacement;
-
- if (pattern.$$is_regexp) {
- pattern = Opal.global_multiline_regexp(pattern);
- } else {
- pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str");
- pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm');
- }
-
- var lastIndex;
- while (true) {
- match = pattern.exec(self);
-
- if (match === null) {
- ($gvars["~"] = nil)
- result += self.slice(index);
- break;
- }
-
- match_data = $$($nesting, 'MatchData').$new(pattern, match);
-
- if (replacement === undefined) {
- lastIndex = pattern.lastIndex;
- _replacement = block(match[0]);
- pattern.lastIndex = lastIndex; // save and restore lastIndex
- }
- else if (replacement.$$is_hash) {
- _replacement = (replacement)['$[]'](match[0]).$to_s();
- }
- else {
- if (!replacement.$$is_string) {
- replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str");
- }
- _replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) {
- if (slashes.length % 2 === 0) {
- return original;
- }
- switch (command) {
- case "+":
- for (var i = match.length - 1; i > 0; i--) {
- if (match[i] !== undefined) {
- return slashes.slice(1) + match[i];
- }
- }
- return '';
- case "&": return slashes.slice(1) + match[0];
- case "`": return slashes.slice(1) + self.slice(0, match.index);
- case "'": return slashes.slice(1) + self.slice(match.index + match[0].length);
- default: return slashes.slice(1) + (match[command] || '');
- }
- }).replace(/\\\\/g, '\\');
- }
-
- if (pattern.lastIndex === match.index) {
- result += (_replacement + self.slice(index, match.index + 1))
- pattern.lastIndex += 1;
- }
- else {
- result += (self.slice(index, match.index) + _replacement)
- }
- index = pattern.lastIndex;
- }
-
- ($gvars["~"] = match_data)
- return self.$$cast(result);
- ;
- }, $String_gsub$33.$$arity = -2);
-
- Opal.def(self, '$hash', $String_hash$34 = function $$hash() {
- var self = this;
-
- return self.toString();
- }, $String_hash$34.$$arity = 0);
-
- Opal.def(self, '$hex', $String_hex$35 = function $$hex() {
- var self = this;
-
- return self.$to_i(16)
- }, $String_hex$35.$$arity = 0);
-
- Opal.def(self, '$include?', $String_include$ques$36 = function(other) {
- var self = this;
-
-
- if (!other.$$is_string) {
- (other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'String'), "to_str"))
- }
- return self.indexOf(other) !== -1;
-
- }, $String_include$ques$36.$$arity = 1);
-
- Opal.def(self, '$index', $String_index$37 = function $$index(search, offset) {
- var self = this;
-
-
- ;
-
- var index,
- match,
- regex;
-
- if (offset === undefined) {
- offset = 0;
- } else {
- offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int");
- if (offset < 0) {
- offset += self.length;
- if (offset < 0) {
- return nil;
- }
- }
- }
-
- if (search.$$is_regexp) {
- regex = Opal.global_multiline_regexp(search);
- while (true) {
- match = regex.exec(self);
- if (match === null) {
- ($gvars["~"] = nil);
- index = -1;
- break;
- }
- if (match.index >= offset) {
- ($gvars["~"] = $$($nesting, 'MatchData').$new(regex, match))
- index = match.index;
- break;
- }
- regex.lastIndex = match.index + 1;
- }
- } else {
- search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str");
- if (search.length === 0 && offset > self.length) {
- index = -1;
- } else {
- index = self.indexOf(search, offset);
- }
- }
-
- return index === -1 ? nil : index;
- ;
- }, $String_index$37.$$arity = -2);
-
- Opal.def(self, '$inspect', $String_inspect$38 = function $$inspect() {
- var self = this;
-
-
- var escapable = /[\\\"\x00-\x1f\u007F-\u009F\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
- meta = {
- '\u0007': '\\a',
- '\u001b': '\\e',
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '\v': '\\v',
- '"' : '\\"',
- '\\': '\\\\'
- },
- escaped = self.replace(escapable, function (chr) {
- return meta[chr] || '\\u' + ('0000' + chr.charCodeAt(0).toString(16).toUpperCase()).slice(-4);
- });
- return '"' + escaped.replace(/\#[\$\@\{]/g, '\\$&') + '"';
-
- }, $String_inspect$38.$$arity = 0);
-
- Opal.def(self, '$intern', $String_intern$39 = function $$intern() {
- var self = this;
-
- return self.toString();
- }, $String_intern$39.$$arity = 0);
-
- Opal.def(self, '$lines', $String_lines$40 = function $$lines(separator) {
- var $iter = $String_lines$40.$$p, block = $iter || nil, self = this, e = nil;
- if ($gvars["/"] == null) $gvars["/"] = nil;
-
- if ($iter) $String_lines$40.$$p = null;
-
-
- if ($iter) $String_lines$40.$$p = null;;
-
- if (separator == null) {
- separator = $gvars["/"];
- };
- e = $send(self, 'each_line', [separator], block.$to_proc());
- if ($truthy(block)) {
- return self
- } else {
- return e.$to_a()
- };
- }, $String_lines$40.$$arity = -1);
-
- Opal.def(self, '$length', $String_length$41 = function $$length() {
- var self = this;
-
- return self.length;
- }, $String_length$41.$$arity = 0);
-
- Opal.def(self, '$ljust', $String_ljust$42 = function $$ljust(width, padstr) {
- var self = this;
-
-
-
- if (padstr == null) {
- padstr = " ";
- };
- width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int");
- padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s();
- if ($truthy(padstr['$empty?']())) {
- self.$raise($$($nesting, 'ArgumentError'), "zero width padding")};
- if ($truthy(width <= self.length)) {
- return self};
-
- var index = -1,
- result = "";
-
- width -= self.length;
-
- while (++index < width) {
- result += padstr;
- }
-
- return self.$$cast(self + result.slice(0, width));
- ;
- }, $String_ljust$42.$$arity = -2);
-
- Opal.def(self, '$lstrip', $String_lstrip$43 = function $$lstrip() {
- var self = this;
-
- return self.replace(/^\s*/, '');
- }, $String_lstrip$43.$$arity = 0);
-
- Opal.def(self, '$ascii_only?', $String_ascii_only$ques$44 = function() {
- var self = this;
-
- return self.match(/[ -~\n]*/)[0] === self;
- }, $String_ascii_only$ques$44.$$arity = 0);
-
- Opal.def(self, '$match', $String_match$45 = function $$match(pattern, pos) {
- var $iter = $String_match$45.$$p, block = $iter || nil, $a, self = this;
-
- if ($iter) $String_match$45.$$p = null;
-
-
- if ($iter) $String_match$45.$$p = null;;
- ;
- if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) {
- pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())};
- if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)")
- };
- return $send(pattern, 'match', [self, pos], block.$to_proc());
- }, $String_match$45.$$arity = -2);
-
- Opal.def(self, '$match?', $String_match$ques$46 = function(pattern, pos) {
- var $a, self = this;
-
-
- ;
- if ($truthy(($truthy($a = $$($nesting, 'String')['$==='](pattern)) ? $a : pattern['$respond_to?']("to_str")))) {
- pattern = $$($nesting, 'Regexp').$new(pattern.$to_str())};
- if ($truthy($$($nesting, 'Regexp')['$==='](pattern))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + (pattern.$class()) + " (expected Regexp)")
- };
- return pattern['$match?'](self, pos);
- }, $String_match$ques$46.$$arity = -2);
-
- Opal.def(self, '$next', $String_next$47 = function $$next() {
- var self = this;
-
-
- var i = self.length;
- if (i === 0) {
- return self.$$cast('');
- }
- var result = self;
- var first_alphanum_char_index = self.search(/[a-zA-Z0-9]/);
- var carry = false;
- var code;
- while (i--) {
- code = self.charCodeAt(i);
- if ((code >= 48 && code <= 57) ||
- (code >= 65 && code <= 90) ||
- (code >= 97 && code <= 122)) {
- switch (code) {
- case 57:
- carry = true;
- code = 48;
- break;
- case 90:
- carry = true;
- code = 65;
- break;
- case 122:
- carry = true;
- code = 97;
- break;
- default:
- carry = false;
- code += 1;
- }
- } else {
- if (first_alphanum_char_index === -1) {
- if (code === 255) {
- carry = true;
- code = 0;
- } else {
- carry = false;
- code += 1;
- }
- } else {
- carry = true;
- }
- }
- result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i + 1);
- if (carry && (i === 0 || i === first_alphanum_char_index)) {
- switch (code) {
- case 65:
- break;
- case 97:
- break;
- default:
- code += 1;
- }
- if (i === 0) {
- result = String.fromCharCode(code) + result;
- } else {
- result = result.slice(0, i) + String.fromCharCode(code) + result.slice(i);
- }
- carry = false;
- }
- if (!carry) {
- break;
- }
- }
- return self.$$cast(result);
-
- }, $String_next$47.$$arity = 0);
-
- Opal.def(self, '$oct', $String_oct$48 = function $$oct() {
- var self = this;
-
-
- var result,
- string = self,
- radix = 8;
-
- if (/^\s*_/.test(string)) {
- return 0;
- }
-
- string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/i, function (original, head, flag, tail) {
- switch (tail.charAt(0)) {
- case '+':
- case '-':
- return original;
- case '0':
- if (tail.charAt(1) === 'x' && flag === '0x') {
- return original;
- }
- }
- switch (flag) {
- case '0b':
- radix = 2;
- break;
- case '0':
- case '0o':
- radix = 8;
- break;
- case '0d':
- radix = 10;
- break;
- case '0x':
- radix = 16;
- break;
- }
- return head + tail;
- });
-
- result = parseInt(string.replace(/_(?!_)/g, ''), radix);
- return isNaN(result) ? 0 : result;
-
- }, $String_oct$48.$$arity = 0);
-
- Opal.def(self, '$ord', $String_ord$49 = function $$ord() {
- var self = this;
-
- return self.charCodeAt(0);
- }, $String_ord$49.$$arity = 0);
-
- Opal.def(self, '$partition', $String_partition$50 = function $$partition(sep) {
- var self = this;
-
-
- var i, m;
-
- if (sep.$$is_regexp) {
- m = sep.exec(self);
- if (m === null) {
- i = -1;
- } else {
- $$($nesting, 'MatchData').$new(sep, m);
- sep = m[0];
- i = m.index;
- }
- } else {
- sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str");
- i = self.indexOf(sep);
- }
-
- if (i === -1) {
- return [self, '', ''];
- }
-
- return [
- self.slice(0, i),
- self.slice(i, i + sep.length),
- self.slice(i + sep.length)
- ];
-
- }, $String_partition$50.$$arity = 1);
-
- Opal.def(self, '$reverse', $String_reverse$51 = function $$reverse() {
- var self = this;
-
- return self.split('').reverse().join('');
- }, $String_reverse$51.$$arity = 0);
-
- Opal.def(self, '$rindex', $String_rindex$52 = function $$rindex(search, offset) {
- var self = this;
-
-
- ;
-
- var i, m, r, _m;
-
- if (offset === undefined) {
- offset = self.length;
- } else {
- offset = $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int");
- if (offset < 0) {
- offset += self.length;
- if (offset < 0) {
- return nil;
- }
- }
- }
-
- if (search.$$is_regexp) {
- m = null;
- r = Opal.global_multiline_regexp(search);
- while (true) {
- _m = r.exec(self);
- if (_m === null || _m.index > offset) {
- break;
- }
- m = _m;
- r.lastIndex = m.index + 1;
- }
- if (m === null) {
- ($gvars["~"] = nil)
- i = -1;
- } else {
- $$($nesting, 'MatchData').$new(r, m);
- i = m.index;
- }
- } else {
- search = $$($nesting, 'Opal').$coerce_to(search, $$($nesting, 'String'), "to_str");
- i = self.lastIndexOf(search, offset);
- }
-
- return i === -1 ? nil : i;
- ;
- }, $String_rindex$52.$$arity = -2);
-
- Opal.def(self, '$rjust', $String_rjust$53 = function $$rjust(width, padstr) {
- var self = this;
-
-
-
- if (padstr == null) {
- padstr = " ";
- };
- width = $$($nesting, 'Opal').$coerce_to(width, $$($nesting, 'Integer'), "to_int");
- padstr = $$($nesting, 'Opal').$coerce_to(padstr, $$($nesting, 'String'), "to_str").$to_s();
- if ($truthy(padstr['$empty?']())) {
- self.$raise($$($nesting, 'ArgumentError'), "zero width padding")};
- if ($truthy(width <= self.length)) {
- return self};
-
- var chars = Math.floor(width - self.length),
- patterns = Math.floor(chars / padstr.length),
- result = Array(patterns + 1).join(padstr),
- remaining = chars - result.length;
-
- return self.$$cast(result + padstr.slice(0, remaining) + self);
- ;
- }, $String_rjust$53.$$arity = -2);
-
- Opal.def(self, '$rpartition', $String_rpartition$54 = function $$rpartition(sep) {
- var self = this;
-
-
- var i, m, r, _m;
-
- if (sep.$$is_regexp) {
- m = null;
- r = Opal.global_multiline_regexp(sep);
-
- while (true) {
- _m = r.exec(self);
- if (_m === null) {
- break;
- }
- m = _m;
- r.lastIndex = m.index + 1;
- }
-
- if (m === null) {
- i = -1;
- } else {
- $$($nesting, 'MatchData').$new(r, m);
- sep = m[0];
- i = m.index;
- }
-
- } else {
- sep = $$($nesting, 'Opal').$coerce_to(sep, $$($nesting, 'String'), "to_str");
- i = self.lastIndexOf(sep);
- }
-
- if (i === -1) {
- return ['', '', self];
- }
-
- return [
- self.slice(0, i),
- self.slice(i, i + sep.length),
- self.slice(i + sep.length)
- ];
-
- }, $String_rpartition$54.$$arity = 1);
-
- Opal.def(self, '$rstrip', $String_rstrip$55 = function $$rstrip() {
- var self = this;
-
- return self.replace(/[\s\u0000]*$/, '');
- }, $String_rstrip$55.$$arity = 0);
-
- Opal.def(self, '$scan', $String_scan$56 = function $$scan(pattern) {
- var $iter = $String_scan$56.$$p, block = $iter || nil, self = this;
-
- if ($iter) $String_scan$56.$$p = null;
-
-
- if ($iter) $String_scan$56.$$p = null;;
-
- var result = [],
- match_data = nil,
- match;
-
- if (pattern.$$is_regexp) {
- pattern = Opal.global_multiline_regexp(pattern);
- } else {
- pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str");
- pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm');
- }
-
- while ((match = pattern.exec(self)) != null) {
- match_data = $$($nesting, 'MatchData').$new(pattern, match);
- if (block === nil) {
- match.length == 1 ? result.push(match[0]) : result.push((match_data).$captures());
- } else {
- match.length == 1 ? block(match[0]) : block.call(self, (match_data).$captures());
- }
- if (pattern.lastIndex === match.index) {
- pattern.lastIndex += 1;
- }
- }
-
- ($gvars["~"] = match_data)
-
- return (block !== nil ? self : result);
- ;
- }, $String_scan$56.$$arity = 1);
- Opal.alias(self, "size", "length");
- Opal.alias(self, "slice", "[]");
-
- Opal.def(self, '$split', $String_split$57 = function $$split(pattern, limit) {
- var $a, self = this;
- if ($gvars[";"] == null) $gvars[";"] = nil;
-
-
- ;
- ;
-
- if (self.length === 0) {
- return [];
- }
-
- if (limit === undefined) {
- limit = 0;
- } else {
- limit = $$($nesting, 'Opal')['$coerce_to!'](limit, $$($nesting, 'Integer'), "to_int");
- if (limit === 1) {
- return [self];
- }
- }
-
- if (pattern === undefined || pattern === nil) {
- pattern = ($truthy($a = $gvars[";"]) ? $a : " ");
- }
-
- var result = [],
- string = self.toString(),
- index = 0,
- match,
- i, ii;
-
- if (pattern.$$is_regexp) {
- pattern = Opal.global_multiline_regexp(pattern);
- } else {
- pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str").$to_s();
- if (pattern === ' ') {
- pattern = /\s+/gm;
- string = string.replace(/^\s+/, '');
- } else {
- pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gm');
- }
- }
-
- result = string.split(pattern);
-
- if (result.length === 1 && result[0] === string) {
- return [self.$$cast(result[0])];
- }
-
- while ((i = result.indexOf(undefined)) !== -1) {
- result.splice(i, 1);
- }
-
- function castResult() {
- for (i = 0; i < result.length; i++) {
- result[i] = self.$$cast(result[i]);
- }
- }
-
- if (limit === 0) {
- while (result[result.length - 1] === '') {
- result.length -= 1;
- }
- castResult();
- return result;
- }
-
- match = pattern.exec(string);
-
- if (limit < 0) {
- if (match !== null && match[0] === '' && pattern.source.indexOf('(?=') === -1) {
- for (i = 0, ii = match.length; i < ii; i++) {
- result.push('');
- }
- }
- castResult();
- return result;
- }
-
- if (match !== null && match[0] === '') {
- result.splice(limit - 1, result.length - 1, result.slice(limit - 1).join(''));
- castResult();
- return result;
- }
-
- if (limit >= result.length) {
- castResult();
- return result;
- }
-
- i = 0;
- while (match !== null) {
- i++;
- index = pattern.lastIndex;
- if (i + 1 === limit) {
- break;
- }
- match = pattern.exec(string);
- }
- result.splice(limit - 1, result.length - 1, string.slice(index));
- castResult();
- return result;
- ;
- }, $String_split$57.$$arity = -1);
-
- Opal.def(self, '$squeeze', $String_squeeze$58 = function $$squeeze($a) {
- var $post_args, sets, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- sets = $post_args;;
-
- if (sets.length === 0) {
- return self.$$cast(self.replace(/(.)\1+/g, '$1'));
- }
- var char_class = char_class_from_char_sets(sets);
- if (char_class === null) {
- return self;
- }
- return self.$$cast(self.replace(new RegExp('(' + char_class + ')\\1+', 'g'), '$1'));
- ;
- }, $String_squeeze$58.$$arity = -1);
-
- Opal.def(self, '$start_with?', $String_start_with$ques$59 = function($a) {
- var $post_args, prefixes, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- prefixes = $post_args;;
-
- for (var i = 0, length = prefixes.length; i < length; i++) {
- var prefix = $$($nesting, 'Opal').$coerce_to(prefixes[i], $$($nesting, 'String'), "to_str").$to_s();
-
- if (self.indexOf(prefix) === 0) {
- return true;
- }
- }
-
- return false;
- ;
- }, $String_start_with$ques$59.$$arity = -1);
-
- Opal.def(self, '$strip', $String_strip$60 = function $$strip() {
- var self = this;
-
- return self.replace(/^\s*/, '').replace(/[\s\u0000]*$/, '');
- }, $String_strip$60.$$arity = 0);
-
- Opal.def(self, '$sub', $String_sub$61 = function $$sub(pattern, replacement) {
- var $iter = $String_sub$61.$$p, block = $iter || nil, self = this;
-
- if ($iter) $String_sub$61.$$p = null;
-
-
- if ($iter) $String_sub$61.$$p = null;;
- ;
-
- if (!pattern.$$is_regexp) {
- pattern = $$($nesting, 'Opal').$coerce_to(pattern, $$($nesting, 'String'), "to_str");
- pattern = new RegExp(pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
- }
-
- var result, match = pattern.exec(self);
-
- if (match === null) {
- ($gvars["~"] = nil)
- result = self.toString();
- } else {
- $$($nesting, 'MatchData').$new(pattern, match)
-
- if (replacement === undefined) {
-
- if (block === nil) {
- self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 2)")
- }
- result = self.slice(0, match.index) + block(match[0]) + self.slice(match.index + match[0].length);
-
- } else if (replacement.$$is_hash) {
-
- result = self.slice(0, match.index) + (replacement)['$[]'](match[0]).$to_s() + self.slice(match.index + match[0].length);
-
- } else {
-
- replacement = $$($nesting, 'Opal').$coerce_to(replacement, $$($nesting, 'String'), "to_str");
-
- replacement = replacement.replace(/([\\]+)([0-9+&`'])/g, function (original, slashes, command) {
- if (slashes.length % 2 === 0) {
- return original;
- }
- switch (command) {
- case "+":
- for (var i = match.length - 1; i > 0; i--) {
- if (match[i] !== undefined) {
- return slashes.slice(1) + match[i];
- }
- }
- return '';
- case "&": return slashes.slice(1) + match[0];
- case "`": return slashes.slice(1) + self.slice(0, match.index);
- case "'": return slashes.slice(1) + self.slice(match.index + match[0].length);
- default: return slashes.slice(1) + (match[command] || '');
- }
- }).replace(/\\\\/g, '\\');
-
- result = self.slice(0, match.index) + replacement + self.slice(match.index + match[0].length);
- }
- }
-
- return self.$$cast(result);
- ;
- }, $String_sub$61.$$arity = -2);
- Opal.alias(self, "succ", "next");
-
- Opal.def(self, '$sum', $String_sum$62 = function $$sum(n) {
- var self = this;
-
-
-
- if (n == null) {
- n = 16;
- };
-
- n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int");
-
- var result = 0,
- length = self.length,
- i = 0;
-
- for (; i < length; i++) {
- result += self.charCodeAt(i);
- }
-
- if (n <= 0) {
- return result;
- }
-
- return result & (Math.pow(2, n) - 1);
- ;
- }, $String_sum$62.$$arity = -1);
-
- Opal.def(self, '$swapcase', $String_swapcase$63 = function $$swapcase() {
- var self = this;
-
-
- var str = self.replace(/([a-z]+)|([A-Z]+)/g, function($0,$1,$2) {
- return $1 ? $0.toUpperCase() : $0.toLowerCase();
- });
-
- if (self.constructor === String) {
- return str;
- }
-
- return self.$class().$new(str);
-
- }, $String_swapcase$63.$$arity = 0);
-
- Opal.def(self, '$to_f', $String_to_f$64 = function $$to_f() {
- var self = this;
-
-
- if (self.charAt(0) === '_') {
- return 0;
- }
-
- var result = parseFloat(self.replace(/_/g, ''));
-
- if (isNaN(result) || result == Infinity || result == -Infinity) {
- return 0;
- }
- else {
- return result;
- }
-
- }, $String_to_f$64.$$arity = 0);
-
- Opal.def(self, '$to_i', $String_to_i$65 = function $$to_i(base) {
- var self = this;
-
-
-
- if (base == null) {
- base = 10;
- };
-
- var result,
- string = self.toLowerCase(),
- radix = $$($nesting, 'Opal').$coerce_to(base, $$($nesting, 'Integer'), "to_int");
-
- if (radix === 1 || radix < 0 || radix > 36) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (radix))
- }
-
- if (/^\s*_/.test(string)) {
- return 0;
- }
-
- string = string.replace(/^(\s*[+-]?)(0[bodx]?)(.+)$/, function (original, head, flag, tail) {
- switch (tail.charAt(0)) {
- case '+':
- case '-':
- return original;
- case '0':
- if (tail.charAt(1) === 'x' && flag === '0x' && (radix === 0 || radix === 16)) {
- return original;
- }
- }
- switch (flag) {
- case '0b':
- if (radix === 0 || radix === 2) {
- radix = 2;
- return head + tail;
- }
- break;
- case '0':
- case '0o':
- if (radix === 0 || radix === 8) {
- radix = 8;
- return head + tail;
- }
- break;
- case '0d':
- if (radix === 0 || radix === 10) {
- radix = 10;
- return head + tail;
- }
- break;
- case '0x':
- if (radix === 0 || radix === 16) {
- radix = 16;
- return head + tail;
- }
- break;
- }
- return original
- });
-
- result = parseInt(string.replace(/_(?!_)/g, ''), radix);
- return isNaN(result) ? 0 : result;
- ;
- }, $String_to_i$65.$$arity = -1);
-
- Opal.def(self, '$to_proc', $String_to_proc$66 = function $$to_proc() {
- var $$67, $iter = $String_to_proc$66.$$p, $yield = $iter || nil, self = this, method_name = nil;
-
- if ($iter) $String_to_proc$66.$$p = null;
-
- method_name = $rb_plus("$", self.valueOf());
- return $send(self, 'proc', [], ($$67 = function($a){var self = $$67.$$s || this, $iter = $$67.$$p, block = $iter || nil, $post_args, args;
-
-
-
- if ($iter) $$67.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- if (args.length === 0) {
- self.$raise($$($nesting, 'ArgumentError'), "no receiver given")
- }
-
- var recv = args[0];
-
- if (recv == null) recv = nil;
-
- var body = recv[method_name];
-
- if (!body) {
- return recv.$method_missing.apply(recv, args);
- }
-
- if (typeof block === 'function') {
- body.$$p = block;
- }
-
- if (args.length === 1) {
- return body.call(recv);
- } else {
- return body.apply(recv, args.slice(1));
- }
- ;}, $$67.$$s = self, $$67.$$arity = -1, $$67));
- }, $String_to_proc$66.$$arity = 0);
-
- Opal.def(self, '$to_s', $String_to_s$68 = function $$to_s() {
- var self = this;
-
- return self.toString();
- }, $String_to_s$68.$$arity = 0);
- Opal.alias(self, "to_str", "to_s");
- Opal.alias(self, "to_sym", "intern");
-
- Opal.def(self, '$tr', $String_tr$69 = function $$tr(from, to) {
- var self = this;
-
-
- from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s();
- to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s();
-
- if (from.length == 0 || from === to) {
- return self;
- }
-
- var i, in_range, c, ch, start, end, length;
- var subs = {};
- var from_chars = from.split('');
- var from_length = from_chars.length;
- var to_chars = to.split('');
- var to_length = to_chars.length;
-
- var inverse = false;
- var global_sub = null;
- if (from_chars[0] === '^' && from_chars.length > 1) {
- inverse = true;
- from_chars.shift();
- global_sub = to_chars[to_length - 1]
- from_length -= 1;
- }
-
- var from_chars_expanded = [];
- var last_from = null;
- in_range = false;
- for (i = 0; i < from_length; i++) {
- ch = from_chars[i];
- if (last_from == null) {
- last_from = ch;
- from_chars_expanded.push(ch);
- }
- else if (ch === '-') {
- if (last_from === '-') {
- from_chars_expanded.push('-');
- from_chars_expanded.push('-');
- }
- else if (i == from_length - 1) {
- from_chars_expanded.push('-');
- }
- else {
- in_range = true;
- }
- }
- else if (in_range) {
- start = last_from.charCodeAt(0);
- end = ch.charCodeAt(0);
- if (start > end) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration")
- }
- for (c = start + 1; c < end; c++) {
- from_chars_expanded.push(String.fromCharCode(c));
- }
- from_chars_expanded.push(ch);
- in_range = null;
- last_from = null;
- }
- else {
- from_chars_expanded.push(ch);
- }
- }
-
- from_chars = from_chars_expanded;
- from_length = from_chars.length;
-
- if (inverse) {
- for (i = 0; i < from_length; i++) {
- subs[from_chars[i]] = true;
- }
- }
- else {
- if (to_length > 0) {
- var to_chars_expanded = [];
- var last_to = null;
- in_range = false;
- for (i = 0; i < to_length; i++) {
- ch = to_chars[i];
- if (last_to == null) {
- last_to = ch;
- to_chars_expanded.push(ch);
- }
- else if (ch === '-') {
- if (last_to === '-') {
- to_chars_expanded.push('-');
- to_chars_expanded.push('-');
- }
- else if (i == to_length - 1) {
- to_chars_expanded.push('-');
- }
- else {
- in_range = true;
- }
- }
- else if (in_range) {
- start = last_to.charCodeAt(0);
- end = ch.charCodeAt(0);
- if (start > end) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration")
- }
- for (c = start + 1; c < end; c++) {
- to_chars_expanded.push(String.fromCharCode(c));
- }
- to_chars_expanded.push(ch);
- in_range = null;
- last_to = null;
- }
- else {
- to_chars_expanded.push(ch);
- }
- }
-
- to_chars = to_chars_expanded;
- to_length = to_chars.length;
- }
-
- var length_diff = from_length - to_length;
- if (length_diff > 0) {
- var pad_char = (to_length > 0 ? to_chars[to_length - 1] : '');
- for (i = 0; i < length_diff; i++) {
- to_chars.push(pad_char);
- }
- }
-
- for (i = 0; i < from_length; i++) {
- subs[from_chars[i]] = to_chars[i];
- }
- }
-
- var new_str = ''
- for (i = 0, length = self.length; i < length; i++) {
- ch = self.charAt(i);
- var sub = subs[ch];
- if (inverse) {
- new_str += (sub == null ? global_sub : ch);
- }
- else {
- new_str += (sub != null ? sub : ch);
- }
- }
- return self.$$cast(new_str);
- ;
- }, $String_tr$69.$$arity = 2);
-
- Opal.def(self, '$tr_s', $String_tr_s$70 = function $$tr_s(from, to) {
- var self = this;
-
-
- from = $$($nesting, 'Opal').$coerce_to(from, $$($nesting, 'String'), "to_str").$to_s();
- to = $$($nesting, 'Opal').$coerce_to(to, $$($nesting, 'String'), "to_str").$to_s();
-
- if (from.length == 0) {
- return self;
- }
-
- var i, in_range, c, ch, start, end, length;
- var subs = {};
- var from_chars = from.split('');
- var from_length = from_chars.length;
- var to_chars = to.split('');
- var to_length = to_chars.length;
-
- var inverse = false;
- var global_sub = null;
- if (from_chars[0] === '^' && from_chars.length > 1) {
- inverse = true;
- from_chars.shift();
- global_sub = to_chars[to_length - 1]
- from_length -= 1;
- }
-
- var from_chars_expanded = [];
- var last_from = null;
- in_range = false;
- for (i = 0; i < from_length; i++) {
- ch = from_chars[i];
- if (last_from == null) {
- last_from = ch;
- from_chars_expanded.push(ch);
- }
- else if (ch === '-') {
- if (last_from === '-') {
- from_chars_expanded.push('-');
- from_chars_expanded.push('-');
- }
- else if (i == from_length - 1) {
- from_chars_expanded.push('-');
- }
- else {
- in_range = true;
- }
- }
- else if (in_range) {
- start = last_from.charCodeAt(0);
- end = ch.charCodeAt(0);
- if (start > end) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration")
- }
- for (c = start + 1; c < end; c++) {
- from_chars_expanded.push(String.fromCharCode(c));
- }
- from_chars_expanded.push(ch);
- in_range = null;
- last_from = null;
- }
- else {
- from_chars_expanded.push(ch);
- }
- }
-
- from_chars = from_chars_expanded;
- from_length = from_chars.length;
-
- if (inverse) {
- for (i = 0; i < from_length; i++) {
- subs[from_chars[i]] = true;
- }
- }
- else {
- if (to_length > 0) {
- var to_chars_expanded = [];
- var last_to = null;
- in_range = false;
- for (i = 0; i < to_length; i++) {
- ch = to_chars[i];
- if (last_from == null) {
- last_from = ch;
- to_chars_expanded.push(ch);
- }
- else if (ch === '-') {
- if (last_to === '-') {
- to_chars_expanded.push('-');
- to_chars_expanded.push('-');
- }
- else if (i == to_length - 1) {
- to_chars_expanded.push('-');
- }
- else {
- in_range = true;
- }
- }
- else if (in_range) {
- start = last_from.charCodeAt(0);
- end = ch.charCodeAt(0);
- if (start > end) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (String.fromCharCode(start)) + "-" + (String.fromCharCode(end)) + "\" in string transliteration")
- }
- for (c = start + 1; c < end; c++) {
- to_chars_expanded.push(String.fromCharCode(c));
- }
- to_chars_expanded.push(ch);
- in_range = null;
- last_from = null;
- }
- else {
- to_chars_expanded.push(ch);
- }
- }
-
- to_chars = to_chars_expanded;
- to_length = to_chars.length;
- }
-
- var length_diff = from_length - to_length;
- if (length_diff > 0) {
- var pad_char = (to_length > 0 ? to_chars[to_length - 1] : '');
- for (i = 0; i < length_diff; i++) {
- to_chars.push(pad_char);
- }
- }
-
- for (i = 0; i < from_length; i++) {
- subs[from_chars[i]] = to_chars[i];
- }
- }
- var new_str = ''
- var last_substitute = null
- for (i = 0, length = self.length; i < length; i++) {
- ch = self.charAt(i);
- var sub = subs[ch]
- if (inverse) {
- if (sub == null) {
- if (last_substitute == null) {
- new_str += global_sub;
- last_substitute = true;
- }
- }
- else {
- new_str += ch;
- last_substitute = null;
- }
- }
- else {
- if (sub != null) {
- if (last_substitute == null || last_substitute !== sub) {
- new_str += sub;
- last_substitute = sub;
- }
- }
- else {
- new_str += ch;
- last_substitute = null;
- }
- }
- }
- return self.$$cast(new_str);
- ;
- }, $String_tr_s$70.$$arity = 2);
-
- Opal.def(self, '$upcase', $String_upcase$71 = function $$upcase() {
- var self = this;
-
- return self.$$cast(self.toUpperCase());
- }, $String_upcase$71.$$arity = 0);
-
- Opal.def(self, '$upto', $String_upto$72 = function $$upto(stop, excl) {
- var $iter = $String_upto$72.$$p, block = $iter || nil, self = this;
-
- if ($iter) $String_upto$72.$$p = null;
-
-
- if ($iter) $String_upto$72.$$p = null;;
-
- if (excl == null) {
- excl = false;
- };
- if ((block !== nil)) {
- } else {
- return self.$enum_for("upto", stop, excl)
- };
- stop = $$($nesting, 'Opal').$coerce_to(stop, $$($nesting, 'String'), "to_str");
-
- var a, b, s = self.toString();
-
- if (s.length === 1 && stop.length === 1) {
-
- a = s.charCodeAt(0);
- b = stop.charCodeAt(0);
-
- while (a <= b) {
- if (excl && a === b) {
- break;
- }
-
- block(String.fromCharCode(a));
-
- a += 1;
- }
-
- } else if (parseInt(s, 10).toString() === s && parseInt(stop, 10).toString() === stop) {
-
- a = parseInt(s, 10);
- b = parseInt(stop, 10);
-
- while (a <= b) {
- if (excl && a === b) {
- break;
- }
-
- block(a.toString());
-
- a += 1;
- }
-
- } else {
-
- while (s.length <= stop.length && s <= stop) {
- if (excl && s === stop) {
- break;
- }
-
- block(s);
-
- s = (s).$succ();
- }
-
- }
- return self;
- ;
- }, $String_upto$72.$$arity = -2);
-
- function char_class_from_char_sets(sets) {
- function explode_sequences_in_character_set(set) {
- var result = '',
- i, len = set.length,
- curr_char,
- skip_next_dash,
- char_code_from,
- char_code_upto,
- char_code;
- for (i = 0; i < len; i++) {
- curr_char = set.charAt(i);
- if (curr_char === '-' && i > 0 && i < (len - 1) && !skip_next_dash) {
- char_code_from = set.charCodeAt(i - 1);
- char_code_upto = set.charCodeAt(i + 1);
- if (char_code_from > char_code_upto) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid range \"" + (char_code_from) + "-" + (char_code_upto) + "\" in string transliteration")
- }
- for (char_code = char_code_from + 1; char_code < char_code_upto + 1; char_code++) {
- result += String.fromCharCode(char_code);
- }
- skip_next_dash = true;
- i++;
- } else {
- skip_next_dash = (curr_char === '\\');
- result += curr_char;
- }
- }
- return result;
- }
-
- function intersection(setA, setB) {
- if (setA.length === 0) {
- return setB;
- }
- var result = '',
- i, len = setA.length,
- chr;
- for (i = 0; i < len; i++) {
- chr = setA.charAt(i);
- if (setB.indexOf(chr) !== -1) {
- result += chr;
- }
- }
- return result;
- }
-
- var i, len, set, neg, chr, tmp,
- pos_intersection = '',
- neg_intersection = '';
-
- for (i = 0, len = sets.length; i < len; i++) {
- set = $$($nesting, 'Opal').$coerce_to(sets[i], $$($nesting, 'String'), "to_str");
- neg = (set.charAt(0) === '^' && set.length > 1);
- set = explode_sequences_in_character_set(neg ? set.slice(1) : set);
- if (neg) {
- neg_intersection = intersection(neg_intersection, set);
- } else {
- pos_intersection = intersection(pos_intersection, set);
- }
- }
-
- if (pos_intersection.length > 0 && neg_intersection.length > 0) {
- tmp = '';
- for (i = 0, len = pos_intersection.length; i < len; i++) {
- chr = pos_intersection.charAt(i);
- if (neg_intersection.indexOf(chr) === -1) {
- tmp += chr;
- }
- }
- pos_intersection = tmp;
- neg_intersection = '';
- }
-
- if (pos_intersection.length > 0) {
- return '[' + $$($nesting, 'Regexp').$escape(pos_intersection) + ']';
- }
-
- if (neg_intersection.length > 0) {
- return '[^' + $$($nesting, 'Regexp').$escape(neg_intersection) + ']';
- }
-
- return null;
- }
- ;
-
- Opal.def(self, '$instance_variables', $String_instance_variables$73 = function $$instance_variables() {
- var self = this;
-
- return []
- }, $String_instance_variables$73.$$arity = 0);
- Opal.defs(self, '$_load', $String__load$74 = function $$_load($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return $send(self, 'new', Opal.to_a(args));
- }, $String__load$74.$$arity = -1);
-
- Opal.def(self, '$unicode_normalize', $String_unicode_normalize$75 = function $$unicode_normalize(form) {
- var self = this;
-
-
- ;
- return self.toString();;
- }, $String_unicode_normalize$75.$$arity = -1);
-
- Opal.def(self, '$unicode_normalized?', $String_unicode_normalized$ques$76 = function(form) {
- var self = this;
-
-
- ;
- return true;
- }, $String_unicode_normalized$ques$76.$$arity = -1);
-
- Opal.def(self, '$unpack', $String_unpack$77 = function $$unpack(format) {
- var self = this;
-
- return self.$raise("To use String#unpack, you must first require 'corelib/string/unpack'.")
- }, $String_unpack$77.$$arity = 1);
- return (Opal.def(self, '$unpack1', $String_unpack1$78 = function $$unpack1(format) {
- var self = this;
-
- return self.$raise("To use String#unpack1, you must first require 'corelib/string/unpack'.")
- }, $String_unpack1$78.$$arity = 1), nil) && 'unpack1';
- })($nesting[0], String, $nesting);
- return Opal.const_set($nesting[0], 'Symbol', $$($nesting, 'String'));
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/enumerable"] = function(Opal) {
- function $rb_gt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
- }
- function $rb_times(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
- }
- function $rb_lt(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_divide(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs);
- }
- function $rb_le(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, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy, $hash2 = Opal.hash2, $lambda = Opal.lambda;
-
- Opal.add_stubs(['$each', '$public_send', '$destructure', '$to_enum', '$enumerator_size', '$new', '$yield', '$raise', '$slice_when', '$!', '$enum_for', '$flatten', '$map', '$warn', '$proc', '$==', '$nil?', '$respond_to?', '$coerce_to!', '$>', '$*', '$coerce_to', '$try_convert', '$<', '$+', '$-', '$ceil', '$/', '$size', '$__send__', '$length', '$<=', '$[]', '$push', '$<<', '$[]=', '$===', '$inspect', '$<=>', '$first', '$reverse', '$sort', '$to_proc', '$compare', '$call', '$dup', '$to_a', '$sort!', '$map!', '$key?', '$values', '$zip']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Enumerable');
-
- var $nesting = [self].concat($parent_nesting), $Enumerable_all$ques$1, $Enumerable_any$ques$5, $Enumerable_chunk$9, $Enumerable_chunk_while$12, $Enumerable_collect$14, $Enumerable_collect_concat$16, $Enumerable_count$19, $Enumerable_cycle$23, $Enumerable_detect$25, $Enumerable_drop$27, $Enumerable_drop_while$28, $Enumerable_each_cons$29, $Enumerable_each_entry$31, $Enumerable_each_slice$33, $Enumerable_each_with_index$35, $Enumerable_each_with_object$37, $Enumerable_entries$39, $Enumerable_find_all$40, $Enumerable_find_index$42, $Enumerable_first$45, $Enumerable_grep$48, $Enumerable_grep_v$50, $Enumerable_group_by$52, $Enumerable_include$ques$54, $Enumerable_inject$56, $Enumerable_lazy$57, $Enumerable_enumerator_size$59, $Enumerable_max$60, $Enumerable_max_by$61, $Enumerable_min$63, $Enumerable_min_by$64, $Enumerable_minmax$66, $Enumerable_minmax_by$68, $Enumerable_none$ques$69, $Enumerable_one$ques$73, $Enumerable_partition$77, $Enumerable_reject$79, $Enumerable_reverse_each$81, $Enumerable_slice_before$83, $Enumerable_slice_after$85, $Enumerable_slice_when$88, $Enumerable_sort$90, $Enumerable_sort_by$92, $Enumerable_sum$97, $Enumerable_take$99, $Enumerable_take_while$100, $Enumerable_uniq$102, $Enumerable_zip$104;
-
-
-
- function comparableForPattern(value) {
- if (value.length === 0) {
- value = [nil];
- }
-
- if (value.length > 1) {
- value = [value];
- }
-
- return value;
- }
- ;
-
- Opal.def(self, '$all?', $Enumerable_all$ques$1 = function(pattern) {try {
-
- var $iter = $Enumerable_all$ques$1.$$p, block = $iter || nil, $$2, $$3, $$4, self = this;
-
- if ($iter) $Enumerable_all$ques$1.$$p = null;
-
-
- if ($iter) $Enumerable_all$ques$1.$$p = null;;
- ;
- if ($truthy(pattern !== undefined)) {
- $send(self, 'each', [], ($$2 = function($a){var self = $$2.$$s || this, $post_args, value, comparable = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- comparable = comparableForPattern(value);
- if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) {
- return nil
- } else {
- Opal.ret(false)
- };}, $$2.$$s = self, $$2.$$arity = -1, $$2))
- } else if ((block !== nil)) {
- $send(self, 'each', [], ($$3 = function($a){var self = $$3.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) {
- return nil
- } else {
- Opal.ret(false)
- };}, $$3.$$s = self, $$3.$$arity = -1, $$3))
- } else {
- $send(self, 'each', [], ($$4 = function($a){var self = $$4.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($truthy($$($nesting, 'Opal').$destructure(value))) {
- return nil
- } else {
- Opal.ret(false)
- };}, $$4.$$s = self, $$4.$$arity = -1, $$4))
- };
- return true;
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_all$ques$1.$$arity = -1);
-
- Opal.def(self, '$any?', $Enumerable_any$ques$5 = function(pattern) {try {
-
- var $iter = $Enumerable_any$ques$5.$$p, block = $iter || nil, $$6, $$7, $$8, self = this;
-
- if ($iter) $Enumerable_any$ques$5.$$p = null;
-
-
- if ($iter) $Enumerable_any$ques$5.$$p = null;;
- ;
- if ($truthy(pattern !== undefined)) {
- $send(self, 'each', [], ($$6 = function($a){var self = $$6.$$s || this, $post_args, value, comparable = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- comparable = comparableForPattern(value);
- if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) {
- Opal.ret(true)
- } else {
- return nil
- };}, $$6.$$s = self, $$6.$$arity = -1, $$6))
- } else if ((block !== nil)) {
- $send(self, 'each', [], ($$7 = function($a){var self = $$7.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) {
- Opal.ret(true)
- } else {
- return nil
- };}, $$7.$$s = self, $$7.$$arity = -1, $$7))
- } else {
- $send(self, 'each', [], ($$8 = function($a){var self = $$8.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($truthy($$($nesting, 'Opal').$destructure(value))) {
- Opal.ret(true)
- } else {
- return nil
- };}, $$8.$$s = self, $$8.$$arity = -1, $$8))
- };
- return false;
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_any$ques$5.$$arity = -1);
-
- Opal.def(self, '$chunk', $Enumerable_chunk$9 = function $$chunk() {
- var $iter = $Enumerable_chunk$9.$$p, block = $iter || nil, $$10, $$11, self = this;
-
- if ($iter) $Enumerable_chunk$9.$$p = null;
-
-
- if ($iter) $Enumerable_chunk$9.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'to_enum', ["chunk"], ($$10 = function(){var self = $$10.$$s || this;
-
- return self.$enumerator_size()}, $$10.$$s = self, $$10.$$arity = 0, $$10))
- };
- return $send($$$('::', 'Enumerator'), 'new', [], ($$11 = function(yielder){var self = $$11.$$s || this;
-
-
-
- if (yielder == null) {
- yielder = nil;
- };
-
- var previous = nil, accumulate = [];
-
- function releaseAccumulate() {
- if (accumulate.length > 0) {
- yielder.$yield(previous, accumulate)
- }
- }
-
- self.$each.$$p = function(value) {
- var key = Opal.yield1(block, value);
-
- if (key === nil) {
- releaseAccumulate();
- accumulate = [];
- previous = nil;
- } else {
- if (previous === nil || previous === key) {
- accumulate.push(value);
- } else {
- releaseAccumulate();
- accumulate = [value];
- }
-
- previous = key;
- }
- }
-
- self.$each();
-
- releaseAccumulate();
- ;}, $$11.$$s = self, $$11.$$arity = 1, $$11));
- }, $Enumerable_chunk$9.$$arity = 0);
-
- Opal.def(self, '$chunk_while', $Enumerable_chunk_while$12 = function $$chunk_while() {
- var $iter = $Enumerable_chunk_while$12.$$p, block = $iter || nil, $$13, self = this;
-
- if ($iter) $Enumerable_chunk_while$12.$$p = null;
-
-
- if ($iter) $Enumerable_chunk_while$12.$$p = null;;
- if ((block !== nil)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "no block given")
- };
- return $send(self, 'slice_when', [], ($$13 = function(before, after){var self = $$13.$$s || this;
-
-
-
- if (before == null) {
- before = nil;
- };
-
- if (after == null) {
- after = nil;
- };
- return Opal.yieldX(block, [before, after])['$!']();}, $$13.$$s = self, $$13.$$arity = 2, $$13));
- }, $Enumerable_chunk_while$12.$$arity = 0);
-
- Opal.def(self, '$collect', $Enumerable_collect$14 = function $$collect() {
- var $iter = $Enumerable_collect$14.$$p, block = $iter || nil, $$15, self = this;
-
- if ($iter) $Enumerable_collect$14.$$p = null;
-
-
- if ($iter) $Enumerable_collect$14.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["collect"], ($$15 = function(){var self = $$15.$$s || this;
-
- return self.$enumerator_size()}, $$15.$$s = self, $$15.$$arity = 0, $$15))
- };
-
- var result = [];
-
- self.$each.$$p = function() {
- var value = Opal.yieldX(block, arguments);
-
- result.push(value);
- };
-
- self.$each();
-
- return result;
- ;
- }, $Enumerable_collect$14.$$arity = 0);
-
- Opal.def(self, '$collect_concat', $Enumerable_collect_concat$16 = function $$collect_concat() {
- var $iter = $Enumerable_collect_concat$16.$$p, block = $iter || nil, $$17, $$18, self = this;
-
- if ($iter) $Enumerable_collect_concat$16.$$p = null;
-
-
- if ($iter) $Enumerable_collect_concat$16.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["collect_concat"], ($$17 = function(){var self = $$17.$$s || this;
-
- return self.$enumerator_size()}, $$17.$$s = self, $$17.$$arity = 0, $$17))
- };
- return $send(self, 'map', [], ($$18 = function(item){var self = $$18.$$s || this;
-
-
-
- if (item == null) {
- item = nil;
- };
- return Opal.yield1(block, item);;}, $$18.$$s = self, $$18.$$arity = 1, $$18)).$flatten(1);
- }, $Enumerable_collect_concat$16.$$arity = 0);
-
- Opal.def(self, '$count', $Enumerable_count$19 = function $$count(object) {
- var $iter = $Enumerable_count$19.$$p, block = $iter || nil, $$20, $$21, $$22, self = this, result = nil;
-
- if ($iter) $Enumerable_count$19.$$p = null;
-
-
- if ($iter) $Enumerable_count$19.$$p = null;;
- ;
- result = 0;
-
- if (object != null && block !== nil) {
- self.$warn("warning: given block not used")
- }
- ;
- if ($truthy(object != null)) {
- block = $send(self, 'proc', [], ($$20 = function($a){var self = $$20.$$s || this, $post_args, args;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return $$($nesting, 'Opal').$destructure(args)['$=='](object);}, $$20.$$s = self, $$20.$$arity = -1, $$20))
- } else if ($truthy(block['$nil?']())) {
- block = $send(self, 'proc', [], ($$21 = function(){var self = $$21.$$s || this;
-
- return true}, $$21.$$s = self, $$21.$$arity = 0, $$21))};
- $send(self, 'each', [], ($$22 = function($a){var self = $$22.$$s || this, $post_args, args;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy(Opal.yieldX(block, args))) {
- return result++;
- } else {
- return nil
- };}, $$22.$$s = self, $$22.$$arity = -1, $$22));
- return result;
- }, $Enumerable_count$19.$$arity = -1);
-
- Opal.def(self, '$cycle', $Enumerable_cycle$23 = function $$cycle(n) {
- var $iter = $Enumerable_cycle$23.$$p, block = $iter || nil, $$24, self = this;
-
- if ($iter) $Enumerable_cycle$23.$$p = null;
-
-
- if ($iter) $Enumerable_cycle$23.$$p = null;;
-
- if (n == null) {
- n = nil;
- };
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["cycle", n], ($$24 = function(){var self = $$24.$$s || this;
-
- if ($truthy(n['$nil?']())) {
- if ($truthy(self['$respond_to?']("size"))) {
- return $$$($$($nesting, 'Float'), 'INFINITY')
- } else {
- return nil
- }
- } else {
-
- n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_gt(n, 0))) {
- return $rb_times(self.$enumerator_size(), n)
- } else {
- return 0
- };
- }}, $$24.$$s = self, $$24.$$arity = 0, $$24))
- };
- if ($truthy(n['$nil?']())) {
- } else {
-
- n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int");
- if ($truthy(n <= 0)) {
- return nil};
- };
-
- var result,
- all = [], i, length, value;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = Opal.yield1(block, param);
-
- all.push(param);
- }
-
- self.$each();
-
- if (result !== undefined) {
- return result;
- }
-
- if (all.length === 0) {
- return nil;
- }
-
- if (n === nil) {
- while (true) {
- for (i = 0, length = all.length; i < length; i++) {
- value = Opal.yield1(block, all[i]);
- }
- }
- }
- else {
- while (n > 1) {
- for (i = 0, length = all.length; i < length; i++) {
- value = Opal.yield1(block, all[i]);
- }
-
- n--;
- }
- }
- ;
- }, $Enumerable_cycle$23.$$arity = -1);
-
- Opal.def(self, '$detect', $Enumerable_detect$25 = function $$detect(ifnone) {try {
-
- var $iter = $Enumerable_detect$25.$$p, block = $iter || nil, $$26, self = this;
-
- if ($iter) $Enumerable_detect$25.$$p = null;
-
-
- if ($iter) $Enumerable_detect$25.$$p = null;;
- ;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("detect", ifnone)
- };
- $send(self, 'each', [], ($$26 = function($a){var self = $$26.$$s || this, $post_args, args, value = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- value = $$($nesting, 'Opal').$destructure(args);
- if ($truthy(Opal.yield1(block, value))) {
- Opal.ret(value)
- } else {
- return nil
- };}, $$26.$$s = self, $$26.$$arity = -1, $$26));
-
- if (ifnone !== undefined) {
- if (typeof(ifnone) === 'function') {
- return ifnone();
- } else {
- return ifnone;
- }
- }
- ;
- return nil;
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_detect$25.$$arity = -1);
-
- Opal.def(self, '$drop', $Enumerable_drop$27 = function $$drop(number) {
- var self = this;
-
-
- number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int");
- if ($truthy(number < 0)) {
- self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")};
-
- var result = [],
- current = 0;
-
- self.$each.$$p = function() {
- if (number <= current) {
- result.push($$($nesting, 'Opal').$destructure(arguments));
- }
-
- current++;
- };
-
- self.$each()
-
- return result;
- ;
- }, $Enumerable_drop$27.$$arity = 1);
-
- Opal.def(self, '$drop_while', $Enumerable_drop_while$28 = function $$drop_while() {
- var $iter = $Enumerable_drop_while$28.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Enumerable_drop_while$28.$$p = null;
-
-
- if ($iter) $Enumerable_drop_while$28.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("drop_while")
- };
-
- var result = [],
- dropping = true;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments);
-
- if (dropping) {
- var value = Opal.yield1(block, param);
-
- if ($falsy(value)) {
- dropping = false;
- result.push(param);
- }
- }
- else {
- result.push(param);
- }
- };
-
- self.$each();
-
- return result;
- ;
- }, $Enumerable_drop_while$28.$$arity = 0);
-
- Opal.def(self, '$each_cons', $Enumerable_each_cons$29 = function $$each_cons(n) {
- var $iter = $Enumerable_each_cons$29.$$p, block = $iter || nil, $$30, self = this;
-
- if ($iter) $Enumerable_each_cons$29.$$p = null;
-
-
- if ($iter) $Enumerable_each_cons$29.$$p = null;;
- if ($truthy(arguments.length != 1)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 1)")};
- n = $$($nesting, 'Opal').$try_convert(n, $$($nesting, 'Integer'), "to_int");
- if ($truthy(n <= 0)) {
- self.$raise($$($nesting, 'ArgumentError'), "invalid size")};
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each_cons", n], ($$30 = function(){var self = $$30.$$s || this, $a, enum_size = nil;
-
-
- enum_size = self.$enumerator_size();
- if ($truthy(enum_size['$nil?']())) {
- return nil
- } else if ($truthy(($truthy($a = enum_size['$=='](0)) ? $a : $rb_lt(enum_size, n)))) {
- return 0
- } else {
- return $rb_plus($rb_minus(enum_size, n), 1)
- };}, $$30.$$s = self, $$30.$$arity = 0, $$30))
- };
-
- var buffer = [], result = nil;
-
- self.$each.$$p = function() {
- var element = $$($nesting, 'Opal').$destructure(arguments);
- buffer.push(element);
- if (buffer.length > n) {
- buffer.shift();
- }
- if (buffer.length == n) {
- Opal.yield1(block, buffer.slice(0, n));
- }
- }
-
- self.$each();
-
- return result;
- ;
- }, $Enumerable_each_cons$29.$$arity = 1);
-
- Opal.def(self, '$each_entry', $Enumerable_each_entry$31 = function $$each_entry($a) {
- var $iter = $Enumerable_each_entry$31.$$p, block = $iter || nil, $post_args, data, $$32, self = this;
-
- if ($iter) $Enumerable_each_entry$31.$$p = null;
-
-
- if ($iter) $Enumerable_each_entry$31.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- data = $post_args;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'to_enum', ["each_entry"].concat(Opal.to_a(data)), ($$32 = function(){var self = $$32.$$s || this;
-
- return self.$enumerator_size()}, $$32.$$s = self, $$32.$$arity = 0, $$32))
- };
-
- self.$each.$$p = function() {
- var item = $$($nesting, 'Opal').$destructure(arguments);
-
- Opal.yield1(block, item);
- }
-
- self.$each.apply(self, data);
-
- return self;
- ;
- }, $Enumerable_each_entry$31.$$arity = -1);
-
- Opal.def(self, '$each_slice', $Enumerable_each_slice$33 = function $$each_slice(n) {
- var $iter = $Enumerable_each_slice$33.$$p, block = $iter || nil, $$34, self = this;
-
- if ($iter) $Enumerable_each_slice$33.$$p = null;
-
-
- if ($iter) $Enumerable_each_slice$33.$$p = null;;
- n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int");
- if ($truthy(n <= 0)) {
- self.$raise($$($nesting, 'ArgumentError'), "invalid slice size")};
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each_slice", n], ($$34 = function(){var self = $$34.$$s || this;
-
- if ($truthy(self['$respond_to?']("size"))) {
- return $rb_divide(self.$size(), n).$ceil()
- } else {
- return nil
- }}, $$34.$$s = self, $$34.$$arity = 0, $$34))
- };
-
- var result,
- slice = []
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments);
-
- slice.push(param);
-
- if (slice.length === n) {
- Opal.yield1(block, slice);
- slice = [];
- }
- };
-
- self.$each();
-
- if (result !== undefined) {
- return result;
- }
-
- // our "last" group, if smaller than n then won't have been yielded
- if (slice.length > 0) {
- Opal.yield1(block, slice);
- }
- ;
- return nil;
- }, $Enumerable_each_slice$33.$$arity = 1);
-
- Opal.def(self, '$each_with_index', $Enumerable_each_with_index$35 = function $$each_with_index($a) {
- var $iter = $Enumerable_each_with_index$35.$$p, block = $iter || nil, $post_args, args, $$36, self = this;
-
- if ($iter) $Enumerable_each_with_index$35.$$p = null;
-
-
- if ($iter) $Enumerable_each_with_index$35.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each_with_index"].concat(Opal.to_a(args)), ($$36 = function(){var self = $$36.$$s || this;
-
- return self.$enumerator_size()}, $$36.$$s = self, $$36.$$arity = 0, $$36))
- };
-
- var result,
- index = 0;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments);
-
- block(param, index);
-
- index++;
- };
-
- self.$each.apply(self, args);
-
- if (result !== undefined) {
- return result;
- }
- ;
- return self;
- }, $Enumerable_each_with_index$35.$$arity = -1);
-
- Opal.def(self, '$each_with_object', $Enumerable_each_with_object$37 = function $$each_with_object(object) {
- var $iter = $Enumerable_each_with_object$37.$$p, block = $iter || nil, $$38, self = this;
-
- if ($iter) $Enumerable_each_with_object$37.$$p = null;
-
-
- if ($iter) $Enumerable_each_with_object$37.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each_with_object", object], ($$38 = function(){var self = $$38.$$s || this;
-
- return self.$enumerator_size()}, $$38.$$s = self, $$38.$$arity = 0, $$38))
- };
-
- var result;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments);
-
- block(param, object);
- };
-
- self.$each();
-
- if (result !== undefined) {
- return result;
- }
- ;
- return object;
- }, $Enumerable_each_with_object$37.$$arity = 1);
-
- Opal.def(self, '$entries', $Enumerable_entries$39 = function $$entries($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- var result = [];
-
- self.$each.$$p = function() {
- result.push($$($nesting, 'Opal').$destructure(arguments));
- };
-
- self.$each.apply(self, args);
-
- return result;
- ;
- }, $Enumerable_entries$39.$$arity = -1);
- Opal.alias(self, "find", "detect");
-
- Opal.def(self, '$find_all', $Enumerable_find_all$40 = function $$find_all() {
- var $iter = $Enumerable_find_all$40.$$p, block = $iter || nil, $$41, self = this;
-
- if ($iter) $Enumerable_find_all$40.$$p = null;
-
-
- if ($iter) $Enumerable_find_all$40.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["find_all"], ($$41 = function(){var self = $$41.$$s || this;
-
- return self.$enumerator_size()}, $$41.$$s = self, $$41.$$arity = 0, $$41))
- };
-
- var result = [];
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = Opal.yield1(block, param);
-
- if ($truthy(value)) {
- result.push(param);
- }
- };
-
- self.$each();
-
- return result;
- ;
- }, $Enumerable_find_all$40.$$arity = 0);
-
- Opal.def(self, '$find_index', $Enumerable_find_index$42 = function $$find_index(object) {try {
-
- var $iter = $Enumerable_find_index$42.$$p, block = $iter || nil, $$43, $$44, self = this, index = nil;
-
- if ($iter) $Enumerable_find_index$42.$$p = null;
-
-
- if ($iter) $Enumerable_find_index$42.$$p = null;;
- ;
- if ($truthy(object === undefined && block === nil)) {
- return self.$enum_for("find_index")};
-
- if (object != null && block !== nil) {
- self.$warn("warning: given block not used")
- }
- ;
- index = 0;
- if ($truthy(object != null)) {
- $send(self, 'each', [], ($$43 = function($a){var self = $$43.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($$($nesting, 'Opal').$destructure(value)['$=='](object)) {
- Opal.ret(index)};
- return index += 1;;}, $$43.$$s = self, $$43.$$arity = -1, $$43))
- } else {
- $send(self, 'each', [], ($$44 = function($a){var self = $$44.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) {
- Opal.ret(index)};
- return index += 1;;}, $$44.$$s = self, $$44.$$arity = -1, $$44))
- };
- return nil;
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_find_index$42.$$arity = -1);
-
- Opal.def(self, '$first', $Enumerable_first$45 = function $$first(number) {try {
-
- var $$46, $$47, self = this, result = nil, current = nil;
-
-
- ;
- if ($truthy(number === undefined)) {
- return $send(self, 'each', [], ($$46 = function(value){var self = $$46.$$s || this;
-
-
-
- if (value == null) {
- value = nil;
- };
- Opal.ret(value);}, $$46.$$s = self, $$46.$$arity = 1, $$46))
- } else {
-
- result = [];
- number = $$($nesting, 'Opal').$coerce_to(number, $$($nesting, 'Integer'), "to_int");
- if ($truthy(number < 0)) {
- self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")};
- if ($truthy(number == 0)) {
- return []};
- current = 0;
- $send(self, 'each', [], ($$47 = function($a){var self = $$47.$$s || this, $post_args, args;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- result.push($$($nesting, 'Opal').$destructure(args));
- if ($truthy(number <= ++current)) {
- Opal.ret(result)
- } else {
- return nil
- };}, $$47.$$s = self, $$47.$$arity = -1, $$47));
- return result;
- };
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_first$45.$$arity = -1);
- Opal.alias(self, "flat_map", "collect_concat");
-
- Opal.def(self, '$grep', $Enumerable_grep$48 = function $$grep(pattern) {
- var $iter = $Enumerable_grep$48.$$p, block = $iter || nil, $$49, self = this, result = nil;
-
- if ($iter) $Enumerable_grep$48.$$p = null;
-
-
- if ($iter) $Enumerable_grep$48.$$p = null;;
- result = [];
- $send(self, 'each', [], ($$49 = function($a){var self = $$49.$$s || this, $post_args, value, cmp = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- cmp = comparableForPattern(value);
- if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) {
- } else {
- return nil;
- };
- if ((block !== nil)) {
-
- if ($truthy($rb_gt(value.$length(), 1))) {
- value = [value]};
- value = Opal.yieldX(block, Opal.to_a(value));
- } else if ($truthy($rb_le(value.$length(), 1))) {
- value = value['$[]'](0)};
- return result.$push(value);}, $$49.$$s = self, $$49.$$arity = -1, $$49));
- return result;
- }, $Enumerable_grep$48.$$arity = 1);
-
- Opal.def(self, '$grep_v', $Enumerable_grep_v$50 = function $$grep_v(pattern) {
- var $iter = $Enumerable_grep_v$50.$$p, block = $iter || nil, $$51, self = this, result = nil;
-
- if ($iter) $Enumerable_grep_v$50.$$p = null;
-
-
- if ($iter) $Enumerable_grep_v$50.$$p = null;;
- result = [];
- $send(self, 'each', [], ($$51 = function($a){var self = $$51.$$s || this, $post_args, value, cmp = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- cmp = comparableForPattern(value);
- if ($truthy($send(pattern, '__send__', ["==="].concat(Opal.to_a(cmp))))) {
- return nil;};
- if ((block !== nil)) {
-
- if ($truthy($rb_gt(value.$length(), 1))) {
- value = [value]};
- value = Opal.yieldX(block, Opal.to_a(value));
- } else if ($truthy($rb_le(value.$length(), 1))) {
- value = value['$[]'](0)};
- return result.$push(value);}, $$51.$$s = self, $$51.$$arity = -1, $$51));
- return result;
- }, $Enumerable_grep_v$50.$$arity = 1);
-
- Opal.def(self, '$group_by', $Enumerable_group_by$52 = function $$group_by() {
- var $iter = $Enumerable_group_by$52.$$p, block = $iter || nil, $$53, $a, self = this, hash = nil, $writer = nil;
-
- if ($iter) $Enumerable_group_by$52.$$p = null;
-
-
- if ($iter) $Enumerable_group_by$52.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["group_by"], ($$53 = function(){var self = $$53.$$s || this;
-
- return self.$enumerator_size()}, $$53.$$s = self, $$53.$$arity = 0, $$53))
- };
- hash = $hash2([], {});
-
- var result;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = Opal.yield1(block, param);
-
- ($truthy($a = hash['$[]'](value)) ? $a : (($writer = [value, []]), $send(hash, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](param);
- }
-
- self.$each();
-
- if (result !== undefined) {
- return result;
- }
- ;
- return hash;
- }, $Enumerable_group_by$52.$$arity = 0);
-
- Opal.def(self, '$include?', $Enumerable_include$ques$54 = function(obj) {try {
-
- var $$55, self = this;
-
-
- $send(self, 'each', [], ($$55 = function($a){var self = $$55.$$s || this, $post_args, args;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($$($nesting, 'Opal').$destructure(args)['$=='](obj)) {
- Opal.ret(true)
- } else {
- return nil
- };}, $$55.$$s = self, $$55.$$arity = -1, $$55));
- return false;
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_include$ques$54.$$arity = 1);
-
- Opal.def(self, '$inject', $Enumerable_inject$56 = function $$inject(object, sym) {
- var $iter = $Enumerable_inject$56.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Enumerable_inject$56.$$p = null;
-
-
- if ($iter) $Enumerable_inject$56.$$p = null;;
- ;
- ;
-
- var result = object;
-
- if (block !== nil && sym === undefined) {
- self.$each.$$p = function() {
- var value = $$($nesting, 'Opal').$destructure(arguments);
-
- if (result === undefined) {
- result = value;
- return;
- }
-
- value = Opal.yieldX(block, [result, value]);
-
- result = value;
- };
- }
- else {
- if (sym === undefined) {
- if (!$$($nesting, 'Symbol')['$==='](object)) {
- self.$raise($$($nesting, 'TypeError'), "" + (object.$inspect()) + " is not a Symbol");
- }
-
- sym = object;
- result = undefined;
- }
-
- self.$each.$$p = function() {
- var value = $$($nesting, 'Opal').$destructure(arguments);
-
- if (result === undefined) {
- result = value;
- return;
- }
-
- result = (result).$__send__(sym, value);
- };
- }
-
- self.$each();
-
- return result == undefined ? nil : result;
- ;
- }, $Enumerable_inject$56.$$arity = -1);
-
- Opal.def(self, '$lazy', $Enumerable_lazy$57 = function $$lazy() {
- var $$58, self = this;
-
- return $send($$$($$($nesting, 'Enumerator'), 'Lazy'), 'new', [self, self.$enumerator_size()], ($$58 = function(enum$, $a){var self = $$58.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
- return $send(enum$, 'yield', Opal.to_a(args));}, $$58.$$s = self, $$58.$$arity = -2, $$58))
- }, $Enumerable_lazy$57.$$arity = 0);
-
- Opal.def(self, '$enumerator_size', $Enumerable_enumerator_size$59 = function $$enumerator_size() {
- var self = this;
-
- if ($truthy(self['$respond_to?']("size"))) {
- return self.$size()
- } else {
- return nil
- }
- }, $Enumerable_enumerator_size$59.$$arity = 0);
- Opal.alias(self, "map", "collect");
-
- Opal.def(self, '$max', $Enumerable_max$60 = function $$max(n) {
- var $iter = $Enumerable_max$60.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Enumerable_max$60.$$p = null;
-
-
- if ($iter) $Enumerable_max$60.$$p = null;;
- ;
-
- if (n === undefined || n === nil) {
- var result, value;
-
- self.$each.$$p = function() {
- var item = $$($nesting, 'Opal').$destructure(arguments);
-
- if (result === undefined) {
- result = item;
- return;
- }
-
- if (block !== nil) {
- value = Opal.yieldX(block, [item, result]);
- } else {
- value = (item)['$<=>'](result);
- }
-
- if (value === nil) {
- self.$raise($$($nesting, 'ArgumentError'), "comparison failed");
- }
-
- if (value > 0) {
- result = item;
- }
- }
-
- self.$each();
-
- if (result === undefined) {
- return nil;
- } else {
- return result;
- }
- }
- ;
- n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int");
- return $send(self, 'sort', [], block.$to_proc()).$reverse().$first(n);
- }, $Enumerable_max$60.$$arity = -1);
-
- Opal.def(self, '$max_by', $Enumerable_max_by$61 = function $$max_by() {
- var $iter = $Enumerable_max_by$61.$$p, block = $iter || nil, $$62, self = this;
-
- if ($iter) $Enumerable_max_by$61.$$p = null;
-
-
- if ($iter) $Enumerable_max_by$61.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["max_by"], ($$62 = function(){var self = $$62.$$s || this;
-
- return self.$enumerator_size()}, $$62.$$s = self, $$62.$$arity = 0, $$62))
- };
-
- var result,
- by;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = Opal.yield1(block, param);
-
- if (result === undefined) {
- result = param;
- by = value;
- return;
- }
-
- if ((value)['$<=>'](by) > 0) {
- result = param
- by = value;
- }
- };
-
- self.$each();
-
- return result === undefined ? nil : result;
- ;
- }, $Enumerable_max_by$61.$$arity = 0);
- Opal.alias(self, "member?", "include?");
-
- Opal.def(self, '$min', $Enumerable_min$63 = function $$min() {
- var $iter = $Enumerable_min$63.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Enumerable_min$63.$$p = null;
-
-
- if ($iter) $Enumerable_min$63.$$p = null;;
-
- var result;
-
- if (block !== nil) {
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments);
-
- if (result === undefined) {
- result = param;
- return;
- }
-
- var value = block(param, result);
-
- if (value === nil) {
- self.$raise($$($nesting, 'ArgumentError'), "comparison failed");
- }
-
- if (value < 0) {
- result = param;
- }
- };
- }
- else {
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments);
-
- if (result === undefined) {
- result = param;
- return;
- }
-
- if ($$($nesting, 'Opal').$compare(param, result) < 0) {
- result = param;
- }
- };
- }
-
- self.$each();
-
- return result === undefined ? nil : result;
- ;
- }, $Enumerable_min$63.$$arity = 0);
-
- Opal.def(self, '$min_by', $Enumerable_min_by$64 = function $$min_by() {
- var $iter = $Enumerable_min_by$64.$$p, block = $iter || nil, $$65, self = this;
-
- if ($iter) $Enumerable_min_by$64.$$p = null;
-
-
- if ($iter) $Enumerable_min_by$64.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["min_by"], ($$65 = function(){var self = $$65.$$s || this;
-
- return self.$enumerator_size()}, $$65.$$s = self, $$65.$$arity = 0, $$65))
- };
-
- var result,
- by;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = Opal.yield1(block, param);
-
- if (result === undefined) {
- result = param;
- by = value;
- return;
- }
-
- if ((value)['$<=>'](by) < 0) {
- result = param
- by = value;
- }
- };
-
- self.$each();
-
- return result === undefined ? nil : result;
- ;
- }, $Enumerable_min_by$64.$$arity = 0);
-
- Opal.def(self, '$minmax', $Enumerable_minmax$66 = function $$minmax() {
- var $iter = $Enumerable_minmax$66.$$p, block = $iter || nil, $a, $$67, self = this;
-
- if ($iter) $Enumerable_minmax$66.$$p = null;
-
-
- if ($iter) $Enumerable_minmax$66.$$p = null;;
- block = ($truthy($a = block) ? $a : $send(self, 'proc', [], ($$67 = function(a, b){var self = $$67.$$s || this;
-
-
-
- if (a == null) {
- a = nil;
- };
-
- if (b == null) {
- b = nil;
- };
- return a['$<=>'](b);}, $$67.$$s = self, $$67.$$arity = 2, $$67)));
-
- var min = nil, max = nil, first_time = true;
-
- self.$each.$$p = function() {
- var element = $$($nesting, 'Opal').$destructure(arguments);
- if (first_time) {
- min = max = element;
- first_time = false;
- } else {
- var min_cmp = block.$call(min, element);
-
- if (min_cmp === nil) {
- self.$raise($$($nesting, 'ArgumentError'), "comparison failed")
- } else if (min_cmp > 0) {
- min = element;
- }
-
- var max_cmp = block.$call(max, element);
-
- if (max_cmp === nil) {
- self.$raise($$($nesting, 'ArgumentError'), "comparison failed")
- } else if (max_cmp < 0) {
- max = element;
- }
- }
- }
-
- self.$each();
-
- return [min, max];
- ;
- }, $Enumerable_minmax$66.$$arity = 0);
-
- Opal.def(self, '$minmax_by', $Enumerable_minmax_by$68 = function $$minmax_by() {
- var $iter = $Enumerable_minmax_by$68.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Enumerable_minmax_by$68.$$p = null;
-
-
- if ($iter) $Enumerable_minmax_by$68.$$p = null;;
- return self.$raise($$($nesting, 'NotImplementedError'));
- }, $Enumerable_minmax_by$68.$$arity = 0);
-
- Opal.def(self, '$none?', $Enumerable_none$ques$69 = function(pattern) {try {
-
- var $iter = $Enumerable_none$ques$69.$$p, block = $iter || nil, $$70, $$71, $$72, self = this;
-
- if ($iter) $Enumerable_none$ques$69.$$p = null;
-
-
- if ($iter) $Enumerable_none$ques$69.$$p = null;;
- ;
- if ($truthy(pattern !== undefined)) {
- $send(self, 'each', [], ($$70 = function($a){var self = $$70.$$s || this, $post_args, value, comparable = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- comparable = comparableForPattern(value);
- if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) {
- Opal.ret(false)
- } else {
- return nil
- };}, $$70.$$s = self, $$70.$$arity = -1, $$70))
- } else if ((block !== nil)) {
- $send(self, 'each', [], ($$71 = function($a){var self = $$71.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) {
- Opal.ret(false)
- } else {
- return nil
- };}, $$71.$$s = self, $$71.$$arity = -1, $$71))
- } else {
- $send(self, 'each', [], ($$72 = function($a){var self = $$72.$$s || this, $post_args, value, item = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- item = $$($nesting, 'Opal').$destructure(value);
- if ($truthy(item)) {
- Opal.ret(false)
- } else {
- return nil
- };}, $$72.$$s = self, $$72.$$arity = -1, $$72))
- };
- return true;
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_none$ques$69.$$arity = -1);
-
- Opal.def(self, '$one?', $Enumerable_one$ques$73 = function(pattern) {try {
-
- var $iter = $Enumerable_one$ques$73.$$p, block = $iter || nil, $$74, $$75, $$76, self = this, count = nil;
-
- if ($iter) $Enumerable_one$ques$73.$$p = null;
-
-
- if ($iter) $Enumerable_one$ques$73.$$p = null;;
- ;
- count = 0;
- if ($truthy(pattern !== undefined)) {
- $send(self, 'each', [], ($$74 = function($a){var self = $$74.$$s || this, $post_args, value, comparable = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- comparable = comparableForPattern(value);
- if ($truthy($send(pattern, 'public_send', ["==="].concat(Opal.to_a(comparable))))) {
-
- count = $rb_plus(count, 1);
- if ($truthy($rb_gt(count, 1))) {
- Opal.ret(false)
- } else {
- return nil
- };
- } else {
- return nil
- };}, $$74.$$s = self, $$74.$$arity = -1, $$74))
- } else if ((block !== nil)) {
- $send(self, 'each', [], ($$75 = function($a){var self = $$75.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($truthy(Opal.yieldX(block, Opal.to_a(value)))) {
- } else {
- return nil;
- };
- count = $rb_plus(count, 1);
- if ($truthy($rb_gt(count, 1))) {
- Opal.ret(false)
- } else {
- return nil
- };}, $$75.$$s = self, $$75.$$arity = -1, $$75))
- } else {
- $send(self, 'each', [], ($$76 = function($a){var self = $$76.$$s || this, $post_args, value;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- value = $post_args;;
- if ($truthy($$($nesting, 'Opal').$destructure(value))) {
- } else {
- return nil;
- };
- count = $rb_plus(count, 1);
- if ($truthy($rb_gt(count, 1))) {
- Opal.ret(false)
- } else {
- return nil
- };}, $$76.$$s = self, $$76.$$arity = -1, $$76))
- };
- return count['$=='](1);
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_one$ques$73.$$arity = -1);
-
- Opal.def(self, '$partition', $Enumerable_partition$77 = function $$partition() {
- var $iter = $Enumerable_partition$77.$$p, block = $iter || nil, $$78, self = this;
-
- if ($iter) $Enumerable_partition$77.$$p = null;
-
-
- if ($iter) $Enumerable_partition$77.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["partition"], ($$78 = function(){var self = $$78.$$s || this;
-
- return self.$enumerator_size()}, $$78.$$s = self, $$78.$$arity = 0, $$78))
- };
-
- var truthy = [], falsy = [], result;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = Opal.yield1(block, param);
-
- if ($truthy(value)) {
- truthy.push(param);
- }
- else {
- falsy.push(param);
- }
- };
-
- self.$each();
-
- return [truthy, falsy];
- ;
- }, $Enumerable_partition$77.$$arity = 0);
- Opal.alias(self, "reduce", "inject");
-
- Opal.def(self, '$reject', $Enumerable_reject$79 = function $$reject() {
- var $iter = $Enumerable_reject$79.$$p, block = $iter || nil, $$80, self = this;
-
- if ($iter) $Enumerable_reject$79.$$p = null;
-
-
- if ($iter) $Enumerable_reject$79.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["reject"], ($$80 = function(){var self = $$80.$$s || this;
-
- return self.$enumerator_size()}, $$80.$$s = self, $$80.$$arity = 0, $$80))
- };
-
- var result = [];
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = Opal.yield1(block, param);
-
- if ($falsy(value)) {
- result.push(param);
- }
- };
-
- self.$each();
-
- return result;
- ;
- }, $Enumerable_reject$79.$$arity = 0);
-
- Opal.def(self, '$reverse_each', $Enumerable_reverse_each$81 = function $$reverse_each() {
- var $iter = $Enumerable_reverse_each$81.$$p, block = $iter || nil, $$82, self = this;
-
- if ($iter) $Enumerable_reverse_each$81.$$p = null;
-
-
- if ($iter) $Enumerable_reverse_each$81.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["reverse_each"], ($$82 = function(){var self = $$82.$$s || this;
-
- return self.$enumerator_size()}, $$82.$$s = self, $$82.$$arity = 0, $$82))
- };
-
- var result = [];
-
- self.$each.$$p = function() {
- result.push(arguments);
- };
-
- self.$each();
-
- for (var i = result.length - 1; i >= 0; i--) {
- Opal.yieldX(block, result[i]);
- }
-
- return result;
- ;
- }, $Enumerable_reverse_each$81.$$arity = 0);
- Opal.alias(self, "select", "find_all");
-
- Opal.def(self, '$slice_before', $Enumerable_slice_before$83 = function $$slice_before(pattern) {
- var $iter = $Enumerable_slice_before$83.$$p, block = $iter || nil, $$84, self = this;
-
- if ($iter) $Enumerable_slice_before$83.$$p = null;
-
-
- if ($iter) $Enumerable_slice_before$83.$$p = null;;
- ;
- if ($truthy(pattern === undefined && block === nil)) {
- self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")};
- if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")};
- return $send($$($nesting, 'Enumerator'), 'new', [], ($$84 = function(e){var self = $$84.$$s || this;
-
-
-
- if (e == null) {
- e = nil;
- };
-
- var slice = [];
-
- if (block !== nil) {
- if (pattern === undefined) {
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = Opal.yield1(block, param);
-
- if ($truthy(value) && slice.length > 0) {
- e['$<<'](slice);
- slice = [];
- }
-
- slice.push(param);
- };
- }
- else {
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = block(param, pattern.$dup());
-
- if ($truthy(value) && slice.length > 0) {
- e['$<<'](slice);
- slice = [];
- }
-
- slice.push(param);
- };
- }
- }
- else {
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = pattern['$==='](param);
-
- if ($truthy(value) && slice.length > 0) {
- e['$<<'](slice);
- slice = [];
- }
-
- slice.push(param);
- };
- }
-
- self.$each();
-
- if (slice.length > 0) {
- e['$<<'](slice);
- }
- ;}, $$84.$$s = self, $$84.$$arity = 1, $$84));
- }, $Enumerable_slice_before$83.$$arity = -1);
-
- Opal.def(self, '$slice_after', $Enumerable_slice_after$85 = function $$slice_after(pattern) {
- var $iter = $Enumerable_slice_after$85.$$p, block = $iter || nil, $$86, $$87, self = this;
-
- if ($iter) $Enumerable_slice_after$85.$$p = null;
-
-
- if ($iter) $Enumerable_slice_after$85.$$p = null;;
- ;
- if ($truthy(pattern === undefined && block === nil)) {
- self.$raise($$($nesting, 'ArgumentError'), "both pattern and block are given")};
- if ($truthy(pattern !== undefined && block !== nil || arguments.length > 1)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " expected 1)")};
- if ($truthy(pattern !== undefined)) {
- block = $send(self, 'proc', [], ($$86 = function(e){var self = $$86.$$s || this;
-
-
-
- if (e == null) {
- e = nil;
- };
- return pattern['$==='](e);}, $$86.$$s = self, $$86.$$arity = 1, $$86))};
- return $send($$($nesting, 'Enumerator'), 'new', [], ($$87 = function(yielder){var self = $$87.$$s || this;
-
-
-
- if (yielder == null) {
- yielder = nil;
- };
-
- var accumulate;
-
- self.$each.$$p = function() {
- var element = $$($nesting, 'Opal').$destructure(arguments),
- end_chunk = Opal.yield1(block, element);
-
- if (accumulate == null) {
- accumulate = [];
- }
-
- if ($truthy(end_chunk)) {
- accumulate.push(element);
- yielder.$yield(accumulate);
- accumulate = null;
- } else {
- accumulate.push(element)
- }
- }
-
- self.$each();
-
- if (accumulate != null) {
- yielder.$yield(accumulate);
- }
- ;}, $$87.$$s = self, $$87.$$arity = 1, $$87));
- }, $Enumerable_slice_after$85.$$arity = -1);
-
- Opal.def(self, '$slice_when', $Enumerable_slice_when$88 = function $$slice_when() {
- var $iter = $Enumerable_slice_when$88.$$p, block = $iter || nil, $$89, self = this;
-
- if ($iter) $Enumerable_slice_when$88.$$p = null;
-
-
- if ($iter) $Enumerable_slice_when$88.$$p = null;;
- if ((block !== nil)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1)")
- };
- return $send($$($nesting, 'Enumerator'), 'new', [], ($$89 = function(yielder){var self = $$89.$$s || this;
-
-
-
- if (yielder == null) {
- yielder = nil;
- };
-
- var slice = nil, last_after = nil;
-
- self.$each_cons.$$p = function() {
- var params = $$($nesting, 'Opal').$destructure(arguments),
- before = params[0],
- after = params[1],
- match = Opal.yieldX(block, [before, after]);
-
- last_after = after;
-
- if (slice === nil) {
- slice = [];
- }
-
- if ($truthy(match)) {
- slice.push(before);
- yielder.$yield(slice);
- slice = [];
- } else {
- slice.push(before);
- }
- }
-
- self.$each_cons(2);
-
- if (slice !== nil) {
- slice.push(last_after);
- yielder.$yield(slice);
- }
- ;}, $$89.$$s = self, $$89.$$arity = 1, $$89));
- }, $Enumerable_slice_when$88.$$arity = 0);
-
- Opal.def(self, '$sort', $Enumerable_sort$90 = function $$sort() {
- var $iter = $Enumerable_sort$90.$$p, block = $iter || nil, $$91, self = this, ary = nil;
-
- if ($iter) $Enumerable_sort$90.$$p = null;
-
-
- if ($iter) $Enumerable_sort$90.$$p = null;;
- ary = self.$to_a();
- if ((block !== nil)) {
- } else {
- block = $lambda(($$91 = function(a, b){var self = $$91.$$s || this;
-
-
-
- if (a == null) {
- a = nil;
- };
-
- if (b == null) {
- b = nil;
- };
- return a['$<=>'](b);}, $$91.$$s = self, $$91.$$arity = 2, $$91))
- };
- return $send(ary, 'sort', [], block.$to_proc());
- }, $Enumerable_sort$90.$$arity = 0);
-
- Opal.def(self, '$sort_by', $Enumerable_sort_by$92 = function $$sort_by() {
- var $iter = $Enumerable_sort_by$92.$$p, block = $iter || nil, $$93, $$94, $$95, $$96, self = this, dup = nil;
-
- if ($iter) $Enumerable_sort_by$92.$$p = null;
-
-
- if ($iter) $Enumerable_sort_by$92.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["sort_by"], ($$93 = function(){var self = $$93.$$s || this;
-
- return self.$enumerator_size()}, $$93.$$s = self, $$93.$$arity = 0, $$93))
- };
- dup = $send(self, 'map', [], ($$94 = function(){var self = $$94.$$s || this, arg = nil;
-
-
- arg = $$($nesting, 'Opal').$destructure(arguments);
- return [Opal.yield1(block, arg), arg];}, $$94.$$s = self, $$94.$$arity = 0, $$94));
- $send(dup, 'sort!', [], ($$95 = function(a, b){var self = $$95.$$s || this;
-
-
-
- if (a == null) {
- a = nil;
- };
-
- if (b == null) {
- b = nil;
- };
- return (a[0])['$<=>'](b[0]);}, $$95.$$s = self, $$95.$$arity = 2, $$95));
- return $send(dup, 'map!', [], ($$96 = function(i){var self = $$96.$$s || this;
-
-
-
- if (i == null) {
- i = nil;
- };
- return i[1];;}, $$96.$$s = self, $$96.$$arity = 1, $$96));
- }, $Enumerable_sort_by$92.$$arity = 0);
-
- Opal.def(self, '$sum', $Enumerable_sum$97 = function $$sum(initial) {
- var $$98, $iter = $Enumerable_sum$97.$$p, $yield = $iter || nil, self = this, result = nil;
-
- if ($iter) $Enumerable_sum$97.$$p = null;
-
-
- if (initial == null) {
- initial = 0;
- };
- result = initial;
- $send(self, 'each', [], ($$98 = function($a){var self = $$98.$$s || this, $post_args, args, item = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- item = (function() {if (($yield !== nil)) {
- return Opal.yieldX($yield, Opal.to_a(args));
- } else {
- return $$($nesting, 'Opal').$destructure(args)
- }; return nil; })();
- return (result = $rb_plus(result, item));}, $$98.$$s = self, $$98.$$arity = -1, $$98));
- return result;
- }, $Enumerable_sum$97.$$arity = -1);
-
- Opal.def(self, '$take', $Enumerable_take$99 = function $$take(num) {
- var self = this;
-
- return self.$first(num)
- }, $Enumerable_take$99.$$arity = 1);
-
- Opal.def(self, '$take_while', $Enumerable_take_while$100 = function $$take_while() {try {
-
- var $iter = $Enumerable_take_while$100.$$p, block = $iter || nil, $$101, self = this, result = nil;
-
- if ($iter) $Enumerable_take_while$100.$$p = null;
-
-
- if ($iter) $Enumerable_take_while$100.$$p = null;;
- if ($truthy(block)) {
- } else {
- return self.$enum_for("take_while")
- };
- result = [];
- return $send(self, 'each', [], ($$101 = function($a){var self = $$101.$$s || this, $post_args, args, value = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- value = $$($nesting, 'Opal').$destructure(args);
- if ($truthy(Opal.yield1(block, value))) {
- } else {
- Opal.ret(result)
- };
- return result.push(value);;}, $$101.$$s = self, $$101.$$arity = -1, $$101));
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Enumerable_take_while$100.$$arity = 0);
-
- Opal.def(self, '$uniq', $Enumerable_uniq$102 = function $$uniq() {
- var $iter = $Enumerable_uniq$102.$$p, block = $iter || nil, $$103, self = this, hash = nil;
-
- if ($iter) $Enumerable_uniq$102.$$p = null;
-
-
- if ($iter) $Enumerable_uniq$102.$$p = null;;
- hash = $hash2([], {});
- $send(self, 'each', [], ($$103 = function($a){var self = $$103.$$s || this, $post_args, args, value = nil, produced = nil, $writer = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- value = $$($nesting, 'Opal').$destructure(args);
- produced = (function() {if ((block !== nil)) {
- return Opal.yield1(block, value);
- } else {
- return value
- }; return nil; })();
- if ($truthy(hash['$key?'](produced))) {
- return nil
- } else {
-
- $writer = [produced, value];
- $send(hash, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };}, $$103.$$s = self, $$103.$$arity = -1, $$103));
- return hash.$values();
- }, $Enumerable_uniq$102.$$arity = 0);
- Opal.alias(self, "to_a", "entries");
-
- Opal.def(self, '$zip', $Enumerable_zip$104 = function $$zip($a) {
- var $iter = $Enumerable_zip$104.$$p, block = $iter || nil, $post_args, others, self = this;
-
- if ($iter) $Enumerable_zip$104.$$p = null;
-
-
- if ($iter) $Enumerable_zip$104.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- others = $post_args;;
- return $send(self.$to_a(), 'zip', Opal.to_a(others));
- }, $Enumerable_zip$104.$$arity = -1);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/enumerator"] = function(Opal) {
- function $rb_plus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
- }
- function $rb_lt(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, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $falsy = Opal.falsy;
-
- Opal.add_stubs(['$require', '$include', '$allocate', '$new', '$to_proc', '$coerce_to', '$nil?', '$empty?', '$+', '$class', '$__send__', '$===', '$call', '$enum_for', '$size', '$destructure', '$inspect', '$any?', '$[]', '$raise', '$yield', '$each', '$enumerator_size', '$respond_to?', '$try_convert', '$<', '$for']);
-
- self.$require("corelib/enumerable");
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Enumerator');
-
- var $nesting = [self].concat($parent_nesting), $Enumerator_for$1, $Enumerator_initialize$2, $Enumerator_each$3, $Enumerator_size$4, $Enumerator_with_index$5, $Enumerator_inspect$7;
-
- self.$$prototype.size = self.$$prototype.args = self.$$prototype.object = self.$$prototype.method = nil;
-
- self.$include($$($nesting, 'Enumerable'));
- self.$$prototype.$$is_enumerator = true;
- Opal.defs(self, '$for', $Enumerator_for$1 = function(object, $a, $b) {
- var $iter = $Enumerator_for$1.$$p, block = $iter || nil, $post_args, method, args, self = this;
-
- if ($iter) $Enumerator_for$1.$$p = null;
-
-
- if ($iter) $Enumerator_for$1.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- if ($post_args.length > 0) {
- method = $post_args[0];
- $post_args.splice(0, 1);
- }
- if (method == null) {
- method = "each";
- };
-
- args = $post_args;;
-
- var obj = self.$allocate();
-
- obj.object = object;
- obj.size = block;
- obj.method = method;
- obj.args = args;
-
- return obj;
- ;
- }, $Enumerator_for$1.$$arity = -2);
-
- Opal.def(self, '$initialize', $Enumerator_initialize$2 = function $$initialize($a) {
- var $iter = $Enumerator_initialize$2.$$p, block = $iter || nil, $post_args, self = this;
-
- if ($iter) $Enumerator_initialize$2.$$p = null;
-
-
- if ($iter) $Enumerator_initialize$2.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- if ($truthy(block)) {
-
- self.object = $send($$($nesting, 'Generator'), 'new', [], block.$to_proc());
- self.method = "each";
- self.args = [];
- self.size = arguments[0] || nil;
- if ($truthy(self.size)) {
- return (self.size = $$($nesting, 'Opal').$coerce_to(self.size, $$($nesting, 'Integer'), "to_int"))
- } else {
- return nil
- };
- } else {
-
- self.object = arguments[0];
- self.method = arguments[1] || "each";
- self.args = $slice.call(arguments, 2);
- return (self.size = nil);
- };
- }, $Enumerator_initialize$2.$$arity = -1);
-
- Opal.def(self, '$each', $Enumerator_each$3 = function $$each($a) {
- var $iter = $Enumerator_each$3.$$p, block = $iter || nil, $post_args, args, $b, self = this;
-
- if ($iter) $Enumerator_each$3.$$p = null;
-
-
- if ($iter) $Enumerator_each$3.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy(($truthy($b = block['$nil?']()) ? args['$empty?']() : $b))) {
- return self};
- args = $rb_plus(self.args, args);
- if ($truthy(block['$nil?']())) {
- return $send(self.$class(), 'new', [self.object, self.method].concat(Opal.to_a(args)))};
- return $send(self.object, '__send__', [self.method].concat(Opal.to_a(args)), block.$to_proc());
- }, $Enumerator_each$3.$$arity = -1);
-
- Opal.def(self, '$size', $Enumerator_size$4 = function $$size() {
- var self = this;
-
- if ($truthy($$($nesting, 'Proc')['$==='](self.size))) {
- return $send(self.size, 'call', Opal.to_a(self.args))
- } else {
- return self.size
- }
- }, $Enumerator_size$4.$$arity = 0);
-
- Opal.def(self, '$with_index', $Enumerator_with_index$5 = function $$with_index(offset) {
- var $iter = $Enumerator_with_index$5.$$p, block = $iter || nil, $$6, self = this;
-
- if ($iter) $Enumerator_with_index$5.$$p = null;
-
-
- if ($iter) $Enumerator_with_index$5.$$p = null;;
-
- if (offset == null) {
- offset = 0;
- };
- offset = (function() {if ($truthy(offset)) {
- return $$($nesting, 'Opal').$coerce_to(offset, $$($nesting, 'Integer'), "to_int")
- } else {
- return 0
- }; return nil; })();
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["with_index", offset], ($$6 = function(){var self = $$6.$$s || this;
-
- return self.$size()}, $$6.$$s = self, $$6.$$arity = 0, $$6))
- };
-
- var result, index = offset;
-
- self.$each.$$p = function() {
- var param = $$($nesting, 'Opal').$destructure(arguments),
- value = block(param, index);
-
- index++;
-
- return value;
- }
-
- return self.$each();
- ;
- }, $Enumerator_with_index$5.$$arity = -1);
- Opal.alias(self, "with_object", "each_with_object");
-
- Opal.def(self, '$inspect', $Enumerator_inspect$7 = function $$inspect() {
- var self = this, result = nil;
-
-
- result = "" + "#<" + (self.$class()) + ": " + (self.object.$inspect()) + ":" + (self.method);
- if ($truthy(self.args['$any?']())) {
- result = $rb_plus(result, "" + "(" + (self.args.$inspect()['$[]']($$($nesting, 'Range').$new(1, -2))) + ")")};
- return $rb_plus(result, ">");
- }, $Enumerator_inspect$7.$$arity = 0);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Generator');
-
- var $nesting = [self].concat($parent_nesting), $Generator_initialize$8, $Generator_each$9;
-
- self.$$prototype.block = nil;
-
- self.$include($$($nesting, 'Enumerable'));
-
- Opal.def(self, '$initialize', $Generator_initialize$8 = function $$initialize() {
- var $iter = $Generator_initialize$8.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Generator_initialize$8.$$p = null;
-
-
- if ($iter) $Generator_initialize$8.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'LocalJumpError'), "no block given")
- };
- return (self.block = block);
- }, $Generator_initialize$8.$$arity = 0);
- return (Opal.def(self, '$each', $Generator_each$9 = function $$each($a) {
- var $iter = $Generator_each$9.$$p, block = $iter || nil, $post_args, args, self = this, yielder = nil;
-
- if ($iter) $Generator_each$9.$$p = null;
-
-
- if ($iter) $Generator_each$9.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- yielder = $send($$($nesting, 'Yielder'), 'new', [], block.$to_proc());
-
- try {
- args.unshift(yielder);
-
- Opal.yieldX(self.block, args);
- }
- catch (e) {
- if (e === $breaker) {
- return $breaker.$v;
- }
- else {
- throw e;
- }
- }
- ;
- return self;
- }, $Generator_each$9.$$arity = -1), nil) && 'each';
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Yielder');
-
- var $nesting = [self].concat($parent_nesting), $Yielder_initialize$10, $Yielder_yield$11, $Yielder_$lt$lt$12;
-
- self.$$prototype.block = nil;
-
-
- Opal.def(self, '$initialize', $Yielder_initialize$10 = function $$initialize() {
- var $iter = $Yielder_initialize$10.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Yielder_initialize$10.$$p = null;
-
-
- if ($iter) $Yielder_initialize$10.$$p = null;;
- return (self.block = block);
- }, $Yielder_initialize$10.$$arity = 0);
-
- Opal.def(self, '$yield', $Yielder_yield$11 = function($a) {
- var $post_args, values, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- values = $post_args;;
-
- var value = Opal.yieldX(self.block, values);
-
- if (value === $breaker) {
- throw $breaker;
- }
-
- return value;
- ;
- }, $Yielder_yield$11.$$arity = -1);
- return (Opal.def(self, '$<<', $Yielder_$lt$lt$12 = function($a) {
- var $post_args, values, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- values = $post_args;;
- $send(self, 'yield', Opal.to_a(values));
- return self;
- }, $Yielder_$lt$lt$12.$$arity = -1), nil) && '<<';
- })($nesting[0], null, $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Lazy');
-
- var $nesting = [self].concat($parent_nesting), $Lazy_initialize$13, $Lazy_lazy$16, $Lazy_collect$17, $Lazy_collect_concat$19, $Lazy_drop$23, $Lazy_drop_while$25, $Lazy_enum_for$27, $Lazy_find_all$28, $Lazy_grep$30, $Lazy_reject$33, $Lazy_take$35, $Lazy_take_while$37, $Lazy_inspect$39;
-
- self.$$prototype.enumerator = nil;
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'StopLazyError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'Exception'), $nesting);
-
- Opal.def(self, '$initialize', $Lazy_initialize$13 = function $$initialize(object, size) {
- var $iter = $Lazy_initialize$13.$$p, block = $iter || nil, $$14, self = this;
-
- if ($iter) $Lazy_initialize$13.$$p = null;
-
-
- if ($iter) $Lazy_initialize$13.$$p = null;;
-
- if (size == null) {
- size = nil;
- };
- if ((block !== nil)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy new without a block")
- };
- self.enumerator = object;
- return $send(self, Opal.find_super_dispatcher(self, 'initialize', $Lazy_initialize$13, false), [size], ($$14 = function(yielder, $a){var self = $$14.$$s || this, $post_args, each_args, $$15;
-
-
-
- if (yielder == null) {
- yielder = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- each_args = $post_args;;
- try {
- return $send(object, 'each', Opal.to_a(each_args), ($$15 = function($b){var self = $$15.$$s || this, $post_args, args;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- args.unshift(yielder);
-
- Opal.yieldX(block, args);
- ;}, $$15.$$s = self, $$15.$$arity = -1, $$15))
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'Exception')])) {
- try {
- return nil
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };}, $$14.$$s = self, $$14.$$arity = -2, $$14));
- }, $Lazy_initialize$13.$$arity = -2);
- Opal.alias(self, "force", "to_a");
-
- Opal.def(self, '$lazy', $Lazy_lazy$16 = function $$lazy() {
- var self = this;
-
- return self
- }, $Lazy_lazy$16.$$arity = 0);
-
- Opal.def(self, '$collect', $Lazy_collect$17 = function $$collect() {
- var $iter = $Lazy_collect$17.$$p, block = $iter || nil, $$18, self = this;
-
- if ($iter) $Lazy_collect$17.$$p = null;
-
-
- if ($iter) $Lazy_collect$17.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block")
- };
- return $send($$($nesting, 'Lazy'), 'new', [self, self.$enumerator_size()], ($$18 = function(enum$, $a){var self = $$18.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
-
- var value = Opal.yieldX(block, args);
-
- enum$.$yield(value);
- ;}, $$18.$$s = self, $$18.$$arity = -2, $$18));
- }, $Lazy_collect$17.$$arity = 0);
-
- Opal.def(self, '$collect_concat', $Lazy_collect_concat$19 = function $$collect_concat() {
- var $iter = $Lazy_collect_concat$19.$$p, block = $iter || nil, $$20, self = this;
-
- if ($iter) $Lazy_collect_concat$19.$$p = null;
-
-
- if ($iter) $Lazy_collect_concat$19.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy map without a block")
- };
- return $send($$($nesting, 'Lazy'), 'new', [self, nil], ($$20 = function(enum$, $a){var self = $$20.$$s || this, $post_args, args, $$21, $$22;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
-
- var value = Opal.yieldX(block, args);
-
- if ((value)['$respond_to?']("force") && (value)['$respond_to?']("each")) {
- $send((value), 'each', [], ($$21 = function(v){var self = $$21.$$s || this;
-
-
-
- if (v == null) {
- v = nil;
- };
- return enum$.$yield(v);}, $$21.$$s = self, $$21.$$arity = 1, $$21))
- }
- else {
- var array = $$($nesting, 'Opal').$try_convert(value, $$($nesting, 'Array'), "to_ary");
-
- if (array === nil) {
- enum$.$yield(value);
- }
- else {
- $send((value), 'each', [], ($$22 = function(v){var self = $$22.$$s || this;
-
-
-
- if (v == null) {
- v = nil;
- };
- return enum$.$yield(v);}, $$22.$$s = self, $$22.$$arity = 1, $$22));
- }
- }
- ;}, $$20.$$s = self, $$20.$$arity = -2, $$20));
- }, $Lazy_collect_concat$19.$$arity = 0);
-
- Opal.def(self, '$drop', $Lazy_drop$23 = function $$drop(n) {
- var $$24, self = this, current_size = nil, set_size = nil, dropped = nil;
-
-
- n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_lt(n, 0))) {
- self.$raise($$($nesting, 'ArgumentError'), "attempt to drop negative size")};
- current_size = self.$enumerator_size();
- set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) {
- if ($truthy($rb_lt(n, current_size))) {
- return n
- } else {
- return current_size
- }
- } else {
- return current_size
- }; return nil; })();
- dropped = 0;
- return $send($$($nesting, 'Lazy'), 'new', [self, set_size], ($$24 = function(enum$, $a){var self = $$24.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
- if ($truthy($rb_lt(dropped, n))) {
- return (dropped = $rb_plus(dropped, 1))
- } else {
- return $send(enum$, 'yield', Opal.to_a(args))
- };}, $$24.$$s = self, $$24.$$arity = -2, $$24));
- }, $Lazy_drop$23.$$arity = 1);
-
- Opal.def(self, '$drop_while', $Lazy_drop_while$25 = function $$drop_while() {
- var $iter = $Lazy_drop_while$25.$$p, block = $iter || nil, $$26, self = this, succeeding = nil;
-
- if ($iter) $Lazy_drop_while$25.$$p = null;
-
-
- if ($iter) $Lazy_drop_while$25.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy drop_while without a block")
- };
- succeeding = true;
- return $send($$($nesting, 'Lazy'), 'new', [self, nil], ($$26 = function(enum$, $a){var self = $$26.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
- if ($truthy(succeeding)) {
-
- var value = Opal.yieldX(block, args);
-
- if ($falsy(value)) {
- succeeding = false;
-
- $send(enum$, 'yield', Opal.to_a(args));
- }
-
- } else {
- return $send(enum$, 'yield', Opal.to_a(args))
- };}, $$26.$$s = self, $$26.$$arity = -2, $$26));
- }, $Lazy_drop_while$25.$$arity = 0);
-
- Opal.def(self, '$enum_for', $Lazy_enum_for$27 = function $$enum_for($a, $b) {
- var $iter = $Lazy_enum_for$27.$$p, block = $iter || nil, $post_args, method, args, self = this;
-
- if ($iter) $Lazy_enum_for$27.$$p = null;
-
-
- if ($iter) $Lazy_enum_for$27.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- if ($post_args.length > 0) {
- method = $post_args[0];
- $post_args.splice(0, 1);
- }
- if (method == null) {
- method = "each";
- };
-
- args = $post_args;;
- return $send(self.$class(), 'for', [self, method].concat(Opal.to_a(args)), block.$to_proc());
- }, $Lazy_enum_for$27.$$arity = -1);
-
- Opal.def(self, '$find_all', $Lazy_find_all$28 = function $$find_all() {
- var $iter = $Lazy_find_all$28.$$p, block = $iter || nil, $$29, self = this;
-
- if ($iter) $Lazy_find_all$28.$$p = null;
-
-
- if ($iter) $Lazy_find_all$28.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy select without a block")
- };
- return $send($$($nesting, 'Lazy'), 'new', [self, nil], ($$29 = function(enum$, $a){var self = $$29.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
-
- var value = Opal.yieldX(block, args);
-
- if ($truthy(value)) {
- $send(enum$, 'yield', Opal.to_a(args));
- }
- ;}, $$29.$$s = self, $$29.$$arity = -2, $$29));
- }, $Lazy_find_all$28.$$arity = 0);
- Opal.alias(self, "flat_map", "collect_concat");
-
- Opal.def(self, '$grep', $Lazy_grep$30 = function $$grep(pattern) {
- var $iter = $Lazy_grep$30.$$p, block = $iter || nil, $$31, $$32, self = this;
-
- if ($iter) $Lazy_grep$30.$$p = null;
-
-
- if ($iter) $Lazy_grep$30.$$p = null;;
- if ($truthy(block)) {
- return $send($$($nesting, 'Lazy'), 'new', [self, nil], ($$31 = function(enum$, $a){var self = $$31.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
-
- var param = $$($nesting, 'Opal').$destructure(args),
- value = pattern['$==='](param);
-
- if ($truthy(value)) {
- value = Opal.yield1(block, param);
-
- enum$.$yield(Opal.yield1(block, param));
- }
- ;}, $$31.$$s = self, $$31.$$arity = -2, $$31))
- } else {
- return $send($$($nesting, 'Lazy'), 'new', [self, nil], ($$32 = function(enum$, $a){var self = $$32.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
-
- var param = $$($nesting, 'Opal').$destructure(args),
- value = pattern['$==='](param);
-
- if ($truthy(value)) {
- enum$.$yield(param);
- }
- ;}, $$32.$$s = self, $$32.$$arity = -2, $$32))
- };
- }, $Lazy_grep$30.$$arity = 1);
- Opal.alias(self, "map", "collect");
- Opal.alias(self, "select", "find_all");
-
- Opal.def(self, '$reject', $Lazy_reject$33 = function $$reject() {
- var $iter = $Lazy_reject$33.$$p, block = $iter || nil, $$34, self = this;
-
- if ($iter) $Lazy_reject$33.$$p = null;
-
-
- if ($iter) $Lazy_reject$33.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy reject without a block")
- };
- return $send($$($nesting, 'Lazy'), 'new', [self, nil], ($$34 = function(enum$, $a){var self = $$34.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
-
- var value = Opal.yieldX(block, args);
-
- if ($falsy(value)) {
- $send(enum$, 'yield', Opal.to_a(args));
- }
- ;}, $$34.$$s = self, $$34.$$arity = -2, $$34));
- }, $Lazy_reject$33.$$arity = 0);
-
- Opal.def(self, '$take', $Lazy_take$35 = function $$take(n) {
- var $$36, self = this, current_size = nil, set_size = nil, taken = nil;
-
-
- n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_lt(n, 0))) {
- self.$raise($$($nesting, 'ArgumentError'), "attempt to take negative size")};
- current_size = self.$enumerator_size();
- set_size = (function() {if ($truthy($$($nesting, 'Integer')['$==='](current_size))) {
- if ($truthy($rb_lt(n, current_size))) {
- return n
- } else {
- return current_size
- }
- } else {
- return current_size
- }; return nil; })();
- taken = 0;
- return $send($$($nesting, 'Lazy'), 'new', [self, set_size], ($$36 = function(enum$, $a){var self = $$36.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
- if ($truthy($rb_lt(taken, n))) {
-
- $send(enum$, 'yield', Opal.to_a(args));
- return (taken = $rb_plus(taken, 1));
- } else {
- return self.$raise($$($nesting, 'StopLazyError'))
- };}, $$36.$$s = self, $$36.$$arity = -2, $$36));
- }, $Lazy_take$35.$$arity = 1);
-
- Opal.def(self, '$take_while', $Lazy_take_while$37 = function $$take_while() {
- var $iter = $Lazy_take_while$37.$$p, block = $iter || nil, $$38, self = this;
-
- if ($iter) $Lazy_take_while$37.$$p = null;
-
-
- if ($iter) $Lazy_take_while$37.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to call lazy take_while without a block")
- };
- return $send($$($nesting, 'Lazy'), 'new', [self, nil], ($$38 = function(enum$, $a){var self = $$38.$$s || this, $post_args, args;
-
-
-
- if (enum$ == null) {
- enum$ = nil;
- };
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- args = $post_args;;
-
- var value = Opal.yieldX(block, args);
-
- if ($truthy(value)) {
- $send(enum$, 'yield', Opal.to_a(args));
- }
- else {
- self.$raise($$($nesting, 'StopLazyError'));
- }
- ;}, $$38.$$s = self, $$38.$$arity = -2, $$38));
- }, $Lazy_take_while$37.$$arity = 0);
- Opal.alias(self, "to_enum", "enum_for");
- return (Opal.def(self, '$inspect', $Lazy_inspect$39 = function $$inspect() {
- var self = this;
-
- return "" + "#<" + (self.$class()) + ": " + (self.enumerator.$inspect()) + ">"
- }, $Lazy_inspect$39.$$arity = 0), nil) && 'inspect';
- })($nesting[0], self, $nesting);
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/numeric"] = function(Opal) {
- function $rb_minus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
- }
- function $rb_times(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
- }
- function $rb_lt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
- }
- function $rb_divide(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);
- }
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$require', '$include', '$instance_of?', '$class', '$Float', '$respond_to?', '$coerce', '$__send__', '$===', '$raise', '$equal?', '$-', '$*', '$div', '$<', '$-@', '$ceil', '$to_f', '$denominator', '$to_r', '$==', '$floor', '$/', '$%', '$Complex', '$zero?', '$numerator', '$abs', '$arg', '$coerce_to!', '$round', '$to_i', '$truncate', '$>']);
-
- self.$require("corelib/comparable");
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Numeric');
-
- var $nesting = [self].concat($parent_nesting), $Numeric_coerce$1, $Numeric___coerced__$2, $Numeric_$lt_eq_gt$3, $Numeric_$plus$$4, $Numeric_$minus$$5, $Numeric_$percent$6, $Numeric_abs$7, $Numeric_abs2$8, $Numeric_angle$9, $Numeric_ceil$10, $Numeric_conj$11, $Numeric_denominator$12, $Numeric_div$13, $Numeric_divmod$14, $Numeric_fdiv$15, $Numeric_floor$16, $Numeric_i$17, $Numeric_imag$18, $Numeric_integer$ques$19, $Numeric_nonzero$ques$20, $Numeric_numerator$21, $Numeric_polar$22, $Numeric_quo$23, $Numeric_real$24, $Numeric_real$ques$25, $Numeric_rect$26, $Numeric_round$27, $Numeric_to_c$28, $Numeric_to_int$29, $Numeric_truncate$30, $Numeric_zero$ques$31, $Numeric_positive$ques$32, $Numeric_negative$ques$33, $Numeric_dup$34, $Numeric_clone$35, $Numeric_finite$ques$36, $Numeric_infinite$ques$37;
-
-
- self.$include($$($nesting, 'Comparable'));
-
- Opal.def(self, '$coerce', $Numeric_coerce$1 = function $$coerce(other) {
- var self = this;
-
-
- if ($truthy(other['$instance_of?'](self.$class()))) {
- return [other, self]};
- return [self.$Float(other), self.$Float(self)];
- }, $Numeric_coerce$1.$$arity = 1);
-
- Opal.def(self, '$__coerced__', $Numeric___coerced__$2 = function $$__coerced__(method, other) {
- var $a, $b, self = this, a = nil, b = nil, $case = nil;
-
- if ($truthy(other['$respond_to?']("coerce"))) {
-
- $b = other.$coerce(self), $a = Opal.to_ary($b), (a = ($a[0] == null ? nil : $a[0])), (b = ($a[1] == null ? nil : $a[1])), $b;
- return a.$__send__(method, b);
- } else {
- return (function() {$case = method;
- if ("+"['$===']($case) || "-"['$===']($case) || "*"['$===']($case) || "/"['$===']($case) || "%"['$===']($case) || "&"['$===']($case) || "|"['$===']($case) || "^"['$===']($case) || "**"['$===']($case)) {return self.$raise($$($nesting, 'TypeError'), "" + (other.$class()) + " can't be coerced into Numeric")}
- else if (">"['$===']($case) || ">="['$===']($case) || "<"['$===']($case) || "<="['$===']($case) || "<=>"['$===']($case)) {return self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (other.$class()) + " failed")}
- else { return nil }})()
- }
- }, $Numeric___coerced__$2.$$arity = 2);
-
- Opal.def(self, '$<=>', $Numeric_$lt_eq_gt$3 = function(other) {
- var self = this;
-
-
- if ($truthy(self['$equal?'](other))) {
- return 0};
- return nil;
- }, $Numeric_$lt_eq_gt$3.$$arity = 1);
-
- Opal.def(self, '$+@', $Numeric_$plus$$4 = function() {
- var self = this;
-
- return self
- }, $Numeric_$plus$$4.$$arity = 0);
-
- Opal.def(self, '$-@', $Numeric_$minus$$5 = function() {
- var self = this;
-
- return $rb_minus(0, self)
- }, $Numeric_$minus$$5.$$arity = 0);
-
- Opal.def(self, '$%', $Numeric_$percent$6 = function(other) {
- var self = this;
-
- return $rb_minus(self, $rb_times(other, self.$div(other)))
- }, $Numeric_$percent$6.$$arity = 1);
-
- Opal.def(self, '$abs', $Numeric_abs$7 = function $$abs() {
- var self = this;
-
- if ($rb_lt(self, 0)) {
- return self['$-@']()
- } else {
- return self
- }
- }, $Numeric_abs$7.$$arity = 0);
-
- Opal.def(self, '$abs2', $Numeric_abs2$8 = function $$abs2() {
- var self = this;
-
- return $rb_times(self, self)
- }, $Numeric_abs2$8.$$arity = 0);
-
- Opal.def(self, '$angle', $Numeric_angle$9 = function $$angle() {
- var self = this;
-
- if ($rb_lt(self, 0)) {
- return $$$($$($nesting, 'Math'), 'PI')
- } else {
- return 0
- }
- }, $Numeric_angle$9.$$arity = 0);
- Opal.alias(self, "arg", "angle");
-
- Opal.def(self, '$ceil', $Numeric_ceil$10 = function $$ceil(ndigits) {
- var self = this;
-
-
-
- if (ndigits == null) {
- ndigits = 0;
- };
- return self.$to_f().$ceil(ndigits);
- }, $Numeric_ceil$10.$$arity = -1);
-
- Opal.def(self, '$conj', $Numeric_conj$11 = function $$conj() {
- var self = this;
-
- return self
- }, $Numeric_conj$11.$$arity = 0);
- Opal.alias(self, "conjugate", "conj");
-
- Opal.def(self, '$denominator', $Numeric_denominator$12 = function $$denominator() {
- var self = this;
-
- return self.$to_r().$denominator()
- }, $Numeric_denominator$12.$$arity = 0);
-
- Opal.def(self, '$div', $Numeric_div$13 = function $$div(other) {
- var self = this;
-
-
- if (other['$=='](0)) {
- self.$raise($$($nesting, 'ZeroDivisionError'), "divided by o")};
- return $rb_divide(self, other).$floor();
- }, $Numeric_div$13.$$arity = 1);
-
- Opal.def(self, '$divmod', $Numeric_divmod$14 = function $$divmod(other) {
- var self = this;
-
- return [self.$div(other), self['$%'](other)]
- }, $Numeric_divmod$14.$$arity = 1);
-
- Opal.def(self, '$fdiv', $Numeric_fdiv$15 = function $$fdiv(other) {
- var self = this;
-
- return $rb_divide(self.$to_f(), other)
- }, $Numeric_fdiv$15.$$arity = 1);
-
- Opal.def(self, '$floor', $Numeric_floor$16 = function $$floor(ndigits) {
- var self = this;
-
-
-
- if (ndigits == null) {
- ndigits = 0;
- };
- return self.$to_f().$floor(ndigits);
- }, $Numeric_floor$16.$$arity = -1);
-
- Opal.def(self, '$i', $Numeric_i$17 = function $$i() {
- var self = this;
-
- return self.$Complex(0, self)
- }, $Numeric_i$17.$$arity = 0);
-
- Opal.def(self, '$imag', $Numeric_imag$18 = function $$imag() {
- var self = this;
-
- return 0
- }, $Numeric_imag$18.$$arity = 0);
- Opal.alias(self, "imaginary", "imag");
-
- Opal.def(self, '$integer?', $Numeric_integer$ques$19 = function() {
- var self = this;
-
- return false
- }, $Numeric_integer$ques$19.$$arity = 0);
- Opal.alias(self, "magnitude", "abs");
- Opal.alias(self, "modulo", "%");
-
- Opal.def(self, '$nonzero?', $Numeric_nonzero$ques$20 = function() {
- var self = this;
-
- if ($truthy(self['$zero?']())) {
- return nil
- } else {
- return self
- }
- }, $Numeric_nonzero$ques$20.$$arity = 0);
-
- Opal.def(self, '$numerator', $Numeric_numerator$21 = function $$numerator() {
- var self = this;
-
- return self.$to_r().$numerator()
- }, $Numeric_numerator$21.$$arity = 0);
- Opal.alias(self, "phase", "arg");
-
- Opal.def(self, '$polar', $Numeric_polar$22 = function $$polar() {
- var self = this;
-
- return [self.$abs(), self.$arg()]
- }, $Numeric_polar$22.$$arity = 0);
-
- Opal.def(self, '$quo', $Numeric_quo$23 = function $$quo(other) {
- var self = this;
-
- return $rb_divide($$($nesting, 'Opal')['$coerce_to!'](self, $$($nesting, 'Rational'), "to_r"), other)
- }, $Numeric_quo$23.$$arity = 1);
-
- Opal.def(self, '$real', $Numeric_real$24 = function $$real() {
- var self = this;
-
- return self
- }, $Numeric_real$24.$$arity = 0);
-
- Opal.def(self, '$real?', $Numeric_real$ques$25 = function() {
- var self = this;
-
- return true
- }, $Numeric_real$ques$25.$$arity = 0);
-
- Opal.def(self, '$rect', $Numeric_rect$26 = function $$rect() {
- var self = this;
-
- return [self, 0]
- }, $Numeric_rect$26.$$arity = 0);
- Opal.alias(self, "rectangular", "rect");
-
- Opal.def(self, '$round', $Numeric_round$27 = function $$round(digits) {
- var self = this;
-
-
- ;
- return self.$to_f().$round(digits);
- }, $Numeric_round$27.$$arity = -1);
-
- Opal.def(self, '$to_c', $Numeric_to_c$28 = function $$to_c() {
- var self = this;
-
- return self.$Complex(self, 0)
- }, $Numeric_to_c$28.$$arity = 0);
-
- Opal.def(self, '$to_int', $Numeric_to_int$29 = function $$to_int() {
- var self = this;
-
- return self.$to_i()
- }, $Numeric_to_int$29.$$arity = 0);
-
- Opal.def(self, '$truncate', $Numeric_truncate$30 = function $$truncate(ndigits) {
- var self = this;
-
-
-
- if (ndigits == null) {
- ndigits = 0;
- };
- return self.$to_f().$truncate(ndigits);
- }, $Numeric_truncate$30.$$arity = -1);
-
- Opal.def(self, '$zero?', $Numeric_zero$ques$31 = function() {
- var self = this;
-
- return self['$=='](0)
- }, $Numeric_zero$ques$31.$$arity = 0);
-
- Opal.def(self, '$positive?', $Numeric_positive$ques$32 = function() {
- var self = this;
-
- return $rb_gt(self, 0)
- }, $Numeric_positive$ques$32.$$arity = 0);
-
- Opal.def(self, '$negative?', $Numeric_negative$ques$33 = function() {
- var self = this;
-
- return $rb_lt(self, 0)
- }, $Numeric_negative$ques$33.$$arity = 0);
-
- Opal.def(self, '$dup', $Numeric_dup$34 = function $$dup() {
- var self = this;
-
- return self
- }, $Numeric_dup$34.$$arity = 0);
-
- Opal.def(self, '$clone', $Numeric_clone$35 = function $$clone($kwargs) {
- var freeze, self = this;
-
-
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- freeze = $kwargs.$$smap["freeze"];
- if (freeze == null) {
- freeze = true
- };
- return self;
- }, $Numeric_clone$35.$$arity = -1);
-
- Opal.def(self, '$finite?', $Numeric_finite$ques$36 = function() {
- var self = this;
-
- return true
- }, $Numeric_finite$ques$36.$$arity = 0);
- return (Opal.def(self, '$infinite?', $Numeric_infinite$ques$37 = function() {
- var self = this;
-
- return nil
- }, $Numeric_infinite$ques$37.$$arity = 0), nil) && 'infinite?';
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/array"] = function(Opal) {
- function $rb_gt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
- }
- function $rb_times(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);
- }
- function $rb_lt(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);
- }
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$require', '$include', '$to_a', '$warn', '$raise', '$replace', '$respond_to?', '$to_ary', '$coerce_to', '$coerce_to?', '$===', '$join', '$to_str', '$class', '$hash', '$<=>', '$==', '$object_id', '$inspect', '$enum_for', '$bsearch_index', '$to_proc', '$nil?', '$coerce_to!', '$>', '$*', '$enumerator_size', '$empty?', '$size', '$map', '$equal?', '$dup', '$each', '$[]', '$dig', '$eql?', '$length', '$begin', '$end', '$exclude_end?', '$flatten', '$__id__', '$to_s', '$new', '$max', '$min', '$!', '$>=', '$**', '$delete_if', '$reverse', '$rotate', '$rand', '$at', '$keep_if', '$shuffle!', '$<', '$sort', '$sort_by', '$!=', '$times', '$[]=', '$-', '$<<', '$values', '$is_a?', '$last', '$first', '$upto', '$reject', '$pristine', '$singleton_class']);
-
- self.$require("corelib/enumerable");
- self.$require("corelib/numeric");
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Array');
-
- var $nesting = [self].concat($parent_nesting), $Array_$$$1, $Array_initialize$2, $Array_try_convert$3, $Array_$$4, $Array_$$5, $Array_$$6, $Array_$plus$7, $Array_$minus$8, $Array_$lt$lt$9, $Array_$lt_eq_gt$10, $Array_$eq_eq$11, $Array_$$$12, $Array_$$$eq$13, $Array_any$ques$14, $Array_assoc$15, $Array_at$16, $Array_bsearch_index$17, $Array_bsearch$18, $Array_cycle$19, $Array_clear$21, $Array_count$22, $Array_initialize_copy$23, $Array_collect$24, $Array_collect$excl$26, $Array_combination$28, $Array_repeated_combination$30, $Array_compact$32, $Array_compact$excl$33, $Array_concat$34, $Array_delete$37, $Array_delete_at$38, $Array_delete_if$39, $Array_dig$41, $Array_drop$42, $Array_dup$43, $Array_each$44, $Array_each_index$46, $Array_empty$ques$48, $Array_eql$ques$49, $Array_fetch$50, $Array_fill$51, $Array_first$52, $Array_flatten$53, $Array_flatten$excl$54, $Array_hash$55, $Array_include$ques$56, $Array_index$57, $Array_insert$58, $Array_inspect$59, $Array_join$60, $Array_keep_if$61, $Array_last$63, $Array_length$64, $Array_max$65, $Array_min$66, $Array_permutation$67, $Array_repeated_permutation$69, $Array_pop$71, $Array_product$72, $Array_push$73, $Array_rassoc$74, $Array_reject$75, $Array_reject$excl$77, $Array_replace$79, $Array_reverse$80, $Array_reverse$excl$81, $Array_reverse_each$82, $Array_rindex$84, $Array_rotate$85, $Array_rotate$excl$86, $Array_sample$89, $Array_select$90, $Array_select$excl$92, $Array_shift$94, $Array_shuffle$95, $Array_shuffle$excl$96, $Array_slice$excl$97, $Array_sort$98, $Array_sort$excl$99, $Array_sort_by$excl$100, $Array_take$102, $Array_take_while$103, $Array_to_a$104, $Array_to_h$105, $Array_transpose$106, $Array_uniq$109, $Array_uniq$excl$110, $Array_unshift$111, $Array_values_at$112, $Array_zip$115, $Array_inherited$116, $Array_instance_variables$117, $Array_pack$119;
-
-
- self.$include($$($nesting, 'Enumerable'));
- Opal.defineProperty(self.$$prototype, '$$is_array', true);
-
- // Recent versions of V8 (> 7.1) only use an optimized implementation when Array.prototype is unmodified.
- // For instance, "array-splice.tq" has a "fast path" (ExtractFastJSArray, defined in "src/codegen/code-stub-assembler.cc")
- // but it's only enabled when "IsPrototypeInitialArrayPrototype()" is true.
- //
- // Older versions of V8 were using relatively fast JS-with-extensions code even when Array.prototype is modified:
- // https://github.com/v8/v8/blob/7.0.1/src/js/array.js#L599-L642
- //
- // In short, Array operations are slow in recent versions of V8 when the Array.prototype has been tampered.
- // So, when possible, we are using faster open-coded version to boost the performance.
-
- // As of V8 8.4, depending on the size of the array, this is up to ~25x times faster than Array#shift()
- // Implementation is heavily inspired by: https://github.com/nodejs/node/blob/ba684805b6c0eded76e5cd89ee00328ac7a59365/lib/internal/util.js#L341-L347
- function shiftNoArg(list) {
- var r = list[0];
- var index = 1;
- var length = list.length;
- for (; index < length; index++) {
- list[index - 1] = list[index];
- }
- list.pop();
- return r;
- }
-
- function toArraySubclass(obj, klass) {
- if (klass.$$name === Opal.Array) {
- return obj;
- } else {
- return klass.$allocate().$replace((obj).$to_a());
- }
- }
- ;
- Opal.defs(self, '$[]', $Array_$$$1 = function($a) {
- var $post_args, objects, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- objects = $post_args;;
- return toArraySubclass(objects, self);;
- }, $Array_$$$1.$$arity = -1);
-
- Opal.def(self, '$initialize', $Array_initialize$2 = function $$initialize(size, obj) {
- var $iter = $Array_initialize$2.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_initialize$2.$$p = null;
-
-
- if ($iter) $Array_initialize$2.$$p = null;;
-
- if (size == null) {
- size = nil;
- };
-
- if (obj == null) {
- obj = nil;
- };
-
- if (obj !== nil && block !== nil) {
- self.$warn("warning: block supersedes default value argument")
- }
-
- if (size > $$$($$($nesting, 'Integer'), 'MAX')) {
- self.$raise($$($nesting, 'ArgumentError'), "array size too big")
- }
-
- if (arguments.length > 2) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..2)")
- }
-
- if (arguments.length === 0) {
- self.splice(0, self.length);
- return self;
- }
-
- if (arguments.length === 1) {
- if (size.$$is_array) {
- self.$replace(size.$to_a())
- return self;
- } else if (size['$respond_to?']("to_ary")) {
- self.$replace(size.$to_ary())
- return self;
- }
- }
-
- size = $$($nesting, 'Opal').$coerce_to(size, $$($nesting, 'Integer'), "to_int")
-
- if (size < 0) {
- self.$raise($$($nesting, 'ArgumentError'), "negative array size")
- }
-
- self.splice(0, self.length);
- var i, value;
-
- if (block === nil) {
- for (i = 0; i < size; i++) {
- self.push(obj);
- }
- }
- else {
- for (i = 0, value; i < size; i++) {
- value = block(i);
- self[i] = value;
- }
- }
-
- return self;
- ;
- }, $Array_initialize$2.$$arity = -1);
- Opal.defs(self, '$try_convert', $Array_try_convert$3 = function $$try_convert(obj) {
- var self = this;
-
- return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Array'), "to_ary")
- }, $Array_try_convert$3.$$arity = 1);
-
- Opal.def(self, '$&', $Array_$$4 = function(other) {
- var self = this;
-
-
- other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) {
- return other.$to_a()
- } else {
- return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a()
- }; return nil; })();
-
- var result = [], hash = $hash2([], {}), i, length, item;
-
- for (i = 0, length = other.length; i < length; i++) {
- Opal.hash_put(hash, other[i], true);
- }
-
- for (i = 0, length = self.length; i < length; i++) {
- item = self[i];
- if (Opal.hash_delete(hash, item) !== undefined) {
- result.push(item);
- }
- }
-
- return result;
- ;
- }, $Array_$$4.$$arity = 1);
-
- Opal.def(self, '$|', $Array_$$5 = function(other) {
- var self = this;
-
-
- other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) {
- return other.$to_a()
- } else {
- return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a()
- }; return nil; })();
-
- var hash = $hash2([], {}), i, length, item;
-
- for (i = 0, length = self.length; i < length; i++) {
- Opal.hash_put(hash, self[i], true);
- }
-
- for (i = 0, length = other.length; i < length; i++) {
- Opal.hash_put(hash, other[i], true);
- }
-
- return hash.$keys();
- ;
- }, $Array_$$5.$$arity = 1);
-
- Opal.def(self, '$*', $Array_$$6 = function(other) {
- var self = this;
-
-
- if ($truthy(other['$respond_to?']("to_str"))) {
- return self.$join(other.$to_str())};
- other = $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Integer'), "to_int");
- if ($truthy(other < 0)) {
- self.$raise($$($nesting, 'ArgumentError'), "negative argument")};
-
- var result = [],
- converted = self.$to_a();
-
- for (var i = 0; i < other; i++) {
- result = result.concat(converted);
- }
-
- return toArraySubclass(result, self.$class());
- ;
- }, $Array_$$6.$$arity = 1);
-
- Opal.def(self, '$+', $Array_$plus$7 = function(other) {
- var self = this;
-
-
- other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) {
- return other.$to_a()
- } else {
- return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a()
- }; return nil; })();
- return self.concat(other);;
- }, $Array_$plus$7.$$arity = 1);
-
- Opal.def(self, '$-', $Array_$minus$8 = function(other) {
- var self = this;
-
-
- other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) {
- return other.$to_a()
- } else {
- return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a()
- }; return nil; })();
- if ($truthy(self.length === 0)) {
- return []};
- if ($truthy(other.length === 0)) {
- return self.slice()};
-
- var result = [], hash = $hash2([], {}), i, length, item;
-
- for (i = 0, length = other.length; i < length; i++) {
- Opal.hash_put(hash, other[i], true);
- }
-
- for (i = 0, length = self.length; i < length; i++) {
- item = self[i];
- if (Opal.hash_get(hash, item) === undefined) {
- result.push(item);
- }
- }
-
- return result;
- ;
- }, $Array_$minus$8.$$arity = 1);
-
- Opal.def(self, '$<<', $Array_$lt$lt$9 = function(object) {
- var self = this;
-
-
- self.push(object);
- return self;
- }, $Array_$lt$lt$9.$$arity = 1);
-
- Opal.def(self, '$<=>', $Array_$lt_eq_gt$10 = function(other) {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Array')['$==='](other))) {
- other = other.$to_a()
- } else if ($truthy(other['$respond_to?']("to_ary"))) {
- other = other.$to_ary().$to_a()
- } else {
- return nil
- };
-
- if (self.$hash() === other.$hash()) {
- return 0;
- }
-
- var count = Math.min(self.length, other.length);
-
- for (var i = 0; i < count; i++) {
- var tmp = (self[i])['$<=>'](other[i]);
-
- if (tmp !== 0) {
- return tmp;
- }
- }
-
- return (self.length)['$<=>'](other.length);
- ;
- }, $Array_$lt_eq_gt$10.$$arity = 1);
-
- Opal.def(self, '$==', $Array_$eq_eq$11 = function(other) {
- var self = this;
-
-
- var recursed = {};
-
- function _eqeq(array, other) {
- var i, length, a, b;
-
- if (array === other)
- return true;
-
- if (!other.$$is_array) {
- if ($$($nesting, 'Opal')['$respond_to?'](other, "to_ary")) {
- return (other)['$=='](array);
- } else {
- return false;
- }
- }
-
- if (array.$$constructor !== Array)
- array = (array).$to_a();
- if (other.$$constructor !== Array)
- other = (other).$to_a();
-
- if (array.length !== other.length) {
- return false;
- }
-
- recursed[(array).$object_id()] = true;
-
- for (i = 0, length = array.length; i < length; i++) {
- a = array[i];
- b = other[i];
- if (a.$$is_array) {
- if (b.$$is_array && b.length !== a.length) {
- return false;
- }
- if (!recursed.hasOwnProperty((a).$object_id())) {
- if (!_eqeq(a, b)) {
- return false;
- }
- }
- } else {
- if (!(a)['$=='](b)) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- return _eqeq(self, other);
-
- }, $Array_$eq_eq$11.$$arity = 1);
-
- function $array_slice_range(self, index) {
- var size = self.length,
- exclude, from, to, result;
-
- exclude = index.excl;
- from = Opal.Opal.$coerce_to(index.begin, Opal.Integer, 'to_int');
- to = Opal.Opal.$coerce_to(index.end, Opal.Integer, 'to_int');
-
- if (from < 0) {
- from += size;
-
- if (from < 0) {
- return nil;
- }
- }
-
- if (from > size) {
- return nil;
- }
-
- if (to < 0) {
- to += size;
-
- if (to < 0) {
- return [];
- }
- }
-
- if (!exclude) {
- to += 1;
- }
-
- result = self.slice(from, to);
- return toArraySubclass(result, self.$class());
- }
-
- function $array_slice_index_length(self, index, length) {
- var size = self.length,
- exclude, from, to, result;
-
- index = Opal.Opal.$coerce_to(index, Opal.Integer, 'to_int');
-
- if (index < 0) {
- index += size;
-
- if (index < 0) {
- return nil;
- }
- }
-
- if (length === undefined) {
- if (index >= size || index < 0) {
- return nil;
- }
-
- return self[index];
- }
- else {
- length = Opal.Opal.$coerce_to(length, Opal.Integer, 'to_int');
-
- if (length < 0 || index > size || index < 0) {
- return nil;
- }
-
- result = self.slice(index, index + length);
- }
- return toArraySubclass(result, self.$class());
- }
- ;
-
- Opal.def(self, '$[]', $Array_$$$12 = function(index, length) {
- var self = this;
-
-
- ;
-
- if (index.$$is_range) {
- return $array_slice_range(self, index);
- }
- else {
- return $array_slice_index_length(self, index, length);
- }
- ;
- }, $Array_$$$12.$$arity = -2);
-
- Opal.def(self, '$[]=', $Array_$$$eq$13 = function(index, value, extra) {
- var self = this, data = nil, length = nil;
-
-
- ;
- var i, size = self.length;;
- if ($truthy($$($nesting, 'Range')['$==='](index))) {
-
- data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) {
- return value.$to_a()
- } else if ($truthy(value['$respond_to?']("to_ary"))) {
- return value.$to_ary().$to_a()
- } else {
- return [value]
- }; return nil; })();
-
- var exclude = index.excl,
- from = $$($nesting, 'Opal').$coerce_to(index.begin, $$($nesting, 'Integer'), "to_int"),
- to = $$($nesting, 'Opal').$coerce_to(index.end, $$($nesting, 'Integer'), "to_int");
-
- if (from < 0) {
- from += size;
-
- if (from < 0) {
- self.$raise($$($nesting, 'RangeError'), "" + (index.$inspect()) + " out of range");
- }
- }
-
- if (to < 0) {
- to += size;
- }
-
- if (!exclude) {
- to += 1;
- }
-
- if (from > size) {
- for (i = size; i < from; i++) {
- self[i] = nil;
- }
- }
-
- if (to < 0) {
- self.splice.apply(self, [from, 0].concat(data));
- }
- else {
- self.splice.apply(self, [from, to - from].concat(data));
- }
-
- return value;
- ;
- } else {
-
- if ($truthy(extra === undefined)) {
- length = 1
- } else {
-
- length = value;
- value = extra;
- data = (function() {if ($truthy($$($nesting, 'Array')['$==='](value))) {
- return value.$to_a()
- } else if ($truthy(value['$respond_to?']("to_ary"))) {
- return value.$to_ary().$to_a()
- } else {
- return [value]
- }; return nil; })();
- };
-
- var old;
-
- index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int");
- length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int");
-
- if (index < 0) {
- old = index;
- index += size;
-
- if (index < 0) {
- self.$raise($$($nesting, 'IndexError'), "" + "index " + (old) + " too small for array; minimum " + (-self.length));
- }
- }
-
- if (length < 0) {
- self.$raise($$($nesting, 'IndexError'), "" + "negative length (" + (length) + ")")
- }
-
- if (index > size) {
- for (i = size; i < index; i++) {
- self[i] = nil;
- }
- }
-
- if (extra === undefined) {
- self[index] = value;
- }
- else {
- self.splice.apply(self, [index, length].concat(data));
- }
-
- return value;
- ;
- };
- }, $Array_$$$eq$13.$$arity = -3);
-
- Opal.def(self, '$any?', $Array_any$ques$14 = function(pattern) {
- var $iter = $Array_any$ques$14.$$p, block = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Array_any$ques$14.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if ($iter) $Array_any$ques$14.$$p = null;;
- ;
- if (self.length === 0) return false;
- return $send(self, Opal.find_super_dispatcher(self, 'any?', $Array_any$ques$14, false), $zuper, $iter);
- }, $Array_any$ques$14.$$arity = -1);
-
- Opal.def(self, '$assoc', $Array_assoc$15 = function $$assoc(object) {
- var self = this;
-
-
- for (var i = 0, length = self.length, item; i < length; i++) {
- if (item = self[i], item.length && (item[0])['$=='](object)) {
- return item;
- }
- }
-
- return nil;
-
- }, $Array_assoc$15.$$arity = 1);
-
- Opal.def(self, '$at', $Array_at$16 = function $$at(index) {
- var self = this;
-
-
- index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int");
-
- if (index < 0) {
- index += self.length;
- }
-
- if (index < 0 || index >= self.length) {
- return nil;
- }
-
- return self[index];
- ;
- }, $Array_at$16.$$arity = 1);
-
- Opal.def(self, '$bsearch_index', $Array_bsearch_index$17 = function $$bsearch_index() {
- var $iter = $Array_bsearch_index$17.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_bsearch_index$17.$$p = null;
-
-
- if ($iter) $Array_bsearch_index$17.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("bsearch_index")
- };
-
- var min = 0,
- max = self.length,
- mid,
- val,
- ret,
- smaller = false,
- satisfied = nil;
-
- while (min < max) {
- mid = min + Math.floor((max - min) / 2);
- val = self[mid];
- ret = Opal.yield1(block, val);
-
- if (ret === true) {
- satisfied = mid;
- smaller = true;
- }
- else if (ret === false || ret === nil) {
- smaller = false;
- }
- else if (ret.$$is_number) {
- if (ret === 0) { return mid; }
- smaller = (ret < 0);
- }
- else {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong argument type " + ((ret).$class()) + " (must be numeric, true, false or nil)")
- }
-
- if (smaller) { max = mid; } else { min = mid + 1; }
- }
-
- return satisfied;
- ;
- }, $Array_bsearch_index$17.$$arity = 0);
-
- Opal.def(self, '$bsearch', $Array_bsearch$18 = function $$bsearch() {
- var $iter = $Array_bsearch$18.$$p, block = $iter || nil, self = this, index = nil;
-
- if ($iter) $Array_bsearch$18.$$p = null;
-
-
- if ($iter) $Array_bsearch$18.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("bsearch")
- };
- index = $send(self, 'bsearch_index', [], block.$to_proc());
-
- if (index != null && index.$$is_number) {
- return self[index];
- } else {
- return index;
- }
- ;
- }, $Array_bsearch$18.$$arity = 0);
-
- Opal.def(self, '$cycle', $Array_cycle$19 = function $$cycle(n) {
- var $iter = $Array_cycle$19.$$p, block = $iter || nil, $$20, $a, self = this;
-
- if ($iter) $Array_cycle$19.$$p = null;
-
-
- if ($iter) $Array_cycle$19.$$p = null;;
-
- if (n == null) {
- n = nil;
- };
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["cycle", n], ($$20 = function(){var self = $$20.$$s || this;
-
- if ($truthy(n['$nil?']())) {
- return $$$($$($nesting, 'Float'), 'INFINITY')
- } else {
-
- n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_gt(n, 0))) {
- return $rb_times(self.$enumerator_size(), n)
- } else {
- return 0
- };
- }}, $$20.$$s = self, $$20.$$arity = 0, $$20))
- };
- if ($truthy(($truthy($a = self['$empty?']()) ? $a : n['$=='](0)))) {
- return nil};
-
- var i, length, value;
-
- if (n === nil) {
- while (true) {
- for (i = 0, length = self.length; i < length; i++) {
- value = Opal.yield1(block, self[i]);
- }
- }
- }
- else {
- n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int");
- if (n <= 0) {
- return self;
- }
-
- while (n > 0) {
- for (i = 0, length = self.length; i < length; i++) {
- value = Opal.yield1(block, self[i]);
- }
-
- n--;
- }
- }
- ;
- return self;
- }, $Array_cycle$19.$$arity = -1);
-
- Opal.def(self, '$clear', $Array_clear$21 = function $$clear() {
- var self = this;
-
-
- self.splice(0, self.length);
- return self;
- }, $Array_clear$21.$$arity = 0);
-
- Opal.def(self, '$count', $Array_count$22 = function $$count(object) {
- var $iter = $Array_count$22.$$p, block = $iter || nil, $a, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Array_count$22.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if ($iter) $Array_count$22.$$p = null;;
-
- if (object == null) {
- object = nil;
- };
- if ($truthy(($truthy($a = object) ? $a : block))) {
- return $send(self, Opal.find_super_dispatcher(self, 'count', $Array_count$22, false), $zuper, $iter)
- } else {
- return self.$size()
- };
- }, $Array_count$22.$$arity = -1);
-
- Opal.def(self, '$initialize_copy', $Array_initialize_copy$23 = function $$initialize_copy(other) {
- var self = this;
-
- return self.$replace(other)
- }, $Array_initialize_copy$23.$$arity = 1);
-
- Opal.def(self, '$collect', $Array_collect$24 = function $$collect() {
- var $iter = $Array_collect$24.$$p, block = $iter || nil, $$25, self = this;
-
- if ($iter) $Array_collect$24.$$p = null;
-
-
- if ($iter) $Array_collect$24.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["collect"], ($$25 = function(){var self = $$25.$$s || this;
-
- return self.$size()}, $$25.$$s = self, $$25.$$arity = 0, $$25))
- };
-
- var result = [];
-
- for (var i = 0, length = self.length; i < length; i++) {
- var value = Opal.yield1(block, self[i]);
- result.push(value);
- }
-
- return result;
- ;
- }, $Array_collect$24.$$arity = 0);
-
- Opal.def(self, '$collect!', $Array_collect$excl$26 = function() {
- var $iter = $Array_collect$excl$26.$$p, block = $iter || nil, $$27, self = this;
-
- if ($iter) $Array_collect$excl$26.$$p = null;
-
-
- if ($iter) $Array_collect$excl$26.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["collect!"], ($$27 = function(){var self = $$27.$$s || this;
-
- return self.$size()}, $$27.$$s = self, $$27.$$arity = 0, $$27))
- };
-
- for (var i = 0, length = self.length; i < length; i++) {
- var value = Opal.yield1(block, self[i]);
- self[i] = value;
- }
- ;
- return self;
- }, $Array_collect$excl$26.$$arity = 0);
-
- function binomial_coefficient(n, k) {
- if (n === k || k === 0) {
- return 1;
- }
-
- if (k > 0 && n > k) {
- return binomial_coefficient(n - 1, k - 1) + binomial_coefficient(n - 1, k);
- }
-
- return 0;
- }
- ;
-
- Opal.def(self, '$combination', $Array_combination$28 = function $$combination(n) {
- var $$29, $iter = $Array_combination$28.$$p, $yield = $iter || nil, self = this, num = nil;
-
- if ($iter) $Array_combination$28.$$p = null;
-
- num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int");
- if (($yield !== nil)) {
- } else {
- return $send(self, 'enum_for', ["combination", num], ($$29 = function(){var self = $$29.$$s || this;
-
- return binomial_coefficient(self.length, num)}, $$29.$$s = self, $$29.$$arity = 0, $$29))
- };
-
- var i, length, stack, chosen, lev, done, next;
-
- if (num === 0) {
- Opal.yield1($yield, [])
- } else if (num === 1) {
- for (i = 0, length = self.length; i < length; i++) {
- Opal.yield1($yield, [self[i]])
- }
- }
- else if (num === self.length) {
- Opal.yield1($yield, self.slice())
- }
- else if (num >= 0 && num < self.length) {
- stack = [];
- for (i = 0; i <= num + 1; i++) {
- stack.push(0);
- }
-
- chosen = [];
- lev = 0;
- done = false;
- stack[0] = -1;
-
- while (!done) {
- chosen[lev] = self[stack[lev+1]];
- while (lev < num - 1) {
- lev++;
- next = stack[lev+1] = stack[lev] + 1;
- chosen[lev] = self[next];
- }
- Opal.yield1($yield, chosen.slice())
- lev++;
- do {
- done = (lev === 0);
- stack[lev]++;
- lev--;
- } while ( stack[lev+1] + num === self.length + lev + 1 );
- }
- }
- ;
- return self;
- }, $Array_combination$28.$$arity = 1);
-
- Opal.def(self, '$repeated_combination', $Array_repeated_combination$30 = function $$repeated_combination(n) {
- var $$31, $iter = $Array_repeated_combination$30.$$p, $yield = $iter || nil, self = this, num = nil;
-
- if ($iter) $Array_repeated_combination$30.$$p = null;
-
- num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int");
- if (($yield !== nil)) {
- } else {
- return $send(self, 'enum_for', ["repeated_combination", num], ($$31 = function(){var self = $$31.$$s || this;
-
- return binomial_coefficient(self.length + num - 1, num);}, $$31.$$s = self, $$31.$$arity = 0, $$31))
- };
-
- function iterate(max, from, buffer, self) {
- if (buffer.length == max) {
- var copy = buffer.slice();
- Opal.yield1($yield, copy)
- return;
- }
- for (var i = from; i < self.length; i++) {
- buffer.push(self[i]);
- iterate(max, i, buffer, self);
- buffer.pop();
- }
- }
-
- if (num >= 0) {
- iterate(num, 0, [], self);
- }
- ;
- return self;
- }, $Array_repeated_combination$30.$$arity = 1);
-
- Opal.def(self, '$compact', $Array_compact$32 = function $$compact() {
- var self = this;
-
-
- var result = [];
-
- for (var i = 0, length = self.length, item; i < length; i++) {
- if ((item = self[i]) !== nil) {
- result.push(item);
- }
- }
-
- return result;
-
- }, $Array_compact$32.$$arity = 0);
-
- Opal.def(self, '$compact!', $Array_compact$excl$33 = function() {
- var self = this;
-
-
- var original = self.length;
-
- for (var i = 0, length = self.length; i < length; i++) {
- if (self[i] === nil) {
- self.splice(i, 1);
-
- length--;
- i--;
- }
- }
-
- return self.length === original ? nil : self;
-
- }, $Array_compact$excl$33.$$arity = 0);
-
- Opal.def(self, '$concat', $Array_concat$34 = function $$concat($a) {
- var $post_args, others, $$35, $$36, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- others = $post_args;;
- others = $send(others, 'map', [], ($$35 = function(other){var self = $$35.$$s || this;
-
-
-
- if (other == null) {
- other = nil;
- };
- other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) {
- return other.$to_a()
- } else {
- return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a()
- }; return nil; })();
- if ($truthy(other['$equal?'](self))) {
- other = other.$dup()};
- return other;}, $$35.$$s = self, $$35.$$arity = 1, $$35));
- $send(others, 'each', [], ($$36 = function(other){var self = $$36.$$s || this;
-
-
-
- if (other == null) {
- other = nil;
- };
-
- for (var i = 0, length = other.length; i < length; i++) {
- self.push(other[i]);
- }
- ;}, $$36.$$s = self, $$36.$$arity = 1, $$36));
- return self;
- }, $Array_concat$34.$$arity = -1);
-
- Opal.def(self, '$delete', $Array_delete$37 = function(object) {
- var $iter = $Array_delete$37.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $Array_delete$37.$$p = null;
-
- var original = self.length;
-
- for (var i = 0, length = original; i < length; i++) {
- if ((self[i])['$=='](object)) {
- self.splice(i, 1);
-
- length--;
- i--;
- }
- }
-
- if (self.length === original) {
- if (($yield !== nil)) {
- return Opal.yieldX($yield, []);
- }
- return nil;
- }
- return object;
-
- }, $Array_delete$37.$$arity = 1);
-
- Opal.def(self, '$delete_at', $Array_delete_at$38 = function $$delete_at(index) {
- var self = this;
-
-
- index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int");
-
- if (index < 0) {
- index += self.length;
- }
-
- if (index < 0 || index >= self.length) {
- return nil;
- }
-
- var result = self[index];
-
- self.splice(index, 1);
-
- return result;
-
- }, $Array_delete_at$38.$$arity = 1);
-
- Opal.def(self, '$delete_if', $Array_delete_if$39 = function $$delete_if() {
- var $iter = $Array_delete_if$39.$$p, block = $iter || nil, $$40, self = this;
-
- if ($iter) $Array_delete_if$39.$$p = null;
-
-
- if ($iter) $Array_delete_if$39.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["delete_if"], ($$40 = function(){var self = $$40.$$s || this;
-
- return self.$size()}, $$40.$$s = self, $$40.$$arity = 0, $$40))
- };
-
- for (var i = 0, length = self.length, value; i < length; i++) {
- value = block(self[i]);
-
- if (value !== false && value !== nil) {
- self.splice(i, 1);
-
- length--;
- i--;
- }
- }
- ;
- return self;
- }, $Array_delete_if$39.$$arity = 0);
-
- Opal.def(self, '$dig', $Array_dig$41 = function $$dig(idx, $a) {
- var $post_args, idxs, self = this, item = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- idxs = $post_args;;
- item = self['$[]'](idx);
-
- if (item === nil || idxs.length === 0) {
- return item;
- }
- ;
- if ($truthy(item['$respond_to?']("dig"))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method")
- };
- return $send(item, 'dig', Opal.to_a(idxs));
- }, $Array_dig$41.$$arity = -2);
-
- Opal.def(self, '$drop', $Array_drop$42 = function $$drop(number) {
- var self = this;
-
-
- if (number < 0) {
- self.$raise($$($nesting, 'ArgumentError'))
- }
-
- return self.slice(number);
-
- }, $Array_drop$42.$$arity = 1);
-
- Opal.def(self, '$dup', $Array_dup$43 = function $$dup() {
- var $iter = $Array_dup$43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Array_dup$43.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if (self.$$class === Opal.Array &&
- self.$$class.$allocate.$$pristine &&
- self.$copy_instance_variables.$$pristine &&
- self.$initialize_dup.$$pristine) {
- return self.slice(0);
- }
- ;
- return $send(self, Opal.find_super_dispatcher(self, 'dup', $Array_dup$43, false), $zuper, $iter);
- }, $Array_dup$43.$$arity = 0);
-
- Opal.def(self, '$each', $Array_each$44 = function $$each() {
- var $iter = $Array_each$44.$$p, block = $iter || nil, $$45, self = this;
-
- if ($iter) $Array_each$44.$$p = null;
-
-
- if ($iter) $Array_each$44.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each"], ($$45 = function(){var self = $$45.$$s || this;
-
- return self.$size()}, $$45.$$s = self, $$45.$$arity = 0, $$45))
- };
-
- for (var i = 0, length = self.length; i < length; i++) {
- var value = Opal.yield1(block, self[i]);
- }
- ;
- return self;
- }, $Array_each$44.$$arity = 0);
-
- Opal.def(self, '$each_index', $Array_each_index$46 = function $$each_index() {
- var $iter = $Array_each_index$46.$$p, block = $iter || nil, $$47, self = this;
-
- if ($iter) $Array_each_index$46.$$p = null;
-
-
- if ($iter) $Array_each_index$46.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each_index"], ($$47 = function(){var self = $$47.$$s || this;
-
- return self.$size()}, $$47.$$s = self, $$47.$$arity = 0, $$47))
- };
-
- for (var i = 0, length = self.length; i < length; i++) {
- var value = Opal.yield1(block, i);
- }
- ;
- return self;
- }, $Array_each_index$46.$$arity = 0);
-
- Opal.def(self, '$empty?', $Array_empty$ques$48 = function() {
- var self = this;
-
- return self.length === 0;
- }, $Array_empty$ques$48.$$arity = 0);
-
- Opal.def(self, '$eql?', $Array_eql$ques$49 = function(other) {
- var self = this;
-
-
- var recursed = {};
-
- function _eql(array, other) {
- var i, length, a, b;
-
- if (!other.$$is_array) {
- return false;
- }
-
- other = other.$to_a();
-
- if (array.length !== other.length) {
- return false;
- }
-
- recursed[(array).$object_id()] = true;
-
- for (i = 0, length = array.length; i < length; i++) {
- a = array[i];
- b = other[i];
- if (a.$$is_array) {
- if (b.$$is_array && b.length !== a.length) {
- return false;
- }
- if (!recursed.hasOwnProperty((a).$object_id())) {
- if (!_eql(a, b)) {
- return false;
- }
- }
- } else {
- if (!(a)['$eql?'](b)) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- return _eql(self, other);
-
- }, $Array_eql$ques$49.$$arity = 1);
-
- Opal.def(self, '$fetch', $Array_fetch$50 = function $$fetch(index, defaults) {
- var $iter = $Array_fetch$50.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_fetch$50.$$p = null;
-
-
- if ($iter) $Array_fetch$50.$$p = null;;
- ;
-
- var original = index;
-
- index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int");
-
- if (index < 0) {
- index += self.length;
- }
-
- if (index >= 0 && index < self.length) {
- return self[index];
- }
-
- if (block !== nil && defaults != null) {
- self.$warn("warning: block supersedes default value argument")
- }
-
- if (block !== nil) {
- return block(original);
- }
-
- if (defaults != null) {
- return defaults;
- }
-
- if (self.length === 0) {
- self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: 0...0")
- }
- else {
- self.$raise($$($nesting, 'IndexError'), "" + "index " + (original) + " outside of array bounds: -" + (self.length) + "..." + (self.length));
- }
- ;
- }, $Array_fetch$50.$$arity = -2);
-
- Opal.def(self, '$fill', $Array_fill$51 = function $$fill($a) {
- var $iter = $Array_fill$51.$$p, block = $iter || nil, $post_args, args, $b, $c, self = this, one = nil, two = nil, obj = nil, left = nil, right = nil;
-
- if ($iter) $Array_fill$51.$$p = null;
-
-
- if ($iter) $Array_fill$51.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- var i, length, value;;
- if ($truthy(block)) {
-
- if ($truthy(args.length > 2)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 0..2)")};
- $c = args, $b = Opal.to_ary($c), (one = ($b[0] == null ? nil : $b[0])), (two = ($b[1] == null ? nil : $b[1])), $c;
- } else {
-
- if ($truthy(args.length == 0)) {
- self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (0 for 1..3)")
- } else if ($truthy(args.length > 3)) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (args.$length()) + " for 1..3)")};
- $c = args, $b = Opal.to_ary($c), (obj = ($b[0] == null ? nil : $b[0])), (one = ($b[1] == null ? nil : $b[1])), (two = ($b[2] == null ? nil : $b[2])), $c;
- };
- if ($truthy($$($nesting, 'Range')['$==='](one))) {
-
- if ($truthy(two)) {
- self.$raise($$($nesting, 'TypeError'), "length invalid with range")};
- left = $$($nesting, 'Opal').$coerce_to(one.$begin(), $$($nesting, 'Integer'), "to_int");
- if ($truthy(left < 0)) {
- left += this.length};
- if ($truthy(left < 0)) {
- self.$raise($$($nesting, 'RangeError'), "" + (one.$inspect()) + " out of range")};
- right = $$($nesting, 'Opal').$coerce_to(one.$end(), $$($nesting, 'Integer'), "to_int");
- if ($truthy(right < 0)) {
- right += this.length};
- if ($truthy(one['$exclude_end?']())) {
- } else {
- right += 1
- };
- if ($truthy(right <= left)) {
- return self};
- } else if ($truthy(one)) {
-
- left = $$($nesting, 'Opal').$coerce_to(one, $$($nesting, 'Integer'), "to_int");
- if ($truthy(left < 0)) {
- left += this.length};
- if ($truthy(left < 0)) {
- left = 0};
- if ($truthy(two)) {
-
- right = $$($nesting, 'Opal').$coerce_to(two, $$($nesting, 'Integer'), "to_int");
- if ($truthy(right == 0)) {
- return self};
- right += left;
- } else {
- right = this.length
- };
- } else {
-
- left = 0;
- right = this.length;
- };
- if ($truthy(left > this.length)) {
-
- for (i = this.length; i < right; i++) {
- self[i] = nil;
- }
- };
- if ($truthy(right > this.length)) {
- this.length = right};
- if ($truthy(block)) {
-
- for (length = this.length; left < right; left++) {
- value = block(left);
- self[left] = value;
- }
-
- } else {
-
- for (length = this.length; left < right; left++) {
- self[left] = obj;
- }
-
- };
- return self;
- }, $Array_fill$51.$$arity = -1);
-
- Opal.def(self, '$first', $Array_first$52 = function $$first(count) {
- var self = this;
-
-
- ;
-
- if (count == null) {
- return self.length === 0 ? nil : self[0];
- }
-
- count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int");
-
- if (count < 0) {
- self.$raise($$($nesting, 'ArgumentError'), "negative array size");
- }
-
- return self.slice(0, count);
- ;
- }, $Array_first$52.$$arity = -1);
-
- Opal.def(self, '$flatten', $Array_flatten$53 = function $$flatten(level) {
- var self = this;
-
-
- ;
-
- function _flatten(array, level) {
- var result = [],
- i, length,
- item, ary;
-
- array = (array).$to_a();
-
- for (i = 0, length = array.length; i < length; i++) {
- item = array[i];
-
- if (!$$($nesting, 'Opal')['$respond_to?'](item, "to_ary", true)) {
- result.push(item);
- continue;
- }
-
- ary = (item).$to_ary();
-
- if (ary === nil) {
- result.push(item);
- continue;
- }
-
- if (!ary.$$is_array) {
- self.$raise($$($nesting, 'TypeError'));
- }
-
- if (ary === self) {
- self.$raise($$($nesting, 'ArgumentError'));
- }
-
- switch (level) {
- case undefined:
- result = result.concat(_flatten(ary));
- break;
- case 0:
- result.push(ary);
- break;
- default:
- result.push.apply(result, _flatten(ary, level - 1));
- }
- }
- return result;
- }
-
- if (level !== undefined) {
- level = $$($nesting, 'Opal').$coerce_to(level, $$($nesting, 'Integer'), "to_int");
- }
-
- return toArraySubclass(_flatten(self, level), self.$class());
- ;
- }, $Array_flatten$53.$$arity = -1);
-
- Opal.def(self, '$flatten!', $Array_flatten$excl$54 = function(level) {
- var self = this;
-
-
- ;
-
- var flattened = self.$flatten(level);
-
- if (self.length == flattened.length) {
- for (var i = 0, length = self.length; i < length; i++) {
- if (self[i] !== flattened[i]) {
- break;
- }
- }
-
- if (i == length) {
- return nil;
- }
- }
-
- self.$replace(flattened);
- ;
- return self;
- }, $Array_flatten$excl$54.$$arity = -1);
-
- Opal.def(self, '$hash', $Array_hash$55 = function $$hash() {
- var self = this;
-
-
- var top = (Opal.hash_ids === undefined),
- result = ['A'],
- hash_id = self.$object_id(),
- item, i, key;
-
- try {
- if (top) {
- Opal.hash_ids = Object.create(null);
- }
-
- // return early for recursive structures
- if (Opal.hash_ids[hash_id]) {
- return 'self';
- }
-
- for (key in Opal.hash_ids) {
- item = Opal.hash_ids[key];
- if (self['$eql?'](item)) {
- return 'self';
- }
- }
-
- Opal.hash_ids[hash_id] = self;
-
- for (i = 0; i < self.length; i++) {
- item = self[i];
- result.push(item.$hash());
- }
-
- return result.join(',');
- } finally {
- if (top) {
- Opal.hash_ids = undefined;
- }
- }
-
- }, $Array_hash$55.$$arity = 0);
-
- Opal.def(self, '$include?', $Array_include$ques$56 = function(member) {
- var self = this;
-
-
- for (var i = 0, length = self.length; i < length; i++) {
- if ((self[i])['$=='](member)) {
- return true;
- }
- }
-
- return false;
-
- }, $Array_include$ques$56.$$arity = 1);
-
- Opal.def(self, '$index', $Array_index$57 = function $$index(object) {
- var $iter = $Array_index$57.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_index$57.$$p = null;
-
-
- if ($iter) $Array_index$57.$$p = null;;
- ;
-
- var i, length, value;
-
- if (object != null && block !== nil) {
- self.$warn("warning: given block not used")
- }
-
- if (object != null) {
- for (i = 0, length = self.length; i < length; i++) {
- if ((self[i])['$=='](object)) {
- return i;
- }
- }
- }
- else if (block !== nil) {
- for (i = 0, length = self.length; i < length; i++) {
- value = block(self[i]);
-
- if (value !== false && value !== nil) {
- return i;
- }
- }
- }
- else {
- return self.$enum_for("index");
- }
-
- return nil;
- ;
- }, $Array_index$57.$$arity = -1);
-
- Opal.def(self, '$insert', $Array_insert$58 = function $$insert(index, $a) {
- var $post_args, objects, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- objects = $post_args;;
-
- index = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int");
-
- if (objects.length > 0) {
- if (index < 0) {
- index += self.length + 1;
-
- if (index < 0) {
- self.$raise($$($nesting, 'IndexError'), "" + (index) + " is out of bounds");
- }
- }
- if (index > self.length) {
- for (var i = self.length; i < index; i++) {
- self.push(nil);
- }
- }
-
- self.splice.apply(self, [index, 0].concat(objects));
- }
- ;
- return self;
- }, $Array_insert$58.$$arity = -2);
-
- Opal.def(self, '$inspect', $Array_inspect$59 = function $$inspect() {
- var self = this;
-
-
- var result = [],
- id = self.$__id__();
-
- for (var i = 0, length = self.length; i < length; i++) {
- var item = self['$[]'](i);
-
- if ((item).$__id__() === id) {
- result.push('[...]');
- }
- else {
- result.push((item).$inspect());
- }
- }
-
- return '[' + result.join(', ') + ']';
-
- }, $Array_inspect$59.$$arity = 0);
-
- Opal.def(self, '$join', $Array_join$60 = function $$join(sep) {
- var self = this;
- if ($gvars[","] == null) $gvars[","] = nil;
-
-
-
- if (sep == null) {
- sep = nil;
- };
- if ($truthy(self.length === 0)) {
- return ""};
- if ($truthy(sep === nil)) {
- sep = $gvars[","]};
-
- var result = [];
- var i, length, item, tmp;
-
- for (i = 0, length = self.length; i < length; i++) {
- item = self[i];
-
- if ($$($nesting, 'Opal')['$respond_to?'](item, "to_str")) {
- tmp = (item).$to_str();
-
- if (tmp !== nil) {
- result.push((tmp).$to_s());
-
- continue;
- }
- }
-
- if ($$($nesting, 'Opal')['$respond_to?'](item, "to_ary")) {
- tmp = (item).$to_ary();
-
- if (tmp === self) {
- self.$raise($$($nesting, 'ArgumentError'));
- }
-
- if (tmp !== nil) {
- result.push((tmp).$join(sep));
-
- continue;
- }
- }
-
- if ($$($nesting, 'Opal')['$respond_to?'](item, "to_s")) {
- tmp = (item).$to_s();
-
- if (tmp !== nil) {
- result.push(tmp);
-
- continue;
- }
- }
-
- self.$raise($$($nesting, 'NoMethodError').$new("" + (Opal.inspect(item)) + " doesn't respond to #to_str, #to_ary or #to_s", "to_str"));
- }
-
- if (sep === nil) {
- return result.join('');
- }
- else {
- return result.join($$($nesting, 'Opal')['$coerce_to!'](sep, $$($nesting, 'String'), "to_str").$to_s());
- }
- ;
- }, $Array_join$60.$$arity = -1);
-
- Opal.def(self, '$keep_if', $Array_keep_if$61 = function $$keep_if() {
- var $iter = $Array_keep_if$61.$$p, block = $iter || nil, $$62, self = this;
-
- if ($iter) $Array_keep_if$61.$$p = null;
-
-
- if ($iter) $Array_keep_if$61.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["keep_if"], ($$62 = function(){var self = $$62.$$s || this;
-
- return self.$size()}, $$62.$$s = self, $$62.$$arity = 0, $$62))
- };
-
- for (var i = 0, length = self.length, value; i < length; i++) {
- value = block(self[i]);
-
- if (value === false || value === nil) {
- self.splice(i, 1);
-
- length--;
- i--;
- }
- }
- ;
- return self;
- }, $Array_keep_if$61.$$arity = 0);
-
- Opal.def(self, '$last', $Array_last$63 = function $$last(count) {
- var self = this;
-
-
- ;
-
- if (count == null) {
- return self.length === 0 ? nil : self[self.length - 1];
- }
-
- count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int");
-
- if (count < 0) {
- self.$raise($$($nesting, 'ArgumentError'), "negative array size");
- }
-
- if (count > self.length) {
- count = self.length;
- }
-
- return self.slice(self.length - count, self.length);
- ;
- }, $Array_last$63.$$arity = -1);
-
- Opal.def(self, '$length', $Array_length$64 = function $$length() {
- var self = this;
-
- return self.length;
- }, $Array_length$64.$$arity = 0);
- Opal.alias(self, "map", "collect");
- Opal.alias(self, "map!", "collect!");
-
- Opal.def(self, '$max', $Array_max$65 = function $$max(n) {
- var $iter = $Array_max$65.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_max$65.$$p = null;
-
-
- if ($iter) $Array_max$65.$$p = null;;
- ;
- return $send(self.$each(), 'max', [n], block.$to_proc());
- }, $Array_max$65.$$arity = -1);
-
- Opal.def(self, '$min', $Array_min$66 = function $$min() {
- var $iter = $Array_min$66.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_min$66.$$p = null;
-
-
- if ($iter) $Array_min$66.$$p = null;;
- return $send(self.$each(), 'min', [], block.$to_proc());
- }, $Array_min$66.$$arity = 0);
-
- // Returns the product of from, from-1, ..., from - how_many + 1.
- function descending_factorial(from, how_many) {
- var count = how_many >= 0 ? 1 : 0;
- while (how_many) {
- count *= from;
- from--;
- how_many--;
- }
- return count;
- }
- ;
-
- Opal.def(self, '$permutation', $Array_permutation$67 = function $$permutation(num) {
- var $iter = $Array_permutation$67.$$p, block = $iter || nil, $$68, self = this, perm = nil, used = nil;
-
- if ($iter) $Array_permutation$67.$$p = null;
-
-
- if ($iter) $Array_permutation$67.$$p = null;;
- ;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["permutation", num], ($$68 = function(){var self = $$68.$$s || this;
-
- return descending_factorial(self.length, num === undefined ? self.length : num);}, $$68.$$s = self, $$68.$$arity = 0, $$68))
- };
-
- var permute, offensive, output;
-
- if (num === undefined) {
- num = self.length;
- }
- else {
- num = $$($nesting, 'Opal').$coerce_to(num, $$($nesting, 'Integer'), "to_int")
- }
-
- if (num < 0 || self.length < num) {
- // no permutations, yield nothing
- }
- else if (num === 0) {
- // exactly one permutation: the zero-length array
- Opal.yield1(block, [])
- }
- else if (num === 1) {
- // this is a special, easy case
- for (var i = 0; i < self.length; i++) {
- Opal.yield1(block, [self[i]])
- }
- }
- else {
- // this is the general case
- (perm = $$($nesting, 'Array').$new(num));
- (used = $$($nesting, 'Array').$new(self.length, false));
-
- permute = function(num, perm, index, used, blk) {
- self = this;
- for(var i = 0; i < self.length; i++){
- if(used['$[]'](i)['$!']()) {
- perm[index] = i;
- if(index < num - 1) {
- used[i] = true;
- permute.call(self, num, perm, index + 1, used, blk);
- used[i] = false;
- }
- else {
- output = [];
- for (var j = 0; j < perm.length; j++) {
- output.push(self[perm[j]]);
- }
- Opal.yield1(blk, output);
- }
- }
- }
- }
-
- if ((block !== nil)) {
- // offensive (both definitions) copy.
- offensive = self.slice();
- permute.call(offensive, num, perm, 0, used, block);
- }
- else {
- permute.call(self, num, perm, 0, used, block);
- }
- }
- ;
- return self;
- }, $Array_permutation$67.$$arity = -1);
-
- Opal.def(self, '$repeated_permutation', $Array_repeated_permutation$69 = function $$repeated_permutation(n) {
- var $$70, $iter = $Array_repeated_permutation$69.$$p, $yield = $iter || nil, self = this, num = nil;
-
- if ($iter) $Array_repeated_permutation$69.$$p = null;
-
- num = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int");
- if (($yield !== nil)) {
- } else {
- return $send(self, 'enum_for', ["repeated_permutation", num], ($$70 = function(){var self = $$70.$$s || this;
-
- if ($truthy($rb_ge(num, 0))) {
- return self.$size()['$**'](num)
- } else {
- return 0
- }}, $$70.$$s = self, $$70.$$arity = 0, $$70))
- };
-
- function iterate(max, buffer, self) {
- if (buffer.length == max) {
- var copy = buffer.slice();
- Opal.yield1($yield, copy)
- return;
- }
- for (var i = 0; i < self.length; i++) {
- buffer.push(self[i]);
- iterate(max, buffer, self);
- buffer.pop();
- }
- }
-
- iterate(num, [], self.slice());
- ;
- return self;
- }, $Array_repeated_permutation$69.$$arity = 1);
-
- Opal.def(self, '$pop', $Array_pop$71 = function $$pop(count) {
- var self = this;
-
-
- ;
- if ($truthy(count === undefined)) {
-
- if ($truthy(self.length === 0)) {
- return nil};
- return self.pop();};
- count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int");
- if ($truthy(count < 0)) {
- self.$raise($$($nesting, 'ArgumentError'), "negative array size")};
- if ($truthy(self.length === 0)) {
- return []};
- if ($truthy(count > self.length)) {
- return self.splice(0, self.length);
- } else {
- return self.splice(self.length - count, self.length);
- };
- }, $Array_pop$71.$$arity = -1);
-
- Opal.def(self, '$product', $Array_product$72 = function $$product($a) {
- var $iter = $Array_product$72.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $Array_product$72.$$p = null;
-
-
- if ($iter) $Array_product$72.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- var result = (block !== nil) ? null : [],
- n = args.length + 1,
- counters = new Array(n),
- lengths = new Array(n),
- arrays = new Array(n),
- i, m, subarray, len, resultlen = 1;
-
- arrays[0] = self;
- for (i = 1; i < n; i++) {
- arrays[i] = $$($nesting, 'Opal').$coerce_to(args[i - 1], $$($nesting, 'Array'), "to_ary");
- }
-
- for (i = 0; i < n; i++) {
- len = arrays[i].length;
- if (len === 0) {
- return result || self;
- }
- resultlen *= len;
- if (resultlen > 2147483647) {
- self.$raise($$($nesting, 'RangeError'), "too big to product")
- }
- lengths[i] = len;
- counters[i] = 0;
- }
-
- outer_loop: for (;;) {
- subarray = [];
- for (i = 0; i < n; i++) {
- subarray.push(arrays[i][counters[i]]);
- }
- if (result) {
- result.push(subarray);
- } else {
- Opal.yield1(block, subarray)
- }
- m = n - 1;
- counters[m]++;
- while (counters[m] === lengths[m]) {
- counters[m] = 0;
- if (--m < 0) break outer_loop;
- counters[m]++;
- }
- }
-
- return result || self;
- ;
- }, $Array_product$72.$$arity = -1);
-
- Opal.def(self, '$push', $Array_push$73 = function $$push($a) {
- var $post_args, objects, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- objects = $post_args;;
-
- for (var i = 0, length = objects.length; i < length; i++) {
- self.push(objects[i]);
- }
- ;
- return self;
- }, $Array_push$73.$$arity = -1);
- Opal.alias(self, "append", "push");
-
- Opal.def(self, '$rassoc', $Array_rassoc$74 = function $$rassoc(object) {
- var self = this;
-
-
- for (var i = 0, length = self.length, item; i < length; i++) {
- item = self[i];
-
- if (item.length && item[1] !== undefined) {
- if ((item[1])['$=='](object)) {
- return item;
- }
- }
- }
-
- return nil;
-
- }, $Array_rassoc$74.$$arity = 1);
-
- Opal.def(self, '$reject', $Array_reject$75 = function $$reject() {
- var $iter = $Array_reject$75.$$p, block = $iter || nil, $$76, self = this;
-
- if ($iter) $Array_reject$75.$$p = null;
-
-
- if ($iter) $Array_reject$75.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["reject"], ($$76 = function(){var self = $$76.$$s || this;
-
- return self.$size()}, $$76.$$s = self, $$76.$$arity = 0, $$76))
- };
-
- var result = [];
-
- for (var i = 0, length = self.length, value; i < length; i++) {
- value = block(self[i]);
-
- if (value === false || value === nil) {
- result.push(self[i]);
- }
- }
- return result;
- ;
- }, $Array_reject$75.$$arity = 0);
-
- Opal.def(self, '$reject!', $Array_reject$excl$77 = function() {
- var $iter = $Array_reject$excl$77.$$p, block = $iter || nil, $$78, self = this, original = nil;
-
- if ($iter) $Array_reject$excl$77.$$p = null;
-
-
- if ($iter) $Array_reject$excl$77.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["reject!"], ($$78 = function(){var self = $$78.$$s || this;
-
- return self.$size()}, $$78.$$s = self, $$78.$$arity = 0, $$78))
- };
- original = self.$length();
- $send(self, 'delete_if', [], block.$to_proc());
- if (self.$length()['$=='](original)) {
- return nil
- } else {
- return self
- };
- }, $Array_reject$excl$77.$$arity = 0);
-
- Opal.def(self, '$replace', $Array_replace$79 = function $$replace(other) {
- var self = this;
-
-
- other = (function() {if ($truthy($$($nesting, 'Array')['$==='](other))) {
- return other.$to_a()
- } else {
- return $$($nesting, 'Opal').$coerce_to(other, $$($nesting, 'Array'), "to_ary").$to_a()
- }; return nil; })();
-
- self.splice(0, self.length);
- self.push.apply(self, other);
- ;
- return self;
- }, $Array_replace$79.$$arity = 1);
-
- Opal.def(self, '$reverse', $Array_reverse$80 = function $$reverse() {
- var self = this;
-
- return self.slice(0).reverse();
- }, $Array_reverse$80.$$arity = 0);
-
- Opal.def(self, '$reverse!', $Array_reverse$excl$81 = function() {
- var self = this;
-
- return self.reverse();
- }, $Array_reverse$excl$81.$$arity = 0);
-
- Opal.def(self, '$reverse_each', $Array_reverse_each$82 = function $$reverse_each() {
- var $iter = $Array_reverse_each$82.$$p, block = $iter || nil, $$83, self = this;
-
- if ($iter) $Array_reverse_each$82.$$p = null;
-
-
- if ($iter) $Array_reverse_each$82.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["reverse_each"], ($$83 = function(){var self = $$83.$$s || this;
-
- return self.$size()}, $$83.$$s = self, $$83.$$arity = 0, $$83))
- };
- $send(self.$reverse(), 'each', [], block.$to_proc());
- return self;
- }, $Array_reverse_each$82.$$arity = 0);
-
- Opal.def(self, '$rindex', $Array_rindex$84 = function $$rindex(object) {
- var $iter = $Array_rindex$84.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_rindex$84.$$p = null;
-
-
- if ($iter) $Array_rindex$84.$$p = null;;
- ;
-
- var i, value;
-
- if (object != null && block !== nil) {
- self.$warn("warning: given block not used")
- }
-
- if (object != null) {
- for (i = self.length - 1; i >= 0; i--) {
- if (i >= self.length) {
- break;
- }
- if ((self[i])['$=='](object)) {
- return i;
- }
- }
- }
- else if (block !== nil) {
- for (i = self.length - 1; i >= 0; i--) {
- if (i >= self.length) {
- break;
- }
-
- value = block(self[i]);
-
- if (value !== false && value !== nil) {
- return i;
- }
- }
- }
- else if (object == null) {
- return self.$enum_for("rindex");
- }
-
- return nil;
- ;
- }, $Array_rindex$84.$$arity = -1);
-
- Opal.def(self, '$rotate', $Array_rotate$85 = function $$rotate(n) {
- var self = this;
-
-
-
- if (n == null) {
- n = 1;
- };
- n = $$($nesting, 'Opal').$coerce_to(n, $$($nesting, 'Integer'), "to_int");
-
- var ary, idx, firstPart, lastPart;
-
- if (self.length === 1) {
- return self.slice();
- }
- if (self.length === 0) {
- return [];
- }
-
- ary = self.slice();
- idx = n % ary.length;
-
- firstPart = ary.slice(idx);
- lastPart = ary.slice(0, idx);
- return firstPart.concat(lastPart);
- ;
- }, $Array_rotate$85.$$arity = -1);
-
- Opal.def(self, '$rotate!', $Array_rotate$excl$86 = function(cnt) {
- var self = this, ary = nil;
-
-
-
- if (cnt == null) {
- cnt = 1;
- };
-
- if (self.length === 0 || self.length === 1) {
- return self;
- }
- ;
- cnt = $$($nesting, 'Opal').$coerce_to(cnt, $$($nesting, 'Integer'), "to_int");
- ary = self.$rotate(cnt);
- return self.$replace(ary);
- }, $Array_rotate$excl$86.$$arity = -1);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'SampleRandom');
-
- var $nesting = [self].concat($parent_nesting), $SampleRandom_initialize$87, $SampleRandom_rand$88;
-
- self.$$prototype.rng = nil;
-
-
- Opal.def(self, '$initialize', $SampleRandom_initialize$87 = function $$initialize(rng) {
- var self = this;
-
- return (self.rng = rng)
- }, $SampleRandom_initialize$87.$$arity = 1);
- return (Opal.def(self, '$rand', $SampleRandom_rand$88 = function $$rand(size) {
- var self = this, random = nil;
-
-
- random = $$($nesting, 'Opal').$coerce_to(self.rng.$rand(size), $$($nesting, 'Integer'), "to_int");
- if ($truthy(random < 0)) {
- self.$raise($$($nesting, 'RangeError'), "random value must be >= 0")};
- if ($truthy(random < size)) {
- } else {
- self.$raise($$($nesting, 'RangeError'), "random value must be less than Array size")
- };
- return random;
- }, $SampleRandom_rand$88.$$arity = 1), nil) && 'rand';
- })($nesting[0], null, $nesting);
-
- Opal.def(self, '$sample', $Array_sample$89 = function $$sample(count, options) {
- var $a, self = this, o = nil, rng = nil;
-
-
- ;
- ;
- if ($truthy(count === undefined)) {
- return self.$at($$($nesting, 'Kernel').$rand(self.length))};
- if ($truthy(options === undefined)) {
- if ($truthy((o = $$($nesting, 'Opal')['$coerce_to?'](count, $$($nesting, 'Hash'), "to_hash")))) {
-
- options = o;
- count = nil;
- } else {
-
- options = nil;
- count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int");
- }
- } else {
-
- count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int");
- options = $$($nesting, 'Opal').$coerce_to(options, $$($nesting, 'Hash'), "to_hash");
- };
- if ($truthy(($truthy($a = count) ? count < 0 : $a))) {
- self.$raise($$($nesting, 'ArgumentError'), "count must be greater than 0")};
- if ($truthy(options)) {
- rng = options['$[]']("random")};
- rng = (function() {if ($truthy(($truthy($a = rng) ? rng['$respond_to?']("rand") : $a))) {
- return $$($nesting, 'SampleRandom').$new(rng)
- } else {
- return $$($nesting, 'Kernel')
- }; return nil; })();
- if ($truthy(count)) {
- } else {
- return self[rng.$rand(self.length)]
- };
-
-
- var abandon, spin, result, i, j, k, targetIndex, oldValue;
-
- if (count > self.length) {
- count = self.length;
- }
-
- switch (count) {
- case 0:
- return [];
- break;
- case 1:
- return [self[rng.$rand(self.length)]];
- break;
- case 2:
- i = rng.$rand(self.length);
- j = rng.$rand(self.length);
- if (i === j) {
- j = i === 0 ? i + 1 : i - 1;
- }
- return [self[i], self[j]];
- break;
- default:
- if (self.length / count > 3) {
- abandon = false;
- spin = 0;
-
- result = $$($nesting, 'Array').$new(count);
- i = 1;
-
- result[0] = rng.$rand(self.length);
- while (i < count) {
- k = rng.$rand(self.length);
- j = 0;
-
- while (j < i) {
- while (k === result[j]) {
- spin++;
- if (spin > 100) {
- abandon = true;
- break;
- }
- k = rng.$rand(self.length);
- }
- if (abandon) { break; }
-
- j++;
- }
-
- if (abandon) { break; }
-
- result[i] = k;
-
- i++;
- }
-
- if (!abandon) {
- i = 0;
- while (i < count) {
- result[i] = self[result[i]];
- i++;
- }
-
- return result;
- }
- }
-
- result = self.slice();
-
- for (var c = 0; c < count; c++) {
- targetIndex = rng.$rand(self.length);
- oldValue = result[c];
- result[c] = result[targetIndex];
- result[targetIndex] = oldValue;
- }
-
- return count === self.length ? result : (result)['$[]'](0, count);
- }
- ;
- }, $Array_sample$89.$$arity = -1);
-
- Opal.def(self, '$select', $Array_select$90 = function $$select() {
- var $iter = $Array_select$90.$$p, block = $iter || nil, $$91, self = this;
-
- if ($iter) $Array_select$90.$$p = null;
-
-
- if ($iter) $Array_select$90.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["select"], ($$91 = function(){var self = $$91.$$s || this;
-
- return self.$size()}, $$91.$$s = self, $$91.$$arity = 0, $$91))
- };
-
- var result = [];
-
- for (var i = 0, length = self.length, item, value; i < length; i++) {
- item = self[i];
-
- value = Opal.yield1(block, item);
-
- if (Opal.truthy(value)) {
- result.push(item);
- }
- }
-
- return result;
- ;
- }, $Array_select$90.$$arity = 0);
-
- Opal.def(self, '$select!', $Array_select$excl$92 = function() {
- var $iter = $Array_select$excl$92.$$p, block = $iter || nil, $$93, self = this;
-
- if ($iter) $Array_select$excl$92.$$p = null;
-
-
- if ($iter) $Array_select$excl$92.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["select!"], ($$93 = function(){var self = $$93.$$s || this;
-
- return self.$size()}, $$93.$$s = self, $$93.$$arity = 0, $$93))
- };
-
- var original = self.length;
- $send(self, 'keep_if', [], block.$to_proc());
- return self.length === original ? nil : self;
- ;
- }, $Array_select$excl$92.$$arity = 0);
-
- Opal.def(self, '$shift', $Array_shift$94 = function $$shift(count) {
- var self = this;
-
-
- ;
- if ($truthy(count === undefined)) {
-
- if ($truthy(self.length === 0)) {
- return nil};
- return shiftNoArg(self);};
- count = $$($nesting, 'Opal').$coerce_to(count, $$($nesting, 'Integer'), "to_int");
- if ($truthy(count < 0)) {
- self.$raise($$($nesting, 'ArgumentError'), "negative array size")};
- if ($truthy(self.length === 0)) {
- return []};
- return self.splice(0, count);;
- }, $Array_shift$94.$$arity = -1);
- Opal.alias(self, "size", "length");
-
- Opal.def(self, '$shuffle', $Array_shuffle$95 = function $$shuffle(rng) {
- var self = this;
-
-
- ;
- return self.$dup().$to_a()['$shuffle!'](rng);
- }, $Array_shuffle$95.$$arity = -1);
-
- Opal.def(self, '$shuffle!', $Array_shuffle$excl$96 = function(rng) {
- var self = this;
-
-
- ;
-
- var randgen, i = self.length, j, tmp;
-
- if (rng !== undefined) {
- rng = $$($nesting, 'Opal')['$coerce_to?'](rng, $$($nesting, 'Hash'), "to_hash");
-
- if (rng !== nil) {
- rng = rng['$[]']("random");
-
- if (rng !== nil && rng['$respond_to?']("rand")) {
- randgen = rng;
- }
- }
- }
-
- while (i) {
- if (randgen) {
- j = randgen.$rand(i).$to_int();
-
- if (j < 0) {
- self.$raise($$($nesting, 'RangeError'), "" + "random number too small " + (j))
- }
-
- if (j >= i) {
- self.$raise($$($nesting, 'RangeError'), "" + "random number too big " + (j))
- }
- }
- else {
- j = self.$rand(i);
- }
-
- tmp = self[--i];
- self[i] = self[j];
- self[j] = tmp;
- }
-
- return self;
- ;
- }, $Array_shuffle$excl$96.$$arity = -1);
- Opal.alias(self, "slice", "[]");
-
- Opal.def(self, '$slice!', $Array_slice$excl$97 = function(index, length) {
- var self = this, result = nil, range = nil, range_start = nil, range_end = nil, start = nil;
-
-
- ;
- result = nil;
- if ($truthy(length === undefined)) {
- if ($truthy($$($nesting, 'Range')['$==='](index))) {
-
- range = index;
- result = self['$[]'](range);
- range_start = $$($nesting, 'Opal').$coerce_to(range.$begin(), $$($nesting, 'Integer'), "to_int");
- range_end = $$($nesting, 'Opal').$coerce_to(range.$end(), $$($nesting, 'Integer'), "to_int");
-
- if (range_start < 0) {
- range_start += self.length;
- }
-
- if (range_end < 0) {
- range_end += self.length;
- } else if (range_end >= self.length) {
- range_end = self.length - 1;
- if (range.excl) {
- range_end += 1;
- }
- }
-
- var range_length = range_end - range_start;
- if (range.excl) {
- range_end -= 1;
- } else {
- range_length += 1;
- }
-
- if (range_start < self.length && range_start >= 0 && range_end < self.length && range_end >= 0 && range_length > 0) {
- self.splice(range_start, range_length);
- }
- ;
- } else {
-
- start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int");
-
- if (start < 0) {
- start += self.length;
- }
-
- if (start < 0 || start >= self.length) {
- return nil;
- }
-
- result = self[start];
-
- if (start === 0) {
- self.shift();
- } else {
- self.splice(start, 1);
- }
- ;
- }
- } else {
-
- start = $$($nesting, 'Opal').$coerce_to(index, $$($nesting, 'Integer'), "to_int");
- length = $$($nesting, 'Opal').$coerce_to(length, $$($nesting, 'Integer'), "to_int");
-
- if (length < 0) {
- return nil;
- }
-
- var end = start + length;
-
- result = self['$[]'](start, length);
-
- if (start < 0) {
- start += self.length;
- }
-
- if (start + length > self.length) {
- length = self.length - start;
- }
-
- if (start < self.length && start >= 0) {
- self.splice(start, length);
- }
- ;
- };
- return result;
- }, $Array_slice$excl$97.$$arity = -2);
-
- Opal.def(self, '$sort', $Array_sort$98 = function $$sort() {
- var $iter = $Array_sort$98.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_sort$98.$$p = null;
-
-
- if ($iter) $Array_sort$98.$$p = null;;
- if ($truthy(self.length > 1)) {
- } else {
- return self
- };
-
- if (block === nil) {
- block = function(a, b) {
- return (a)['$<=>'](b);
- };
- }
-
- return self.slice().sort(function(x, y) {
- var ret = block(x, y);
-
- if (ret === nil) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + ((x).$inspect()) + " with " + ((y).$inspect()) + " failed");
- }
-
- return $rb_gt(ret, 0) ? 1 : ($rb_lt(ret, 0) ? -1 : 0);
- });
- ;
- }, $Array_sort$98.$$arity = 0);
-
- Opal.def(self, '$sort!', $Array_sort$excl$99 = function() {
- var $iter = $Array_sort$excl$99.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_sort$excl$99.$$p = null;
-
-
- if ($iter) $Array_sort$excl$99.$$p = null;;
-
- var result;
-
- if ((block !== nil)) {
- result = $send((self.slice()), 'sort', [], block.$to_proc());
- }
- else {
- result = (self.slice()).$sort();
- }
-
- self.length = 0;
- for(var i = 0, length = result.length; i < length; i++) {
- self.push(result[i]);
- }
-
- return self;
- ;
- }, $Array_sort$excl$99.$$arity = 0);
-
- Opal.def(self, '$sort_by!', $Array_sort_by$excl$100 = function() {
- var $iter = $Array_sort_by$excl$100.$$p, block = $iter || nil, $$101, self = this;
-
- if ($iter) $Array_sort_by$excl$100.$$p = null;
-
-
- if ($iter) $Array_sort_by$excl$100.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["sort_by!"], ($$101 = function(){var self = $$101.$$s || this;
-
- return self.$size()}, $$101.$$s = self, $$101.$$arity = 0, $$101))
- };
- return self.$replace($send(self, 'sort_by', [], block.$to_proc()));
- }, $Array_sort_by$excl$100.$$arity = 0);
-
- Opal.def(self, '$take', $Array_take$102 = function $$take(count) {
- var self = this;
-
-
- if (count < 0) {
- self.$raise($$($nesting, 'ArgumentError'));
- }
-
- return self.slice(0, count);
-
- }, $Array_take$102.$$arity = 1);
-
- Opal.def(self, '$take_while', $Array_take_while$103 = function $$take_while() {
- var $iter = $Array_take_while$103.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_take_while$103.$$p = null;
-
-
- if ($iter) $Array_take_while$103.$$p = null;;
-
- var result = [];
-
- for (var i = 0, length = self.length, item, value; i < length; i++) {
- item = self[i];
-
- value = block(item);
-
- if (value === false || value === nil) {
- return result;
- }
-
- result.push(item);
- }
-
- return result;
- ;
- }, $Array_take_while$103.$$arity = 0);
-
- Opal.def(self, '$to_a', $Array_to_a$104 = function $$to_a() {
- var self = this;
-
- return self
- }, $Array_to_a$104.$$arity = 0);
- Opal.alias(self, "to_ary", "to_a");
-
- Opal.def(self, '$to_h', $Array_to_h$105 = function $$to_h() {
- var self = this;
-
-
- var i, len = self.length, ary, key, val, hash = $hash2([], {});
-
- for (i = 0; i < len; i++) {
- ary = $$($nesting, 'Opal')['$coerce_to?'](self[i], $$($nesting, 'Array'), "to_ary");
- if (!ary.$$is_array) {
- self.$raise($$($nesting, 'TypeError'), "" + "wrong element type " + ((ary).$class()) + " at " + (i) + " (expected array)")
- }
- if (ary.length !== 2) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong array length at " + (i) + " (expected 2, was " + ((ary).$length()) + ")")
- }
- key = ary[0];
- val = ary[1];
- Opal.hash_put(hash, key, val);
- }
-
- return hash;
-
- }, $Array_to_h$105.$$arity = 0);
- Opal.alias(self, "to_s", "inspect");
-
- Opal.def(self, '$transpose', $Array_transpose$106 = function $$transpose() {
- var $$107, self = this, result = nil, max = nil;
-
-
- if ($truthy(self['$empty?']())) {
- return []};
- result = [];
- max = nil;
- $send(self, 'each', [], ($$107 = function(row){var self = $$107.$$s || this, $a, $$108;
-
-
-
- if (row == null) {
- row = nil;
- };
- row = (function() {if ($truthy($$($nesting, 'Array')['$==='](row))) {
- return row.$to_a()
- } else {
- return $$($nesting, 'Opal').$coerce_to(row, $$($nesting, 'Array'), "to_ary").$to_a()
- }; return nil; })();
- max = ($truthy($a = max) ? $a : row.length);
- if ($truthy((row.length)['$!='](max))) {
- self.$raise($$($nesting, 'IndexError'), "" + "element size differs (" + (row.length) + " should be " + (max) + ")")};
- return $send((row.length), 'times', [], ($$108 = function(i){var self = $$108.$$s || this, $b, entry = nil, $writer = nil;
-
-
-
- if (i == null) {
- i = nil;
- };
- entry = ($truthy($b = result['$[]'](i)) ? $b : (($writer = [i, []]), $send(result, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- return entry['$<<'](row.$at(i));}, $$108.$$s = self, $$108.$$arity = 1, $$108));}, $$107.$$s = self, $$107.$$arity = 1, $$107));
- return result;
- }, $Array_transpose$106.$$arity = 0);
-
- Opal.def(self, '$uniq', $Array_uniq$109 = function $$uniq() {
- var $iter = $Array_uniq$109.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_uniq$109.$$p = null;
-
-
- if ($iter) $Array_uniq$109.$$p = null;;
-
- var hash = $hash2([], {}), i, length, item, key;
-
- if (block === nil) {
- for (i = 0, length = self.length; i < length; i++) {
- item = self[i];
- if (Opal.hash_get(hash, item) === undefined) {
- Opal.hash_put(hash, item, item);
- }
- }
- }
- else {
- for (i = 0, length = self.length; i < length; i++) {
- item = self[i];
- key = Opal.yield1(block, item);
- if (Opal.hash_get(hash, key) === undefined) {
- Opal.hash_put(hash, key, item);
- }
- }
- }
-
- return toArraySubclass((hash).$values(), self.$class());
- ;
- }, $Array_uniq$109.$$arity = 0);
-
- Opal.def(self, '$uniq!', $Array_uniq$excl$110 = function() {
- var $iter = $Array_uniq$excl$110.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Array_uniq$excl$110.$$p = null;
-
-
- if ($iter) $Array_uniq$excl$110.$$p = null;;
-
- var original_length = self.length, hash = $hash2([], {}), i, length, item, key;
-
- for (i = 0, length = original_length; i < length; i++) {
- item = self[i];
- key = (block === nil ? item : Opal.yield1(block, item));
-
- if (Opal.hash_get(hash, key) === undefined) {
- Opal.hash_put(hash, key, item);
- continue;
- }
-
- self.splice(i, 1);
- length--;
- i--;
- }
-
- return self.length === original_length ? nil : self;
- ;
- }, $Array_uniq$excl$110.$$arity = 0);
-
- Opal.def(self, '$unshift', $Array_unshift$111 = function $$unshift($a) {
- var $post_args, objects, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- objects = $post_args;;
-
- for (var i = objects.length - 1; i >= 0; i--) {
- self.unshift(objects[i]);
- }
- ;
- return self;
- }, $Array_unshift$111.$$arity = -1);
- Opal.alias(self, "prepend", "unshift");
-
- Opal.def(self, '$values_at', $Array_values_at$112 = function $$values_at($a) {
- var $post_args, args, $$113, self = this, out = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- out = [];
- $send(args, 'each', [], ($$113 = function(elem){var self = $$113.$$s || this, $$114, finish = nil, start = nil, i = nil;
-
-
-
- if (elem == null) {
- elem = nil;
- };
- if ($truthy(elem['$is_a?']($$($nesting, 'Range')))) {
-
- finish = $$($nesting, 'Opal').$coerce_to(elem.$last(), $$($nesting, 'Integer'), "to_int");
- start = $$($nesting, 'Opal').$coerce_to(elem.$first(), $$($nesting, 'Integer'), "to_int");
-
- if (start < 0) {
- start = start + self.length;
- return nil;;
- }
- ;
-
- if (finish < 0) {
- finish = finish + self.length;
- }
- if (elem['$exclude_end?']()) {
- finish--;
- }
- if (finish < start) {
- return nil;;
- }
- ;
- return $send(start, 'upto', [finish], ($$114 = function(i){var self = $$114.$$s || this;
-
-
-
- if (i == null) {
- i = nil;
- };
- return out['$<<'](self.$at(i));}, $$114.$$s = self, $$114.$$arity = 1, $$114));
- } else {
-
- i = $$($nesting, 'Opal').$coerce_to(elem, $$($nesting, 'Integer'), "to_int");
- return out['$<<'](self.$at(i));
- };}, $$113.$$s = self, $$113.$$arity = 1, $$113));
- return out;
- }, $Array_values_at$112.$$arity = -1);
-
- Opal.def(self, '$zip', $Array_zip$115 = function $$zip($a) {
- var $iter = $Array_zip$115.$$p, block = $iter || nil, $post_args, others, $b, self = this;
-
- if ($iter) $Array_zip$115.$$p = null;
-
-
- if ($iter) $Array_zip$115.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- others = $post_args;;
-
- var result = [], size = self.length, part, o, i, j, jj;
-
- for (j = 0, jj = others.length; j < jj; j++) {
- o = others[j];
- if (o.$$is_array) {
- continue;
- }
- if (o.$$is_enumerator) {
- if (o.$size() === Infinity) {
- others[j] = o.$take(size);
- } else {
- others[j] = o.$to_a();
- }
- continue;
- }
- others[j] = ($truthy($b = $$($nesting, 'Opal')['$coerce_to?'](o, $$($nesting, 'Array'), "to_ary")) ? $b : $$($nesting, 'Opal')['$coerce_to!'](o, $$($nesting, 'Enumerator'), "each")).$to_a();
- }
-
- for (i = 0; i < size; i++) {
- part = [self[i]];
-
- for (j = 0, jj = others.length; j < jj; j++) {
- o = others[j][i];
-
- if (o == null) {
- o = nil;
- }
-
- part[j + 1] = o;
- }
-
- result[i] = part;
- }
-
- if (block !== nil) {
- for (i = 0; i < size; i++) {
- block(result[i]);
- }
-
- return nil;
- }
-
- return result;
- ;
- }, $Array_zip$115.$$arity = -1);
- Opal.defs(self, '$inherited', $Array_inherited$116 = function $$inherited(klass) {
- var self = this;
-
-
- klass.$$prototype.$to_a = function() {
- return this.slice(0, this.length);
- }
-
- }, $Array_inherited$116.$$arity = 1);
-
- Opal.def(self, '$instance_variables', $Array_instance_variables$117 = function $$instance_variables() {
- var $$118, $iter = $Array_instance_variables$117.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Array_instance_variables$117.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- return $send($send(self, Opal.find_super_dispatcher(self, 'instance_variables', $Array_instance_variables$117, false), $zuper, $iter), 'reject', [], ($$118 = function(ivar){var self = $$118.$$s || this, $a;
-
-
-
- if (ivar == null) {
- ivar = nil;
- };
- return ($truthy($a = /^@\d+$/.test(ivar)) ? $a : ivar['$==']("@length"));}, $$118.$$s = self, $$118.$$arity = 1, $$118))
- }, $Array_instance_variables$117.$$arity = 0);
- $$($nesting, 'Opal').$pristine(self.$singleton_class(), "allocate");
- $$($nesting, 'Opal').$pristine(self, "copy_instance_variables", "initialize_dup");
- return (Opal.def(self, '$pack', $Array_pack$119 = function $$pack($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return self.$raise("To use Array#pack, you must first require 'corelib/array/pack'.");
- }, $Array_pack$119.$$arity = -1), nil) && 'pack';
- })($nesting[0], Array, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/hash"] = function(Opal) {
- function $rb_ge(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_minus(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, $klass = Opal.klass, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$require', '$include', '$coerce_to?', '$[]', '$merge!', '$allocate', '$raise', '$coerce_to!', '$each', '$fetch', '$>=', '$>', '$==', '$compare_by_identity', '$lambda?', '$abs', '$arity', '$enum_for', '$size', '$respond_to?', '$class', '$dig', '$new', '$inspect', '$map', '$to_proc', '$flatten', '$eql?', '$default', '$dup', '$default_proc', '$default_proc=', '$-', '$default=', '$proc']);
-
- self.$require("corelib/enumerable");
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Hash');
-
- var $nesting = [self].concat($parent_nesting), $Hash_$$$1, $Hash_allocate$2, $Hash_try_convert$3, $Hash_initialize$4, $Hash_$eq_eq$5, $Hash_$gt_eq$6, $Hash_$gt$8, $Hash_$lt$9, $Hash_$lt_eq$10, $Hash_$$$11, $Hash_$$$eq$12, $Hash_assoc$13, $Hash_clear$14, $Hash_clone$15, $Hash_compact$16, $Hash_compact$excl$17, $Hash_compare_by_identity$18, $Hash_compare_by_identity$ques$19, $Hash_default$20, $Hash_default$eq$21, $Hash_default_proc$22, $Hash_default_proc$eq$23, $Hash_delete$24, $Hash_delete_if$25, $Hash_dig$27, $Hash_each$28, $Hash_each_key$30, $Hash_each_value$32, $Hash_empty$ques$34, $Hash_fetch$35, $Hash_fetch_values$36, $Hash_flatten$38, $Hash_has_key$ques$39, $Hash_has_value$ques$40, $Hash_hash$41, $Hash_index$42, $Hash_indexes$43, $Hash_inspect$44, $Hash_invert$45, $Hash_keep_if$46, $Hash_keys$48, $Hash_length$49, $Hash_merge$50, $Hash_merge$excl$51, $Hash_rassoc$52, $Hash_rehash$53, $Hash_reject$54, $Hash_reject$excl$56, $Hash_replace$58, $Hash_select$59, $Hash_select$excl$61, $Hash_shift$63, $Hash_slice$64, $Hash_to_a$65, $Hash_to_h$66, $Hash_to_hash$67, $Hash_to_proc$68, $Hash_transform_keys$70, $Hash_transform_keys$excl$72, $Hash_transform_values$74, $Hash_transform_values$excl$76, $Hash_values$78;
-
-
- self.$include($$($nesting, 'Enumerable'));
- self.$$prototype.$$is_hash = true;
- Opal.defs(self, '$[]', $Hash_$$$1 = function($a) {
- var $post_args, argv, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- argv = $post_args;;
-
- var hash, argc = argv.length, i;
-
- if (argc === 1) {
- hash = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Hash'), "to_hash");
- if (hash !== nil) {
- return self.$allocate()['$merge!'](hash);
- }
-
- argv = $$($nesting, 'Opal')['$coerce_to?'](argv['$[]'](0), $$($nesting, 'Array'), "to_ary");
- if (argv === nil) {
- self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash")
- }
-
- argc = argv.length;
- hash = self.$allocate();
-
- for (i = 0; i < argc; i++) {
- if (!argv[i].$$is_array) continue;
- switch(argv[i].length) {
- case 1:
- hash.$store(argv[i][0], nil);
- break;
- case 2:
- hash.$store(argv[i][0], argv[i][1]);
- break;
- default:
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid number of elements (" + (argv[i].length) + " for 1..2)")
- }
- }
-
- return hash;
- }
-
- if (argc % 2 !== 0) {
- self.$raise($$($nesting, 'ArgumentError'), "odd number of arguments for Hash")
- }
-
- hash = self.$allocate();
-
- for (i = 0; i < argc; i += 2) {
- hash.$store(argv[i], argv[i + 1]);
- }
-
- return hash;
- ;
- }, $Hash_$$$1.$$arity = -1);
- Opal.defs(self, '$allocate', $Hash_allocate$2 = function $$allocate() {
- var self = this;
-
-
- var hash = new self.$$constructor();
-
- Opal.hash_init(hash);
-
- hash.$$none = nil;
- hash.$$proc = nil;
-
- return hash;
-
- }, $Hash_allocate$2.$$arity = 0);
- Opal.defs(self, '$try_convert', $Hash_try_convert$3 = function $$try_convert(obj) {
- var self = this;
-
- return $$($nesting, 'Opal')['$coerce_to?'](obj, $$($nesting, 'Hash'), "to_hash")
- }, $Hash_try_convert$3.$$arity = 1);
-
- Opal.def(self, '$initialize', $Hash_initialize$4 = function $$initialize(defaults) {
- var $iter = $Hash_initialize$4.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Hash_initialize$4.$$p = null;
-
-
- if ($iter) $Hash_initialize$4.$$p = null;;
- ;
-
- if (defaults !== undefined && block !== nil) {
- self.$raise($$($nesting, 'ArgumentError'), "wrong number of arguments (1 for 0)")
- }
- self.$$none = (defaults === undefined ? nil : defaults);
- self.$$proc = block;
-
- return self;
- ;
- }, $Hash_initialize$4.$$arity = -1);
-
- Opal.def(self, '$==', $Hash_$eq_eq$5 = function(other) {
- var self = this;
-
-
- if (self === other) {
- return true;
- }
-
- if (!other.$$is_hash) {
- return false;
- }
-
- if (self.$$keys.length !== other.$$keys.length) {
- return false;
- }
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, other_value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- other_value = other.$$smap[key];
- } else {
- value = key.value;
- other_value = Opal.hash_get(other, key.key);
- }
-
- if (other_value === undefined || !value['$eql?'](other_value)) {
- return false;
- }
- }
-
- return true;
-
- }, $Hash_$eq_eq$5.$$arity = 1);
-
- Opal.def(self, '$>=', $Hash_$gt_eq$6 = function(other) {
- var $$7, self = this, result = nil;
-
-
- other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash");
-
- if (self.$$keys.length < other.$$keys.length) {
- return false
- }
- ;
- result = true;
- $send(other, 'each', [], ($$7 = function(other_key, other_val){var self = $$7.$$s || this, val = nil;
-
-
-
- if (other_key == null) {
- other_key = nil;
- };
-
- if (other_val == null) {
- other_val = nil;
- };
- val = self.$fetch(other_key, null);
-
- if (val == null || val !== other_val) {
- result = false;
- return;
- }
- ;}, $$7.$$s = self, $$7.$$arity = 2, $$7));
- return result;
- }, $Hash_$gt_eq$6.$$arity = 1);
-
- Opal.def(self, '$>', $Hash_$gt$8 = function(other) {
- var self = this;
-
-
- other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash");
-
- if (self.$$keys.length <= other.$$keys.length) {
- return false
- }
- ;
- return $rb_ge(self, other);
- }, $Hash_$gt$8.$$arity = 1);
-
- Opal.def(self, '$<', $Hash_$lt$9 = function(other) {
- var self = this;
-
-
- other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash");
- return $rb_gt(other, self);
- }, $Hash_$lt$9.$$arity = 1);
-
- Opal.def(self, '$<=', $Hash_$lt_eq$10 = function(other) {
- var self = this;
-
-
- other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash");
- return $rb_ge(other, self);
- }, $Hash_$lt_eq$10.$$arity = 1);
-
- Opal.def(self, '$[]', $Hash_$$$11 = function(key) {
- var self = this;
-
-
- var value = Opal.hash_get(self, key);
-
- if (value !== undefined) {
- return value;
- }
-
- return self.$default(key);
-
- }, $Hash_$$$11.$$arity = 1);
-
- Opal.def(self, '$[]=', $Hash_$$$eq$12 = function(key, value) {
- var self = this;
-
-
- Opal.hash_put(self, key, value);
- return value;
-
- }, $Hash_$$$eq$12.$$arity = 2);
-
- Opal.def(self, '$assoc', $Hash_assoc$13 = function $$assoc(object) {
- var self = this;
-
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- if ((key)['$=='](object)) {
- return [key, self.$$smap[key]];
- }
- } else {
- if ((key.key)['$=='](object)) {
- return [key.key, key.value];
- }
- }
- }
-
- return nil;
-
- }, $Hash_assoc$13.$$arity = 1);
-
- Opal.def(self, '$clear', $Hash_clear$14 = function $$clear() {
- var self = this;
-
-
- Opal.hash_init(self);
- return self;
-
- }, $Hash_clear$14.$$arity = 0);
-
- Opal.def(self, '$clone', $Hash_clone$15 = function $$clone() {
- var self = this;
-
-
- var hash = new self.$$class();
-
- Opal.hash_init(hash);
- Opal.hash_clone(self, hash);
-
- return hash;
-
- }, $Hash_clone$15.$$arity = 0);
-
- Opal.def(self, '$compact', $Hash_compact$16 = function $$compact() {
- var self = this;
-
-
- var hash = Opal.hash();
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- if (value !== nil) {
- Opal.hash_put(hash, key, value);
- }
- }
-
- return hash;
-
- }, $Hash_compact$16.$$arity = 0);
-
- Opal.def(self, '$compact!', $Hash_compact$excl$17 = function() {
- var self = this;
-
-
- var changes_were_made = false;
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- if (value === nil) {
- if (Opal.hash_delete(self, key) !== undefined) {
- changes_were_made = true;
- length--;
- i--;
- }
- }
- }
-
- return changes_were_made ? self : nil;
-
- }, $Hash_compact$excl$17.$$arity = 0);
-
- Opal.def(self, '$compare_by_identity', $Hash_compare_by_identity$18 = function $$compare_by_identity() {
- var self = this;
-
-
- var i, ii, key, keys = self.$$keys, identity_hash;
-
- if (self.$$by_identity) return self;
- if (self.$$keys.length === 0) {
- self.$$by_identity = true
- return self;
- }
-
- identity_hash = $hash2([], {}).$compare_by_identity();
- for(i = 0, ii = keys.length; i < ii; i++) {
- key = keys[i];
- if (!key.$$is_string) key = key.key;
- Opal.hash_put(identity_hash, key, Opal.hash_get(self, key));
- }
-
- self.$$by_identity = true;
- self.$$map = identity_hash.$$map;
- self.$$smap = identity_hash.$$smap;
- return self;
-
- }, $Hash_compare_by_identity$18.$$arity = 0);
-
- Opal.def(self, '$compare_by_identity?', $Hash_compare_by_identity$ques$19 = function() {
- var self = this;
-
- return self.$$by_identity === true;
- }, $Hash_compare_by_identity$ques$19.$$arity = 0);
-
- Opal.def(self, '$default', $Hash_default$20 = function(key) {
- var self = this;
-
-
- ;
-
- if (key !== undefined && self.$$proc !== nil && self.$$proc !== undefined) {
- return self.$$proc.$call(self, key);
- }
- if (self.$$none === undefined) {
- return nil;
- }
- return self.$$none;
- ;
- }, $Hash_default$20.$$arity = -1);
-
- Opal.def(self, '$default=', $Hash_default$eq$21 = function(object) {
- var self = this;
-
-
- self.$$proc = nil;
- self.$$none = object;
-
- return object;
-
- }, $Hash_default$eq$21.$$arity = 1);
-
- Opal.def(self, '$default_proc', $Hash_default_proc$22 = function $$default_proc() {
- var self = this;
-
-
- if (self.$$proc !== undefined) {
- return self.$$proc;
- }
- return nil;
-
- }, $Hash_default_proc$22.$$arity = 0);
-
- Opal.def(self, '$default_proc=', $Hash_default_proc$eq$23 = function(default_proc) {
- var self = this;
-
-
- var proc = default_proc;
-
- if (proc !== nil) {
- proc = $$($nesting, 'Opal')['$coerce_to!'](proc, $$($nesting, 'Proc'), "to_proc");
-
- if ((proc)['$lambda?']() && (proc).$arity().$abs() !== 2) {
- self.$raise($$($nesting, 'TypeError'), "default_proc takes two arguments");
- }
- }
-
- self.$$none = nil;
- self.$$proc = proc;
-
- return default_proc;
-
- }, $Hash_default_proc$eq$23.$$arity = 1);
-
- Opal.def(self, '$delete', $Hash_delete$24 = function(key) {
- var $iter = $Hash_delete$24.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Hash_delete$24.$$p = null;
-
-
- if ($iter) $Hash_delete$24.$$p = null;;
-
- var value = Opal.hash_delete(self, key);
-
- if (value !== undefined) {
- return value;
- }
-
- if (block !== nil) {
- return Opal.yield1(block, key);
- }
-
- return nil;
- ;
- }, $Hash_delete$24.$$arity = 1);
-
- Opal.def(self, '$delete_if', $Hash_delete_if$25 = function $$delete_if() {
- var $iter = $Hash_delete_if$25.$$p, block = $iter || nil, $$26, self = this;
-
- if ($iter) $Hash_delete_if$25.$$p = null;
-
-
- if ($iter) $Hash_delete_if$25.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["delete_if"], ($$26 = function(){var self = $$26.$$s || this;
-
- return self.$size()}, $$26.$$s = self, $$26.$$arity = 0, $$26))
- };
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- obj = block(key, value);
-
- if (obj !== false && obj !== nil) {
- if (Opal.hash_delete(self, key) !== undefined) {
- length--;
- i--;
- }
- }
- }
-
- return self;
- ;
- }, $Hash_delete_if$25.$$arity = 0);
- Opal.alias(self, "dup", "clone");
-
- Opal.def(self, '$dig', $Hash_dig$27 = function $$dig(key, $a) {
- var $post_args, keys, self = this, item = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- keys = $post_args;;
- item = self['$[]'](key);
-
- if (item === nil || keys.length === 0) {
- return item;
- }
- ;
- if ($truthy(item['$respond_to?']("dig"))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method")
- };
- return $send(item, 'dig', Opal.to_a(keys));
- }, $Hash_dig$27.$$arity = -2);
-
- Opal.def(self, '$each', $Hash_each$28 = function $$each() {
- var $iter = $Hash_each$28.$$p, block = $iter || nil, $$29, self = this;
-
- if ($iter) $Hash_each$28.$$p = null;
-
-
- if ($iter) $Hash_each$28.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["each"], ($$29 = function(){var self = $$29.$$s || this;
-
- return self.$size()}, $$29.$$s = self, $$29.$$arity = 0, $$29))
- };
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- Opal.yield1(block, [key, value]);
- }
-
- return self;
- ;
- }, $Hash_each$28.$$arity = 0);
-
- Opal.def(self, '$each_key', $Hash_each_key$30 = function $$each_key() {
- var $iter = $Hash_each_key$30.$$p, block = $iter || nil, $$31, self = this;
-
- if ($iter) $Hash_each_key$30.$$p = null;
-
-
- if ($iter) $Hash_each_key$30.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["each_key"], ($$31 = function(){var self = $$31.$$s || this;
-
- return self.$size()}, $$31.$$s = self, $$31.$$arity = 0, $$31))
- };
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) {
- key = keys[i];
-
- block(key.$$is_string ? key : key.key);
- }
-
- return self;
- ;
- }, $Hash_each_key$30.$$arity = 0);
- Opal.alias(self, "each_pair", "each");
-
- Opal.def(self, '$each_value', $Hash_each_value$32 = function $$each_value() {
- var $iter = $Hash_each_value$32.$$p, block = $iter || nil, $$33, self = this;
-
- if ($iter) $Hash_each_value$32.$$p = null;
-
-
- if ($iter) $Hash_each_value$32.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["each_value"], ($$33 = function(){var self = $$33.$$s || this;
-
- return self.$size()}, $$33.$$s = self, $$33.$$arity = 0, $$33))
- };
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) {
- key = keys[i];
-
- block(key.$$is_string ? self.$$smap[key] : key.value);
- }
-
- return self;
- ;
- }, $Hash_each_value$32.$$arity = 0);
-
- Opal.def(self, '$empty?', $Hash_empty$ques$34 = function() {
- var self = this;
-
- return self.$$keys.length === 0;
- }, $Hash_empty$ques$34.$$arity = 0);
- Opal.alias(self, "eql?", "==");
-
- Opal.def(self, '$fetch', $Hash_fetch$35 = function $$fetch(key, defaults) {
- var $iter = $Hash_fetch$35.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Hash_fetch$35.$$p = null;
-
-
- if ($iter) $Hash_fetch$35.$$p = null;;
- ;
-
- var value = Opal.hash_get(self, key);
-
- if (value !== undefined) {
- return value;
- }
-
- if (block !== nil) {
- return block(key);
- }
-
- if (defaults !== undefined) {
- return defaults;
- }
- ;
- return self.$raise($$($nesting, 'KeyError').$new("" + "key not found: " + (key.$inspect()), $hash2(["key", "receiver"], {"key": key, "receiver": self})));
- }, $Hash_fetch$35.$$arity = -2);
-
- Opal.def(self, '$fetch_values', $Hash_fetch_values$36 = function $$fetch_values($a) {
- var $iter = $Hash_fetch_values$36.$$p, block = $iter || nil, $post_args, keys, $$37, self = this;
-
- if ($iter) $Hash_fetch_values$36.$$p = null;
-
-
- if ($iter) $Hash_fetch_values$36.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- keys = $post_args;;
- return $send(keys, 'map', [], ($$37 = function(key){var self = $$37.$$s || this;
-
-
-
- if (key == null) {
- key = nil;
- };
- return $send(self, 'fetch', [key], block.$to_proc());}, $$37.$$s = self, $$37.$$arity = 1, $$37));
- }, $Hash_fetch_values$36.$$arity = -1);
-
- Opal.def(self, '$flatten', $Hash_flatten$38 = function $$flatten(level) {
- var self = this;
-
-
-
- if (level == null) {
- level = 1;
- };
- level = $$($nesting, 'Opal')['$coerce_to!'](level, $$($nesting, 'Integer'), "to_int");
-
- var result = [];
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- result.push(key);
-
- if (value.$$is_array) {
- if (level === 1) {
- result.push(value);
- continue;
- }
-
- result = result.concat((value).$flatten(level - 2));
- continue;
- }
-
- result.push(value);
- }
-
- return result;
- ;
- }, $Hash_flatten$38.$$arity = -1);
-
- Opal.def(self, '$has_key?', $Hash_has_key$ques$39 = function(key) {
- var self = this;
-
- return Opal.hash_get(self, key) !== undefined;
- }, $Hash_has_key$ques$39.$$arity = 1);
-
- Opal.def(self, '$has_value?', $Hash_has_value$ques$40 = function(value) {
- var self = this;
-
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) {
- key = keys[i];
-
- if (((key.$$is_string ? self.$$smap[key] : key.value))['$=='](value)) {
- return true;
- }
- }
-
- return false;
-
- }, $Hash_has_value$ques$40.$$arity = 1);
-
- Opal.def(self, '$hash', $Hash_hash$41 = function $$hash() {
- var self = this;
-
-
- var top = (Opal.hash_ids === undefined),
- hash_id = self.$object_id(),
- result = ['Hash'],
- key, item;
-
- try {
- if (top) {
- Opal.hash_ids = Object.create(null);
- }
-
- if (Opal[hash_id]) {
- return 'self';
- }
-
- for (key in Opal.hash_ids) {
- item = Opal.hash_ids[key];
- if (self['$eql?'](item)) {
- return 'self';
- }
- }
-
- Opal.hash_ids[hash_id] = self;
-
- for (var i = 0, keys = self.$$keys, length = keys.length; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- result.push([key, self.$$smap[key].$hash()]);
- } else {
- result.push([key.key_hash, key.value.$hash()]);
- }
- }
-
- return result.sort().join();
-
- } finally {
- if (top) {
- Opal.hash_ids = undefined;
- }
- }
-
- }, $Hash_hash$41.$$arity = 0);
- Opal.alias(self, "include?", "has_key?");
-
- Opal.def(self, '$index', $Hash_index$42 = function $$index(object) {
- var self = this;
-
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- if ((value)['$=='](object)) {
- return key;
- }
- }
-
- return nil;
-
- }, $Hash_index$42.$$arity = 1);
-
- Opal.def(self, '$indexes', $Hash_indexes$43 = function $$indexes($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- var result = [];
-
- for (var i = 0, length = args.length, key, value; i < length; i++) {
- key = args[i];
- value = Opal.hash_get(self, key);
-
- if (value === undefined) {
- result.push(self.$default());
- continue;
- }
-
- result.push(value);
- }
-
- return result;
- ;
- }, $Hash_indexes$43.$$arity = -1);
- Opal.alias(self, "indices", "indexes");
- var inspect_ids;
-
- Opal.def(self, '$inspect', $Hash_inspect$44 = function $$inspect() {
- var self = this;
-
-
- var top = (inspect_ids === undefined),
- hash_id = self.$object_id(),
- result = [];
-
- try {
- if (top) {
- inspect_ids = {};
- }
-
- if (inspect_ids.hasOwnProperty(hash_id)) {
- return '{...}';
- }
-
- inspect_ids[hash_id] = true;
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- result.push(key.$inspect() + '=>' + value.$inspect());
- }
-
- return '{' + result.join(', ') + '}';
-
- } finally {
- if (top) {
- inspect_ids = undefined;
- }
- }
-
- }, $Hash_inspect$44.$$arity = 0);
-
- Opal.def(self, '$invert', $Hash_invert$45 = function $$invert() {
- var self = this;
-
-
- var hash = Opal.hash();
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- Opal.hash_put(hash, value, key);
- }
-
- return hash;
-
- }, $Hash_invert$45.$$arity = 0);
-
- Opal.def(self, '$keep_if', $Hash_keep_if$46 = function $$keep_if() {
- var $iter = $Hash_keep_if$46.$$p, block = $iter || nil, $$47, self = this;
-
- if ($iter) $Hash_keep_if$46.$$p = null;
-
-
- if ($iter) $Hash_keep_if$46.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["keep_if"], ($$47 = function(){var self = $$47.$$s || this;
-
- return self.$size()}, $$47.$$s = self, $$47.$$arity = 0, $$47))
- };
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- obj = block(key, value);
-
- if (obj === false || obj === nil) {
- if (Opal.hash_delete(self, key) !== undefined) {
- length--;
- i--;
- }
- }
- }
-
- return self;
- ;
- }, $Hash_keep_if$46.$$arity = 0);
- Opal.alias(self, "key", "index");
- Opal.alias(self, "key?", "has_key?");
-
- Opal.def(self, '$keys', $Hash_keys$48 = function $$keys() {
- var self = this;
-
-
- var result = [];
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- result.push(key);
- } else {
- result.push(key.key);
- }
- }
-
- return result;
-
- }, $Hash_keys$48.$$arity = 0);
-
- Opal.def(self, '$length', $Hash_length$49 = function $$length() {
- var self = this;
-
- return self.$$keys.length;
- }, $Hash_length$49.$$arity = 0);
- Opal.alias(self, "member?", "has_key?");
-
- Opal.def(self, '$merge', $Hash_merge$50 = function $$merge(other) {
- var $iter = $Hash_merge$50.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Hash_merge$50.$$p = null;
-
-
- if ($iter) $Hash_merge$50.$$p = null;;
- return $send(self.$dup(), 'merge!', [other], block.$to_proc());
- }, $Hash_merge$50.$$arity = 1);
-
- Opal.def(self, '$merge!', $Hash_merge$excl$51 = function(other) {
- var $iter = $Hash_merge$excl$51.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Hash_merge$excl$51.$$p = null;
-
-
- if ($iter) $Hash_merge$excl$51.$$p = null;;
-
- if (!other.$$is_hash) {
- other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash");
- }
-
- var i, other_keys = other.$$keys, length = other_keys.length, key, value, other_value;
-
- if (block === nil) {
- for (i = 0; i < length; i++) {
- key = other_keys[i];
-
- if (key.$$is_string) {
- other_value = other.$$smap[key];
- } else {
- other_value = key.value;
- key = key.key;
- }
-
- Opal.hash_put(self, key, other_value);
- }
-
- return self;
- }
-
- for (i = 0; i < length; i++) {
- key = other_keys[i];
-
- if (key.$$is_string) {
- other_value = other.$$smap[key];
- } else {
- other_value = key.value;
- key = key.key;
- }
-
- value = Opal.hash_get(self, key);
-
- if (value === undefined) {
- Opal.hash_put(self, key, other_value);
- continue;
- }
-
- Opal.hash_put(self, key, block(key, value, other_value));
- }
-
- return self;
- ;
- }, $Hash_merge$excl$51.$$arity = 1);
-
- Opal.def(self, '$rassoc', $Hash_rassoc$52 = function $$rassoc(object) {
- var self = this;
-
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- if ((value)['$=='](object)) {
- return [key, value];
- }
- }
-
- return nil;
-
- }, $Hash_rassoc$52.$$arity = 1);
-
- Opal.def(self, '$rehash', $Hash_rehash$53 = function $$rehash() {
- var self = this;
-
-
- Opal.hash_rehash(self);
- return self;
-
- }, $Hash_rehash$53.$$arity = 0);
-
- Opal.def(self, '$reject', $Hash_reject$54 = function $$reject() {
- var $iter = $Hash_reject$54.$$p, block = $iter || nil, $$55, self = this;
-
- if ($iter) $Hash_reject$54.$$p = null;
-
-
- if ($iter) $Hash_reject$54.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["reject"], ($$55 = function(){var self = $$55.$$s || this;
-
- return self.$size()}, $$55.$$s = self, $$55.$$arity = 0, $$55))
- };
-
- var hash = Opal.hash();
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- obj = block(key, value);
-
- if (obj === false || obj === nil) {
- Opal.hash_put(hash, key, value);
- }
- }
-
- return hash;
- ;
- }, $Hash_reject$54.$$arity = 0);
-
- Opal.def(self, '$reject!', $Hash_reject$excl$56 = function() {
- var $iter = $Hash_reject$excl$56.$$p, block = $iter || nil, $$57, self = this;
-
- if ($iter) $Hash_reject$excl$56.$$p = null;
-
-
- if ($iter) $Hash_reject$excl$56.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["reject!"], ($$57 = function(){var self = $$57.$$s || this;
-
- return self.$size()}, $$57.$$s = self, $$57.$$arity = 0, $$57))
- };
-
- var changes_were_made = false;
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- obj = block(key, value);
-
- if (obj !== false && obj !== nil) {
- if (Opal.hash_delete(self, key) !== undefined) {
- changes_were_made = true;
- length--;
- i--;
- }
- }
- }
-
- return changes_were_made ? self : nil;
- ;
- }, $Hash_reject$excl$56.$$arity = 0);
-
- Opal.def(self, '$replace', $Hash_replace$58 = function $$replace(other) {
- var self = this, $writer = nil;
-
-
- other = $$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Hash'), "to_hash");
-
- Opal.hash_init(self);
-
- for (var i = 0, other_keys = other.$$keys, length = other_keys.length, key, value, other_value; i < length; i++) {
- key = other_keys[i];
-
- if (key.$$is_string) {
- other_value = other.$$smap[key];
- } else {
- other_value = key.value;
- key = key.key;
- }
-
- Opal.hash_put(self, key, other_value);
- }
- ;
- if ($truthy(other.$default_proc())) {
-
- $writer = [other.$default_proc()];
- $send(self, 'default_proc=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = [other.$default()];
- $send(self, 'default=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- return self;
- }, $Hash_replace$58.$$arity = 1);
-
- Opal.def(self, '$select', $Hash_select$59 = function $$select() {
- var $iter = $Hash_select$59.$$p, block = $iter || nil, $$60, self = this;
-
- if ($iter) $Hash_select$59.$$p = null;
-
-
- if ($iter) $Hash_select$59.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["select"], ($$60 = function(){var self = $$60.$$s || this;
-
- return self.$size()}, $$60.$$s = self, $$60.$$arity = 0, $$60))
- };
-
- var hash = Opal.hash();
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- obj = block(key, value);
-
- if (obj !== false && obj !== nil) {
- Opal.hash_put(hash, key, value);
- }
- }
-
- return hash;
- ;
- }, $Hash_select$59.$$arity = 0);
-
- Opal.def(self, '$select!', $Hash_select$excl$61 = function() {
- var $iter = $Hash_select$excl$61.$$p, block = $iter || nil, $$62, self = this;
-
- if ($iter) $Hash_select$excl$61.$$p = null;
-
-
- if ($iter) $Hash_select$excl$61.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["select!"], ($$62 = function(){var self = $$62.$$s || this;
-
- return self.$size()}, $$62.$$s = self, $$62.$$arity = 0, $$62))
- };
-
- var result = nil;
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value, obj; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- obj = block(key, value);
-
- if (obj === false || obj === nil) {
- if (Opal.hash_delete(self, key) !== undefined) {
- length--;
- i--;
- }
- result = self;
- }
- }
-
- return result;
- ;
- }, $Hash_select$excl$61.$$arity = 0);
-
- Opal.def(self, '$shift', $Hash_shift$63 = function $$shift() {
- var self = this;
-
-
- var keys = self.$$keys,
- key;
-
- if (keys.length > 0) {
- key = keys[0];
-
- key = key.$$is_string ? key : key.key;
-
- return [key, Opal.hash_delete(self, key)];
- }
-
- return self.$default(nil);
-
- }, $Hash_shift$63.$$arity = 0);
- Opal.alias(self, "size", "length");
-
- Opal.def(self, '$slice', $Hash_slice$64 = function $$slice($a) {
- var $post_args, keys, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- keys = $post_args;;
-
- var result = Opal.hash();
-
- for (var i = 0, length = keys.length; i < length; i++) {
- var key = keys[i], value = Opal.hash_get(self, key);
-
- if (value !== undefined) {
- Opal.hash_put(result, key, value);
- }
- }
-
- return result;
- ;
- }, $Hash_slice$64.$$arity = -1);
- Opal.alias(self, "store", "[]=");
-
- Opal.def(self, '$to_a', $Hash_to_a$65 = function $$to_a() {
- var self = this;
-
-
- var result = [];
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- result.push([key, value]);
- }
-
- return result;
-
- }, $Hash_to_a$65.$$arity = 0);
-
- Opal.def(self, '$to_h', $Hash_to_h$66 = function $$to_h() {
- var self = this;
-
-
- if (self.$$class === Opal.Hash) {
- return self;
- }
-
- var hash = new Opal.Hash();
-
- Opal.hash_init(hash);
- Opal.hash_clone(self, hash);
-
- return hash;
-
- }, $Hash_to_h$66.$$arity = 0);
-
- Opal.def(self, '$to_hash', $Hash_to_hash$67 = function $$to_hash() {
- var self = this;
-
- return self
- }, $Hash_to_hash$67.$$arity = 0);
-
- Opal.def(self, '$to_proc', $Hash_to_proc$68 = function $$to_proc() {
- var $$69, self = this;
-
- return $send(self, 'proc', [], ($$69 = function(key){var self = $$69.$$s || this;
-
-
- ;
-
- if (key == null) {
- self.$raise($$($nesting, 'ArgumentError'), "no key given")
- }
- ;
- return self['$[]'](key);}, $$69.$$s = self, $$69.$$arity = -1, $$69))
- }, $Hash_to_proc$68.$$arity = 0);
- Opal.alias(self, "to_s", "inspect");
-
- Opal.def(self, '$transform_keys', $Hash_transform_keys$70 = function $$transform_keys() {
- var $iter = $Hash_transform_keys$70.$$p, block = $iter || nil, $$71, self = this;
-
- if ($iter) $Hash_transform_keys$70.$$p = null;
-
-
- if ($iter) $Hash_transform_keys$70.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["transform_keys"], ($$71 = function(){var self = $$71.$$s || this;
-
- return self.$size()}, $$71.$$s = self, $$71.$$arity = 0, $$71))
- };
-
- var result = Opal.hash();
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- key = Opal.yield1(block, key);
-
- Opal.hash_put(result, key, value);
- }
-
- return result;
- ;
- }, $Hash_transform_keys$70.$$arity = 0);
-
- Opal.def(self, '$transform_keys!', $Hash_transform_keys$excl$72 = function() {
- var $iter = $Hash_transform_keys$excl$72.$$p, block = $iter || nil, $$73, self = this;
-
- if ($iter) $Hash_transform_keys$excl$72.$$p = null;
-
-
- if ($iter) $Hash_transform_keys$excl$72.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["transform_keys!"], ($$73 = function(){var self = $$73.$$s || this;
-
- return self.$size()}, $$73.$$s = self, $$73.$$arity = 0, $$73))
- };
-
- var keys = Opal.slice.call(self.$$keys),
- i, length = keys.length, key, value, new_key;
-
- for (i = 0; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- new_key = Opal.yield1(block, key);
-
- Opal.hash_delete(self, key);
- Opal.hash_put(self, new_key, value);
- }
-
- return self;
- ;
- }, $Hash_transform_keys$excl$72.$$arity = 0);
-
- Opal.def(self, '$transform_values', $Hash_transform_values$74 = function $$transform_values() {
- var $iter = $Hash_transform_values$74.$$p, block = $iter || nil, $$75, self = this;
-
- if ($iter) $Hash_transform_values$74.$$p = null;
-
-
- if ($iter) $Hash_transform_values$74.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["transform_values"], ($$75 = function(){var self = $$75.$$s || this;
-
- return self.$size()}, $$75.$$s = self, $$75.$$arity = 0, $$75))
- };
-
- var result = Opal.hash();
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- value = Opal.yield1(block, value);
-
- Opal.hash_put(result, key, value);
- }
-
- return result;
- ;
- }, $Hash_transform_values$74.$$arity = 0);
-
- Opal.def(self, '$transform_values!', $Hash_transform_values$excl$76 = function() {
- var $iter = $Hash_transform_values$excl$76.$$p, block = $iter || nil, $$77, self = this;
-
- if ($iter) $Hash_transform_values$excl$76.$$p = null;
-
-
- if ($iter) $Hash_transform_values$excl$76.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["transform_values!"], ($$77 = function(){var self = $$77.$$s || this;
-
- return self.$size()}, $$77.$$s = self, $$77.$$arity = 0, $$77))
- };
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key, value; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- value = self.$$smap[key];
- } else {
- value = key.value;
- key = key.key;
- }
-
- value = Opal.yield1(block, value);
-
- Opal.hash_put(self, key, value);
- }
-
- return self;
- ;
- }, $Hash_transform_values$excl$76.$$arity = 0);
- Opal.alias(self, "update", "merge!");
- Opal.alias(self, "value?", "has_value?");
- Opal.alias(self, "values_at", "indexes");
- return (Opal.def(self, '$values', $Hash_values$78 = function $$values() {
- var self = this;
-
-
- var result = [];
-
- for (var i = 0, keys = self.$$keys, length = keys.length, key; i < length; i++) {
- key = keys[i];
-
- if (key.$$is_string) {
- result.push(self.$$smap[key]);
- } else {
- result.push(key.value);
- }
- }
-
- return result;
-
- }, $Hash_values$78.$$arity = 0), nil) && 'values';
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/number"] = function(Opal) {
- function $rb_gt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
- }
- function $rb_lt(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_divide(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs / rhs : lhs['$/'](rhs);
- }
- function $rb_times(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
- }
- function $rb_le(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, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$require', '$bridge', '$raise', '$name', '$class', '$Float', '$respond_to?', '$coerce_to!', '$__coerced__', '$===', '$!', '$>', '$**', '$new', '$<', '$to_f', '$==', '$nan?', '$infinite?', '$enum_for', '$+', '$-', '$gcd', '$lcm', '$%', '$/', '$frexp', '$to_i', '$ldexp', '$rationalize', '$*', '$<<', '$to_r', '$truncate', '$-@', '$size', '$<=', '$>=', '$<=>', '$compare', '$any?']);
-
- self.$require("corelib/numeric");
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Number');
-
- var $nesting = [self].concat($parent_nesting), $Number_coerce$2, $Number___id__$3, $Number_$plus$4, $Number_$minus$5, $Number_$$6, $Number_$slash$7, $Number_$percent$8, $Number_$$9, $Number_$$10, $Number_$$11, $Number_$lt$12, $Number_$lt_eq$13, $Number_$gt$14, $Number_$gt_eq$15, $Number_$lt_eq_gt$16, $Number_$lt$lt$17, $Number_$gt$gt$18, $Number_$$$19, $Number_$plus$$20, $Number_$minus$$21, $Number_$$22, $Number_$$$23, $Number_$eq_eq_eq$24, $Number_$eq_eq$25, $Number_abs$26, $Number_abs2$27, $Number_allbits$ques$28, $Number_anybits$ques$29, $Number_angle$30, $Number_bit_length$31, $Number_ceil$32, $Number_chr$33, $Number_denominator$34, $Number_downto$35, $Number_equal$ques$37, $Number_even$ques$38, $Number_floor$39, $Number_gcd$40, $Number_gcdlcm$41, $Number_integer$ques$42, $Number_is_a$ques$43, $Number_instance_of$ques$44, $Number_lcm$45, $Number_next$46, $Number_nobits$ques$47, $Number_nonzero$ques$48, $Number_numerator$49, $Number_odd$ques$50, $Number_ord$51, $Number_pow$52, $Number_pred$53, $Number_quo$54, $Number_rationalize$55, $Number_remainder$56, $Number_round$57, $Number_step$58, $Number_times$60, $Number_to_f$62, $Number_to_i$63, $Number_to_r$64, $Number_to_s$65, $Number_truncate$66, $Number_digits$67, $Number_divmod$68, $Number_upto$69, $Number_zero$ques$71, $Number_size$72, $Number_nan$ques$73, $Number_finite$ques$74, $Number_infinite$ques$75, $Number_positive$ques$76, $Number_negative$ques$77;
-
-
- $$($nesting, 'Opal').$bridge(Number, self);
- Opal.defineProperty(self.$$prototype, '$$is_number', true);
- self.$$is_number_class = true;
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $allocate$1;
-
-
-
- Opal.def(self, '$allocate', $allocate$1 = function $$allocate() {
- var self = this;
-
- return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name()))
- }, $allocate$1.$$arity = 0);
-
-
- Opal.udef(self, '$' + "new");;
- return nil;;
- })(Opal.get_singleton_class(self), $nesting);
-
- Opal.def(self, '$coerce', $Number_coerce$2 = function $$coerce(other) {
- var self = this;
-
-
- if (other === nil) {
- self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float");
- }
- else if (other.$$is_string) {
- return [self.$Float(other), self];
- }
- else if (other['$respond_to?']("to_f")) {
- return [$$($nesting, 'Opal')['$coerce_to!'](other, $$($nesting, 'Float'), "to_f"), self];
- }
- else if (other.$$is_number) {
- return [other, self];
- }
- else {
- self.$raise($$($nesting, 'TypeError'), "" + "can't convert " + (other.$class()) + " into Float");
- }
-
- }, $Number_coerce$2.$$arity = 1);
-
- Opal.def(self, '$__id__', $Number___id__$3 = function $$__id__() {
- var self = this;
-
- return (self * 2) + 1;
- }, $Number___id__$3.$$arity = 0);
- Opal.alias(self, "object_id", "__id__");
-
- Opal.def(self, '$+', $Number_$plus$4 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self + other;
- }
- else {
- return self.$__coerced__("+", other);
- }
-
- }, $Number_$plus$4.$$arity = 1);
-
- Opal.def(self, '$-', $Number_$minus$5 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self - other;
- }
- else {
- return self.$__coerced__("-", other);
- }
-
- }, $Number_$minus$5.$$arity = 1);
-
- Opal.def(self, '$*', $Number_$$6 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self * other;
- }
- else {
- return self.$__coerced__("*", other);
- }
-
- }, $Number_$$6.$$arity = 1);
-
- Opal.def(self, '$/', $Number_$slash$7 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self / other;
- }
- else {
- return self.$__coerced__("/", other);
- }
-
- }, $Number_$slash$7.$$arity = 1);
- Opal.alias(self, "fdiv", "/");
-
- Opal.def(self, '$%', $Number_$percent$8 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- if (other == -Infinity) {
- return other;
- }
- else if (other == 0) {
- self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0");
- }
- else if (other < 0 || self < 0) {
- return (self % other + other) % other;
- }
- else {
- return self % other;
- }
- }
- else {
- return self.$__coerced__("%", other);
- }
-
- }, $Number_$percent$8.$$arity = 1);
-
- Opal.def(self, '$&', $Number_$$9 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self & other;
- }
- else {
- return self.$__coerced__("&", other);
- }
-
- }, $Number_$$9.$$arity = 1);
-
- Opal.def(self, '$|', $Number_$$10 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self | other;
- }
- else {
- return self.$__coerced__("|", other);
- }
-
- }, $Number_$$10.$$arity = 1);
-
- Opal.def(self, '$^', $Number_$$11 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self ^ other;
- }
- else {
- return self.$__coerced__("^", other);
- }
-
- }, $Number_$$11.$$arity = 1);
-
- Opal.def(self, '$<', $Number_$lt$12 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self < other;
- }
- else {
- return self.$__coerced__("<", other);
- }
-
- }, $Number_$lt$12.$$arity = 1);
-
- Opal.def(self, '$<=', $Number_$lt_eq$13 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self <= other;
- }
- else {
- return self.$__coerced__("<=", other);
- }
-
- }, $Number_$lt_eq$13.$$arity = 1);
-
- Opal.def(self, '$>', $Number_$gt$14 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self > other;
- }
- else {
- return self.$__coerced__(">", other);
- }
-
- }, $Number_$gt$14.$$arity = 1);
-
- Opal.def(self, '$>=', $Number_$gt_eq$15 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self >= other;
- }
- else {
- return self.$__coerced__(">=", other);
- }
-
- }, $Number_$gt_eq$15.$$arity = 1);
-
- var spaceship_operator = function(self, other) {
- if (other.$$is_number) {
- if (isNaN(self) || isNaN(other)) {
- return nil;
- }
-
- if (self > other) {
- return 1;
- } else if (self < other) {
- return -1;
- } else {
- return 0;
- }
- }
- else {
- return self.$__coerced__("<=>", other);
- }
- }
- ;
-
- Opal.def(self, '$<=>', $Number_$lt_eq_gt$16 = function(other) {
- var self = this;
-
- try {
- return spaceship_operator(self, other);
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'ArgumentError')])) {
- try {
- return nil
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }
- }, $Number_$lt_eq_gt$16.$$arity = 1);
-
- Opal.def(self, '$<<', $Number_$lt$lt$17 = function(count) {
- var self = this;
-
-
- count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int");
- return count > 0 ? self << count : self >> -count;
- }, $Number_$lt$lt$17.$$arity = 1);
-
- Opal.def(self, '$>>', $Number_$gt$gt$18 = function(count) {
- var self = this;
-
-
- count = $$($nesting, 'Opal')['$coerce_to!'](count, $$($nesting, 'Integer'), "to_int");
- return count > 0 ? self >> count : self << -count;
- }, $Number_$gt$gt$18.$$arity = 1);
-
- Opal.def(self, '$[]', $Number_$$$19 = function(bit) {
- var self = this;
-
-
- bit = $$($nesting, 'Opal')['$coerce_to!'](bit, $$($nesting, 'Integer'), "to_int");
-
- if (bit < 0) {
- return 0;
- }
- if (bit >= 32) {
- return self < 0 ? 1 : 0;
- }
- return (self >> bit) & 1;
- ;
- }, $Number_$$$19.$$arity = 1);
-
- Opal.def(self, '$+@', $Number_$plus$$20 = function() {
- var self = this;
-
- return +self;
- }, $Number_$plus$$20.$$arity = 0);
-
- Opal.def(self, '$-@', $Number_$minus$$21 = function() {
- var self = this;
-
- return -self;
- }, $Number_$minus$$21.$$arity = 0);
-
- Opal.def(self, '$~', $Number_$$22 = function() {
- var self = this;
-
- return ~self;
- }, $Number_$$22.$$arity = 0);
-
- Opal.def(self, '$**', $Number_$$$23 = function(other) {
- var $a, $b, self = this;
-
- if ($truthy($$($nesting, 'Integer')['$==='](other))) {
- if ($truthy(($truthy($a = $$($nesting, 'Integer')['$==='](self)['$!']()) ? $a : $rb_gt(other, 0)))) {
- return Math.pow(self, other);
- } else {
- return $$($nesting, 'Rational').$new(self, 1)['$**'](other)
- }
- } else if ($truthy((($a = $rb_lt(self, 0)) ? ($truthy($b = $$($nesting, 'Float')['$==='](other)) ? $b : $$($nesting, 'Rational')['$==='](other)) : $rb_lt(self, 0)))) {
- return $$($nesting, 'Complex').$new(self, 0)['$**'](other.$to_f())
- } else if ($truthy(other.$$is_number != null)) {
- return Math.pow(self, other);
- } else {
- return self.$__coerced__("**", other)
- }
- }, $Number_$$$23.$$arity = 1);
-
- Opal.def(self, '$===', $Number_$eq_eq_eq$24 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self.valueOf() === other.valueOf();
- }
- else if (other['$respond_to?']("==")) {
- return other['$=='](self);
- }
- else {
- return false;
- }
-
- }, $Number_$eq_eq_eq$24.$$arity = 1);
-
- Opal.def(self, '$==', $Number_$eq_eq$25 = function(other) {
- var self = this;
-
-
- if (other.$$is_number) {
- return self.valueOf() === other.valueOf();
- }
- else if (other['$respond_to?']("==")) {
- return other['$=='](self);
- }
- else {
- return false;
- }
-
- }, $Number_$eq_eq$25.$$arity = 1);
-
- Opal.def(self, '$abs', $Number_abs$26 = function $$abs() {
- var self = this;
-
- return Math.abs(self);
- }, $Number_abs$26.$$arity = 0);
-
- Opal.def(self, '$abs2', $Number_abs2$27 = function $$abs2() {
- var self = this;
-
- return Math.abs(self * self);
- }, $Number_abs2$27.$$arity = 0);
-
- Opal.def(self, '$allbits?', $Number_allbits$ques$28 = function(mask) {
- var self = this;
-
-
- mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int");
- return (self & mask) == mask;;
- }, $Number_allbits$ques$28.$$arity = 1);
-
- Opal.def(self, '$anybits?', $Number_anybits$ques$29 = function(mask) {
- var self = this;
-
-
- mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int");
- return (self & mask) !== 0;;
- }, $Number_anybits$ques$29.$$arity = 1);
-
- Opal.def(self, '$angle', $Number_angle$30 = function $$angle() {
- var self = this;
-
-
- if ($truthy(self['$nan?']())) {
- return self};
-
- if (self == 0) {
- if (1 / self > 0) {
- return 0;
- }
- else {
- return Math.PI;
- }
- }
- else if (self < 0) {
- return Math.PI;
- }
- else {
- return 0;
- }
- ;
- }, $Number_angle$30.$$arity = 0);
- Opal.alias(self, "arg", "angle");
- Opal.alias(self, "phase", "angle");
-
- Opal.def(self, '$bit_length', $Number_bit_length$31 = function $$bit_length() {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Integer')['$==='](self))) {
- } else {
- self.$raise($$($nesting, 'NoMethodError').$new("" + "undefined method `bit_length` for " + (self) + ":Float", "bit_length"))
- };
-
- if (self === 0 || self === -1) {
- return 0;
- }
-
- var result = 0,
- value = self < 0 ? ~self : self;
-
- while (value != 0) {
- result += 1;
- value >>>= 1;
- }
-
- return result;
- ;
- }, $Number_bit_length$31.$$arity = 0);
-
- Opal.def(self, '$ceil', $Number_ceil$32 = function $$ceil(ndigits) {
- var self = this;
-
-
-
- if (ndigits == null) {
- ndigits = 0;
- };
-
- var f = self.$to_f();
-
- if (f % 1 === 0 && ndigits >= 0) {
- return f;
- }
-
- var factor = Math.pow(10, ndigits),
- result = Math.ceil(f * factor) / factor;
-
- if (f % 1 === 0) {
- result = Math.round(result);
- }
-
- return result;
- ;
- }, $Number_ceil$32.$$arity = -1);
-
- Opal.def(self, '$chr', $Number_chr$33 = function $$chr(encoding) {
- var self = this;
-
-
- ;
- return String.fromCharCode(self);;
- }, $Number_chr$33.$$arity = -1);
-
- Opal.def(self, '$denominator', $Number_denominator$34 = function $$denominator() {
- var $a, $iter = $Number_denominator$34.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Number_denominator$34.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) {
- return 1
- } else {
- return $send(self, Opal.find_super_dispatcher(self, 'denominator', $Number_denominator$34, false), $zuper, $iter)
- }
- }, $Number_denominator$34.$$arity = 0);
-
- Opal.def(self, '$downto', $Number_downto$35 = function $$downto(stop) {
- var $iter = $Number_downto$35.$$p, block = $iter || nil, $$36, self = this;
-
- if ($iter) $Number_downto$35.$$p = null;
-
-
- if ($iter) $Number_downto$35.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["downto", stop], ($$36 = function(){var self = $$36.$$s || this;
-
-
- if ($truthy($$($nesting, 'Numeric')['$==='](stop))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed")
- };
- if ($truthy($rb_gt(stop, self))) {
- return 0
- } else {
- return $rb_plus($rb_minus(self, stop), 1)
- };}, $$36.$$s = self, $$36.$$arity = 0, $$36))
- };
-
- if (!stop.$$is_number) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed")
- }
- for (var i = self; i >= stop; i--) {
- block(i);
- }
- ;
- return self;
- }, $Number_downto$35.$$arity = 1);
- Opal.alias(self, "eql?", "==");
-
- Opal.def(self, '$equal?', $Number_equal$ques$37 = function(other) {
- var $a, self = this;
-
- return ($truthy($a = self['$=='](other)) ? $a : isNaN(self) && isNaN(other))
- }, $Number_equal$ques$37.$$arity = 1);
-
- Opal.def(self, '$even?', $Number_even$ques$38 = function() {
- var self = this;
-
- return self % 2 === 0;
- }, $Number_even$ques$38.$$arity = 0);
-
- Opal.def(self, '$floor', $Number_floor$39 = function $$floor(ndigits) {
- var self = this;
-
-
-
- if (ndigits == null) {
- ndigits = 0;
- };
-
- var f = self.$to_f();
-
- if (f % 1 === 0 && ndigits >= 0) {
- return f;
- }
-
- var factor = Math.pow(10, ndigits),
- result = Math.floor(f * factor) / factor;
-
- if (f % 1 === 0) {
- result = Math.round(result);
- }
-
- return result;
- ;
- }, $Number_floor$39.$$arity = -1);
-
- Opal.def(self, '$gcd', $Number_gcd$40 = function $$gcd(other) {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Integer')['$==='](other))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "not an integer")
- };
-
- var min = Math.abs(self),
- max = Math.abs(other);
-
- while (min > 0) {
- var tmp = min;
-
- min = max % min;
- max = tmp;
- }
-
- return max;
- ;
- }, $Number_gcd$40.$$arity = 1);
-
- Opal.def(self, '$gcdlcm', $Number_gcdlcm$41 = function $$gcdlcm(other) {
- var self = this;
-
- return [self.$gcd(), self.$lcm()]
- }, $Number_gcdlcm$41.$$arity = 1);
-
- Opal.def(self, '$integer?', $Number_integer$ques$42 = function() {
- var self = this;
-
- return self % 1 === 0;
- }, $Number_integer$ques$42.$$arity = 0);
-
- Opal.def(self, '$is_a?', $Number_is_a$ques$43 = function(klass) {
- var $a, $iter = $Number_is_a$ques$43.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Number_is_a$ques$43.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
- if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) {
- return true};
- if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) {
- return true};
- if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) {
- return true};
- return $send(self, Opal.find_super_dispatcher(self, 'is_a?', $Number_is_a$ques$43, false), $zuper, $iter);
- }, $Number_is_a$ques$43.$$arity = 1);
- Opal.alias(self, "kind_of?", "is_a?");
-
- Opal.def(self, '$instance_of?', $Number_instance_of$ques$44 = function(klass) {
- var $a, $iter = $Number_instance_of$ques$44.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Number_instance_of$ques$44.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
- if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) {
- return true};
- if ($truthy((($a = klass['$==']($$($nesting, 'Integer'))) ? $$($nesting, 'Integer')['$==='](self) : klass['$==']($$($nesting, 'Integer'))))) {
- return true};
- if ($truthy((($a = klass['$==']($$($nesting, 'Float'))) ? $$($nesting, 'Float')['$==='](self) : klass['$==']($$($nesting, 'Float'))))) {
- return true};
- return $send(self, Opal.find_super_dispatcher(self, 'instance_of?', $Number_instance_of$ques$44, false), $zuper, $iter);
- }, $Number_instance_of$ques$44.$$arity = 1);
-
- Opal.def(self, '$lcm', $Number_lcm$45 = function $$lcm(other) {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Integer')['$==='](other))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "not an integer")
- };
-
- if (self == 0 || other == 0) {
- return 0;
- }
- else {
- return Math.abs(self * other / self.$gcd(other));
- }
- ;
- }, $Number_lcm$45.$$arity = 1);
- Opal.alias(self, "magnitude", "abs");
- Opal.alias(self, "modulo", "%");
-
- Opal.def(self, '$next', $Number_next$46 = function $$next() {
- var self = this;
-
- return self + 1;
- }, $Number_next$46.$$arity = 0);
-
- Opal.def(self, '$nobits?', $Number_nobits$ques$47 = function(mask) {
- var self = this;
-
-
- mask = $$($nesting, 'Opal')['$coerce_to!'](mask, $$($nesting, 'Integer'), "to_int");
- return (self & mask) == 0;;
- }, $Number_nobits$ques$47.$$arity = 1);
-
- Opal.def(self, '$nonzero?', $Number_nonzero$ques$48 = function() {
- var self = this;
-
- return self == 0 ? nil : self;
- }, $Number_nonzero$ques$48.$$arity = 0);
-
- Opal.def(self, '$numerator', $Number_numerator$49 = function $$numerator() {
- var $a, $iter = $Number_numerator$49.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Number_numerator$49.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) {
- return self
- } else {
- return $send(self, Opal.find_super_dispatcher(self, 'numerator', $Number_numerator$49, false), $zuper, $iter)
- }
- }, $Number_numerator$49.$$arity = 0);
-
- Opal.def(self, '$odd?', $Number_odd$ques$50 = function() {
- var self = this;
-
- return self % 2 !== 0;
- }, $Number_odd$ques$50.$$arity = 0);
-
- Opal.def(self, '$ord', $Number_ord$51 = function $$ord() {
- var self = this;
-
- return self
- }, $Number_ord$51.$$arity = 0);
-
- Opal.def(self, '$pow', $Number_pow$52 = function $$pow(b, m) {
- var self = this;
-
-
- ;
-
- if (self == 0) {
- self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0")
- }
-
- if (m === undefined) {
- return self['$**'](b);
- } else {
- if (!($$($nesting, 'Integer')['$==='](b))) {
- self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless a 1st argument is integer")
- }
-
- if (b < 0) {
- self.$raise($$($nesting, 'TypeError'), "Integer#pow() 1st argument cannot be negative when 2nd argument specified")
- }
-
- if (!($$($nesting, 'Integer')['$==='](m))) {
- self.$raise($$($nesting, 'TypeError'), "Integer#pow() 2nd argument not allowed unless all arguments are integers")
- }
-
- if (m === 0) {
- self.$raise($$($nesting, 'ZeroDivisionError'), "divided by 0")
- }
-
- return self['$**'](b)['$%'](m)
- }
- ;
- }, $Number_pow$52.$$arity = -2);
-
- Opal.def(self, '$pred', $Number_pred$53 = function $$pred() {
- var self = this;
-
- return self - 1;
- }, $Number_pred$53.$$arity = 0);
-
- Opal.def(self, '$quo', $Number_quo$54 = function $$quo(other) {
- var $iter = $Number_quo$54.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Number_quo$54.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if ($truthy($$($nesting, 'Integer')['$==='](self))) {
- return $send(self, Opal.find_super_dispatcher(self, 'quo', $Number_quo$54, false), $zuper, $iter)
- } else {
- return $rb_divide(self, other)
- }
- }, $Number_quo$54.$$arity = 1);
-
- Opal.def(self, '$rationalize', $Number_rationalize$55 = function $$rationalize(eps) {
- var $a, $b, self = this, f = nil, n = nil;
-
-
- ;
-
- if (arguments.length > 1) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arguments.length) + " for 0..1)");
- }
- ;
- if ($truthy($$($nesting, 'Integer')['$==='](self))) {
- return $$($nesting, 'Rational').$new(self, 1)
- } else if ($truthy(self['$infinite?']())) {
- return self.$raise($$($nesting, 'FloatDomainError'), "Infinity")
- } else if ($truthy(self['$nan?']())) {
- return self.$raise($$($nesting, 'FloatDomainError'), "NaN")
- } else if ($truthy(eps == null)) {
-
- $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (n = ($a[1] == null ? nil : $a[1])), $b;
- f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i();
- n = $rb_minus(n, $$$($$($nesting, 'Float'), 'MANT_DIG'));
- return $$($nesting, 'Rational').$new($rb_times(2, f), (1)['$<<']($rb_minus(1, n))).$rationalize($$($nesting, 'Rational').$new(1, (1)['$<<']($rb_minus(1, n))));
- } else {
- return self.$to_r().$rationalize(eps)
- };
- }, $Number_rationalize$55.$$arity = -1);
-
- Opal.def(self, '$remainder', $Number_remainder$56 = function $$remainder(y) {
- var self = this;
-
- return $rb_minus(self, $rb_times(y, $rb_divide(self, y).$truncate()))
- }, $Number_remainder$56.$$arity = 1);
-
- Opal.def(self, '$round', $Number_round$57 = function $$round(ndigits) {
- var $a, $b, self = this, _ = nil, exp = nil;
-
-
- ;
- if ($truthy($$($nesting, 'Integer')['$==='](self))) {
-
- if ($truthy(ndigits == null)) {
- return self};
- if ($truthy(($truthy($a = $$($nesting, 'Float')['$==='](ndigits)) ? ndigits['$infinite?']() : $a))) {
- self.$raise($$($nesting, 'RangeError'), "Infinity")};
- ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_lt(ndigits, $$$($$($nesting, 'Integer'), 'MIN')))) {
- self.$raise($$($nesting, 'RangeError'), "out of bounds")};
- if ($truthy(ndigits >= 0)) {
- return self};
- ndigits = ndigits['$-@']();
-
- if (0.415241 * ndigits - 0.125 > self.$size()) {
- return 0;
- }
-
- var f = Math.pow(10, ndigits),
- x = Math.floor((Math.abs(x) + f / 2) / f) * f;
-
- return self < 0 ? -x : x;
- ;
- } else {
-
- if ($truthy(($truthy($a = self['$nan?']()) ? ndigits == null : $a))) {
- self.$raise($$($nesting, 'FloatDomainError'), "NaN")};
- ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits || 0, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_le(ndigits, 0))) {
- if ($truthy(self['$nan?']())) {
- self.$raise($$($nesting, 'RangeError'), "NaN")
- } else if ($truthy(self['$infinite?']())) {
- self.$raise($$($nesting, 'FloatDomainError'), "Infinity")}
- } else if (ndigits['$=='](0)) {
- return Math.round(self)
- } else if ($truthy(($truthy($a = self['$nan?']()) ? $a : self['$infinite?']()))) {
- return self};
- $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (exp = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy($rb_ge(ndigits, $rb_minus($rb_plus($$$($$($nesting, 'Float'), 'DIG'), 2), (function() {if ($truthy($rb_gt(exp, 0))) {
- return $rb_divide(exp, 4)
- } else {
- return $rb_minus($rb_divide(exp, 3), 1)
- }; return nil; })())))) {
- return self};
- if ($truthy($rb_lt(ndigits, (function() {if ($truthy($rb_gt(exp, 0))) {
- return $rb_plus($rb_divide(exp, 3), 1)
- } else {
- return $rb_divide(exp, 4)
- }; return nil; })()['$-@']()))) {
- return 0};
- return Math.round(self * Math.pow(10, ndigits)) / Math.pow(10, ndigits);;
- };
- }, $Number_round$57.$$arity = -1);
-
- Opal.def(self, '$step', $Number_step$58 = function $$step($a, $b, $c) {
- var $iter = $Number_step$58.$$p, block = $iter || nil, $post_args, $kwargs, limit, step, to, by, $$59, self = this, positional_args = nil, keyword_args = nil;
-
- if ($iter) $Number_step$58.$$p = null;
-
-
- if ($iter) $Number_step$58.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- $kwargs = Opal.extract_kwargs($post_args);
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- if ($post_args.length > 0) {
- limit = $post_args[0];
- $post_args.splice(0, 1);
- };
-
- if ($post_args.length > 0) {
- step = $post_args[0];
- $post_args.splice(0, 1);
- };
-
- to = $kwargs.$$smap["to"];;
-
- by = $kwargs.$$smap["by"];;
-
- if (limit !== undefined && to !== undefined) {
- self.$raise($$($nesting, 'ArgumentError'), "to is given twice")
- }
-
- if (step !== undefined && by !== undefined) {
- self.$raise($$($nesting, 'ArgumentError'), "step is given twice")
- }
-
- function validateParameters() {
- if (to !== undefined) {
- limit = to;
- }
-
- if (limit === undefined) {
- limit = nil;
- }
-
- if (step === nil) {
- self.$raise($$($nesting, 'TypeError'), "step must be numeric")
- }
-
- if (step === 0) {
- self.$raise($$($nesting, 'ArgumentError'), "step can't be 0")
- }
-
- if (by !== undefined) {
- step = by;
- }
-
- if (step === nil || step == null) {
- step = 1;
- }
-
- var sign = step['$<=>'](0);
-
- if (sign === nil) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "0 can't be coerced into " + (step.$class()))
- }
-
- if (limit === nil || limit == null) {
- limit = sign > 0 ? $$$($$($nesting, 'Float'), 'INFINITY') : $$$($$($nesting, 'Float'), 'INFINITY')['$-@']();
- }
-
- $$($nesting, 'Opal').$compare(self, limit)
- }
-
- function stepFloatSize() {
- if ((step > 0 && self > limit) || (step < 0 && self < limit)) {
- return 0;
- } else if (step === Infinity || step === -Infinity) {
- return 1;
- } else {
- var abs = Math.abs, floor = Math.floor,
- err = (abs(self) + abs(limit) + abs(limit - self)) / abs(step) * $$$($$($nesting, 'Float'), 'EPSILON');
-
- if (err === Infinity || err === -Infinity) {
- return 0;
- } else {
- if (err > 0.5) {
- err = 0.5;
- }
-
- return floor((limit - self) / step + err) + 1
- }
- }
- }
-
- function stepSize() {
- validateParameters();
-
- if (step === 0) {
- return Infinity;
- }
-
- if (step % 1 !== 0) {
- return stepFloatSize();
- } else if ((step > 0 && self > limit) || (step < 0 && self < limit)) {
- return 0;
- } else {
- var ceil = Math.ceil, abs = Math.abs,
- lhs = abs(self - limit) + 1,
- rhs = abs(step);
-
- return ceil(lhs / rhs);
- }
- }
- ;
- if ((block !== nil)) {
- } else {
-
- positional_args = [];
- keyword_args = $hash2([], {});
-
- if (limit !== undefined) {
- positional_args.push(limit);
- }
-
- if (step !== undefined) {
- positional_args.push(step);
- }
-
- if (to !== undefined) {
- Opal.hash_put(keyword_args, "to", to);
- }
-
- if (by !== undefined) {
- Opal.hash_put(keyword_args, "by", by);
- }
-
- if (keyword_args['$any?']()) {
- positional_args.push(keyword_args);
- }
- ;
- return $send(self, 'enum_for', ["step"].concat(Opal.to_a(positional_args)), ($$59 = function(){var self = $$59.$$s || this;
-
- return stepSize();}, $$59.$$s = self, $$59.$$arity = 0, $$59));
- };
-
- validateParameters();
-
- if (step === 0) {
- while (true) {
- block(self);
- }
- }
-
- if (self % 1 !== 0 || limit % 1 !== 0 || step % 1 !== 0) {
- var n = stepFloatSize();
-
- if (n > 0) {
- if (step === Infinity || step === -Infinity) {
- block(self);
- } else {
- var i = 0, d;
-
- if (step > 0) {
- while (i < n) {
- d = i * step + self;
- if (limit < d) {
- d = limit;
- }
- block(d);
- i += 1;
- }
- } else {
- while (i < n) {
- d = i * step + self;
- if (limit > d) {
- d = limit;
- }
- block(d);
- i += 1
- }
- }
- }
- }
- } else {
- var value = self;
-
- if (step > 0) {
- while (value <= limit) {
- block(value);
- value += step;
- }
- } else {
- while (value >= limit) {
- block(value);
- value += step
- }
- }
- }
-
- return self;
- ;
- }, $Number_step$58.$$arity = -1);
- Opal.alias(self, "succ", "next");
-
- Opal.def(self, '$times', $Number_times$60 = function $$times() {
- var $iter = $Number_times$60.$$p, block = $iter || nil, $$61, self = this;
-
- if ($iter) $Number_times$60.$$p = null;
-
-
- if ($iter) $Number_times$60.$$p = null;;
- if ($truthy(block)) {
- } else {
- return $send(self, 'enum_for', ["times"], ($$61 = function(){var self = $$61.$$s || this;
-
- return self}, $$61.$$s = self, $$61.$$arity = 0, $$61))
- };
-
- for (var i = 0; i < self; i++) {
- block(i);
- }
- ;
- return self;
- }, $Number_times$60.$$arity = 0);
-
- Opal.def(self, '$to_f', $Number_to_f$62 = function $$to_f() {
- var self = this;
-
- return self
- }, $Number_to_f$62.$$arity = 0);
-
- Opal.def(self, '$to_i', $Number_to_i$63 = function $$to_i() {
- var self = this;
-
- return parseInt(self, 10);
- }, $Number_to_i$63.$$arity = 0);
- Opal.alias(self, "to_int", "to_i");
-
- Opal.def(self, '$to_r', $Number_to_r$64 = function $$to_r() {
- var $a, $b, self = this, f = nil, e = nil;
-
- if ($truthy($$($nesting, 'Integer')['$==='](self))) {
- return $$($nesting, 'Rational').$new(self, 1)
- } else {
-
- $b = $$($nesting, 'Math').$frexp(self), $a = Opal.to_ary($b), (f = ($a[0] == null ? nil : $a[0])), (e = ($a[1] == null ? nil : $a[1])), $b;
- f = $$($nesting, 'Math').$ldexp(f, $$$($$($nesting, 'Float'), 'MANT_DIG')).$to_i();
- e = $rb_minus(e, $$$($$($nesting, 'Float'), 'MANT_DIG'));
- return $rb_times(f, $$$($$($nesting, 'Float'), 'RADIX')['$**'](e)).$to_r();
- }
- }, $Number_to_r$64.$$arity = 0);
-
- Opal.def(self, '$to_s', $Number_to_s$65 = function $$to_s(base) {
- var $a, self = this;
-
-
-
- if (base == null) {
- base = 10;
- };
- base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int");
- if ($truthy(($truthy($a = $rb_lt(base, 2)) ? $a : $rb_gt(base, 36)))) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))};
- return self.toString(base);;
- }, $Number_to_s$65.$$arity = -1);
-
- Opal.def(self, '$truncate', $Number_truncate$66 = function $$truncate(ndigits) {
- var self = this;
-
-
-
- if (ndigits == null) {
- ndigits = 0;
- };
-
- var f = self.$to_f();
-
- if (f % 1 === 0 && ndigits >= 0) {
- return f;
- }
-
- var factor = Math.pow(10, ndigits),
- result = parseInt(f * factor, 10) / factor;
-
- if (f % 1 === 0) {
- result = Math.round(result);
- }
-
- return result;
- ;
- }, $Number_truncate$66.$$arity = -1);
- Opal.alias(self, "inspect", "to_s");
-
- Opal.def(self, '$digits', $Number_digits$67 = function $$digits(base) {
- var self = this;
-
-
-
- if (base == null) {
- base = 10;
- };
- if ($rb_lt(self, 0)) {
- self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "out of domain")};
- base = $$($nesting, 'Opal')['$coerce_to!'](base, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_lt(base, 2))) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "invalid radix " + (base))};
-
- var value = self, result = [];
-
- while (value !== 0) {
- result.push(value % base);
- value = parseInt(value / base, 10);
- }
-
- return result;
- ;
- }, $Number_digits$67.$$arity = -1);
-
- Opal.def(self, '$divmod', $Number_divmod$68 = function $$divmod(other) {
- var $a, $iter = $Number_divmod$68.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Number_divmod$68.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if ($truthy(($truthy($a = self['$nan?']()) ? $a : other['$nan?']()))) {
- return self.$raise($$($nesting, 'FloatDomainError'), "NaN")
- } else if ($truthy(self['$infinite?']())) {
- return self.$raise($$($nesting, 'FloatDomainError'), "Infinity")
- } else {
- return $send(self, Opal.find_super_dispatcher(self, 'divmod', $Number_divmod$68, false), $zuper, $iter)
- }
- }, $Number_divmod$68.$$arity = 1);
-
- Opal.def(self, '$upto', $Number_upto$69 = function $$upto(stop) {
- var $iter = $Number_upto$69.$$p, block = $iter || nil, $$70, self = this;
-
- if ($iter) $Number_upto$69.$$p = null;
-
-
- if ($iter) $Number_upto$69.$$p = null;;
- if ((block !== nil)) {
- } else {
- return $send(self, 'enum_for', ["upto", stop], ($$70 = function(){var self = $$70.$$s || this;
-
-
- if ($truthy($$($nesting, 'Numeric')['$==='](stop))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed")
- };
- if ($truthy($rb_lt(stop, self))) {
- return 0
- } else {
- return $rb_plus($rb_minus(stop, self), 1)
- };}, $$70.$$s = self, $$70.$$arity = 0, $$70))
- };
-
- if (!stop.$$is_number) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "comparison of " + (self.$class()) + " with " + (stop.$class()) + " failed")
- }
- for (var i = self; i <= stop; i++) {
- block(i);
- }
- ;
- return self;
- }, $Number_upto$69.$$arity = 1);
-
- Opal.def(self, '$zero?', $Number_zero$ques$71 = function() {
- var self = this;
-
- return self == 0;
- }, $Number_zero$ques$71.$$arity = 0);
-
- Opal.def(self, '$size', $Number_size$72 = function $$size() {
- var self = this;
-
- return 4
- }, $Number_size$72.$$arity = 0);
-
- Opal.def(self, '$nan?', $Number_nan$ques$73 = function() {
- var self = this;
-
- return isNaN(self);
- }, $Number_nan$ques$73.$$arity = 0);
-
- Opal.def(self, '$finite?', $Number_finite$ques$74 = function() {
- var self = this;
-
- return self != Infinity && self != -Infinity && !isNaN(self);
- }, $Number_finite$ques$74.$$arity = 0);
-
- Opal.def(self, '$infinite?', $Number_infinite$ques$75 = function() {
- var self = this;
-
-
- if (self == Infinity) {
- return +1;
- }
- else if (self == -Infinity) {
- return -1;
- }
- else {
- return nil;
- }
-
- }, $Number_infinite$ques$75.$$arity = 0);
-
- Opal.def(self, '$positive?', $Number_positive$ques$76 = function() {
- var self = this;
-
- return self != 0 && (self == Infinity || 1 / self > 0);
- }, $Number_positive$ques$76.$$arity = 0);
- return (Opal.def(self, '$negative?', $Number_negative$ques$77 = function() {
- var self = this;
-
- return self == -Infinity || 1 / self < 0;
- }, $Number_negative$ques$77.$$arity = 0), nil) && 'negative?';
- })($nesting[0], $$($nesting, 'Numeric'), $nesting);
- Opal.const_set($nesting[0], 'Fixnum', $$($nesting, 'Number'));
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Integer');
-
- var $nesting = [self].concat($parent_nesting);
-
-
- self.$$is_number_class = true;
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $allocate$78, $eq_eq_eq$79, $sqrt$80;
-
-
-
- Opal.def(self, '$allocate', $allocate$78 = function $$allocate() {
- var self = this;
-
- return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name()))
- }, $allocate$78.$$arity = 0);
-
- Opal.udef(self, '$' + "new");;
-
- Opal.def(self, '$===', $eq_eq_eq$79 = function(other) {
- var self = this;
-
-
- if (!other.$$is_number) {
- return false;
- }
-
- return (other % 1) === 0;
-
- }, $eq_eq_eq$79.$$arity = 1);
- return (Opal.def(self, '$sqrt', $sqrt$80 = function $$sqrt(n) {
- var self = this;
-
-
- n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int");
-
- if (n < 0) {
- self.$raise($$$($$($nesting, 'Math'), 'DomainError'), "Numerical argument is out of domain - \"isqrt\"")
- }
-
- return parseInt(Math.sqrt(n), 10);
- ;
- }, $sqrt$80.$$arity = 1), nil) && 'sqrt';
- })(Opal.get_singleton_class(self), $nesting);
- Opal.const_set($nesting[0], 'MAX', Math.pow(2, 30) - 1);
- return Opal.const_set($nesting[0], 'MIN', -Math.pow(2, 30));
- })($nesting[0], $$($nesting, 'Numeric'), $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Float');
-
- var $nesting = [self].concat($parent_nesting);
-
-
- self.$$is_number_class = true;
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $allocate$81, $eq_eq_eq$82;
-
-
-
- Opal.def(self, '$allocate', $allocate$81 = function $$allocate() {
- var self = this;
-
- return self.$raise($$($nesting, 'TypeError'), "" + "allocator undefined for " + (self.$name()))
- }, $allocate$81.$$arity = 0);
-
- Opal.udef(self, '$' + "new");;
- return (Opal.def(self, '$===', $eq_eq_eq$82 = function(other) {
- var self = this;
-
- return !!other.$$is_number;
- }, $eq_eq_eq$82.$$arity = 1), nil) && '===';
- })(Opal.get_singleton_class(self), $nesting);
- Opal.const_set($nesting[0], 'INFINITY', Infinity);
- Opal.const_set($nesting[0], 'MAX', Number.MAX_VALUE);
- Opal.const_set($nesting[0], 'MIN', Number.MIN_VALUE);
- Opal.const_set($nesting[0], 'NAN', NaN);
- Opal.const_set($nesting[0], 'DIG', 15);
- Opal.const_set($nesting[0], 'MANT_DIG', 53);
- Opal.const_set($nesting[0], 'RADIX', 2);
- return Opal.const_set($nesting[0], 'EPSILON', Number.EPSILON || 2.2204460492503130808472633361816E-16);
- })($nesting[0], $$($nesting, 'Numeric'), $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/range"] = function(Opal) {
- function $rb_le(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs);
- }
- function $rb_lt(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_minus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
- }
- function $rb_divide(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_times(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, $klass = Opal.klass, $truthy = Opal.truthy, $send = Opal.send;
-
- Opal.add_stubs(['$require', '$include', '$attr_reader', '$raise', '$<=>', '$include?', '$<=', '$<', '$enum_for', '$upto', '$to_proc', '$respond_to?', '$class', '$succ', '$!', '$==', '$===', '$exclude_end?', '$eql?', '$begin', '$end', '$last', '$to_a', '$>', '$-', '$abs', '$to_i', '$coerce_to!', '$ceil', '$/', '$size', '$loop', '$+', '$*', '$>=', '$each_with_index', '$%', '$bsearch', '$inspect', '$[]', '$hash']);
-
- self.$require("corelib/enumerable");
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Range');
-
- var $nesting = [self].concat($parent_nesting), $Range_initialize$1, $Range_$eq_eq$2, $Range_$eq_eq_eq$3, $Range_cover$ques$4, $Range_each$5, $Range_eql$ques$6, $Range_exclude_end$ques$7, $Range_first$8, $Range_last$9, $Range_max$10, $Range_min$11, $Range_size$12, $Range_step$13, $Range_bsearch$17, $Range_to_s$18, $Range_inspect$19, $Range_marshal_load$20, $Range_hash$21;
-
- self.$$prototype.begin = self.$$prototype.end = self.$$prototype.excl = nil;
-
- self.$include($$($nesting, 'Enumerable'));
- self.$$prototype.$$is_range = true;
- self.$attr_reader("begin", "end");
-
- Opal.def(self, '$initialize', $Range_initialize$1 = function $$initialize(first, last, exclude) {
- var self = this;
-
-
-
- if (exclude == null) {
- exclude = false;
- };
- if ($truthy(self.begin)) {
- self.$raise($$($nesting, 'NameError'), "'initialize' called twice")};
- if ($truthy(first['$<=>'](last))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "bad value for range")
- };
- self.begin = first;
- self.end = last;
- return (self.excl = exclude);
- }, $Range_initialize$1.$$arity = -3);
-
- Opal.def(self, '$==', $Range_$eq_eq$2 = function(other) {
- var self = this;
-
-
- if (!other.$$is_range) {
- return false;
- }
-
- return self.excl === other.excl &&
- self.begin == other.begin &&
- self.end == other.end;
-
- }, $Range_$eq_eq$2.$$arity = 1);
-
- Opal.def(self, '$===', $Range_$eq_eq_eq$3 = function(value) {
- var self = this;
-
- return self['$include?'](value)
- }, $Range_$eq_eq_eq$3.$$arity = 1);
-
- Opal.def(self, '$cover?', $Range_cover$ques$4 = function(value) {
- var $a, self = this, beg_cmp = nil, end_cmp = nil;
-
-
- beg_cmp = self.begin['$<=>'](value);
- if ($truthy(($truthy($a = beg_cmp) ? $rb_le(beg_cmp, 0) : $a))) {
- } else {
- return false
- };
- end_cmp = value['$<=>'](self.end);
- if ($truthy(self.excl)) {
- return ($truthy($a = end_cmp) ? $rb_lt(end_cmp, 0) : $a)
- } else {
- return ($truthy($a = end_cmp) ? $rb_le(end_cmp, 0) : $a)
- };
- }, $Range_cover$ques$4.$$arity = 1);
-
- Opal.def(self, '$each', $Range_each$5 = function $$each() {
- var $iter = $Range_each$5.$$p, block = $iter || nil, $a, self = this, current = nil, last = nil;
-
- if ($iter) $Range_each$5.$$p = null;
-
-
- if ($iter) $Range_each$5.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("each")
- };
-
- var i, limit;
-
- if (self.begin.$$is_number && self.end.$$is_number) {
- if (self.begin % 1 !== 0 || self.end % 1 !== 0) {
- self.$raise($$($nesting, 'TypeError'), "can't iterate from Float")
- }
-
- for (i = self.begin, limit = self.end + (function() {if ($truthy(self.excl)) {
- return 0
- } else {
- return 1
- }; return nil; })(); i < limit; i++) {
- block(i);
- }
-
- return self;
- }
-
- if (self.begin.$$is_string && self.end.$$is_string) {
- $send(self.begin, 'upto', [self.end, self.excl], block.$to_proc())
- return self;
- }
- ;
- current = self.begin;
- last = self.end;
- if ($truthy(current['$respond_to?']("succ"))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + "can't iterate from " + (current.$class()))
- };
- while ($truthy($rb_lt(current['$<=>'](last), 0))) {
-
- Opal.yield1(block, current);
- current = current.$succ();
- };
- if ($truthy(($truthy($a = self.excl['$!']()) ? current['$=='](last) : $a))) {
- Opal.yield1(block, current)};
- return self;
- }, $Range_each$5.$$arity = 0);
-
- Opal.def(self, '$eql?', $Range_eql$ques$6 = function(other) {
- var $a, $b, self = this;
-
-
- if ($truthy($$($nesting, 'Range')['$==='](other))) {
- } else {
- return false
- };
- return ($truthy($a = ($truthy($b = self.excl['$==='](other['$exclude_end?']())) ? self.begin['$eql?'](other.$begin()) : $b)) ? self.end['$eql?'](other.$end()) : $a);
- }, $Range_eql$ques$6.$$arity = 1);
-
- Opal.def(self, '$exclude_end?', $Range_exclude_end$ques$7 = function() {
- var self = this;
-
- return self.excl
- }, $Range_exclude_end$ques$7.$$arity = 0);
-
- Opal.def(self, '$first', $Range_first$8 = function $$first(n) {
- var $iter = $Range_first$8.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Range_first$8.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
- ;
- if ($truthy(n == null)) {
- return self.begin};
- return $send(self, Opal.find_super_dispatcher(self, 'first', $Range_first$8, false), $zuper, $iter);
- }, $Range_first$8.$$arity = -1);
- Opal.alias(self, "include?", "cover?");
-
- Opal.def(self, '$last', $Range_last$9 = function $$last(n) {
- var self = this;
-
-
- ;
- if ($truthy(n == null)) {
- return self.end};
- return self.$to_a().$last(n);
- }, $Range_last$9.$$arity = -1);
-
- Opal.def(self, '$max', $Range_max$10 = function $$max() {
- var $a, $iter = $Range_max$10.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Range_max$10.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if (($yield !== nil)) {
- return $send(self, Opal.find_super_dispatcher(self, 'max', $Range_max$10, false), $zuper, $iter)
- } else if ($truthy($rb_gt(self.begin, self.end))) {
- return nil
- } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) {
- return nil
- } else {
- return self.excl ? self.end - 1 : self.end
- }
- }, $Range_max$10.$$arity = 0);
- Opal.alias(self, "member?", "cover?");
-
- Opal.def(self, '$min', $Range_min$11 = function $$min() {
- var $a, $iter = $Range_min$11.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Range_min$11.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if (($yield !== nil)) {
- return $send(self, Opal.find_super_dispatcher(self, 'min', $Range_min$11, false), $zuper, $iter)
- } else if ($truthy($rb_gt(self.begin, self.end))) {
- return nil
- } else if ($truthy(($truthy($a = self.excl) ? self.begin['$=='](self.end) : $a))) {
- return nil
- } else {
- return self.begin
- }
- }, $Range_min$11.$$arity = 0);
-
- Opal.def(self, '$size', $Range_size$12 = function $$size() {
- var $a, self = this, range_begin = nil, range_end = nil, infinity = nil;
-
-
- range_begin = self.begin;
- range_end = self.end;
- if ($truthy(self.excl)) {
- range_end = $rb_minus(range_end, 1)};
- if ($truthy(($truthy($a = $$($nesting, 'Numeric')['$==='](range_begin)) ? $$($nesting, 'Numeric')['$==='](range_end) : $a))) {
- } else {
- return nil
- };
- if ($truthy($rb_lt(range_end, range_begin))) {
- return 0};
- infinity = $$$($$($nesting, 'Float'), 'INFINITY');
- if ($truthy([range_begin.$abs(), range_end.$abs()]['$include?'](infinity))) {
- return infinity};
- return (Math.abs(range_end - range_begin) + 1).$to_i();
- }, $Range_size$12.$$arity = 0);
-
- Opal.def(self, '$step', $Range_step$13 = function $$step(n) {
- var $$14, $$15, $$16, $iter = $Range_step$13.$$p, $yield = $iter || nil, self = this, i = nil;
-
- if ($iter) $Range_step$13.$$p = null;
-
-
- if (n == null) {
- n = 1;
- };
-
- function coerceStepSize() {
- if (!n.$$is_number) {
- n = $$($nesting, 'Opal')['$coerce_to!'](n, $$($nesting, 'Integer'), "to_int")
- }
-
- if (n < 0) {
- self.$raise($$($nesting, 'ArgumentError'), "step can't be negative")
- } else if (n === 0) {
- self.$raise($$($nesting, 'ArgumentError'), "step can't be 0")
- }
- }
-
- function enumeratorSize() {
- if (!self.begin['$respond_to?']("succ")) {
- return nil;
- }
-
- if (self.begin.$$is_string && self.end.$$is_string) {
- return nil;
- }
-
- if (n % 1 === 0) {
- return $rb_divide(self.$size(), n).$ceil();
- } else {
- // n is a float
- var begin = self.begin, end = self.end,
- abs = Math.abs, floor = Math.floor,
- err = (abs(begin) + abs(end) + abs(end - begin)) / abs(n) * $$$($$($nesting, 'Float'), 'EPSILON'),
- size;
-
- if (err > 0.5) {
- err = 0.5;
- }
-
- if (self.excl) {
- size = floor((end - begin) / n - err);
- if (size * n + begin < end) {
- size++;
- }
- } else {
- size = floor((end - begin) / n + err) + 1
- }
-
- return size;
- }
- }
- ;
- if (($yield !== nil)) {
- } else {
- return $send(self, 'enum_for', ["step", n], ($$14 = function(){var self = $$14.$$s || this;
-
-
- coerceStepSize();
- return enumeratorSize();
- }, $$14.$$s = self, $$14.$$arity = 0, $$14))
- };
- coerceStepSize();
- if ($truthy(self.begin.$$is_number && self.end.$$is_number)) {
-
- i = 0;
- (function(){var $brk = Opal.new_brk(); try {return $send(self, 'loop', [], ($$15 = function(){var self = $$15.$$s || this, current = nil;
- if (self.begin == null) self.begin = nil;
- if (self.excl == null) self.excl = nil;
- if (self.end == null) self.end = nil;
-
-
- current = $rb_plus(self.begin, $rb_times(i, n));
- if ($truthy(self.excl)) {
- if ($truthy($rb_ge(current, self.end))) {
-
- Opal.brk(nil, $brk)}
- } else if ($truthy($rb_gt(current, self.end))) {
-
- Opal.brk(nil, $brk)};
- Opal.yield1($yield, current);
- return (i = $rb_plus(i, 1));}, $$15.$$s = self, $$15.$$brk = $brk, $$15.$$arity = 0, $$15))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();
- } else {
-
-
- if (self.begin.$$is_string && self.end.$$is_string && n % 1 !== 0) {
- self.$raise($$($nesting, 'TypeError'), "no implicit conversion to float from string")
- }
- ;
- $send(self, 'each_with_index', [], ($$16 = function(value, idx){var self = $$16.$$s || this;
-
-
-
- if (value == null) {
- value = nil;
- };
-
- if (idx == null) {
- idx = nil;
- };
- if (idx['$%'](n)['$=='](0)) {
- return Opal.yield1($yield, value);
- } else {
- return nil
- };}, $$16.$$s = self, $$16.$$arity = 2, $$16));
- };
- return self;
- }, $Range_step$13.$$arity = -1);
-
- Opal.def(self, '$bsearch', $Range_bsearch$17 = function $$bsearch() {
- var $iter = $Range_bsearch$17.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Range_bsearch$17.$$p = null;
-
-
- if ($iter) $Range_bsearch$17.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("bsearch")
- };
- if ($truthy(self.begin.$$is_number && self.end.$$is_number)) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + "can't do binary search for " + (self.begin.$class()))
- };
- return $send(self.$to_a(), 'bsearch', [], block.$to_proc());
- }, $Range_bsearch$17.$$arity = 0);
-
- Opal.def(self, '$to_s', $Range_to_s$18 = function $$to_s() {
- var self = this;
-
- return "" + (self.begin) + ((function() {if ($truthy(self.excl)) {
- return "..."
- } else {
- return ".."
- }; return nil; })()) + (self.end)
- }, $Range_to_s$18.$$arity = 0);
-
- Opal.def(self, '$inspect', $Range_inspect$19 = function $$inspect() {
- var self = this;
-
- return "" + (self.begin.$inspect()) + ((function() {if ($truthy(self.excl)) {
- return "..."
- } else {
- return ".."
- }; return nil; })()) + (self.end.$inspect())
- }, $Range_inspect$19.$$arity = 0);
-
- Opal.def(self, '$marshal_load', $Range_marshal_load$20 = function $$marshal_load(args) {
- var self = this;
-
-
- self.begin = args['$[]']("begin");
- self.end = args['$[]']("end");
- return (self.excl = args['$[]']("excl"));
- }, $Range_marshal_load$20.$$arity = 1);
- return (Opal.def(self, '$hash', $Range_hash$21 = function $$hash() {
- var self = this;
-
- return [self.begin, self.end, self.excl].$hash()
- }, $Range_hash$21.$$arity = 0), nil) && 'hash';
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/proc"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$raise', '$coerce_to!']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Proc');
-
- var $nesting = [self].concat($parent_nesting), $Proc_new$1, $Proc_call$2, $Proc_to_proc$3, $Proc_lambda$ques$4, $Proc_arity$5, $Proc_source_location$6, $Proc_binding$7, $Proc_parameters$8, $Proc_curry$9, $Proc_dup$10;
-
-
- Opal.defineProperty(self.$$prototype, '$$is_proc', true);
- Opal.defineProperty(self.$$prototype, '$$is_lambda', false);
- Opal.defs(self, '$new', $Proc_new$1 = function() {
- var $iter = $Proc_new$1.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Proc_new$1.$$p = null;
-
-
- if ($iter) $Proc_new$1.$$p = null;;
- if ($truthy(block)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "tried to create a Proc object without a block")
- };
- return block;
- }, $Proc_new$1.$$arity = 0);
-
- Opal.def(self, '$call', $Proc_call$2 = function $$call($a) {
- var $iter = $Proc_call$2.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $Proc_call$2.$$p = null;
-
-
- if ($iter) $Proc_call$2.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- if (block !== nil) {
- self.$$p = block;
- }
-
- var result, $brk = self.$$brk;
-
- if ($brk) {
- try {
- if (self.$$is_lambda) {
- result = self.apply(null, args);
- }
- else {
- result = Opal.yieldX(self, args);
- }
- } catch (err) {
- if (err === $brk) {
- return $brk.$v
- }
- else {
- throw err
- }
- }
- }
- else {
- if (self.$$is_lambda) {
- result = self.apply(null, args);
- }
- else {
- result = Opal.yieldX(self, args);
- }
- }
-
- return result;
- ;
- }, $Proc_call$2.$$arity = -1);
- Opal.alias(self, "[]", "call");
- Opal.alias(self, "===", "call");
- Opal.alias(self, "yield", "call");
-
- Opal.def(self, '$to_proc', $Proc_to_proc$3 = function $$to_proc() {
- var self = this;
-
- return self
- }, $Proc_to_proc$3.$$arity = 0);
-
- Opal.def(self, '$lambda?', $Proc_lambda$ques$4 = function() {
- var self = this;
-
- return !!self.$$is_lambda;
- }, $Proc_lambda$ques$4.$$arity = 0);
-
- Opal.def(self, '$arity', $Proc_arity$5 = function $$arity() {
- var self = this;
-
-
- if (self.$$is_curried) {
- return -1;
- } else {
- return self.$$arity;
- }
-
- }, $Proc_arity$5.$$arity = 0);
-
- Opal.def(self, '$source_location', $Proc_source_location$6 = function $$source_location() {
- var self = this;
-
-
- if (self.$$is_curried) { return nil; };
- return nil;
- }, $Proc_source_location$6.$$arity = 0);
-
- Opal.def(self, '$binding', $Proc_binding$7 = function $$binding() {
- var self = this;
-
-
- if (self.$$is_curried) { self.$raise($$($nesting, 'ArgumentError'), "Can't create Binding") };
- return nil;
- }, $Proc_binding$7.$$arity = 0);
-
- Opal.def(self, '$parameters', $Proc_parameters$8 = function $$parameters() {
- var self = this;
-
-
- if (self.$$is_curried) {
- return [["rest"]];
- } else if (self.$$parameters) {
- if (self.$$is_lambda) {
- return self.$$parameters;
- } else {
- var result = [], i, length;
-
- for (i = 0, length = self.$$parameters.length; i < length; i++) {
- var parameter = self.$$parameters[i];
-
- if (parameter[0] === 'req') {
- // required arguments always have name
- parameter = ['opt', parameter[1]];
- }
-
- result.push(parameter);
- }
-
- return result;
- }
- } else {
- return [];
- }
-
- }, $Proc_parameters$8.$$arity = 0);
-
- Opal.def(self, '$curry', $Proc_curry$9 = function $$curry(arity) {
- var self = this;
-
-
- ;
-
- if (arity === undefined) {
- arity = self.length;
- }
- else {
- arity = $$($nesting, 'Opal')['$coerce_to!'](arity, $$($nesting, 'Integer'), "to_int");
- if (self.$$is_lambda && arity !== self.length) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (arity) + " for " + (self.length) + ")")
- }
- }
-
- function curried () {
- var args = $slice.call(arguments),
- length = args.length,
- result;
-
- if (length > arity && self.$$is_lambda && !self.$$is_curried) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (" + (length) + " for " + (arity) + ")")
- }
-
- if (length >= arity) {
- return self.$call.apply(self, args);
- }
-
- result = function () {
- return curried.apply(null,
- args.concat($slice.call(arguments)));
- }
- result.$$is_lambda = self.$$is_lambda;
- result.$$is_curried = true;
-
- return result;
- };
-
- curried.$$is_lambda = self.$$is_lambda;
- curried.$$is_curried = true;
- return curried;
- ;
- }, $Proc_curry$9.$$arity = -1);
-
- Opal.def(self, '$dup', $Proc_dup$10 = function $$dup() {
- var self = this;
-
-
- var original_proc = self.$$original_proc || self,
- proc = function () {
- return original_proc.apply(this, arguments);
- };
-
- for (var prop in self) {
- if (self.hasOwnProperty(prop)) {
- proc[prop] = self[prop];
- }
- }
-
- return proc;
-
- }, $Proc_dup$10.$$arity = 0);
- return Opal.alias(self, "clone", "dup");
- })($nesting[0], Function, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/method"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$attr_reader', '$arity', '$new', '$class', '$join', '$source_location', '$raise']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Method');
-
- var $nesting = [self].concat($parent_nesting), $Method_initialize$1, $Method_arity$2, $Method_parameters$3, $Method_source_location$4, $Method_comments$5, $Method_call$6, $Method_unbind$7, $Method_to_proc$8, $Method_inspect$9;
-
- self.$$prototype.method = self.$$prototype.receiver = self.$$prototype.owner = self.$$prototype.name = nil;
-
- self.$attr_reader("owner", "receiver", "name");
-
- Opal.def(self, '$initialize', $Method_initialize$1 = function $$initialize(receiver, owner, method, name) {
- var self = this;
-
-
- self.receiver = receiver;
- self.owner = owner;
- self.name = name;
- return (self.method = method);
- }, $Method_initialize$1.$$arity = 4);
-
- Opal.def(self, '$arity', $Method_arity$2 = function $$arity() {
- var self = this;
-
- return self.method.$arity()
- }, $Method_arity$2.$$arity = 0);
-
- Opal.def(self, '$parameters', $Method_parameters$3 = function $$parameters() {
- var self = this;
-
- return self.method.$$parameters
- }, $Method_parameters$3.$$arity = 0);
-
- Opal.def(self, '$source_location', $Method_source_location$4 = function $$source_location() {
- var $a, self = this;
-
- return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0])
- }, $Method_source_location$4.$$arity = 0);
-
- Opal.def(self, '$comments', $Method_comments$5 = function $$comments() {
- var $a, self = this;
-
- return ($truthy($a = self.method.$$comments) ? $a : [])
- }, $Method_comments$5.$$arity = 0);
-
- Opal.def(self, '$call', $Method_call$6 = function $$call($a) {
- var $iter = $Method_call$6.$$p, block = $iter || nil, $post_args, args, self = this;
-
- if ($iter) $Method_call$6.$$p = null;
-
-
- if ($iter) $Method_call$6.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
-
- self.method.$$p = block;
-
- return self.method.apply(self.receiver, args);
- ;
- }, $Method_call$6.$$arity = -1);
- Opal.alias(self, "[]", "call");
-
- Opal.def(self, '$unbind', $Method_unbind$7 = function $$unbind() {
- var self = this;
-
- return $$($nesting, 'UnboundMethod').$new(self.receiver.$class(), self.owner, self.method, self.name)
- }, $Method_unbind$7.$$arity = 0);
-
- Opal.def(self, '$to_proc', $Method_to_proc$8 = function $$to_proc() {
- var self = this;
-
-
- var proc = self.$call.bind(self);
- proc.$$unbound = self.method;
- proc.$$is_lambda = true;
- proc.$$arity = self.method.$$arity;
- proc.$$parameters = self.method.$$parameters;
- return proc;
-
- }, $Method_to_proc$8.$$arity = 0);
- return (Opal.def(self, '$inspect', $Method_inspect$9 = function $$inspect() {
- var self = this;
-
- return "" + "#<" + (self.$class()) + ": " + (self.receiver.$class()) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>"
- }, $Method_inspect$9.$$arity = 0), nil) && 'inspect';
- })($nesting[0], null, $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'UnboundMethod');
-
- var $nesting = [self].concat($parent_nesting), $UnboundMethod_initialize$10, $UnboundMethod_arity$11, $UnboundMethod_parameters$12, $UnboundMethod_source_location$13, $UnboundMethod_comments$14, $UnboundMethod_bind$15, $UnboundMethod_inspect$16;
-
- self.$$prototype.method = self.$$prototype.owner = self.$$prototype.name = self.$$prototype.source = nil;
-
- self.$attr_reader("source", "owner", "name");
-
- Opal.def(self, '$initialize', $UnboundMethod_initialize$10 = function $$initialize(source, owner, method, name) {
- var self = this;
-
-
- self.source = source;
- self.owner = owner;
- self.method = method;
- return (self.name = name);
- }, $UnboundMethod_initialize$10.$$arity = 4);
-
- Opal.def(self, '$arity', $UnboundMethod_arity$11 = function $$arity() {
- var self = this;
-
- return self.method.$arity()
- }, $UnboundMethod_arity$11.$$arity = 0);
-
- Opal.def(self, '$parameters', $UnboundMethod_parameters$12 = function $$parameters() {
- var self = this;
-
- return self.method.$$parameters
- }, $UnboundMethod_parameters$12.$$arity = 0);
-
- Opal.def(self, '$source_location', $UnboundMethod_source_location$13 = function $$source_location() {
- var $a, self = this;
-
- return ($truthy($a = self.method.$$source_location) ? $a : ["(eval)", 0])
- }, $UnboundMethod_source_location$13.$$arity = 0);
-
- Opal.def(self, '$comments', $UnboundMethod_comments$14 = function $$comments() {
- var $a, self = this;
-
- return ($truthy($a = self.method.$$comments) ? $a : [])
- }, $UnboundMethod_comments$14.$$arity = 0);
-
- Opal.def(self, '$bind', $UnboundMethod_bind$15 = function $$bind(object) {
- var self = this;
-
-
- if (self.owner.$$is_module || Opal.is_a(object, self.owner)) {
- return $$($nesting, 'Method').$new(object, self.owner, self.method, self.name);
- }
- else {
- self.$raise($$($nesting, 'TypeError'), "" + "can't bind singleton method to a different class (expected " + (object) + ".kind_of?(" + (self.owner) + " to be true)");
- }
-
- }, $UnboundMethod_bind$15.$$arity = 1);
- return (Opal.def(self, '$inspect', $UnboundMethod_inspect$16 = function $$inspect() {
- var self = this;
-
- return "" + "#<" + (self.$class()) + ": " + (self.source) + "#" + (self.name) + " (defined in " + (self.owner) + " in " + (self.$source_location().$join(":")) + ")>"
- }, $UnboundMethod_inspect$16.$$arity = 0), nil) && 'inspect';
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/variables"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $gvars = Opal.gvars, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$new']);
-
- $gvars['&'] = $gvars['~'] = $gvars['`'] = $gvars["'"] = nil;
- $gvars.LOADED_FEATURES = ($gvars["\""] = Opal.loaded_features);
- $gvars.LOAD_PATH = ($gvars[":"] = []);
- $gvars["/"] = "\n";
- $gvars[","] = nil;
- Opal.const_set($nesting[0], 'ARGV', []);
- Opal.const_set($nesting[0], 'ARGF', $$($nesting, 'Object').$new());
- Opal.const_set($nesting[0], 'ENV', $hash2([], {}));
- $gvars.VERBOSE = false;
- $gvars.DEBUG = false;
- return ($gvars.SAFE = 0);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["opal/regexp_anchors"] = function(Opal) {
- 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;
-
- Opal.add_stubs(['$==', '$new']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Opal');
-
- var $nesting = [self].concat($parent_nesting);
-
-
- Opal.const_set($nesting[0], 'REGEXP_START', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- return "^"
- } else {
- return nil
- }; return nil; })());
- Opal.const_set($nesting[0], 'REGEXP_END', (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- return "$"
- } else {
- return nil
- }; return nil; })());
- Opal.const_set($nesting[0], 'FORBIDDEN_STARTING_IDENTIFIER_CHARS', "\\u0001-\\u002F\\u003A-\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F");
- Opal.const_set($nesting[0], 'FORBIDDEN_ENDING_IDENTIFIER_CHARS', "\\u0001-\\u0020\\u0022-\\u002F\\u003A-\\u003E\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F");
- Opal.const_set($nesting[0], 'INLINE_IDENTIFIER_REGEXP', $$($nesting, 'Regexp').$new("" + "[^" + ($$($nesting, 'FORBIDDEN_STARTING_IDENTIFIER_CHARS')) + "]*[^" + ($$($nesting, 'FORBIDDEN_ENDING_IDENTIFIER_CHARS')) + "]"));
- Opal.const_set($nesting[0], 'FORBIDDEN_CONST_NAME_CHARS', "\\u0001-\\u0020\\u0021-\\u002F\\u003B-\\u003F\\u0040\\u005B-\\u005E\\u0060\\u007B-\\u007F");
- Opal.const_set($nesting[0], 'CONST_NAME_REGEXP', $$($nesting, 'Regexp').$new("" + ($$($nesting, 'REGEXP_START')) + "(::)?[A-Z][^" + ($$($nesting, 'FORBIDDEN_CONST_NAME_CHARS')) + "]*" + ($$($nesting, 'REGEXP_END'))));
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["opal/mini"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$require']);
-
- self.$require("opal/base");
- self.$require("corelib/nil");
- self.$require("corelib/boolean");
- self.$require("corelib/string");
- self.$require("corelib/comparable");
- self.$require("corelib/enumerable");
- self.$require("corelib/enumerator");
- self.$require("corelib/array");
- self.$require("corelib/hash");
- self.$require("corelib/number");
- self.$require("corelib/range");
- self.$require("corelib/proc");
- self.$require("corelib/method");
- self.$require("corelib/regexp");
- self.$require("corelib/variables");
- return self.$require("opal/regexp_anchors");
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/string/encoding"] = function(Opal) {
- function $rb_plus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
- }
- function $rb_lt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
- }
- var $$11, $$14, $$17, $$20, $$23, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send;
-
- Opal.add_stubs(['$require', '$+', '$[]', '$new', '$to_proc', '$each', '$const_set', '$sub', '$==', '$default_external', '$upcase', '$raise', '$attr_accessor', '$attr_reader', '$register', '$length', '$bytes', '$to_a', '$each_byte', '$dup', '$bytesize', '$enum_for', '$coerce_to!', '$find', '$<']);
-
- self.$require("corelib/string");
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Encoding');
-
- var $nesting = [self].concat($parent_nesting), $Encoding_register$1, $Encoding_find$3, $Encoding_initialize$4, $Encoding_ascii_compatible$ques$5, $Encoding_dummy$ques$6, $Encoding_to_s$7, $Encoding_inspect$8, $Encoding_each_byte$9, $Encoding_bytesize$10;
-
- self.$$prototype.ascii = self.$$prototype.dummy = self.$$prototype.name = nil;
-
- Opal.defineProperty(self, '$$register', {});
- Opal.defs(self, '$register', $Encoding_register$1 = function $$register(name, options) {
- var $iter = $Encoding_register$1.$$p, block = $iter || nil, $a, $$2, self = this, names = nil, encoding = nil, register = nil;
-
- if ($iter) $Encoding_register$1.$$p = null;
-
-
- if ($iter) $Encoding_register$1.$$p = null;;
-
- if (options == null) {
- options = $hash2([], {});
- };
- names = $rb_plus([name], ($truthy($a = options['$[]']("aliases")) ? $a : []));
- encoding = $send($$($nesting, 'Class'), 'new', [self], block.$to_proc()).$new(name, names, ($truthy($a = options['$[]']("ascii")) ? $a : false), ($truthy($a = options['$[]']("dummy")) ? $a : false));
- register = self["$$register"];
- return $send(names, 'each', [], ($$2 = function(encoding_name){var self = $$2.$$s || this;
-
-
-
- if (encoding_name == null) {
- encoding_name = nil;
- };
- self.$const_set(encoding_name.$sub("-", "_"), encoding);
- return register["" + "$$" + (encoding_name)] = encoding;}, $$2.$$s = self, $$2.$$arity = 1, $$2));
- }, $Encoding_register$1.$$arity = -2);
- Opal.defs(self, '$find', $Encoding_find$3 = function $$find(name) {
- var $a, self = this, register = nil, encoding = nil;
-
-
- if (name['$==']("default_external")) {
- return self.$default_external()};
- register = self["$$register"];
- encoding = ($truthy($a = register["" + "$$" + (name)]) ? $a : register["" + "$$" + (name.$upcase())]);
- if ($truthy(encoding)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "" + "unknown encoding name - " + (name))
- };
- return encoding;
- }, $Encoding_find$3.$$arity = 1);
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting);
-
- return self.$attr_accessor("default_external")
- })(Opal.get_singleton_class(self), $nesting);
- self.$attr_reader("name", "names");
-
- Opal.def(self, '$initialize', $Encoding_initialize$4 = function $$initialize(name, names, ascii, dummy) {
- var self = this;
-
-
- self.name = name;
- self.names = names;
- self.ascii = ascii;
- return (self.dummy = dummy);
- }, $Encoding_initialize$4.$$arity = 4);
-
- Opal.def(self, '$ascii_compatible?', $Encoding_ascii_compatible$ques$5 = function() {
- var self = this;
-
- return self.ascii
- }, $Encoding_ascii_compatible$ques$5.$$arity = 0);
-
- Opal.def(self, '$dummy?', $Encoding_dummy$ques$6 = function() {
- var self = this;
-
- return self.dummy
- }, $Encoding_dummy$ques$6.$$arity = 0);
-
- Opal.def(self, '$to_s', $Encoding_to_s$7 = function $$to_s() {
- var self = this;
-
- return self.name
- }, $Encoding_to_s$7.$$arity = 0);
-
- Opal.def(self, '$inspect', $Encoding_inspect$8 = function $$inspect() {
- var self = this;
-
- return "" + "#"
- }, $Encoding_inspect$8.$$arity = 0);
-
- Opal.def(self, '$each_byte', $Encoding_each_byte$9 = function $$each_byte($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'));
- }, $Encoding_each_byte$9.$$arity = -1);
-
- Opal.def(self, '$bytesize', $Encoding_bytesize$10 = function $$bytesize($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'));
- }, $Encoding_bytesize$10.$$arity = -1);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'EncodingError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'StandardError'), $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'CompatibilityError');
-
- var $nesting = [self].concat($parent_nesting);
-
- return nil
- })($nesting[0], $$($nesting, 'EncodingError'), $nesting);
- })($nesting[0], null, $nesting);
- $send($$($nesting, 'Encoding'), 'register', ["UTF-8", $hash2(["aliases", "ascii"], {"aliases": ["CP65001"], "ascii": true})], ($$11 = function(){var self = $$11.$$s || this, $each_byte$12, $bytesize$13;
-
-
-
- Opal.def(self, '$each_byte', $each_byte$12 = function $$each_byte(string) {
- var $iter = $each_byte$12.$$p, block = $iter || nil, self = this;
-
- if ($iter) $each_byte$12.$$p = null;
-
-
- if ($iter) $each_byte$12.$$p = null;;
-
- var units = Infinity
- var codePoint
- var length = string.length
- var leadSurrogate = null
-
- for (var i = 0; i < length; ++i) {
- codePoint = string.charCodeAt(i)
-
- // is surrogate component
- if (codePoint > 0xD7FF && codePoint < 0xE000) {
- // last char was a lead
- if (!leadSurrogate) {
- // no lead yet
- if (codePoint > 0xDBFF) {
- // unexpected trail
- if ((units -= 3) > -1) {
- Opal.yield1(block, 0xEF);
- Opal.yield1(block, 0xBF);
- Opal.yield1(block, 0xBD);
- }
- continue
- } else if (i + 1 === length) {
- // unpaired lead
- if ((units -= 3) > -1) {
- Opal.yield1(block, 0xEF);
- Opal.yield1(block, 0xBF);
- Opal.yield1(block, 0xBD);
- }
- continue
- }
-
- // valid lead
- leadSurrogate = codePoint
-
- continue
- }
-
- // 2 leads in a row
- if (codePoint < 0xDC00) {
- if ((units -= 3) > -1) {
- Opal.yield1(block, 0xEF);
- Opal.yield1(block, 0xBF);
- Opal.yield1(block, 0xBD);
- }
- leadSurrogate = codePoint
- continue
- }
-
- // valid surrogate pair
- codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
- } else if (leadSurrogate) {
- // valid bmp char, but last char was a lead
- if ((units -= 3) > -1) {
- Opal.yield1(block, 0xEF);
- Opal.yield1(block, 0xBF);
- Opal.yield1(block, 0xBD);
- }
- }
-
- leadSurrogate = null
-
- // encode utf8
- if (codePoint < 0x80) {
- if ((units -= 1) < 0) break
- Opal.yield1(block, codePoint);
- } else if (codePoint < 0x800) {
- if ((units -= 2) < 0) break
- Opal.yield1(block, codePoint >> 0x6 | 0xC0);
- Opal.yield1(block, codePoint & 0x3F | 0x80);
- } else if (codePoint < 0x10000) {
- if ((units -= 3) < 0) break
- Opal.yield1(block, codePoint >> 0xC | 0xE0);
- Opal.yield1(block, codePoint >> 0x6 & 0x3F | 0x80);
- Opal.yield1(block, codePoint & 0x3F | 0x80);
- } else if (codePoint < 0x110000) {
- if ((units -= 4) < 0) break
- Opal.yield1(block, codePoint >> 0x12 | 0xF0);
- Opal.yield1(block, codePoint >> 0xC & 0x3F | 0x80);
- Opal.yield1(block, codePoint >> 0x6 & 0x3F | 0x80);
- Opal.yield1(block, codePoint & 0x3F | 0x80);
- } else {
- // Invalid code point
- }
- }
- ;
- }, $each_byte$12.$$arity = 1);
- return (Opal.def(self, '$bytesize', $bytesize$13 = function $$bytesize(string) {
- var self = this;
-
- return string.$bytes().$length()
- }, $bytesize$13.$$arity = 1), nil) && 'bytesize';}, $$11.$$s = self, $$11.$$arity = 0, $$11));
- $send($$($nesting, 'Encoding'), 'register', ["UTF-16LE"], ($$14 = function(){var self = $$14.$$s || this, $each_byte$15, $bytesize$16;
-
-
-
- Opal.def(self, '$each_byte', $each_byte$15 = function $$each_byte(string) {
- var $iter = $each_byte$15.$$p, block = $iter || nil, self = this;
-
- if ($iter) $each_byte$15.$$p = null;
-
-
- if ($iter) $each_byte$15.$$p = null;;
-
- for (var i = 0, length = string.length; i < length; i++) {
- var code = string.charCodeAt(i);
-
- Opal.yield1(block, code & 0xff);
- Opal.yield1(block, code >> 8);
- }
- ;
- }, $each_byte$15.$$arity = 1);
- return (Opal.def(self, '$bytesize', $bytesize$16 = function $$bytesize(string) {
- var self = this;
-
- return string.$bytes().$length()
- }, $bytesize$16.$$arity = 1), nil) && 'bytesize';}, $$14.$$s = self, $$14.$$arity = 0, $$14));
- $send($$($nesting, 'Encoding'), 'register', ["UTF-16BE"], ($$17 = function(){var self = $$17.$$s || this, $each_byte$18, $bytesize$19;
-
-
-
- Opal.def(self, '$each_byte', $each_byte$18 = function $$each_byte(string) {
- var $iter = $each_byte$18.$$p, block = $iter || nil, self = this;
-
- if ($iter) $each_byte$18.$$p = null;
-
-
- if ($iter) $each_byte$18.$$p = null;;
-
- for (var i = 0, length = string.length; i < length; i++) {
- var code = string.charCodeAt(i);
-
- Opal.yield1(block, code >> 8);
- Opal.yield1(block, code & 0xff);
- }
- ;
- }, $each_byte$18.$$arity = 1);
- return (Opal.def(self, '$bytesize', $bytesize$19 = function $$bytesize(string) {
- var self = this;
-
- return string.$bytes().$length()
- }, $bytesize$19.$$arity = 1), nil) && 'bytesize';}, $$17.$$s = self, $$17.$$arity = 0, $$17));
- $send($$($nesting, 'Encoding'), 'register', ["UTF-32LE"], ($$20 = function(){var self = $$20.$$s || this, $each_byte$21, $bytesize$22;
-
-
-
- Opal.def(self, '$each_byte', $each_byte$21 = function $$each_byte(string) {
- var $iter = $each_byte$21.$$p, block = $iter || nil, self = this;
-
- if ($iter) $each_byte$21.$$p = null;
-
-
- if ($iter) $each_byte$21.$$p = null;;
-
- for (var i = 0, length = string.length; i < length; i++) {
- var code = string.charCodeAt(i);
-
- Opal.yield1(block, code & 0xff);
- Opal.yield1(block, code >> 8);
- }
- ;
- }, $each_byte$21.$$arity = 1);
- return (Opal.def(self, '$bytesize', $bytesize$22 = function $$bytesize(string) {
- var self = this;
-
- return string.$bytes().$length()
- }, $bytesize$22.$$arity = 1), nil) && 'bytesize';}, $$20.$$s = self, $$20.$$arity = 0, $$20));
- $send($$($nesting, 'Encoding'), 'register', ["ASCII-8BIT", $hash2(["aliases", "ascii", "dummy"], {"aliases": ["BINARY", "US-ASCII", "ASCII"], "ascii": true, "dummy": true})], ($$23 = function(){var self = $$23.$$s || this, $each_byte$24, $bytesize$25;
-
-
-
- Opal.def(self, '$each_byte', $each_byte$24 = function $$each_byte(string) {
- var $iter = $each_byte$24.$$p, block = $iter || nil, self = this;
-
- if ($iter) $each_byte$24.$$p = null;
-
-
- if ($iter) $each_byte$24.$$p = null;;
-
- for (var i = 0, length = string.length; i < length; i++) {
- var code = string.charCodeAt(i);
- Opal.yield1(block, code & 0xff);
- Opal.yield1(block, code >> 8);
- }
- ;
- }, $each_byte$24.$$arity = 1);
- return (Opal.def(self, '$bytesize', $bytesize$25 = function $$bytesize(string) {
- var self = this;
-
- return string.$bytes().$length()
- }, $bytesize$25.$$arity = 1), nil) && 'bytesize';}, $$23.$$s = self, $$23.$$arity = 0, $$23));
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'String');
-
- var $nesting = [self].concat($parent_nesting), $String_bytes$26, $String_bytesize$27, $String_each_byte$28, $String_encode$29, $String_force_encoding$30, $String_getbyte$31, $String_valid_encoding$ques$32;
-
- self.$$prototype.bytes = self.$$prototype.internal_encoding = nil;
-
- self.$attr_reader("encoding");
- self.$attr_reader("internal_encoding");
- Opal.defineProperty(String.prototype, 'bytes', nil);
- Opal.defineProperty(String.prototype, 'encoding', $$$($$($nesting, 'Encoding'), 'UTF_8'));
- Opal.defineProperty(String.prototype, 'internal_encoding', $$$($$($nesting, 'Encoding'), 'UTF_8'));
-
- Opal.def(self, '$bytes', $String_bytes$26 = function $$bytes() {
- var $a, self = this;
-
-
- self.bytes = ($truthy($a = self.bytes) ? $a : self.$each_byte().$to_a());
- return self.bytes.$dup();
- }, $String_bytes$26.$$arity = 0);
-
- Opal.def(self, '$bytesize', $String_bytesize$27 = function $$bytesize() {
- var self = this;
-
- return self.internal_encoding.$bytesize(self)
- }, $String_bytesize$27.$$arity = 0);
-
- Opal.def(self, '$each_byte', $String_each_byte$28 = function $$each_byte() {
- var $iter = $String_each_byte$28.$$p, block = $iter || nil, self = this;
-
- if ($iter) $String_each_byte$28.$$p = null;
-
-
- if ($iter) $String_each_byte$28.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("each_byte")
- };
- $send(self.internal_encoding, 'each_byte', [self], block.$to_proc());
- return self;
- }, $String_each_byte$28.$$arity = 0);
-
- Opal.def(self, '$encode', $String_encode$29 = function $$encode(encoding) {
- var self = this;
-
- return Opal.enc(self, encoding);
- }, $String_encode$29.$$arity = 1);
-
- Opal.def(self, '$force_encoding', $String_force_encoding$30 = function $$force_encoding(encoding) {
- var self = this;
-
-
- if (encoding === self.encoding) { return self; }
-
- encoding = $$($nesting, 'Opal')['$coerce_to!'](encoding, $$($nesting, 'String'), "to_s");
- encoding = $$($nesting, 'Encoding').$find(encoding);
-
- if (encoding === self.encoding) { return self; }
-
- self.encoding = encoding;
- return self;
-
- }, $String_force_encoding$30.$$arity = 1);
-
- Opal.def(self, '$getbyte', $String_getbyte$31 = function $$getbyte(idx) {
- var self = this, string_bytes = nil;
-
-
- string_bytes = self.$bytes();
- idx = $$($nesting, 'Opal')['$coerce_to!'](idx, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_lt(string_bytes.$length(), idx))) {
- return nil};
- return string_bytes['$[]'](idx);
- }, $String_getbyte$31.$$arity = 1);
- return (Opal.def(self, '$valid_encoding?', $String_valid_encoding$ques$32 = function() {
- var self = this;
-
- return true
- }, $String_valid_encoding$ques$32.$$arity = 0), nil) && 'valid_encoding?';
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/struct"] = function(Opal) {
- function $rb_gt(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_lt(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);
- }
- function $rb_plus(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, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send;
-
- Opal.add_stubs(['$require', '$include', '$const_name!', '$unshift', '$map', '$coerce_to!', '$new', '$each', '$define_struct_attribute', '$allocate', '$initialize', '$alias_method', '$module_eval', '$to_proc', '$const_set', '$==', '$raise', '$<<', '$members', '$define_method', '$instance_eval', '$class', '$last', '$>', '$length', '$-', '$keys', '$any?', '$join', '$[]', '$[]=', '$each_with_index', '$hash', '$===', '$<', '$-@', '$size', '$>=', '$include?', '$to_sym', '$instance_of?', '$__id__', '$eql?', '$enum_for', '$name', '$+', '$each_pair', '$inspect', '$each_with_object', '$flatten', '$to_a', '$respond_to?', '$dig']);
-
- self.$require("corelib/enumerable");
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Struct');
-
- var $nesting = [self].concat($parent_nesting), $Struct_new$1, $Struct_define_struct_attribute$6, $Struct_members$9, $Struct_inherited$10, $Struct_initialize$12, $Struct_members$15, $Struct_hash$16, $Struct_$$$17, $Struct_$$$eq$18, $Struct_$eq_eq$19, $Struct_eql$ques$20, $Struct_each$21, $Struct_each_pair$24, $Struct_length$27, $Struct_to_a$28, $Struct_inspect$30, $Struct_to_h$32, $Struct_values_at$34, $Struct_dig$36;
-
-
- self.$include($$($nesting, 'Enumerable'));
- Opal.defs(self, '$new', $Struct_new$1 = function(const_name, $a, $b) {
- var $iter = $Struct_new$1.$$p, block = $iter || nil, $post_args, $kwargs, args, keyword_init, $$2, $$3, self = this, klass = nil;
-
- if ($iter) $Struct_new$1.$$p = null;
-
-
- if ($iter) $Struct_new$1.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- $kwargs = Opal.extract_kwargs($post_args);
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- args = $post_args;;
-
- keyword_init = $kwargs.$$smap["keyword_init"];
- if (keyword_init == null) {
- keyword_init = false
- };
- if ($truthy(const_name)) {
-
- try {
- const_name = $$($nesting, 'Opal')['$const_name!'](const_name)
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'TypeError'), $$($nesting, 'NameError')])) {
- try {
-
- args.$unshift(const_name);
- const_name = nil;
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };};
- $send(args, 'map', [], ($$2 = function(arg){var self = $$2.$$s || this;
-
-
-
- if (arg == null) {
- arg = nil;
- };
- return $$($nesting, 'Opal')['$coerce_to!'](arg, $$($nesting, 'String'), "to_str");}, $$2.$$s = self, $$2.$$arity = 1, $$2));
- klass = $send($$($nesting, 'Class'), 'new', [self], ($$3 = function(){var self = $$3.$$s || this, $$4;
-
-
- $send(args, 'each', [], ($$4 = function(arg){var self = $$4.$$s || this;
-
-
-
- if (arg == null) {
- arg = nil;
- };
- return self.$define_struct_attribute(arg);}, $$4.$$s = self, $$4.$$arity = 1, $$4));
- return (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $new$5;
-
-
-
- Opal.def(self, '$new', $new$5 = function($a) {
- var $post_args, args, self = this, instance = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- instance = self.$allocate();
- instance.$$data = {};
- $send(instance, 'initialize', Opal.to_a(args));
- return instance;
- }, $new$5.$$arity = -1);
- return self.$alias_method("[]", "new");
- })(Opal.get_singleton_class(self), $nesting);}, $$3.$$s = self, $$3.$$arity = 0, $$3));
- if ($truthy(block)) {
- $send(klass, 'module_eval', [], block.$to_proc())};
- klass.$$keyword_init = keyword_init;
- if ($truthy(const_name)) {
- $$($nesting, 'Struct').$const_set(const_name, klass)};
- return klass;
- }, $Struct_new$1.$$arity = -2);
- Opal.defs(self, '$define_struct_attribute', $Struct_define_struct_attribute$6 = function $$define_struct_attribute(name) {
- var $$7, $$8, self = this;
-
-
- if (self['$==']($$($nesting, 'Struct'))) {
- self.$raise($$($nesting, 'ArgumentError'), "you cannot define attributes to the Struct class")};
- self.$members()['$<<'](name);
- $send(self, 'define_method', [name], ($$7 = function(){var self = $$7.$$s || this;
-
- return self.$$data[name];}, $$7.$$s = self, $$7.$$arity = 0, $$7));
- return $send(self, 'define_method', ["" + (name) + "="], ($$8 = function(value){var self = $$8.$$s || this;
-
-
-
- if (value == null) {
- value = nil;
- };
- return self.$$data[name] = value;;}, $$8.$$s = self, $$8.$$arity = 1, $$8));
- }, $Struct_define_struct_attribute$6.$$arity = 1);
- Opal.defs(self, '$members', $Struct_members$9 = function $$members() {
- var $a, self = this;
- if (self.members == null) self.members = nil;
-
-
- if (self['$==']($$($nesting, 'Struct'))) {
- self.$raise($$($nesting, 'ArgumentError'), "the Struct class has no members")};
- return (self.members = ($truthy($a = self.members) ? $a : []));
- }, $Struct_members$9.$$arity = 0);
- Opal.defs(self, '$inherited', $Struct_inherited$10 = function $$inherited(klass) {
- var $$11, self = this, members = nil;
- if (self.members == null) self.members = nil;
-
-
- members = self.members;
- return $send(klass, 'instance_eval', [], ($$11 = function(){var self = $$11.$$s || this;
-
- return (self.members = members)}, $$11.$$s = self, $$11.$$arity = 0, $$11));
- }, $Struct_inherited$10.$$arity = 1);
-
- Opal.def(self, '$initialize', $Struct_initialize$12 = function $$initialize($a) {
- var $post_args, args, $b, $$13, $$14, self = this, kwargs = nil, extra = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy(self.$class().$$keyword_init)) {
-
- kwargs = ($truthy($b = args.$last()) ? $b : $hash2([], {}));
- if ($truthy(($truthy($b = $rb_gt(args.$length(), 1)) ? $b : (args.length === 1 && !kwargs.$$is_hash)))) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "wrong number of arguments (given " + (args.$length()) + ", expected 0)")};
- extra = $rb_minus(kwargs.$keys(), self.$class().$members());
- if ($truthy(extra['$any?']())) {
- self.$raise($$($nesting, 'ArgumentError'), "" + "unknown keywords: " + (extra.$join(", ")))};
- return $send(self.$class().$members(), 'each', [], ($$13 = function(name){var self = $$13.$$s || this, $writer = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
- $writer = [name, kwargs['$[]'](name)];
- $send(self, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$13.$$s = self, $$13.$$arity = 1, $$13));
- } else {
-
- if ($truthy($rb_gt(args.$length(), self.$class().$members().$length()))) {
- self.$raise($$($nesting, 'ArgumentError'), "struct size differs")};
- return $send(self.$class().$members(), 'each_with_index', [], ($$14 = function(name, index){var self = $$14.$$s || this, $writer = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
-
- if (index == null) {
- index = nil;
- };
- $writer = [name, args['$[]'](index)];
- $send(self, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$14.$$s = self, $$14.$$arity = 2, $$14));
- };
- }, $Struct_initialize$12.$$arity = -1);
-
- Opal.def(self, '$members', $Struct_members$15 = function $$members() {
- var self = this;
-
- return self.$class().$members()
- }, $Struct_members$15.$$arity = 0);
-
- Opal.def(self, '$hash', $Struct_hash$16 = function $$hash() {
- var self = this;
-
- return $$($nesting, 'Hash').$new(self.$$data).$hash()
- }, $Struct_hash$16.$$arity = 0);
-
- Opal.def(self, '$[]', $Struct_$$$17 = function(name) {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Integer')['$==='](name))) {
-
- if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) {
- self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")};
- if ($truthy($rb_ge(name, self.$class().$members().$size()))) {
- self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")};
- name = self.$class().$members()['$[]'](name);
- } else if ($truthy($$($nesting, 'String')['$==='](name))) {
-
- if(!self.$$data.hasOwnProperty(name)) {
- self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name))
- }
-
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer")
- };
- name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str");
- return self.$$data[name];;
- }, $Struct_$$$17.$$arity = 1);
-
- Opal.def(self, '$[]=', $Struct_$$$eq$18 = function(name, value) {
- var self = this;
-
-
- if ($truthy($$($nesting, 'Integer')['$==='](name))) {
-
- if ($truthy($rb_lt(name, self.$class().$members().$size()['$-@']()))) {
- self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too small for struct(size:" + (self.$class().$members().$size()) + ")")};
- if ($truthy($rb_ge(name, self.$class().$members().$size()))) {
- self.$raise($$($nesting, 'IndexError'), "" + "offset " + (name) + " too large for struct(size:" + (self.$class().$members().$size()) + ")")};
- name = self.$class().$members()['$[]'](name);
- } else if ($truthy($$($nesting, 'String')['$==='](name))) {
- if ($truthy(self.$class().$members()['$include?'](name.$to_sym()))) {
- } else {
- self.$raise($$($nesting, 'NameError').$new("" + "no member '" + (name) + "' in struct", name))
- }
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + (name.$class()) + " into Integer")
- };
- name = $$($nesting, 'Opal')['$coerce_to!'](name, $$($nesting, 'String'), "to_str");
- return self.$$data[name] = value;;
- }, $Struct_$$$eq$18.$$arity = 2);
-
- Opal.def(self, '$==', $Struct_$eq_eq$19 = function(other) {
- var self = this;
-
-
- if ($truthy(other['$instance_of?'](self.$class()))) {
- } else {
- return false
- };
-
- var recursed1 = {}, recursed2 = {};
-
- function _eqeq(struct, other) {
- var key, a, b;
-
- recursed1[(struct).$__id__()] = true;
- recursed2[(other).$__id__()] = true;
-
- for (key in struct.$$data) {
- a = struct.$$data[key];
- b = other.$$data[key];
-
- if ($$($nesting, 'Struct')['$==='](a)) {
- if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) {
- if (!_eqeq(a, b)) {
- return false;
- }
- }
- } else {
- if (!(a)['$=='](b)) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- return _eqeq(self, other);
- ;
- }, $Struct_$eq_eq$19.$$arity = 1);
-
- Opal.def(self, '$eql?', $Struct_eql$ques$20 = function(other) {
- var self = this;
-
-
- if ($truthy(other['$instance_of?'](self.$class()))) {
- } else {
- return false
- };
-
- var recursed1 = {}, recursed2 = {};
-
- function _eqeq(struct, other) {
- var key, a, b;
-
- recursed1[(struct).$__id__()] = true;
- recursed2[(other).$__id__()] = true;
-
- for (key in struct.$$data) {
- a = struct.$$data[key];
- b = other.$$data[key];
-
- if ($$($nesting, 'Struct')['$==='](a)) {
- if (!recursed1.hasOwnProperty((a).$__id__()) || !recursed2.hasOwnProperty((b).$__id__())) {
- if (!_eqeq(a, b)) {
- return false;
- }
- }
- } else {
- if (!(a)['$eql?'](b)) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- return _eqeq(self, other);
- ;
- }, $Struct_eql$ques$20.$$arity = 1);
-
- Opal.def(self, '$each', $Struct_each$21 = function $$each() {
- var $$22, $$23, $iter = $Struct_each$21.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $Struct_each$21.$$p = null;
-
- if (($yield !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each"], ($$22 = function(){var self = $$22.$$s || this;
-
- return self.$size()}, $$22.$$s = self, $$22.$$arity = 0, $$22))
- };
- $send(self.$class().$members(), 'each', [], ($$23 = function(name){var self = $$23.$$s || this;
-
-
-
- if (name == null) {
- name = nil;
- };
- return Opal.yield1($yield, self['$[]'](name));;}, $$23.$$s = self, $$23.$$arity = 1, $$23));
- return self;
- }, $Struct_each$21.$$arity = 0);
-
- Opal.def(self, '$each_pair', $Struct_each_pair$24 = function $$each_pair() {
- var $$25, $$26, $iter = $Struct_each_pair$24.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $Struct_each_pair$24.$$p = null;
-
- if (($yield !== nil)) {
- } else {
- return $send(self, 'enum_for', ["each_pair"], ($$25 = function(){var self = $$25.$$s || this;
-
- return self.$size()}, $$25.$$s = self, $$25.$$arity = 0, $$25))
- };
- $send(self.$class().$members(), 'each', [], ($$26 = function(name){var self = $$26.$$s || this;
-
-
-
- if (name == null) {
- name = nil;
- };
- return Opal.yield1($yield, [name, self['$[]'](name)]);;}, $$26.$$s = self, $$26.$$arity = 1, $$26));
- return self;
- }, $Struct_each_pair$24.$$arity = 0);
-
- Opal.def(self, '$length', $Struct_length$27 = function $$length() {
- var self = this;
-
- return self.$class().$members().$length()
- }, $Struct_length$27.$$arity = 0);
- Opal.alias(self, "size", "length");
-
- Opal.def(self, '$to_a', $Struct_to_a$28 = function $$to_a() {
- var $$29, self = this;
-
- return $send(self.$class().$members(), 'map', [], ($$29 = function(name){var self = $$29.$$s || this;
-
-
-
- if (name == null) {
- name = nil;
- };
- return self['$[]'](name);}, $$29.$$s = self, $$29.$$arity = 1, $$29))
- }, $Struct_to_a$28.$$arity = 0);
- Opal.alias(self, "values", "to_a");
-
- Opal.def(self, '$inspect', $Struct_inspect$30 = function $$inspect() {
- var $a, $$31, self = this, result = nil;
-
-
- result = "#");
- return result;
- }, $Struct_inspect$30.$$arity = 0);
- Opal.alias(self, "to_s", "inspect");
-
- Opal.def(self, '$to_h', $Struct_to_h$32 = function $$to_h() {
- var $$33, self = this;
-
- return $send(self.$class().$members(), 'each_with_object', [$hash2([], {})], ($$33 = function(name, h){var self = $$33.$$s || this, $writer = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
-
- if (h == null) {
- h = nil;
- };
- $writer = [name, self['$[]'](name)];
- $send(h, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$33.$$s = self, $$33.$$arity = 2, $$33))
- }, $Struct_to_h$32.$$arity = 0);
-
- Opal.def(self, '$values_at', $Struct_values_at$34 = function $$values_at($a) {
- var $post_args, args, $$35, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- args = $send(args, 'map', [], ($$35 = function(arg){var self = $$35.$$s || this;
-
-
-
- if (arg == null) {
- arg = nil;
- };
- return arg.$$is_range ? arg.$to_a() : arg;}, $$35.$$s = self, $$35.$$arity = 1, $$35)).$flatten();
-
- var result = [];
- for (var i = 0, len = args.length; i < len; i++) {
- if (!args[i].$$is_number) {
- self.$raise($$($nesting, 'TypeError'), "" + "no implicit conversion of " + ((args[i]).$class()) + " into Integer")
- }
- result.push(self['$[]'](args[i]));
- }
- return result;
- ;
- }, $Struct_values_at$34.$$arity = -1);
- return (Opal.def(self, '$dig', $Struct_dig$36 = function $$dig(key, $a) {
- var $post_args, keys, self = this, item = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- keys = $post_args;;
- item = (function() {if ($truthy(key.$$is_string && self.$$data.hasOwnProperty(key))) {
- return self.$$data[key] || nil;
- } else {
- return nil
- }; return nil; })();
-
- if (item === nil || keys.length === 0) {
- return item;
- }
- ;
- if ($truthy(item['$respond_to?']("dig"))) {
- } else {
- self.$raise($$($nesting, 'TypeError'), "" + (item.$class()) + " does not have #dig method")
- };
- return $send(item, 'dig', Opal.to_a(keys));
- }, $Struct_dig$36.$$arity = -2), nil) && 'dig';
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/io"] = function(Opal) {
- function $rb_minus(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, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy, $writer = nil;
-
- Opal.add_stubs(['$attr_accessor', '$size', '$write', '$join', '$map', '$String', '$empty?', '$concat', '$chomp', '$getbyte', '$getc', '$raise', '$new', '$write_proc=', '$-', '$extend']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'IO');
-
- var $nesting = [self].concat($parent_nesting), $IO_tty$ques$1, $IO_closed$ques$2, $IO_write$3, $IO_flush$4;
-
- self.$$prototype.tty = self.$$prototype.closed = nil;
-
- Opal.const_set($nesting[0], 'SEEK_SET', 0);
- Opal.const_set($nesting[0], 'SEEK_CUR', 1);
- Opal.const_set($nesting[0], 'SEEK_END', 2);
-
- Opal.def(self, '$tty?', $IO_tty$ques$1 = function() {
- var self = this;
-
- return self.tty
- }, $IO_tty$ques$1.$$arity = 0);
-
- Opal.def(self, '$closed?', $IO_closed$ques$2 = function() {
- var self = this;
-
- return self.closed
- }, $IO_closed$ques$2.$$arity = 0);
- self.$attr_accessor("write_proc");
-
- Opal.def(self, '$write', $IO_write$3 = function $$write(string) {
- var self = this;
-
-
- self.write_proc(string);
- return string.$size();
- }, $IO_write$3.$$arity = 1);
- self.$attr_accessor("sync", "tty");
-
- Opal.def(self, '$flush', $IO_flush$4 = function $$flush() {
- var self = this;
-
- return nil
- }, $IO_flush$4.$$arity = 0);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Writable');
-
- var $nesting = [self].concat($parent_nesting), $Writable_$lt$lt$5, $Writable_print$6, $Writable_puts$8;
-
-
-
- Opal.def(self, '$<<', $Writable_$lt$lt$5 = function(string) {
- var self = this;
-
-
- self.$write(string);
- return self;
- }, $Writable_$lt$lt$5.$$arity = 1);
-
- Opal.def(self, '$print', $Writable_print$6 = function $$print($a) {
- var $post_args, args, $$7, self = this;
- if ($gvars[","] == null) $gvars[","] = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- self.$write($send(args, 'map', [], ($$7 = function(arg){var self = $$7.$$s || this;
-
-
-
- if (arg == null) {
- arg = nil;
- };
- return self.$String(arg);}, $$7.$$s = self, $$7.$$arity = 1, $$7)).$join($gvars[","]));
- return nil;
- }, $Writable_print$6.$$arity = -1);
-
- Opal.def(self, '$puts', $Writable_puts$8 = function $$puts($a) {
- var $post_args, args, $$9, self = this, newline = nil;
- if ($gvars["/"] == null) $gvars["/"] = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- newline = $gvars["/"];
- if ($truthy(args['$empty?']())) {
- self.$write($gvars["/"])
- } else {
- self.$write($send(args, 'map', [], ($$9 = function(arg){var self = $$9.$$s || this;
-
-
-
- if (arg == null) {
- arg = nil;
- };
- return self.$String(arg).$chomp();}, $$9.$$s = self, $$9.$$arity = 1, $$9)).$concat([nil]).$join(newline))
- };
- return nil;
- }, $Writable_puts$8.$$arity = -1);
- })($nesting[0], $nesting);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Readable');
-
- var $nesting = [self].concat($parent_nesting), $Readable_readbyte$10, $Readable_readchar$11, $Readable_readline$12, $Readable_readpartial$13;
-
-
-
- Opal.def(self, '$readbyte', $Readable_readbyte$10 = function $$readbyte() {
- var self = this;
-
- return self.$getbyte()
- }, $Readable_readbyte$10.$$arity = 0);
-
- Opal.def(self, '$readchar', $Readable_readchar$11 = function $$readchar() {
- var self = this;
-
- return self.$getc()
- }, $Readable_readchar$11.$$arity = 0);
-
- Opal.def(self, '$readline', $Readable_readline$12 = function $$readline(sep) {
- var self = this;
- if ($gvars["/"] == null) $gvars["/"] = nil;
-
-
-
- if (sep == null) {
- sep = $gvars["/"];
- };
- return self.$raise($$($nesting, 'NotImplementedError'));
- }, $Readable_readline$12.$$arity = -1);
-
- Opal.def(self, '$readpartial', $Readable_readpartial$13 = function $$readpartial(integer, outbuf) {
- var self = this;
-
-
-
- if (outbuf == null) {
- outbuf = nil;
- };
- return self.$raise($$($nesting, 'NotImplementedError'));
- }, $Readable_readpartial$13.$$arity = -2);
- })($nesting[0], $nesting);
- })($nesting[0], null, $nesting);
- Opal.const_set($nesting[0], 'STDERR', ($gvars.stderr = $$($nesting, 'IO').$new()));
- Opal.const_set($nesting[0], 'STDIN', ($gvars.stdin = $$($nesting, 'IO').$new()));
- Opal.const_set($nesting[0], 'STDOUT', ($gvars.stdout = $$($nesting, 'IO').$new()));
- var console = Opal.global.console;
-
- $writer = [typeof(process) === 'object' && typeof(process.stdout) === 'object' ? function(s){process.stdout.write(s)} : function(s){console.log(s)}];
- $send($$($nesting, 'STDOUT'), 'write_proc=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = [typeof(process) === 'object' && typeof(process.stderr) === 'object' ? function(s){process.stderr.write(s)} : function(s){console.warn(s)}];
- $send($$($nesting, 'STDERR'), 'write_proc=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- $$($nesting, 'STDOUT').$extend($$$($$($nesting, 'IO'), 'Writable'));
- return $$($nesting, 'STDERR').$extend($$$($$($nesting, 'IO'), 'Writable'));
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/main"] = function(Opal) {
- var $to_s$1, $include$2, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$include']);
-
- Opal.defs(self, '$to_s', $to_s$1 = function $$to_s() {
- var self = this;
-
- return "main"
- }, $to_s$1.$$arity = 0);
- return (Opal.defs(self, '$include', $include$2 = function $$include(mod) {
- var self = this;
-
- return $$($nesting, 'Object').$include(mod)
- }, $include$2.$$arity = 1), nil) && 'include';
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/dir"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$[]']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Dir');
-
- var $nesting = [self].concat($parent_nesting);
-
- return (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $chdir$1, $pwd$2, $home$3;
-
-
-
- Opal.def(self, '$chdir', $chdir$1 = function $$chdir(dir) {
- var $iter = $chdir$1.$$p, $yield = $iter || nil, self = this, prev_cwd = nil;
-
- if ($iter) $chdir$1.$$p = null;
- return (function() { try {
-
- prev_cwd = Opal.current_dir;
- Opal.current_dir = dir;
- return Opal.yieldX($yield, []);;
- } finally {
- Opal.current_dir = prev_cwd
- }; })()
- }, $chdir$1.$$arity = 1);
-
- Opal.def(self, '$pwd', $pwd$2 = function $$pwd() {
- var self = this;
-
- return Opal.current_dir || '.';
- }, $pwd$2.$$arity = 0);
- Opal.alias(self, "getwd", "pwd");
- return (Opal.def(self, '$home', $home$3 = function $$home() {
- var $a, self = this;
-
- return ($truthy($a = $$($nesting, 'ENV')['$[]']("HOME")) ? $a : ".")
- }, $home$3.$$arity = 0), nil) && 'home';
- })(Opal.get_singleton_class(self), $nesting)
- })($nesting[0], null, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/file"] = function(Opal) {
- 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);
- }
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $range = Opal.range, $send = Opal.send;
-
- Opal.add_stubs(['$respond_to?', '$to_path', '$pwd', '$split', '$sub', '$+', '$unshift', '$join', '$home', '$raise', '$start_with?', '$absolute_path', '$coerce_to!', '$basename', '$empty?', '$rindex', '$[]', '$nil?', '$==', '$-', '$length', '$gsub', '$find', '$=~', '$map', '$each_with_index', '$flatten', '$reject', '$to_proc', '$end_with?']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'File');
-
- var $nesting = [self].concat($parent_nesting), windows_root_rx = nil;
-
-
- Opal.const_set($nesting[0], 'Separator', Opal.const_set($nesting[0], 'SEPARATOR', "/"));
- Opal.const_set($nesting[0], 'ALT_SEPARATOR', nil);
- Opal.const_set($nesting[0], 'PATH_SEPARATOR', ":");
- Opal.const_set($nesting[0], 'FNM_SYSCASE', 0);
- windows_root_rx = /^[a-zA-Z]:(?:\\|\/)/;
- return (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $absolute_path$1, $expand_path$2, $dirname$3, $basename$4, $extname$5, $exist$ques$6, $directory$ques$7, $join$9, $split$12;
-
-
-
- Opal.def(self, '$absolute_path', $absolute_path$1 = function $$absolute_path(path, basedir) {
- var $a, self = this, sep = nil, sep_chars = nil, new_parts = nil, path_abs = nil, basedir_abs = nil, parts = nil, leading_sep = nil, abs = nil, new_path = nil;
-
-
-
- if (basedir == null) {
- basedir = nil;
- };
- sep = $$($nesting, 'SEPARATOR');
- sep_chars = $sep_chars();
- new_parts = [];
- path = (function() {if ($truthy(path['$respond_to?']("to_path"))) {
- return path.$to_path()
- } else {
- return path
- }; return nil; })();
- basedir = ($truthy($a = basedir) ? $a : $$($nesting, 'Dir').$pwd());
- path_abs = path.substr(0, sep.length) === sep || windows_root_rx.test(path);
- basedir_abs = basedir.substr(0, sep.length) === sep || windows_root_rx.test(basedir);
- if ($truthy(path_abs)) {
-
- parts = path.$split(new RegExp("" + "[" + (sep_chars) + "]"));
- leading_sep = windows_root_rx.test(path) ? '' : path.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1");
- abs = true;
- } else {
-
- parts = $rb_plus(basedir.$split(new RegExp("" + "[" + (sep_chars) + "]")), path.$split(new RegExp("" + "[" + (sep_chars) + "]")));
- leading_sep = windows_root_rx.test(basedir) ? '' : basedir.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1");
- abs = basedir_abs;
- };
-
- var part;
- for (var i = 0, ii = parts.length; i < ii; i++) {
- part = parts[i];
-
- if (
- (part === nil) ||
- (part === '' && ((new_parts.length === 0) || abs)) ||
- (part === '.' && ((new_parts.length === 0) || abs))
- ) {
- continue;
- }
- if (part === '..') {
- new_parts.pop();
- } else {
- new_parts.push(part);
- }
- }
-
- if (!abs && parts[0] !== '.') {
- new_parts.$unshift(".")
- }
- ;
- new_path = new_parts.$join(sep);
- if ($truthy(abs)) {
- new_path = $rb_plus(leading_sep, new_path)};
- return new_path;
- }, $absolute_path$1.$$arity = -2);
-
- Opal.def(self, '$expand_path', $expand_path$2 = function $$expand_path(path, basedir) {
- var self = this, sep = nil, sep_chars = nil, home = nil, leading_sep = nil, home_path_regexp = nil;
-
-
-
- if (basedir == null) {
- basedir = nil;
- };
- sep = $$($nesting, 'SEPARATOR');
- sep_chars = $sep_chars();
- if ($truthy(path[0] === '~' || (basedir && basedir[0] === '~'))) {
-
- home = $$($nesting, 'Dir').$home();
- if ($truthy(home)) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "couldn't find HOME environment -- expanding `~'")
- };
- leading_sep = windows_root_rx.test(home) ? '' : home.$sub(new RegExp("" + "^([" + (sep_chars) + "]+).*$"), "\\1");
- if ($truthy(home['$start_with?'](leading_sep))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "non-absolute home")
- };
- home = $rb_plus(home, sep);
- home_path_regexp = new RegExp("" + "^\\~(?:" + (sep) + "|$)");
- path = path.$sub(home_path_regexp, home);
- if ($truthy(basedir)) {
- basedir = basedir.$sub(home_path_regexp, home)};};
- return self.$absolute_path(path, basedir);
- }, $expand_path$2.$$arity = -2);
- Opal.alias(self, "realpath", "expand_path");
-
- // Coerce a given path to a path string using #to_path and #to_str
- function $coerce_to_path(path) {
- if ($truthy((path)['$respond_to?']("to_path"))) {
- path = path.$to_path();
- }
-
- path = $$($nesting, 'Opal')['$coerce_to!'](path, $$($nesting, 'String'), "to_str");
-
- return path;
- }
-
- // Return a RegExp compatible char class
- function $sep_chars() {
- if ($$($nesting, 'ALT_SEPARATOR') === nil) {
- return Opal.escape_regexp($$($nesting, 'SEPARATOR'));
- } else {
- return Opal.escape_regexp($rb_plus($$($nesting, 'SEPARATOR'), $$($nesting, 'ALT_SEPARATOR')));
- }
- }
- ;
-
- Opal.def(self, '$dirname', $dirname$3 = function $$dirname(path) {
- var self = this, sep_chars = nil;
-
-
- sep_chars = $sep_chars();
- path = $coerce_to_path(path);
-
- var absolute = path.match(new RegExp("" + "^[" + (sep_chars) + "]"));
-
- path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove trailing separators
- path = path.replace(new RegExp("" + "[^" + (sep_chars) + "]+$"), ''); // remove trailing basename
- path = path.replace(new RegExp("" + "[" + (sep_chars) + "]+$"), ''); // remove final trailing separators
-
- if (path === '') {
- return absolute ? '/' : '.';
- }
-
- return path;
- ;
- }, $dirname$3.$$arity = 1);
-
- Opal.def(self, '$basename', $basename$4 = function $$basename(name, suffix) {
- var self = this, sep_chars = nil;
-
-
-
- if (suffix == null) {
- suffix = nil;
- };
- sep_chars = $sep_chars();
- name = $coerce_to_path(name);
-
- if (name.length == 0) {
- return name;
- }
-
- if (suffix !== nil) {
- suffix = $$($nesting, 'Opal')['$coerce_to!'](suffix, $$($nesting, 'String'), "to_str")
- } else {
- suffix = null;
- }
-
- name = name.replace(new RegExp("" + "(.)[" + (sep_chars) + "]*$"), '$1');
- name = name.replace(new RegExp("" + "^(?:.*[" + (sep_chars) + "])?([^" + (sep_chars) + "]+)$"), '$1');
-
- if (suffix === ".*") {
- name = name.replace(/\.[^\.]+$/, '');
- } else if(suffix !== null) {
- suffix = Opal.escape_regexp(suffix);
- name = name.replace(new RegExp("" + (suffix) + "$"), '');
- }
-
- return name;
- ;
- }, $basename$4.$$arity = -2);
-
- Opal.def(self, '$extname', $extname$5 = function $$extname(path) {
- var $a, self = this, filename = nil, last_dot_idx = nil;
-
-
- path = $coerce_to_path(path);
- filename = self.$basename(path);
- if ($truthy(filename['$empty?']())) {
- return ""};
- last_dot_idx = filename['$[]']($range(1, -1, false)).$rindex(".");
- if ($truthy(($truthy($a = last_dot_idx['$nil?']()) ? $a : $rb_plus(last_dot_idx, 1)['$==']($rb_minus(filename.$length(), 1))))) {
- return ""
- } else {
- return filename['$[]'](Opal.Range.$new($rb_plus(last_dot_idx, 1), -1, false))
- };
- }, $extname$5.$$arity = 1);
-
- Opal.def(self, '$exist?', $exist$ques$6 = function(path) {
- var self = this;
-
- return Opal.modules[path] != null
- }, $exist$ques$6.$$arity = 1);
- Opal.alias(self, "exists?", "exist?");
-
- Opal.def(self, '$directory?', $directory$ques$7 = function(path) {
- var $$8, self = this, files = nil, file = nil;
-
-
- files = [];
-
- for (var key in Opal.modules) {
- files.push(key)
- }
- ;
- path = path.$gsub(new RegExp("" + "(^." + ($$($nesting, 'SEPARATOR')) + "+|" + ($$($nesting, 'SEPARATOR')) + "+$)"));
- file = $send(files, 'find', [], ($$8 = function(f){var self = $$8.$$s || this;
-
-
-
- if (f == null) {
- f = nil;
- };
- return f['$=~'](new RegExp("" + "^" + (path)));}, $$8.$$s = self, $$8.$$arity = 1, $$8));
- return file;
- }, $directory$ques$7.$$arity = 1);
-
- Opal.def(self, '$join', $join$9 = function $$join($a) {
- var $post_args, paths, $$10, $$11, self = this, result = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- paths = $post_args;;
- if ($truthy(paths['$empty?']())) {
- return ""};
- result = "";
- paths = $send(paths.$flatten().$each_with_index(), 'map', [], ($$10 = function(item, index){var self = $$10.$$s || this, $b;
-
-
-
- if (item == null) {
- item = nil;
- };
-
- if (index == null) {
- index = nil;
- };
- if ($truthy((($b = index['$=='](0)) ? item['$empty?']() : index['$=='](0)))) {
- return $$($nesting, 'SEPARATOR')
- } else if ($truthy((($b = paths.$length()['$==']($rb_plus(index, 1))) ? item['$empty?']() : paths.$length()['$==']($rb_plus(index, 1))))) {
- return $$($nesting, 'SEPARATOR')
- } else {
- return item
- };}, $$10.$$s = self, $$10.$$arity = 2, $$10));
- paths = $send(paths, 'reject', [], "empty?".$to_proc());
- $send(paths, 'each_with_index', [], ($$11 = function(item, index){var self = $$11.$$s || this, $b, next_item = nil;
-
-
-
- if (item == null) {
- item = nil;
- };
-
- if (index == null) {
- index = nil;
- };
- next_item = paths['$[]']($rb_plus(index, 1));
- if ($truthy(next_item['$nil?']())) {
- return (result = "" + (result) + (item))
- } else {
-
- if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? next_item['$start_with?']($$($nesting, 'SEPARATOR')) : $b))) {
- item = item.$sub(new RegExp("" + ($$($nesting, 'SEPARATOR')) + "+$"), "")};
- return (result = (function() {if ($truthy(($truthy($b = item['$end_with?']($$($nesting, 'SEPARATOR'))) ? $b : next_item['$start_with?']($$($nesting, 'SEPARATOR'))))) {
- return "" + (result) + (item)
- } else {
- return "" + (result) + (item) + ($$($nesting, 'SEPARATOR'))
- }; return nil; })());
- };}, $$11.$$s = self, $$11.$$arity = 2, $$11));
- return result;
- }, $join$9.$$arity = -1);
- return (Opal.def(self, '$split', $split$12 = function $$split(path) {
- var self = this;
-
- return path.$split($$($nesting, 'SEPARATOR'))
- }, $split$12.$$arity = 1), nil) && 'split';
- })(Opal.get_singleton_class(self), $nesting);
- })($nesting[0], $$($nesting, 'IO'), $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/process"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$const_set', '$size', '$<<', '$__register_clock__', '$to_f', '$now', '$new', '$[]', '$raise']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Process');
-
- var $nesting = [self].concat($parent_nesting), $Process___register_clock__$1, $Process_pid$2, $Process_times$3, $Process_clock_gettime$4, monotonic = nil;
-
-
- self.__clocks__ = [];
- Opal.defs(self, '$__register_clock__', $Process___register_clock__$1 = function $$__register_clock__(name, func) {
- var self = this;
- if (self.__clocks__ == null) self.__clocks__ = nil;
-
-
- self.$const_set(name, self.__clocks__.$size());
- return self.__clocks__['$<<'](func);
- }, $Process___register_clock__$1.$$arity = 2);
- self.$__register_clock__("CLOCK_REALTIME", function() { return Date.now() });
- monotonic = false;
-
- if (Opal.global.performance) {
- monotonic = function() {
- return performance.now()
- };
- }
- else if (Opal.global.process && process.hrtime) {
- // let now be the base to get smaller numbers
- var hrtime_base = process.hrtime();
-
- monotonic = function() {
- var hrtime = process.hrtime(hrtime_base);
- var us = (hrtime[1] / 1000) | 0; // cut below microsecs;
- return ((hrtime[0] * 1000) + (us / 1000));
- };
- }
- ;
- if ($truthy(monotonic)) {
- self.$__register_clock__("CLOCK_MONOTONIC", monotonic)};
- Opal.defs(self, '$pid', $Process_pid$2 = function $$pid() {
- var self = this;
-
- return 0
- }, $Process_pid$2.$$arity = 0);
- Opal.defs(self, '$times', $Process_times$3 = function $$times() {
- var self = this, t = nil;
-
-
- t = $$($nesting, 'Time').$now().$to_f();
- return $$$($$($nesting, 'Benchmark'), 'Tms').$new(t, t, t, t, t);
- }, $Process_times$3.$$arity = 0);
- return (Opal.defs(self, '$clock_gettime', $Process_clock_gettime$4 = function $$clock_gettime(clock_id, unit) {
- var $a, self = this, clock = nil;
- if (self.__clocks__ == null) self.__clocks__ = nil;
-
-
-
- if (unit == null) {
- unit = "float_second";
- };
- ($truthy($a = (clock = self.__clocks__['$[]'](clock_id))) ? $a : self.$raise($$$($$($nesting, 'Errno'), 'EINVAL'), "" + "clock_gettime(" + (clock_id) + ") " + (self.__clocks__['$[]'](clock_id))));
-
- var ms = clock();
- switch (unit) {
- case 'float_second': return (ms / 1000); // number of seconds as a float (default)
- case 'float_millisecond': return (ms / 1); // number of milliseconds as a float
- case 'float_microsecond': return (ms * 1000); // number of microseconds as a float
- case 'second': return ((ms / 1000) | 0); // number of seconds as an integer
- case 'millisecond': return ((ms / 1) | 0); // number of milliseconds as an integer
- case 'microsecond': return ((ms * 1000) | 0); // number of microseconds as an integer
- case 'nanosecond': return ((ms * 1000000) | 0); // number of nanoseconds as an integer
- default: self.$raise($$($nesting, 'ArgumentError'), "" + "unexpected unit: " + (unit))
- }
- ;
- }, $Process_clock_gettime$4.$$arity = -2), nil) && 'clock_gettime';
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Signal');
-
- var $nesting = [self].concat($parent_nesting), $Signal_trap$5;
-
- return (Opal.defs(self, '$trap', $Signal_trap$5 = function $$trap($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $Signal_trap$5.$$arity = -1), nil) && 'trap'
- })($nesting[0], null, $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'GC');
-
- var $nesting = [self].concat($parent_nesting), $GC_start$6;
-
- return (Opal.defs(self, '$start', $GC_start$6 = function $$start() {
- var self = this;
-
- return nil
- }, $GC_start$6.$$arity = 0), nil) && 'start'
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["corelib/unsupported"] = function(Opal) {
- var $public$35, $private$36, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $module = Opal.module;
-
- Opal.add_stubs(['$raise', '$warn', '$%']);
-
-
- var warnings = {};
-
- function handle_unsupported_feature(message) {
- switch (Opal.config.unsupported_features_severity) {
- case 'error':
- $$($nesting, 'Kernel').$raise($$($nesting, 'NotImplementedError'), message)
- break;
- case 'warning':
- warn(message)
- break;
- default: // ignore
- // noop
- }
- }
-
- function warn(string) {
- if (warnings[string]) {
- return;
- }
-
- warnings[string] = true;
- self.$warn(string);
- }
-;
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'String');
-
- var $nesting = [self].concat($parent_nesting), $String_$lt$lt$1, $String_capitalize$excl$2, $String_chomp$excl$3, $String_chop$excl$4, $String_downcase$excl$5, $String_gsub$excl$6, $String_lstrip$excl$7, $String_next$excl$8, $String_reverse$excl$9, $String_slice$excl$10, $String_squeeze$excl$11, $String_strip$excl$12, $String_sub$excl$13, $String_succ$excl$14, $String_swapcase$excl$15, $String_tr$excl$16, $String_tr_s$excl$17, $String_upcase$excl$18, $String_prepend$19, $String_$$$eq$20, $String_clear$21, $String_encode$excl$22, $String_unicode_normalize$excl$23;
-
-
- var ERROR = "String#%s not supported. Mutable String methods are not supported in Opal.";
-
- Opal.def(self, '$<<', $String_$lt$lt$1 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("<<"));
- }, $String_$lt$lt$1.$$arity = -1);
-
- Opal.def(self, '$capitalize!', $String_capitalize$excl$2 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("capitalize!"));
- }, $String_capitalize$excl$2.$$arity = -1);
-
- Opal.def(self, '$chomp!', $String_chomp$excl$3 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chomp!"));
- }, $String_chomp$excl$3.$$arity = -1);
-
- Opal.def(self, '$chop!', $String_chop$excl$4 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("chop!"));
- }, $String_chop$excl$4.$$arity = -1);
-
- Opal.def(self, '$downcase!', $String_downcase$excl$5 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("downcase!"));
- }, $String_downcase$excl$5.$$arity = -1);
-
- Opal.def(self, '$gsub!', $String_gsub$excl$6 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("gsub!"));
- }, $String_gsub$excl$6.$$arity = -1);
-
- Opal.def(self, '$lstrip!', $String_lstrip$excl$7 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("lstrip!"));
- }, $String_lstrip$excl$7.$$arity = -1);
-
- Opal.def(self, '$next!', $String_next$excl$8 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("next!"));
- }, $String_next$excl$8.$$arity = -1);
-
- Opal.def(self, '$reverse!', $String_reverse$excl$9 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("reverse!"));
- }, $String_reverse$excl$9.$$arity = -1);
-
- Opal.def(self, '$slice!', $String_slice$excl$10 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("slice!"));
- }, $String_slice$excl$10.$$arity = -1);
-
- Opal.def(self, '$squeeze!', $String_squeeze$excl$11 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("squeeze!"));
- }, $String_squeeze$excl$11.$$arity = -1);
-
- Opal.def(self, '$strip!', $String_strip$excl$12 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("strip!"));
- }, $String_strip$excl$12.$$arity = -1);
-
- Opal.def(self, '$sub!', $String_sub$excl$13 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("sub!"));
- }, $String_sub$excl$13.$$arity = -1);
-
- Opal.def(self, '$succ!', $String_succ$excl$14 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("succ!"));
- }, $String_succ$excl$14.$$arity = -1);
-
- Opal.def(self, '$swapcase!', $String_swapcase$excl$15 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("swapcase!"));
- }, $String_swapcase$excl$15.$$arity = -1);
-
- Opal.def(self, '$tr!', $String_tr$excl$16 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr!"));
- }, $String_tr$excl$16.$$arity = -1);
-
- Opal.def(self, '$tr_s!', $String_tr_s$excl$17 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("tr_s!"));
- }, $String_tr_s$excl$17.$$arity = -1);
-
- Opal.def(self, '$upcase!', $String_upcase$excl$18 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("upcase!"));
- }, $String_upcase$excl$18.$$arity = -1);
-
- Opal.def(self, '$prepend', $String_prepend$19 = function $$prepend($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("prepend"));
- }, $String_prepend$19.$$arity = -1);
-
- Opal.def(self, '$[]=', $String_$$$eq$20 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("[]="));
- }, $String_$$$eq$20.$$arity = -1);
-
- Opal.def(self, '$clear', $String_clear$21 = function $$clear($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("clear"));
- }, $String_clear$21.$$arity = -1);
-
- Opal.def(self, '$encode!', $String_encode$excl$22 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("encode!"));
- }, $String_encode$excl$22.$$arity = -1);
- return (Opal.def(self, '$unicode_normalize!', $String_unicode_normalize$excl$23 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), (ERROR)['$%']("unicode_normalize!"));
- }, $String_unicode_normalize$excl$23.$$arity = -1), nil) && 'unicode_normalize!';
- })($nesting[0], null, $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Kernel');
-
- var $nesting = [self].concat($parent_nesting), $Kernel_freeze$24, $Kernel_frozen$ques$25;
-
-
- var ERROR = "Object freezing is not supported by Opal";
-
- Opal.def(self, '$freeze', $Kernel_freeze$24 = function $$freeze() {
- var self = this;
-
-
- handle_unsupported_feature(ERROR);
- return self;
- }, $Kernel_freeze$24.$$arity = 0);
-
- Opal.def(self, '$frozen?', $Kernel_frozen$ques$25 = function() {
- var self = this;
-
-
- handle_unsupported_feature(ERROR);
- return false;
- }, $Kernel_frozen$ques$25.$$arity = 0);
- })($nesting[0], $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Kernel');
-
- var $nesting = [self].concat($parent_nesting), $Kernel_taint$26, $Kernel_untaint$27, $Kernel_tainted$ques$28;
-
-
- var ERROR = "Object tainting is not supported by Opal";
-
- Opal.def(self, '$taint', $Kernel_taint$26 = function $$taint() {
- var self = this;
-
-
- handle_unsupported_feature(ERROR);
- return self;
- }, $Kernel_taint$26.$$arity = 0);
-
- Opal.def(self, '$untaint', $Kernel_untaint$27 = function $$untaint() {
- var self = this;
-
-
- handle_unsupported_feature(ERROR);
- return self;
- }, $Kernel_untaint$27.$$arity = 0);
-
- Opal.def(self, '$tainted?', $Kernel_tainted$ques$28 = function() {
- var self = this;
-
-
- handle_unsupported_feature(ERROR);
- return false;
- }, $Kernel_tainted$ques$28.$$arity = 0);
- })($nesting[0], $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Module');
-
- var $nesting = [self].concat($parent_nesting), $Module_public$29, $Module_private_class_method$30, $Module_private_method_defined$ques$31, $Module_private_constant$32;
-
-
-
- Opal.def(self, '$public', $Module_public$29 = function($a) {
- var $post_args, methods, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- methods = $post_args;;
-
- if (methods.length === 0) {
- self.$$module_function = false;
- }
-
- return nil;
- ;
- }, $Module_public$29.$$arity = -1);
- Opal.alias(self, "private", "public");
- Opal.alias(self, "protected", "public");
- Opal.alias(self, "nesting", "public");
-
- Opal.def(self, '$private_class_method', $Module_private_class_method$30 = function $$private_class_method($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self;
- }, $Module_private_class_method$30.$$arity = -1);
- Opal.alias(self, "public_class_method", "private_class_method");
-
- Opal.def(self, '$private_method_defined?', $Module_private_method_defined$ques$31 = function(obj) {
- var self = this;
-
- return false
- }, $Module_private_method_defined$ques$31.$$arity = 1);
-
- Opal.def(self, '$private_constant', $Module_private_constant$32 = function $$private_constant($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $Module_private_constant$32.$$arity = -1);
- Opal.alias(self, "protected_method_defined?", "private_method_defined?");
- Opal.alias(self, "public_instance_methods", "instance_methods");
- Opal.alias(self, "public_instance_method", "instance_method");
- return Opal.alias(self, "public_method_defined?", "method_defined?");
- })($nesting[0], null, $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Kernel');
-
- var $nesting = [self].concat($parent_nesting), $Kernel_private_methods$33;
-
-
-
- Opal.def(self, '$private_methods', $Kernel_private_methods$33 = function $$private_methods($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return [];
- }, $Kernel_private_methods$33.$$arity = -1);
- Opal.alias(self, "private_instance_methods", "private_methods");
- })($nesting[0], $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Kernel');
-
- var $nesting = [self].concat($parent_nesting), $Kernel_eval$34;
-
-
- Opal.def(self, '$eval', $Kernel_eval$34 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return self.$raise($$($nesting, 'NotImplementedError'), "" + "To use Kernel#eval, you must first require 'opal-parser'. " + ("" + "See https://github.com/opal/opal/blob/" + ($$($nesting, 'RUBY_ENGINE_VERSION')) + "/docs/opal_parser.md for details."));
- }, $Kernel_eval$34.$$arity = -1)
- })($nesting[0], $nesting);
- Opal.defs(self, '$public', $public$35 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $public$35.$$arity = -1);
- return (Opal.defs(self, '$private', $private$36 = function($a) {
- var $post_args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
- ;
- return nil;
- }, $private$36.$$arity = -1), nil) && 'private';
-};
-
-/* Generated by Opal 0.11.99.dev */
-(function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$require']);
-
- self.$require("opal/base");
- self.$require("opal/mini");
- self.$require("corelib/string/encoding");
- self.$require("corelib/struct");
- self.$require("corelib/io");
- self.$require("corelib/main");
- self.$require("corelib/dir");
- self.$require("corelib/file");
- self.$require("corelib/process");
- return self.$require("corelib/unsupported");
-})(Opal);
-
-
-// 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
- } else if (typeof define === 'function' && define.amd) {
- // AMD. Register a named module.
- define('asciidoctor', ['module'], function (module) {
- return factory(module.config())
- })
- } else {
- // Browser globals (root is window)
- root.Asciidoctor = factory
- }
-}(this, function (moduleConfig) {
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/browser/file"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass;
-
- Opal.add_stubs(['$new']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'File');
-
- var $nesting = [self].concat($parent_nesting), $File_read$1;
-
- return (Opal.defs(self, '$read', $File_read$1 = function $$read(path) {
- var self = this;
-
-
- var data = '';
- var status = -1;
- try {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', path, false);
- xhr.addEventListener('load', function() {
- status = this.status;
- // status is 0 for local file mode (i.e., file://)
- if (status === 0 || status === 200) {
- data = this.responseText;
- }
- });
- xhr.overrideMimeType('text/plain');
- xhr.send();
- }
- catch (e) {
- throw $$($nesting, 'IOError').$new('Error reading file or directory: ' + path + '; reason: ' + e.message);
- }
- // assume that no data in local file mode means it doesn't exist
- if (status === 404 || (status === 0 && !data)) {
- throw $$($nesting, 'IOError').$new('No such file or directory: ' + path);
- }
- return data;
-
- }, $File_read$1.$$arity = 1), nil) && 'read'
- })($nesting[0], null, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/browser"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$require']);
-
-
- var platform, engine, framework, ioModule;
-
- if (typeof moduleConfig === 'object' && typeof moduleConfig.runtime === 'object') {
- var runtime = moduleConfig.runtime;
- platform = runtime.platform;
- engine = runtime.engine;
- framework = runtime.framework;
- ioModule = runtime.ioModule;
- }
- ioModule = ioModule || 'xmlhttprequest';
- platform = platform || 'browser';
- engine = engine || '';
- framework = framework || '';
-;
- Opal.const_set($nesting[0], 'JAVASCRIPT_IO_MODULE', ioModule);
- Opal.const_set($nesting[0], 'JAVASCRIPT_PLATFORM', platform);
- Opal.const_set($nesting[0], 'JAVASCRIPT_ENGINE', engine);
- Opal.const_set($nesting[0], 'JAVASCRIPT_FRAMEWORK', framework);
- return self.$require("asciidoctor/js/opal_ext/browser/file");
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/asciidoctor_ext/browser/abstract_node"] = function(Opal) {
- 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;
-
- Opal.add_stubs(['$uriish?', '$[]', '$web_path', '$path_resolver', '$descends_from?', '$base_dir', '$start_with?', '$attr?', '$join', '$prepare_source_string', '$read', '$fetch', '$warn', '$logger', '$normalize_system_path', '$read_asset']);
- 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, 'AbstractNode');
-
- var $nesting = [self].concat($parent_nesting), $AbstractNode_read_contents$1, $AbstractNode_generate_data_uri_from_uri$2;
-
- self.$$prototype.document = nil;
-
-
- Opal.def(self, '$read_contents', $AbstractNode_read_contents$1 = function $$read_contents(target, opts) {
- var $a, $b, $c, self = this, doc = nil, start = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- doc = self.document;
- if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : ($truthy($b = ($truthy($c = (start = opts['$[]']("start"))) ? $$($nesting, 'Helpers')['$uriish?'](start) : $c)) ? (target = doc.$path_resolver().$web_path(target, start)) : $b)))) {
- if ($truthy(($truthy($a = ($truthy($b = doc.$path_resolver()['$descends_from?'](target, doc.$base_dir())) ? $b : target['$start_with?']("chrome://"))) ? $a : doc['$attr?']("allow-uri-read")))) {
-
- try {
- if ($truthy(opts['$[]']("normalize"))) {
- return $$($nesting, 'Helpers').$prepare_source_string($$$('::', 'File').$read(target)).$join($$($nesting, 'LF'))
- } else {
- return $$$('::', 'File').$read(target)
- }
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
-
- if ($truthy(opts.$fetch("warn_on_failure", true))) {
- self.$logger().$warn("" + "could not retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target))};
- return nil;
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- } else {
-
- if ($truthy(opts.$fetch("warn_on_failure", true))) {
- self.$logger().$warn("" + "cannot retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)")};
- return nil;
- }
- } else {
-
- target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy($a = opts['$[]']("label")) ? $a : "asset")}));
- return self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")}));
- };
- }, $AbstractNode_read_contents$1.$$arity = -2);
- return (Opal.def(self, '$generate_data_uri_from_uri', $AbstractNode_generate_data_uri_from_uri$2 = function $$generate_data_uri_from_uri(image_uri, cache_uri) {
- var self = this;
-
-
-
- if (cache_uri == null) {
- cache_uri = false;
- };
-
- var contentType = ''
- var b64encoded = ''
- var status = -1
-
- try {
- var xhr = new XMLHttpRequest()
- xhr.open('GET', image_uri, false)
- // the response type cannot be changed for synchronous requests made from a document
- // xhr.responseType = 'arraybuffer'
- xhr.overrideMimeType('text/plain; charset=x-user-defined')
- xhr.addEventListener('load', function() {
- status = this.status
- // status is 0 for local file mode (i.e., file://)
- if (status === 0 || status === 200) {
- var binary = ''
- var rawText = this.responseText
- for (var i = 0, len = rawText.length; i < len; ++i) {
- var c = rawText.charCodeAt(i)
- var byteCode = c & 0xff // byte at offset i
- binary += String.fromCharCode(byteCode)
- }
- b64encoded = btoa(binary)
- contentType = this.getResponseHeader('content-type')
- }
- })
- xhr.send(null)
- // try to detect the MIME Type from the file extension
- if (!contentType) {
- if (image_uri.endsWith('.jpeg') || image_uri.endsWith('.jpg') || image_uri.endsWith('.jpe')) {
- contentType = 'image/jpg'
- } else if (image_uri.endsWith('.png')) {
- contentType = 'image/png'
- } else if (image_uri.endsWith('.svg')) {
- contentType = 'image/svg+xml'
- } else if (image_uri.endsWith('.bmp')) {
- contentType = 'image/bmp'
- } else if (image_uri.endsWith('.tif') || image_uri.endsWith('.tiff')) {
- contentType = 'image/tiff'
- }
- }
- }
- catch (e) {
- // something bad happened!
- status = 0
- }
-
- // assume that no data in local file mode means it doesn't exist
- if (status === 404 || (status === 0 && (!b64encoded || !contentType))) {
- self.$logger().$warn('could not retrieve image data from URI: ' + image_uri)
- return image_uri
- }
- return 'data:' + contentType + ';base64,' + b64encoded
- ;
- }, $AbstractNode_generate_data_uri_from_uri$2.$$arity = -2), nil) && 'generate_data_uri_from_uri';
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/asciidoctor_ext/browser/open_uri"] = function(Opal) {
- 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, $send = Opal.send;
-
- Opal.add_stubs(['$new', '$path']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'OpenURI');
-
- var $nesting = [self].concat($parent_nesting), $OpenURI_open_uri$1;
-
- Opal.defs($$($nesting, 'OpenURI'), '$open_uri', $OpenURI_open_uri$1 = function $$open_uri(name, $a) {
- var $post_args, rest, $iter = $OpenURI_open_uri$1.$$p, $yield = $iter || nil, self = this, file = nil;
-
- if ($iter) $OpenURI_open_uri$1.$$p = null;
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- rest = $post_args;;
- file = $send($$($nesting, 'File'), 'new', [self.$path()].concat(Opal.to_a(rest)));
- if (($yield !== nil)) {
- return Opal.yield1($yield, file);
- } else {
- return file
- };
- }, $OpenURI_open_uri$1.$$arity = -2)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/asciidoctor_ext/browser/path_resolver"] = function(Opal) {
- 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, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$absolute_path?', '$start_with?']);
- 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, 'PathResolver');
-
- var $nesting = [self].concat($parent_nesting), $PathResolver_root$ques$1;
-
- return (Opal.def(self, '$root?', $PathResolver_root$ques$1 = function(path) {
- var $a, self = this;
-
- return ($truthy($a = self['$absolute_path?'](path)) ? $a : path['$start_with?']("file://", "http://", "https://", "chrome://"))
- }, $PathResolver_root$ques$1.$$arity = 1), nil) && 'root?'
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/asciidoctor_ext/browser/reader"] = function(Opal) {
- 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, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$posixify', '$new', '$base_dir', '$start_with?', '$uriish?', '$descends_from?', '$key?', '$attributes', '$replace_next_line', '$absolute_path?', '$==', '$empty?', '$!', '$slice', '$length']);
- 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, 'PreprocessorReader');
-
- var $nesting = [self].concat($parent_nesting), $PreprocessorReader_resolve_include_path$1;
-
- self.$$prototype.path_resolver = self.$$prototype.document = self.$$prototype.include_stack = self.$$prototype.dir = nil;
- return (Opal.def(self, '$resolve_include_path', $PreprocessorReader_resolve_include_path$1 = function $$resolve_include_path(target, attrlist, attributes) {
- var $a, self = this, p_target = nil, target_type = nil, base_dir = nil, inc_path = nil, relpath = nil, ctx_dir = nil, top_level = nil, offset = nil;
-
-
- p_target = (self.path_resolver = ($truthy($a = self.path_resolver) ? $a : $$($nesting, 'PathResolver').$new("\\"))).$posixify(target);
- $a = ["file", self.document.$base_dir()], (target_type = $a[0]), (base_dir = $a[1]), $a;
- if ($truthy(p_target['$start_with?']("file://"))) {
- inc_path = (relpath = p_target)
- } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](p_target))) {
-
- if ($truthy(($truthy($a = self.path_resolver['$descends_from?'](p_target, base_dir)) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) {
- } else {
- return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]")
- };
- inc_path = (relpath = p_target);
- } else if ($truthy(self.path_resolver['$absolute_path?'](p_target))) {
- inc_path = (relpath = "" + "file://" + ((function() {if ($truthy(p_target['$start_with?']("/"))) {
- return ""
- } else {
- return "/"
- }; return nil; })()) + (p_target))
- } else if ((ctx_dir = (function() {if ($truthy((top_level = self.include_stack['$empty?']()))) {
- return base_dir
- } else {
- return self.dir
- }; return nil; })())['$=='](".")) {
- inc_path = (relpath = p_target)
- } else if ($truthy(($truthy($a = ctx_dir['$start_with?']("file://")) ? $a : $$($nesting, 'Helpers')['$uriish?'](ctx_dir)['$!']()))) {
-
- inc_path = "" + (ctx_dir) + "/" + (p_target);
- if ($truthy(top_level)) {
- relpath = p_target
- } else if ($truthy(($truthy($a = base_dir['$=='](".")) ? $a : (offset = self.path_resolver['$descends_from?'](inc_path, base_dir))['$!']()))) {
- relpath = inc_path
- } else {
- relpath = inc_path.$slice(offset, inc_path.$length())
- };
- } else if ($truthy(top_level)) {
- inc_path = "" + (ctx_dir) + "/" + ((relpath = p_target))
- } else if ($truthy(($truthy($a = (offset = self.path_resolver['$descends_from?'](ctx_dir, base_dir))) ? $a : self.document.$attributes()['$key?']("allow-uri-read")))) {
-
- inc_path = "" + (ctx_dir) + "/" + (p_target);
- relpath = (function() {if ($truthy(offset)) {
-
- return inc_path.$slice(offset, inc_path.$length());
- } else {
- return p_target
- }; return nil; })();
- } else {
- return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]")
- };
- return [inc_path, "file", relpath];
- }, $PreprocessorReader_resolve_include_path$1.$$arity = 3), nil) && 'resolve_include_path'
- })($nesting[0], $$($nesting, 'Reader'), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/asciidoctor_ext/browser"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$==', '$require']);
- if ($$($nesting, 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest")) {
-
- self.$require("asciidoctor/js/asciidoctor_ext/browser/abstract_node");
- self.$require("asciidoctor/js/asciidoctor_ext/browser/open_uri");
- self.$require("asciidoctor/js/asciidoctor_ext/browser/path_resolver");
- return self.$require("asciidoctor/js/asciidoctor_ext/browser/reader");
- } else {
- return nil
- }
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["set"] = function(Opal) {
- function $rb_minus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
- }
- function $rb_lt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
- }
- function $rb_le(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, $klass = Opal.klass, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $module = Opal.module;
-
- Opal.add_stubs(['$include', '$new', '$nil?', '$===', '$raise', '$each', '$add', '$merge', '$class', '$respond_to?', '$subtract', '$dup', '$join', '$to_a', '$equal?', '$instance_of?', '$==', '$instance_variable_get', '$is_a?', '$size', '$all?', '$include?', '$[]=', '$-', '$enum_for', '$[]', '$<<', '$replace', '$delete', '$select', '$each_key', '$to_proc', '$empty?', '$eql?', '$instance_eval', '$clear', '$<', '$<=', '$keys']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Set');
-
- var $nesting = [self].concat($parent_nesting), $Set_$$$1, $Set_initialize$2, $Set_dup$4, $Set_$minus$5, $Set_inspect$6, $Set_$eq_eq$7, $Set_add$9, $Set_classify$10, $Set_collect$excl$13, $Set_delete$15, $Set_delete$ques$16, $Set_delete_if$17, $Set_add$ques$20, $Set_each$21, $Set_empty$ques$22, $Set_eql$ques$23, $Set_clear$25, $Set_include$ques$26, $Set_merge$27, $Set_replace$29, $Set_size$30, $Set_subtract$31, $Set_$$33, $Set_superset$ques$34, $Set_proper_superset$ques$36, $Set_subset$ques$38, $Set_proper_subset$ques$40, $Set_to_a$42;
-
- self.$$prototype.hash = nil;
-
- self.$include($$($nesting, 'Enumerable'));
- Opal.defs(self, '$[]', $Set_$$$1 = function($a) {
- var $post_args, ary, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- ary = $post_args;;
- return self.$new(ary);
- }, $Set_$$$1.$$arity = -1);
-
- Opal.def(self, '$initialize', $Set_initialize$2 = function $$initialize(enum$) {
- var $iter = $Set_initialize$2.$$p, block = $iter || nil, $$3, self = this;
-
- if ($iter) $Set_initialize$2.$$p = null;
-
-
- if ($iter) $Set_initialize$2.$$p = null;;
-
- if (enum$ == null) {
- enum$ = nil;
- };
- self.hash = $hash2([], {});
- if ($truthy(enum$['$nil?']())) {
- return nil};
- if ($truthy($$($nesting, 'Enumerable')['$==='](enum$))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable")
- };
- if ($truthy(block)) {
- return $send(enum$, 'each', [], ($$3 = function(item){var self = $$3.$$s || this;
-
-
-
- if (item == null) {
- item = nil;
- };
- return self.$add(Opal.yield1(block, item));}, $$3.$$s = self, $$3.$$arity = 1, $$3))
- } else {
- return self.$merge(enum$)
- };
- }, $Set_initialize$2.$$arity = -1);
-
- Opal.def(self, '$dup', $Set_dup$4 = function $$dup() {
- var self = this, result = nil;
-
-
- result = self.$class().$new();
- return result.$merge(self);
- }, $Set_dup$4.$$arity = 0);
-
- Opal.def(self, '$-', $Set_$minus$5 = function(enum$) {
- var self = this;
-
-
- if ($truthy(enum$['$respond_to?']("each"))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable")
- };
- return self.$dup().$subtract(enum$);
- }, $Set_$minus$5.$$arity = 1);
- Opal.alias(self, "difference", "-");
-
- Opal.def(self, '$inspect', $Set_inspect$6 = function $$inspect() {
- var self = this;
-
- return "" + "#"
- }, $Set_inspect$6.$$arity = 0);
-
- Opal.def(self, '$==', $Set_$eq_eq$7 = function(other) {
- var $a, $$8, self = this;
-
- if ($truthy(self['$equal?'](other))) {
- return true
- } else if ($truthy(other['$instance_of?'](self.$class()))) {
- return self.hash['$=='](other.$instance_variable_get("@hash"))
- } else if ($truthy(($truthy($a = other['$is_a?']($$($nesting, 'Set'))) ? self.$size()['$=='](other.$size()) : $a))) {
- return $send(other, 'all?', [], ($$8 = function(o){var self = $$8.$$s || this;
- if (self.hash == null) self.hash = nil;
-
-
-
- if (o == null) {
- o = nil;
- };
- return self.hash['$include?'](o);}, $$8.$$s = self, $$8.$$arity = 1, $$8))
- } else {
- return false
- }
- }, $Set_$eq_eq$7.$$arity = 1);
-
- Opal.def(self, '$add', $Set_add$9 = function $$add(o) {
- var self = this, $writer = nil;
-
-
-
- $writer = [o, true];
- $send(self.hash, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return self;
- }, $Set_add$9.$$arity = 1);
- Opal.alias(self, "<<", "add");
-
- Opal.def(self, '$classify', $Set_classify$10 = function $$classify() {
- var $iter = $Set_classify$10.$$p, block = $iter || nil, $$11, $$12, self = this, result = nil;
-
- if ($iter) $Set_classify$10.$$p = null;
-
-
- if ($iter) $Set_classify$10.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("classify")
- };
- result = $send($$($nesting, 'Hash'), 'new', [], ($$11 = function(h, k){var self = $$11.$$s || this, $writer = nil;
-
-
-
- if (h == null) {
- h = nil;
- };
-
- if (k == null) {
- k = nil;
- };
- $writer = [k, self.$class().$new()];
- $send(h, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$11.$$s = self, $$11.$$arity = 2, $$11));
- $send(self, 'each', [], ($$12 = function(item){var self = $$12.$$s || this;
-
-
-
- if (item == null) {
- item = nil;
- };
- return result['$[]'](Opal.yield1(block, item)).$add(item);}, $$12.$$s = self, $$12.$$arity = 1, $$12));
- return result;
- }, $Set_classify$10.$$arity = 0);
-
- Opal.def(self, '$collect!', $Set_collect$excl$13 = function() {
- var $iter = $Set_collect$excl$13.$$p, block = $iter || nil, $$14, self = this, result = nil;
-
- if ($iter) $Set_collect$excl$13.$$p = null;
-
-
- if ($iter) $Set_collect$excl$13.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("collect!")
- };
- result = self.$class().$new();
- $send(self, 'each', [], ($$14 = function(item){var self = $$14.$$s || this;
-
-
-
- if (item == null) {
- item = nil;
- };
- return result['$<<'](Opal.yield1(block, item));}, $$14.$$s = self, $$14.$$arity = 1, $$14));
- return self.$replace(result);
- }, $Set_collect$excl$13.$$arity = 0);
- Opal.alias(self, "map!", "collect!");
-
- Opal.def(self, '$delete', $Set_delete$15 = function(o) {
- var self = this;
-
-
- self.hash.$delete(o);
- return self;
- }, $Set_delete$15.$$arity = 1);
-
- Opal.def(self, '$delete?', $Set_delete$ques$16 = function(o) {
- var self = this;
-
- if ($truthy(self['$include?'](o))) {
-
- self.$delete(o);
- return self;
- } else {
- return nil
- }
- }, $Set_delete$ques$16.$$arity = 1);
-
- Opal.def(self, '$delete_if', $Set_delete_if$17 = function $$delete_if() {
- var $$18, $$19, $iter = $Set_delete_if$17.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $Set_delete_if$17.$$p = null;
-
- if (($yield !== nil)) {
- } else {
- return self.$enum_for("delete_if")
- };
- $send($send(self, 'select', [], ($$18 = function(o){var self = $$18.$$s || this;
-
-
-
- if (o == null) {
- o = nil;
- };
- return Opal.yield1($yield, o);;}, $$18.$$s = self, $$18.$$arity = 1, $$18)), 'each', [], ($$19 = function(o){var self = $$19.$$s || this;
- if (self.hash == null) self.hash = nil;
-
-
-
- if (o == null) {
- o = nil;
- };
- return self.hash.$delete(o);}, $$19.$$s = self, $$19.$$arity = 1, $$19));
- return self;
- }, $Set_delete_if$17.$$arity = 0);
-
- Opal.def(self, '$add?', $Set_add$ques$20 = function(o) {
- var self = this;
-
- if ($truthy(self['$include?'](o))) {
- return nil
- } else {
- return self.$add(o)
- }
- }, $Set_add$ques$20.$$arity = 1);
-
- Opal.def(self, '$each', $Set_each$21 = function $$each() {
- var $iter = $Set_each$21.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Set_each$21.$$p = null;
-
-
- if ($iter) $Set_each$21.$$p = null;;
- if ((block !== nil)) {
- } else {
- return self.$enum_for("each")
- };
- $send(self.hash, 'each_key', [], block.$to_proc());
- return self;
- }, $Set_each$21.$$arity = 0);
-
- Opal.def(self, '$empty?', $Set_empty$ques$22 = function() {
- var self = this;
-
- return self.hash['$empty?']()
- }, $Set_empty$ques$22.$$arity = 0);
-
- Opal.def(self, '$eql?', $Set_eql$ques$23 = function(other) {
- var $$24, self = this;
-
- return self.hash['$eql?']($send(other, 'instance_eval', [], ($$24 = function(){var self = $$24.$$s || this;
- if (self.hash == null) self.hash = nil;
-
- return self.hash}, $$24.$$s = self, $$24.$$arity = 0, $$24)))
- }, $Set_eql$ques$23.$$arity = 1);
-
- Opal.def(self, '$clear', $Set_clear$25 = function $$clear() {
- var self = this;
-
-
- self.hash.$clear();
- return self;
- }, $Set_clear$25.$$arity = 0);
-
- Opal.def(self, '$include?', $Set_include$ques$26 = function(o) {
- var self = this;
-
- return self.hash['$include?'](o)
- }, $Set_include$ques$26.$$arity = 1);
- Opal.alias(self, "member?", "include?");
-
- Opal.def(self, '$merge', $Set_merge$27 = function $$merge(enum$) {
- var $$28, self = this;
-
-
- $send(enum$, 'each', [], ($$28 = function(item){var self = $$28.$$s || this;
-
-
-
- if (item == null) {
- item = nil;
- };
- return self.$add(item);}, $$28.$$s = self, $$28.$$arity = 1, $$28));
- return self;
- }, $Set_merge$27.$$arity = 1);
-
- Opal.def(self, '$replace', $Set_replace$29 = function $$replace(enum$) {
- var self = this;
-
-
- self.$clear();
- self.$merge(enum$);
- return self;
- }, $Set_replace$29.$$arity = 1);
-
- Opal.def(self, '$size', $Set_size$30 = function $$size() {
- var self = this;
-
- return self.hash.$size()
- }, $Set_size$30.$$arity = 0);
- Opal.alias(self, "length", "size");
-
- Opal.def(self, '$subtract', $Set_subtract$31 = function $$subtract(enum$) {
- var $$32, self = this;
-
-
- $send(enum$, 'each', [], ($$32 = function(item){var self = $$32.$$s || this;
-
-
-
- if (item == null) {
- item = nil;
- };
- return self.$delete(item);}, $$32.$$s = self, $$32.$$arity = 1, $$32));
- return self;
- }, $Set_subtract$31.$$arity = 1);
-
- Opal.def(self, '$|', $Set_$$33 = function(enum$) {
- var self = this;
-
-
- if ($truthy(enum$['$respond_to?']("each"))) {
- } else {
- self.$raise($$($nesting, 'ArgumentError'), "value must be enumerable")
- };
- return self.$dup().$merge(enum$);
- }, $Set_$$33.$$arity = 1);
-
- Opal.def(self, '$superset?', $Set_superset$ques$34 = function(set) {
- var $a, $$35, self = this;
-
-
- ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set"));
- if ($truthy($rb_lt(self.$size(), set.$size()))) {
- return false};
- return $send(set, 'all?', [], ($$35 = function(o){var self = $$35.$$s || this;
-
-
-
- if (o == null) {
- o = nil;
- };
- return self['$include?'](o);}, $$35.$$s = self, $$35.$$arity = 1, $$35));
- }, $Set_superset$ques$34.$$arity = 1);
- Opal.alias(self, ">=", "superset?");
-
- Opal.def(self, '$proper_superset?', $Set_proper_superset$ques$36 = function(set) {
- var $a, $$37, self = this;
-
-
- ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set"));
- if ($truthy($rb_le(self.$size(), set.$size()))) {
- return false};
- return $send(set, 'all?', [], ($$37 = function(o){var self = $$37.$$s || this;
-
-
-
- if (o == null) {
- o = nil;
- };
- return self['$include?'](o);}, $$37.$$s = self, $$37.$$arity = 1, $$37));
- }, $Set_proper_superset$ques$36.$$arity = 1);
- Opal.alias(self, ">", "proper_superset?");
-
- Opal.def(self, '$subset?', $Set_subset$ques$38 = function(set) {
- var $a, $$39, self = this;
-
-
- ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set"));
- if ($truthy($rb_lt(set.$size(), self.$size()))) {
- return false};
- return $send(self, 'all?', [], ($$39 = function(o){var self = $$39.$$s || this;
-
-
-
- if (o == null) {
- o = nil;
- };
- return set['$include?'](o);}, $$39.$$s = self, $$39.$$arity = 1, $$39));
- }, $Set_subset$ques$38.$$arity = 1);
- Opal.alias(self, "<=", "subset?");
-
- Opal.def(self, '$proper_subset?', $Set_proper_subset$ques$40 = function(set) {
- var $a, $$41, self = this;
-
-
- ($truthy($a = set['$is_a?']($$($nesting, 'Set'))) ? $a : self.$raise($$($nesting, 'ArgumentError'), "value must be a set"));
- if ($truthy($rb_le(set.$size(), self.$size()))) {
- return false};
- return $send(self, 'all?', [], ($$41 = function(o){var self = $$41.$$s || this;
-
-
-
- if (o == null) {
- o = nil;
- };
- return set['$include?'](o);}, $$41.$$s = self, $$41.$$arity = 1, $$41));
- }, $Set_proper_subset$ques$40.$$arity = 1);
- Opal.alias(self, "<", "proper_subset?");
- Opal.alias(self, "+", "|");
- Opal.alias(self, "union", "|");
- return (Opal.def(self, '$to_a', $Set_to_a$42 = function $$to_a() {
- var self = this;
-
- return self.hash.$keys()
- }, $Set_to_a$42.$$arity = 0), nil) && 'to_a';
- })($nesting[0], null, $nesting);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Enumerable');
-
- var $nesting = [self].concat($parent_nesting), $Enumerable_to_set$43;
-
-
- Opal.def(self, '$to_set', $Enumerable_to_set$43 = function $$to_set($a, $b) {
- var $iter = $Enumerable_to_set$43.$$p, block = $iter || nil, $post_args, klass, args, self = this;
-
- if ($iter) $Enumerable_to_set$43.$$p = null;
-
-
- if ($iter) $Enumerable_to_set$43.$$p = null;;
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- if ($post_args.length > 0) {
- klass = $post_args[0];
- $post_args.splice(0, 1);
- }
- if (klass == null) {
- klass = $$($nesting, 'Set');
- };
-
- args = $post_args;;
- return $send(klass, 'new', [self].concat(Opal.to_a(args)), block.$to_proc());
- }, $Enumerable_to_set$43.$$arity = -1)
- })($nesting[0], $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/kernel"] = function(Opal) {
- 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, $send = Opal.send;
-
- Opal.add_stubs(['$new']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Kernel');
-
- var $nesting = [self].concat($parent_nesting), $Kernel_open$1, $Kernel___dir__$2;
-
-
-
- Opal.def(self, '$open', $Kernel_open$1 = function $$open(path, $a) {
- var $post_args, rest, $iter = $Kernel_open$1.$$p, $yield = $iter || nil, self = this, file = nil;
-
- if ($iter) $Kernel_open$1.$$p = null;
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- rest = $post_args;;
- file = $send($$($nesting, 'File'), 'new', [path].concat(Opal.to_a(rest)));
- if (($yield !== nil)) {
- return Opal.yield1($yield, file);
- } else {
- return file
- };
- }, $Kernel_open$1.$$arity = -2);
-
- Opal.def(self, '$__dir__', $Kernel___dir__$2 = function $$__dir__() {
- var self = this;
-
- return ""
- }, $Kernel___dir__$2.$$arity = 0);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/file"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$attr_reader', '$delete', '$gsub', '$read', '$size', '$to_enum', '$chomp', '$each_line', '$readlines', '$split']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'File');
-
- var $nesting = [self].concat($parent_nesting), $File_initialize$1, $File_read$2, $File_each_line$3, $File_readlines$4;
-
- self.$$prototype.eof = self.$$prototype.path = nil;
-
- self.$attr_reader("eof");
- self.$attr_reader("lineno");
- self.$attr_reader("path");
-
- Opal.def(self, '$initialize', $File_initialize$1 = function $$initialize(path, flags) {
- var self = this, encoding_flag_regexp = nil;
-
-
-
- if (flags == null) {
- flags = "r";
- };
- self.path = path;
- self.contents = nil;
- self.eof = false;
- self.lineno = 0;
- flags = flags.$delete("b");
- encoding_flag_regexp = /:(.*)/;
- flags = flags.$gsub(encoding_flag_regexp, "");
- return (self.flags = flags);
- }, $File_initialize$1.$$arity = -2);
-
- Opal.def(self, '$read', $File_read$2 = function $$read() {
- var self = this, res = nil;
-
- if ($truthy(self.eof)) {
- return ""
- } else {
-
- res = $$($nesting, 'File').$read(self.path);
- self.eof = true;
- self.lineno = res.$size();
- return res;
- }
- }, $File_read$2.$$arity = 0);
-
- Opal.def(self, '$each_line', $File_each_line$3 = function $$each_line(separator) {
- var $iter = $File_each_line$3.$$p, block = $iter || nil, self = this, lines = nil;
- if ($gvars["/"] == null) $gvars["/"] = nil;
-
- if ($iter) $File_each_line$3.$$p = null;
-
-
- if ($iter) $File_each_line$3.$$p = null;;
-
- if (separator == null) {
- separator = $gvars["/"];
- };
- if ($truthy(self.eof)) {
- return (function() {if ((block !== nil)) {
- return self
- } else {
- return [].$to_enum()
- }; return nil; })()};
- if ((block !== nil)) {
-
- lines = $$($nesting, 'File').$read(self.path);
-
- self.eof = false;
- self.lineno = 0;
- var chomped = lines.$chomp(),
- trailing = lines.length != chomped.length,
- splitted = chomped.split(separator);
- for (var i = 0, length = splitted.length; i < length; i++) {
- self.lineno += 1;
- if (i < length - 1 || trailing) {
- Opal.yield1(block, splitted[i] + separator);
- }
- else {
- Opal.yield1(block, splitted[i]);
- }
- }
- self.eof = true;
- ;
- return self;
- } else {
- return self.$read().$each_line()
- };
- }, $File_each_line$3.$$arity = -1);
-
- Opal.def(self, '$readlines', $File_readlines$4 = function $$readlines() {
- var self = this;
-
- return $$($nesting, 'File').$readlines(self.path)
- }, $File_readlines$4.$$arity = 0);
- return (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $readlines$5, $file$ques$6, $readable$ques$7, $read$8;
-
-
-
- Opal.def(self, '$readlines', $readlines$5 = function $$readlines(path, separator) {
- var self = this, content = nil;
- if ($gvars["/"] == null) $gvars["/"] = nil;
-
-
-
- if (separator == null) {
- separator = $gvars["/"];
- };
- content = $$($nesting, 'File').$read(path);
- return content.$split(separator);
- }, $readlines$5.$$arity = -2);
-
- Opal.def(self, '$file?', $file$ques$6 = function(path) {
- var self = this;
-
- return true
- }, $file$ques$6.$$arity = 1);
-
- Opal.def(self, '$readable?', $readable$ques$7 = function(path) {
- var self = this;
-
- return true
- }, $readable$ques$7.$$arity = 1);
- return (Opal.def(self, '$read', $read$8 = function $$read(path) {
- var self = this;
-
- return ""
- }, $read$8.$$arity = 1), nil) && 'read';
- })(Opal.get_singleton_class(self), $nesting);
- })($nesting[0], null, $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'IO');
-
- var $nesting = [self].concat($parent_nesting), $IO_read$9;
-
- return (Opal.defs(self, '$read', $IO_read$9 = function $$read(path) {
- var self = this;
-
- return $$($nesting, 'File').$read(path)
- }, $IO_read$9.$$arity = 1), nil) && 'read'
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/match_data"] = function(Opal) {
- function $rb_minus(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, $klass = Opal.klass, $send = Opal.send;
-
- Opal.add_stubs(['$[]=', '$-']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'MatchData');
-
- var $nesting = [self].concat($parent_nesting), $MatchData_$$$eq$1;
-
- self.$$prototype.matches = nil;
- return (Opal.def(self, '$[]=', $MatchData_$$$eq$1 = function(idx, val) {
- var self = this, $writer = nil;
-
-
- $writer = [idx, val];
- $send(self.matches, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- }, $MatchData_$$$eq$1.$$arity = 2), nil) && '[]='
- })($nesting[0], null, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/string"] = function(Opal) {
- function $rb_lt(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, $klass = Opal.klass, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$method_defined?', '$<', '$length', '$bytes', '$to_s', '$byteslice', '$==', '$_original_unpack']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'String');
-
- var $nesting = [self].concat($parent_nesting), $String_limit_bytesize$1, $String_unpack$2;
-
-
- if ($truthy(self['$method_defined?']("limit_bytesize"))) {
- } else {
-
- Opal.def(self, '$limit_bytesize', $String_limit_bytesize$1 = function $$limit_bytesize(size) {
- var self = this, result = nil;
-
-
- if ($truthy($rb_lt(size, self.$bytes().$length()))) {
- } else {
- return self.$to_s()
- };
- result = self.$byteslice(0, size);
- return result.$to_s();
- }, $String_limit_bytesize$1.$$arity = 1)
- };
- if ($truthy(self['$method_defined?']("limit"))) {
- } else {
- Opal.alias(self, "limit", "limit_bytesize")
- };
- Opal.alias(self, "_original_unpack", "unpack");
- return (Opal.def(self, '$unpack', $String_unpack$2 = function $$unpack(format) {
- var self = this;
-
- if (format['$==']("C3")) {
-
- var bytes = []
- for (var i=0; i < 3; i++) {
- if (i < self.length) {
- bytes.push(self.charCodeAt(i))
- } else {
- bytes.push(nil)
- }
- }
- return bytes
-
- } else {
- return self.$_original_unpack(format)
- }
- }, $String_unpack$2.$$arity = 1), nil) && 'unpack';
- })($nesting[0], null, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/uri"] = function(Opal) {
- 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;
-
- Opal.add_stubs(['$extend']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'URI');
-
- var $nesting = [self].concat($parent_nesting), $URI_parse$1, $URI_path$2;
-
-
- Opal.defs(self, '$parse', $URI_parse$1 = function $$parse(str) {
- var self = this;
-
- return str.$extend($$($nesting, 'URI'))
- }, $URI_parse$1.$$arity = 1);
-
- Opal.def(self, '$path', $URI_path$2 = function $$path() {
- var self = this;
-
- return self
- }, $URI_path$2.$$arity = 0);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/base64"] = function(Opal) {
- 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, $hash2 = Opal.hash2, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$delete']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Base64');
-
- var $nesting = [self].concat($parent_nesting), $Base64_decode64$1, $Base64_encode64$2, $Base64_strict_decode64$3, $Base64_strict_encode64$4, $Base64_urlsafe_decode64$5, $Base64_urlsafe_encode64$6;
-
-
-
- var encode, decode;
- encode = Opal.global.btoa || function (input) {
- var buffer;
- if (input instanceof Buffer) {
- buffer = input;
- } else {
- buffer = Buffer.from(input.toString(), 'binary');
- }
- return buffer.toString('base64');
- };
- decode = Opal.global.atob || function (input) {
- return Buffer.from(input, 'base64').toString('binary');
- };
- ;
- Opal.defs(self, '$decode64', $Base64_decode64$1 = function $$decode64(string) {
- var self = this;
-
- return decode(string.replace(/\r?\n/g, ''));
- }, $Base64_decode64$1.$$arity = 1);
- Opal.defs(self, '$encode64', $Base64_encode64$2 = function $$encode64(string) {
- var self = this;
-
- return encode(string).replace(/(.{60})/g, "$1\n").replace(/([^\n])$/g, "$1\n");
- }, $Base64_encode64$2.$$arity = 1);
- Opal.defs(self, '$strict_decode64', $Base64_strict_decode64$3 = function $$strict_decode64(string) {
- var self = this;
-
- return decode(string);
- }, $Base64_strict_decode64$3.$$arity = 1);
- Opal.defs(self, '$strict_encode64', $Base64_strict_encode64$4 = function $$strict_encode64(string) {
- var self = this;
-
- return encode(string);
- }, $Base64_strict_encode64$4.$$arity = 1);
- Opal.defs(self, '$urlsafe_decode64', $Base64_urlsafe_decode64$5 = function $$urlsafe_decode64(string) {
- var self = this;
-
- return decode(string.replace(/\-/g, '+').replace(/_/g, '/'));
- }, $Base64_urlsafe_decode64$5.$$arity = 1);
- Opal.defs(self, '$urlsafe_encode64', $Base64_urlsafe_encode64$6 = function $$urlsafe_encode64(string, $kwargs) {
- var padding, self = this, str = nil;
-
-
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- padding = $kwargs.$$smap["padding"];
- if (padding == null) {
- padding = true
- };
- str = encode(string).replace(/\+/g, '-').replace(/\//g, '_');
- if ($truthy(padding)) {
- } else {
- str = str.$delete("=")
- };
- return str;
- }, $Base64_urlsafe_encode64$6.$$arity = -2);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext/number"] = function(Opal) {
- function $rb_gt(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, $klass = Opal.klass, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$coerce_to!', '$>']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Number');
-
- var $nesting = [self].concat($parent_nesting), $Number_round$1;
-
- return (Opal.def(self, '$round', $Number_round$1 = function $$round(ndigits) {
- var self = this;
-
-
- ;
- ndigits = $$($nesting, 'Opal')['$coerce_to!'](ndigits, $$($nesting, 'Integer'), "to_int");
- if ($truthy($rb_gt(ndigits, 0))) {
- return Number(self.toFixed(ndigits));
- } else {
- return Math.round(self);
- };
- }, $Number_round$1.$$arity = -1), nil) && 'round'
- })($nesting[0], $$($nesting, 'Numeric'), $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/opal_ext"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$require']);
-
- self.$require("asciidoctor/js/opal_ext/kernel");
- self.$require("asciidoctor/js/opal_ext/file");
- self.$require("asciidoctor/js/opal_ext/match_data");
- self.$require("asciidoctor/js/opal_ext/string");
- self.$require("asciidoctor/js/opal_ext/uri");
- self.$require("asciidoctor/js/opal_ext/base64");
- self.$require("asciidoctor/js/opal_ext/number");
-
-// suppress "not supported" warning messages from Opal
-Opal.config.unsupported_features_severity = 'ignore'
-
-// Load specific runtime
-self.$require("asciidoctor/js/opal_ext/browser");
-;
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js/rx"] = function(Opal) {
- function $rb_plus(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, $send = Opal.send, $gvars = Opal.gvars, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$gsub', '$+', '$unpack_hex_range']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting), $Asciidoctor_unpack_hex_range$1;
-
-
- Opal.const_set($nesting[0], 'HEX_RANGE_RX', /([A-F0-9]{4})(?:-([A-F0-9]{4}))?/);
- Opal.defs(self, '$unpack_hex_range', $Asciidoctor_unpack_hex_range$1 = function $$unpack_hex_range(str) {
- var $$2, self = this;
-
- return $send(str, 'gsub', [$$($nesting, 'HEX_RANGE_RX')], ($$2 = function(){var self = $$2.$$s || this, $a, $b;
-
- return "" + "\\u" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))) + (($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? "" + "-\\u" + ((($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) : $a))}, $$2.$$s = self, $$2.$$arity = 0, $$2))
- }, $Asciidoctor_unpack_hex_range$1.$$arity = 1);
- Opal.const_set($nesting[0], 'P_L', $rb_plus("A-Za-z", self.$unpack_hex_range("00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D037F03860388-038A038C038E-03A103A3-03F503F7-0481048A-052F0531-055605590561-058705D0-05EA05F0-05F20620-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280840-085808A0-08B20904-0939093D09500958-09610971-09800985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10CF10CF20D05-0D0C0D0E-0D100D12-0D3A0D3D0D4E0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC-0EDF0F000F40-0F470F49-0F6C0F88-0F8C1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510C710CD10D0-10FA10FC-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA16F1-16F81700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191E1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1BBA-1BE51C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11CF51CF61D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209C21022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2CF22CF32D00-2D252D272D2D2D30-2D672D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31BA31F0-31FF3400-4DB54E00-9FCCA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A66EA67F-A69DA6A0-A6E5A717-A71FA722-A788A78B-A78EA790-A7ADA7B0A7B1A7F7-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFA9E0-A9E4A9E6-A9EFA9FA-A9FEAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA7E-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDAAE0-AAEAAAF2-AAF4AB01-AB06AB09-AB0EAB11-AB16AB20-AB26AB28-AB2EAB30-AB5AAB5C-AB5FAB64AB65ABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC")));
- Opal.const_set($nesting[0], 'P_Nl', self.$unpack_hex_range("16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF"));
- Opal.const_set($nesting[0], 'P_Nd', $rb_plus("0-9", self.$unpack_hex_range("0660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0DE6-0DEF0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19D91A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9A9F0-A9F9AA50-AA59ABF0-ABF9FF10-FF19")));
- Opal.const_set($nesting[0], 'P_Pc', self.$unpack_hex_range("005F203F20402054FE33FE34FE4D-FE4FFF3F"));
- Opal.const_set($nesting[0], 'CC_ALPHA', "" + ($$($nesting, 'P_L')) + ($$($nesting, 'P_Nl')));
- Opal.const_set($nesting[0], 'CG_ALPHA', "" + "[" + ($$($nesting, 'CC_ALPHA')) + "]");
- Opal.const_set($nesting[0], 'CC_ALNUM', "" + ($$($nesting, 'CC_ALPHA')) + ($$($nesting, 'P_Nd')));
- Opal.const_set($nesting[0], 'CG_ALNUM', "" + "[" + ($$($nesting, 'CC_ALNUM')) + "]");
- Opal.const_set($nesting[0], 'CC_WORD', "" + ($$($nesting, 'CC_ALNUM')) + ($$($nesting, 'P_Pc')));
- Opal.const_set($nesting[0], 'CG_WORD', "" + "[" + ($$($nesting, 'CC_WORD')) + "]");
- Opal.const_set($nesting[0], 'CG_BLANK', "[ \\t]");
- Opal.const_set($nesting[0], 'CC_EOL', "(?=\\n|$)");
- Opal.const_set($nesting[0], 'CG_GRAPH', "[^\\s\\x00-\\x1F\\x7F]");
- Opal.const_set($nesting[0], 'CC_ALL', "[\\s\\S]");
- Opal.const_set($nesting[0], 'CC_ANY', "[^\\n]");
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["strscan"] = function(Opal) {
- function $rb_minus(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, $klass = Opal.klass, $send = Opal.send;
-
- Opal.add_stubs(['$attr_reader', '$anchor', '$scan_until', '$length', '$size', '$rest', '$pos=', '$-', '$private']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'StringScanner');
-
- var $nesting = [self].concat($parent_nesting), $StringScanner_initialize$1, $StringScanner_beginning_of_line$ques$2, $StringScanner_scan$3, $StringScanner_scan_until$4, $StringScanner_$$$5, $StringScanner_check$6, $StringScanner_check_until$7, $StringScanner_peek$8, $StringScanner_eos$ques$9, $StringScanner_exist$ques$10, $StringScanner_skip$11, $StringScanner_skip_until$12, $StringScanner_get_byte$13, $StringScanner_match$ques$14, $StringScanner_pos$eq$15, $StringScanner_matched_size$16, $StringScanner_post_match$17, $StringScanner_pre_match$18, $StringScanner_reset$19, $StringScanner_rest$20, $StringScanner_rest$ques$21, $StringScanner_rest_size$22, $StringScanner_terminate$23, $StringScanner_unscan$24, $StringScanner_anchor$25;
-
- self.$$prototype.pos = self.$$prototype.string = self.$$prototype.working = self.$$prototype.matched = self.$$prototype.prev_pos = self.$$prototype.match = nil;
-
- self.$attr_reader("pos");
- self.$attr_reader("matched");
-
- Opal.def(self, '$initialize', $StringScanner_initialize$1 = function $$initialize(string) {
- var self = this;
-
-
- self.string = string;
- self.pos = 0;
- self.matched = nil;
- self.working = string;
- return (self.match = []);
- }, $StringScanner_initialize$1.$$arity = 1);
- self.$attr_reader("string");
-
- Opal.def(self, '$beginning_of_line?', $StringScanner_beginning_of_line$ques$2 = function() {
- var self = this;
-
- return self.pos === 0 || self.string.charAt(self.pos - 1) === "\n"
- }, $StringScanner_beginning_of_line$ques$2.$$arity = 0);
- Opal.alias(self, "bol?", "beginning_of_line?");
-
- Opal.def(self, '$scan', $StringScanner_scan$3 = function $$scan(pattern) {
- var self = this;
-
-
- pattern = self.$anchor(pattern);
-
- var result = pattern.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;
- }
- ;
- }, $StringScanner_scan$3.$$arity = 1);
-
- Opal.def(self, '$scan_until', $StringScanner_scan_until$4 = function $$scan_until(pattern) {
- var self = this;
-
-
- pattern = self.$anchor(pattern);
-
- var pos = self.pos,
- working = self.working,
- result;
-
- while (true) {
- result = pattern.exec(working);
- pos += 1;
- working = working.substr(1);
-
- if (result == null) {
- if (working.length === 0) {
- return self.matched = nil;
- }
-
- continue;
- }
-
- self.matched = self.string.substr(self.pos, pos - self.pos - 1 + result[0].length);
- self.prev_pos = pos - 1;
- self.pos = pos;
- self.working = working.substr(result[0].length);
-
- return self.matched;
- }
- ;
- }, $StringScanner_scan_until$4.$$arity = 1);
-
- Opal.def(self, '$[]', $StringScanner_$$$5 = function(idx) {
- var self = this;
-
-
- var match = self.match;
-
- if (idx < 0) {
- idx += match.length;
- }
-
- if (idx < 0 || idx >= match.length) {
- return nil;
- }
-
- if (match[idx] == null) {
- return nil;
- }
-
- return match[idx];
-
- }, $StringScanner_$$$5.$$arity = 1);
-
- Opal.def(self, '$check', $StringScanner_check$6 = function $$check(pattern) {
- var self = this;
-
-
- pattern = self.$anchor(pattern);
-
- var result = pattern.exec(self.working);
-
- if (result == null) {
- return self.matched = nil;
- }
-
- return self.matched = result[0];
- ;
- }, $StringScanner_check$6.$$arity = 1);
-
- Opal.def(self, '$check_until', $StringScanner_check_until$7 = function $$check_until(pattern) {
- var self = this;
-
-
- var prev_pos = self.prev_pos,
- pos = self.pos;
-
- var result = self.$scan_until(pattern);
-
- if (result !== nil) {
- self.matched = result.substr(-1);
- self.working = self.string.substr(pos);
- }
-
- self.prev_pos = prev_pos;
- self.pos = pos;
-
- return result;
-
- }, $StringScanner_check_until$7.$$arity = 1);
-
- Opal.def(self, '$peek', $StringScanner_peek$8 = function $$peek(length) {
- var self = this;
-
- return self.working.substring(0, length)
- }, $StringScanner_peek$8.$$arity = 1);
-
- Opal.def(self, '$eos?', $StringScanner_eos$ques$9 = function() {
- var self = this;
-
- return self.working.length === 0
- }, $StringScanner_eos$ques$9.$$arity = 0);
-
- Opal.def(self, '$exist?', $StringScanner_exist$ques$10 = function(pattern) {
- var self = this;
-
-
- var result = pattern.exec(self.working);
-
- if (result == null) {
- return nil;
- }
- else if (result.index == 0) {
- return 0;
- }
- else {
- return result.index + 1;
- }
-
- }, $StringScanner_exist$ques$10.$$arity = 1);
-
- Opal.def(self, '$skip', $StringScanner_skip$11 = function $$skip(pattern) {
- var self = this;
-
-
- pattern = self.$anchor(pattern);
-
- var result = pattern.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;
- }
- ;
- }, $StringScanner_skip$11.$$arity = 1);
-
- Opal.def(self, '$skip_until', $StringScanner_skip_until$12 = function $$skip_until(pattern) {
- var self = this;
-
-
- var result = self.$scan_until(pattern);
-
- if (result === nil) {
- return nil;
- }
- else {
- self.matched = result.substr(-1);
-
- return result.length;
- }
-
- }, $StringScanner_skip_until$12.$$arity = 1);
-
- Opal.def(self, '$get_byte', $StringScanner_get_byte$13 = function $$get_byte() {
- 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;
-
- }, $StringScanner_get_byte$13.$$arity = 0);
- Opal.alias(self, "getch", "get_byte");
-
- Opal.def(self, '$match?', $StringScanner_match$ques$14 = function(pattern) {
- var self = this;
-
-
- pattern = self.$anchor(pattern);
-
- var result = pattern.exec(self.working);
-
- if (result == null) {
- return nil;
- }
- else {
- self.prev_pos = self.pos;
-
- return result[0].length;
- }
- ;
- }, $StringScanner_match$ques$14.$$arity = 1);
-
- Opal.def(self, '$pos=', $StringScanner_pos$eq$15 = function(pos) {
- var self = this;
-
-
-
- if (pos < 0) {
- pos += self.string.$length();
- }
- ;
- self.pos = pos;
- return (self.working = self.string.slice(pos));
- }, $StringScanner_pos$eq$15.$$arity = 1);
-
- Opal.def(self, '$matched_size', $StringScanner_matched_size$16 = function $$matched_size() {
- var self = this;
-
-
- if (self.matched === nil) {
- return nil;
- }
-
- return self.matched.length
-
- }, $StringScanner_matched_size$16.$$arity = 0);
-
- Opal.def(self, '$post_match', $StringScanner_post_match$17 = function $$post_match() {
- var self = this;
-
-
- if (self.matched === nil) {
- return nil;
- }
-
- return self.string.substr(self.pos);
-
- }, $StringScanner_post_match$17.$$arity = 0);
-
- Opal.def(self, '$pre_match', $StringScanner_pre_match$18 = function $$pre_match() {
- var self = this;
-
-
- if (self.matched === nil) {
- return nil;
- }
-
- return self.string.substr(0, self.prev_pos);
-
- }, $StringScanner_pre_match$18.$$arity = 0);
-
- Opal.def(self, '$reset', $StringScanner_reset$19 = function $$reset() {
- var self = this;
-
-
- self.working = self.string;
- self.matched = nil;
- return (self.pos = 0);
- }, $StringScanner_reset$19.$$arity = 0);
-
- Opal.def(self, '$rest', $StringScanner_rest$20 = function $$rest() {
- var self = this;
-
- return self.working
- }, $StringScanner_rest$20.$$arity = 0);
-
- Opal.def(self, '$rest?', $StringScanner_rest$ques$21 = function() {
- var self = this;
-
- return self.working.length !== 0
- }, $StringScanner_rest$ques$21.$$arity = 0);
-
- Opal.def(self, '$rest_size', $StringScanner_rest_size$22 = function $$rest_size() {
- var self = this;
-
- return self.$rest().$size()
- }, $StringScanner_rest_size$22.$$arity = 0);
-
- Opal.def(self, '$terminate', $StringScanner_terminate$23 = function $$terminate() {
- var self = this, $writer = nil;
-
-
- self.match = nil;
-
- $writer = [self.string.$length()];
- $send(self, 'pos=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- }, $StringScanner_terminate$23.$$arity = 0);
-
- Opal.def(self, '$unscan', $StringScanner_unscan$24 = function $$unscan() {
- var self = this;
-
-
- self.pos = self.prev_pos;
- self.prev_pos = nil;
- self.match = nil;
- return self;
- }, $StringScanner_unscan$24.$$arity = 0);
- self.$private();
- return (Opal.def(self, '$anchor', $StringScanner_anchor$25 = function $$anchor(pattern) {
- var self = this;
-
-
- var flags = pattern.toString().match(/\/([^\/]+)$/);
- flags = flags ? flags[1] : undefined;
- return new RegExp('^(?:' + pattern.source + ')', flags);
-
- }, $StringScanner_anchor$25.$$arity = 1), nil) && 'anchor';
- })($nesting[0], null, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/js"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$require']);
-
- self.$require("asciidoctor/js/opal_ext");
- self.$require("asciidoctor/js/rx");
- return self.$require("strscan");
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/core_ext/nil_or_empty"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $klass = Opal.klass, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$method_defined?']);
-
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NilClass');
-
- var $nesting = [self].concat($parent_nesting);
-
- if ($truthy(self['$method_defined?']("nil_or_empty?"))) {
- return nil
- } else {
- return Opal.alias(self, "nil_or_empty?", "nil?")
- }
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'String');
-
- var $nesting = [self].concat($parent_nesting);
-
- if ($truthy(self['$method_defined?']("nil_or_empty?"))) {
- return nil
- } else {
- return Opal.alias(self, "nil_or_empty?", "empty?")
- }
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Array');
-
- var $nesting = [self].concat($parent_nesting);
-
- if ($truthy(self['$method_defined?']("nil_or_empty?"))) {
- return nil
- } else {
- return Opal.alias(self, "nil_or_empty?", "empty?")
- }
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Hash');
-
- var $nesting = [self].concat($parent_nesting);
-
- if ($truthy(self['$method_defined?']("nil_or_empty?"))) {
- return nil
- } else {
- return Opal.alias(self, "nil_or_empty?", "empty?")
- }
- })($nesting[0], null, $nesting);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Numeric');
-
- var $nesting = [self].concat($parent_nesting);
-
- if ($truthy(self['$method_defined?']("nil_or_empty?"))) {
- return nil
- } else {
- return Opal.alias(self, "nil_or_empty?", "nil?")
- }
- })($nesting[0], null, $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/core_ext/hash/merge"] = function(Opal) {
- function $rb_lt(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);
- }
- var $$1, self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$==', '$arity', '$instance_method', '$send', '$new', '$<', '$length', '$>', '$inject', '$merge', '$[]']);
- if ($$($nesting, 'Hash').$instance_method("merge").$arity()['$=='](1)) {
- return $$($nesting, 'Hash').$send("prepend", $send($$($nesting, 'Module'), 'new', [], ($$1 = function(){var self = $$1.$$s || this, $merge$2;
-
- return (Opal.def(self, '$merge', $merge$2 = function $$merge($a) {
- var $post_args, args, $$3, $iter = $merge$2.$$p, $yield = $iter || nil, self = this, len = nil;
-
- if ($iter) $merge$2.$$p = null;
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- if ($truthy($rb_lt((len = args.$length()), 1))) {
- return $send(self, Opal.find_super_dispatcher(self, 'merge', $merge$2, false), [$hash2([], {})], null)
- } else {
-
- if ($truthy($rb_gt(len, 1))) {
- return $send(args, 'inject', [self], ($$3 = function(acc, arg){var self = $$3.$$s || this;
-
-
-
- if (acc == null) {
- acc = nil;
- };
-
- if (arg == null) {
- arg = nil;
- };
- return acc.$merge(arg);}, $$3.$$s = self, $$3.$$arity = 2, $$3))
- } else {
-
- return $send(self, Opal.find_super_dispatcher(self, 'merge', $merge$2, false), [args['$[]'](0)], null);
- };
- };
- }, $merge$2.$$arity = -1), nil) && 'merge'}, $$1.$$s = self, $$1.$$arity = 0, $$1)))
- } else {
- return nil
- }
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/core_ext/match_data/names"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice, $truthy = Opal.truthy, $klass = Opal.klass;
-
- Opal.add_stubs(['$method_defined?']);
- if ($truthy($$($nesting, 'MatchData')['$method_defined?']("names"))) {
- return nil
- } else {
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'MatchData');
-
- var $nesting = [self].concat($parent_nesting), $MatchData_names$1;
-
- return (Opal.def(self, '$names', $MatchData_names$1 = function $$names() {
- var self = this;
-
- return []
- }, $MatchData_names$1.$$arity = 0), nil) && 'names'
- })($nesting[0], null, $nesting)
- }
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/core_ext"] = function(Opal) {
- var self = Opal.top, $nesting = [], nil = Opal.nil, $$$ = Opal.const_get_qualified, $$ = Opal.const_get_relative, $breaker = Opal.breaker, $slice = Opal.slice;
-
- Opal.add_stubs(['$==']);
-
- self.$require("asciidoctor/core_ext.rb"+ '/../' + "core_ext/nil_or_empty");
- self.$require("asciidoctor/core_ext.rb"+ '/../' + "core_ext/hash/merge");
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- return self.$require("asciidoctor/core_ext.rb"+ '/../' + "core_ext/match_data/names")
- } else {
- return nil
- };
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/helpers"] = function(Opal) {
- function $rb_minus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
- }
- function $rb_times(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);
- }
- 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, $truthy = Opal.truthy, $gvars = Opal.gvars, $send = Opal.send, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$module_function', '$require', '$include?', '$include', '$==', '$===', '$path', '$message', '$raise', '$warn', '$logger', '$chomp', '$empty?', '$slice', '$unpack', '$[]', '$byteslice', '$bytesize', '$[]=', '$-', '$map', '$rstrip', '$encode', '$encoding', '$nil_or_empty?', '$!=', '$tap', '$each_line', '$<<', '$match?', '$gsub', '$rindex', '$index', '$basename', '$extname', '$!', '$length', '$directory?', '$dirname', '$mkdir_p', '$mkdir', '$private_constant', '$join', '$divmod', '$*', '$+', '$to_s', '$to_i', '$succ', '$class_for_name', '$const_get']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting);
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'Helpers');
-
- var $nesting = [self].concat($parent_nesting), $Helpers_require_library$1, $Helpers_prepare_source_array$2, $Helpers_prepare_source_string$11, $Helpers_uriish$ques$16, $Helpers_encode_uri_component$17, $Helpers_encode_spaces_in_uri$18, $Helpers_rootname$19, $Helpers_basename$20, $Helpers_extname$ques$21, $Helpers_extname$22, $Helpers_extname$23, $Helpers_mkdir_p$24, $Helpers_int_to_roman$25, $Helpers_nextval$27, $Helpers_resolve_class$28, $Helpers_class_for_name$29;
-
-
- self.$module_function();
-
- Opal.def(self, '$require_library', $Helpers_require_library$1 = function $$require_library(name, gem_name, on_failure) {
- var self = this, $case = nil, details = nil;
- if ($gvars["!"] == null) $gvars["!"] = nil;
-
-
-
- if (gem_name == null) {
- gem_name = true;
- };
-
- if (on_failure == null) {
- on_failure = "abort";
- };
- try {
- return self.$require(name)
- } catch ($err) {
- if (Opal.rescue($err, [$$$('::', 'LoadError')])) {
- try {
-
- if ($truthy(self['$include?']($$($nesting, 'Logging')))) {
- } else {
- self.$include($$($nesting, 'Logging'))
- };
- if ($truthy(gem_name)) {
-
- if (gem_name['$=='](true)) {
- gem_name = name};
- $case = on_failure;
- if ("abort"['$===']($case)) {
- details = (function() {if ($gvars["!"].$path()['$=='](gem_name)) {
- return ""
- } else {
- return "" + " (reason: " + ((function() {if ($truthy($gvars["!"].$path())) {
- return "" + "cannot load '" + ($gvars["!"].$path()) + "'"
- } else {
- return $gvars["!"].$message()
- }; return nil; })()) + ")"
- }; return nil; })();
- self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: required gem '" + (gem_name) + "' is not available" + (details) + ". Processing aborted.");}
- else if ("warn"['$===']($case)) {
- details = (function() {if ($gvars["!"].$path()['$=='](gem_name)) {
- return ""
- } else {
- return "" + " (reason: " + ((function() {if ($truthy($gvars["!"].$path())) {
- return "" + "cannot load '" + ($gvars["!"].$path()) + "'"
- } else {
- return $gvars["!"].$message()
- }; return nil; })()) + ")"
- }; return nil; })();
- self.$logger().$warn("" + "optional gem '" + (gem_name) + "' is not available" + (details) + ". Functionality disabled.");};
- } else {
- $case = on_failure;
- if ("abort"['$===']($case)) {self.$raise($$$('::', 'LoadError'), "" + "asciidoctor: FAILED: " + ($gvars["!"].$message().$chomp(".")) + ". Processing aborted.")}
- else if ("warn"['$===']($case)) {self.$logger().$warn("" + ($gvars["!"].$message().$chomp(".")) + ". Functionality disabled.")}
- };
- return nil;
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- }, $Helpers_require_library$1.$$arity = -2);
-
- Opal.def(self, '$prepare_source_array', $Helpers_prepare_source_array$2 = function $$prepare_source_array(data, trim_end) {
- var $$3, $$4, $$5, $$6, $$7, $$8, $$9, $$10, self = this, leading_2_bytes = nil, leading_bytes = nil, first = nil, $writer = nil;
-
-
-
- if (trim_end == null) {
- trim_end = true;
- };
- if ($truthy(data['$empty?']())) {
- return []};
- if ((leading_2_bytes = (leading_bytes = (first = data['$[]'](0)).$unpack("C3")).$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) {
-
-
- $writer = [0, first.$byteslice(2, first.$bytesize())];
- $send(data, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return (function() {if ($truthy(trim_end)) {
- return $send(data, 'map', [], ($$3 = function(line){var self = $$3.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line.$encode($$($nesting, 'UTF_8'), $$$($$$('::', 'Encoding'), 'UTF_16LE')).$rstrip();}, $$3.$$s = self, $$3.$$arity = 1, $$3))
- } else {
- return $send(data, 'map', [], ($$4 = function(line){var self = $$4.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line.$encode($$($nesting, 'UTF_8'), $$$($$$('::', 'Encoding'), 'UTF_16LE')).$chomp();}, $$4.$$s = self, $$4.$$arity = 1, $$4))
- }; return nil; })();
- } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) {
-
-
- $writer = [0, first.$byteslice(2, first.$bytesize())];
- $send(data, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return (function() {if ($truthy(trim_end)) {
- return $send(data, 'map', [], ($$5 = function(line){var self = $$5.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line.$encode($$($nesting, 'UTF_8'), $$$($$$('::', 'Encoding'), 'UTF_16BE')).$rstrip();}, $$5.$$s = self, $$5.$$arity = 1, $$5))
- } else {
- return $send(data, 'map', [], ($$6 = function(line){var self = $$6.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line.$encode($$($nesting, 'UTF_8'), $$$($$$('::', 'Encoding'), 'UTF_16BE')).$chomp();}, $$6.$$s = self, $$6.$$arity = 1, $$6))
- }; return nil; })();
- } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) {
-
- $writer = [0, first.$byteslice(3, first.$bytesize())];
- $send(data, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if (first.$encoding()['$==']($$($nesting, 'UTF_8'))) {
- if ($truthy(trim_end)) {
- return $send(data, 'map', [], ($$7 = function(line){var self = $$7.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line.$rstrip();}, $$7.$$s = self, $$7.$$arity = 1, $$7))
- } else {
- return $send(data, 'map', [], ($$8 = function(line){var self = $$8.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line.$chomp();}, $$8.$$s = self, $$8.$$arity = 1, $$8))
- }
- } else if ($truthy(trim_end)) {
- return $send(data, 'map', [], ($$9 = function(line){var self = $$9.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line.$encode($$($nesting, 'UTF_8')).$rstrip();}, $$9.$$s = self, $$9.$$arity = 1, $$9))
- } else {
- return $send(data, 'map', [], ($$10 = function(line){var self = $$10.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line.$encode($$($nesting, 'UTF_8')).$chomp();}, $$10.$$s = self, $$10.$$arity = 1, $$10))
- };
- }, $Helpers_prepare_source_array$2.$$arity = -2);
-
- Opal.def(self, '$prepare_source_string', $Helpers_prepare_source_string$11 = function $$prepare_source_string(data, trim_end) {
- var $$12, $$14, self = this, leading_2_bytes = nil, leading_bytes = nil;
-
-
-
- if (trim_end == null) {
- trim_end = true;
- };
- if ($truthy(data['$nil_or_empty?']())) {
- return []};
- if ((leading_2_bytes = (leading_bytes = data.$unpack("C3")).$slice(0, 2))['$==']($$($nesting, 'BOM_BYTES_UTF_16LE'))) {
- data = data.$byteslice(2, data.$bytesize()).$encode($$($nesting, 'UTF_8'), $$$($$$('::', 'Encoding'), 'UTF_16LE'))
- } else if (leading_2_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_16BE'))) {
- data = data.$byteslice(2, data.$bytesize()).$encode($$($nesting, 'UTF_8'), $$$($$$('::', 'Encoding'), 'UTF_16BE'))
- } else if (leading_bytes['$==']($$($nesting, 'BOM_BYTES_UTF_8'))) {
-
- data = data.$byteslice(3, data.$bytesize());
- if (data.$encoding()['$==']($$($nesting, 'UTF_8'))) {
- } else {
- data = data.$encode($$($nesting, 'UTF_8'))
- };
- } else if ($truthy(data.$encoding()['$!=']($$($nesting, 'UTF_8')))) {
- data = data.$encode($$($nesting, 'UTF_8'))};
- if ($truthy(trim_end)) {
- return $send([], 'tap', [], ($$12 = function(lines){var self = $$12.$$s || this, $$13;
-
-
-
- if (lines == null) {
- lines = nil;
- };
- return $send(data, 'each_line', [], ($$13 = function(line){var self = $$13.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return lines['$<<'](line.$rstrip());}, $$13.$$s = self, $$13.$$arity = 1, $$13));}, $$12.$$s = self, $$12.$$arity = 1, $$12))
- } else {
- return $send([], 'tap', [], ($$14 = function(lines){var self = $$14.$$s || this, $$15;
-
-
-
- if (lines == null) {
- lines = nil;
- };
- return $send(data, 'each_line', [], ($$15 = function(line){var self = $$15.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return lines['$<<'](line.$chomp());}, $$15.$$s = self, $$15.$$arity = 1, $$15));}, $$14.$$s = self, $$14.$$arity = 1, $$14))
- };
- }, $Helpers_prepare_source_string$11.$$arity = -2);
-
- Opal.def(self, '$uriish?', $Helpers_uriish$ques$16 = function(str) {
- var $a, self = this;
-
- return ($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$match?'](str) : $a)
- }, $Helpers_uriish$ques$16.$$arity = 1);
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
-
- Opal.def(self, '$encode_uri_component', $Helpers_encode_uri_component$17 = function $$encode_uri_component(str) {
- var self = this;
-
-
- return encodeURIComponent(str).replace(/%20|[!'()*]/g, function (m) {
- return m === '%20' ? '+' : '%' + m.charCodeAt(0).toString(16)
- })
-
- }, $Helpers_encode_uri_component$17.$$arity = 1)
- } else {
- nil
- };
-
- Opal.def(self, '$encode_spaces_in_uri', $Helpers_encode_spaces_in_uri$18 = function $$encode_spaces_in_uri(str) {
- var self = this;
-
- if ($truthy(str['$include?'](" "))) {
-
- return str.$gsub(" ", "%20");
- } else {
- return str
- }
- }, $Helpers_encode_spaces_in_uri$18.$$arity = 1);
-
- Opal.def(self, '$rootname', $Helpers_rootname$19 = function $$rootname(filename) {
- var self = this, last_dot_idx = nil;
-
- if ($truthy((last_dot_idx = filename.$rindex(".")))) {
- if ($truthy(filename.$index("/", last_dot_idx))) {
- return filename
- } else {
-
- return filename.$slice(0, last_dot_idx);
- }
- } else {
- return filename
- }
- }, $Helpers_rootname$19.$$arity = 1);
-
- Opal.def(self, '$basename', $Helpers_basename$20 = function $$basename(filename, drop_ext) {
- var self = this;
-
-
-
- if (drop_ext == null) {
- drop_ext = nil;
- };
- if ($truthy(drop_ext)) {
- return $$$('::', 'File').$basename(filename, (function() {if (drop_ext['$=='](true)) {
-
- return self.$extname(filename);
- } else {
- return drop_ext
- }; return nil; })())
- } else {
- return $$$('::', 'File').$basename(filename)
- };
- }, $Helpers_basename$20.$$arity = -2);
-
- Opal.def(self, '$extname?', $Helpers_extname$ques$21 = function(path) {
- var $a, self = this, last_dot_idx = nil;
-
- return ($truthy($a = (last_dot_idx = path.$rindex("."))) ? path.$index("/", last_dot_idx)['$!']() : $a)
- }, $Helpers_extname$ques$21.$$arity = 1);
- if ($truthy($$$($$$('::', 'File'), 'ALT_SEPARATOR'))) {
-
- Opal.def(self, '$extname', $Helpers_extname$22 = function $$extname(path, fallback) {
- var $a, self = this, last_dot_idx = nil;
-
-
-
- if (fallback == null) {
- fallback = "";
- };
- if ($truthy((last_dot_idx = path.$rindex(".")))) {
- if ($truthy(($truthy($a = path.$index("/", last_dot_idx)) ? $a : path.$index($$$($$$('::', 'File'), 'ALT_SEPARATOR'), last_dot_idx)))) {
- return fallback
- } else {
-
- return path.$slice(last_dot_idx, path.$length());
- }
- } else {
- return fallback
- };
- }, $Helpers_extname$22.$$arity = -2)
- } else {
-
- Opal.def(self, '$extname', $Helpers_extname$23 = function $$extname(path, fallback) {
- var self = this, last_dot_idx = nil;
-
-
-
- if (fallback == null) {
- fallback = "";
- };
- if ($truthy((last_dot_idx = path.$rindex(".")))) {
- if ($truthy(path.$index("/", last_dot_idx))) {
- return fallback
- } else {
-
- return path.$slice(last_dot_idx, path.$length());
- }
- } else {
- return fallback
- };
- }, $Helpers_extname$23.$$arity = -2)
- };
-
- Opal.def(self, '$mkdir_p', $Helpers_mkdir_p$24 = function $$mkdir_p(dir) {
- var self = this, parent_dir = nil;
-
- if ($truthy($$$('::', 'File')['$directory?'](dir))) {
- return nil
- } else {
-
- if ((parent_dir = $$$('::', 'File').$dirname(dir))['$=='](".")) {
- } else {
- self.$mkdir_p(parent_dir)
- };
-
- try {
- return $$$('::', 'Dir').$mkdir(dir)
- } catch ($err) {
- if (Opal.rescue($err, [$$$('::', 'SystemCallError')])) {
- try {
- if ($truthy($$$('::', 'File')['$directory?'](dir))) {
- return nil
- } else {
- return self.$raise()
- }
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };;
- }
- }, $Helpers_mkdir_p$24.$$arity = 1);
- Opal.const_set($nesting[0], 'ROMAN_NUMERALS', $hash2(["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"], {"M": 1000, "CM": 900, "D": 500, "CD": 400, "C": 100, "XC": 90, "L": 50, "XL": 40, "X": 10, "IX": 9, "V": 5, "IV": 4, "I": 1}));
- self.$private_constant("ROMAN_NUMERALS");
-
- Opal.def(self, '$int_to_roman', $Helpers_int_to_roman$25 = function $$int_to_roman(val) {
- var $$26, self = this;
-
- return $send($$($nesting, 'ROMAN_NUMERALS'), 'map', [], ($$26 = function(l, i){var self = $$26.$$s || this, $a, $b, repeat = nil;
-
-
-
- if (l == null) {
- l = nil;
- };
-
- if (i == null) {
- i = nil;
- };
- $b = val.$divmod(i), $a = Opal.to_ary($b), (repeat = ($a[0] == null ? nil : $a[0])), (val = ($a[1] == null ? nil : $a[1])), $b;
- return $rb_times(l, repeat);}, $$26.$$s = self, $$26.$$arity = 2, $$26)).$join()
- }, $Helpers_int_to_roman$25.$$arity = 1);
-
- Opal.def(self, '$nextval', $Helpers_nextval$27 = function $$nextval(current) {
- var self = this, intval = nil;
-
- if ($truthy($$$('::', 'Integer')['$==='](current))) {
- return $rb_plus(current, 1)
- } else if ((intval = current.$to_i()).$to_s()['$=='](current.$to_s())) {
- return $rb_plus(intval, 1)
- } else {
- return current.$succ()
- }
- }, $Helpers_nextval$27.$$arity = 1);
-
- Opal.def(self, '$resolve_class', $Helpers_resolve_class$28 = function $$resolve_class(object) {
- var self = this;
-
- if ($truthy($$$('::', 'Class')['$==='](object))) {
- return object
- } else {
-
- if ($truthy($$$('::', 'String')['$==='](object))) {
-
- return self.$class_for_name(object);
- } else {
- return nil
- };
- }
- }, $Helpers_resolve_class$28.$$arity = 1);
-
- Opal.def(self, '$class_for_name', $Helpers_class_for_name$29 = function $$class_for_name(qualified_name) {
- var self = this, resolved = nil;
-
- try {
-
- if ($truthy($$$('::', 'Class')['$===']((resolved = $$$('::', 'Object').$const_get(qualified_name, false))))) {
- } else {
- self.$raise()
- };
- return resolved;
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- return self.$raise($$$('::', 'NameError'), "" + "Could not resolve class for name: " + (qualified_name))
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }
- }, $Helpers_class_for_name$29.$$arity = 1);
- })($nesting[0], $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["logger"] = function(Opal) {
- function $rb_plus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
- }
- function $rb_le(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs);
- }
- function $rb_lt(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, $klass = Opal.klass, $module = Opal.module, $send = Opal.send, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$include', '$to_h', '$map', '$constants', '$const_get', '$to_s', '$format', '$chr', '$strftime', '$message_as_string', '$===', '$+', '$message', '$class', '$join', '$backtrace', '$inspect', '$attr_reader', '$attr_accessor', '$new', '$key', '$upcase', '$raise', '$add', '$to_proc', '$<=', '$<', '$write', '$call', '$[]', '$now']);
- return (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Logger');
-
- var $nesting = [self].concat($parent_nesting), $Logger$1, $Logger_initialize$4, $Logger_level$eq$5, $Logger_info$6, $Logger_debug$7, $Logger_warn$8, $Logger_error$9, $Logger_fatal$10, $Logger_unknown$11, $Logger_info$ques$12, $Logger_debug$ques$13, $Logger_warn$ques$14, $Logger_error$ques$15, $Logger_fatal$ques$16, $Logger_add$17;
-
- self.$$prototype.level = self.$$prototype.progname = self.$$prototype.pipe = self.$$prototype.formatter = nil;
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'Severity');
-
- var $nesting = [self].concat($parent_nesting);
-
-
- Opal.const_set($nesting[0], 'DEBUG', 0);
- Opal.const_set($nesting[0], 'INFO', 1);
- Opal.const_set($nesting[0], 'WARN', 2);
- Opal.const_set($nesting[0], 'ERROR', 3);
- Opal.const_set($nesting[0], 'FATAL', 4);
- Opal.const_set($nesting[0], 'UNKNOWN', 5);
- })($nesting[0], $nesting);
- self.$include($$($nesting, 'Severity'));
- Opal.const_set($nesting[0], 'SEVERITY_LABELS', $send($$($nesting, 'Severity').$constants(), 'map', [], ($Logger$1 = function(s){var self = $Logger$1.$$s || this;
-
-
-
- if (s == null) {
- s = nil;
- };
- return [$$($nesting, 'Severity').$const_get(s), s.$to_s()];}, $Logger$1.$$s = self, $Logger$1.$$arity = 1, $Logger$1)).$to_h());
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Formatter');
-
- var $nesting = [self].concat($parent_nesting), $Formatter_call$2, $Formatter_message_as_string$3;
-
-
- Opal.const_set($nesting[0], 'MESSAGE_FORMAT', "%s, [%s] %5s -- %s: %s\n");
- Opal.const_set($nesting[0], 'DATE_TIME_FORMAT', "%Y-%m-%dT%H:%M:%S.%6N");
-
- Opal.def(self, '$call', $Formatter_call$2 = function $$call(severity, time, progname, msg) {
- var self = this;
-
- return self.$format($$($nesting, 'MESSAGE_FORMAT'), severity.$chr(), time.$strftime($$($nesting, 'DATE_TIME_FORMAT')), severity, progname, self.$message_as_string(msg))
- }, $Formatter_call$2.$$arity = 4);
- return (Opal.def(self, '$message_as_string', $Formatter_message_as_string$3 = function $$message_as_string(msg) {
- var $a, self = this, $case = nil;
-
- return (function() {$case = msg;
- if ($$$('::', 'String')['$===']($case)) {return msg}
- else if ($$$('::', 'Exception')['$===']($case)) {return $rb_plus("" + (msg.$message()) + " (" + (msg.$class()) + ")\n", ($truthy($a = msg.$backtrace()) ? $a : []).$join("\n"))}
- else {return msg.$inspect()}})()
- }, $Formatter_message_as_string$3.$$arity = 1), nil) && 'message_as_string';
- })($nesting[0], null, $nesting);
- self.$attr_reader("level");
- self.$attr_accessor("progname");
- self.$attr_accessor("formatter");
-
- Opal.def(self, '$initialize', $Logger_initialize$4 = function $$initialize(pipe) {
- var self = this;
-
-
- self.pipe = pipe;
- self.level = $$($nesting, 'DEBUG');
- return (self.formatter = $$($nesting, 'Formatter').$new());
- }, $Logger_initialize$4.$$arity = 1);
-
- Opal.def(self, '$level=', $Logger_level$eq$5 = function(severity) {
- var self = this, level = nil;
-
- if ($truthy($$$('::', 'Integer')['$==='](severity))) {
- return (self.level = severity)
- } else if ($truthy((level = $$($nesting, 'SEVERITY_LABELS').$key(severity.$to_s().$upcase())))) {
- return (self.level = level)
- } else {
- return self.$raise($$($nesting, 'ArgumentError'), "" + "invalid log level: " + (severity))
- }
- }, $Logger_level$eq$5.$$arity = 1);
-
- Opal.def(self, '$info', $Logger_info$6 = function $$info(progname) {
- var $iter = $Logger_info$6.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Logger_info$6.$$p = null;
-
-
- if ($iter) $Logger_info$6.$$p = null;;
-
- if (progname == null) {
- progname = nil;
- };
- return $send(self, 'add', [$$($nesting, 'INFO'), nil, progname], block.$to_proc());
- }, $Logger_info$6.$$arity = -1);
-
- Opal.def(self, '$debug', $Logger_debug$7 = function $$debug(progname) {
- var $iter = $Logger_debug$7.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Logger_debug$7.$$p = null;
-
-
- if ($iter) $Logger_debug$7.$$p = null;;
-
- if (progname == null) {
- progname = nil;
- };
- return $send(self, 'add', [$$($nesting, 'DEBUG'), nil, progname], block.$to_proc());
- }, $Logger_debug$7.$$arity = -1);
-
- Opal.def(self, '$warn', $Logger_warn$8 = function $$warn(progname) {
- var $iter = $Logger_warn$8.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Logger_warn$8.$$p = null;
-
-
- if ($iter) $Logger_warn$8.$$p = null;;
-
- if (progname == null) {
- progname = nil;
- };
- return $send(self, 'add', [$$($nesting, 'WARN'), nil, progname], block.$to_proc());
- }, $Logger_warn$8.$$arity = -1);
-
- Opal.def(self, '$error', $Logger_error$9 = function $$error(progname) {
- var $iter = $Logger_error$9.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Logger_error$9.$$p = null;
-
-
- if ($iter) $Logger_error$9.$$p = null;;
-
- if (progname == null) {
- progname = nil;
- };
- return $send(self, 'add', [$$($nesting, 'ERROR'), nil, progname], block.$to_proc());
- }, $Logger_error$9.$$arity = -1);
-
- Opal.def(self, '$fatal', $Logger_fatal$10 = function $$fatal(progname) {
- var $iter = $Logger_fatal$10.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Logger_fatal$10.$$p = null;
-
-
- if ($iter) $Logger_fatal$10.$$p = null;;
-
- if (progname == null) {
- progname = nil;
- };
- return $send(self, 'add', [$$($nesting, 'FATAL'), nil, progname], block.$to_proc());
- }, $Logger_fatal$10.$$arity = -1);
-
- Opal.def(self, '$unknown', $Logger_unknown$11 = function $$unknown(progname) {
- var $iter = $Logger_unknown$11.$$p, block = $iter || nil, self = this;
-
- if ($iter) $Logger_unknown$11.$$p = null;
-
-
- if ($iter) $Logger_unknown$11.$$p = null;;
-
- if (progname == null) {
- progname = nil;
- };
- return $send(self, 'add', [$$($nesting, 'UNKNOWN'), nil, progname], block.$to_proc());
- }, $Logger_unknown$11.$$arity = -1);
-
- Opal.def(self, '$info?', $Logger_info$ques$12 = function() {
- var self = this;
-
- return $rb_le(self.level, $$($nesting, 'INFO'))
- }, $Logger_info$ques$12.$$arity = 0);
-
- Opal.def(self, '$debug?', $Logger_debug$ques$13 = function() {
- var self = this;
-
- return $rb_le(self.level, $$($nesting, 'DEBUG'))
- }, $Logger_debug$ques$13.$$arity = 0);
-
- Opal.def(self, '$warn?', $Logger_warn$ques$14 = function() {
- var self = this;
-
- return $rb_le(self.level, $$($nesting, 'WARN'))
- }, $Logger_warn$ques$14.$$arity = 0);
-
- Opal.def(self, '$error?', $Logger_error$ques$15 = function() {
- var self = this;
-
- return $rb_le(self.level, $$($nesting, 'ERROR'))
- }, $Logger_error$ques$15.$$arity = 0);
-
- Opal.def(self, '$fatal?', $Logger_fatal$ques$16 = function() {
- var self = this;
-
- return $rb_le(self.level, $$($nesting, 'FATAL'))
- }, $Logger_fatal$ques$16.$$arity = 0);
- return (Opal.def(self, '$add', $Logger_add$17 = function $$add(severity, message, progname) {
- var $iter = $Logger_add$17.$$p, block = $iter || nil, $a, self = this;
-
- if ($iter) $Logger_add$17.$$p = null;
-
-
- if ($iter) $Logger_add$17.$$p = null;;
-
- if (message == null) {
- message = nil;
- };
-
- if (progname == null) {
- progname = nil;
- };
- if ($truthy($rb_lt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), self.level))) {
- return true};
- progname = ($truthy($a = progname) ? $a : self.progname);
- if ($truthy(message)) {
- } else if ((block !== nil)) {
- message = Opal.yieldX(block, [])
- } else {
-
- message = progname;
- progname = self.progname;
- };
- self.pipe.$write(self.formatter.$call(($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : "ANY"), $$$('::', 'Time').$now(), progname, message));
- return true;
- }, $Logger_add$17.$$arity = -2), nil) && 'add';
- })($nesting[0], null, $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/logging"] = function(Opal) {
- function $rb_minus(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);
- }
- 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, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$require', '$attr_reader', '$progname=', '$-', '$new', '$formatter=', '$level=', '$>', '$[]', '$===', '$inspect', '$tap', '$each', '$constants', '$const_get', '$[]=', '$<<', '$clear', '$empty?', '$max', '$map', '$attr_accessor', '$memoize_logger', '$private', '$private_class_method', '$extend', '$logger', '$merge']);
-
- self.$require("logger");
- 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, 'Logger');
-
- var $nesting = [self].concat($parent_nesting), $Logger_initialize$1, $Logger_add$2;
-
- self.$$prototype.max_severity = nil;
-
- self.$attr_reader("max_severity");
-
- Opal.def(self, '$initialize', $Logger_initialize$1 = function $$initialize($a) {
- var $post_args, args, $iter = $Logger_initialize$1.$$p, $yield = $iter || nil, self = this, $writer = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Logger_initialize$1.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $Logger_initialize$1, false), $zuper, $iter);
-
- $writer = ["asciidoctor"];
- $send(self, 'progname=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = [$$($nesting, 'BasicFormatter').$new()];
- $send(self, 'formatter=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = [$$($nesting, 'WARN')];
- $send(self, 'level=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- }, $Logger_initialize$1.$$arity = -1);
-
- Opal.def(self, '$add', $Logger_add$2 = function $$add(severity, message, progname) {
- var $a, $iter = $Logger_add$2.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Logger_add$2.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if (message == null) {
- message = nil;
- };
-
- if (progname == null) {
- progname = nil;
- };
- if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) {
- self.max_severity = severity};
- return $send(self, Opal.find_super_dispatcher(self, 'add', $Logger_add$2, false), $zuper, $iter);
- }, $Logger_add$2.$$arity = -2);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'BasicFormatter');
-
- var $nesting = [self].concat($parent_nesting), $BasicFormatter_call$3;
-
-
- Opal.const_set($nesting[0], 'SEVERITY_LABELS', $hash2(["WARN", "FATAL"], {"WARN": "WARNING", "FATAL": "FAILED"}));
- return (Opal.def(self, '$call', $BasicFormatter_call$3 = function $$call(severity, _, progname, msg) {
- var $a, self = this;
-
- return "" + (progname) + ": " + (($truthy($a = $$($nesting, 'SEVERITY_LABELS')['$[]'](severity)) ? $a : severity)) + ": " + ((function() {if ($truthy($$$('::', 'String')['$==='](msg))) {
- return msg
- } else {
- return msg.$inspect()
- }; return nil; })()) + ($$($nesting, 'LF'))
- }, $BasicFormatter_call$3.$$arity = 4), nil) && 'call';
- })($nesting[0], $$($nesting, 'Formatter'), $nesting);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'AutoFormattingMessage');
-
- var $nesting = [self].concat($parent_nesting), $AutoFormattingMessage_inspect$4;
-
-
- Opal.def(self, '$inspect', $AutoFormattingMessage_inspect$4 = function $$inspect() {
- var self = this, sloc = nil;
-
- if ($truthy((sloc = self['$[]']("source_location")))) {
- return "" + (sloc) + ": " + (self['$[]']("text"))
- } else {
- return self['$[]']("text")
- }
- }, $AutoFormattingMessage_inspect$4.$$arity = 0)
- })($nesting[0], $nesting);
- })($nesting[0], $$$('::', 'Logger'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'MemoryLogger');
-
- var $nesting = [self].concat($parent_nesting), $MemoryLogger$5, $MemoryLogger_initialize$7, $MemoryLogger_add$8, $MemoryLogger_clear$9, $MemoryLogger_empty$ques$10, $MemoryLogger_max_severity$11;
-
- self.$$prototype.messages = nil;
-
- Opal.const_set($nesting[0], 'SEVERITY_LABELS', $send($hash2([], {}), 'tap', [], ($MemoryLogger$5 = function(accum){var self = $MemoryLogger$5.$$s || this, $$6;
-
-
-
- if (accum == null) {
- accum = nil;
- };
- return $send($$($nesting, 'Severity').$constants(false), 'each', [], ($$6 = function(c){var self = $$6.$$s || this, $writer = nil;
-
-
-
- if (c == null) {
- c = nil;
- };
- $writer = [$$($nesting, 'Severity').$const_get(c, false), c];
- $send(accum, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$6.$$s = self, $$6.$$arity = 1, $$6));}, $MemoryLogger$5.$$s = self, $MemoryLogger$5.$$arity = 1, $MemoryLogger$5)));
- self.$attr_reader("messages");
-
- Opal.def(self, '$initialize', $MemoryLogger_initialize$7 = function $$initialize() {
- var self = this, $writer = nil;
-
-
-
- $writer = [$$($nesting, 'WARN')];
- $send(self, 'level=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return (self.messages = []);
- }, $MemoryLogger_initialize$7.$$arity = 0);
-
- Opal.def(self, '$add', $MemoryLogger_add$8 = function $$add(severity, message, progname) {
- var $a, $iter = $MemoryLogger_add$8.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $MemoryLogger_add$8.$$p = null;
-
-
- if (message == null) {
- message = nil;
- };
-
- if (progname == null) {
- progname = nil;
- };
- if ($truthy(message)) {
- } else {
- message = (function() {if (($yield !== nil)) {
- return Opal.yieldX($yield, []);
- } else {
- return progname
- }; return nil; })()
- };
- self.messages['$<<']($hash2(["severity", "message"], {"severity": $$($nesting, 'SEVERITY_LABELS')['$[]'](($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), "message": message}));
- return true;
- }, $MemoryLogger_add$8.$$arity = -2);
-
- Opal.def(self, '$clear', $MemoryLogger_clear$9 = function $$clear() {
- var self = this;
-
- return self.messages.$clear()
- }, $MemoryLogger_clear$9.$$arity = 0);
-
- Opal.def(self, '$empty?', $MemoryLogger_empty$ques$10 = function() {
- var self = this;
-
- return self.messages['$empty?']()
- }, $MemoryLogger_empty$ques$10.$$arity = 0);
- return (Opal.def(self, '$max_severity', $MemoryLogger_max_severity$11 = function $$max_severity() {
- var $$12, self = this;
-
- if ($truthy(self['$empty?']())) {
- return nil
- } else {
- return $send(self.messages, 'map', [], ($$12 = function(m){var self = $$12.$$s || this;
-
-
-
- if (m == null) {
- m = nil;
- };
- return $$($nesting, 'Severity').$const_get(m['$[]']("severity"), false);}, $$12.$$s = self, $$12.$$arity = 1, $$12)).$max()
- }
- }, $MemoryLogger_max_severity$11.$$arity = 0), nil) && 'max_severity';
- })($nesting[0], $$$('::', 'Logger'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'NullLogger');
-
- var $nesting = [self].concat($parent_nesting), $NullLogger_initialize$13, $NullLogger_add$14;
-
- self.$$prototype.max_severity = nil;
-
- self.$attr_reader("max_severity");
-
- Opal.def(self, '$initialize', $NullLogger_initialize$13 = function $$initialize() {
- var self = this, $writer = nil;
-
-
- $writer = [$$($nesting, 'WARN')];
- $send(self, 'level=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- }, $NullLogger_initialize$13.$$arity = 0);
- return (Opal.def(self, '$add', $NullLogger_add$14 = function $$add(severity, message, progname) {
- var $a, self = this;
-
-
-
- if (message == null) {
- message = nil;
- };
-
- if (progname == null) {
- progname = nil;
- };
- if ($truthy($rb_gt((severity = ($truthy($a = severity) ? $a : $$($nesting, 'UNKNOWN'))), (self.max_severity = ($truthy($a = self.max_severity) ? $a : severity))))) {
- self.max_severity = severity};
- return true;
- }, $NullLogger_add$14.$$arity = -2), nil) && 'add';
- })($nesting[0], $$$('::', 'Logger'), $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'LoggerManager');
-
- var $nesting = [self].concat($parent_nesting);
-
-
- self.logger_class = $$($nesting, 'Logger');
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $logger$15, $logger$eq$16, $memoize_logger$17;
-
-
- self.$attr_accessor("logger_class");
-
- Opal.def(self, '$logger', $logger$15 = function $$logger(pipe) {
- var $a, self = this;
- if (self.logger == null) self.logger = nil;
- if (self.logger_class == null) self.logger_class = nil;
- if ($gvars.stderr == null) $gvars.stderr = nil;
-
-
-
- if (pipe == null) {
- pipe = $gvars.stderr;
- };
- self.$memoize_logger();
- return (self.logger = ($truthy($a = self.logger) ? $a : self.logger_class.$new(pipe)));
- }, $logger$15.$$arity = -1);
-
- Opal.def(self, '$logger=', $logger$eq$16 = function(new_logger) {
- var $a, self = this;
- if (self.logger_class == null) self.logger_class = nil;
- if ($gvars.stderr == null) $gvars.stderr = nil;
-
- return (self.logger = ($truthy($a = new_logger) ? $a : self.logger_class.$new($gvars.stderr)))
- }, $logger$eq$16.$$arity = 1);
- self.$private();
- return (Opal.def(self, '$memoize_logger', $memoize_logger$17 = function $$memoize_logger() {
- var self = this;
-
- return (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting);
-
-
- Opal.alias(self, "logger", "logger");
- return self.$attr_reader("logger");
- })(Opal.get_singleton_class(self), $nesting)
- }, $memoize_logger$17.$$arity = 0), nil) && 'memoize_logger';
- })(Opal.get_singleton_class(self), $nesting);
- })($nesting[0], $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Logging');
-
- var $nesting = [self].concat($parent_nesting), $a, $Logging_included$18, $Logging_logger$19, $Logging_message_with_context$20;
-
-
- self.$private_class_method(($truthy($a = (Opal.defs(self, '$included', $Logging_included$18 = function $$included(into) {
- var self = this;
-
- return into.$extend($$($nesting, 'Logging'))
- }, $Logging_included$18.$$arity = 1), nil) && 'included') ? $a : "included"));
-
- Opal.def(self, '$logger', $Logging_logger$19 = function $$logger() {
- var self = this;
-
- return $$($nesting, 'LoggerManager').$logger()
- }, $Logging_logger$19.$$arity = 0);
-
- Opal.def(self, '$message_with_context', $Logging_message_with_context$20 = function $$message_with_context(text, context) {
- var self = this;
-
-
-
- if (context == null) {
- context = $hash2([], {});
- };
- return $hash2(["text"], {"text": text}).$merge(context).$extend($$$($$($nesting, 'Logger'), 'AutoFormattingMessage'));
- }, $Logging_message_with_context$20.$$arity = -2);
- })($nesting[0], $nesting);
- })($nesting[0], $nesting);
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/rx"] = function(Opal) {
- function $rb_minus(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, $hash2 = Opal.hash2, $send = Opal.send, $truthy = Opal.truthy, $hash = Opal.hash;
-
- Opal.add_stubs(['$==', '$join', '$to_a', '$new', '$empty?', '$escape', '$[]=', '$-']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting), $Asciidoctor$1, $Asciidoctor$2;
-
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'Rx');
-
- var $nesting = [self].concat($parent_nesting);
-
- nil
- })($nesting[0], $nesting);
- Opal.const_set($nesting[0], 'AuthorInfoLineRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*)(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-'.]*))?(?: +<([^>]+)>)?$"));
- Opal.const_set($nesting[0], 'AuthorDelimiterRx', /;(?: |$)/);
- Opal.const_set($nesting[0], 'RevisionInfoLineRx', new RegExp("" + "^(?:[^\\d{]*(" + ($$($nesting, 'CC_ANY')) + "*?),)? *(?!:)(" + ($$($nesting, 'CC_ANY')) + "*?)(?: *(?!^),?: *(" + ($$($nesting, 'CC_ANY')) + "*))?$"));
- Opal.const_set($nesting[0], 'ManpageTitleVolnumRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *\\( *(" + ($$($nesting, 'CC_ANY')) + "+?) *\\)$"));
- Opal.const_set($nesting[0], 'ManpageNamePurposeRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) +- +(" + ($$($nesting, 'CC_ANY')) + "+)$"));
- Opal.const_set($nesting[0], 'ConditionalDirectiveRx', new RegExp("" + "^(\\\\)?(ifdef|ifndef|ifeval|endif)::(\\S*?(?:([,+])\\S*?)?)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$"));
- Opal.const_set($nesting[0], 'EvalExpressionRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "+?) *([=!><]=|[><]) *(" + ($$($nesting, 'CC_ANY')) + "+)$"));
- Opal.const_set($nesting[0], 'IncludeDirectiveRx', new RegExp("" + "^(\\\\)?include::([^\\[][^\\[]*)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$"));
- Opal.const_set($nesting[0], 'TagDirectiveRx', /\b(?:tag|(e)nd)::(\S+?)\[\](?=$|[ \r])/m);
- Opal.const_set($nesting[0], 'AttributeEntryRx', new RegExp("" + "^:(!?" + ($$($nesting, 'CG_WORD')) + "[^:]*):(?:[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*))?$"));
- Opal.const_set($nesting[0], 'InvalidAttributeNameCharsRx', new RegExp("" + "[^" + ($$($nesting, 'CC_WORD')) + "-]"));
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- Opal.const_set($nesting[0], 'AttributeEntryPassMacroRx', new RegExp("" + "^pass:([a-z]+(?:,[a-z-]+)*)?\\[(" + ($$($nesting, 'CC_ALL')) + "*)\\]$"))
- } else {
- nil
- };
- Opal.const_set($nesting[0], 'AttributeReferenceRx', new RegExp("" + "(\\\\)?\\{(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "-]*|(set|counter2?):" + ($$($nesting, 'CC_ANY')) + "+?)(\\\\)?\\}"));
- Opal.const_set($nesting[0], 'BlockAnchorRx', new RegExp("" + "^\\[\\[(?:|([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?)\\]\\]$"));
- Opal.const_set($nesting[0], 'BlockAttributeListRx', new RegExp("" + "^\\[(|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*)\\]$"));
- Opal.const_set($nesting[0], 'BlockAttributeLineRx', new RegExp("" + "^\\[(?:|[" + ($$($nesting, 'CC_WORD')) + ".#%{,\"']" + ($$($nesting, 'CC_ANY')) + "*|\\[(?:|[" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*(?:, *" + ($$($nesting, 'CC_ANY')) + "+)?)\\])\\]$"));
- Opal.const_set($nesting[0], 'BlockTitleRx', new RegExp("" + "^\\.(\\.?[^ \\t.]" + ($$($nesting, 'CC_ANY')) + "*)$"));
- Opal.const_set($nesting[0], 'AdmonitionParagraphRx', new RegExp("" + "^(" + ($$($nesting, 'ADMONITION_STYLES').$to_a().$join("|")) + "):[ \\t]+"));
- Opal.const_set($nesting[0], 'LiteralParagraphRx', new RegExp("" + "^([ \\t]+" + ($$($nesting, 'CC_ANY')) + "*)$"));
- Opal.const_set($nesting[0], 'AtxSectionTitleRx', new RegExp("" + "^(=={0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$"));
- Opal.const_set($nesting[0], 'ExtAtxSectionTitleRx', new RegExp("" + "^(=={0,5}|#\\\#{0,5})[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "+?)(?:[ \\t]+\\1)?$"));
- Opal.const_set($nesting[0], 'SetextSectionTitleRx', new RegExp("" + "^((?!\\.)" + ($$($nesting, 'CC_ANY')) + "*?" + ($$($nesting, 'CG_ALNUM')) + ($$($nesting, 'CC_ANY')) + "*)$"));
- Opal.const_set($nesting[0], 'InlineSectionAnchorRx', new RegExp("" + " (\\\\)?\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+))?\\]\\]$"));
- Opal.const_set($nesting[0], 'InvalidSectionIdCharsRx', new RegExp("" + "<[^>]+>|&(?:[a-z][a-z]+\\d{0,2}|#\\d\\d\\d{0,4}|#x[\\da-f][\\da-f][\\da-f]{0,3});|[^ " + ($$($nesting, 'CC_WORD')) + "\\-.]+?"));
- Opal.const_set($nesting[0], 'SectionLevelStyleRx', /^sect\d$/);
- Opal.const_set($nesting[0], 'AnyListRx', new RegExp("" + "^(?:[ \\t]*(?:-|\\*\\**|\\.\\.*|\\u2022|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]|(?!//[^/])[ \\t]*[^ \\t]" + ($$($nesting, 'CC_ANY')) + "*?(?::::{0,2}|;;)(?:$|[ \\t])|<(?:\\d+|\\.)>[ \\t])"));
- Opal.const_set($nesting[0], 'UnorderedListRx', new RegExp("" + "^[ \\t]*(-|\\*\\**|\\u2022)[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$"));
- Opal.const_set($nesting[0], 'OrderedListRx', new RegExp("" + "^[ \\t]*(\\.\\.*|\\d+\\.|[a-zA-Z]\\.|[IVXivx]+\\))[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$"));
- Opal.const_set($nesting[0], 'OrderedListMarkerRxMap', $hash2(["arabic", "loweralpha", "lowerroman", "upperalpha", "upperroman"], {"arabic": /\d+\./, "loweralpha": /[a-z]\./, "lowerroman": /[ivx]+\)/, "upperalpha": /[A-Z]\./, "upperroman": /[IVX]+\)/}));
- Opal.const_set($nesting[0], 'DescriptionListRx', new RegExp("" + "^(?!//[^/])[ \\t]*([^ \\t]" + ($$($nesting, 'CC_ANY')) + "*?)(:::{0,2}|;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"));
- Opal.const_set($nesting[0], 'DescriptionListSiblingRx', $hash2(["::", ":::", "::::", ";;"], {"::": new RegExp("" + "^(?!//[^/])[ \\t]*([^ \\t]" + ($$($nesting, 'CC_ANY')) + "*?[^:]|[^ \\t:])(::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ":::": new RegExp("" + "^(?!//[^/])[ \\t]*([^ \\t]" + ($$($nesting, 'CC_ANY')) + "*?[^:]|[^ \\t:])(:::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), "::::": new RegExp("" + "^(?!//[^/])[ \\t]*([^ \\t]" + ($$($nesting, 'CC_ANY')) + "*?[^:]|[^ \\t:])(::::)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)"), ";;": new RegExp("" + "^(?!//[^/])[ \\t]*([^ \\t]" + ($$($nesting, 'CC_ANY')) + "*?)(;;)(?:$|[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$)")}));
- Opal.const_set($nesting[0], 'CalloutListRx', new RegExp("" + "^<(\\d+|\\.)>[ \\t]+(" + ($$($nesting, 'CC_ANY')) + "*)$"));
- Opal.const_set($nesting[0], 'CalloutExtractRx', /((?:\/\/|#|--|;;) ?)?(\\)?(?=(?: ?\\?)*$)/);
- Opal.const_set($nesting[0], 'CalloutExtractRxt', "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*$)");
- Opal.const_set($nesting[0], 'CalloutExtractRxMap', $send($$$('::', 'Hash'), 'new', [], ($Asciidoctor$1 = function(h, k){var self = $Asciidoctor$1.$$s || this, $writer = nil;
-
-
-
- if (h == null) {
- h = nil;
- };
-
- if (k == null) {
- k = nil;
- };
- $writer = [k, new RegExp("" + "(" + ((function() {if ($truthy(k['$empty?']())) {
- return ""
- } else {
- return "" + ($$$('::', 'Regexp').$escape(k)) + " ?"
- }; return nil; })()) + ")?" + ($$($nesting, 'CalloutExtractRxt')))];
- $send(h, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $Asciidoctor$1.$$s = self, $Asciidoctor$1.$$arity = 2, $Asciidoctor$1)));
- Opal.const_set($nesting[0], 'CalloutScanRx', new RegExp("" + "\\\\?(?=(?: ?\\\\?)*" + ($$($nesting, 'CC_EOL')) + ")"));
- Opal.const_set($nesting[0], 'CalloutSourceRx', new RegExp("" + "((?://|#|--|;;) ?)?(\\\\)?<!?(|--)(\\d+|\\.)\\3>(?=(?: ?\\\\?<!?\\3(?:\\d+|\\.)\\3>)*" + ($$($nesting, 'CC_EOL')) + ")"));
- Opal.const_set($nesting[0], 'CalloutSourceRxt', "" + "(\\\\)?<()(\\d+|\\.)>(?=(?: ?\\\\?<(?:\\d+|\\.)>)*" + ($$($nesting, 'CC_EOL')) + ")");
- Opal.const_set($nesting[0], 'CalloutSourceRxMap', $send($$$('::', 'Hash'), 'new', [], ($Asciidoctor$2 = function(h, k){var self = $Asciidoctor$2.$$s || this, $writer = nil;
-
-
-
- if (h == null) {
- h = nil;
- };
-
- if (k == null) {
- k = nil;
- };
- $writer = [k, new RegExp("" + "(" + ((function() {if ($truthy(k['$empty?']())) {
- return ""
- } else {
- return "" + ($$$('::', 'Regexp').$escape(k)) + " ?"
- }; return nil; })()) + ")?" + ($$($nesting, 'CalloutSourceRxt')))];
- $send(h, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $Asciidoctor$2.$$s = self, $Asciidoctor$2.$$arity = 2, $Asciidoctor$2)));
- Opal.const_set($nesting[0], 'ListRxMap', $hash2(["ulist", "olist", "dlist", "colist"], {"ulist": $$($nesting, 'UnorderedListRx'), "olist": $$($nesting, 'OrderedListRx'), "dlist": $$($nesting, 'DescriptionListRx'), "colist": $$($nesting, 'CalloutListRx')}));
- Opal.const_set($nesting[0], 'ColumnSpecRx', /^(?:(\d+)\*)?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?(\d+%?|~)?([a-z])?$/);
- Opal.const_set($nesting[0], 'CellSpecStartRx', /^[ \t]*(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/);
- Opal.const_set($nesting[0], 'CellSpecEndRx', /[ \t]+(?:(\d+(?:\.\d*)?|(?:\d*\.)?\d+)([*+]))?([<^>](?:\.[<^>]?)?|(?:[<^>]?\.)?[<^>])?([a-z])?$/);
- Opal.const_set($nesting[0], 'CustomBlockMacroRx', new RegExp("" + "^(" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "-]*)::(|\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$"));
- Opal.const_set($nesting[0], 'BlockMediaMacroRx', new RegExp("" + "^(image|video|audio)::(\\S|\\S" + ($$($nesting, 'CC_ANY')) + "*?\\S)\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$"));
- Opal.const_set($nesting[0], 'BlockTocMacroRx', new RegExp("" + "^toc::\\[(" + ($$($nesting, 'CC_ANY')) + "+)?\\]$"));
- Opal.const_set($nesting[0], 'InlineAnchorRx', new RegExp("" + "(\\\\)?(?:\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\]))"));
- Opal.const_set($nesting[0], 'InlineAnchorScanRx', new RegExp("" + "(?:^|[^\\\\\\[])\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]|(?:^|[^\\\\])anchor:([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*)\\[(?:\\]|(" + ($$($nesting, 'CC_ANY')) + "*?[^\\\\])\\])"));
- Opal.const_set($nesting[0], 'LeadingInlineAnchorRx', new RegExp("" + "^\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]"));
- Opal.const_set($nesting[0], 'InlineBiblioAnchorRx', new RegExp("" + "^\\[\\[\\[([" + ($$($nesting, 'CC_ALPHA')) + "_:][" + ($$($nesting, 'CC_WORD')) + "\\-:.]*)(?:, *(" + ($$($nesting, 'CC_ANY')) + "+?))?\\]\\]\\]"));
- Opal.const_set($nesting[0], 'InlineEmailRx', new RegExp("" + "([\\\\>:/])?" + ($$($nesting, 'CG_WORD')) + "(?:&|[" + ($$($nesting, 'CC_WORD')) + "\\-.%+])*@" + ($$($nesting, 'CG_ALNUM')) + "[" + ($$($nesting, 'CC_ALNUM')) + "_\\-.]*\\.[a-zA-Z]{2,5}\\b"));
- Opal.const_set($nesting[0], 'InlineFootnoteMacroRx', new RegExp("" + "\\\\?footnote(?:(ref):|:([" + ($$($nesting, 'CC_WORD')) + "-]+)?)\\[(?:|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\]))\\](?! )", 'm'));
- Opal.const_set($nesting[0], 'InlineImageMacroRx', new RegExp("" + "\\\\?i(?:mage|con):([^:\\s\\[](?:[^\\n\\[]*[^\\s\\[])?)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm'));
- Opal.const_set($nesting[0], 'InlineIndextermMacroRx', new RegExp("" + "\\\\?(?:(indexterm2?):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]|\\(\\((" + ($$($nesting, 'CC_ALL')) + "+?)\\)\\)(?!\\)))", 'm'));
- Opal.const_set($nesting[0], 'InlineKbdBtnMacroRx', new RegExp("" + "(\\\\)?(kbd|btn):\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm'));
- Opal.const_set($nesting[0], 'InlineLinkRx', new RegExp("" + "(^|link:|" + ($$($nesting, 'CG_BLANK')) + "|<|[>\\(\\)\\[\\];\"'])(\\\\?(?:https?|file|ftp|irc)://[^\\s\\[\\]<]*([^\\s.,\\[\\]<]))(?:\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])?", 'm'));
- Opal.const_set($nesting[0], 'InlineLinkMacroRx', new RegExp("" + "\\\\?(?:link|(mailto)):(|[^:\\s\\[][^\\s\\[]*)\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm'));
- Opal.const_set($nesting[0], 'MacroNameRx', new RegExp("" + "^" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "-]*$"));
- Opal.const_set($nesting[0], 'InlineStemMacroRx', new RegExp("" + "\\\\?(stem|(?:latex|ascii)math):([a-z]+(?:,[a-z-]+)*)?\\[(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]", 'm'));
- Opal.const_set($nesting[0], 'InlineMenuMacroRx', new RegExp("" + "\\\\?menu:(" + ($$($nesting, 'CG_WORD')) + "|[" + ($$($nesting, 'CC_WORD')) + "&][^\\n\\[]*[^\\s\\[])\\[ *(?:|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\]))\\]", 'm'));
- Opal.const_set($nesting[0], 'InlineMenuRx', new RegExp("" + "\\\\?\"([" + ($$($nesting, 'CC_WORD')) + "&][^\"]*?[ \\n]+>[ \\n]+[^\"]*)\""));
- Opal.const_set($nesting[0], 'InlinePassRx', $hash(false, ["+", "`", new RegExp("" + "(^|[^" + ($$($nesting, 'CC_WORD')) + ";:])(?:\\[([^\\]]+)\\])?(\\\\?(\\+|`)(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?!" + ($$($nesting, 'CG_WORD')) + ")", 'm')], true, ["`", nil, new RegExp("" + "(^|[^`" + ($$($nesting, 'CC_WORD')) + "])(?:\\[([^\\]]+)\\])?(\\\\?(`)([^`\\s]|[^`\\s]" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\4)(?![`" + ($$($nesting, 'CC_WORD')) + "])", 'm')]));
- Opal.const_set($nesting[0], 'SinglePlusInlinePassRx', new RegExp("" + "^(\\\\)?\\+(\\S|\\S" + ($$($nesting, 'CC_ALL')) + "*?\\S)\\+$", 'm'));
- Opal.const_set($nesting[0], 'InlinePassMacroRx', new RegExp("" + "(?:(?:(\\\\?)\\[([^\\]]+)\\])?(\\\\{0,2})(\\+\\+\\+?|\\$\\$)(" + ($$($nesting, 'CC_ALL')) + "*?)\\4|(\\\\?)pass:([a-z]+(?:,[a-z-]+)*)?\\[(|" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\])", 'm'));
- Opal.const_set($nesting[0], 'InlineXrefMacroRx', new RegExp("" + "\\\\?(?:<<([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)>>|xref:([" + ($$($nesting, 'CC_WORD')) + "#/.:{]" + ($$($nesting, 'CC_ALL')) + "*?)\\[(?:\\]|(" + ($$($nesting, 'CC_ALL')) + "*?[^\\\\])\\]))", 'm'));
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- Opal.const_set($nesting[0], 'HardLineBreakRx', new RegExp("" + "^(" + ($$($nesting, 'CC_ANY')) + "*) \\+$", 'm'))
- } else {
- nil
- };
- Opal.const_set($nesting[0], 'MarkdownThematicBreakRx', /^ {0,3}([-*_])( *)\1\2\1$/);
- Opal.const_set($nesting[0], 'ExtLayoutBreakRx', /^(?:'{3,}|<{3,}|([-*_])( *)\1\2\1)$/);
- Opal.const_set($nesting[0], 'BlankLineRx', /\n{2,}/);
- Opal.const_set($nesting[0], 'EscapedSpaceRx', /\\([ \t\n])/);
- Opal.const_set($nesting[0], 'ReplaceableTextRx', /[&']|--|\.\.\.|\([CRT]M?\)/);
- Opal.const_set($nesting[0], 'SpaceDelimiterRx', /([^\\])[ \t\n]+/);
- Opal.const_set($nesting[0], 'SubModifierSniffRx', /[+-]/);
- Opal.const_set($nesting[0], 'TrailingDigitsRx', /\d+$/);
- Opal.const_set($nesting[0], 'UriSniffRx', new RegExp("" + "^" + ($$($nesting, 'CG_ALPHA')) + "[" + ($$($nesting, 'CC_ALNUM')) + ".+-]+:/{0,2}"));
- Opal.const_set($nesting[0], 'XmlSanitizeRx', /<[^>]+>/);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/substitutors"] = function(Opal) {
- 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_gt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
- }
- function $rb_lt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
- }
- function $rb_times(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, $hash2 = Opal.hash2, $hash = Opal.hash, $truthy = Opal.truthy, $send = Opal.send, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$freeze', '$+', '$keys', '$empty?', '$!', '$===', '$[]', '$join', '$include?', '$extract_passthroughs', '$each', '$sub_specialchars', '$sub_quotes', '$sub_attributes', '$sub_replacements', '$sub_macros', '$highlight_source', '$sub_callouts', '$sub_post_replacements', '$warn', '$logger', '$restore_passthroughs', '$clear', '$split', '$apply_subs', '$==', '$gsub', '$match?', '$compat_mode', '$convert_quoted_text', '$attributes', '$shift', '$store_attribute', '$!=', '$attribute_undefined', '$counter', '$key?', '$downcase', '$attribute_missing', '$info', '$squeeze', '$delete', '$reject', '$start_with?', '$do_replacement', '$extensions', '$inline_macros?', '$inline_macros', '$regexp', '$instance', '$slice', '$length', '$names', '$config', '$merge', '$[]=', '$-', '$normalize_text', '$parse_attributes', '$process_method', '$expand_subs', '$text', '$text=', '$convert', '$class', '$strip', '$>', '$index', '$min', '$compact', '$end_with?', '$map', '$chop', '$new', '$pop', '$rstrip', '$register', '$tr', '$basename', '$parse', '$<<', '$lstrip', '$split_simple_csv', '$partition', '$extract_attributes_from_text', '$sub', '$encode_uri_component', '$style', '$extname?', '$rindex', '$info?', '$catalog', '$fetch', '$outfilesuffix', '$natural_xrefs', '$resolve_id', '$find', '$footnotes', '$id', '$<', '$size', '$attr?', '$attr', '$to_s', '$read_next_id', '$callouts', '$syntax_highlighter', '$highlight?', '$sub_source', '$extract_callouts', '$name', '$to_sym', '$to_i', '$resolve_lines_to_highlight', '$highlight', '$nil_or_empty?', '$restore_callouts', '$count', '$to_a', '$|', '$sort', '$*', '$parse_quoted_text_attributes', '$resolve_pass_subs', '$extract_inner_passthrough', '$basebackend?', '$error', '$chr', '$drop', '$&', '$resolve_subs', '$resolve_block_subs', '$parse_into', '$private', '$=~', '$shorthand_property_syntax', '$concat', '$each_char']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting);
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'Substitutors');
-
- var $nesting = [self].concat($parent_nesting), $Substitutors_apply_subs$1, $Substitutors_apply_normal_subs$3, $Substitutors_apply_header_subs$4, $Substitutors_apply_reftext_subs$5, $Substitutors_sub_specialchars$6, $Substitutors_sub_quotes$7, $Substitutors_sub_attributes$10, $Substitutors_sub_replacements$16, $Substitutors_sub_macros$19, $Substitutors_sub_post_replacements$41, $Substitutors_sub_source$44, $Substitutors_sub_callouts$45, $Substitutors_highlight_source$47, $Substitutors_resolve_lines_to_highlight$48, $Substitutors_extract_passthroughs$51, $Substitutors_restore_passthroughs$55, $Substitutors_resolve_subs$57, $Substitutors_resolve_block_subs$59, $Substitutors_resolve_pass_subs$60, $Substitutors_expand_subs$61, $Substitutors_commit_subs$63, $Substitutors_parse_attributes$64, $Substitutors_extract_attributes_from_text$65, $Substitutors_extract_callouts$66, $Substitutors_restore_callouts$69, $Substitutors_extract_inner_passthrough$72, $Substitutors_convert_quoted_text$73, $Substitutors_do_replacement$74, $Substitutors_parse_quoted_text_attributes$75, $Substitutors_normalize_text$76, $Substitutors_split_simple_csv$77;
-
-
- Opal.const_set($nesting[0], 'SpecialCharsRx', /[<&>]/);
- Opal.const_set($nesting[0], 'SpecialCharsTr', $hash2([">", "<", "&"], {">": ">", "<": "<", "&": "&"}));
- Opal.const_set($nesting[0], 'QuotedTextSniffRx', $hash(false, /[*_`#^~]/, true, /[*'_+#^~]/));
- Opal.const_set($nesting[0], 'BASIC_SUBS', ["specialcharacters"]).$freeze();
- Opal.const_set($nesting[0], 'HEADER_SUBS', ["specialcharacters", "attributes"]).$freeze();
- Opal.const_set($nesting[0], 'NO_SUBS', []).$freeze();
- Opal.const_set($nesting[0], 'NORMAL_SUBS', ["specialcharacters", "quotes", "attributes", "replacements", "macros", "post_replacements"]).$freeze();
- Opal.const_set($nesting[0], 'REFTEXT_SUBS', ["specialcharacters", "quotes", "replacements"]).$freeze();
- Opal.const_set($nesting[0], 'VERBATIM_SUBS', ["specialcharacters", "callouts"]).$freeze();
- Opal.const_set($nesting[0], 'SUB_GROUPS', $hash2(["none", "normal", "verbatim", "specialchars"], {"none": $$($nesting, 'NO_SUBS'), "normal": $$($nesting, 'NORMAL_SUBS'), "verbatim": $$($nesting, 'VERBATIM_SUBS'), "specialchars": $$($nesting, 'BASIC_SUBS')}));
- Opal.const_set($nesting[0], 'SUB_HINTS', $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.const_set($nesting[0], 'SUB_OPTIONS', $hash2(["block", "inline"], {"block": $rb_plus($rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS')), ["callouts"]), "inline": $rb_plus($$($nesting, 'SUB_GROUPS').$keys(), $$($nesting, 'NORMAL_SUBS'))}));
- Opal.const_set($nesting[0], 'CAN', "\u0018");
- Opal.const_set($nesting[0], 'DEL', "\u007F");
- Opal.const_set($nesting[0], 'PASS_START', "\u0096");
- Opal.const_set($nesting[0], 'PASS_END', "\u0097");
- Opal.const_set($nesting[0], 'PassSlotRx', new RegExp("" + ($$($nesting, 'PASS_START')) + "(\\d+)" + ($$($nesting, 'PASS_END'))));
- Opal.const_set($nesting[0], 'HighlightedPassSlotRx', new RegExp("" + "]*>" + ($$($nesting, 'PASS_START')) + " [^\\d]*(\\d+)[^\\d]*]*>" + ($$($nesting, 'PASS_END')) + " "));
- Opal.const_set($nesting[0], 'RS', "\\");
- Opal.const_set($nesting[0], 'R_SB', "]");
- Opal.const_set($nesting[0], 'ESC_R_SB', "\\]");
- Opal.const_set($nesting[0], 'PLUS', "+");
-
- Opal.def(self, '$apply_subs', $Substitutors_apply_subs$1 = function $$apply_subs(text, subs) {
- var $a, $$2, self = this, is_multiline = nil, passthrus = nil, clear_passthrus = nil;
- if (self.passthroughs == null) self.passthroughs = nil;
- if (self.passthroughs_locked == null) self.passthroughs_locked = nil;
-
-
-
- if (subs == null) {
- subs = $$($nesting, 'NORMAL_SUBS');
- };
- if ($truthy(($truthy($a = text['$empty?']()) ? $a : subs['$!']()))) {
- return text};
- if ($truthy((is_multiline = $$$('::', 'Array')['$==='](text)))) {
- text = (function() {if ($truthy(text['$[]'](1))) {
-
- return text.$join($$($nesting, 'LF'));
- } else {
- return text['$[]'](0)
- }; return nil; })()};
- if ($truthy(subs['$include?']("macros"))) {
-
- text = self.$extract_passthroughs(text);
- if ($truthy(self.passthroughs['$empty?']())) {
- } else {
-
- passthrus = self.passthroughs;
- self.passthroughs_locked = ($truthy($a = self.passthroughs_locked) ? $a : (clear_passthrus = true));
- };};
- $send(subs, 'each', [], ($$2 = function(type){var self = $$2.$$s || this, $case = nil;
-
-
-
- if (type == null) {
- type = nil;
- };
- return (function() {$case = type;
- if ("specialcharacters"['$===']($case)) {return (text = self.$sub_specialchars(text))}
- else if ("quotes"['$===']($case)) {return (text = self.$sub_quotes(text))}
- else if ("attributes"['$===']($case)) {if ($truthy(text['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- return (text = self.$sub_attributes(text))
- } else {
- return nil
- }}
- 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 ($truthy(subs['$include?']("highlight"))) {
- return nil
- } else {
- return (text = self.$sub_callouts(text))
- }}
- else if ("post_replacements"['$===']($case)) {return (text = self.$sub_post_replacements(text))}
- else {return self.$logger().$warn("" + "unknown substitution type " + (type))}})();}, $$2.$$s = self, $$2.$$arity = 1, $$2));
- if ($truthy(passthrus)) {
-
- text = self.$restore_passthroughs(text);
- if ($truthy(clear_passthrus)) {
-
- passthrus.$clear();
- self.passthroughs_locked = nil;};};
- if ($truthy(is_multiline)) {
-
- return text.$split($$($nesting, 'LF'), -1);
- } else {
- return text
- };
- }, $Substitutors_apply_subs$1.$$arity = -2);
-
- Opal.def(self, '$apply_normal_subs', $Substitutors_apply_normal_subs$3 = function $$apply_normal_subs(text) {
- var self = this;
-
- return self.$apply_subs(text, $$($nesting, 'NORMAL_SUBS'))
- }, $Substitutors_apply_normal_subs$3.$$arity = 1);
-
- Opal.def(self, '$apply_header_subs', $Substitutors_apply_header_subs$4 = function $$apply_header_subs(text) {
- var self = this;
-
- return self.$apply_subs(text, $$($nesting, 'HEADER_SUBS'))
- }, $Substitutors_apply_header_subs$4.$$arity = 1);
- Opal.alias(self, "apply_title_subs", "apply_subs");
-
- Opal.def(self, '$apply_reftext_subs', $Substitutors_apply_reftext_subs$5 = function $$apply_reftext_subs(text) {
- var self = this;
-
- return self.$apply_subs(text, $$($nesting, 'REFTEXT_SUBS'))
- }, $Substitutors_apply_reftext_subs$5.$$arity = 1);
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
-
- Opal.def(self, '$sub_specialchars', $Substitutors_sub_specialchars$6 = function $$sub_specialchars(text) {
- var $a, $b, self = this;
-
- if ($truthy(($truthy($a = ($truthy($b = text['$include?'](">")) ? $b : text['$include?']("&"))) ? $a : text['$include?']("<")))) {
-
- return text.$gsub($$($nesting, 'SpecialCharsRx'), $$($nesting, 'SpecialCharsTr'));
- } else {
- return text
- }
- }, $Substitutors_sub_specialchars$6.$$arity = 1)
- } else {
- nil
- };
- Opal.alias(self, "sub_specialcharacters", "sub_specialchars");
-
- Opal.def(self, '$sub_quotes', $Substitutors_sub_quotes$7 = function $$sub_quotes(text) {
- var $$8, self = this, compat = nil;
- if (self.document == null) self.document = nil;
-
-
- if ($truthy($$($nesting, 'QuotedTextSniffRx')['$[]']((compat = self.document.$compat_mode()))['$match?'](text))) {
- $send($$($nesting, 'QUOTE_SUBS')['$[]'](compat), 'each', [], ($$8 = function(type, scope, pattern){var self = $$8.$$s || this, $$9;
-
-
-
- if (type == null) {
- type = nil;
- };
-
- if (scope == null) {
- scope = nil;
- };
-
- if (pattern == null) {
- pattern = nil;
- };
- return (text = $send(text, 'gsub', [pattern], ($$9 = function(){var self = $$9.$$s || this;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
- return self.$convert_quoted_text($gvars["~"], type, scope)}, $$9.$$s = self, $$9.$$arity = 0, $$9)));}, $$8.$$s = self, $$8.$$arity = 3, $$8))};
- return text;
- }, $Substitutors_sub_quotes$7.$$arity = 1);
-
- Opal.def(self, '$sub_attributes', $Substitutors_sub_attributes$10 = function $$sub_attributes(text, opts) {
- var $$11, $$13, $$14, $$15, self = this, doc_attrs = nil, drop = nil, drop_line = nil, drop_line_severity = nil, drop_empty_line = nil, attribute_undefined = nil, attribute_missing = nil, lines = nil;
- if (self.document == null) self.document = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- doc_attrs = self.document.$attributes();
- drop = (drop_line = (drop_line_severity = (drop_empty_line = (attribute_undefined = (attribute_missing = nil)))));
- text = $send(text, 'gsub', [$$($nesting, 'AttributeReferenceRx')], ($$11 = function(){var self = $$11.$$s || this, $a, $b, $c, $$12, $case = nil, args = nil, _ = nil, value = nil, key = nil;
- if (self.document == null) self.document = nil;
-
- if ($truthy(($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$==']($$($nesting, 'RS'))) ? $a : (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))['$==']($$($nesting, 'RS'))))) {
- return "" + "{" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "}"
- } else if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](3)))) {
- return (function() {$case = (args = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$split(":", 3)).$shift();
- if ("set"['$===']($case)) {
- $b = $$($nesting, 'Parser').$store_attribute(args['$[]'](0), ($truthy($c = args['$[]'](1)) ? $c : ""), self.document), $a = Opal.to_ary($b), (_ = ($a[0] == null ? nil : $a[0])), (value = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy(($truthy($a = value) ? $a : (attribute_undefined = ($truthy($b = attribute_undefined) ? $b : ($truthy($c = doc_attrs['$[]']("attribute-undefined")) ? $c : $$($nesting, 'Compliance').$attribute_undefined())))['$!=']("drop-line")))) {
- return (drop = (drop_empty_line = $$($nesting, 'DEL')))
- } else {
- return (drop = (drop_line = $$($nesting, 'CAN')))
- };}
- else if ("counter2"['$===']($case)) {
- $send(self.document, 'counter', Opal.to_a(args));
- return (drop = (drop_empty_line = $$($nesting, 'DEL')));}
- else {return $send(self.document, 'counter', Opal.to_a(args))}})()
- } else if ($truthy(doc_attrs['$key?']((key = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)).$downcase())))) {
- return doc_attrs['$[]'](key)
- } else if ($truthy((value = $$($nesting, 'INTRINSIC_ATTRIBUTES')['$[]'](key)))) {
- return value
- } else {
- return (function() {$case = (attribute_missing = ($truthy($a = attribute_missing) ? $a : ($truthy($b = ($truthy($c = opts['$[]']("attribute_missing")) ? $c : doc_attrs['$[]']("attribute-missing"))) ? $b : $$($nesting, 'Compliance').$attribute_missing())));
- if ("drop"['$===']($case)) {return (drop = (drop_empty_line = $$($nesting, 'DEL')))}
- else if ("drop-line"['$===']($case)) {
- if ((drop_line_severity = ($truthy($a = drop_line_severity) ? $a : ($truthy($b = opts['$[]']("drop_line_severity")) ? $b : "info")))['$==']("info")) {
- $send(self.$logger(), 'info', [], ($$12 = function(){var self = $$12.$$s || this;
-
- return "" + "dropping line containing reference to missing attribute: " + (key)}, $$12.$$s = self, $$12.$$arity = 0, $$12))};
- return (drop = (drop_line = $$($nesting, 'CAN')));}
- else if ("warn"['$===']($case)) {
- self.$logger().$warn("" + "skipping reference to missing attribute: " + (key));
- return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0));}
- else {return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0))}})()
- }}, $$11.$$s = self, $$11.$$arity = 0, $$11));
- if ($truthy(drop)) {
- if ($truthy(drop_empty_line)) {
-
- lines = text.$squeeze($$($nesting, 'DEL')).$split($$($nesting, 'LF'), -1);
- if ($truthy(drop_line)) {
- return $send(lines, 'reject', [], ($$13 = function(line){var self = $$13.$$s || this, $a, $b, $c;
-
-
-
- if (line == null) {
- line = nil;
- };
- return ($truthy($a = ($truthy($b = ($truthy($c = line['$==']($$($nesting, 'DEL'))) ? $c : line['$==']($$($nesting, 'CAN')))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, $$13.$$s = self, $$13.$$arity = 1, $$13)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL'))
- } else {
- return $send(lines, 'reject', [], ($$14 = function(line){var self = $$14.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line['$==']($$($nesting, 'DEL'));}, $$14.$$s = self, $$14.$$arity = 1, $$14)).$join($$($nesting, 'LF')).$delete($$($nesting, 'DEL'))
- };
- } else if ($truthy(text['$include?']($$($nesting, 'LF')))) {
- return $send(text.$split($$($nesting, 'LF'), -1), 'reject', [], ($$15 = function(line){var self = $$15.$$s || this, $a, $b;
-
-
-
- if (line == null) {
- line = nil;
- };
- return ($truthy($a = ($truthy($b = line['$==']($$($nesting, 'CAN'))) ? $b : line['$start_with?']($$($nesting, 'CAN')))) ? $a : line['$include?']($$($nesting, 'CAN')));}, $$15.$$s = self, $$15.$$arity = 1, $$15)).$join($$($nesting, 'LF'))
- } else {
- return ""
- }
- } else {
- return text
- };
- }, $Substitutors_sub_attributes$10.$$arity = -2);
-
- Opal.def(self, '$sub_replacements', $Substitutors_sub_replacements$16 = function $$sub_replacements(text) {
- var $$17, self = this;
-
-
- if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) {
- $send($$($nesting, 'REPLACEMENTS'), 'each', [], ($$17 = function(pattern, replacement, restore){var self = $$17.$$s || this, $$18;
-
-
-
- if (pattern == null) {
- pattern = nil;
- };
-
- if (replacement == null) {
- replacement = nil;
- };
-
- if (restore == null) {
- restore = nil;
- };
- return (text = $send(text, 'gsub', [pattern], ($$18 = function(){var self = $$18.$$s || this;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
- return self.$do_replacement($gvars["~"], replacement, restore)}, $$18.$$s = self, $$18.$$arity = 0, $$18)));}, $$17.$$s = self, $$17.$$arity = 3, $$17))};
- return text;
- }, $Substitutors_sub_replacements$16.$$arity = 1);
-
- Opal.def(self, '$sub_macros', $Substitutors_sub_macros$19 = function $$sub_macros(text) {
- var $a, $$20, $b, $$22, $$25, $$27, $$29, $$30, $$33, $$34, $$35, $$36, $$37, $$38, $$39, self = this, found_square_bracket = nil, found_colon = nil, found_macroish = nil, found_macroish_short = nil, doc_attrs = nil, doc = nil, extensions = nil;
- if (self.document == null) self.document = nil;
- if (self.context == null) self.context = nil;
- if (self.parent == null) self.parent = nil;
-
-
- found_square_bracket = text['$include?']("[");
- found_colon = text['$include?'](":");
- found_macroish = ($truthy($a = found_square_bracket) ? found_colon : $a);
- found_macroish_short = ($truthy($a = found_macroish) ? text['$include?'](":[") : $a);
- doc_attrs = (doc = self.document).$attributes();
- if ($truthy(($truthy($a = (extensions = doc.$extensions())) ? extensions['$inline_macros?']() : $a))) {
- $send(extensions.$inline_macros(), 'each', [], ($$20 = function(extension){var self = $$20.$$s || this, $$21;
-
-
-
- if (extension == null) {
- extension = nil;
- };
- return (text = $send(text, 'gsub', [extension.$instance().$regexp()], ($$21 = function(){var self = $$21.$$s || this, $b, $c, match = nil, target = nil, content = nil, attributes = nil, default_attrs = nil, ext_config = nil, $writer = nil, replacement = nil, inline_subs = nil;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
-
- if ($truthy((match = (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)))['$start_with?']($$($nesting, 'RS')))) {
- return (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$slice(1, (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length());};
- if ($truthy($gvars["~"].$names()['$empty?']())) {
- $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](1)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))], (target = $b[0]), (content = $b[1]), $b
- } else {
- $b = [(function() { try {
- return $gvars["~"]['$[]']("target")
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- return nil
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }})(), (function() { try {
- return $gvars["~"]['$[]']("content")
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- return nil
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }})()], (target = $b[0]), (content = $b[1]), $b
- };
- attributes = (function() {if ($truthy((default_attrs = (ext_config = extension.$config())['$[]']("default_attrs")))) {
- return default_attrs.$merge()
- } else {
- return $hash2([], {})
- }; return nil; })();
- if ($truthy(content)) {
-
- if ($truthy(content['$empty?']())) {
- if (ext_config['$[]']("content_model")['$==']("attributes")) {
- } else {
-
- $writer = ["text", content];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }
- } else {
-
- content = self.$normalize_text(content, true, true);
- if (ext_config['$[]']("content_model")['$==']("attributes")) {
- self.$parse_attributes(content, ($truthy($b = ($truthy($c = ext_config['$[]']("positional_attrs")) ? $c : ext_config['$[]']("pos_attrs"))) ? $b : []), $hash2(["into"], {"into": attributes}))
- } else {
-
- $writer = ["text", content];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- };
- target = ($truthy($b = target) ? $b : (function() {if (ext_config['$[]']("format")['$==']("short")) {
- return content
- } else {
- return target
- }; return nil; })());};
- if ($truthy($$($nesting, 'Inline')['$===']((replacement = extension.$process_method()['$[]'](self, target, attributes))))) {
-
- if ($truthy(($truthy($b = (inline_subs = replacement.$attributes().$delete("subs"))) ? (inline_subs = self.$expand_subs(inline_subs, "custom inline macro")) : $b))) {
-
- $writer = [self.$apply_subs(replacement.$text(), inline_subs)];
- $send(replacement, 'text=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return replacement.$convert();
- } else if ($truthy(replacement)) {
-
- self.$logger().$info("" + "expected substitution value for custom inline macro to be of type Inline; got " + (replacement.$class()) + ": " + (match));
- return replacement;
- } else {
- return ""
- };}, $$21.$$s = self, $$21.$$arity = 0, $$21)));}, $$20.$$s = self, $$20.$$arity = 1, $$20))};
- if ($truthy(doc_attrs['$key?']("experimental"))) {
-
- if ($truthy(($truthy($a = found_macroish_short) ? ($truthy($b = text['$include?']("kbd:")) ? $b : text['$include?']("btn:")) : $a))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineKbdBtnMacroRx')], ($$22 = function(){var self = $$22.$$s || this, $c, $$23, $$24, keys = nil, delim_idx = nil, delim = nil, $writer = nil;
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length())
- } else if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](2))['$==']("kbd")) {
-
- if ($truthy((keys = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$strip())['$include?']($$($nesting, 'R_SB')))) {
- keys = keys.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))};
- if ($truthy(($truthy($c = $rb_gt(keys.$length(), 1)) ? (delim_idx = (function() {if ($truthy((delim_idx = keys.$index(",", 1)))) {
- return [delim_idx, keys.$index("+", 1)].$compact().$min()
- } else {
-
- return keys.$index("+", 1);
- }; return nil; })()) : $c))) {
-
- delim = keys.$slice(delim_idx, 1);
- if ($truthy(keys['$end_with?'](delim))) {
-
- keys = $send(keys.$chop().$split(delim, -1), 'map', [], ($$23 = function(key){var self = $$23.$$s || this;
-
-
-
- if (key == null) {
- key = nil;
- };
- return key.$strip();}, $$23.$$s = self, $$23.$$arity = 1, $$23));
-
- $writer = [-1, $rb_plus(keys['$[]'](-1), delim)];
- $send(keys, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
- keys = $send(keys.$split(delim), 'map', [], ($$24 = function(key){var self = $$24.$$s || this;
-
-
-
- if (key == null) {
- key = nil;
- };
- return key.$strip();}, $$24.$$s = self, $$24.$$arity = 1, $$24))
- };
- } else {
- keys = [keys]
- };
- return $$($nesting, 'Inline').$new(self, "kbd", nil, $hash2(["attributes"], {"attributes": $hash2(["keys"], {"keys": keys})})).$convert();
- } else {
- return $$($nesting, 'Inline').$new(self, "button", self.$normalize_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)), true, true)).$convert()
- }}, $$22.$$s = self, $$22.$$arity = 0, $$22))};
- if ($truthy(($truthy($a = found_macroish) ? text['$include?']("menu:") : $a))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineMenuMacroRx')], ($$25 = function(){var self = $$25.$$s || this, $c, $$26, menu = nil, items = nil, delim = nil, submenus = nil, menuitem = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- menu = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1));
- if ($truthy((items = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))))) {
-
- if ($truthy(items['$include?']($$($nesting, 'R_SB')))) {
- items = items.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))};
- if ($truthy((delim = (function() {if ($truthy(items['$include?'](">"))) {
- return ">"
- } else {
-
- if ($truthy(items['$include?'](","))) {
- return ","
- } else {
- return nil
- };
- }; return nil; })()))) {
-
- submenus = $send(items.$split(delim), 'map', [], ($$26 = function(it){var self = $$26.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- return it.$strip();}, $$26.$$s = self, $$26.$$arity = 1, $$26));
- menuitem = submenus.$pop();
- } else {
- $c = [[], items.$rstrip()], (submenus = $c[0]), (menuitem = $c[1]), $c
- };
- } else {
- $c = [[], nil], (submenus = $c[0]), (menuitem = $c[1]), $c
- };
- return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, $$25.$$s = self, $$25.$$arity = 0, $$25))};
- if ($truthy(($truthy($a = text['$include?']("\"")) ? text['$include?'](">") : $a))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineMenuRx')], ($$27 = function(){var self = $$27.$$s || this, $c, $d, $e, $$28, menu = nil, submenus = nil, menuitem = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- $d = $send((($e = $gvars['~']) === nil ? nil : $e['$[]'](1)).$split(">"), 'map', [], ($$28 = function(it){var self = $$28.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- return it.$strip();}, $$28.$$s = self, $$28.$$arity = 1, $$28)), $c = Opal.to_ary($d), (menu = ($c[0] == null ? nil : $c[0])), (submenus = $slice.call($c, 1)), $d;
- menuitem = submenus.$pop();
- return $$($nesting, 'Inline').$new(self, "menu", nil, $hash2(["attributes"], {"attributes": $hash2(["menu", "submenus", "menuitem"], {"menu": menu, "submenus": submenus, "menuitem": menuitem})})).$convert();}, $$27.$$s = self, $$27.$$arity = 0, $$27))};};
- if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("image:")) ? $b : text['$include?']("icon:")) : $a))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineImageMacroRx')], ($$29 = function(){var self = $$29.$$s || this, $c, type = nil, posattrs = nil, target = nil, attrs = nil, $writer = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());
- } else if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']("icon:"))) {
- $c = ["icon", ["size"]], (type = $c[0]), (posattrs = $c[1]), $c
- } else {
- $c = ["image", ["alt", "width", "height"]], (type = $c[0]), (posattrs = $c[1]), $c
- };
- target = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1));
- attrs = self.$parse_attributes((($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), posattrs, $hash2(["unescape_input"], {"unescape_input": true}));
- if (type['$==']("icon")) {
- } else {
-
- doc.$register("images", target);
-
- $writer = ["imagesdir", doc_attrs['$[]']("imagesdir")];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- };
- ($truthy($c = attrs['$[]']("alt")) ? $c : (($writer = ["alt", (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- return $$($nesting, 'Inline').$new(self, "image", nil, $hash2(["type", "target", "attributes"], {"type": type, "target": target, "attributes": attrs})).$convert();}, $$29.$$s = self, $$29.$$arity = 0, $$29))};
- if ($truthy(($truthy($a = ($truthy($b = text['$include?']("((")) ? text['$include?']("))") : $b)) ? $a : ($truthy($b = found_macroish_short) ? text['$include?']("dexterm") : $b)))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineIndextermMacroRx')], ($$30 = function(){var self = $$30.$$s || this, $c, $$31, $d, $$32, $case = nil, attrlist = nil, primary = nil, attrs = nil, $writer = nil, terms = nil, secondary = nil, tertiary = nil, see_also = nil, term = nil, visible = nil, before = nil, after = nil, _ = nil, see = nil, subbed_term = nil;
-
- return (function() {$case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1));
- if ("indexterm"['$===']($case)) {
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- if ($truthy((attrlist = self.$normalize_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), true, true))['$include?']("="))) {
- if ($truthy((primary = (attrs = $$($nesting, 'AttributeList').$new(attrlist, self).$parse())['$[]'](1)))) {
-
-
- $writer = ["terms", (terms = [primary])];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy((secondary = attrs['$[]'](2)))) {
-
- terms['$<<'](secondary);
- if ($truthy((tertiary = attrs['$[]'](3)))) {
- terms['$<<'](tertiary)};};
- if ($truthy((see_also = attrs['$[]']("see-also")))) {
-
- $writer = ["see-also", (function() {if ($truthy(see_also['$include?'](","))) {
- return $send(see_also.$split(","), 'map', [], ($$31 = function(it){var self = $$31.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- return it.$lstrip();}, $$31.$$s = self, $$31.$$arity = 1, $$31))
- } else {
- return [see_also]
- }; return nil; })()];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- } else {
- attrs = $hash2(["terms"], {"terms": (terms = attrlist)})
- }
- } else {
- attrs = $hash2(["terms"], {"terms": (terms = self.$split_simple_csv(attrlist))})
- };
- return $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": attrs})).$convert();}
- else if ("indexterm2"['$===']($case)) {
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- if ($truthy((term = self.$normalize_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), true, true))['$include?']("="))) {
-
- term = ($truthy($c = ($truthy($d = (attrs = $$($nesting, 'AttributeList').$new(term, self).$parse())['$[]'](1)) ? $d : (attrs = nil))) ? $c : term);
- if ($truthy(($truthy($c = attrs) ? (see_also = attrs['$[]']("see-also")) : $c))) {
-
- $writer = ["see-also", (function() {if ($truthy(see_also['$include?'](","))) {
- return $send(see_also.$split(","), 'map', [], ($$32 = function(it){var self = $$32.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- return it.$lstrip();}, $$32.$$s = self, $$32.$$arity = 1, $$32))
- } else {
- return [see_also]
- }; return nil; })()];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};};
- return $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["attributes", "type"], {"attributes": attrs, "type": "visible"})).$convert();}
- else {
- text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3));
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- if ($truthy(($truthy($c = text['$start_with?']("(")) ? text['$end_with?'](")") : $c))) {
-
- text = text.$slice(1, $rb_minus(text.$length(), 2));
- $c = [true, "(", ")"], (visible = $c[0]), (before = $c[1]), (after = $c[2]), $c;
- } else {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());
- }
- } else {
-
- visible = true;
- if ($truthy(text['$start_with?']("("))) {
- if ($truthy(text['$end_with?'](")"))) {
- $c = [text.$slice(1, $rb_minus(text.$length(), 2)), false], (text = $c[0]), (visible = $c[1]), $c
- } else {
- $c = [text.$slice(1, text.$length()), "(", ""], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c
- }
- } else if ($truthy(text['$end_with?'](")"))) {
- $c = [text.$chop(), "", ")"], (text = $c[0]), (before = $c[1]), (after = $c[2]), $c};
- };
- if ($truthy(visible)) {
-
- if ($truthy((term = self.$normalize_text(text, true))['$include?'](";&"))) {
- if ($truthy(term['$include?'](" >> "))) {
-
- $d = term.$partition(" >> "), $c = Opal.to_ary($d), (term = ($c[0] == null ? nil : $c[0])), (_ = ($c[1] == null ? nil : $c[1])), (see = ($c[2] == null ? nil : $c[2])), $d;
- attrs = $hash2(["see"], {"see": see});
- } else if ($truthy(term['$include?'](" &> "))) {
-
- $d = term.$split(" &> "), $c = Opal.to_ary($d), (term = ($c[0] == null ? nil : $c[0])), (see_also = $slice.call($c, 1)), $d;
- attrs = $hash2(["see-also"], {"see-also": see_also});}};
- subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", term, $hash2(["attributes", "type"], {"attributes": attrs, "type": "visible"})).$convert();
- } else {
-
- attrs = $hash2([], {});
- if ($truthy((terms = self.$normalize_text(text, true))['$include?'](";&"))) {
- if ($truthy(terms['$include?'](" >> "))) {
-
- $d = terms.$partition(" >> "), $c = Opal.to_ary($d), (terms = ($c[0] == null ? nil : $c[0])), (_ = ($c[1] == null ? nil : $c[1])), (see = ($c[2] == null ? nil : $c[2])), $d;
-
- $writer = ["see", see];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else if ($truthy(terms['$include?'](" &> "))) {
-
- $d = terms.$split(" &> "), $c = Opal.to_ary($d), (terms = ($c[0] == null ? nil : $c[0])), (see_also = $slice.call($c, 1)), $d;
-
- $writer = ["see-also", see_also];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;}};
-
- $writer = ["terms", (terms = self.$split_simple_csv(terms))];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- subbed_term = $$($nesting, 'Inline').$new(self, "indexterm", nil, $hash2(["attributes"], {"attributes": attrs})).$convert();
- };
- if ($truthy(before)) {
- return "" + (before) + (subbed_term) + (after)
- } else {
- return subbed_term
- };}})()}, $$30.$$s = self, $$30.$$arity = 0, $$30))};
- if ($truthy(($truthy($a = found_colon) ? text['$include?']("://") : $a))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineLinkRx')], ($$33 = function(){var self = $$33.$$s || this, $c, $d, target = nil, prefix = nil, suffix = nil, $case = nil, attrs = nil, link_opts = nil, $writer = nil;
-
-
- if ($truthy((target = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)))['$start_with?']($$($nesting, 'RS')))) {
- return "" + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](1))) + (target.$slice(1, target.$length())) + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](4)));};
- $c = [(($d = $gvars['~']) === nil ? nil : $d['$[]'](1)), ""], (prefix = $c[0]), (suffix = $c[1]), $c;
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](4)))) {
-
- if (prefix['$==']("link:")) {
- prefix = ""};
- text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](4));
- } else {
-
- $case = prefix;
- if ("link:"['$===']($case) || "\""['$===']($case) || "'"['$===']($case)) {return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0));};
- text = "";
- $case = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3));
- if (")"['$===']($case) || "?"['$===']($case) || "!"['$===']($case)) {
- target = target.$chop();
- if ($truthy((($c = (suffix = (($d = $gvars['~']) === nil ? nil : $d['$[]'](3)))['$=='](")")) ? target['$end_with?'](".", "?", "!") : (suffix = (($d = $gvars['~']) === nil ? nil : $d['$[]'](3)))['$=='](")")))) {
-
- suffix = $rb_plus(target['$[]'](-1), suffix);
- target = target.$chop();};
- if ($truthy(target['$end_with?']("://"))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0));};}
- else if (";"['$===']($case)) {
- if ($truthy(($truthy($c = prefix['$start_with?']("<")) ? target['$end_with?'](">") : $c))) {
-
- prefix = prefix.$slice(4, prefix.$length());
- target = target.$slice(0, $rb_minus(target.$length(), 4));
- } else if ($truthy((target = target.$chop())['$end_with?'](")"))) {
-
- target = target.$chop();
- suffix = ");";
- } else {
- suffix = ";"
- };
- if ($truthy(target['$end_with?']("://"))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0));};}
- else if (":"['$===']($case)) {
- if ($truthy((target = target.$chop())['$end_with?'](")"))) {
-
- target = target.$chop();
- suffix = "):";
- } else {
- suffix = ":"
- };
- if ($truthy(target['$end_with?']("://"))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0));};};
- };
- $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c;
- if ($truthy(text['$empty?']())) {
- } else {
-
- if ($truthy(text['$include?']($$($nesting, 'R_SB')))) {
- text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))};
- if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) {
-
- $d = self.$extract_attributes_from_text(text, ""), $c = Opal.to_ary($d), (text = ($c[0] == null ? nil : $c[0])), (attrs = ($c[1] == null ? nil : $c[1])), $d;
-
- $writer = ["id", attrs['$[]']("id")];
- $send(link_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- if ($truthy(text['$end_with?']("^"))) {
-
- text = text.$chop();
- if ($truthy(attrs)) {
- ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- } else {
- attrs = $hash2(["window"], {"window": "_blank"})
- };};
- };
- if ($truthy(text['$empty?']())) {
-
- text = (function() {if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) {
-
- return target.$sub($$($nesting, 'UriSniffRx'), "");
- } else {
- return target
- }; return nil; })();
- if ($truthy(attrs)) {
-
- $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) {
- return "" + "bare " + (attrs['$[]']("role"))
- } else {
- return "bare"
- }; return nil; })()];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
- attrs = $hash2(["role"], {"role": "bare"})
- };};
- doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy(attrs)) {
-
- $writer = ["attributes", attrs];
- $send(link_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return "" + (prefix) + ($$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert()) + (suffix);}, $$33.$$s = self, $$33.$$arity = 0, $$33))};
- if ($truthy(($truthy($a = found_macroish) ? ($truthy($b = text['$include?']("link:")) ? $b : text['$include?']("ilto:")) : $a))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineLinkMacroRx')], ($$34 = function(){var self = $$34.$$s || this, $c, $d, mailto = nil, target = nil, mailto_text = nil, attrs = nil, link_opts = nil, $writer = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());
- } else if ($truthy((mailto = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1))))) {
- target = $rb_plus("mailto:", (mailto_text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))))
- } else {
- target = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))
- };
- $c = [nil, $hash2(["type"], {"type": "link"})], (attrs = $c[0]), (link_opts = $c[1]), $c;
- if ($truthy((text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))['$empty?']())) {
- } else {
-
- if ($truthy(text['$include?']($$($nesting, 'R_SB')))) {
- text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))};
- if ($truthy(mailto)) {
- if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?'](",") : $c))) {
-
- $d = self.$extract_attributes_from_text(text, ""), $c = Opal.to_ary($d), (text = ($c[0] == null ? nil : $c[0])), (attrs = ($c[1] == null ? nil : $c[1])), $d;
-
- $writer = ["id", attrs['$[]']("id")];
- $send(link_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(attrs['$key?'](2))) {
- if ($truthy(attrs['$key?'](3))) {
- target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$encode_uri_component(attrs['$[]'](2))) + "&body=" + ($$($nesting, 'Helpers').$encode_uri_component(attrs['$[]'](3)))
- } else {
- target = "" + (target) + "?subject=" + ($$($nesting, 'Helpers').$encode_uri_component(attrs['$[]'](2)))
- }};}
- } else if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) {
-
- $d = self.$extract_attributes_from_text(text, ""), $c = Opal.to_ary($d), (text = ($c[0] == null ? nil : $c[0])), (attrs = ($c[1] == null ? nil : $c[1])), $d;
-
- $writer = ["id", attrs['$[]']("id")];
- $send(link_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- if ($truthy(text['$end_with?']("^"))) {
-
- text = text.$chop();
- if ($truthy(attrs)) {
- ($truthy($c = attrs['$[]']("window")) ? $c : (($writer = ["window", "_blank"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- } else {
- attrs = $hash2(["window"], {"window": "_blank"})
- };};
- };
- if ($truthy(text['$empty?']())) {
- if ($truthy(mailto)) {
- text = mailto_text
- } else {
-
- if ($truthy(doc_attrs['$key?']("hide-uri-scheme"))) {
- if ($truthy((text = target.$sub($$($nesting, 'UriSniffRx'), ""))['$empty?']())) {
- text = target}
- } else {
- text = target
- };
- if ($truthy(attrs)) {
-
- $writer = ["role", (function() {if ($truthy(attrs['$key?']("role"))) {
- return "" + "bare " + (attrs['$[]']("role"))
- } else {
- return "bare"
- }; return nil; })()];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
- attrs = $hash2(["role"], {"role": "bare"})
- };
- }};
- doc.$register("links", (($writer = ["target", target]), $send(link_opts, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy(attrs)) {
-
- $writer = ["attributes", attrs];
- $send(link_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return $$($nesting, 'Inline').$new(self, "anchor", text, link_opts).$convert();}, $$34.$$s = self, $$34.$$arity = 0, $$34))};
- if ($truthy(text['$include?']("@"))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineEmailRx')], ($$35 = function(){var self = $$35.$$s || this, $c, target = nil, address = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) {
- return (function() {if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](1))['$==']($$($nesting, 'RS'))) {
-
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());
- } else {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0))
- }; return nil; })();};
- target = $rb_plus("mailto:", (address = (($c = $gvars['~']) === nil ? nil : $c['$[]'](0))));
- doc.$register("links", target);
- return $$($nesting, 'Inline').$new(self, "anchor", address, $hash2(["type", "target"], {"type": "link", "target": target})).$convert();}, $$35.$$s = self, $$35.$$arity = 0, $$35))};
- if ($truthy(($truthy($a = ($truthy($b = found_square_bracket) ? self.context['$==']("list_item") : $b)) ? self.parent.$style()['$==']("bibliography") : $a))) {
- text = $send(text, 'sub', [$$($nesting, 'InlineBiblioAnchorRx')], ($$36 = function(){var self = $$36.$$s || this, $c;
-
- return $$($nesting, 'Inline').$new(self, "anchor", (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), $hash2(["type", "id"], {"type": "bibref", "id": (($c = $gvars['~']) === nil ? nil : $c['$[]'](1))})).$convert()}, $$36.$$s = self, $$36.$$arity = 0, $$36))};
- if ($truthy(($truthy($a = ($truthy($b = found_square_bracket) ? text['$include?']("[[") : $b)) ? $a : ($truthy($b = found_macroish) ? text['$include?']("or:") : $b)))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineAnchorRx')], ($$37 = function(){var self = $$37.$$s || this, $c, $d, id = nil, reftext = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- if ($truthy((id = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))))) {
- reftext = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))
- } else {
-
- id = (($c = $gvars['~']) === nil ? nil : $c['$[]'](4));
- if ($truthy(($truthy($c = (reftext = (($d = $gvars['~']) === nil ? nil : $d['$[]'](5)))) ? reftext['$include?']($$($nesting, 'R_SB')) : $c))) {
- reftext = reftext.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))};
- };
- return $$($nesting, 'Inline').$new(self, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id})).$convert();}, $$37.$$s = self, $$37.$$arity = 0, $$37))};
- if ($truthy(($truthy($a = ($truthy($b = text['$include?']("&")) ? text['$include?'](";&l") : $b)) ? $a : ($truthy($b = found_macroish) ? text['$include?']("xref:") : $b)))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineXrefMacroRx')], ($$38 = function(){var self = $$38.$$s || this, $c, $d, attrs = nil, refid = nil, macro = nil, fragment = nil, hash_idx = nil, fragment_len = nil, path = nil, src2src = nil, target = nil, $writer = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- attrs = $hash2([], {});
- if ($truthy((refid = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1))))) {
-
- $d = refid.$split(",", 2), $c = Opal.to_ary($d), (refid = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d;
- if ($truthy(text)) {
- text = text.$lstrip()};
- } else {
-
- macro = true;
- refid = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2));
- if ($truthy((text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))))) {
-
- if ($truthy(text['$include?']($$($nesting, 'R_SB')))) {
- text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))};
- if ($truthy(($truthy($c = doc.$compat_mode()['$!']()) ? text['$include?']("=") : $c))) {
- $d = self.$extract_attributes_from_text(text), $c = Opal.to_ary($d), (text = ($c[0] == null ? nil : $c[0])), (attrs = ($c[1] == null ? nil : $c[1])), $d};};
- };
- if ($truthy(doc.$compat_mode())) {
- fragment = refid
- } else if ($truthy((hash_idx = refid.$index("#")))) {
- if ($truthy($rb_gt(hash_idx, 0))) {
-
- if ($truthy($rb_gt((fragment_len = $rb_minus($rb_minus(refid.$length(), 1), hash_idx)), 0))) {
- $c = [refid.$slice(0, hash_idx), refid.$slice($rb_plus(hash_idx, 1), fragment_len)], (path = $c[0]), (fragment = $c[1]), $c
- } else {
- path = refid.$chop()
- };
- if ($truthy(macro)) {
- if ($truthy(path['$end_with?'](".adoc"))) {
- src2src = (path = path.$slice(0, $rb_minus(path.$length(), 5)))
- } else if ($truthy($$($nesting, 'Helpers')['$extname?'](path)['$!']())) {
- src2src = path}
- } else if ($truthy($send(path, 'end_with?', Opal.to_a($$($nesting, 'ASCIIDOC_EXTENSIONS').$keys())))) {
- src2src = (path = path.$slice(0, path.$rindex(".")))
- } else {
- src2src = path
- };
- } else {
- $c = [refid, refid.$slice(1, refid.$length())], (target = $c[0]), (fragment = $c[1]), $c
- }
- } else if ($truthy(macro)) {
- if ($truthy(refid['$end_with?'](".adoc"))) {
- src2src = (path = refid.$slice(0, $rb_minus(refid.$length(), 5)))
- } else if ($truthy($$($nesting, 'Helpers')['$extname?'](refid))) {
- path = refid
- } else {
- fragment = refid
- }
- } else {
- fragment = refid
- };
- if ($truthy(target)) {
-
- refid = fragment;
- if ($truthy(($truthy($c = self.$logger()['$info?']()) ? doc.$catalog()['$[]']("refs")['$[]'](refid)['$!']() : $c))) {
- self.$logger().$info("" + "possible invalid reference: " + (refid))};
- } else if ($truthy(path)) {
- if ($truthy(($truthy($c = src2src) ? ($truthy($d = doc.$attributes()['$[]']("docname")['$=='](path)) ? $d : doc.$catalog()['$[]']("includes")['$[]'](path)) : $c))) {
- if ($truthy(fragment)) {
-
- $c = [fragment, nil, "" + "#" + (fragment)], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c;
- if ($truthy(($truthy($c = self.$logger()['$info?']()) ? doc.$catalog()['$[]']("refs")['$[]'](refid)['$!']() : $c))) {
- self.$logger().$info("" + "possible invalid reference: " + (refid))};
- } else {
- $c = [nil, nil, "#"], (refid = $c[0]), (path = $c[1]), (target = $c[2]), $c
- }
- } else {
-
- $c = [path, "" + (($truthy($d = doc.$attributes()['$[]']("relfileprefix")) ? $d : "")) + (path) + ((function() {if ($truthy(src2src)) {
-
- return doc.$attributes().$fetch("relfilesuffix", doc.$outfilesuffix());
- } else {
- return ""
- }; return nil; })())], (refid = $c[0]), (path = $c[1]), $c;
- if ($truthy(fragment)) {
- $c = ["" + (refid) + "#" + (fragment), "" + (path) + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c
- } else {
- target = path
- };
- }
- } else if ($truthy(($truthy($c = doc.$compat_mode()) ? $c : $$($nesting, 'Compliance').$natural_xrefs()['$!']()))) {
-
- $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c;
- if ($truthy(($truthy($c = self.$logger()['$info?']()) ? doc.$catalog()['$[]']("refs")['$[]'](refid)['$!']() : $c))) {
- self.$logger().$info("" + "possible invalid reference: " + (refid))};
- } else if ($truthy(doc.$catalog()['$[]']("refs")['$[]'](fragment))) {
- $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c
- } else if ($truthy(($truthy($c = ($truthy($d = fragment['$include?'](" ")) ? $d : fragment.$downcase()['$!='](fragment))) ? (refid = doc.$resolve_id(fragment)) : $c))) {
- $c = [refid, "" + "#" + (refid)], (fragment = $c[0]), (target = $c[1]), $c
- } else {
-
- $c = [fragment, "" + "#" + (fragment)], (refid = $c[0]), (target = $c[1]), $c;
- if ($truthy(self.$logger()['$info?']())) {
- self.$logger().$info("" + "possible invalid reference: " + (refid))};
- };
-
- $writer = ["path", path];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["fragment", fragment];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["refid", refid];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return $$($nesting, 'Inline').$new(self, "anchor", text, $hash2(["type", "target", "attributes"], {"type": "xref", "target": target, "attributes": attrs})).$convert();}, $$38.$$s = self, $$38.$$arity = 0, $$38))};
- if ($truthy(($truthy($a = found_macroish) ? text['$include?']("tnote") : $a))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineFootnoteMacroRx')], ($$39 = function(){var self = $$39.$$s || this, $c, $d, $e, $$40, id = nil, footnote = nil, index = nil, type = nil, target = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](1)))) {
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))) {
-
- $d = (($e = $gvars['~']) === nil ? nil : $e['$[]'](3)).$split(",", 2), $c = Opal.to_ary($d), (id = ($c[0] == null ? nil : $c[0])), (text = ($c[1] == null ? nil : $c[1])), $d;
- if ($truthy(doc.$compat_mode())) {
- } else {
- self.$logger().$warn("" + "found deprecated footnoteref macro: " + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))) + "; use footnote macro with target instead")
- };
- } else {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0));
- }
- } else {
-
- id = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2));
- text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3));
- };
- if ($truthy(id)) {
- if ($truthy((footnote = $send(doc.$footnotes(), 'find', [], ($$40 = function(candidate){var self = $$40.$$s || this;
-
-
-
- if (candidate == null) {
- candidate = nil;
- };
- return candidate.$id()['$=='](id);}, $$40.$$s = self, $$40.$$arity = 1, $$40))))) {
-
- $c = [footnote.$index(), footnote.$text()], (index = $c[0]), (text = $c[1]), $c;
- $c = ["xref", id, nil], (type = $c[0]), (target = $c[1]), (id = $c[2]), $c;
- } else if ($truthy(text)) {
-
- text = self.$restore_passthroughs(self.$normalize_text(text, true, true));
- index = doc.$counter("footnote-number");
- doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text));
- $c = ["ref", nil], (type = $c[0]), (target = $c[1]), $c;
- } else {
-
- self.$logger().$warn("" + "invalid footnote reference: " + (id));
- $c = ["xref", id, id, nil], (type = $c[0]), (target = $c[1]), (text = $c[2]), (id = $c[3]), $c;
- }
- } else if ($truthy(text)) {
-
- text = self.$restore_passthroughs(self.$normalize_text(text, true, true));
- index = doc.$counter("footnote-number");
- doc.$register("footnotes", $$$($$($nesting, 'Document'), 'Footnote').$new(index, id, text));
- type = (target = nil);
- } else {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0));
- };
- return $$($nesting, 'Inline').$new(self, "footnote", text, $hash2(["attributes", "id", "target", "type"], {"attributes": $hash2(["index"], {"index": index}), "id": id, "target": target, "type": type})).$convert();}, $$39.$$s = self, $$39.$$arity = 0, $$39))};
- return text;
- }, $Substitutors_sub_macros$19.$$arity = 1);
-
- Opal.def(self, '$sub_post_replacements', $Substitutors_sub_post_replacements$41 = function $$sub_post_replacements(text) {
- var $a, $$42, $$43, self = this, lines = nil, last = nil;
- if (self.attributes == null) self.attributes = nil;
- if (self.document == null) self.document = nil;
-
- if ($truthy(($truthy($a = self.attributes['$[]']("hardbreaks-option")) ? $a : self.document.$attributes()['$[]']("hardbreaks-option")))) {
-
- lines = text.$split($$($nesting, 'LF'), -1);
- if ($truthy($rb_lt(lines.$size(), 2))) {
- return text};
- last = lines.$pop();
- return $send(lines, 'map', [], ($$42 = function(line){var self = $$42.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return $$($nesting, 'Inline').$new(self, "break", (function() {if ($truthy(line['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) {
-
- return line.$slice(0, $rb_minus(line.$length(), 2));
- } else {
- return line
- }; return nil; })(), $hash2(["type"], {"type": "line"})).$convert();}, $$42.$$s = self, $$42.$$arity = 1, $$42))['$<<'](last).$join($$($nesting, 'LF'));
- } else if ($truthy(($truthy($a = text['$include?']($$($nesting, 'PLUS'))) ? text['$include?']($$($nesting, 'HARD_LINE_BREAK')) : $a))) {
- return $send(text, 'gsub', [$$($nesting, 'HardLineBreakRx')], ($$43 = function(){var self = $$43.$$s || this, $b;
-
- return $$($nesting, 'Inline').$new(self, "break", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), $hash2(["type"], {"type": "line"})).$convert()}, $$43.$$s = self, $$43.$$arity = 0, $$43))
- } else {
- return text
- }
- }, $Substitutors_sub_post_replacements$41.$$arity = 1);
-
- Opal.def(self, '$sub_source', $Substitutors_sub_source$44 = function $$sub_source(source, process_callouts) {
- var self = this;
-
- if ($truthy(process_callouts)) {
- return self.$sub_callouts(self.$sub_specialchars(source))
- } else {
-
- return self.$sub_specialchars(source);
- }
- }, $Substitutors_sub_source$44.$$arity = 2);
-
- Opal.def(self, '$sub_callouts', $Substitutors_sub_callouts$45 = function $$sub_callouts(text) {
- var $$46, self = this, callout_rx = nil, autonum = nil;
-
-
- callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) {
- return $$($nesting, 'CalloutSourceRxMap')['$[]'](self.$attr("line-comment"))
- } else {
- return $$($nesting, 'CalloutSourceRx')
- }; return nil; })();
- autonum = 0;
- return $send(text, 'gsub', [callout_rx], ($$46 = function(){var self = $$46.$$s || this, $a, $b;
- if (self.document == null) self.document = nil;
-
- if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) {
- return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$($nesting, 'RS'), "")
- } else {
- return $$($nesting, 'Inline').$new(self, "callout", (function() {if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4))['$=='](".")) {
- return (autonum = $rb_plus(autonum, 1)).$to_s()
- } else {
- return (($a = $gvars['~']) === nil ? nil : $a['$[]'](4))
- }; return nil; })(), $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": ($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))) ? $a : (function() {if ((($b = $gvars['~']) === nil ? nil : $b['$[]'](3))['$==']("--")) {
- return [""]
- } else {
- return nil
- }; return nil; })())})})).$convert()
- }}, $$46.$$s = self, $$46.$$arity = 0, $$46));
- }, $Substitutors_sub_callouts$45.$$arity = 1);
-
- Opal.def(self, '$highlight_source', $Substitutors_highlight_source$47 = function $$highlight_source(source, process_callouts) {
- var $a, $b, $c, self = this, syntax_hl = nil, callout_marks = nil, doc_attrs = nil, syntax_hl_name = nil, linenums_mode = nil, start_line_number = nil, highlight_lines = nil, highlighted = nil, source_offset = nil;
- if (self.document == null) self.document = nil;
- if (self.passthroughs == null) self.passthroughs = nil;
-
-
- if ($truthy(($truthy($a = (syntax_hl = self.document.$syntax_highlighter())) ? syntax_hl['$highlight?']() : $a))) {
- } else {
- return self.$sub_source(source, process_callouts)
- };
- if ($truthy(process_callouts)) {
- $b = self.$extract_callouts(source), $a = Opal.to_ary($b), (source = ($a[0] == null ? nil : $a[0])), (callout_marks = ($a[1] == null ? nil : $a[1])), $b};
- doc_attrs = self.document.$attributes();
- syntax_hl_name = syntax_hl.$name();
- if ($truthy((linenums_mode = (function() {if ($truthy(self['$attr?']("linenums"))) {
- return ($truthy($a = doc_attrs['$[]']("" + (syntax_hl_name) + "-linenums-mode")) ? $a : "table").$to_sym()
- } else {
- return nil
- }; return nil; })()))) {
- if ($truthy($rb_lt((start_line_number = self.$attr("start", 1).$to_i()), 1))) {
- start_line_number = 1}};
- if ($truthy(self['$attr?']("highlight"))) {
- highlight_lines = self.$resolve_lines_to_highlight(source, self.$attr("highlight"), start_line_number)};
- $b = syntax_hl.$highlight(self, source, self.$attr("language"), $hash2(["callouts", "css_mode", "highlight_lines", "number_lines", "start_line_number", "style"], {"callouts": callout_marks, "css_mode": ($truthy($c = doc_attrs['$[]']("" + (syntax_hl_name) + "-css")) ? $c : "class").$to_sym(), "highlight_lines": highlight_lines, "number_lines": linenums_mode, "start_line_number": start_line_number, "style": doc_attrs['$[]']("" + (syntax_hl_name) + "-style")})), $a = Opal.to_ary($b), (highlighted = ($a[0] == null ? nil : $a[0])), (source_offset = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy(self.passthroughs['$empty?']())) {
- } else {
- highlighted = highlighted.$gsub($$($nesting, 'HighlightedPassSlotRx'), "" + ($$($nesting, 'PASS_START')) + "\\1" + ($$($nesting, 'PASS_END')))
- };
- if ($truthy(callout_marks['$nil_or_empty?']())) {
- return highlighted
- } else {
-
- return self.$restore_callouts(highlighted, callout_marks, source_offset);
- };
- }, $Substitutors_highlight_source$47.$$arity = 2);
-
- Opal.def(self, '$resolve_lines_to_highlight', $Substitutors_resolve_lines_to_highlight$48 = function $$resolve_lines_to_highlight(source, spec, start) {
- var $$49, $$50, self = this, lines = nil, shift = nil;
-
-
-
- if (start == null) {
- start = nil;
- };
- lines = [];
- if ($truthy(spec['$include?'](" "))) {
- spec = spec.$delete(" ")};
- $send((function() {if ($truthy(spec['$include?'](","))) {
-
- return spec.$split(",");
- } else {
-
- return spec.$split(";");
- }; return nil; })(), 'map', [], ($$49 = function(entry){var self = $$49.$$s || this, $a, $b, negate = nil, delim = nil, from = nil, to = nil, line = nil;
-
-
-
- if (entry == null) {
- entry = nil;
- };
- if ($truthy(entry['$start_with?']("!"))) {
-
- entry = entry.$slice(1, entry.$length());
- negate = true;};
- if ($truthy((delim = (function() {if ($truthy(entry['$include?'](".."))) {
- return ".."
- } else {
-
- if ($truthy(entry['$include?']("-"))) {
- return "-"
- } else {
- return nil
- };
- }; return nil; })()))) {
-
- $b = entry.$partition(delim), $a = Opal.to_ary($b), (from = ($a[0] == null ? nil : $a[0])), (delim = ($a[1] == null ? nil : $a[1])), (to = ($a[2] == null ? nil : $a[2])), $b;
- if ($truthy(($truthy($a = to['$empty?']()) ? $a : $rb_lt((to = to.$to_i()), 0)))) {
- to = $rb_plus(source.$count($$($nesting, 'LF')), 1)};
- if ($truthy(negate)) {
- return (lines = $rb_minus(lines, Opal.Range.$new(from.$to_i(), to, false).$to_a()))
- } else {
- return (lines = lines['$|'](Opal.Range.$new(from.$to_i(), to, false).$to_a()))
- };
- } else if ($truthy(negate)) {
- return lines.$delete(entry.$to_i())
- } else if ($truthy(lines['$include?']((line = entry.$to_i()))['$!']())) {
- return lines['$<<'](line)
- } else {
- return nil
- };}, $$49.$$s = self, $$49.$$arity = 1, $$49));
- if ((shift = (function() {if ($truthy(start)) {
- return $rb_minus(start, 1)
- } else {
- return 0
- }; return nil; })())['$=='](0)) {
- } else {
- lines = $send(lines, 'map', [], ($$50 = function(it){var self = $$50.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- return $rb_minus(it, shift);}, $$50.$$s = self, $$50.$$arity = 1, $$50))
- };
- return lines.$sort();
- }, $Substitutors_resolve_lines_to_highlight$48.$$arity = -3);
-
- Opal.def(self, '$extract_passthroughs', $Substitutors_extract_passthroughs$51 = function $$extract_passthroughs(text) {
- var $a, $b, $$52, $$53, $$54, self = this, compat_mode = nil, passthrus = nil, pass_inline_char1 = nil, pass_inline_char2 = nil, pass_inline_rx = nil;
- if (self.document == null) self.document = nil;
- if (self.passthroughs == null) self.passthroughs = nil;
-
-
- compat_mode = self.document.$compat_mode();
- passthrus = self.passthroughs;
- if ($truthy(($truthy($a = ($truthy($b = text['$include?']("++")) ? $b : text['$include?']("$$"))) ? $a : text['$include?']("ss:")))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlinePassMacroRx')], ($$52 = function(){var self = $$52.$$s || this, $c, boundary = nil, attrlist = nil, escape_count = nil, preceding = nil, old_behavior = nil, attributes = nil, subs = nil, $writer = nil, passthru_key = nil;
-
-
- if ($truthy((boundary = (($c = $gvars['~']) === nil ? nil : $c['$[]'](4))))) {
-
- if ($truthy(($truthy($c = compat_mode) ? boundary['$==']("++") : $c))) {
- return "" + ((function() {if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](2)))) {
- return "" + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](1))) + "[" + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](2))) + "]" + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))
- } else {
- return "" + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](1))) + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))
- }; return nil; })()) + "++" + (self.$extract_passthroughs((($c = $gvars['~']) === nil ? nil : $c['$[]'](5)))) + "++";};
- if ($truthy((attrlist = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2))))) {
- if ($truthy($rb_gt((escape_count = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$length()), 0))) {
- return "" + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](1))) + "[" + (attrlist) + "]" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](5))) + (boundary);
- } else if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](1))['$==']($$($nesting, 'RS'))) {
- preceding = "" + "[" + (attrlist) + "]"
- } else {
-
- if ($truthy((($c = boundary['$==']("++")) ? attrlist['$end_with?']("x-") : boundary['$==']("++")))) {
-
- old_behavior = true;
- attrlist = attrlist.$slice(0, $rb_minus(attrlist.$length(), 2));};
- attributes = self.$parse_quoted_text_attributes(attrlist);
- }
- } else if ($truthy($rb_gt((escape_count = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)).$length()), 0))) {
- return "" + ($rb_times($$($nesting, 'RS'), $rb_minus(escape_count, 1))) + (boundary) + ((($c = $gvars['~']) === nil ? nil : $c['$[]'](5))) + (boundary);};
- subs = (function() {if (boundary['$==']("+++")) {
- return []
- } else {
- return $$($nesting, 'BASIC_SUBS')
- }; return nil; })();
- if ($truthy(attributes)) {
- if ($truthy(old_behavior)) {
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs", "type", "attributes"], {"text": (($c = $gvars['~']) === nil ? nil : $c['$[]'](5)), "subs": $$($nesting, 'NORMAL_SUBS'), "type": "monospaced", "attributes": attributes})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs", "type", "attributes"], {"text": (($c = $gvars['~']) === nil ? nil : $c['$[]'](5)), "subs": subs, "type": "unquoted", "attributes": attributes})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }
- } else {
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs"], {"text": (($c = $gvars['~']) === nil ? nil : $c['$[]'](5)), "subs": subs})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- } else {
-
- if ((($c = $gvars['~']) === nil ? nil : $c['$[]'](6))['$==']($$($nesting, 'RS'))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- if ($truthy((subs = (($c = $gvars['~']) === nil ? nil : $c['$[]'](7))))) {
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs"], {"text": self.$normalize_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](8)), nil, true), "subs": self.$resolve_pass_subs(subs)})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text"], {"text": self.$normalize_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](8)), nil, true)})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- };
- return "" + (($truthy($c = preceding) ? $c : "")) + ($$($nesting, 'PASS_START')) + (passthru_key) + ($$($nesting, 'PASS_END'));}, $$52.$$s = self, $$52.$$arity = 0, $$52))};
- $b = $$($nesting, 'InlinePassRx')['$[]'](compat_mode), $a = Opal.to_ary($b), (pass_inline_char1 = ($a[0] == null ? nil : $a[0])), (pass_inline_char2 = ($a[1] == null ? nil : $a[1])), (pass_inline_rx = ($a[2] == null ? nil : $a[2])), $b;
- if ($truthy(($truthy($a = text['$include?'](pass_inline_char1)) ? $a : ($truthy($b = pass_inline_char2) ? text['$include?'](pass_inline_char2) : $b)))) {
- text = $send(text, 'gsub', [pass_inline_rx], ($$53 = function(){var self = $$53.$$s || this, $c, preceding = nil, attrlist = nil, quoted_text = nil, escape_mark = nil, format_mark = nil, content = nil, old_behavior = nil, attributes = nil, $writer = nil, passthru_key = nil, subs = nil;
-
-
- preceding = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1));
- attrlist = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2));
- if ($truthy((quoted_text = (($c = $gvars['~']) === nil ? nil : $c['$[]'](3)))['$start_with?']($$($nesting, 'RS')))) {
- escape_mark = $$($nesting, 'RS')};
- format_mark = (($c = $gvars['~']) === nil ? nil : $c['$[]'](4));
- content = (($c = $gvars['~']) === nil ? nil : $c['$[]'](5));
- if ($truthy(compat_mode)) {
- old_behavior = true
- } else if ($truthy((old_behavior = ($truthy($c = attrlist) ? attrlist['$end_with?']("x-") : $c)))) {
- attrlist = attrlist.$slice(0, $rb_minus(attrlist.$length(), 2))};
- if ($truthy(attrlist)) {
- if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) {
- return self.$extract_inner_passthrough(content, "" + (preceding) + "[" + (attrlist) + "]" + (escape_mark));
- } else if ($truthy(escape_mark)) {
- return "" + (preceding) + "[" + (attrlist) + "]" + (quoted_text.$slice(1, quoted_text.$length()));
- } else if (preceding['$==']($$($nesting, 'RS'))) {
- preceding = "" + "[" + (attrlist) + "]"
- } else {
- attributes = self.$parse_quoted_text_attributes(attrlist)
- }
- } else if ($truthy((($c = format_mark['$==']("`")) ? old_behavior['$!']() : format_mark['$==']("`")))) {
- return self.$extract_inner_passthrough(content, "" + (preceding) + (escape_mark));
- } else if ($truthy(escape_mark)) {
- return "" + (preceding) + (quoted_text.$slice(1, quoted_text.$length()));};
- if ($truthy(compat_mode)) {
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "monospaced"})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else if ($truthy(attributes)) {
- if ($truthy(old_behavior)) {
-
- subs = (function() {if (format_mark['$==']("`")) {
- return $$($nesting, 'BASIC_SUBS')
- } else {
- return $$($nesting, 'NORMAL_SUBS')
- }; return nil; })();
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": subs, "attributes": attributes, "type": "monospaced"})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs", "attributes", "type"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS'), "attributes": attributes, "type": "unquoted"})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }
- } else {
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs"], {"text": content, "subs": $$($nesting, 'BASIC_SUBS')})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- return "" + (preceding) + ($$($nesting, 'PASS_START')) + (passthru_key) + ($$($nesting, 'PASS_END'));}, $$53.$$s = self, $$53.$$arity = 0, $$53))};
- if ($truthy(($truthy($a = text['$include?'](":")) ? ($truthy($b = text['$include?']("stem:")) ? $b : text['$include?']("math:")) : $a))) {
- text = $send(text, 'gsub', [$$($nesting, 'InlineStemMacroRx')], ($$54 = function(){var self = $$54.$$s || this, $c, $d, type = nil, subs = nil, content = nil, $writer = nil, passthru_key = nil;
- if (self.document == null) self.document = nil;
-
-
- if ($truthy((($c = $gvars['~']) === nil ? nil : $c['$[]'](0))['$start_with?']($$($nesting, 'RS')))) {
- return (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$slice(1, (($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$length());};
- if ((type = (($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$to_sym())['$==']("stem")) {
- type = $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](self.document.$attributes()['$[]']("stem")).$to_sym()};
- subs = (($c = $gvars['~']) === nil ? nil : $c['$[]'](2));
- content = self.$normalize_text((($c = $gvars['~']) === nil ? nil : $c['$[]'](3)), nil, true);
- if ($truthy(($truthy($c = (($d = type['$==']("latexmath")) ? content['$start_with?']("$") : type['$==']("latexmath"))) ? content['$end_with?']("$") : $c))) {
- content = content.$slice(1, $rb_minus(content.$length(), 2))};
- subs = (function() {if ($truthy(subs)) {
-
- return self.$resolve_pass_subs(subs);
- } else {
-
- if ($truthy(self.document['$basebackend?']("html"))) {
- return $$($nesting, 'BASIC_SUBS')
- } else {
- return nil
- };
- }; return nil; })();
-
- $writer = [(passthru_key = passthrus.$size()), $hash2(["text", "subs", "type"], {"text": content, "subs": subs, "type": type})];
- $send(passthrus, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return "" + ($$($nesting, 'PASS_START')) + (passthru_key) + ($$($nesting, 'PASS_END'));}, $$54.$$s = self, $$54.$$arity = 0, $$54))};
- return text;
- }, $Substitutors_extract_passthroughs$51.$$arity = 1);
-
- Opal.def(self, '$restore_passthroughs', $Substitutors_restore_passthroughs$55 = function $$restore_passthroughs(text) {
- var $$56, self = this, passthrus = nil;
- if (self.passthroughs == null) self.passthroughs = nil;
-
-
- passthrus = self.passthroughs;
- return $send(text, 'gsub', [$$($nesting, 'PassSlotRx')], ($$56 = function(){var self = $$56.$$s || this, $a, pass = nil, subbed_text = nil, type = nil, attributes = nil, id = nil;
-
- if ($truthy((pass = passthrus['$[]']((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$to_i())))) {
-
- subbed_text = self.$apply_subs(pass['$[]']("text"), pass['$[]']("subs"));
- if ($truthy((type = pass['$[]']("type")))) {
-
- if ($truthy((attributes = pass['$[]']("attributes")))) {
- id = attributes['$[]']("id")};
- subbed_text = $$($nesting, 'Inline').$new(self, "quoted", subbed_text, $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert();};
- if ($truthy(subbed_text['$include?']($$($nesting, 'PASS_START')))) {
- return self.$restore_passthroughs(subbed_text)
- } else {
- return subbed_text
- };
- } else {
-
- self.$logger().$error("" + "unresolved passthrough detected: " + (text));
- return "??pass??";
- }}, $$56.$$s = self, $$56.$$arity = 0, $$56));
- }, $Substitutors_restore_passthroughs$55.$$arity = 1);
-
- Opal.def(self, '$resolve_subs', $Substitutors_resolve_subs$57 = function $$resolve_subs(subs, type, defaults, subject) {
- var $$58, self = this, candidates = nil, modifiers_present = nil, resolved = nil, invalid = nil;
-
-
-
- if (type == null) {
- type = "block";
- };
-
- if (defaults == null) {
- defaults = nil;
- };
-
- if (subject == null) {
- subject = nil;
- };
- if ($truthy(subs['$nil_or_empty?']())) {
- return nil};
- candidates = nil;
- if ($truthy(subs['$include?'](" "))) {
- subs = subs.$delete(" ")};
- modifiers_present = $$($nesting, 'SubModifierSniffRx')['$match?'](subs);
- $send(subs.$split(","), 'each', [], ($$58 = function(key){var self = $$58.$$s || this, $a, $b, modifier_operation = nil, first = nil, resolved_keys = nil, resolved_key = nil, candidate = nil, $case = nil;
-
-
-
- if (key == null) {
- key = nil;
- };
- modifier_operation = nil;
- if ($truthy(modifiers_present)) {
- if ((first = key.$chr())['$==']("+")) {
-
- modifier_operation = "append";
- key = key.$slice(1, key.$length());
- } else if (first['$==']("-")) {
-
- modifier_operation = "remove";
- key = key.$slice(1, key.$length());
- } else if ($truthy(key['$end_with?']("+"))) {
-
- modifier_operation = "prepend";
- key = key.$chop();}};
- key = key.$to_sym();
- if ($truthy((($a = type['$==']("inline")) ? ($truthy($b = key['$==']("verbatim")) ? $b : key['$==']("v")) : type['$==']("inline")))) {
- resolved_keys = $$($nesting, 'BASIC_SUBS')
- } else if ($truthy($$($nesting, 'SUB_GROUPS')['$key?'](key))) {
- resolved_keys = $$($nesting, 'SUB_GROUPS')['$[]'](key)
- } else if ($truthy(($truthy($a = (($b = type['$==']("inline")) ? key.$length()['$=='](1) : type['$==']("inline"))) ? $$($nesting, 'SUB_HINTS')['$key?'](key) : $a))) {
-
- resolved_key = $$($nesting, 'SUB_HINTS')['$[]'](key);
- if ($truthy((candidate = $$($nesting, 'SUB_GROUPS')['$[]'](resolved_key)))) {
- resolved_keys = candidate
- } else {
- resolved_keys = [resolved_key]
- };
- } else {
- resolved_keys = [key]
- };
- if ($truthy(modifier_operation)) {
-
- candidates = ($truthy($a = candidates) ? $a : (function() {if ($truthy(defaults)) {
-
- return defaults.$drop(0);
- } else {
- return []
- }; return nil; })());
- return (function() {$case = modifier_operation;
- if ("append"['$===']($case)) {return (candidates = $rb_plus(candidates, resolved_keys))}
- else if ("prepend"['$===']($case)) {return (candidates = $rb_plus(resolved_keys, candidates))}
- else if ("remove"['$===']($case)) {return (candidates = $rb_minus(candidates, resolved_keys))}
- else { return nil }})();
- } else {
-
- candidates = ($truthy($a = candidates) ? $a : []);
- return (candidates = $rb_plus(candidates, resolved_keys));
- };}, $$58.$$s = self, $$58.$$arity = 1, $$58));
- if ($truthy(candidates)) {
- } else {
- return nil
- };
- resolved = candidates['$&']($$($nesting, 'SUB_OPTIONS')['$[]'](type));
- if ($truthy($rb_minus(candidates, resolved)['$empty?']())) {
- } else {
-
- invalid = $rb_minus(candidates, resolved);
- self.$logger().$warn("" + "invalid substitution type" + ((function() {if ($truthy($rb_gt(invalid.$size(), 1))) {
- return "s"
- } else {
- return ""
- }; return nil; })()) + ((function() {if ($truthy(subject)) {
- return " for "
- } else {
- return ""
- }; return nil; })()) + (subject) + ": " + (invalid.$join(", ")));
- };
- return resolved;
- }, $Substitutors_resolve_subs$57.$$arity = -2);
-
- Opal.def(self, '$resolve_block_subs', $Substitutors_resolve_block_subs$59 = function $$resolve_block_subs(subs, defaults, subject) {
- var self = this;
-
- return self.$resolve_subs(subs, "block", defaults, subject)
- }, $Substitutors_resolve_block_subs$59.$$arity = 3);
-
- Opal.def(self, '$resolve_pass_subs', $Substitutors_resolve_pass_subs$60 = function $$resolve_pass_subs(subs) {
- var self = this;
-
- return self.$resolve_subs(subs, "inline", nil, "passthrough macro")
- }, $Substitutors_resolve_pass_subs$60.$$arity = 1);
-
- Opal.def(self, '$expand_subs', $Substitutors_expand_subs$61 = function $$expand_subs(subs, subject) {
- var $a, $$62, self = this, expanded_subs = nil;
-
-
-
- if (subject == null) {
- subject = nil;
- };
- if ($truthy($$$('::', 'Symbol')['$==='](subs))) {
- if (subs['$==']("none")) {
- return nil
- } else {
- return ($truthy($a = $$($nesting, 'SUB_GROUPS')['$[]'](subs)) ? $a : [subs])
- }
- } else if ($truthy($$$('::', 'Array')['$==='](subs))) {
-
- expanded_subs = [];
- $send(subs, 'each', [], ($$62 = function(key){var self = $$62.$$s || this, sub_group = nil;
-
-
-
- if (key == null) {
- key = nil;
- };
- if (key['$==']("none")) {
- return nil
- } else if ($truthy((sub_group = $$($nesting, 'SUB_GROUPS')['$[]'](key)))) {
- return (expanded_subs = $rb_plus(expanded_subs, sub_group))
- } else {
- return expanded_subs['$<<'](key)
- };}, $$62.$$s = self, $$62.$$arity = 1, $$62));
- if ($truthy(expanded_subs['$empty?']())) {
- return nil
- } else {
- return expanded_subs
- };
- } else {
- return self.$resolve_subs(subs, "inline", nil, subject)
- };
- }, $Substitutors_expand_subs$61.$$arity = -2);
-
- Opal.def(self, '$commit_subs', $Substitutors_commit_subs$63 = function $$commit_subs() {
- var $a, $b, $c, $d, self = this, default_subs = nil, $case = nil, custom_subs = nil, syntax_hl = nil, idx = nil, $writer = nil;
- if (self.default_subs == null) self.default_subs = nil;
- if (self.content_model == null) self.content_model = nil;
- if (self.context == null) self.context = nil;
- if (self.subs == null) self.subs = nil;
- if (self.attributes == null) self.attributes = nil;
- if (self.style == null) self.style = nil;
- if (self.document == null) self.document = nil;
-
-
- if ($truthy((default_subs = self.default_subs))) {
- } else {
- $case = self.content_model;
- if ("simple"['$===']($case)) {default_subs = $$($nesting, 'NORMAL_SUBS')}
- else if ("verbatim"['$===']($case)) {default_subs = (function() {if (self.context['$==']("verse")) {
- return $$($nesting, 'NORMAL_SUBS')
- } else {
- return $$($nesting, 'VERBATIM_SUBS')
- }; return nil; })()}
- else if ("raw"['$===']($case)) {default_subs = (function() {if (self.context['$==']("stem")) {
- return $$($nesting, 'BASIC_SUBS')
- } else {
- return $$($nesting, 'NO_SUBS')
- }; return nil; })()}
- else {return self.subs}
- };
- if ($truthy((custom_subs = self.attributes['$[]']("subs")))) {
- self.subs = ($truthy($a = self.$resolve_block_subs(custom_subs, default_subs, self.context)) ? $a : [])
- } else {
- self.subs = default_subs.$drop(0)
- };
- if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (($d = self.context['$==']("listing")) ? self.style['$==']("source") : self.context['$==']("listing"))) ? (syntax_hl = self.document.$syntax_highlighter()) : $c)) ? syntax_hl['$highlight?']() : $b)) ? (idx = self.subs.$index("specialcharacters")) : $a))) {
-
- $writer = [idx, "highlight"];
- $send(self.subs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return nil;
- }, $Substitutors_commit_subs$63.$$arity = 0);
-
- Opal.def(self, '$parse_attributes', $Substitutors_parse_attributes$64 = function $$parse_attributes(attrlist, posattrs, opts) {
- var $a, self = this, block = nil, into = nil;
- if (self.document == null) self.document = nil;
-
-
-
- if (posattrs == null) {
- posattrs = [];
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy((function() {if ($truthy(attrlist)) {
- return attrlist['$empty?']()
- } else {
- return true
- }; return nil; })())) {
- return $hash2([], {})};
- if ($truthy(opts['$[]']("unescape_input"))) {
- attrlist = self.$normalize_text(attrlist, true, true)};
- if ($truthy(($truthy($a = opts['$[]']("sub_input")) ? attrlist['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) {
- attrlist = self.document.$sub_attributes(attrlist)};
- if ($truthy(opts['$[]']("sub_result"))) {
- block = self};
- if ($truthy((into = opts['$[]']("into")))) {
- return $$($nesting, 'AttributeList').$new(attrlist, block).$parse_into(into, posattrs)
- } else {
- return $$($nesting, 'AttributeList').$new(attrlist, block).$parse(posattrs)
- };
- }, $Substitutors_parse_attributes$64.$$arity = -2);
- self.$private();
-
- Opal.def(self, '$extract_attributes_from_text', $Substitutors_extract_attributes_from_text$65 = function $$extract_attributes_from_text(text, default_text) {
- var self = this, attrlist = nil, resolved_text = nil, attrs = nil;
-
-
-
- if (default_text == null) {
- default_text = nil;
- };
- attrlist = (function() {if ($truthy(text['$include?']($$($nesting, 'LF')))) {
-
- return text.$tr($$($nesting, 'LF'), " ");
- } else {
- return text
- }; return nil; })();
- if ($truthy((resolved_text = (attrs = $$($nesting, 'AttributeList').$new(attrlist, self).$parse())['$[]'](1)))) {
- if (resolved_text['$=='](attrlist)) {
- return [text, attrs.$clear()]
- } else {
- return [resolved_text, attrs]
- }
- } else {
- return [default_text, attrs]
- };
- }, $Substitutors_extract_attributes_from_text$65.$$arity = -2);
-
- Opal.def(self, '$extract_callouts', $Substitutors_extract_callouts$66 = function $$extract_callouts(source) {
- var $$67, self = this, callout_marks = nil, autonum = nil, lineno = nil, last_lineno = nil, callout_rx = nil;
-
-
- callout_marks = $hash2([], {});
- autonum = (lineno = 0);
- last_lineno = nil;
- callout_rx = (function() {if ($truthy(self['$attr?']("line-comment"))) {
- return $$($nesting, 'CalloutExtractRxMap')['$[]'](self.$attr("line-comment"))
- } else {
- return $$($nesting, 'CalloutExtractRx')
- }; return nil; })();
- source = $send(source.$split($$($nesting, 'LF'), -1), 'map', [], ($$67 = function(line){var self = $$67.$$s || this, $$68;
-
-
-
- if (line == null) {
- line = nil;
- };
- lineno = $rb_plus(lineno, 1);
- return $send(line, 'gsub', [callout_rx], ($$68 = function(){var self = $$68.$$s || this, $a, $b, $writer = nil;
-
- if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))) {
- return (($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$sub($$($nesting, 'RS'), "")
- } else {
-
- ($truthy($a = callout_marks['$[]'](lineno)) ? $a : (($writer = [lineno, []]), $send(callout_marks, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<']([($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))) ? $a : (function() {if ((($b = $gvars['~']) === nil ? nil : $b['$[]'](3))['$==']("--")) {
- return [""]
- } else {
- return nil
- }; return nil; })()), (function() {if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](4))['$=='](".")) {
- return (autonum = $rb_plus(autonum, 1)).$to_s()
- } else {
- return (($a = $gvars['~']) === nil ? nil : $a['$[]'](4))
- }; return nil; })()]);
- last_lineno = lineno;
- return "";
- }}, $$68.$$s = self, $$68.$$arity = 0, $$68));}, $$67.$$s = self, $$67.$$arity = 1, $$67)).$join($$($nesting, 'LF'));
- if ($truthy(last_lineno)) {
- if (last_lineno['$=='](lineno)) {
- source = "" + (source) + ($$($nesting, 'LF'))}
- } else {
- callout_marks = nil
- };
- return [source, callout_marks];
- }, $Substitutors_extract_callouts$66.$$arity = 1);
-
- Opal.def(self, '$restore_callouts', $Substitutors_restore_callouts$69 = function $$restore_callouts(source, callout_marks, source_offset) {
- var $$70, self = this, preamble = nil, lineno = nil;
-
-
-
- if (source_offset == null) {
- source_offset = nil;
- };
- if ($truthy(source_offset)) {
-
- preamble = source.$slice(0, source_offset);
- source = source.$slice(source_offset, source.$length());
- } else {
- preamble = ""
- };
- lineno = 0;
- return $rb_plus(preamble, $send(source.$split($$($nesting, 'LF'), -1), 'map', [], ($$70 = function(line){var self = $$70.$$s || this, $a, $b, $$71, conums = nil, guard = nil, numeral = nil;
- if (self.document == null) self.document = nil;
-
-
-
- if (line == null) {
- line = nil;
- };
- if ($truthy((conums = callout_marks.$delete((lineno = $rb_plus(lineno, 1)))))) {
- if (conums.$size()['$=='](1)) {
-
- $b = conums['$[]'](0), $a = Opal.to_ary($b), (guard = ($a[0] == null ? nil : $a[0])), (numeral = ($a[1] == null ? nil : $a[1])), $b;
- return "" + (line) + ($$($nesting, 'Inline').$new(self, "callout", numeral, $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard})})).$convert());
- } else {
- return "" + (line) + ($send(conums, 'map', [], ($$71 = function(guard_it, numeral_it){var self = $$71.$$s || this;
- if (self.document == null) self.document = nil;
-
-
-
- if (guard_it == null) {
- guard_it = nil;
- };
-
- if (numeral_it == null) {
- numeral_it = nil;
- };
- return $$($nesting, 'Inline').$new(self, "callout", numeral_it, $hash2(["id", "attributes"], {"id": self.document.$callouts().$read_next_id(), "attributes": $hash2(["guard"], {"guard": guard_it})})).$convert();}, $$71.$$s = self, $$71.$$arity = 2, $$71)).$join(" "))
- }
- } else {
- return line
- };}, $$70.$$s = self, $$70.$$arity = 1, $$70)).$join($$($nesting, 'LF')));
- }, $Substitutors_restore_callouts$69.$$arity = -3);
-
- Opal.def(self, '$extract_inner_passthrough', $Substitutors_extract_inner_passthrough$72 = function $$extract_inner_passthrough(text, pre) {
- var $a, $b, self = this, $writer = nil, passthru_key = nil;
- if (self.passthroughs == null) self.passthroughs = nil;
-
- if ($truthy(($truthy($a = ($truthy($b = text['$end_with?']("+")) ? text['$start_with?']("+", "\\+") : $b)) ? $$($nesting, 'SinglePlusInlinePassRx')['$=~'](text) : $a))) {
- if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) {
- return "" + (pre) + "`+" + ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))) + "+`"
- } else {
-
-
- $writer = [(passthru_key = self.passthroughs.$size()), $hash2(["text", "subs"], {"text": (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), "subs": $$($nesting, 'BASIC_SUBS')})];
- $send(self.passthroughs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return "" + (pre) + "`" + ($$($nesting, 'PASS_START')) + (passthru_key) + ($$($nesting, 'PASS_END')) + "`";
- }
- } else {
- return "" + (pre) + "`" + (text) + "`"
- }
- }, $Substitutors_extract_inner_passthrough$72.$$arity = 2);
-
- Opal.def(self, '$convert_quoted_text', $Substitutors_convert_quoted_text$73 = function $$convert_quoted_text(match, type, scope) {
- var $a, self = this, attrs = nil, unescaped_attrs = nil, attrlist = nil, id = nil, attributes = nil;
-
-
- if ($truthy(match['$[]'](0)['$start_with?']($$($nesting, 'RS')))) {
- if ($truthy((($a = scope['$==']("constrained")) ? (attrs = match['$[]'](2)) : scope['$==']("constrained")))) {
- unescaped_attrs = "" + "[" + (attrs) + "]"
- } else {
- return match['$[]'](0).$slice(1, match['$[]'](0).$length())
- }};
- if (scope['$==']("constrained")) {
- if ($truthy(unescaped_attrs)) {
- return "" + (unescaped_attrs) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type"], {"type": type})).$convert())
- } else {
-
- if ($truthy((attrlist = match['$[]'](2)))) {
-
- id = (attributes = self.$parse_quoted_text_attributes(attrlist))['$[]']("id");
- if (type['$==']("mark")) {
- type = "unquoted"};};
- return "" + (match['$[]'](1)) + ($$($nesting, 'Inline').$new(self, "quoted", match['$[]'](3), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert());
- }
- } else {
-
- if ($truthy((attrlist = match['$[]'](1)))) {
-
- id = (attributes = self.$parse_quoted_text_attributes(attrlist))['$[]']("id");
- if (type['$==']("mark")) {
- type = "unquoted"};};
- return $$($nesting, 'Inline').$new(self, "quoted", match['$[]'](2), $hash2(["type", "id", "attributes"], {"type": type, "id": id, "attributes": attributes})).$convert();
- };
- }, $Substitutors_convert_quoted_text$73.$$arity = 3);
-
- Opal.def(self, '$do_replacement', $Substitutors_do_replacement$74 = function $$do_replacement(m, replacement, restore) {
- var self = this, captured = nil, $case = nil;
-
- if ($truthy((captured = m['$[]'](0))['$include?']($$($nesting, 'RS')))) {
- return captured.$sub($$($nesting, 'RS'), "")
- } else {
- return (function() {$case = restore;
- if ("none"['$===']($case)) {return replacement}
- else if ("bounding"['$===']($case)) {return $rb_plus($rb_plus(m['$[]'](1), replacement), m['$[]'](2))}
- else {return $rb_plus(m['$[]'](1), replacement)}})()
- }
- }, $Substitutors_do_replacement$74.$$arity = 3);
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- } else {
- nil
- };
-
- Opal.def(self, '$parse_quoted_text_attributes', $Substitutors_parse_quoted_text_attributes$75 = function $$parse_quoted_text_attributes(str) {
- var $a, $b, self = this, segments = nil, id = nil, more_roles = nil, roles = nil, attrs = nil, $writer = nil;
-
-
- if ($truthy(str['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- str = self.$sub_attributes(str)};
- if ($truthy(str['$include?'](","))) {
- str = str.$slice(0, str.$index(","))};
- if ($truthy((str = str.$strip())['$empty?']())) {
- return $hash2([], {})
- } else if ($truthy(($truthy($a = str['$start_with?'](".", "#")) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) {
-
- segments = str.$split("#", 2);
- if ($truthy($rb_gt(segments.$size(), 1))) {
- $b = segments['$[]'](1).$split("."), $a = Opal.to_ary($b), (id = ($a[0] == null ? nil : $a[0])), (more_roles = $slice.call($a, 1)), $b
- } else {
- more_roles = []
- };
- roles = (function() {if ($truthy(segments['$[]'](0)['$empty?']())) {
- return []
- } else {
- return segments['$[]'](0).$split(".")
- }; return nil; })();
- if ($truthy($rb_gt(roles.$size(), 1))) {
- roles.$shift()};
- if ($truthy($rb_gt(more_roles.$size(), 0))) {
- roles.$concat(more_roles)};
- attrs = $hash2([], {});
- if ($truthy(id)) {
-
- $writer = ["id", id];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(roles['$empty?']())) {
- } else {
-
- $writer = ["role", roles.$join(" ")];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- return attrs;
- } else {
- return $hash2(["role"], {"role": str})
- };
- }, $Substitutors_parse_quoted_text_attributes$75.$$arity = 1);
-
- Opal.def(self, '$normalize_text', $Substitutors_normalize_text$76 = function $$normalize_text(text, normalize_whitespace, unescape_closing_square_brackets) {
- var $a, self = this;
-
-
-
- if (normalize_whitespace == null) {
- normalize_whitespace = nil;
- };
-
- if (unescape_closing_square_brackets == null) {
- unescape_closing_square_brackets = nil;
- };
- if ($truthy(text['$empty?']())) {
- } else {
-
- if ($truthy(normalize_whitespace)) {
- text = text.$strip().$tr($$($nesting, 'LF'), " ")};
- if ($truthy(($truthy($a = unescape_closing_square_brackets) ? text['$include?']($$($nesting, 'R_SB')) : $a))) {
- text = text.$gsub($$($nesting, 'ESC_R_SB'), $$($nesting, 'R_SB'))};
- };
- return text;
- }, $Substitutors_normalize_text$76.$$arity = -2);
-
- Opal.def(self, '$split_simple_csv', $Substitutors_split_simple_csv$77 = function $$split_simple_csv(str) {
- var $$78, $$79, self = this, values = nil, accum = nil, quote_open = nil;
-
- if ($truthy(str['$empty?']())) {
- return []
- } else if ($truthy(str['$include?']("\""))) {
-
- values = [];
- accum = "";
- quote_open = nil;
- $send(str, 'each_char', [], ($$78 = function(c){var self = $$78.$$s || this, $case = nil;
-
-
-
- if (c == null) {
- c = nil;
- };
- return (function() {$case = c;
- if (","['$===']($case)) {if ($truthy(quote_open)) {
- return (accum = $rb_plus(accum, c))
- } else {
-
- values['$<<'](accum.$strip());
- return (accum = "");
- }}
- else if ("\""['$===']($case)) {return (quote_open = quote_open['$!']())}
- else {return (accum = $rb_plus(accum, c))}})();}, $$78.$$s = self, $$78.$$arity = 1, $$78));
- return values['$<<'](accum.$strip());
- } else {
- return $send(str.$split(","), 'map', [], ($$79 = function(it){var self = $$79.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- return it.$strip();}, $$79.$$s = self, $$79.$$arity = 1, $$79))
- }
- }, $Substitutors_split_simple_csv$77.$$arity = 1);
- })($nesting[0], $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/version"] = function(Opal) {
- 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;
-
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting);
-
- Opal.const_set($nesting[0], 'VERSION', "2.0.15")
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/abstract_node"] = function(Opal) {
- function $rb_minus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
- }
- function $rb_lt(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;
-
- Opal.add_stubs(['$include', '$attr_reader', '$attr_accessor', '$==', '$document', '$to_s', '$[]', '$merge', '$raise', '$converter', '$attributes', '$key?', '$[]=', '$-', '$delete', '$tap', '$new', '$each_key', '$end_with?', '$<<', '$slice', '$length', '$update', '$split', '$include?', '$===', '$join', '$empty?', '$apply_reftext_subs', '$attr?', '$attr', '$extname?', '$image_uri', '$<', '$safe', '$uriish?', '$encode_spaces_in_uri', '$normalize_web_path', '$generate_data_uri_from_uri', '$generate_data_uri', '$extname', '$normalize_system_path', '$readable?', '$strict_encode64', '$binread', '$warn', '$logger', '$require_library', '$!', '$open_uri', '$content_type', '$read', '$base_dir', '$root?', '$path_resolver', '$system_path', '$web_path', '$!=', '$prepare_source_string', '$fetch', '$read_asset']);
- 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, 'AbstractNode');
-
- var $nesting = [self].concat($parent_nesting), $AbstractNode_initialize$1, $AbstractNode_block$ques$2, $AbstractNode_inline$ques$3, $AbstractNode_converter$4, $AbstractNode_parent$eq$5, $AbstractNode_attr$6, $AbstractNode_attr$ques$7, $AbstractNode_set_attr$8, $AbstractNode_remove_attr$9, $AbstractNode_option$ques$10, $AbstractNode_set_option$11, $AbstractNode_enabled_options$12, $AbstractNode_update_attributes$15, $AbstractNode_role$16, $AbstractNode_roles$17, $AbstractNode_role$ques$18, $AbstractNode_has_role$ques$19, $AbstractNode_role$eq$20, $AbstractNode_add_role$21, $AbstractNode_remove_role$22, $AbstractNode_reftext$23, $AbstractNode_reftext$ques$24, $AbstractNode_icon_uri$25, $AbstractNode_image_uri$26, $AbstractNode_media_uri$27, $AbstractNode_generate_data_uri$28, $AbstractNode_generate_data_uri_from_uri$29, $AbstractNode_normalize_asset_path$31, $AbstractNode_normalize_system_path$32, $AbstractNode_normalize_web_path$33, $AbstractNode_read_asset$34, $AbstractNode_read_contents$35, $AbstractNode_is_uri$ques$38;
-
- self.$$prototype.document = self.$$prototype.attributes = self.$$prototype.parent = nil;
-
- self.$include($$($nesting, 'Substitutors'), $$($nesting, 'Logging'));
- self.$attr_reader("attributes");
- self.$attr_reader("context");
- self.$attr_reader("document");
- self.$attr_accessor("id");
- self.$attr_reader("node_name");
- self.$attr_reader("parent");
-
- Opal.def(self, '$initialize', $AbstractNode_initialize$1 = function $$initialize(parent, context, opts) {
- var self = this, attrs = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if (context['$==']("document")) {
- self.document = self
- } else if ($truthy(parent)) {
- self.document = (self.parent = parent).$document()};
- self.node_name = (self.context = context).$to_s();
- self.attributes = (function() {if ($truthy((attrs = opts['$[]']("attributes")))) {
- return attrs.$merge()
- } else {
- return $hash2([], {})
- }; return nil; })();
- return (self.passthroughs = []);
- }, $AbstractNode_initialize$1.$$arity = -3);
-
- Opal.def(self, '$block?', $AbstractNode_block$ques$2 = function() {
- var self = this;
-
- return self.$raise($$$('::', 'NotImplementedError'))
- }, $AbstractNode_block$ques$2.$$arity = 0);
-
- Opal.def(self, '$inline?', $AbstractNode_inline$ques$3 = function() {
- var self = this;
-
- return self.$raise($$$('::', 'NotImplementedError'))
- }, $AbstractNode_inline$ques$3.$$arity = 0);
-
- Opal.def(self, '$converter', $AbstractNode_converter$4 = function $$converter() {
- var self = this;
-
- return self.document.$converter()
- }, $AbstractNode_converter$4.$$arity = 0);
-
- Opal.def(self, '$parent=', $AbstractNode_parent$eq$5 = function(parent) {
- var $a, self = this;
-
- return $a = [parent, parent.$document()], (self.parent = $a[0]), (self.document = $a[1]), $a
- }, $AbstractNode_parent$eq$5.$$arity = 1);
-
- Opal.def(self, '$attr', $AbstractNode_attr$6 = function $$attr(name, default_value, fallback_name) {
- var $a, $b, $c, $d, self = this;
-
-
-
- if (default_value == null) {
- default_value = nil;
- };
-
- if (fallback_name == null) {
- fallback_name = nil;
- };
- return ($truthy($a = self.attributes['$[]'](name.$to_s())) ? $a : ($truthy($b = ($truthy($c = ($truthy($d = fallback_name) ? self.parent : $d)) ? self.document.$attributes()['$[]']((function() {if (fallback_name['$=='](true)) {
- return name
- } else {
- return fallback_name
- }; return nil; })().$to_s()) : $c)) ? $b : default_value));
- }, $AbstractNode_attr$6.$$arity = -2);
-
- Opal.def(self, '$attr?', $AbstractNode_attr$ques$7 = function(name, expected_value, fallback_name) {
- var $a, $b, self = this;
-
-
-
- if (expected_value == null) {
- expected_value = nil;
- };
-
- if (fallback_name == null) {
- fallback_name = nil;
- };
- if ($truthy(expected_value)) {
- return expected_value['$=='](($truthy($a = self.attributes['$[]'](name.$to_s())) ? $a : (function() {if ($truthy(($truthy($b = fallback_name) ? self.parent : $b))) {
- return self.document.$attributes()['$[]']((function() {if (fallback_name['$=='](true)) {
- return name
- } else {
- return fallback_name
- }; return nil; })().$to_s())
- } else {
- return nil
- }; return nil; })()))
- } else {
- return ($truthy($a = self.attributes['$key?'](name.$to_s())) ? $a : (function() {if ($truthy(($truthy($b = fallback_name) ? self.parent : $b))) {
-
- return self.document.$attributes()['$key?']((function() {if (fallback_name['$=='](true)) {
- return name
- } else {
- return fallback_name
- }; return nil; })().$to_s());
- } else {
- return false
- }; return nil; })())
- };
- }, $AbstractNode_attr$ques$7.$$arity = -2);
-
- Opal.def(self, '$set_attr', $AbstractNode_set_attr$8 = function $$set_attr(name, value, overwrite) {
- var $a, self = this, $writer = nil;
-
-
-
- if (value == null) {
- value = "";
- };
-
- if (overwrite == null) {
- overwrite = true;
- };
- if ($truthy((($a = overwrite['$=='](false)) ? self.attributes['$key?'](name) : overwrite['$=='](false)))) {
- return false
- } else {
-
-
- $writer = [name, value];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return true;
- };
- }, $AbstractNode_set_attr$8.$$arity = -2);
-
- Opal.def(self, '$remove_attr', $AbstractNode_remove_attr$9 = function $$remove_attr(name) {
- var self = this;
-
- return self.attributes.$delete(name)
- }, $AbstractNode_remove_attr$9.$$arity = 1);
-
- Opal.def(self, '$option?', $AbstractNode_option$ques$10 = function(name) {
- var self = this;
-
- if ($truthy(self.attributes['$[]']("" + (name) + "-option"))) {
- return true
- } else {
- return false
- }
- }, $AbstractNode_option$ques$10.$$arity = 1);
-
- Opal.def(self, '$set_option', $AbstractNode_set_option$11 = function $$set_option(name) {
- var self = this, $writer = nil;
-
-
-
- $writer = ["" + (name) + "-option", ""];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return nil;
- }, $AbstractNode_set_option$11.$$arity = 1);
-
- Opal.def(self, '$enabled_options', $AbstractNode_enabled_options$12 = function $$enabled_options() {
- var $$13, self = this;
-
- return $send($$$('::', 'Set').$new(), 'tap', [], ($$13 = function(accum){var self = $$13.$$s || this, $$14;
- if (self.attributes == null) self.attributes = nil;
-
-
-
- if (accum == null) {
- accum = nil;
- };
- return $send(self.attributes, 'each_key', [], ($$14 = function(k){var self = $$14.$$s || this;
-
-
-
- if (k == null) {
- k = nil;
- };
- if ($truthy(k.$to_s()['$end_with?']("-option"))) {
- return accum['$<<'](k.$slice(0, $rb_minus(k.$length(), 7)))
- } else {
- return nil
- };}, $$14.$$s = self, $$14.$$arity = 1, $$14));}, $$13.$$s = self, $$13.$$arity = 1, $$13))
- }, $AbstractNode_enabled_options$12.$$arity = 0);
-
- Opal.def(self, '$update_attributes', $AbstractNode_update_attributes$15 = function $$update_attributes(new_attributes) {
- var self = this;
-
- return self.attributes.$update(new_attributes)
- }, $AbstractNode_update_attributes$15.$$arity = 1);
-
- Opal.def(self, '$role', $AbstractNode_role$16 = function $$role() {
- var self = this;
-
- return self.attributes['$[]']("role")
- }, $AbstractNode_role$16.$$arity = 0);
-
- Opal.def(self, '$roles', $AbstractNode_roles$17 = function $$roles() {
- var self = this, val = nil;
-
- if ($truthy((val = self.attributes['$[]']("role")))) {
- return val.$split()
- } else {
- return []
- }
- }, $AbstractNode_roles$17.$$arity = 0);
-
- Opal.def(self, '$role?', $AbstractNode_role$ques$18 = function(expected_value) {
- var self = this;
-
-
-
- if (expected_value == null) {
- expected_value = nil;
- };
- if ($truthy(expected_value)) {
- return expected_value['$=='](self.attributes['$[]']("role"))
- } else {
-
- return self.attributes['$key?']("role");
- };
- }, $AbstractNode_role$ques$18.$$arity = -1);
-
- Opal.def(self, '$has_role?', $AbstractNode_has_role$ques$19 = function(name) {
- var self = this, val = nil;
-
- if ($truthy((val = self.attributes['$[]']("role")))) {
-
- return ((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " ");
- } else {
- return false
- }
- }, $AbstractNode_has_role$ques$19.$$arity = 1);
-
- Opal.def(self, '$role=', $AbstractNode_role$eq$20 = function(names) {
- var self = this, $writer = nil;
-
-
- $writer = ["role", (function() {if ($truthy($$$('::', 'Array')['$==='](names))) {
-
- return names.$join(" ");
- } else {
- return names
- }; return nil; })()];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- }, $AbstractNode_role$eq$20.$$arity = 1);
-
- Opal.def(self, '$add_role', $AbstractNode_add_role$21 = function $$add_role(name) {
- var self = this, val = nil, $writer = nil;
-
- if ($truthy((val = self.attributes['$[]']("role")))) {
- if ($truthy(((("" + " ") + (val)) + " ")['$include?']("" + " " + (name) + " "))) {
- return false
- } else {
-
-
- $writer = ["role", "" + (val) + " " + (name)];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return true;
- }
- } else {
-
-
- $writer = ["role", name];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return true;
- }
- }, $AbstractNode_add_role$21.$$arity = 1);
-
- Opal.def(self, '$remove_role', $AbstractNode_remove_role$22 = function $$remove_role(name) {
- var $a, self = this, val = nil, $writer = nil;
-
- if ($truthy(($truthy($a = (val = self.attributes['$[]']("role"))) ? (val = val.$split()).$delete(name) : $a))) {
-
- if ($truthy(val['$empty?']())) {
- self.attributes.$delete("role")
- } else {
-
- $writer = ["role", val.$join(" ")];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- return true;
- } else {
- return false
- }
- }, $AbstractNode_remove_role$22.$$arity = 1);
-
- Opal.def(self, '$reftext', $AbstractNode_reftext$23 = function $$reftext() {
- var self = this, val = nil;
-
- if ($truthy((val = self.attributes['$[]']("reftext")))) {
-
- return self.$apply_reftext_subs(val);
- } else {
- return nil
- }
- }, $AbstractNode_reftext$23.$$arity = 0);
-
- Opal.def(self, '$reftext?', $AbstractNode_reftext$ques$24 = function() {
- var self = this;
-
- return self.attributes['$key?']("reftext")
- }, $AbstractNode_reftext$ques$24.$$arity = 0);
-
- Opal.def(self, '$icon_uri', $AbstractNode_icon_uri$25 = function $$icon_uri(name) {
- var self = this, icon = nil;
-
-
- if ($truthy(self['$attr?']("icon"))) {
-
- icon = self.$attr("icon");
- if ($truthy($$($nesting, 'Helpers')['$extname?'](icon))) {
- } else {
- icon = "" + (icon) + "." + (self.document.$attr("icontype", "png"))
- };
- } else {
- icon = "" + (name) + "." + (self.document.$attr("icontype", "png"))
- };
- return self.$image_uri(icon, "iconsdir");
- }, $AbstractNode_icon_uri$25.$$arity = 1);
-
- Opal.def(self, '$image_uri', $AbstractNode_image_uri$26 = function $$image_uri(target_image, asset_dir_key) {
- var $a, $b, $c, $d, self = this, doc = nil, images_base = nil;
-
-
-
- if (asset_dir_key == null) {
- asset_dir_key = "imagesdir";
- };
- if ($truthy(($truthy($a = $rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE'))) ? doc['$attr?']("data-uri") : $a))) {
- if ($truthy(($truthy($a = ($truthy($b = $$($nesting, 'Helpers')['$uriish?'](target_image)) ? (target_image = $$($nesting, 'Helpers').$encode_spaces_in_uri(target_image)) : $b)) ? $a : ($truthy($b = ($truthy($c = ($truthy($d = asset_dir_key) ? (images_base = doc.$attr(asset_dir_key)) : $d)) ? $$($nesting, 'Helpers')['$uriish?'](images_base) : $c)) ? (target_image = self.$normalize_web_path(target_image, images_base, false)) : $b)))) {
- if ($truthy(doc['$attr?']("allow-uri-read"))) {
-
- return self.$generate_data_uri_from_uri(target_image, doc['$attr?']("cache-uri"));
- } else {
- return target_image
- }
- } else {
- return self.$generate_data_uri(target_image, asset_dir_key)
- }
- } else {
- return self.$normalize_web_path(target_image, (function() {if ($truthy(asset_dir_key)) {
-
- return doc.$attr(asset_dir_key);
- } else {
- return nil
- }; return nil; })())
- };
- }, $AbstractNode_image_uri$26.$$arity = -2);
-
- Opal.def(self, '$media_uri', $AbstractNode_media_uri$27 = function $$media_uri(target, asset_dir_key) {
- var self = this;
-
-
-
- if (asset_dir_key == null) {
- asset_dir_key = "imagesdir";
- };
- return self.$normalize_web_path(target, (function() {if ($truthy(asset_dir_key)) {
- return self.document.$attr(asset_dir_key)
- } else {
- return nil
- }; return nil; })());
- }, $AbstractNode_media_uri$27.$$arity = -2);
-
- Opal.def(self, '$generate_data_uri', $AbstractNode_generate_data_uri$28 = function $$generate_data_uri(target_image, asset_dir_key) {
- var self = this, ext = nil, mimetype = nil, image_path = nil;
-
-
-
- if (asset_dir_key == null) {
- asset_dir_key = nil;
- };
- if ($truthy((ext = $$($nesting, 'Helpers').$extname(target_image, nil)))) {
- mimetype = (function() {if (ext['$=='](".svg")) {
- return "image/svg+xml"
- } else {
- return "" + "image/" + (ext.$slice(1, ext.$length()))
- }; return nil; })()
- } else {
- mimetype = "application/octet-stream"
- };
- if ($truthy(asset_dir_key)) {
- 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 ($truthy($$$('::', 'File')['$readable?'](image_path))) {
- return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64($$$('::', 'File').$binread(image_path)))
- } else {
-
- self.$logger().$warn("" + "image to embed not found or not readable: " + (image_path));
- return "" + "data:" + (mimetype) + ";base64,";
- };
- }, $AbstractNode_generate_data_uri$28.$$arity = -2);
-
- Opal.def(self, '$generate_data_uri_from_uri', $AbstractNode_generate_data_uri_from_uri$29 = function $$generate_data_uri_from_uri(image_uri, cache_uri) {
- var $a, $b, $$30, self = this, mimetype = nil, bindata = nil;
-
-
-
- if (cache_uri == null) {
- cache_uri = false;
- };
- if ($truthy(cache_uri)) {
- $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached")
- } else if ($truthy($$($nesting, 'RUBY_ENGINE_OPAL')['$!']())) {
- $$$('::', 'OpenURI')};
-
- try {
-
- $b = $send($$$('::', 'OpenURI'), 'open_uri', [image_uri, $$($nesting, 'URI_READ_MODE')], ($$30 = function(f){var self = $$30.$$s || this;
-
-
-
- if (f == null) {
- f = nil;
- };
- return [f.$content_type(), f.$read()];}, $$30.$$s = self, $$30.$$arity = 1, $$30)), $a = Opal.to_ary($b), (mimetype = ($a[0] == null ? nil : $a[0])), (bindata = ($a[1] == null ? nil : $a[1])), $b;
- return "" + "data:" + (mimetype) + ";base64," + ($$$('::', 'Base64').$strict_encode64(bindata));
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
-
- self.$logger().$warn("" + "could not retrieve image data from URI: " + (image_uri));
- return image_uri;
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };;
- }, $AbstractNode_generate_data_uri_from_uri$29.$$arity = -2);
-
- Opal.def(self, '$normalize_asset_path', $AbstractNode_normalize_asset_path$31 = function $$normalize_asset_path(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}));
- }, $AbstractNode_normalize_asset_path$31.$$arity = -2);
-
- Opal.def(self, '$normalize_system_path', $AbstractNode_normalize_system_path$32 = function $$normalize_system_path(target, start, jail, opts) {
- var self = this, doc = nil;
-
-
-
- if (start == null) {
- start = nil;
- };
-
- if (jail == null) {
- jail = nil;
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy($rb_lt((doc = self.document).$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) {
- if ($truthy(start)) {
- if ($truthy(doc.$path_resolver()['$root?'](start))) {
- } else {
- start = $$$('::', 'File').$join(doc.$base_dir(), start)
- }
- } else {
- start = doc.$base_dir()
- }
- } else {
-
- if ($truthy(start)) {
- } else {
- start = doc.$base_dir()
- };
- if ($truthy(jail)) {
- } else {
- jail = doc.$base_dir()
- };
- };
- return doc.$path_resolver().$system_path(target, start, jail, opts);
- }, $AbstractNode_normalize_system_path$32.$$arity = -2);
-
- Opal.def(self, '$normalize_web_path', $AbstractNode_normalize_web_path$33 = function $$normalize_web_path(target, start, preserve_uri_target) {
- var $a, self = this;
-
-
-
- if (start == null) {
- start = nil;
- };
-
- if (preserve_uri_target == null) {
- preserve_uri_target = true;
- };
- if ($truthy(($truthy($a = preserve_uri_target) ? $$($nesting, 'Helpers')['$uriish?'](target) : $a))) {
- return $$($nesting, 'Helpers').$encode_spaces_in_uri(target)
- } else {
- return self.document.$path_resolver().$web_path(target, start)
- };
- }, $AbstractNode_normalize_web_path$33.$$arity = -2);
-
- Opal.def(self, '$read_asset', $AbstractNode_read_asset$34 = function $$read_asset(path, opts) {
- var $a, self = this;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy($$$('::', 'Hash')['$==='](opts))) {
- } else {
- opts = $hash2(["warn_on_failure"], {"warn_on_failure": opts['$!='](false)})
- };
- if ($truthy($$$('::', 'File')['$readable?'](path))) {
- if ($truthy(opts['$[]']("normalize"))) {
-
- return $$($nesting, 'Helpers').$prepare_source_string($$$('::', 'File').$read(path, $hash2(["mode"], {"mode": $$($nesting, 'FILE_READ_MODE')}))).$join($$($nesting, 'LF'));
- } else {
-
- return $$$('::', 'File').$read(path, $hash2(["mode"], {"mode": $$($nesting, 'FILE_READ_MODE')}));
- }
- } else if ($truthy(opts['$[]']("warn_on_failure"))) {
-
- self.$logger().$warn("" + (($truthy($a = self.$attr("docfile")) ? $a : "")) + ": " + (($truthy($a = opts['$[]']("label")) ? $a : "file")) + " does not exist or cannot be read: " + (path));
- return nil;
- } else {
- return nil
- };
- }, $AbstractNode_read_asset$34.$$arity = -2);
-
- Opal.def(self, '$read_contents', $AbstractNode_read_contents$35 = function $$read_contents(target, opts) {
- var $a, $b, $c, $$36, $$37, self = this, doc = nil, start = nil, contents = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- doc = self.document;
- if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : ($truthy($b = ($truthy($c = (start = opts['$[]']("start"))) ? $$($nesting, 'Helpers')['$uriish?'](start) : $c)) ? (target = doc.$path_resolver().$web_path(target, start)) : $b)))) {
- if ($truthy(doc['$attr?']("allow-uri-read"))) {
-
- if ($truthy(doc['$attr?']("cache-uri"))) {
- $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached")};
-
- try {
- if ($truthy(opts['$[]']("normalize"))) {
- contents = $$($nesting, 'Helpers').$prepare_source_string($send($$$('::', 'OpenURI'), 'open_uri', [target, $$($nesting, 'URI_READ_MODE')], ($$36 = function(f){var self = $$36.$$s || this;
-
-
-
- if (f == null) {
- f = nil;
- };
- return f.$read();}, $$36.$$s = self, $$36.$$arity = 1, $$36))).$join($$($nesting, 'LF'))
- } else {
- contents = $send($$$('::', 'OpenURI'), 'open_uri', [target, $$($nesting, 'URI_READ_MODE')], ($$37 = function(f){var self = $$37.$$s || this;
-
-
-
- if (f == null) {
- f = nil;
- };
- return f.$read();}, $$37.$$s = self, $$37.$$arity = 1, $$37))
- }
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- if ($truthy(opts.$fetch("warn_on_failure", true))) {
- self.$logger().$warn("" + "could not retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target))}
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };;
- } else if ($truthy(opts.$fetch("warn_on_failure", true))) {
- self.$logger().$warn("" + "cannot retrieve contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " at URI: " + (target) + " (allow-uri-read attribute not enabled)")}
- } else {
-
- target = self.$normalize_system_path(target, opts['$[]']("start"), nil, $hash2(["target_name"], {"target_name": ($truthy($a = opts['$[]']("label")) ? $a : "asset")}));
- contents = self.$read_asset(target, $hash2(["normalize", "warn_on_failure", "label"], {"normalize": opts['$[]']("normalize"), "warn_on_failure": opts.$fetch("warn_on_failure", true), "label": opts['$[]']("label")}));
- };
- if ($truthy(($truthy($a = ($truthy($b = contents) ? opts['$[]']("warn_if_empty") : $b)) ? contents['$empty?']() : $a))) {
- self.$logger().$warn("" + "contents of " + (($truthy($a = opts['$[]']("label")) ? $a : "asset")) + " is empty: " + (target))};
- return contents;
- }, $AbstractNode_read_contents$35.$$arity = -2);
- return (Opal.def(self, '$is_uri?', $AbstractNode_is_uri$ques$38 = function(str) {
- var self = this;
-
- return $$($nesting, 'Helpers')['$uriish?'](str)
- }, $AbstractNode_is_uri$ques$38.$$arity = 1), nil) && 'is_uri?';
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/abstract_block"] = function(Opal) {
- function $rb_minus(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);
- }
- 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, $send = Opal.send, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$attr_reader', '$attr_writer', '$attr_accessor', '$==', '$===', '$level', '$file', '$lineno', '$playback_attributes', '$convert', '$converter', '$join', '$map', '$to_s', '$parent', '$parent=', '$-', '$<<', '$empty?', '$>', '$Integer', '$find_by_internal', '$to_proc', '$context', '$[]', '$items', '$+', '$find_index', '$include?', '$next_adjacent_block', '$blocks', '$select', '$sub_specialchars', '$match?', '$sub_replacements', '$title', '$apply_title_subs', '$delete', '$reftext', '$!', '$nil_or_empty?', '$sub_placeholder', '$sub_quotes', '$compat_mode', '$attributes', '$chomp', '$increment_and_store_counter', '$index=', '$numbered', '$sectname', '$counter', '$numeral=', '$numeral', '$caption=', '$int_to_roman', '$each', '$assign_numeral', '$reindex_sections', '$protected', '$has_role?', '$raise', '$header?', '$!=', '$flatten', '$head', '$rows', '$merge', '$body', '$foot', '$style', '$inner_document']);
- 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, 'AbstractBlock');
-
- var $nesting = [self].concat($parent_nesting), $AbstractBlock_initialize$1, $AbstractBlock_block$ques$2, $AbstractBlock_inline$ques$3, $AbstractBlock_file$4, $AbstractBlock_lineno$5, $AbstractBlock_convert$6, $AbstractBlock_content$7, $AbstractBlock_context$eq$9, $AbstractBlock_$lt$lt$10, $AbstractBlock_blocks$ques$11, $AbstractBlock_sections$ques$12, $AbstractBlock_number$13, $AbstractBlock_number$eq$14, $AbstractBlock_find_by$15, $AbstractBlock_next_adjacent_block$16, $AbstractBlock_sections$18, $AbstractBlock_alt$20, $AbstractBlock_caption$21, $AbstractBlock_captioned_title$22, $AbstractBlock_list_marker_keyword$23, $AbstractBlock_title$24, $AbstractBlock_title$ques$25, $AbstractBlock_title$eq$26, $AbstractBlock_sub$ques$27, $AbstractBlock_remove_sub$28, $AbstractBlock_xreftext$29, $AbstractBlock_assign_caption$30, $AbstractBlock_assign_numeral$31, $AbstractBlock_reindex_sections$32, $AbstractBlock_find_by_internal$34;
-
- self.$$prototype.source_location = self.$$prototype.document = self.$$prototype.attributes = self.$$prototype.blocks = self.$$prototype.next_section_index = self.$$prototype.numeral = self.$$prototype.context = self.$$prototype.parent = self.$$prototype.caption = self.$$prototype.style = self.$$prototype.converted_title = self.$$prototype.title = self.$$prototype.subs = self.$$prototype.next_section_ordinal = self.$$prototype.id = self.$$prototype.header = nil;
-
- self.$attr_reader("blocks");
- self.$attr_writer("caption");
- self.$attr_accessor("content_model");
- self.$attr_accessor("level");
- self.$attr_accessor("numeral");
- self.$attr_accessor("source_location");
- self.$attr_accessor("style");
- self.$attr_reader("subs");
-
- Opal.def(self, '$initialize', $AbstractBlock_initialize$1 = function $$initialize(parent, context, opts) {
- var $a, $iter = $AbstractBlock_initialize$1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $AbstractBlock_initialize$1.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $AbstractBlock_initialize$1, false), $zuper, $iter);
- self.content_model = "compound";
- self.blocks = [];
- self.subs = [];
- self.id = (self.title = (self.caption = (self.numeral = (self.style = (self.default_subs = (self.source_location = nil))))));
- if ($truthy(($truthy($a = context['$==']("document")) ? $a : context['$==']("section")))) {
-
- self.level = (self.next_section_index = 0);
- return (self.next_section_ordinal = 1);
- } else if ($truthy($$($nesting, 'AbstractBlock')['$==='](parent))) {
- return (self.level = parent.$level())
- } else {
- return (self.level = nil)
- };
- }, $AbstractBlock_initialize$1.$$arity = -3);
-
- Opal.def(self, '$block?', $AbstractBlock_block$ques$2 = function() {
- var self = this;
-
- return true
- }, $AbstractBlock_block$ques$2.$$arity = 0);
-
- Opal.def(self, '$inline?', $AbstractBlock_inline$ques$3 = function() {
- var self = this;
-
- return false
- }, $AbstractBlock_inline$ques$3.$$arity = 0);
-
- Opal.def(self, '$file', $AbstractBlock_file$4 = function $$file() {
- var $a, self = this;
-
- return ($truthy($a = self.source_location) ? self.source_location.$file() : $a)
- }, $AbstractBlock_file$4.$$arity = 0);
-
- Opal.def(self, '$lineno', $AbstractBlock_lineno$5 = function $$lineno() {
- var $a, self = this;
-
- return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a)
- }, $AbstractBlock_lineno$5.$$arity = 0);
-
- Opal.def(self, '$convert', $AbstractBlock_convert$6 = function $$convert() {
- var self = this;
-
-
- self.document.$playback_attributes(self.attributes);
- return self.$converter().$convert(self);
- }, $AbstractBlock_convert$6.$$arity = 0);
- Opal.alias(self, "render", "convert");
-
- Opal.def(self, '$content', $AbstractBlock_content$7 = function $$content() {
- var $$8, self = this;
-
- return $send(self.blocks, 'map', [], ($$8 = function(b){var self = $$8.$$s || this;
-
-
-
- if (b == null) {
- b = nil;
- };
- return b.$convert();}, $$8.$$s = self, $$8.$$arity = 1, $$8)).$join($$($nesting, 'LF'))
- }, $AbstractBlock_content$7.$$arity = 0);
-
- Opal.def(self, '$context=', $AbstractBlock_context$eq$9 = function(context) {
- var self = this;
-
- return (self.node_name = (self.context = context).$to_s())
- }, $AbstractBlock_context$eq$9.$$arity = 1);
-
- Opal.def(self, '$<<', $AbstractBlock_$lt$lt$10 = function(block) {
- var self = this, $writer = nil;
-
-
- if (block.$parent()['$=='](self)) {
- } else {
-
- $writer = [self];
- $send(block, 'parent=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- self.blocks['$<<'](block);
- return self;
- }, $AbstractBlock_$lt$lt$10.$$arity = 1);
- Opal.alias(self, "append", "<<");
-
- Opal.def(self, '$blocks?', $AbstractBlock_blocks$ques$11 = function() {
- var self = this;
-
- if ($truthy(self.blocks['$empty?']())) {
- return false
- } else {
- return true
- }
- }, $AbstractBlock_blocks$ques$11.$$arity = 0);
-
- Opal.def(self, '$sections?', $AbstractBlock_sections$ques$12 = function() {
- var self = this;
-
- return $rb_gt(self.next_section_index, 0)
- }, $AbstractBlock_sections$ques$12.$$arity = 0);
-
- Opal.def(self, '$number', $AbstractBlock_number$13 = function $$number() {
- var self = this;
-
- try {
-
- return self.$Integer(self.numeral);
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- return self.numeral
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }
- }, $AbstractBlock_number$13.$$arity = 0);
-
- Opal.def(self, '$number=', $AbstractBlock_number$eq$14 = function(val) {
- var self = this;
-
- return (self.numeral = val.$to_s())
- }, $AbstractBlock_number$eq$14.$$arity = 1);
-
- Opal.def(self, '$find_by', $AbstractBlock_find_by$15 = function $$find_by(selector) {
- var $iter = $AbstractBlock_find_by$15.$$p, block = $iter || nil, self = this, result = nil;
-
- if ($iter) $AbstractBlock_find_by$15.$$p = null;
-
-
- if ($iter) $AbstractBlock_find_by$15.$$p = null;;
-
- if (selector == null) {
- selector = $hash2([], {});
- };
- try {
- return $send(self, 'find_by_internal', [selector, (result = [])], block.$to_proc())
- } catch ($err) {
- if (Opal.rescue($err, [$$$('::', 'StopIteration')])) {
- try {
- return result
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- }, $AbstractBlock_find_by$15.$$arity = -1);
- Opal.alias(self, "query", "find_by");
-
- Opal.def(self, '$next_adjacent_block', $AbstractBlock_next_adjacent_block$16 = function $$next_adjacent_block() {
- var $a, $$17, self = this, p = nil, sib = nil;
-
- if (self.context['$==']("document")) {
- return nil
- } else if ($truthy((($a = (p = self.parent).$context()['$==']("dlist")) ? self.context['$==']("list_item") : (p = self.parent).$context()['$==']("dlist")))) {
- if ($truthy((sib = p.$items()['$[]']($rb_plus($send(p.$items(), 'find_index', [], ($$17 = function(terms, desc){var self = $$17.$$s || this, $b;
-
-
-
- if (terms == null) {
- terms = nil;
- };
-
- if (desc == null) {
- desc = nil;
- };
- return ($truthy($b = terms['$include?'](self)) ? $b : desc['$=='](self));}, $$17.$$s = self, $$17.$$arity = 2, $$17)), 1))))) {
- return sib
- } else {
- return p.$next_adjacent_block()
- }
- } else if ($truthy((sib = p.$blocks()['$[]']($rb_plus(p.$blocks().$find_index(self), 1))))) {
- return sib
- } else {
- return p.$next_adjacent_block()
- }
- }, $AbstractBlock_next_adjacent_block$16.$$arity = 0);
-
- Opal.def(self, '$sections', $AbstractBlock_sections$18 = function $$sections() {
- var $$19, self = this;
-
- return $send(self.blocks, 'select', [], ($$19 = function(block){var self = $$19.$$s || this;
-
-
-
- if (block == null) {
- block = nil;
- };
- return block.$context()['$==']("section");}, $$19.$$s = self, $$19.$$arity = 1, $$19))
- }, $AbstractBlock_sections$18.$$arity = 0);
-
- Opal.def(self, '$alt', $AbstractBlock_alt$20 = function $$alt() {
- var self = this, text = nil;
-
- if ($truthy((text = self.attributes['$[]']("alt")))) {
- if (text['$=='](self.attributes['$[]']("default-alt"))) {
- return self.$sub_specialchars(text)
- } else {
-
- text = self.$sub_specialchars(text);
- if ($truthy($$($nesting, 'ReplaceableTextRx')['$match?'](text))) {
-
- return self.$sub_replacements(text);
- } else {
- return text
- };
- }
- } else {
- return ""
- }
- }, $AbstractBlock_alt$20.$$arity = 0);
-
- Opal.def(self, '$caption', $AbstractBlock_caption$21 = function $$caption() {
- var self = this;
-
- if (self.context['$==']("admonition")) {
- return self.attributes['$[]']("textlabel")
- } else {
- return self.caption
- }
- }, $AbstractBlock_caption$21.$$arity = 0);
-
- Opal.def(self, '$captioned_title', $AbstractBlock_captioned_title$22 = function $$captioned_title() {
- var self = this;
-
- return "" + (self.caption) + (self.$title())
- }, $AbstractBlock_captioned_title$22.$$arity = 0);
-
- Opal.def(self, '$list_marker_keyword', $AbstractBlock_list_marker_keyword$23 = function $$list_marker_keyword(list_type) {
- var $a, self = this;
-
-
-
- if (list_type == null) {
- list_type = nil;
- };
- return $$($nesting, 'ORDERED_LIST_KEYWORDS')['$[]'](($truthy($a = list_type) ? $a : self.style));
- }, $AbstractBlock_list_marker_keyword$23.$$arity = -1);
-
- Opal.def(self, '$title', $AbstractBlock_title$24 = function $$title() {
- var $a, $b, self = this;
-
- return (self.converted_title = ($truthy($a = self.converted_title) ? $a : ($truthy($b = self.title) ? self.$apply_title_subs(self.title) : $b)))
- }, $AbstractBlock_title$24.$$arity = 0);
-
- Opal.def(self, '$title?', $AbstractBlock_title$ques$25 = function() {
- var self = this;
-
- if ($truthy(self.title)) {
- return true
- } else {
- return false
- }
- }, $AbstractBlock_title$ques$25.$$arity = 0);
-
- Opal.def(self, '$title=', $AbstractBlock_title$eq$26 = function(val) {
- var self = this;
-
-
- self.converted_title = nil;
- return (self.title = val);
- }, $AbstractBlock_title$eq$26.$$arity = 1);
-
- Opal.def(self, '$sub?', $AbstractBlock_sub$ques$27 = function(name) {
- var self = this;
-
- return self.subs['$include?'](name)
- }, $AbstractBlock_sub$ques$27.$$arity = 1);
-
- Opal.def(self, '$remove_sub', $AbstractBlock_remove_sub$28 = function $$remove_sub(sub) {
- var self = this;
-
-
- self.subs.$delete(sub);
- return nil;
- }, $AbstractBlock_remove_sub$28.$$arity = 1);
-
- Opal.def(self, '$xreftext', $AbstractBlock_xreftext$29 = function $$xreftext(xrefstyle) {
- var $a, $b, self = this, val = nil, $case = nil, quoted_title = nil, caption_attr_name = nil, prefix = nil;
-
-
-
- if (xrefstyle == null) {
- xrefstyle = nil;
- };
- if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) {
- return val
- } else if ($truthy(($truthy($a = ($truthy($b = xrefstyle) ? self.title : $b)) ? self.caption['$nil_or_empty?']()['$!']() : $a))) {
- return (function() {$case = xrefstyle;
- if ("full"['$===']($case)) {
- quoted_title = self.$sub_placeholder(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) {
- return "``%s''"
- } else {
- return "\"`%s`\""
- }; return nil; })()), self.$title());
- if ($truthy(($truthy($a = ($truthy($b = self.numeral) ? (caption_attr_name = $$($nesting, 'CAPTION_ATTRIBUTE_NAMES')['$[]'](self.context)) : $b)) ? (prefix = self.document.$attributes()['$[]'](caption_attr_name)) : $a))) {
- return "" + (prefix) + " " + (self.numeral) + ", " + (quoted_title)
- } else {
- return "" + (self.caption.$chomp(". ")) + ", " + (quoted_title)
- };}
- else if ("short"['$===']($case)) {if ($truthy(($truthy($a = ($truthy($b = self.numeral) ? (caption_attr_name = $$($nesting, 'CAPTION_ATTRIBUTE_NAMES')['$[]'](self.context)) : $b)) ? (prefix = self.document.$attributes()['$[]'](caption_attr_name)) : $a))) {
- return "" + (prefix) + " " + (self.numeral)
- } else {
- return self.caption.$chomp(". ")
- }}
- else {return self.$title()}})()
- } else {
- return self.$title()
- };
- }, $AbstractBlock_xreftext$29.$$arity = -1);
-
- Opal.def(self, '$assign_caption', $AbstractBlock_assign_caption$30 = function $$assign_caption(value, caption_context) {
- var $a, $b, self = this, attr_name = nil, prefix = nil;
-
-
-
- if (caption_context == null) {
- caption_context = self.context;
- };
- if ($truthy(($truthy($a = ($truthy($b = self.caption) ? $b : self.title['$!']())) ? $a : (self.caption = ($truthy($b = value) ? $b : self.document.$attributes()['$[]']("caption")))))) {
- return nil
- } else if ($truthy(($truthy($a = (attr_name = $$($nesting, 'CAPTION_ATTRIBUTE_NAMES')['$[]'](caption_context))) ? (prefix = self.document.$attributes()['$[]'](attr_name)) : $a))) {
-
- self.caption = "" + (prefix) + " " + ((self.numeral = self.document.$increment_and_store_counter("" + (caption_context) + "-number", self))) + ". ";
- return nil;
- } else {
- return nil
- };
- }, $AbstractBlock_assign_caption$30.$$arity = -2);
-
- Opal.def(self, '$assign_numeral', $AbstractBlock_assign_numeral$31 = function $$assign_numeral(section) {
- var $a, self = this, $writer = nil, like = nil, sectname = nil, caption = nil;
-
-
- self.next_section_index = $rb_plus((($writer = [self.next_section_index]), $send(section, 'index=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]), 1);
- if ($truthy((like = section.$numbered()))) {
- if ((sectname = section.$sectname())['$==']("appendix")) {
-
-
- $writer = [self.document.$counter("appendix-number", "A")];
- $send(section, 'numeral=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = [(function() {if ($truthy((caption = self.document.$attributes()['$[]']("appendix-caption")))) {
- return "" + (caption) + " " + (section.$numeral()) + ": "
- } else {
- return "" + (section.$numeral()) + ". "
- }; return nil; })()];
- $send(section, 'caption=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else if ($truthy(($truthy($a = sectname['$==']("chapter")) ? $a : like['$==']("chapter")))) {
-
- $writer = [self.document.$counter("chapter-number", 1).$to_s()];
- $send(section, 'numeral=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
-
- $writer = [(function() {if (sectname['$==']("part")) {
-
- return $$($nesting, 'Helpers').$int_to_roman(self.next_section_ordinal);
- } else {
- return self.next_section_ordinal.$to_s()
- }; return nil; })()];
- $send(section, 'numeral=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- self.next_section_ordinal = $rb_plus(self.next_section_ordinal, 1);
- }};
- return nil;
- }, $AbstractBlock_assign_numeral$31.$$arity = 1);
-
- Opal.def(self, '$reindex_sections', $AbstractBlock_reindex_sections$32 = function $$reindex_sections() {
- var $$33, self = this;
-
-
- self.next_section_index = 0;
- self.next_section_ordinal = 1;
- return $send(self.blocks, 'each', [], ($$33 = function(block){var self = $$33.$$s || this;
-
-
-
- if (block == null) {
- block = nil;
- };
- if (block.$context()['$==']("section")) {
-
- self.$assign_numeral(block);
- return block.$reindex_sections();
- } else {
- return nil
- };}, $$33.$$s = self, $$33.$$arity = 1, $$33));
- }, $AbstractBlock_reindex_sections$32.$$arity = 0);
- self.$protected();
- return (Opal.def(self, '$find_by_internal', $AbstractBlock_find_by_internal$34 = function $$find_by_internal(selector, result) {
- var $iter = $AbstractBlock_find_by_internal$34.$$p, block = $iter || nil, $a, $b, $c, $d, $$35, $$36, $$37, $$39, $$41, $$43, self = this, any_context = nil, context_selector = nil, style_selector = nil, role_selector = nil, id_selector = nil, verdict = nil, $case = nil;
-
- if ($iter) $AbstractBlock_find_by_internal$34.$$p = null;
-
-
- if ($iter) $AbstractBlock_find_by_internal$34.$$p = null;;
-
- if (selector == null) {
- selector = $hash2([], {});
- };
-
- if (result == null) {
- result = [];
- };
- if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = (any_context = (function() {if ($truthy((context_selector = selector['$[]']("context")))) {
- return nil
- } else {
- return true
- }; return nil; })())) ? $d : context_selector['$=='](self.context))) ? ($truthy($d = (style_selector = selector['$[]']("style"))['$!']()) ? $d : style_selector['$=='](self.style)) : $c)) ? ($truthy($c = (role_selector = selector['$[]']("role"))['$!']()) ? $c : self['$has_role?'](role_selector)) : $b)) ? ($truthy($b = (id_selector = selector['$[]']("id"))['$!']()) ? $b : id_selector['$=='](self.id)) : $a))) {
- if ((block !== nil)) {
- if ($truthy((verdict = Opal.yield1(block, self)))) {
- $case = verdict;
- if ("prune"['$===']($case)) {
- result['$<<'](self);
- if ($truthy(id_selector)) {
- self.$raise($$$('::', 'StopIteration'))};
- return result;}
- else if ("reject"['$===']($case)) {
- if ($truthy(id_selector)) {
- self.$raise($$$('::', 'StopIteration'))};
- return result;}
- else if ("stop"['$===']($case)) {self.$raise($$$('::', 'StopIteration'))}
- else {
- result['$<<'](self);
- if ($truthy(id_selector)) {
- self.$raise($$$('::', 'StopIteration'))};}
- } else if ($truthy(id_selector)) {
- self.$raise($$$('::', 'StopIteration'))}
- } else {
-
- result['$<<'](self);
- if ($truthy(id_selector)) {
- self.$raise($$$('::', 'StopIteration'))};
- }};
- $case = self.context;
- if ("document"['$===']($case)) {if (context_selector['$==']("document")) {
- } else {
-
- if ($truthy(($truthy($a = self['$header?']()) ? ($truthy($b = any_context) ? $b : context_selector['$==']("section")) : $a))) {
- $send(self.header, 'find_by_internal', [selector, result], block.$to_proc())};
- $send(self.blocks, 'each', [], ($$35 = function(b){var self = $$35.$$s || this, $e;
-
-
-
- if (b == null) {
- b = nil;
- };
- if ($truthy((($e = context_selector['$==']("section")) ? b.$context()['$!=']("section") : context_selector['$==']("section")))) {
- return nil;};
- return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}, $$35.$$s = self, $$35.$$arity = 1, $$35));
- }}
- else if ("dlist"['$===']($case)) {if ($truthy(($truthy($a = any_context) ? $a : context_selector['$!=']("section")))) {
- $send(self.blocks.$flatten(), 'each', [], ($$36 = function(b){var self = $$36.$$s || this;
-
-
-
- if (b == null) {
- b = nil;
- };
- if ($truthy(b)) {
- return $send(b, 'find_by_internal', [selector, result], block.$to_proc())
- } else {
- return nil
- };}, $$36.$$s = self, $$36.$$arity = 1, $$36))}}
- else if ("table"['$===']($case)) {if ($truthy(selector['$[]']("traverse_documents"))) {
-
- $send(self.$rows().$head(), 'each', [], ($$37 = function(r){var self = $$37.$$s || this, $$38;
-
-
-
- if (r == null) {
- r = nil;
- };
- return $send(r, 'each', [], ($$38 = function(c){var self = $$38.$$s || this;
-
-
-
- if (c == null) {
- c = nil;
- };
- return $send(c, 'find_by_internal', [selector, result], block.$to_proc());}, $$38.$$s = self, $$38.$$arity = 1, $$38));}, $$37.$$s = self, $$37.$$arity = 1, $$37));
- if (context_selector['$==']("inner_document")) {
- selector = selector.$merge($hash2(["context"], {"context": "document"}))};
- $send($rb_plus(self.$rows().$body(), self.$rows().$foot()), 'each', [], ($$39 = function(r){var self = $$39.$$s || this, $$40;
-
-
-
- if (r == null) {
- r = nil;
- };
- return $send(r, 'each', [], ($$40 = function(c){var self = $$40.$$s || this;
-
-
-
- if (c == null) {
- c = nil;
- };
- $send(c, 'find_by_internal', [selector, result], block.$to_proc());
- if (c.$style()['$==']("asciidoc")) {
- return $send(c.$inner_document(), 'find_by_internal', [selector, result], block.$to_proc())
- } else {
- return nil
- };}, $$40.$$s = self, $$40.$$arity = 1, $$40));}, $$39.$$s = self, $$39.$$arity = 1, $$39));
- } else {
- $send($rb_plus($rb_plus(self.$rows().$head(), self.$rows().$body()), self.$rows().$foot()), 'each', [], ($$41 = function(r){var self = $$41.$$s || this, $$42;
-
-
-
- if (r == null) {
- r = nil;
- };
- return $send(r, 'each', [], ($$42 = function(c){var self = $$42.$$s || this;
-
-
-
- if (c == null) {
- c = nil;
- };
- return $send(c, 'find_by_internal', [selector, result], block.$to_proc());}, $$42.$$s = self, $$42.$$arity = 1, $$42));}, $$41.$$s = self, $$41.$$arity = 1, $$41))
- }}
- else {$send(self.blocks, 'each', [], ($$43 = function(b){var self = $$43.$$s || this, $e;
-
-
-
- if (b == null) {
- b = nil;
- };
- if ($truthy((($e = context_selector['$==']("section")) ? b.$context()['$!=']("section") : context_selector['$==']("section")))) {
- return nil;};
- return $send(b, 'find_by_internal', [selector, result], block.$to_proc());}, $$43.$$s = self, $$43.$$arity = 1, $$43))};
- return result;
- }, $AbstractBlock_find_by_internal$34.$$arity = -1), nil) && 'find_by_internal';
- })($nesting[0], $$($nesting, 'AbstractNode'), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/attribute_list"] = function(Opal) {
- 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_times(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, $hash = Opal.hash, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send;
-
- Opal.add_stubs(['$new', '$[]', '$update', '$parse', '$parse_attribute', '$eos?', '$skip_delimiter', '$+', '$rekey', '$each_with_index', '$[]=', '$-', '$private', '$skip_blank', '$peek', '$===', '$parse_attribute_value', '$get_byte', '$start_with?', '$scan_name', '$end_with?', '$rstrip', '$string', '$==', '$unscan', '$scan_to_delimiter', '$*', '$include?', '$delete', '$each', '$split', '$empty?', '$apply_subs', '$scan_to_quote', '$gsub', '$skip', '$scan']);
- 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, 'AttributeList');
-
- var $nesting = [self].concat($parent_nesting), $AttributeList_initialize$1, $AttributeList_parse_into$2, $AttributeList_parse$3, $AttributeList_rekey$4, $AttributeList_rekey$5, $AttributeList_parse_attribute$7, $AttributeList_parse_attribute_value$9, $AttributeList_skip_blank$10, $AttributeList_skip_delimiter$11, $AttributeList_scan_name$12, $AttributeList_scan_to_delimiter$13, $AttributeList_scan_to_quote$14;
-
- self.$$prototype.attributes = self.$$prototype.scanner = self.$$prototype.delimiter = self.$$prototype.block = self.$$prototype.delimiter_skip_pattern = self.$$prototype.delimiter_boundary_pattern = nil;
-
- Opal.const_set($nesting[0], 'APOS', "'");
- Opal.const_set($nesting[0], 'BACKSLASH', "\\");
- Opal.const_set($nesting[0], 'QUOT', "\"");
- Opal.const_set($nesting[0], 'BoundaryRx', $hash($$($nesting, 'QUOT'), /.*?[^\\](?=")/, $$($nesting, 'APOS'), /.*?[^\\](?=')/, ",", /.*?(?=[ \t]*(,|$))/));
- Opal.const_set($nesting[0], 'EscapedQuotes', $hash($$($nesting, 'QUOT'), "\\\"", $$($nesting, 'APOS'), "\\'"));
- Opal.const_set($nesting[0], 'NameRx', new RegExp("" + ($$($nesting, 'CG_WORD')) + "[" + ($$($nesting, 'CC_WORD')) + "\\-.]*"));
- Opal.const_set($nesting[0], 'BlankRx', /[ \t]+/);
- Opal.const_set($nesting[0], 'SkipRx', $hash2([","], {",": /[ \t]*(,|$)/}));
-
- Opal.def(self, '$initialize', $AttributeList_initialize$1 = function $$initialize(source, block, delimiter) {
- var self = this;
-
-
-
- if (block == null) {
- block = nil;
- };
-
- if (delimiter == null) {
- delimiter = ",";
- };
- self.scanner = $$$('::', 'StringScanner').$new(source);
- self.block = block;
- self.delimiter = delimiter;
- self.delimiter_skip_pattern = $$($nesting, 'SkipRx')['$[]'](delimiter);
- self.delimiter_boundary_pattern = $$($nesting, 'BoundaryRx')['$[]'](delimiter);
- return (self.attributes = nil);
- }, $AttributeList_initialize$1.$$arity = -2);
-
- Opal.def(self, '$parse_into', $AttributeList_parse_into$2 = function $$parse_into(attributes, positional_attrs) {
- var self = this;
-
-
-
- if (positional_attrs == null) {
- positional_attrs = [];
- };
- return attributes.$update(self.$parse(positional_attrs));
- }, $AttributeList_parse_into$2.$$arity = -2);
-
- Opal.def(self, '$parse', $AttributeList_parse$3 = function $$parse(positional_attrs) {
- var $a, self = this, index = nil;
-
-
-
- if (positional_attrs == null) {
- positional_attrs = [];
- };
- if ($truthy(self.attributes)) {
- return self.attributes};
- self.attributes = $hash2([], {});
- index = 0;
- while ($truthy(self.$parse_attribute(index, positional_attrs))) {
-
- if ($truthy(self.scanner['$eos?']())) {
- break;};
- self.$skip_delimiter();
- index = $rb_plus(index, 1);
- };
- return self.attributes;
- }, $AttributeList_parse$3.$$arity = -1);
-
- Opal.def(self, '$rekey', $AttributeList_rekey$4 = function $$rekey(positional_attrs) {
- var self = this;
-
- return $$($nesting, 'AttributeList').$rekey(self.attributes, positional_attrs)
- }, $AttributeList_rekey$4.$$arity = 1);
- Opal.defs(self, '$rekey', $AttributeList_rekey$5 = function $$rekey(attributes, positional_attrs) {
- var $$6, self = this;
-
-
- $send(positional_attrs, 'each_with_index', [], ($$6 = function(key, index){var self = $$6.$$s || this, $a, val = nil, $writer = nil;
-
-
-
- if (key == null) {
- key = nil;
- };
-
- if (index == null) {
- index = nil;
- };
- if ($truthy(($truthy($a = key) ? (val = attributes['$[]']($rb_plus(index, 1))) : $a))) {
-
- $writer = [key, val];
- $send(attributes, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- } else {
- return nil
- };}, $$6.$$s = self, $$6.$$arity = 2, $$6));
- return attributes;
- }, $AttributeList_rekey$5.$$arity = 2);
- self.$private();
-
- Opal.def(self, '$parse_attribute', $AttributeList_parse_attribute$7 = function $$parse_attribute(index, positional_attrs) {
- var $a, $b, $$8, self = this, continue$ = nil, $case = nil, name = nil, single_quoted = nil, skipped = nil, c = nil, value = nil, $writer = nil, positional_attr_name = nil;
-
-
- continue$ = true;
- self.$skip_blank();
- $case = self.scanner.$peek(1);
- if ($$($nesting, 'QUOT')['$===']($case)) {name = self.$parse_attribute_value(self.scanner.$get_byte())}
- else if ($$($nesting, 'APOS')['$===']($case)) {
- name = self.$parse_attribute_value(self.scanner.$get_byte());
- if ($truthy(name['$start_with?']($$($nesting, 'APOS')))) {
- } else {
- single_quoted = true
- };}
- else {
- skipped = ($truthy($a = ($truthy($b = (name = self.$scan_name())) ? self.$skip_blank() : $b)) ? $a : 0);
- if ($truthy(self.scanner['$eos?']())) {
-
- if ($truthy(($truthy($a = name) ? $a : self.scanner.$string().$rstrip()['$end_with?'](self.delimiter)))) {
- } else {
- return nil
- };
- continue$ = nil;
- } else if ((c = self.scanner.$get_byte())['$=='](self.delimiter)) {
- self.scanner.$unscan()
- } else if ($truthy(name)) {
- if (c['$==']("=")) {
-
- self.$skip_blank();
- $case = (c = self.scanner.$get_byte());
- if ($$($nesting, 'QUOT')['$===']($case)) {value = self.$parse_attribute_value(c)}
- else if ($$($nesting, 'APOS')['$===']($case)) {
- value = self.$parse_attribute_value(c);
- if ($truthy(value['$start_with?']($$($nesting, 'APOS')))) {
- } else {
- single_quoted = true
- };}
- else if (self.delimiter['$===']($case)) {
- value = "";
- self.scanner.$unscan();}
- else if (nil['$===']($case)) {value = ""}
- else {
- value = "" + (c) + (self.$scan_to_delimiter());
- if (value['$==']("None")) {
- return true};};
- } else {
- name = "" + (name) + ($rb_times(" ", skipped)) + (c) + (self.$scan_to_delimiter())
- }
- } else {
- name = "" + (c) + (self.$scan_to_delimiter())
- };};
- if ($truthy(value)) {
- $case = name;
- if ("options"['$===']($case) || "opts"['$===']($case)) {if ($truthy(value['$include?'](","))) {
-
- if ($truthy(value['$include?'](" "))) {
- value = value.$delete(" ")};
- $send(value.$split(","), 'each', [], ($$8 = function(opt){var self = $$8.$$s || this, $writer = nil;
- if (self.attributes == null) self.attributes = nil;
-
-
-
- if (opt == null) {
- opt = nil;
- };
- if ($truthy(opt['$empty?']())) {
- return nil
- } else {
-
- $writer = ["" + (opt) + "-option", ""];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };}, $$8.$$s = self, $$8.$$arity = 1, $$8));
- } else if ($truthy(value['$empty?']())) {
- } else {
-
- $writer = ["" + (value) + "-option", ""];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }}
- else {if ($truthy(($truthy($a = single_quoted) ? self.block : $a))) {
- $case = name;
- if ("title"['$===']($case) || "reftext"['$===']($case)) {
- $writer = [name, value];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- else {
- $writer = [name, self.block.$apply_subs(value)];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- } else {
-
- $writer = [name, value];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }}
- } else {
-
- if ($truthy(($truthy($a = single_quoted) ? self.block : $a))) {
- name = self.block.$apply_subs(name)};
- if ($truthy(($truthy($a = (positional_attr_name = positional_attrs['$[]'](index))) ? name : $a))) {
-
- $writer = [positional_attr_name, name];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
-
- $writer = [$rb_plus(index, 1), name];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- };
- return continue$;
- }, $AttributeList_parse_attribute$7.$$arity = 2);
-
- Opal.def(self, '$parse_attribute_value', $AttributeList_parse_attribute_value$9 = function $$parse_attribute_value(quote) {
- var self = this, value = nil;
-
- if (self.scanner.$peek(1)['$=='](quote)) {
-
- self.scanner.$get_byte();
- return "";
- } else if ($truthy((value = self.$scan_to_quote(quote)))) {
-
- self.scanner.$get_byte();
- if ($truthy(value['$include?']($$($nesting, 'BACKSLASH')))) {
-
- return value.$gsub($$($nesting, 'EscapedQuotes')['$[]'](quote), quote);
- } else {
- return value
- };
- } else {
- return "" + (quote) + (self.$scan_to_delimiter())
- }
- }, $AttributeList_parse_attribute_value$9.$$arity = 1);
-
- Opal.def(self, '$skip_blank', $AttributeList_skip_blank$10 = function $$skip_blank() {
- var self = this;
-
- return self.scanner.$skip($$($nesting, 'BlankRx'))
- }, $AttributeList_skip_blank$10.$$arity = 0);
-
- Opal.def(self, '$skip_delimiter', $AttributeList_skip_delimiter$11 = function $$skip_delimiter() {
- var self = this;
-
- return self.scanner.$skip(self.delimiter_skip_pattern)
- }, $AttributeList_skip_delimiter$11.$$arity = 0);
-
- Opal.def(self, '$scan_name', $AttributeList_scan_name$12 = function $$scan_name() {
- var self = this;
-
- return self.scanner.$scan($$($nesting, 'NameRx'))
- }, $AttributeList_scan_name$12.$$arity = 0);
-
- Opal.def(self, '$scan_to_delimiter', $AttributeList_scan_to_delimiter$13 = function $$scan_to_delimiter() {
- var self = this;
-
- return self.scanner.$scan(self.delimiter_boundary_pattern)
- }, $AttributeList_scan_to_delimiter$13.$$arity = 0);
- return (Opal.def(self, '$scan_to_quote', $AttributeList_scan_to_quote$14 = function $$scan_to_quote(quote) {
- var self = this;
-
- return self.scanner.$scan($$($nesting, 'BoundaryRx')['$[]'](quote))
- }, $AttributeList_scan_to_quote$14.$$arity = 1), nil) && 'scan_to_quote';
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/block"] = function(Opal) {
- function $rb_minus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
- }
- function $rb_lt(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, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$default=', '$-', '$attr_accessor', '$[]', '$key?', '$==', '$===', '$drop', '$delete', '$[]=', '$commit_subs', '$nil_or_empty?', '$prepare_source_string', '$apply_subs', '$join', '$<', '$size', '$empty?', '$rstrip', '$shift', '$pop', '$warn', '$logger', '$to_s', '$class', '$object_id', '$inspect']);
- 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, 'Block');
-
- var $nesting = [self].concat($parent_nesting), $Block_initialize$1, $Block_content$2, $Block_source$3, $Block_to_s$4, $writer = nil;
-
- self.$$prototype.attributes = self.$$prototype.content_model = self.$$prototype.lines = self.$$prototype.subs = self.$$prototype.blocks = self.$$prototype.context = self.$$prototype.style = nil;
-
-
- $writer = ["simple"];
- $send(Opal.const_set($nesting[0], 'DEFAULT_CONTENT_MODEL', $hash2(["audio", "image", "listing", "literal", "stem", "open", "page_break", "pass", "thematic_break", "video"], {"audio": "empty", "image": "empty", "listing": "verbatim", "literal": "verbatim", "stem": "raw", "open": "compound", "page_break": "empty", "pass": "raw", "thematic_break": "empty", "video": "empty"})), 'default=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- Opal.alias(self, "blockname", "context");
- self.$attr_accessor("lines");
-
- Opal.def(self, '$initialize', $Block_initialize$1 = function $$initialize(parent, context, opts) {
- var $a, $iter = $Block_initialize$1.$$p, $yield = $iter || nil, self = this, subs = nil, $writer = nil, raw_source = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Block_initialize$1.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $Block_initialize$1, false), $zuper, $iter);
- self.content_model = ($truthy($a = opts['$[]']("content_model")) ? $a : $$($nesting, 'DEFAULT_CONTENT_MODEL')['$[]'](context));
- if ($truthy(opts['$key?']("subs"))) {
- if ($truthy((subs = opts['$[]']("subs")))) {
-
- if (subs['$==']("default")) {
- self.default_subs = opts['$[]']("default_subs")
- } else if ($truthy($$$('::', 'Array')['$==='](subs))) {
-
- self.default_subs = subs.$drop(0);
- self.attributes.$delete("subs");
- } else {
-
- self.default_subs = nil;
-
- $writer = ["subs", "" + (subs)];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- };
- self.$commit_subs();
- } else {
-
- self.default_subs = [];
- self.attributes.$delete("subs");
- }
- } else {
- self.default_subs = nil
- };
- if ($truthy((raw_source = opts['$[]']("source"))['$nil_or_empty?']())) {
- return (self.lines = [])
- } else if ($truthy($$$('::', 'String')['$==='](raw_source))) {
- return (self.lines = $$($nesting, 'Helpers').$prepare_source_string(raw_source))
- } else {
- return (self.lines = raw_source.$drop(0))
- };
- }, $Block_initialize$1.$$arity = -3);
-
- Opal.def(self, '$content', $Block_content$2 = function $$content() {
- var $a, $b, $iter = $Block_content$2.$$p, $yield = $iter || nil, self = this, $case = nil, result = nil, first = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Block_content$2.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- return (function() {$case = self.content_model;
- if ("compound"['$===']($case)) {return $send(self, Opal.find_super_dispatcher(self, 'content', $Block_content$2, false), $zuper, $iter)}
- else if ("simple"['$===']($case)) {return self.$apply_subs(self.lines.$join($$($nesting, 'LF')), self.subs)}
- else if ("verbatim"['$===']($case) || "raw"['$===']($case)) {
- result = self.$apply_subs(self.lines, self.subs);
- if ($truthy($rb_lt(result.$size(), 2))) {
- return result['$[]'](0)
- } else {
-
- while ($truthy(($truthy($b = (first = result['$[]'](0))) ? first.$rstrip()['$empty?']() : $b))) {
- result.$shift()
- };
- while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last.$rstrip()['$empty?']() : $b))) {
- result.$pop()
- };
- return result.$join($$($nesting, 'LF'));
- };}
- else {
- if (self.content_model['$==']("empty")) {
- } else {
- self.$logger().$warn("" + "Unknown content model '" + (self.content_model) + "' for block: " + (self.$to_s()))
- };
- return nil;}})()
- }, $Block_content$2.$$arity = 0);
-
- Opal.def(self, '$source', $Block_source$3 = function $$source() {
- var self = this;
-
- return self.lines.$join($$($nesting, 'LF'))
- }, $Block_source$3.$$arity = 0);
- return (Opal.def(self, '$to_s', $Block_to_s$4 = function $$to_s() {
- var self = this, content_summary = nil;
-
-
- content_summary = (function() {if (self.content_model['$==']("compound")) {
- return "" + "blocks: " + (self.blocks.$size())
- } else {
- return "" + "lines: " + (self.lines.$size())
- }; return nil; })();
- return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", content_model: " + (self.content_model.$inspect()) + ", style: " + (self.style.$inspect()) + ", " + (content_summary) + "}>";
- }, $Block_to_s$4.$$arity = 0), nil) && 'to_s';
- })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/callouts"] = function(Opal) {
- function $rb_plus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs + rhs : lhs['$+'](rhs);
- }
- function $rb_le(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_lt(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;
-
- Opal.add_stubs(['$next_list', '$<<', '$current_list', '$to_i', '$generate_next_callout_id', '$+', '$<=', '$size', '$[]', '$-', '$chop', '$join', '$map', '$==', '$<', '$private', '$generate_callout_id']);
- 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, 'Callouts');
-
- var $nesting = [self].concat($parent_nesting), $Callouts_initialize$1, $Callouts_register$2, $Callouts_read_next_id$3, $Callouts_callout_ids$4, $Callouts_current_list$6, $Callouts_next_list$7, $Callouts_rewind$8, $Callouts_generate_next_callout_id$9, $Callouts_generate_callout_id$10;
-
- self.$$prototype.co_index = self.$$prototype.lists = self.$$prototype.list_index = nil;
-
-
- Opal.def(self, '$initialize', $Callouts_initialize$1 = function $$initialize() {
- var self = this;
-
-
- self.lists = [];
- self.list_index = 0;
- return self.$next_list();
- }, $Callouts_initialize$1.$$arity = 0);
-
- Opal.def(self, '$register', $Callouts_register$2 = function $$register(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 = $rb_plus(self.co_index, 1);
- return id;
- }, $Callouts_register$2.$$arity = 1);
-
- Opal.def(self, '$read_next_id', $Callouts_read_next_id$3 = function $$read_next_id() {
- var self = this, id = nil, list = nil;
-
-
- id = nil;
- list = self.$current_list();
- if ($truthy($rb_le(self.co_index, list.$size()))) {
- id = list['$[]']($rb_minus(self.co_index, 1))['$[]']("id")};
- self.co_index = $rb_plus(self.co_index, 1);
- return id;
- }, $Callouts_read_next_id$3.$$arity = 0);
-
- Opal.def(self, '$callout_ids', $Callouts_callout_ids$4 = function $$callout_ids(li_ordinal) {
- var $$5, self = this;
-
- return $send(self.$current_list(), 'map', [], ($$5 = function(it){var self = $$5.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- if (it['$[]']("ordinal")['$=='](li_ordinal)) {
- return "" + (it['$[]']("id")) + " "
- } else {
- return ""
- };}, $$5.$$s = self, $$5.$$arity = 1, $$5)).$join().$chop()
- }, $Callouts_callout_ids$4.$$arity = 1);
-
- Opal.def(self, '$current_list', $Callouts_current_list$6 = function $$current_list() {
- var self = this;
-
- return self.lists['$[]']($rb_minus(self.list_index, 1))
- }, $Callouts_current_list$6.$$arity = 0);
-
- Opal.def(self, '$next_list', $Callouts_next_list$7 = function $$next_list() {
- var self = this;
-
-
- self.list_index = $rb_plus(self.list_index, 1);
- if ($truthy($rb_lt(self.lists.$size(), self.list_index))) {
- self.lists['$<<']([])};
- self.co_index = 1;
- return nil;
- }, $Callouts_next_list$7.$$arity = 0);
-
- Opal.def(self, '$rewind', $Callouts_rewind$8 = function $$rewind() {
- var self = this;
-
-
- self.list_index = 1;
- self.co_index = 1;
- return nil;
- }, $Callouts_rewind$8.$$arity = 0);
- self.$private();
-
- Opal.def(self, '$generate_next_callout_id', $Callouts_generate_next_callout_id$9 = function $$generate_next_callout_id() {
- var self = this;
-
- return self.$generate_callout_id(self.list_index, self.co_index)
- }, $Callouts_generate_next_callout_id$9.$$arity = 0);
- return (Opal.def(self, '$generate_callout_id', $Callouts_generate_callout_id$10 = function $$generate_callout_id(list_index, co_index) {
- var self = this;
-
- return "" + "CO" + (list_index) + "-" + (co_index)
- }, $Callouts_generate_callout_id$10.$$arity = 2), nil) && 'generate_callout_id';
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/converter"] = function(Opal) {
- function $rb_minus(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);
- }
- 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, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $klass = Opal.klass, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$autoload', '$__dir__', '$attr_reader', '$raise', '$class', '$[]', '$sub', '$slice', '$length', '$==', '$[]=', '$backend_traits', '$-', '$derive_backend_traits', '$register', '$map', '$to_s', '$new', '$create', '$default', '$each', '$default=', '$registry', '$for', '$===', '$supports_templates?', '$merge', '$private', '$include', '$delete', '$clear', '$private_class_method', '$send', '$extend', '$node_name', '$+', '$receiver', '$name', '$warn', '$logger', '$respond_to?', '$content']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting);
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'Converter');
-
- var $nesting = [self].concat($parent_nesting), $Converter_initialize$1, $Converter_convert$2, $Converter_handles$ques$3, $Converter_derive_backend_traits$4, $a, $Converter_included$28;
-
-
- self.$autoload("CompositeConverter", "" + (self.$__dir__()) + "/converter/composite");
- self.$autoload("TemplateConverter", "" + (self.$__dir__()) + "/converter/template");
- self.$attr_reader("backend");
-
- Opal.def(self, '$initialize', $Converter_initialize$1 = function $$initialize(backend, opts) {
- var self = this;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- return (self.backend = backend);
- }, $Converter_initialize$1.$$arity = -2);
-
- Opal.def(self, '$convert', $Converter_convert$2 = function $$convert(node, transform, opts) {
- var self = this;
- if (self.backend == null) self.backend = nil;
-
-
-
- if (transform == null) {
- transform = nil;
- };
-
- if (opts == null) {
- opts = nil;
- };
- return self.$raise($$$('::', 'NotImplementedError'), "" + (self.$class()) + " (backend: " + (self.backend) + ") must implement the #" + ("convert") + " method");
- }, $Converter_convert$2.$$arity = -2);
-
- Opal.def(self, '$handles?', $Converter_handles$ques$3 = function(transform) {
- var self = this;
-
- return true
- }, $Converter_handles$ques$3.$$arity = 1);
- Opal.defs(self, '$derive_backend_traits', $Converter_derive_backend_traits$4 = function $$derive_backend_traits(backend, basebackend) {
- var $a, self = this, outfilesuffix = nil, filetype = nil;
-
-
-
- if (basebackend == null) {
- basebackend = nil;
- };
- if ($truthy(backend)) {
- } else {
- return $hash2([], {})
- };
- if ($truthy((outfilesuffix = $$($nesting, 'DEFAULT_EXTENSIONS')['$[]']((basebackend = ($truthy($a = basebackend) ? $a : backend.$sub($$($nesting, 'TrailingDigitsRx'), ""))))))) {
- filetype = outfilesuffix.$slice(1, outfilesuffix.$length())
- } else {
- outfilesuffix = "" + "." + ((filetype = basebackend))
- };
- if (filetype['$==']("html")) {
- return $hash2(["basebackend", "filetype", "htmlsyntax", "outfilesuffix"], {"basebackend": basebackend, "filetype": filetype, "htmlsyntax": "html", "outfilesuffix": outfilesuffix})
- } else {
- return $hash2(["basebackend", "filetype", "outfilesuffix"], {"basebackend": basebackend, "filetype": filetype, "outfilesuffix": outfilesuffix})
- };
- }, $Converter_derive_backend_traits$4.$$arity = -2);
- (function($base, $parent_nesting) {
- var self = $module($base, 'BackendTraits');
-
- var $nesting = [self].concat($parent_nesting), $BackendTraits_basebackend$5, $BackendTraits_filetype$6, $BackendTraits_htmlsyntax$7, $BackendTraits_outfilesuffix$8, $BackendTraits_supports_templates$9, $BackendTraits_supports_templates$ques$10, $BackendTraits_init_backend_traits$11, $BackendTraits_backend_traits$12, $BackendTraits_derive_backend_traits$13;
-
-
-
- Opal.def(self, '$basebackend', $BackendTraits_basebackend$5 = function $$basebackend(value) {
- var self = this, $writer = nil;
-
-
-
- if (value == null) {
- value = nil;
- };
- if ($truthy(value)) {
-
-
- $writer = ["basebackend", value];
- $send(self.$backend_traits(value), '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- } else {
- return self.$backend_traits()['$[]']("basebackend")
- };
- }, $BackendTraits_basebackend$5.$$arity = -1);
-
- Opal.def(self, '$filetype', $BackendTraits_filetype$6 = function $$filetype(value) {
- var self = this, $writer = nil;
-
-
-
- if (value == null) {
- value = nil;
- };
- if ($truthy(value)) {
-
-
- $writer = ["filetype", value];
- $send(self.$backend_traits(), '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- } else {
- return self.$backend_traits()['$[]']("filetype")
- };
- }, $BackendTraits_filetype$6.$$arity = -1);
-
- Opal.def(self, '$htmlsyntax', $BackendTraits_htmlsyntax$7 = function $$htmlsyntax(value) {
- var self = this, $writer = nil;
-
-
-
- if (value == null) {
- value = nil;
- };
- if ($truthy(value)) {
-
-
- $writer = ["htmlsyntax", value];
- $send(self.$backend_traits(), '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- } else {
- return self.$backend_traits()['$[]']("htmlsyntax")
- };
- }, $BackendTraits_htmlsyntax$7.$$arity = -1);
-
- Opal.def(self, '$outfilesuffix', $BackendTraits_outfilesuffix$8 = function $$outfilesuffix(value) {
- var self = this, $writer = nil;
-
-
-
- if (value == null) {
- value = nil;
- };
- if ($truthy(value)) {
-
-
- $writer = ["outfilesuffix", value];
- $send(self.$backend_traits(), '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- } else {
- return self.$backend_traits()['$[]']("outfilesuffix")
- };
- }, $BackendTraits_outfilesuffix$8.$$arity = -1);
-
- Opal.def(self, '$supports_templates', $BackendTraits_supports_templates$9 = function $$supports_templates(value) {
- var self = this, $writer = nil;
-
-
-
- if (value == null) {
- value = true;
- };
- $writer = ["supports_templates", value];
- $send(self.$backend_traits(), '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- }, $BackendTraits_supports_templates$9.$$arity = -1);
-
- Opal.def(self, '$supports_templates?', $BackendTraits_supports_templates$ques$10 = function() {
- var self = this;
-
- return self.$backend_traits()['$[]']("supports_templates")
- }, $BackendTraits_supports_templates$ques$10.$$arity = 0);
-
- Opal.def(self, '$init_backend_traits', $BackendTraits_init_backend_traits$11 = function $$init_backend_traits(value) {
- var $a, self = this;
-
-
-
- if (value == null) {
- value = nil;
- };
- return (self.backend_traits = ($truthy($a = value) ? $a : $hash2([], {})));
- }, $BackendTraits_init_backend_traits$11.$$arity = -1);
-
- Opal.def(self, '$backend_traits', $BackendTraits_backend_traits$12 = function $$backend_traits(basebackend) {
- var $a, self = this;
- if (self.backend_traits == null) self.backend_traits = nil;
- if (self.backend == null) self.backend = nil;
-
-
-
- if (basebackend == null) {
- basebackend = nil;
- };
- return (self.backend_traits = ($truthy($a = self.backend_traits) ? $a : $$($nesting, 'Converter').$derive_backend_traits(self.backend, basebackend)));
- }, $BackendTraits_backend_traits$12.$$arity = -1);
- Opal.alias(self, "backend_info", "backend_traits");
- Opal.defs(self, '$derive_backend_traits', $BackendTraits_derive_backend_traits$13 = function $$derive_backend_traits(backend, basebackend) {
- var self = this;
-
-
-
- if (basebackend == null) {
- basebackend = nil;
- };
- return $$($nesting, 'Converter').$derive_backend_traits(backend, basebackend);
- }, $BackendTraits_derive_backend_traits$13.$$arity = -2);
- })($nesting[0], $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Config');
-
- var $nesting = [self].concat($parent_nesting), $Config_register_for$14;
-
-
- Opal.def(self, '$register_for', $Config_register_for$14 = function $$register_for($a) {
- var $post_args, backends, $$15, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- backends = $post_args;;
- return $send($$($nesting, 'Converter'), 'register', [self].concat(Opal.to_a($send(backends, 'map', [], ($$15 = function(backend){var self = $$15.$$s || this;
-
-
-
- if (backend == null) {
- backend = nil;
- };
- return backend.$to_s();}, $$15.$$s = self, $$15.$$arity = 1, $$15)))));
- }, $Config_register_for$14.$$arity = -1)
- })($nesting[0], $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Factory');
-
- var $nesting = [self].concat($parent_nesting), $Factory_new$16, $Factory_default$17, $Factory_create$18, $Factory_register$19, $Factory_for$21, $Factory_create$22, $Factory_converters$23, $Factory_registry$24;
-
-
- Opal.defs(self, '$new', $Factory_new$16 = function($a, $b) {
- var $post_args, $kwargs, converters, proxy_default, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- $kwargs = Opal.extract_kwargs($post_args);
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- if ($post_args.length > 0) {
- converters = $post_args[0];
- $post_args.splice(0, 1);
- }
- if (converters == null) {
- converters = nil;
- };
-
- proxy_default = $kwargs.$$smap["proxy_default"];
- if (proxy_default == null) {
- proxy_default = true
- };
- if ($truthy(proxy_default)) {
-
- return $$($nesting, 'DefaultFactoryProxy').$new(converters);
- } else {
-
- return $$($nesting, 'CustomFactory').$new(converters);
- };
- }, $Factory_new$16.$$arity = -1);
- Opal.defs(self, '$default', $Factory_default$17 = function($a) {
- var $post_args, args, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- return $$($nesting, 'Converter');
- }, $Factory_default$17.$$arity = -1);
- Opal.defs(self, '$create', $Factory_create$18 = function $$create(backend, opts) {
- var self = this;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- return self.$default().$create(backend, opts);
- }, $Factory_create$18.$$arity = -2);
-
- Opal.def(self, '$register', $Factory_register$19 = function $$register(converter, $a) {
- var $post_args, backends, $$20, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- backends = $post_args;;
- return $send(backends, 'each', [], ($$20 = function(backend){var self = $$20.$$s || this, $writer = nil;
-
-
-
- if (backend == null) {
- backend = nil;
- };
- if (backend['$==']("*")) {
-
-
- $writer = [converter];
- $send(self.$registry(), 'default=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- } else {
-
-
- $writer = [backend, converter];
- $send(self.$registry(), '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- };}, $$20.$$s = self, $$20.$$arity = 1, $$20));
- }, $Factory_register$19.$$arity = -2);
-
- Opal.def(self, '$for', $Factory_for$21 = function(backend) {
- var self = this;
-
- return self.$registry()['$[]'](backend)
- }, $Factory_for$21.$$arity = 1);
-
- Opal.def(self, '$create', $Factory_create$22 = function $$create(backend, opts) {
- var $a, $b, self = this, converter = nil, template_dirs = nil, delegate_backend = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy((converter = self.$for(backend)))) {
-
- if ($truthy($$$('::', 'Class')['$==='](converter))) {
- converter = converter.$new(backend, opts)};
- if ($truthy(($truthy($a = ($truthy($b = (template_dirs = opts['$[]']("template_dirs"))) ? $$($nesting, 'BackendTraits')['$==='](converter) : $b)) ? converter['$supports_templates?']() : $a))) {
- return $$($nesting, 'CompositeConverter').$new(backend, $$($nesting, 'TemplateConverter').$new(backend, template_dirs, opts), converter, $hash2(["backend_traits_source"], {"backend_traits_source": converter}))
- } else {
- return converter
- };
- } else if ($truthy((template_dirs = opts['$[]']("template_dirs")))) {
- if ($truthy(($truthy($a = (delegate_backend = opts['$[]']("delegate_backend"))) ? (converter = self.$for(delegate_backend)) : $a))) {
-
- if ($truthy($$$('::', 'Class')['$==='](converter))) {
- converter = converter.$new(delegate_backend, opts)};
- return $$($nesting, 'CompositeConverter').$new(backend, $$($nesting, 'TemplateConverter').$new(backend, template_dirs, opts), converter, $hash2(["backend_traits_source"], {"backend_traits_source": converter}));
- } else {
- return $$($nesting, 'TemplateConverter').$new(backend, template_dirs, opts)
- }
- } else {
- return nil
- };
- }, $Factory_create$22.$$arity = -2);
-
- Opal.def(self, '$converters', $Factory_converters$23 = function $$converters() {
- var self = this;
-
- return self.$registry().$merge()
- }, $Factory_converters$23.$$arity = 0);
- self.$private();
-
- Opal.def(self, '$registry', $Factory_registry$24 = function $$registry() {
- var self = this;
-
- return self.$raise($$$('::', 'NotImplementedError'), "" + ($$($nesting, 'Factory')) + " subclass " + (self.$class()) + " must implement the #" + ("registry") + " method")
- }, $Factory_registry$24.$$arity = 0);
- })($nesting[0], $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'CustomFactory');
-
- var $nesting = [self].concat($parent_nesting), $CustomFactory_initialize$25, $CustomFactory_unregister_all$26;
-
-
- self.$include($$($nesting, 'Factory'));
-
- Opal.def(self, '$initialize', $CustomFactory_initialize$25 = function $$initialize(seed_registry) {
- var self = this, $writer = nil;
-
-
-
- if (seed_registry == null) {
- seed_registry = nil;
- };
- if ($truthy(seed_registry)) {
-
-
- $writer = [seed_registry.$delete("*")];
- $send(seed_registry, 'default=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return (self.registry = seed_registry);
- } else {
- return (self.registry = $hash2([], {}))
- };
- }, $CustomFactory_initialize$25.$$arity = -1);
-
- Opal.def(self, '$unregister_all', $CustomFactory_unregister_all$26 = function $$unregister_all() {
- var self = this, $writer = nil;
-
-
- $writer = [nil];
- $send(self.$registry().$clear(), 'default=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- }, $CustomFactory_unregister_all$26.$$arity = 0);
- self.$private();
- return self.$attr_reader("registry");
- })($nesting[0], null, $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'DefaultFactory');
-
- var $nesting = [self].concat($parent_nesting), $DefaultFactory_registry$27;
-
-
- self.$include($$($nesting, 'Factory'));
- self.$private();
- (Opal.class_variable_set($nesting[0], '@@registry', $hash2([], {})));
-
- Opal.def(self, '$registry', $DefaultFactory_registry$27 = function $$registry() {
- var $a, self = this;
-
- return (($a = $nesting[0].$$cvars['@@registry']) == null ? nil : $a)
- }, $DefaultFactory_registry$27.$$arity = 0);
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- } else {
- nil
- };
- })($nesting[0], $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'DefaultFactoryProxy');
-
- var $nesting = [self].concat($parent_nesting);
-
-
- self.$include($$($nesting, 'DefaultFactory'));
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- return nil
- } else {
- return nil
- };
- })($nesting[0], $$($nesting, 'CustomFactory'), $nesting);
- self.$private_class_method(($truthy($a = (Opal.defs(self, '$included', $Converter_included$28 = function $$included(into) {
- var self = this;
-
-
- into.$send("include", $$($nesting, 'BackendTraits'));
- return into.$extend($$($nesting, 'Config'));
- }, $Converter_included$28.$$arity = 1), nil) && 'included') ? $a : "included"));
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Base');
-
- var $nesting = [self].concat($parent_nesting), $Base_convert$29, $Base_handles$ques$30, $Base_content_only$31, $Base_skip$32;
-
- self.$$prototype.backend = nil;
-
- self.$include($$($nesting, 'Converter'), $$($nesting, 'Logging'));
-
- Opal.def(self, '$convert', $Base_convert$29 = function $$convert(node, transform, opts) {
- var $a, $b, self = this, ex = nil;
- if ($gvars["!"] == null) $gvars["!"] = nil;
-
-
-
- if (transform == null) {
- transform = node.$node_name();
- };
-
- if (opts == null) {
- opts = nil;
- };
- try {
- if ($truthy(opts)) {
-
- return self.$send($rb_plus("convert_", transform), node, opts);
- } else {
-
- return self.$send($rb_plus("convert_", transform), node);
- }
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
-
- if ($truthy(($truthy($a = ($truthy($b = $$$('::', 'NoMethodError')['$===']((ex = $gvars["!"]))) ? ex.$receiver()['$=='](self) : $b)) ? ex.$name().$to_s()['$=='](transform) : $a))) {
- } else {
- self.$raise()
- };
- self.$logger().$warn("" + "missing convert handler for " + (ex.$name()) + " node in " + (self.backend) + " backend (" + (self.$class()) + ")");
- return nil;
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- }, $Base_convert$29.$$arity = -2);
-
- Opal.def(self, '$handles?', $Base_handles$ques$30 = function(transform) {
- var self = this;
-
- return self['$respond_to?']("" + "convert_" + (transform))
- }, $Base_handles$ques$30.$$arity = 1);
-
- Opal.def(self, '$content_only', $Base_content_only$31 = function $$content_only(node) {
- var self = this;
-
- return node.$content()
- }, $Base_content_only$31.$$arity = 1);
- return (Opal.def(self, '$skip', $Base_skip$32 = function $$skip(node) {
- var self = this;
-
- return nil
- }, $Base_skip$32.$$arity = 1), nil) && 'skip';
- })($nesting[0], null, $nesting);
- self.$extend($$($nesting, 'DefaultFactory'));
- })($nesting[0], $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/document"] = function(Opal) {
- 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);
- }
- function $rb_plus(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_lt(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, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $hash = Opal.hash, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$new', '$attr_reader', '$nil?', '$<<', '$[]', '$[]=', '$-', '$include?', '$strip', '$squeeze', '$gsub', '$empty?', '$!', '$rpartition', '$attr_accessor', '$delete', '$base_dir', '$options', '$merge', '$catalog', '$instance_variable_get', '$attributes', '$safe', '$compat_mode', '$outfilesuffix', '$sourcemap', '$path_resolver', '$converter', '$extensions', '$syntax_highlighter', '$each', '$end_with?', '$start_with?', '$slice', '$length', '$chop', '$==', '$downcase', '$extname', '$===', '$value_for_name', '$key?', '$freeze', '$attribute_undefined', '$attribute_missing', '$update', '$&', '$keys', '$name_for_value', '$expand_path', '$pwd', '$>=', '$+', '$abs', '$to_i', '$delete_if', '$update_doctype_attributes', '$cursor', '$parse', '$restore_attributes', '$update_backend_attributes', '$fetch', '$fill_datetime_attributes', '$activate', '$groups', '$create', '$to_proc', '$preprocessors?', '$preprocessors', '$process_method', '$tree_processors?', '$tree_processors', '$!=', '$counter', '$attribute_locked?', '$nextval', '$nil_or_empty?', '$to_s', '$value', '$save_to', '$register', '$tap', '$xreftext', '$source', '$source_lines', '$doctitle', '$sectname=', '$title=', '$first_section', '$title', '$reftext', '$>', '$<', '$find', '$context', '$assign_numeral', '$clear_playback_attributes', '$save_attributes', '$name', '$negate', '$rewind', '$replace', '$apply_attribute_value_subs', '$delete?', '$start', '$doctype', '$content_model', '$warn', '$logger', '$content', '$convert', '$postprocessors?', '$postprocessors', '$record', '$write', '$respond_to?', '$chomp', '$class', '$write_alternate_pages', '$map', '$split', '$resolve_docinfo_subs', '$normalize_system_path', '$read_asset', '$apply_subs', '$docinfo_processors?', '$join', '$concat', '$compact', '$docinfo_processors', '$object_id', '$inspect', '$size', '$private', '$=~', '$resolve_pass_subs', '$apply_header_subs', '$limit_bytesize', '$bytesize', '$valid_encoding?', '$byteslice', '$resolve_subs', '$utc', '$at', '$Integer', '$now', '$index', '$strftime', '$year', '$utc_offset', '$partition', '$create_converter', '$basebackend', '$filetype', '$htmlsyntax', '$derive_backend_traits', '$raise']);
- 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, 'Document');
-
- var $nesting = [self].concat($parent_nesting), $Document$1, $Document_initialize$8, $Document_parse$11, $Document_parsed$ques$14, $Document_counter$15, $Document_increment_and_store_counter$16, $Document_register$17, $Document_resolve_id$18, $Document_footnotes$ques$23, $Document_footnotes$24, $Document_callouts$25, $Document_nested$ques$26, $Document_embedded$ques$27, $Document_extensions$ques$28, $Document_source$29, $Document_source_lines$30, $Document_basebackend$ques$31, $Document_title$32, $Document_title$eq$33, $Document_doctitle$34, $Document_xreftext$35, $Document_author$36, $Document_authors$37, $Document_revdate$38, $Document_notitle$39, $Document_noheader$40, $Document_nofooter$41, $Document_first_section$42, $Document_header$ques$44, $Document_$lt$lt$45, $Document_finalize_header$46, $Document_playback_attributes$47, $Document_restore_attributes$49, $Document_set_attribute$50, $Document_delete_attribute$51, $Document_attribute_locked$ques$52, $Document_set_header_attribute$53, $Document_convert$54, $Document_write$56, $Document_content$57, $Document_docinfo$58, $Document_docinfo_processors$ques$61, $Document_to_s$62, $Document_apply_attribute_value_subs$63, $Document_limit_bytesize$64, $Document_resolve_docinfo_subs$65, $Document_create_converter$66, $Document_clear_playback_attributes$67, $Document_save_attributes$68, $Document_fill_datetime_attributes$70, $Document_update_backend_attributes$71, $Document_update_doctype_attributes$72;
-
- self.$$prototype.attributes = self.$$prototype.safe = self.$$prototype.sourcemap = self.$$prototype.reader = self.$$prototype.base_dir = self.$$prototype.parsed = self.$$prototype.parent_document = self.$$prototype.extensions = self.$$prototype.options = self.$$prototype.counters = self.$$prototype.catalog = self.$$prototype.reftexts = self.$$prototype.header = self.$$prototype.blocks = self.$$prototype.header_attributes = self.$$prototype.attributes_modified = self.$$prototype.backend = self.$$prototype.attribute_overrides = self.$$prototype.timings = self.$$prototype.converter = self.$$prototype.outfilesuffix = self.$$prototype.docinfo_processor_extensions = self.$$prototype.document = self.$$prototype.max_attribute_value_size = self.$$prototype.id = self.$$prototype.doctype = nil;
-
- Opal.const_set($nesting[0], 'ImageReference', $send($$$('::', 'Struct'), 'new', ["target", "imagesdir"], ($Document$1 = function(){var self = $Document$1.$$s || this;
-
- return Opal.alias(self, "to_s", "target")}, $Document$1.$$s = self, $Document$1.$$arity = 0, $Document$1)));
- Opal.const_set($nesting[0], 'Footnote', $$$('::', 'Struct').$new("index", "id", "text"));
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'AttributeEntry');
-
- var $nesting = [self].concat($parent_nesting), $AttributeEntry_initialize$2, $AttributeEntry_save_to$3;
-
-
- self.$attr_reader("name", "value", "negate");
-
- Opal.def(self, '$initialize', $AttributeEntry_initialize$2 = function $$initialize(name, value, negate) {
- var self = this;
-
-
-
- if (negate == null) {
- negate = nil;
- };
- self.name = name;
- self.value = value;
- return (self.negate = (function() {if ($truthy(negate['$nil?']())) {
- return value['$nil?']()
- } else {
- return negate
- }; return nil; })());
- }, $AttributeEntry_initialize$2.$$arity = -3);
- return (Opal.def(self, '$save_to', $AttributeEntry_save_to$3 = function $$save_to(block_attributes) {
- var $a, self = this, $writer = nil;
-
-
- ($truthy($a = block_attributes['$[]']("attribute_entries")) ? $a : (($writer = ["attribute_entries", []]), $send(block_attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](self);
- return self;
- }, $AttributeEntry_save_to$3.$$arity = 1), nil) && 'save_to';
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Title');
-
- var $nesting = [self].concat($parent_nesting), $Title_initialize$4, $Title_sanitized$ques$5, $Title_subtitle$ques$6, $Title_to_s$7;
-
- self.$$prototype.sanitized = self.$$prototype.subtitle = self.$$prototype.combined = nil;
-
- self.$attr_reader("main");
- Opal.alias(self, "title", "main");
- self.$attr_reader("subtitle");
- self.$attr_reader("combined");
-
- Opal.def(self, '$initialize', $Title_initialize$4 = function $$initialize(val, opts) {
- var $a, $b, self = this, sep = nil, _ = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy(($truthy($a = (self.sanitized = opts['$[]']("sanitize"))) ? val['$include?']("<") : $a))) {
- val = val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip()};
- if ($truthy(($truthy($a = (sep = ($truthy($b = opts['$[]']("separator")) ? $b : ":"))['$empty?']()) ? $a : val['$include?']((sep = "" + (sep) + " "))['$!']()))) {
-
- self.main = val;
- self.subtitle = nil;
- } else {
- $b = val.$rpartition(sep), $a = Opal.to_ary($b), (self.main = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (self.subtitle = ($a[2] == null ? nil : $a[2])), $b
- };
- return (self.combined = val);
- }, $Title_initialize$4.$$arity = -2);
-
- Opal.def(self, '$sanitized?', $Title_sanitized$ques$5 = function() {
- var self = this;
-
- return self.sanitized
- }, $Title_sanitized$ques$5.$$arity = 0);
-
- Opal.def(self, '$subtitle?', $Title_subtitle$ques$6 = function() {
- var self = this;
-
- if ($truthy(self.subtitle)) {
- return true
- } else {
- return false
- }
- }, $Title_subtitle$ques$6.$$arity = 0);
- return (Opal.def(self, '$to_s', $Title_to_s$7 = function $$to_s() {
- var self = this;
-
- return self.combined
- }, $Title_to_s$7.$$arity = 0), nil) && 'to_s';
- })($nesting[0], null, $nesting);
- Opal.const_set($nesting[0], 'Author', $$$('::', 'Struct').$new("name", "firstname", "middlename", "lastname", "initials", "email"));
- self.$attr_reader("safe");
- self.$attr_reader("compat_mode");
- self.$attr_reader("backend");
- self.$attr_reader("doctype");
- self.$attr_accessor("sourcemap");
- self.$attr_reader("catalog");
- Opal.alias(self, "references", "catalog");
- self.$attr_reader("counters");
- self.$attr_reader("header");
- self.$attr_reader("base_dir");
- self.$attr_reader("options");
- self.$attr_reader("outfilesuffix");
- self.$attr_reader("parent_document");
- self.$attr_reader("reader");
- self.$attr_reader("path_resolver");
- self.$attr_reader("converter");
- self.$attr_reader("syntax_highlighter");
- self.$attr_reader("extensions");
-
- Opal.def(self, '$initialize', $Document_initialize$8 = function $$initialize(data, options) {
- var $a, $$9, $b, $c, $$10, $d, $e, $f, $g, $iter = $Document_initialize$8.$$p, $yield = $iter || nil, self = this, parent_doc = nil, $writer = nil, attr_overrides = nil, parent_doctype = nil, initialize_extensions = nil, to_file = nil, safe_mode = nil, input_mtime = nil, standalone = nil, attrs = nil, safe_mode_name = nil, base_dir_val = nil, backend_val = nil, doctype_val = nil, size = nil, initial_backend = nil, ext_registry = nil, ext_block = nil;
-
- if ($iter) $Document_initialize$8.$$p = null;
-
-
- if (data == null) {
- data = nil;
- };
-
- if (options == null) {
- options = $hash2([], {});
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $Document_initialize$8, false), [self, "document"], null);
- if ($truthy((parent_doc = options.$delete("parent")))) {
-
- self.parent_document = parent_doc;
- ($truthy($a = options['$[]']("base_dir")) ? $a : (($writer = ["base_dir", parent_doc.$base_dir()]), $send(options, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy(parent_doc.$options()['$[]']("catalog_assets"))) {
-
- $writer = ["catalog_assets", true];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- self.catalog = parent_doc.$catalog().$merge($hash2(["footnotes"], {"footnotes": []}));
- self.attribute_overrides = (attr_overrides = parent_doc.$instance_variable_get("@attribute_overrides").$merge(parent_doc.$attributes()));
- attr_overrides.$delete("compat-mode");
- parent_doctype = attr_overrides.$delete("doctype");
- attr_overrides.$delete("notitle");
- attr_overrides.$delete("showtitle");
- attr_overrides.$delete("toc");
-
- $writer = ["toc-placement", ($truthy($a = attr_overrides.$delete("toc-placement")) ? $a : "auto")];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- attr_overrides.$delete("toc-position");
- self.safe = parent_doc.$safe();
- if ($truthy((self.compat_mode = parent_doc.$compat_mode()))) {
-
- $writer = ["compat-mode", ""];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- self.outfilesuffix = parent_doc.$outfilesuffix();
- self.sourcemap = parent_doc.$sourcemap();
- self.timings = nil;
- self.path_resolver = parent_doc.$path_resolver();
- self.converter = parent_doc.$converter();
- initialize_extensions = nil;
- self.extensions = parent_doc.$extensions();
- self.syntax_highlighter = parent_doc.$syntax_highlighter();
- } else {
-
- self.parent_document = nil;
- self.catalog = $hash2(["ids", "refs", "footnotes", "links", "images", "callouts", "includes"], {"ids": $hash2([], {}), "refs": $hash2([], {}), "footnotes": [], "links": [], "images": [], "callouts": $$($nesting, 'Callouts').$new(), "includes": $hash2([], {})});
- self.attribute_overrides = (attr_overrides = $hash2([], {}));
- $send(($truthy($a = options['$[]']("attributes")) ? $a : $hash2([], {})), 'each', [], ($$9 = function(key, val){var self = $$9.$$s || this, $b;
-
-
-
- if (key == null) {
- key = nil;
- };
-
- if (val == null) {
- val = nil;
- };
- if ($truthy(key['$end_with?']("@"))) {
- if ($truthy(key['$start_with?']("!"))) {
- $b = [key.$slice(1, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b
- } else if ($truthy(key['$end_with?']("!@"))) {
- $b = [key.$slice(0, $rb_minus(key.$length(), 2)), false], (key = $b[0]), (val = $b[1]), $b
- } else {
- $b = [key.$chop(), "" + (val) + "@"], (key = $b[0]), (val = $b[1]), $b
- }
- } else if ($truthy(key['$start_with?']("!"))) {
- $b = [key.$slice(1, key.$length()), (function() {if (val['$==']("@")) {
- return false
- } else {
- return nil
- }; return nil; })()], (key = $b[0]), (val = $b[1]), $b
- } else if ($truthy(key['$end_with?']("!"))) {
- $b = [key.$chop(), (function() {if (val['$==']("@")) {
- return false
- } else {
- return nil
- }; return nil; })()], (key = $b[0]), (val = $b[1]), $b};
-
- $writer = [key.$downcase(), val];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;}, $$9.$$s = self, $$9.$$arity = 2, $$9));
- if ($truthy((to_file = options['$[]']("to_file")))) {
-
- $writer = ["outfilesuffix", $$($nesting, 'Helpers').$extname(to_file)];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy((safe_mode = options['$[]']("safe"))['$!']())) {
- self.safe = $$$($$($nesting, 'SafeMode'), 'SECURE')
- } else if ($truthy($$$('::', 'Integer')['$==='](safe_mode))) {
- self.safe = safe_mode
- } else {
- self.safe = (function() { try {
-
- return $$($nesting, 'SafeMode').$value_for_name(safe_mode);
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- return $$$($$($nesting, 'SafeMode'), 'SECURE')
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }})()
- };
- input_mtime = options.$delete("input_mtime");
- self.compat_mode = attr_overrides['$key?']("compat-mode");
- self.sourcemap = options['$[]']("sourcemap");
- self.timings = options.$delete("timings");
- self.path_resolver = $$($nesting, 'PathResolver').$new();
- initialize_extensions = (function() {if ($truthy(($truthy($a = (($c = $$$('::', 'Asciidoctor', 'skip_raise')) && ($b = $$$($c, 'Extensions', 'skip_raise')) ? 'constant' : nil)) ? $a : options['$key?']("extensions")))) {
- return $$$($$$('::', 'Asciidoctor'), 'Extensions')
- } else {
- return nil
- }; return nil; })();
- self.extensions = nil;
- if ($truthy(($truthy($a = options['$key?']("header_footer")) ? options['$key?']("standalone")['$!']() : $a))) {
-
- $writer = ["standalone", options['$[]']("header_footer")];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- };
- self.parsed = (self.reftexts = (self.header = (self.header_attributes = nil)));
- self.counters = $hash2([], {});
- self.attributes_modified = $$$('::', 'Set').$new();
- self.docinfo_processor_extensions = $hash2([], {});
- standalone = options['$[]']("standalone");
- (self.options = options).$freeze();
- attrs = self.attributes;
- if ($truthy(parent_doc)) {
- } else {
-
-
- $writer = ["attribute-undefined", $$($nesting, 'Compliance').$attribute_undefined()];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["attribute-missing", $$($nesting, 'Compliance').$attribute_missing()];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- attrs.$update($$($nesting, 'DEFAULT_ATTRIBUTES'));
- };
- if ($truthy(standalone)) {
-
-
- $writer = ["embedded", nil];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["copycss", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["iconfont-remote", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["stylesheet", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["webfonts", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
-
-
- $writer = ["embedded", ""];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(($truthy($a = attr_overrides['$key?']("showtitle")) ? attr_overrides.$keys()['$&'](["notitle", "showtitle"])['$[]'](-1)['$==']("showtitle") : $a))) {
-
- $writer = ["notitle", $hash(nil, "", false, "@", "@", false)['$[]'](attr_overrides['$[]']("showtitle"))];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else if ($truthy(attr_overrides['$key?']("notitle"))) {
-
- $writer = ["showtitle", $hash(nil, "", false, "@", "@", false)['$[]'](attr_overrides['$[]']("notitle"))];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = ["notitle", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- };
-
- $writer = ["asciidoctor", ""];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["asciidoctor-version", $$$($$$('::', 'Asciidoctor'), 'VERSION')];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["safe-mode-name", (safe_mode_name = $$($nesting, 'SafeMode').$name_for_value(self.safe))];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["" + "safe-mode-" + (safe_mode_name), ""];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["safe-mode-level", self.safe];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- ($truthy($a = attr_overrides['$[]']("max-include-depth")) ? $a : (($writer = ["max-include-depth", 64]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- ($truthy($a = attr_overrides['$[]']("allow-uri-read")) ? $a : (($writer = ["allow-uri-read", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy(attr_overrides['$key?']("numbered"))) {
-
- $writer = ["sectnums", attr_overrides.$delete("numbered")];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(attr_overrides['$key?']("hardbreaks"))) {
-
- $writer = ["hardbreaks-option", attr_overrides.$delete("hardbreaks")];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy((base_dir_val = options['$[]']("base_dir")))) {
- self.base_dir = (($writer = ["docdir", $$$('::', 'File').$expand_path(base_dir_val)]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])
- } else if ($truthy(attr_overrides['$[]']("docdir"))) {
- self.base_dir = attr_overrides['$[]']("docdir")
- } else {
- self.base_dir = (($writer = ["docdir", $$$('::', 'Dir').$pwd()]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])
- };
- if ($truthy((backend_val = options['$[]']("backend")))) {
-
- $writer = ["backend", "" + (backend_val)];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy((doctype_val = options['$[]']("doctype")))) {
-
- $writer = ["doctype", "" + (doctype_val)];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER')))) {
-
- ($truthy($a = attr_overrides['$[]']("copycss")) ? $a : (($writer = ["copycss", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- ($truthy($a = attr_overrides['$[]']("source-highlighter")) ? $a : (($writer = ["source-highlighter", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- ($truthy($a = attr_overrides['$[]']("backend")) ? $a : (($writer = ["backend", $$($nesting, 'DEFAULT_BACKEND')]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy(($truthy($a = parent_doc['$!']()) ? attr_overrides['$key?']("docfile") : $a))) {
-
- $writer = ["docfile", attr_overrides['$[]']("docfile")['$[]'](Opal.Range.$new($rb_plus(attr_overrides['$[]']("docdir").$length(), 1), -1, false))];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
-
- $writer = ["docdir", ""];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- ($truthy($a = attr_overrides['$[]']("user-home")) ? $a : (($writer = ["user-home", "."]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy($rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SECURE')))) {
-
- if ($truthy(attr_overrides['$key?']("max-attribute-value-size"))) {
- } else {
-
- $writer = ["max-attribute-value-size", 4096];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy(attr_overrides['$key?']("linkcss"))) {
- } else {
-
- $writer = ["linkcss", ""];
- $send(attr_overrides, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- ($truthy($a = attr_overrides['$[]']("icons")) ? $a : (($writer = ["icons", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));};
- } else {
- ($truthy($a = attr_overrides['$[]']("user-home")) ? $a : (($writer = ["user-home", $$($nesting, 'USER_HOME')]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- };
- self.max_attribute_value_size = (function() {if ($truthy((size = ($truthy($a = attr_overrides['$[]']("max-attribute-value-size")) ? $a : (($writer = ["max-attribute-value-size", nil]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) {
- return size.$to_i().$abs()
- } else {
- return nil
- }; return nil; })();
- $send(attr_overrides, 'delete_if', [], ($$10 = function(key, val){var self = $$10.$$s || this, $d, verdict = nil;
-
-
-
- if (key == null) {
- key = nil;
- };
-
- if (val == null) {
- val = nil;
- };
- if ($truthy(val)) {
-
- if ($truthy(($truthy($d = $$$('::', 'String')['$==='](val)) ? val['$end_with?']("@") : $d))) {
- $d = [val.$chop(), true], (val = $d[0]), (verdict = $d[1]), $d};
-
- $writer = [key, val];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
-
- attrs.$delete(key);
- verdict = val['$=='](false);
- };
- return verdict;}, $$10.$$s = self, $$10.$$arity = 2, $$10));
- if ($truthy(parent_doc)) {
-
- self.backend = attrs['$[]']("backend");
- if ((self.doctype = (($writer = ["doctype", parent_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$==']($$($nesting, 'DEFAULT_DOCTYPE'))) {
- } else {
- self.$update_doctype_attributes($$($nesting, 'DEFAULT_DOCTYPE'))
- };
- self.reader = $$($nesting, 'Reader').$new(data, options['$[]']("cursor"));
- if ($truthy(self.sourcemap)) {
- self.source_location = self.reader.$cursor()};
- $$($nesting, 'Parser').$parse(self.reader, self);
- self.$restore_attributes();
- return (self.parsed = true);
- } else {
-
- self.backend = nil;
- if ((initial_backend = ($truthy($a = attrs['$[]']("backend")) ? $a : $$($nesting, 'DEFAULT_BACKEND')))['$==']("manpage")) {
- self.doctype = (($writer = ["doctype", (($writer = ["doctype", "manpage"]), $send(attr_overrides, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])
- } else {
- self.doctype = ($truthy($a = attrs['$[]']("doctype")) ? $a : (($writer = ["doctype", $$($nesting, 'DEFAULT_DOCTYPE')]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- };
- self.$update_backend_attributes(initial_backend, true);
- ($truthy($a = attrs['$[]']("stylesdir")) ? $a : (($writer = ["stylesdir", "."]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- ($truthy($a = attrs['$[]']("iconsdir")) ? $a : (($writer = ["iconsdir", "" + (attrs.$fetch("imagesdir", "./images")) + "/icons"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- self.$fill_datetime_attributes(attrs, input_mtime);
- if ($truthy(initialize_extensions)) {
- if ($truthy((ext_registry = options['$[]']("extension_registry")))) {
- if ($truthy(($truthy($a = $$$($$($nesting, 'Extensions'), 'Registry')['$==='](ext_registry)) ? $a : ($truthy($d = (($g = $$$('::', 'AsciidoctorJ', 'skip_raise')) && ($f = $$$($g, 'Extensions', 'skip_raise')) && ($e = $$$($f, 'ExtensionRegistry', 'skip_raise')) ? 'constant' : nil)) ? $$$($$$($$$('::', 'AsciidoctorJ'), 'Extensions'), 'ExtensionRegistry')['$==='](ext_registry) : $d)))) {
- self.extensions = ext_registry.$activate(self)}
- } else if ($truthy((ext_block = options['$[]']("extensions"))['$nil?']())) {
- if ($truthy($$($nesting, 'Extensions').$groups()['$empty?']())) {
- } else {
- self.extensions = $$$($$($nesting, 'Extensions'), 'Registry').$new().$activate(self)
- }
- } else if ($truthy($$$('::', 'Proc')['$==='](ext_block))) {
- self.extensions = $send($$($nesting, 'Extensions'), 'create', [], ext_block.$to_proc()).$activate(self)}};
- self.reader = $$($nesting, 'PreprocessorReader').$new(self, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(attrs['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true}));
- if ($truthy(self.sourcemap)) {
- return (self.source_location = self.reader.$cursor())
- } else {
- return nil
- };
- };
- }, $Document_initialize$8.$$arity = -1);
-
- Opal.def(self, '$parse', $Document_parse$11 = function $$parse(data) {
- var $a, $$12, $$13, self = this, doc = nil, exts = nil;
-
-
-
- if (data == null) {
- data = nil;
- };
- if ($truthy(self.parsed)) {
- return self
- } else {
-
- doc = self;
- if ($truthy(data)) {
-
- self.reader = $$($nesting, 'PreprocessorReader').$new(doc, data, $$$($$($nesting, 'Reader'), 'Cursor').$new(self.attributes['$[]']("docfile"), self.base_dir), $hash2(["normalize"], {"normalize": true}));
- if ($truthy(self.sourcemap)) {
- self.source_location = self.reader.$cursor()};};
- if ($truthy(($truthy($a = (exts = (function() {if ($truthy(self.parent_document)) {
- return nil
- } else {
- return self.extensions
- }; return nil; })())) ? exts['$preprocessors?']() : $a))) {
- $send(exts.$preprocessors(), 'each', [], ($$12 = function(ext){var self = $$12.$$s || this, $b;
- if (self.reader == null) self.reader = nil;
-
-
-
- if (ext == null) {
- ext = nil;
- };
- return (self.reader = ($truthy($b = ext.$process_method()['$[]'](doc, self.reader)) ? $b : self.reader));}, $$12.$$s = self, $$12.$$arity = 1, $$12))};
- $$($nesting, 'Parser').$parse(self.reader, doc, $hash2(["header_only"], {"header_only": self.options['$[]']("parse_header_only")}));
- self.$restore_attributes();
- if ($truthy(($truthy($a = exts) ? exts['$tree_processors?']() : $a))) {
- $send(exts.$tree_processors(), 'each', [], ($$13 = function(ext){var self = $$13.$$s || this, $b, $c, result = nil;
-
-
-
- if (ext == null) {
- ext = nil;
- };
- if ($truthy(($truthy($b = ($truthy($c = (result = ext.$process_method()['$[]'](doc))) ? $$($nesting, 'Document')['$==='](result) : $c)) ? result['$!='](doc) : $b))) {
- return (doc = result)
- } else {
- return nil
- };}, $$13.$$s = self, $$13.$$arity = 1, $$13))};
- self.parsed = true;
- return doc;
- };
- }, $Document_parse$11.$$arity = -1);
-
- Opal.def(self, '$parsed?', $Document_parsed$ques$14 = function() {
- var self = this;
-
- return self.parsed
- }, $Document_parsed$ques$14.$$arity = 0);
-
- Opal.def(self, '$counter', $Document_counter$15 = function $$counter(name, seed) {
- var $a, self = this, locked = nil, curr_val = nil, next_val = nil, $writer = nil;
-
-
-
- if (seed == null) {
- seed = nil;
- };
- if ($truthy(self.parent_document)) {
- return self.parent_document.$counter(name, seed)};
- if ($truthy(($truthy($a = (locked = self['$attribute_locked?'](name))) ? (curr_val = self.counters['$[]'](name)) : $a))) {
- next_val = (($writer = [name, $$($nesting, 'Helpers').$nextval(curr_val)]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])
- } else if ($truthy((curr_val = self.attributes['$[]'](name))['$nil_or_empty?']()['$!']())) {
- next_val = (($writer = [name, $$($nesting, 'Helpers').$nextval(curr_val)]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])
- } else if ($truthy(seed)) {
- next_val = (($writer = [name, (function() {if (seed['$=='](seed.$to_i().$to_s())) {
- return seed.$to_i()
- } else {
- return seed
- }; return nil; })()]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])
- } else {
- next_val = (($writer = [name, 1]), $send(self.counters, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])
- };
- if ($truthy(locked)) {
- } else {
-
- $writer = [name, next_val];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- return next_val;
- }, $Document_counter$15.$$arity = -2);
-
- Opal.def(self, '$increment_and_store_counter', $Document_increment_and_store_counter$16 = function $$increment_and_store_counter(counter_name, block) {
- var self = this;
-
- return $$($nesting, 'AttributeEntry').$new(counter_name, self.$counter(counter_name)).$save_to(block.$attributes()).$value()
- }, $Document_increment_and_store_counter$16.$$arity = 2);
- Opal.alias(self, "counter_increment", "increment_and_store_counter");
-
- Opal.def(self, '$register', $Document_register$17 = function $$register(type, value) {
- var $a, self = this, $case = nil, id = nil, $logical_op_recvr_tmp_1 = nil, $writer = nil, ref = nil;
-
- return (function() {$case = type;
- if ("ids"['$===']($case)) {return self.$register("refs", [(id = value['$[]'](0)), $$($nesting, 'Inline').$new(self, "anchor", value['$[]'](1), $hash2(["type", "id"], {"type": "ref", "id": id}))])}
- else if ("refs"['$===']($case)) {
-
- $logical_op_recvr_tmp_1 = self.catalog['$[]']("refs");
- ($truthy($a = $logical_op_recvr_tmp_1['$[]'](value['$[]'](0))) ? $a : (($writer = [value['$[]'](0), (ref = value['$[]'](1))]), $send($logical_op_recvr_tmp_1, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));;
- return ref;}
- else if ("footnotes"['$===']($case)) {return self.catalog['$[]'](type)['$<<'](value)}
- else {if ($truthy(self.options['$[]']("catalog_assets"))) {
- return self.catalog['$[]'](type)['$<<']((function() {if (type['$==']("images")) {
-
- return $$($nesting, 'ImageReference').$new(value, self.attributes['$[]']("imagesdir"));
- } else {
- return value
- }; return nil; })())
- } else {
- return nil
- }}})()
- }, $Document_register$17.$$arity = 2);
-
- Opal.def(self, '$resolve_id', $Document_resolve_id$18 = function $$resolve_id(text) {
- var $$19, $$21, self = this, resolved_id = nil;
-
- if ($truthy(self.reftexts)) {
- return self.reftexts['$[]'](text)
- } else if ($truthy(self.parsed)) {
- return $send((self.reftexts = $hash2([], {})), 'tap', [], ($$19 = function(accum){var self = $$19.$$s || this, $$20;
- if (self.catalog == null) self.catalog = nil;
-
-
-
- if (accum == null) {
- accum = nil;
- };
- return $send(self.catalog['$[]']("refs"), 'each', [], ($$20 = function(id, ref){var self = $$20.$$s || this, $a, $writer = nil;
-
-
-
- if (id == null) {
- id = nil;
- };
-
- if (ref == null) {
- ref = nil;
- };
- return ($truthy($a = accum['$[]'](ref.$xreftext())) ? $a : (($writer = [ref.$xreftext(), id]), $send(accum, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));}, $$20.$$s = self, $$20.$$arity = 2, $$20));}, $$19.$$s = self, $$19.$$arity = 1, $$19))['$[]'](text)
- } else {
-
- resolved_id = nil;
- (function(){var $brk = Opal.new_brk(); try {return $send((self.reftexts = $hash2([], {})), 'tap', [], ($$21 = function(accum){var self = $$21.$$s || this, $$22;
- if (self.catalog == null) self.catalog = nil;
-
-
-
- if (accum == null) {
- accum = nil;
- };
- return (function(){var $brk = Opal.new_brk(); try {return $send(self.catalog['$[]']("refs"), 'each', [], ($$22 = function(id, ref){var self = $$22.$$s || this, $a, xreftext = nil, $writer = nil;
-
-
-
- if (id == null) {
- id = nil;
- };
-
- if (ref == null) {
- ref = nil;
- };
- if ((xreftext = ref.$xreftext())['$=='](text)) {
-
-
- Opal.brk((resolved_id = id), $brk);
- } else {
-
- return ($truthy($a = accum['$[]'](xreftext)) ? $a : (($writer = [xreftext, id]), $send(accum, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- };}, $$22.$$s = self, $$22.$$brk = $brk, $$22.$$arity = 2, $$22))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();}, $$21.$$s = self, $$21.$$brk = $brk, $$21.$$arity = 1, $$21))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();
- self.reftexts = nil;
- return resolved_id;
- }
- }, $Document_resolve_id$18.$$arity = 1);
-
- Opal.def(self, '$footnotes?', $Document_footnotes$ques$23 = function() {
- var self = this;
-
- if ($truthy(self.catalog['$[]']("footnotes")['$empty?']())) {
- return false
- } else {
- return true
- }
- }, $Document_footnotes$ques$23.$$arity = 0);
-
- Opal.def(self, '$footnotes', $Document_footnotes$24 = function $$footnotes() {
- var self = this;
-
- return self.catalog['$[]']("footnotes")
- }, $Document_footnotes$24.$$arity = 0);
-
- Opal.def(self, '$callouts', $Document_callouts$25 = function $$callouts() {
- var self = this;
-
- return self.catalog['$[]']("callouts")
- }, $Document_callouts$25.$$arity = 0);
-
- Opal.def(self, '$nested?', $Document_nested$ques$26 = function() {
- var self = this;
-
- if ($truthy(self.parent_document)) {
- return true
- } else {
- return false
- }
- }, $Document_nested$ques$26.$$arity = 0);
-
- Opal.def(self, '$embedded?', $Document_embedded$ques$27 = function() {
- var self = this;
-
- return self.attributes['$key?']("embedded")
- }, $Document_embedded$ques$27.$$arity = 0);
-
- Opal.def(self, '$extensions?', $Document_extensions$ques$28 = function() {
- var self = this;
-
- if ($truthy(self.extensions)) {
- return true
- } else {
- return false
- }
- }, $Document_extensions$ques$28.$$arity = 0);
-
- Opal.def(self, '$source', $Document_source$29 = function $$source() {
- var self = this;
-
- if ($truthy(self.reader)) {
- return self.reader.$source()
- } else {
- return nil
- }
- }, $Document_source$29.$$arity = 0);
-
- Opal.def(self, '$source_lines', $Document_source_lines$30 = function $$source_lines() {
- var self = this;
-
- if ($truthy(self.reader)) {
- return self.reader.$source_lines()
- } else {
- return nil
- }
- }, $Document_source_lines$30.$$arity = 0);
-
- Opal.def(self, '$basebackend?', $Document_basebackend$ques$31 = function(base) {
- var self = this;
-
- return self.attributes['$[]']("basebackend")['$=='](base)
- }, $Document_basebackend$ques$31.$$arity = 1);
-
- Opal.def(self, '$title', $Document_title$32 = function $$title() {
- var self = this;
-
- return self.$doctitle()
- }, $Document_title$32.$$arity = 0);
-
- Opal.def(self, '$title=', $Document_title$eq$33 = function(title) {
- var self = this, sect = nil, $writer = nil;
-
-
- if ($truthy((sect = self.header))) {
- } else {
-
- $writer = ["header"];
- $send((sect = (self.header = $$($nesting, 'Section').$new(self, 0))), 'sectname=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
-
- $writer = [title];
- $send(sect, 'title=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- }, $Document_title$eq$33.$$arity = 1);
-
- Opal.def(self, '$doctitle', $Document_doctitle$34 = function $$doctitle(opts) {
- var $a, self = this, val = nil, sect = nil, separator = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy((val = self.attributes['$[]']("title")))) {
- } else if ($truthy((sect = self.$first_section()))) {
- val = sect.$title()
- } else if ($truthy(($truthy($a = opts['$[]']("use_fallback")) ? (val = self.attributes['$[]']("untitled-label")) : $a)['$!']())) {
- return nil};
- if ($truthy((separator = opts['$[]']("partition")))) {
- return $$($nesting, 'Title').$new(val, opts.$merge($hash2(["separator"], {"separator": (function() {if (separator['$=='](true)) {
- return self.attributes['$[]']("title-separator")
- } else {
- return separator
- }; return nil; })()})))
- } else if ($truthy(($truthy($a = opts['$[]']("sanitize")) ? val['$include?']("<") : $a))) {
- return val.$gsub($$($nesting, 'XmlSanitizeRx'), "").$squeeze(" ").$strip()
- } else {
- return val
- };
- }, $Document_doctitle$34.$$arity = -1);
- Opal.alias(self, "name", "doctitle");
-
- Opal.def(self, '$xreftext', $Document_xreftext$35 = function $$xreftext(xrefstyle) {
- var $a, self = this, val = nil;
-
-
-
- if (xrefstyle == null) {
- xrefstyle = nil;
- };
- if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) {
- return val
- } else {
- return self.$title()
- };
- }, $Document_xreftext$35.$$arity = -1);
-
- Opal.def(self, '$author', $Document_author$36 = function $$author() {
- var self = this;
-
- return self.attributes['$[]']("author")
- }, $Document_author$36.$$arity = 0);
-
- Opal.def(self, '$authors', $Document_authors$37 = function $$authors() {
- var $a, self = this, attrs = nil, authors = nil, num_authors = nil, idx = nil;
-
- if ($truthy((attrs = self.attributes)['$key?']("author"))) {
-
- authors = [$$($nesting, 'Author').$new(attrs['$[]']("author"), attrs['$[]']("firstname"), attrs['$[]']("middlename"), attrs['$[]']("lastname"), attrs['$[]']("authorinitials"), attrs['$[]']("email"))];
- if ($truthy($rb_gt((num_authors = ($truthy($a = attrs['$[]']("authorcount")) ? $a : 0)), 1))) {
-
- idx = 1;
- while ($truthy($rb_lt(idx, num_authors))) {
-
- idx = $rb_plus(idx, 1);
- authors['$<<']($$($nesting, 'Author').$new(attrs['$[]']("" + "author_" + (idx)), attrs['$[]']("" + "firstname_" + (idx)), attrs['$[]']("" + "middlename_" + (idx)), attrs['$[]']("" + "lastname_" + (idx)), attrs['$[]']("" + "authorinitials_" + (idx)), attrs['$[]']("" + "email_" + (idx))));
- };};
- return authors;
- } else {
- return []
- }
- }, $Document_authors$37.$$arity = 0);
-
- Opal.def(self, '$revdate', $Document_revdate$38 = function $$revdate() {
- var self = this;
-
- return self.attributes['$[]']("revdate")
- }, $Document_revdate$38.$$arity = 0);
-
- Opal.def(self, '$notitle', $Document_notitle$39 = function $$notitle() {
- var self = this;
-
- return self.attributes['$key?']("notitle")
- }, $Document_notitle$39.$$arity = 0);
-
- Opal.def(self, '$noheader', $Document_noheader$40 = function $$noheader() {
- var self = this;
-
- return self.attributes['$key?']("noheader")
- }, $Document_noheader$40.$$arity = 0);
-
- Opal.def(self, '$nofooter', $Document_nofooter$41 = function $$nofooter() {
- var self = this;
-
- return self.attributes['$key?']("nofooter")
- }, $Document_nofooter$41.$$arity = 0);
-
- Opal.def(self, '$first_section', $Document_first_section$42 = function $$first_section() {
- var $a, $$43, self = this;
-
- return ($truthy($a = self.header) ? $a : $send(self.blocks, 'find', [], ($$43 = function(e){var self = $$43.$$s || this;
-
-
-
- if (e == null) {
- e = nil;
- };
- return e.$context()['$==']("section");}, $$43.$$s = self, $$43.$$arity = 1, $$43)))
- }, $Document_first_section$42.$$arity = 0);
-
- Opal.def(self, '$header?', $Document_header$ques$44 = function() {
- var self = this;
-
- if ($truthy(self.header)) {
- return true
- } else {
- return false
- }
- }, $Document_header$ques$44.$$arity = 0);
- Opal.alias(self, "has_header?", "header?");
-
- Opal.def(self, '$<<', $Document_$lt$lt$45 = function(block) {
- var $iter = $Document_$lt$lt$45.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Document_$lt$lt$45.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
- if (block.$context()['$==']("section")) {
- self.$assign_numeral(block)};
- return $send(self, Opal.find_super_dispatcher(self, '<<', $Document_$lt$lt$45, false), $zuper, $iter);
- }, $Document_$lt$lt$45.$$arity = 1);
-
- Opal.def(self, '$finalize_header', $Document_finalize_header$46 = function $$finalize_header(unrooted_attributes, header_valid) {
- var self = this, $writer = nil;
-
-
-
- if (header_valid == null) {
- header_valid = true;
- };
- self.$clear_playback_attributes(unrooted_attributes);
- self.$save_attributes();
- if ($truthy(header_valid)) {
- } else {
-
- $writer = ["invalid-header", true];
- $send(unrooted_attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- return unrooted_attributes;
- }, $Document_finalize_header$46.$$arity = -2);
-
- Opal.def(self, '$playback_attributes', $Document_playback_attributes$47 = function $$playback_attributes(block_attributes) {
- var $$48, self = this;
-
- if ($truthy(block_attributes['$key?']("attribute_entries"))) {
- return $send(block_attributes['$[]']("attribute_entries"), 'each', [], ($$48 = function(entry){var self = $$48.$$s || this, name = nil, $writer = nil;
- if (self.attributes == null) self.attributes = nil;
-
-
-
- if (entry == null) {
- entry = nil;
- };
- name = entry.$name();
- if ($truthy(entry.$negate())) {
-
- self.attributes.$delete(name);
- if (name['$==']("compat-mode")) {
- return (self.compat_mode = false)
- } else {
- return nil
- };
- } else {
-
-
- $writer = [name, entry.$value()];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if (name['$==']("compat-mode")) {
- return (self.compat_mode = true)
- } else {
- return nil
- };
- };}, $$48.$$s = self, $$48.$$arity = 1, $$48))
- } else {
- return nil
- }
- }, $Document_playback_attributes$47.$$arity = 1);
-
- Opal.def(self, '$restore_attributes', $Document_restore_attributes$49 = function $$restore_attributes() {
- var self = this;
-
-
- if ($truthy(self.parent_document)) {
- } else {
- self.catalog['$[]']("callouts").$rewind()
- };
- return self.attributes.$replace(self.header_attributes);
- }, $Document_restore_attributes$49.$$arity = 0);
-
- Opal.def(self, '$set_attribute', $Document_set_attribute$50 = function $$set_attribute(name, value) {
- var $a, self = this, $writer = nil, $case = nil;
-
-
-
- if (value == null) {
- value = "";
- };
- if ($truthy(self['$attribute_locked?'](name))) {
- return nil
- } else {
-
- if ($truthy(value['$empty?']())) {
- } else {
- value = self.$apply_attribute_value_subs(value)
- };
- if ($truthy(self.header_attributes)) {
-
- $writer = [name, value];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $case = name;
- if ("backend"['$===']($case)) {self.$update_backend_attributes(value, ($truthy($a = self.attributes_modified['$delete?']("htmlsyntax")) ? value['$=='](self.backend) : $a))}
- else if ("doctype"['$===']($case)) {self.$update_doctype_attributes(value)}
- else {
- $writer = [name, value];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- self.attributes_modified['$<<'](name);
- };
- return value;
- };
- }, $Document_set_attribute$50.$$arity = -2);
-
- Opal.def(self, '$delete_attribute', $Document_delete_attribute$51 = function $$delete_attribute(name) {
- var self = this;
-
- if ($truthy(self['$attribute_locked?'](name))) {
- return false
- } else {
-
- self.attributes.$delete(name);
- self.attributes_modified['$<<'](name);
- return true;
- }
- }, $Document_delete_attribute$51.$$arity = 1);
-
- Opal.def(self, '$attribute_locked?', $Document_attribute_locked$ques$52 = function(name) {
- var self = this;
-
- return self.attribute_overrides['$key?'](name)
- }, $Document_attribute_locked$ques$52.$$arity = 1);
-
- Opal.def(self, '$set_header_attribute', $Document_set_header_attribute$53 = function $$set_header_attribute(name, value, overwrite) {
- var $a, self = this, attrs = nil, $writer = nil;
-
-
-
- if (value == null) {
- value = "";
- };
-
- if (overwrite == null) {
- overwrite = true;
- };
- attrs = ($truthy($a = self.header_attributes) ? $a : self.attributes);
- if ($truthy((($a = overwrite['$=='](false)) ? attrs['$key?'](name) : overwrite['$=='](false)))) {
- return false
- } else {
-
-
- $writer = [name, value];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return true;
- };
- }, $Document_set_header_attribute$53.$$arity = -2);
-
- Opal.def(self, '$convert', $Document_convert$54 = function $$convert(opts) {
- var $a, $$55, self = this, $writer = nil, block = nil, output = nil, transform = nil, exts = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy(self.timings)) {
- self.timings.$start("convert")};
- if ($truthy(self.parsed)) {
- } else {
- self.$parse()
- };
- if ($truthy(($truthy($a = $rb_ge(self.safe, $$$($$($nesting, 'SafeMode'), 'SERVER'))) ? $a : opts['$empty?']()))) {
- } else {
-
- if ($truthy((($writer = ["outfile", opts['$[]']("outfile")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) {
- } else {
- self.attributes.$delete("outfile")
- };
- if ($truthy((($writer = ["outdir", opts['$[]']("outdir")]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))) {
- } else {
- self.attributes.$delete("outdir")
- };
- };
- if (self.$doctype()['$==']("inline")) {
- if ($truthy((block = ($truthy($a = self.blocks['$[]'](0)) ? $a : self.header)))) {
- if ($truthy(($truthy($a = block.$content_model()['$==']("compound")) ? $a : block.$content_model()['$==']("empty")))) {
- self.$logger().$warn("no inline candidate; use the inline doctype to convert a single paragragh, verbatim, or raw block")
- } else {
- output = block.$content()
- }}
- } else {
-
- if ($truthy(opts['$key?']("standalone"))) {
- transform = (function() {if ($truthy(opts['$[]']("standalone"))) {
- return "document"
- } else {
- return "embedded"
- }; return nil; })()
- } else if ($truthy(opts['$key?']("header_footer"))) {
- transform = (function() {if ($truthy(opts['$[]']("header_footer"))) {
- return "document"
- } else {
- return "embedded"
- }; return nil; })()
- } else {
- transform = (function() {if ($truthy(self.options['$[]']("standalone"))) {
- return "document"
- } else {
- return "embedded"
- }; return nil; })()
- };
- output = self.converter.$convert(self, transform);
- };
- if ($truthy(self.parent_document)) {
- } else if ($truthy(($truthy($a = (exts = self.extensions)) ? exts['$postprocessors?']() : $a))) {
- $send(exts.$postprocessors(), 'each', [], ($$55 = function(ext){var self = $$55.$$s || this;
-
-
-
- if (ext == null) {
- ext = nil;
- };
- return (output = ext.$process_method()['$[]'](self, output));}, $$55.$$s = self, $$55.$$arity = 1, $$55))};
- if ($truthy(self.timings)) {
- self.timings.$record("convert")};
- return output;
- }, $Document_convert$54.$$arity = -1);
- Opal.alias(self, "render", "convert");
-
- Opal.def(self, '$write', $Document_write$56 = function $$write(output, target) {
- var $a, $b, self = this;
-
-
- if ($truthy(self.timings)) {
- self.timings.$start("write")};
- if ($truthy($$($nesting, 'Writer')['$==='](self.converter))) {
- self.converter.$write(output, target)
- } else {
-
- if ($truthy(target['$respond_to?']("write"))) {
- if ($truthy(output['$nil_or_empty?']())) {
- } else {
-
- target.$write(output.$chomp());
- target.$write($$($nesting, 'LF'));
- }
- } else {
- $$$('::', 'File').$write(target, output, $hash2(["mode"], {"mode": $$($nesting, 'FILE_WRITE_MODE')}))
- };
- if ($truthy(($truthy($a = (($b = self.backend['$==']("manpage")) ? $$$('::', 'String')['$==='](target) : self.backend['$==']("manpage"))) ? self.converter.$class()['$respond_to?']("write_alternate_pages") : $a))) {
- self.converter.$class().$write_alternate_pages(self.attributes['$[]']("mannames"), self.attributes['$[]']("manvolnum"), target)};
- };
- if ($truthy(self.timings)) {
- self.timings.$record("write")};
- return nil;
- }, $Document_write$56.$$arity = 2);
-
- Opal.def(self, '$content', $Document_content$57 = function $$content() {
- var $iter = $Document_content$57.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Document_content$57.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
- self.attributes.$delete("title");
- return $send(self, Opal.find_super_dispatcher(self, 'content', $Document_content$57, false), $zuper, $iter);
- }, $Document_content$57.$$arity = 0);
-
- Opal.def(self, '$docinfo', $Document_docinfo$58 = function $$docinfo(location, suffix) {
- var $$59, $a, $$60, self = this, qualifier = nil, docinfo = nil, content = nil, docinfo_file = nil, docinfo_dir = nil, docinfo_subs = nil, docinfo_path = nil, shared_docinfo = nil, private_docinfo = nil;
-
-
-
- if (location == null) {
- location = "head";
- };
-
- if (suffix == null) {
- suffix = nil;
- };
- if ($truthy($rb_lt(self.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) {
-
- if (location['$==']("head")) {
- } else {
- qualifier = "" + "-" + (location)
- };
- if ($truthy(suffix)) {
- } else {
- suffix = self.outfilesuffix
- };
- if ($truthy((docinfo = self.attributes['$[]']("docinfo"))['$nil_or_empty?']())) {
- if ($truthy(self.attributes['$key?']("docinfo2"))) {
- docinfo = ["private", "shared"]
- } else if ($truthy(self.attributes['$key?']("docinfo1"))) {
- docinfo = ["shared"]
- } else {
- docinfo = (function() {if ($truthy(docinfo)) {
- return ["private"]
- } else {
- return nil
- }; return nil; })()
- }
- } else {
- docinfo = $send(docinfo.$split(","), 'map', [], ($$59 = function(it){var self = $$59.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- return it.$strip();}, $$59.$$s = self, $$59.$$arity = 1, $$59))
- };
- if ($truthy(docinfo)) {
-
- content = [];
- $a = ["" + "docinfo" + (qualifier) + (suffix), self.attributes['$[]']("docinfodir"), self.$resolve_docinfo_subs()], (docinfo_file = $a[0]), (docinfo_dir = $a[1]), (docinfo_subs = $a[2]), $a;
- if ($truthy(docinfo['$&'](["shared", "" + "shared-" + (location)])['$empty?']())) {
- } else {
-
- docinfo_path = self.$normalize_system_path(docinfo_file, docinfo_dir);
- if ($truthy((shared_docinfo = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) {
- content['$<<'](self.$apply_subs(shared_docinfo, docinfo_subs))};
- };
- if ($truthy(($truthy($a = self.attributes['$[]']("docname")['$nil_or_empty?']()) ? $a : docinfo['$&'](["private", "" + "private-" + (location)])['$empty?']()))) {
- } else {
-
- docinfo_path = self.$normalize_system_path("" + (self.attributes['$[]']("docname")) + "-" + (docinfo_file), docinfo_dir);
- if ($truthy((private_docinfo = self.$read_asset(docinfo_path, $hash2(["normalize"], {"normalize": true}))))) {
- content['$<<'](self.$apply_subs(private_docinfo, docinfo_subs))};
- };};};
- if ($truthy(($truthy($a = self.extensions) ? self['$docinfo_processors?'](location) : $a))) {
- return ($truthy($a = content) ? $a : []).$concat($send(self.docinfo_processor_extensions['$[]'](location), 'map', [], ($$60 = function(ext){var self = $$60.$$s || this;
-
-
-
- if (ext == null) {
- ext = nil;
- };
- return ext.$process_method()['$[]'](self);}, $$60.$$s = self, $$60.$$arity = 1, $$60)).$compact()).$join($$($nesting, 'LF'))
- } else if ($truthy(content)) {
- return content.$join($$($nesting, 'LF'))
- } else {
- return ""
- };
- }, $Document_docinfo$58.$$arity = -1);
-
- Opal.def(self, '$docinfo_processors?', $Document_docinfo_processors$ques$61 = function(location) {
- var $a, self = this, $writer = nil;
-
-
-
- if (location == null) {
- location = "head";
- };
- if ($truthy(self.docinfo_processor_extensions['$key?'](location))) {
- return self.docinfo_processor_extensions['$[]'](location)['$!='](false)
- } else if ($truthy(($truthy($a = self.extensions) ? self.document.$extensions()['$docinfo_processors?'](location) : $a))) {
- return (($writer = [location, self.document.$extensions().$docinfo_processors(location)]), $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$!']()['$!']()
- } else {
-
- $writer = [location, false];
- $send(self.docinfo_processor_extensions, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };
- }, $Document_docinfo_processors$ques$61.$$arity = -1);
-
- Opal.def(self, '$to_s', $Document_to_s$62 = function $$to_s() {
- var self = this;
-
- return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {doctype: " + (self.$doctype().$inspect()) + ", doctitle: " + ((function() {if ($truthy(self.header['$!='](nil))) {
- return self.header.$title()
- } else {
- return nil
- }; return nil; })().$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>"
- }, $Document_to_s$62.$$arity = 0);
- self.$private();
-
- Opal.def(self, '$apply_attribute_value_subs', $Document_apply_attribute_value_subs$63 = function $$apply_attribute_value_subs(value) {
- var $a, self = this;
-
-
- if ($truthy($$($nesting, 'AttributeEntryPassMacroRx')['$=~'](value))) {
-
- value = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2));
- if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))) {
- value = self.$apply_subs(value, self.$resolve_pass_subs((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))))};
- } else {
- value = self.$apply_header_subs(value)
- };
- if ($truthy(self.max_attribute_value_size)) {
-
- return self.$limit_bytesize(value, self.max_attribute_value_size);
- } else {
- return value
- };
- }, $Document_apply_attribute_value_subs$63.$$arity = 1);
-
- Opal.def(self, '$limit_bytesize', $Document_limit_bytesize$64 = function $$limit_bytesize(str, max) {
- var $a, self = this;
-
-
- if ($truthy($rb_gt(str.$bytesize(), max))) {
- while (!($truthy((str = str.$byteslice(0, max))['$valid_encoding?']()))) {
- max = $rb_minus(max, 1)
- }};
- return str;
- }, $Document_limit_bytesize$64.$$arity = 2);
-
- Opal.def(self, '$resolve_docinfo_subs', $Document_resolve_docinfo_subs$65 = function $$resolve_docinfo_subs() {
- var self = this;
-
- if ($truthy(self.attributes['$key?']("docinfosubs"))) {
-
- return self.$resolve_subs(self.attributes['$[]']("docinfosubs"), "block", nil, "docinfo");
- } else {
- return ["attributes"]
- }
- }, $Document_resolve_docinfo_subs$65.$$arity = 0);
-
- Opal.def(self, '$create_converter', $Document_create_converter$66 = function $$create_converter(backend, delegate_backend) {
- var $a, self = this, converter_opts = nil, template_dirs = nil, opts = nil, $writer = nil, converter = nil;
-
-
- converter_opts = $hash2(["document", "htmlsyntax"], {"document": self, "htmlsyntax": self.attributes['$[]']("htmlsyntax")});
- if ($truthy((template_dirs = ($truthy($a = (opts = self.options)['$[]']("template_dirs")) ? $a : opts['$[]']("template_dir"))))) {
-
-
- $writer = ["template_dirs", [].concat(Opal.to_a(template_dirs))];
- $send(converter_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["template_cache", opts.$fetch("template_cache", true)];
- $send(converter_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["template_engine", opts['$[]']("template_engine")];
- $send(converter_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["template_engine_options", opts['$[]']("template_engine_options")];
- $send(converter_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["eruby", opts['$[]']("eruby")];
- $send(converter_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["safe", self.safe];
- $send(converter_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(delegate_backend)) {
-
- $writer = ["delegate_backend", delegate_backend];
- $send(converter_opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};};
- if ($truthy((converter = opts['$[]']("converter")))) {
- return $$$($$($nesting, 'Converter'), 'CustomFactory').$new($hash(backend, converter)).$create(backend, converter_opts)
- } else {
- return opts.$fetch("converter_factory", $$($nesting, 'Converter')).$create(backend, converter_opts)
- };
- }, $Document_create_converter$66.$$arity = 2);
-
- Opal.def(self, '$clear_playback_attributes', $Document_clear_playback_attributes$67 = function $$clear_playback_attributes(attributes) {
- var self = this;
-
- return attributes.$delete("attribute_entries")
- }, $Document_clear_playback_attributes$67.$$arity = 1);
-
- Opal.def(self, '$save_attributes', $Document_save_attributes$68 = function $$save_attributes() {
- var $a, $$69, self = this, attrs = nil, doctitle_val = nil, $writer = nil, toc_val = nil, toc_position_val = nil, toc_placement_val = nil, default_toc_position = nil, default_toc_class = nil, position = nil, $case = nil, icons_val = nil, basebackend = nil, syntax_hl_name = nil, syntax_hl_factory = nil, syntax_hls = nil;
-
-
- if ($truthy(($truthy($a = (attrs = self.attributes)['$key?']("doctitle")) ? $a : (doctitle_val = self.$doctitle())['$!']()))) {
- } else {
-
- $writer = ["doctitle", doctitle_val];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- self.id = ($truthy($a = self.id) ? $a : attrs['$[]']("css-signature"));
- if ($truthy((toc_val = (function() {if ($truthy(attrs.$delete("toc2"))) {
- return "left"
- } else {
- return attrs['$[]']("toc")
- }; return nil; })()))) {
-
- toc_position_val = (function() {if ($truthy(($truthy($a = (toc_placement_val = attrs.$fetch("toc-placement", "macro"))) ? toc_placement_val['$!=']("auto") : $a))) {
- return toc_placement_val
- } else {
- return attrs['$[]']("toc-position")
- }; return nil; })();
- if ($truthy(($truthy($a = toc_val['$empty?']()) ? toc_position_val['$nil_or_empty?']() : $a))) {
- } else {
-
- default_toc_position = "left";
- default_toc_class = "toc2";
- position = (function() {if ($truthy(toc_position_val['$nil_or_empty?']())) {
-
- if ($truthy(toc_val['$empty?']())) {
- return default_toc_position
- } else {
- return toc_val
- };
- } else {
- return toc_position_val
- }; return nil; })();
-
- $writer = ["toc", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["toc-placement", "auto"];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- $case = position;
- if ("left"['$===']($case) || "<"['$===']($case) || "<"['$===']($case)) {
- $writer = ["toc-position", "left"];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- else if ("right"['$===']($case) || ">"['$===']($case) || ">"['$===']($case)) {
- $writer = ["toc-position", "right"];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- else if ("top"['$===']($case) || "^"['$===']($case)) {
- $writer = ["toc-position", "top"];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- else if ("bottom"['$===']($case) || "v"['$===']($case)) {
- $writer = ["toc-position", "bottom"];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- else if ("preamble"['$===']($case) || "macro"['$===']($case)) {
-
- $writer = ["toc-position", "content"];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["toc-placement", position];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- default_toc_class = nil;}
- else {
- attrs.$delete("toc-position");
- default_toc_class = nil;};
- if ($truthy(default_toc_class)) {
- ($truthy($a = attrs['$[]']("toc-class")) ? $a : (($writer = ["toc-class", default_toc_class]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))};
- };};
- if ($truthy(($truthy($a = (icons_val = attrs['$[]']("icons"))) ? attrs['$key?']("icontype")['$!']() : $a))) {
- $case = icons_val;
- if (""['$===']($case) || "font"['$===']($case)) {nil}
- else {
-
- $writer = ["icons", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if (icons_val['$==']("image")) {
- } else {
-
- $writer = ["icontype", icons_val];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };}};
- if ($truthy((self.compat_mode = attrs['$key?']("compat-mode")))) {
- if ($truthy(attrs['$key?']("language"))) {
-
- $writer = ["source-language", attrs['$[]']("language")];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}};
- if ($truthy(self.parent_document)) {
- } else {
-
- if ((basebackend = attrs['$[]']("basebackend"))['$==']("html")) {
- if ($truthy(($truthy($a = (syntax_hl_name = attrs['$[]']("source-highlighter"))) ? attrs['$[]']("" + (syntax_hl_name) + "-unavailable")['$!']() : $a))) {
- if ($truthy((syntax_hl_factory = self.options['$[]']("syntax_highlighter_factory")))) {
- self.syntax_highlighter = syntax_hl_factory.$create(syntax_hl_name, self.backend, $hash2(["document"], {"document": self}))
- } else if ($truthy((syntax_hls = self.options['$[]']("syntax_highlighters")))) {
- self.syntax_highlighter = $$$($$($nesting, 'SyntaxHighlighter'), 'DefaultFactoryProxy').$new(syntax_hls).$create(syntax_hl_name, self.backend, $hash2(["document"], {"document": self}))
- } else {
- self.syntax_highlighter = $$($nesting, 'SyntaxHighlighter').$create(syntax_hl_name, self.backend, $hash2(["document"], {"document": self}))
- }}
- } else if (basebackend['$==']("docbook")) {
-
- if ($truthy(($truthy($a = self['$attribute_locked?']("toc")) ? $a : self.attributes_modified['$include?']("toc")))) {
- } else {
-
- $writer = ["toc", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy(($truthy($a = self['$attribute_locked?']("sectnums")) ? $a : self.attributes_modified['$include?']("sectnums")))) {
- } else {
-
- $writer = ["sectnums", ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };};
- self.outfilesuffix = attrs['$[]']("outfilesuffix");
- $send($$($nesting, 'FLEXIBLE_ATTRIBUTES'), 'each', [], ($$69 = function(name){var self = $$69.$$s || this, $b;
- if (self.attribute_overrides == null) self.attribute_overrides = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
- if ($truthy(($truthy($b = self.attribute_overrides['$key?'](name)) ? self.attribute_overrides['$[]'](name) : $b))) {
- return self.attribute_overrides.$delete(name)
- } else {
- return nil
- };}, $$69.$$s = self, $$69.$$arity = 1, $$69));
- };
- return (self.header_attributes = attrs.$merge());
- }, $Document_save_attributes$68.$$arity = 0);
-
- Opal.def(self, '$fill_datetime_attributes', $Document_fill_datetime_attributes$70 = function $$fill_datetime_attributes(attrs, input_mtime) {
- var $a, $b, self = this, now = nil, source_date_epoch = nil, localdate = nil, $writer = nil, localtime = nil, docdate = nil, doctime = nil;
-
-
- now = (function() {if ($truthy($$$('::', 'ENV')['$key?']("SOURCE_DATE_EPOCH"))) {
-
- return (source_date_epoch = $$$('::', 'Time').$at(self.$Integer($$$('::', 'ENV')['$[]']("SOURCE_DATE_EPOCH"))).$utc());
- } else {
- return $$$('::', 'Time').$now()
- }; return nil; })();
- if ($truthy((localdate = attrs['$[]']("localdate")))) {
- ($truthy($a = attrs['$[]']("localyear")) ? $a : (($writer = ["localyear", (function() {if (localdate.$index("-")['$=='](4)) {
-
- return localdate.$slice(0, 4);
- } else {
- return nil
- }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- } else {
-
- localdate = (($writer = ["localdate", now.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]);
- ($truthy($a = attrs['$[]']("localyear")) ? $a : (($writer = ["localyear", now.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- };
- localtime = ($truthy($a = attrs['$[]']("localtime")) ? $a : (($writer = ["localtime", now.$strftime("" + "%T " + ((function() {if (now.$utc_offset()['$=='](0)) {
- return "UTC"
- } else {
- return "%z"
- }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- ($truthy($a = attrs['$[]']("localdatetime")) ? $a : (($writer = ["localdatetime", "" + (localdate) + " " + (localtime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- input_mtime = ($truthy($a = ($truthy($b = source_date_epoch) ? $b : input_mtime)) ? $a : now);
- if ($truthy((docdate = attrs['$[]']("docdate")))) {
- ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", (function() {if (docdate.$index("-")['$=='](4)) {
-
- return docdate.$slice(0, 4);
- } else {
- return nil
- }; return nil; })()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- } else {
-
- docdate = (($writer = ["docdate", input_mtime.$strftime("%F")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]);
- ($truthy($a = attrs['$[]']("docyear")) ? $a : (($writer = ["docyear", input_mtime.$year().$to_s()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- };
- doctime = ($truthy($a = attrs['$[]']("doctime")) ? $a : (($writer = ["doctime", input_mtime.$strftime("" + "%T " + ((function() {if (input_mtime.$utc_offset()['$=='](0)) {
- return "UTC"
- } else {
- return "%z"
- }; return nil; })()))]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- ($truthy($a = attrs['$[]']("docdatetime")) ? $a : (($writer = ["docdatetime", "" + (docdate) + " " + (doctime)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- return nil;
- }, $Document_fill_datetime_attributes$70.$$arity = 2);
-
- Opal.def(self, '$update_backend_attributes', $Document_update_backend_attributes$71 = function $$update_backend_attributes(new_backend, init) {
- var $a, $b, self = this, current_backend = nil, current_basebackend = nil, attrs = nil, current_doctype = nil, actual_backend = nil, _ = nil, $writer = nil, delegate_backend = nil, converter = nil, new_basebackend = nil, new_filetype = nil, htmlsyntax = nil, backend_traits = nil, current_filetype = nil, page_width = nil;
-
-
-
- if (init == null) {
- init = nil;
- };
- if ($truthy(($truthy($a = init) ? $a : new_backend['$!='](self.backend)))) {
-
- current_backend = self.backend;
- current_basebackend = (attrs = self.attributes)['$[]']("basebackend");
- current_doctype = self.doctype;
- if ($truthy(new_backend['$include?'](":"))) {
- $b = new_backend.$partition(":"), $a = Opal.to_ary($b), (actual_backend = ($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (new_backend = ($a[2] == null ? nil : $a[2])), $b};
- if ($truthy(new_backend['$start_with?']("xhtml"))) {
-
-
- $writer = ["htmlsyntax", "xml"];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- new_backend = new_backend.$slice(1, new_backend.$length());
- } else if ($truthy(new_backend['$start_with?']("html"))) {
- ($truthy($a = attrs['$[]']("htmlsyntax")) ? $a : (($writer = ["htmlsyntax", "html"]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))};
- new_backend = ($truthy($a = $$($nesting, 'BACKEND_ALIASES')['$[]'](new_backend)) ? $a : new_backend);
- if ($truthy(actual_backend)) {
- $a = [actual_backend, new_backend], (new_backend = $a[0]), (delegate_backend = $a[1]), $a};
- if ($truthy(current_doctype)) {
-
- if ($truthy(current_backend)) {
-
- attrs.$delete("" + "backend-" + (current_backend));
- attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype));};
-
- $writer = ["" + "backend-" + (new_backend) + "-doctype-" + (current_doctype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["" + "doctype-" + (current_doctype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else if ($truthy(current_backend)) {
- attrs.$delete("" + "backend-" + (current_backend))};
-
- $writer = ["" + "backend-" + (new_backend), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- self.backend = (($writer = ["backend", new_backend]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]);
- if ($truthy($$$($$($nesting, 'Converter'), 'BackendTraits')['$===']((converter = self.$create_converter(new_backend, delegate_backend))))) {
-
- new_basebackend = converter.$basebackend();
- new_filetype = converter.$filetype();
- if ($truthy((htmlsyntax = converter.$htmlsyntax()))) {
-
- $writer = ["htmlsyntax", htmlsyntax];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(init)) {
- ($truthy($a = attrs['$[]']("outfilesuffix")) ? $a : (($writer = ["outfilesuffix", converter.$outfilesuffix()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- } else if ($truthy(self['$attribute_locked?']("outfilesuffix"))) {
- } else {
-
- $writer = ["outfilesuffix", converter.$outfilesuffix()];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- } else if ($truthy(converter)) {
-
- backend_traits = $$($nesting, 'Converter').$derive_backend_traits(new_backend);
- new_basebackend = backend_traits['$[]']("basebackend");
- new_filetype = backend_traits['$[]']("filetype");
- if ($truthy(init)) {
- ($truthy($a = attrs['$[]']("outfilesuffix")) ? $a : (($writer = ["outfilesuffix", backend_traits['$[]']("outfilesuffix")]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- } else if ($truthy(self['$attribute_locked?']("outfilesuffix"))) {
- } else {
-
- $writer = ["outfilesuffix", backend_traits['$[]']("outfilesuffix")];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- } else {
- self.$raise($$$('::', 'NotImplementedError'), "" + "asciidoctor: FAILED: missing converter for backend '" + (new_backend) + "'. Processing aborted.")
- };
- self.converter = converter;
- if ($truthy((current_filetype = attrs['$[]']("filetype")))) {
- attrs.$delete("" + "filetype-" + (current_filetype))};
-
- $writer = ["filetype", new_filetype];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["" + "filetype-" + (new_filetype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy((page_width = $$($nesting, 'DEFAULT_PAGE_WIDTHS')['$[]'](new_basebackend)))) {
-
- $writer = ["pagewidth", page_width];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
- attrs.$delete("pagewidth")
- };
- if ($truthy(new_basebackend['$!='](current_basebackend))) {
-
- if ($truthy(current_doctype)) {
-
- if ($truthy(current_basebackend)) {
-
- attrs.$delete("" + "basebackend-" + (current_basebackend));
- attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype));};
-
- $writer = ["" + "basebackend-" + (new_basebackend) + "-doctype-" + (current_doctype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else if ($truthy(current_basebackend)) {
- attrs.$delete("" + "basebackend-" + (current_basebackend))};
-
- $writer = ["" + "basebackend-" + (new_basebackend), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["basebackend", new_basebackend];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- return new_backend;
- } else {
- return nil
- };
- }, $Document_update_backend_attributes$71.$$arity = -2);
- return (Opal.def(self, '$update_doctype_attributes', $Document_update_doctype_attributes$72 = function $$update_doctype_attributes(new_doctype) {
- var $a, self = this, attrs = nil, current_backend = nil, current_basebackend = nil, current_doctype = nil, $writer = nil;
-
- if ($truthy(($truthy($a = new_doctype) ? new_doctype['$!='](self.doctype) : $a))) {
-
- $a = [self.backend, (attrs = self.attributes)['$[]']("basebackend"), self.doctype], (current_backend = $a[0]), (current_basebackend = $a[1]), (current_doctype = $a[2]), $a;
- if ($truthy(current_doctype)) {
-
- attrs.$delete("" + "doctype-" + (current_doctype));
- if ($truthy(current_backend)) {
-
- attrs.$delete("" + "backend-" + (current_backend) + "-doctype-" + (current_doctype));
-
- $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- if ($truthy(current_basebackend)) {
-
- attrs.$delete("" + "basebackend-" + (current_basebackend) + "-doctype-" + (current_doctype));
-
- $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- } else {
-
- if ($truthy(current_backend)) {
-
- $writer = ["" + "backend-" + (current_backend) + "-doctype-" + (new_doctype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(current_basebackend)) {
-
- $writer = ["" + "basebackend-" + (current_basebackend) + "-doctype-" + (new_doctype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- };
-
- $writer = ["" + "doctype-" + (new_doctype), ""];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return (self.doctype = (($writer = ["doctype", new_doctype]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- } else {
- return nil
- }
- }, $Document_update_doctype_attributes$72.$$arity = 1), nil) && 'update_doctype_attributes';
- })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/inline"] = function(Opal) {
- 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, $send = Opal.send, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$attr_accessor', '$attr_reader', '$[]', '$convert', '$converter', '$attr', '$==', '$apply_reftext_subs', '$reftext']);
- 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, 'Inline');
-
- var $nesting = [self].concat($parent_nesting), $Inline_initialize$1, $Inline_block$ques$2, $Inline_inline$ques$3, $Inline_convert$4, $Inline_alt$5, $Inline_reftext$ques$6, $Inline_reftext$7, $Inline_xreftext$8;
-
- self.$$prototype.text = self.$$prototype.type = nil;
-
- self.$attr_accessor("text");
- self.$attr_reader("type");
- self.$attr_accessor("target");
-
- Opal.def(self, '$initialize', $Inline_initialize$1 = function $$initialize(parent, context, text, opts) {
- var $iter = $Inline_initialize$1.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $Inline_initialize$1.$$p = null;
-
-
- if (text == null) {
- text = nil;
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $Inline_initialize$1, false), [parent, context, opts], null);
- self.node_name = "" + "inline_" + (context);
- self.text = text;
- self.id = opts['$[]']("id");
- self.type = opts['$[]']("type");
- return (self.target = opts['$[]']("target"));
- }, $Inline_initialize$1.$$arity = -3);
-
- Opal.def(self, '$block?', $Inline_block$ques$2 = function() {
- var self = this;
-
- return false
- }, $Inline_block$ques$2.$$arity = 0);
-
- Opal.def(self, '$inline?', $Inline_inline$ques$3 = function() {
- var self = this;
-
- return true
- }, $Inline_inline$ques$3.$$arity = 0);
-
- Opal.def(self, '$convert', $Inline_convert$4 = function $$convert() {
- var self = this;
-
- return self.$converter().$convert(self)
- }, $Inline_convert$4.$$arity = 0);
- Opal.alias(self, "render", "convert");
-
- Opal.def(self, '$alt', $Inline_alt$5 = function $$alt() {
- var $a, self = this;
-
- return ($truthy($a = self.$attr("alt")) ? $a : "")
- }, $Inline_alt$5.$$arity = 0);
-
- Opal.def(self, '$reftext?', $Inline_reftext$ques$6 = function() {
- var $a, $b, self = this;
-
- return ($truthy($a = self.text) ? ($truthy($b = self.type['$==']("ref")) ? $b : self.type['$==']("bibref")) : $a)
- }, $Inline_reftext$ques$6.$$arity = 0);
-
- Opal.def(self, '$reftext', $Inline_reftext$7 = function $$reftext() {
- var self = this, val = nil;
-
- if ($truthy((val = self.text))) {
-
- return self.$apply_reftext_subs(val);
- } else {
- return nil
- }
- }, $Inline_reftext$7.$$arity = 0);
- return (Opal.def(self, '$xreftext', $Inline_xreftext$8 = function $$xreftext(xrefstyle) {
- var self = this;
-
-
-
- if (xrefstyle == null) {
- xrefstyle = nil;
- };
- return self.$reftext();
- }, $Inline_xreftext$8.$$arity = -1), nil) && 'xreftext';
- })($nesting[0], $$($nesting, 'AbstractNode'), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/list"] = function(Opal) {
- 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, $send = Opal.send, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$==', '$next_list', '$callouts', '$class', '$object_id', '$inspect', '$size', '$items', '$attr_accessor', '$level', '$drop', '$nil_or_empty?', '$apply_subs', '$empty?', '$===', '$[]', '$outline?', '$!', '$simple?', '$source', '$shift', '$context', '$parent']);
- 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, 'List');
-
- var $nesting = [self].concat($parent_nesting), $List_initialize$1, $List_outline$ques$2, $List_convert$3, $List_to_s$4;
-
- self.$$prototype.context = self.$$prototype.document = self.$$prototype.style = nil;
-
- Opal.alias(self, "items", "blocks");
- Opal.alias(self, "content", "blocks");
- Opal.alias(self, "items?", "blocks?");
-
- Opal.def(self, '$initialize', $List_initialize$1 = function $$initialize(parent, context, opts) {
- var $iter = $List_initialize$1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $List_initialize$1.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- return $send(self, Opal.find_super_dispatcher(self, 'initialize', $List_initialize$1, false), $zuper, $iter);
- }, $List_initialize$1.$$arity = -3);
-
- Opal.def(self, '$outline?', $List_outline$ques$2 = function() {
- var $a, self = this;
-
- return ($truthy($a = self.context['$==']("ulist")) ? $a : self.context['$==']("olist"))
- }, $List_outline$ques$2.$$arity = 0);
-
- Opal.def(self, '$convert', $List_convert$3 = function $$convert() {
- var $iter = $List_convert$3.$$p, $yield = $iter || nil, self = this, result = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $List_convert$3.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if (self.context['$==']("colist")) {
-
- result = $send(self, Opal.find_super_dispatcher(self, 'convert', $List_convert$3, false), $zuper, $iter);
- self.document.$callouts().$next_list();
- return result;
- } else {
- return $send(self, Opal.find_super_dispatcher(self, 'convert', $List_convert$3, false), $zuper, $iter)
- }
- }, $List_convert$3.$$arity = 0);
- Opal.alias(self, "render", "convert");
- return (Opal.def(self, '$to_s', $List_to_s$4 = function $$to_s() {
- var self = this;
-
- return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {context: " + (self.context.$inspect()) + ", style: " + (self.style.$inspect()) + ", items: " + (self.$items().$size()) + "}>"
- }, $List_to_s$4.$$arity = 0), nil) && 'to_s';
- })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'ListItem');
-
- var $nesting = [self].concat($parent_nesting), $ListItem_initialize$5, $ListItem_text$ques$6, $ListItem_text$7, $ListItem_text$eq$8, $ListItem_simple$ques$9, $ListItem_compound$ques$10, $ListItem_fold_first$11, $ListItem_to_s$12;
-
- self.$$prototype.text = self.$$prototype.subs = self.$$prototype.blocks = nil;
-
- Opal.alias(self, "list", "parent");
- self.$attr_accessor("marker");
-
- Opal.def(self, '$initialize', $ListItem_initialize$5 = function $$initialize(parent, text) {
- var $iter = $ListItem_initialize$5.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $ListItem_initialize$5.$$p = null;
-
-
- if (text == null) {
- text = nil;
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $ListItem_initialize$5, false), [parent, "list_item"], null);
- self.text = text;
- self.level = parent.$level();
- return (self.subs = $$($nesting, 'NORMAL_SUBS').$drop(0));
- }, $ListItem_initialize$5.$$arity = -2);
-
- Opal.def(self, '$text?', $ListItem_text$ques$6 = function() {
- var self = this;
-
- if ($truthy(self.text['$nil_or_empty?']())) {
- return false
- } else {
- return true
- }
- }, $ListItem_text$ques$6.$$arity = 0);
-
- Opal.def(self, '$text', $ListItem_text$7 = function $$text() {
- var $a, self = this;
-
- return ($truthy($a = self.text) ? self.$apply_subs(self.text, self.subs) : $a)
- }, $ListItem_text$7.$$arity = 0);
-
- Opal.def(self, '$text=', $ListItem_text$eq$8 = function(val) {
- var self = this;
-
- return (self.text = val)
- }, $ListItem_text$eq$8.$$arity = 1);
-
- Opal.def(self, '$simple?', $ListItem_simple$ques$9 = function() {
- var $a, $b, $c, self = this, blk = nil;
-
- return ($truthy($a = self.blocks['$empty?']()) ? $a : ($truthy($b = (($c = self.blocks.$size()['$=='](1)) ? $$($nesting, 'List')['$===']((blk = self.blocks['$[]'](0))) : self.blocks.$size()['$=='](1))) ? blk['$outline?']() : $b))
- }, $ListItem_simple$ques$9.$$arity = 0);
-
- Opal.def(self, '$compound?', $ListItem_compound$ques$10 = function() {
- var self = this;
-
- return self['$simple?']()['$!']()
- }, $ListItem_compound$ques$10.$$arity = 0);
-
- Opal.def(self, '$fold_first', $ListItem_fold_first$11 = function $$fold_first() {
- var self = this;
-
-
- self.text = (function() {if ($truthy(self.text['$nil_or_empty?']())) {
- return self.blocks.$shift().$source()
- } else {
- return "" + (self.text) + ($$($nesting, 'LF')) + (self.blocks.$shift().$source())
- }; return nil; })();
- return nil;
- }, $ListItem_fold_first$11.$$arity = 0);
- return (Opal.def(self, '$to_s', $ListItem_to_s$12 = function $$to_s() {
- var $a, self = this;
-
- return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {list_context: " + (self.$parent().$context().$inspect()) + ", text: " + (self.text.$inspect()) + ", blocks: " + (($truthy($a = self.blocks) ? $a : []).$size()) + "}>"
- }, $ListItem_to_s$12.$$arity = 0), nil) && 'to_s';
- })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/parser"] = function(Opal) {
- function $rb_minus(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_lt(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_times(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, $send = Opal.send, $truthy = Opal.truthy, $hash2 = Opal.hash2, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$include', '$new', '$proc', '$start_with?', '$match?', '$is_delimited_block?', '$private_class_method', '$parse_document_header', '$[]', '$has_more_lines?', '$next_section', '$assign_numeral', '$<<', '$blocks', '$skip_blank_lines', '$parse_block_metadata_lines', '$attributes', '$is_next_line_doctitle?', '$finalize_header', '$nil_or_empty?', '$title=', '$-', '$sourcemap', '$cursor', '$parse_section_title', '$id=', '$include?', '$sub_specialchars', '$[]=', '$sub_attributes', '$source_location=', '$header', '$attribute_locked?', '$id', '$clear', '$delete', '$instance_variable_get', '$parse_header_metadata', '$==', '$!', '$register', '$doctype', '$parse_manpage_header', '$=~', '$downcase', '$error', '$logger', '$message_with_context', '$cursor_at_line', '$backend', '$save', '$update', '$is_next_line_section?', '$initialize_section', '$join', '$map', '$read_lines_until', '$lstrip', '$split', '$title', '$restore_save', '$discard_save', '$context', '$empty?', '$header?', '$!=', '$attr?', '$attr', '$key?', '$document', '$+', '$level', '$special', '$sectname', '$to_i', '$<', '$>', '$warn', '$next_block', '$blocks?', '$style', '$context=', '$style=', '$parent=', '$size', '$content_model', '$shift', '$unwrap_standalone_preamble', '$source_location', '$merge', '$fetch', '$parse_block_metadata_line', '$extensions', '$block_macros?', '$mark', '$read_line', '$terminator', '$to_s', '$masq', '$to_sym', '$registered_for_block?', '$debug?', '$debug', '$cursor_at_mark', '$strict_verbatim_paragraphs', '$unshift_line', '$markdown_syntax', '$keys', '$chr', '$uniform?', '$length', '$end_with?', '$===', '$parse_attributes', '$attribute_missing', '$tr', '$basename', '$assign_caption', '$registered_for_block_macro?', '$config', '$process_method', '$replace', '$parse_callout_list', '$callouts', '$parse_list', '$parse_description_list', '$underline_style_section_titles', '$is_section_title?', '$peek_line', '$atx_section_title?', '$generate_id', '$level=', '$read_paragraph_lines', '$adjust_indentation!', '$map!', '$slice', '$pop', '$build_block', '$apply_subs', '$chop', '$catalog_inline_anchors', '$rekey', '$index', '$strip', '$parse_table', '$each', '$raise', '$title?', '$update_attributes', '$commit_subs', '$sub?', '$catalog_callouts', '$source', '$remove_sub', '$block_terminates_paragraph', '$to_proc', '$nil?', '$lines', '$parse_blocks', '$parse_list_item', '$items', '$scan', '$gsub', '$count', '$advance', '$dup', '$match', '$callout_ids', '$next_list', '$catalog_inline_anchor', '$marker=', '$catalog_inline_biblio_anchor', '$set_option', '$text=', '$resolve_ordered_list_marker', '$read_lines_for_list_item', '$skip_line_comments', '$unshift_lines', '$fold_first', '$text?', '$is_sibling_list_item?', '$concat', '$find', '$casecmp', '$sectname=', '$special=', '$numbered=', '$numbered', '$lineno', '$peek_lines', '$setext_section_title?', '$abs', '$cursor_at_prev_line', '$process_attribute_entries', '$next_line_empty?', '$process_authors', '$apply_header_subs', '$rstrip', '$each_with_index', '$compact', '$squeeze', '$to_a', '$parse_style_attribute', '$process_attribute_entry', '$skip_comment_lines', '$store_attribute', '$sanitize_attribute_name', '$set_attribute', '$save_to', '$delete_attribute', '$ord', '$int_to_roman', '$resolve_list_marker', '$parse_colspecs', '$create_columns', '$has_header_option=', '$format', '$starts_with_delimiter?', '$close_open_cell', '$parse_cellspec', '$delimiter', '$match_delimiter', '$pre_match', '$post_match', '$buffer_has_unclosed_quotes?', '$skip_past_delimiter', '$buffer', '$buffer=', '$skip_past_escaped_delimiter', '$keep_cell_open', '$push_cellspec', '$close_cell', '$cell_open?', '$columns', '$assign_column_widths', '$partition_header_footer', '$upto', '$partition', '$shorthand_property_syntax', '$each_char', '$yield_buffered_attribute', '$any?', '$*', '$each_byte', '$%']);
- 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, 'Parser');
-
- var $nesting = [self].concat($parent_nesting), $Parser$1, $Parser$2, $Parser$3, $Parser_parse$4, $Parser_parse_document_header$5, $Parser_parse_manpage_header$6, $Parser_next_section$9, $Parser_next_block$10, $Parser_read_paragraph_lines$14, $Parser_is_delimited_block$ques$15, $Parser_build_block$16, $Parser_parse_blocks$17, $Parser_parse_list$18, $Parser_catalog_callouts$19, $Parser_catalog_inline_anchor$21, $Parser_catalog_inline_anchors$22, $Parser_catalog_inline_biblio_anchor$24, $Parser_parse_description_list$25, $Parser_parse_callout_list$26, $Parser_parse_list_item$27, $Parser_read_lines_for_list_item$28, $Parser_initialize_section$34, $Parser_is_next_line_section$ques$35, $Parser_is_next_line_doctitle$ques$36, $Parser_is_section_title$ques$37, $Parser_atx_section_title$ques$38, $Parser_setext_section_title$ques$39, $Parser_parse_section_title$40, $Parser_parse_header_metadata$41, $Parser_process_authors$46, $Parser_parse_block_metadata_lines$51, $Parser_parse_block_metadata_line$52, $Parser_process_attribute_entries$53, $Parser_process_attribute_entry$54, $Parser_store_attribute$55, $Parser_resolve_list_marker$56, $Parser_resolve_ordered_list_marker$57, $Parser_is_sibling_list_item$ques$59, $Parser_parse_table$60, $Parser_parse_colspecs$61, $Parser_parse_cellspec$65, $Parser_parse_style_attribute$66, $Parser_yield_buffered_attribute$69, $Parser_adjust_indentation$excl$70, $Parser_uniform$ques$79, $Parser_sanitize_attribute_name$80;
-
-
- self.$include($$($nesting, 'Logging'));
- Opal.const_set($nesting[0], 'BlockMatchData', $$($nesting, 'Struct').$new("context", "masq", "tip", "terminator"));
- Opal.const_set($nesting[0], 'TAB', "\t");
- Opal.const_set($nesting[0], 'TabIndentRx', /^\t+/);
- Opal.const_set($nesting[0], 'StartOfBlockProc', $send(self, 'proc', [], ($Parser$1 = function(l){var self = $Parser$1.$$s || this, $a, $b;
-
-
-
- if (l == null) {
- l = nil;
- };
- return ($truthy($a = ($truthy($b = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $b)) ? $a : self['$is_delimited_block?'](l));}, $Parser$1.$$s = self, $Parser$1.$$arity = 1, $Parser$1)));
- Opal.const_set($nesting[0], 'StartOfListProc', $send(self, 'proc', [], ($Parser$2 = function(l){var self = $Parser$2.$$s || this;
-
-
-
- if (l == null) {
- l = nil;
- };
- return $$($nesting, 'AnyListRx')['$match?'](l);}, $Parser$2.$$s = self, $Parser$2.$$arity = 1, $Parser$2)));
- Opal.const_set($nesting[0], 'StartOfBlockOrListProc', $send(self, 'proc', [], ($Parser$3 = function(l){var self = $Parser$3.$$s || this, $a, $b, $c;
-
-
-
- if (l == null) {
- l = nil;
- };
- return ($truthy($a = ($truthy($b = self['$is_delimited_block?'](l)) ? $b : ($truthy($c = l['$start_with?']("[")) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](l) : $c))) ? $a : $$($nesting, 'AnyListRx')['$match?'](l));}, $Parser$3.$$s = self, $Parser$3.$$arity = 1, $Parser$3)));
- Opal.const_set($nesting[0], 'NoOp', nil);
- Opal.const_set($nesting[0], 'AuthorKeys', ["author", "authorinitials", "firstname", "middlename", "lastname", "email"]);
- Opal.const_set($nesting[0], 'TableCellHorzAlignments', $hash2(["<", ">", "^"], {"<": "left", ">": "right", "^": "center"}));
- Opal.const_set($nesting[0], 'TableCellVertAlignments', $hash2(["<", ">", "^"], {"<": "top", ">": "bottom", "^": "middle"}));
- Opal.const_set($nesting[0], 'TableCellStyles', $hash2(["d", "s", "e", "m", "h", "l", "a"], {"d": "none", "s": "strong", "e": "emphasis", "m": "monospaced", "h": "header", "l": "literal", "a": "asciidoc"}));
- self.$private_class_method("new");
- Opal.defs(self, '$parse', $Parser_parse$4 = function $$parse(reader, document, options) {
- var $a, $b, $c, self = this, block_attributes = nil, new_section = nil;
-
-
-
- if (options == null) {
- options = $hash2([], {});
- };
- block_attributes = self.$parse_document_header(reader, document);
- if ($truthy(options['$[]']("header_only"))) {
- } else {
- while ($truthy(reader['$has_more_lines?']())) {
-
- $c = self.$next_section(reader, document, block_attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (block_attributes = ($b[1] == null ? nil : $b[1])), $c;
- if ($truthy(new_section)) {
-
- document.$assign_numeral(new_section);
- document.$blocks()['$<<'](new_section);};
- }
- };
- return document;
- }, $Parser_parse$4.$$arity = -3);
- Opal.defs(self, '$parse_document_header', $Parser_parse_document_header$5 = function $$parse_document_header(reader, document) {
- var $a, $b, self = this, block_attrs = nil, doc_attrs = nil, implicit_doctitle = nil, val = nil, $writer = nil, doctitle_attr_val = nil, source_location = nil, _ = nil, l0_section_title = nil, atx = nil, separator = nil, doc_id = nil, role = nil, reftext = nil, modified_attrs = nil;
-
-
- block_attrs = (function() {if ($truthy(reader.$skip_blank_lines())) {
-
- return self.$parse_block_metadata_lines(reader, document);
- } else {
- return $hash2([], {})
- }; return nil; })();
- doc_attrs = document.$attributes();
- if ($truthy(($truthy($a = (implicit_doctitle = self['$is_next_line_doctitle?'](reader, block_attrs, doc_attrs['$[]']("leveloffset")))) ? block_attrs['$[]']("title") : $a))) {
- return document.$finalize_header(block_attrs, false)};
- if ($truthy((val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']())) {
- } else {
-
- $writer = [(doctitle_attr_val = val)];
- $send(document, 'title=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy(implicit_doctitle)) {
-
- if ($truthy(document.$sourcemap())) {
- source_location = reader.$cursor()};
- $b = self.$parse_section_title(reader, document), $a = Opal.to_ary($b), document['$id='](($a[0] == null ? nil : $a[0])), (_ = ($a[1] == null ? nil : $a[1])), (l0_section_title = ($a[2] == null ? nil : $a[2])), (_ = ($a[3] == null ? nil : $a[3])), (atx = ($a[4] == null ? nil : $a[4])), $b;
- if ($truthy(doctitle_attr_val)) {
- l0_section_title = nil
- } else {
-
-
- $writer = [l0_section_title];
- $send(document, 'title=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy((($writer = ["doctitle", (doctitle_attr_val = document.$sub_specialchars(l0_section_title))]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
-
- $writer = ["doctitle", (doctitle_attr_val = document.$sub_attributes(doctitle_attr_val, $hash2(["attribute_missing"], {"attribute_missing": "skip"})))];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- };
- if ($truthy(source_location)) {
-
- $writer = [source_location];
- $send(document.$header(), 'source_location=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(($truthy($a = atx) ? $a : document['$attribute_locked?']("compat-mode")))) {
- } else {
-
- $writer = ["compat-mode", ""];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy((separator = block_attrs['$[]']("separator")))) {
- if ($truthy(document['$attribute_locked?']("title-separator"))) {
- } else {
-
- $writer = ["title-separator", separator];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }};
- if ($truthy((doc_id = block_attrs['$[]']("id")))) {
-
- $writer = [doc_id];
- $send(document, 'id=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
- doc_id = document.$id()
- };
- if ($truthy((role = block_attrs['$[]']("role")))) {
-
- $writer = ["role", role];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy((reftext = block_attrs['$[]']("reftext")))) {
-
- $writer = ["reftext", reftext];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- block_attrs.$clear();
- (modified_attrs = document.$instance_variable_get("@attributes_modified")).$delete("doctitle");
- self.$parse_header_metadata(reader, document);
- if ($truthy(modified_attrs['$include?']("doctitle"))) {
- if ($truthy(($truthy($a = (val = doc_attrs['$[]']("doctitle"))['$nil_or_empty?']()) ? $a : val['$=='](doctitle_attr_val)))) {
-
- $writer = ["doctitle", doctitle_attr_val];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = [val];
- $send(document, 'title=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }
- } else if ($truthy(l0_section_title['$!']())) {
- modified_attrs['$<<']("doctitle")};
- if ($truthy(doc_id)) {
- document.$register("refs", [doc_id, document])};};
- if (document.$doctype()['$==']("manpage")) {
- self.$parse_manpage_header(reader, document, block_attrs)};
- return document.$finalize_header(block_attrs);
- }, $Parser_parse_document_header$5.$$arity = 2);
- Opal.defs(self, '$parse_manpage_header', $Parser_parse_manpage_header$6 = function $$parse_manpage_header(reader, document, block_attributes) {
- var $a, $b, $$7, $$8, self = this, doc_attrs = nil, $writer = nil, manvolnum = nil, mantitle = nil, manname = nil, name_section_level = nil, name_section = nil, name_section_buffer = nil, mannames = nil, manpurpose = nil, error_msg = nil;
-
-
- if ($truthy($$($nesting, 'ManpageTitleVolnumRx')['$=~']((doc_attrs = document.$attributes())['$[]']("doctitle")))) {
-
-
- $writer = ["manvolnum", (manvolnum = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["mantitle", (function() {if ($truthy((mantitle = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
-
- return document.$sub_attributes(mantitle);
- } else {
- return mantitle
- }; return nil; })().$downcase()];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
-
- self.$logger().$error(self.$message_with_context("non-conforming manpage title", $hash2(["source_location"], {"source_location": reader.$cursor_at_line(1)})));
-
- $writer = ["mantitle", ($truthy($a = ($truthy($b = doc_attrs['$[]']("doctitle")) ? $b : doc_attrs['$[]']("docname"))) ? $a : "command")];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["manvolnum", (manvolnum = "1")];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- };
- if ($truthy(($truthy($a = (manname = doc_attrs['$[]']("manname"))) ? doc_attrs['$[]']("manpurpose") : $a))) {
-
- ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", "Name"]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
-
- $writer = ["mannames", [manname]];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if (document.$backend()['$==']("manpage")) {
-
-
- $writer = ["docname", manname];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["outfilesuffix", "" + "." + (manvolnum)];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- } else {
-
- reader.$skip_blank_lines();
- reader.$save();
- block_attributes.$update(self.$parse_block_metadata_lines(reader, document));
- if ($truthy((name_section_level = self['$is_next_line_section?'](reader, $hash2([], {}))))) {
- if (name_section_level['$=='](1)) {
-
- name_section = self.$initialize_section(reader, document, $hash2([], {}));
- name_section_buffer = $send(reader.$read_lines_until($hash2(["break_on_blank_lines", "skip_line_comments"], {"break_on_blank_lines": true, "skip_line_comments": true})), 'map', [], ($$7 = function(l){var self = $$7.$$s || this;
-
-
-
- if (l == null) {
- l = nil;
- };
- return l.$lstrip();}, $$7.$$s = self, $$7.$$arity = 1, $$7)).$join(" ");
- if ($truthy($$($nesting, 'ManpageNamePurposeRx')['$=~'](name_section_buffer))) {
-
- if ($truthy((manname = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- manname = document.$sub_attributes(manname)};
- if ($truthy(manname['$include?'](","))) {
- manname = (mannames = $send(manname.$split(","), 'map', [], ($$8 = function(n){var self = $$8.$$s || this;
-
-
-
- if (n == null) {
- n = nil;
- };
- return n.$lstrip();}, $$8.$$s = self, $$8.$$arity = 1, $$8)))['$[]'](0)
- } else {
- mannames = [manname]
- };
- if ($truthy((manpurpose = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- manpurpose = document.$sub_attributes(manpurpose)};
- ($truthy($a = doc_attrs['$[]']("manname-title")) ? $a : (($writer = ["manname-title", name_section.$title()]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy(name_section.$id())) {
-
- $writer = ["manname-id", name_section.$id()];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
-
- $writer = ["manname", manname];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["mannames", mannames];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["manpurpose", manpurpose];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if (document.$backend()['$==']("manpage")) {
-
-
- $writer = ["docname", manname];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["outfilesuffix", "" + "." + (manvolnum)];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- } else {
- error_msg = "non-conforming name section body"
- };
- } else {
- error_msg = "name section must be at level 1"
- }
- } else {
- error_msg = "name section expected"
- };
- if ($truthy(error_msg)) {
-
- reader.$restore_save();
- self.$logger().$error(self.$message_with_context(error_msg, $hash2(["source_location"], {"source_location": reader.$cursor()})));
-
- $writer = ["manname", (manname = ($truthy($a = doc_attrs['$[]']("docname")) ? $a : "command"))];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["mannames", [manname]];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if (document.$backend()['$==']("manpage")) {
-
-
- $writer = ["docname", manname];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["outfilesuffix", "" + "." + (manvolnum)];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- } else {
- reader.$discard_save()
- };
- };
- return nil;
- }, $Parser_parse_manpage_header$6.$$arity = 3);
- Opal.defs(self, '$next_section', $Parser_next_section$9 = function $$next_section(reader, parent, attributes) {
- var $a, $b, $c, $d, self = this, preamble = nil, intro = nil, part = nil, has_header = nil, book = nil, document = nil, $writer = nil, section = nil, current_level = nil, expected_next_level = nil, expected_next_level_alt = nil, title = nil, sectname = nil, next_level = nil, expected_condition = nil, new_section = nil, block_cursor = nil, new_block = nil, first_block = nil, child_block = nil;
-
-
-
- if (attributes == null) {
- attributes = $hash2([], {});
- };
- preamble = (intro = (part = false));
- if ($truthy(($truthy($a = (($b = parent.$context()['$==']("document")) ? parent.$blocks()['$empty?']() : parent.$context()['$==']("document"))) ? ($truthy($b = ($truthy($c = (has_header = parent['$header?']())) ? $c : attributes.$delete("invalid-header"))) ? $b : self['$is_next_line_section?'](reader, attributes)['$!']()) : $a))) {
-
- book = (document = parent).$doctype()['$==']("book");
- if ($truthy(($truthy($a = has_header) ? $a : ($truthy($b = book) ? attributes['$[]'](1)['$!=']("abstract") : $b)))) {
-
- preamble = (intro = $$($nesting, 'Block').$new(parent, "preamble", $hash2(["content_model"], {"content_model": "compound"})));
- if ($truthy(($truthy($a = book) ? parent['$attr?']("preface-title") : $a))) {
-
- $writer = [parent.$attr("preface-title")];
- $send(preamble, 'title=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- parent.$blocks()['$<<'](preamble);};
- section = parent;
- current_level = 0;
- if ($truthy(parent.$attributes()['$key?']("fragment"))) {
- expected_next_level = -1
- } else if ($truthy(book)) {
- $a = [1, 0], (expected_next_level = $a[0]), (expected_next_level_alt = $a[1]), $a
- } else {
- expected_next_level = 1
- };
- } else {
-
- book = (document = parent.$document()).$doctype()['$==']("book");
- section = self.$initialize_section(reader, parent, attributes);
- attributes = (function() {if ($truthy((title = attributes['$[]']("title")))) {
- return $hash2(["title"], {"title": title})
- } else {
- return $hash2([], {})
- }; return nil; })();
- expected_next_level = $rb_plus((current_level = section.$level()), 1);
- if (current_level['$=='](0)) {
- part = book
- } else if ($truthy((($a = current_level['$=='](1)) ? section.$special() : current_level['$=='](1)))) {
- if ($truthy(($truthy($a = ($truthy($b = (sectname = section.$sectname())['$==']("appendix")) ? $b : sectname['$==']("preface"))) ? $a : sectname['$==']("abstract")))) {
- } else {
- expected_next_level = nil
- }};
- };
- reader.$skip_blank_lines();
- while ($truthy(reader['$has_more_lines?']())) {
-
- self.$parse_block_metadata_lines(reader, document, attributes);
- if ($truthy((next_level = self['$is_next_line_section?'](reader, attributes)))) {
-
- if ($truthy(document['$attr?']("leveloffset"))) {
-
- next_level = $rb_plus(next_level, document.$attr("leveloffset").$to_i());
- if ($truthy($rb_lt(next_level, 0))) {
- next_level = 0};};
- if ($truthy($rb_gt(next_level, current_level))) {
-
- if ($truthy(expected_next_level)) {
- if ($truthy(($truthy($b = ($truthy($c = next_level['$=='](expected_next_level)) ? $c : ($truthy($d = expected_next_level_alt) ? next_level['$=='](expected_next_level_alt) : $d))) ? $b : $rb_lt(expected_next_level, 0)))) {
- } else {
-
- expected_condition = (function() {if ($truthy(expected_next_level_alt)) {
- return "" + "expected levels " + (expected_next_level_alt) + " or " + (expected_next_level)
- } else {
- return "" + "expected level " + (expected_next_level)
- }; return nil; })();
- self.$logger().$warn(self.$message_with_context("" + "section title out of sequence: " + (expected_condition) + ", got level " + (next_level), $hash2(["source_location"], {"source_location": reader.$cursor()})));
- }
- } else {
- self.$logger().$error(self.$message_with_context("" + (sectname) + " sections do not support nested sections", $hash2(["source_location"], {"source_location": reader.$cursor()})))
- };
- $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c;
- section.$assign_numeral(new_section);
- section.$blocks()['$<<'](new_section);
- } else if ($truthy((($b = next_level['$=='](0)) ? section['$=='](document) : next_level['$=='](0)))) {
-
- if ($truthy(book)) {
- } else {
- self.$logger().$error(self.$message_with_context("level 0 sections can only be used when doctype is book", $hash2(["source_location"], {"source_location": reader.$cursor()})))
- };
- $c = self.$next_section(reader, section, attributes), $b = Opal.to_ary($c), (new_section = ($b[0] == null ? nil : $b[0])), (attributes = ($b[1] == null ? nil : $b[1])), $c;
- section.$assign_numeral(new_section);
- section.$blocks()['$<<'](new_section);
- } else {
- break;
- };
- } else {
-
- block_cursor = reader.$cursor();
- if ($truthy((new_block = self.$next_block(reader, ($truthy($b = intro) ? $b : section), attributes, $hash2(["parse_metadata"], {"parse_metadata": false}))))) {
-
- if ($truthy(part)) {
- if ($truthy(section['$blocks?']()['$!']())) {
- if ($truthy(new_block.$style()['$!=']("partintro"))) {
- if (new_block.$context()['$==']("paragraph")) {
-
-
- $writer = ["open"];
- $send(new_block, 'context=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["partintro"];
- $send(new_block, 'style=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
-
-
- $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))];
- $send(new_block, 'parent=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["partintro"];
- $send(intro, 'style=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- section.$blocks()['$<<'](intro);
- }}
- } else if (section.$blocks().$size()['$=='](1)) {
-
- first_block = section.$blocks()['$[]'](0);
- if ($truthy(($truthy($b = intro['$!']()) ? first_block.$content_model()['$==']("compound") : $b))) {
- self.$logger().$error(self.$message_with_context("illegal block content outside of partintro block", $hash2(["source_location"], {"source_location": block_cursor})))
- } else if ($truthy(first_block.$content_model()['$!=']("compound"))) {
-
-
- $writer = [(intro = $$($nesting, 'Block').$new(section, "open", $hash2(["content_model"], {"content_model": "compound"})))];
- $send(new_block, 'parent=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["partintro"];
- $send(intro, 'style=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- section.$blocks().$shift();
- if (first_block.$style()['$==']("partintro")) {
-
-
- $writer = ["paragraph"];
- $send(first_block, 'context=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = [nil];
- $send(first_block, 'style=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- intro['$<<'](first_block);
- section.$blocks()['$<<'](intro);};}};
- ($truthy($b = intro) ? $b : section).$blocks()['$<<'](new_block);
- attributes.$clear();};
- };
- if ($truthy($b = reader.$skip_blank_lines())) {
- $b
- } else {
- break;
- };
- };
- if ($truthy(part)) {
- if ($truthy(($truthy($a = section['$blocks?']()) ? section.$blocks()['$[]'](-1).$context()['$==']("section") : $a))) {
- } else {
- self.$logger().$error(self.$message_with_context("invalid part, must have at least one section (e.g., chapter, appendix, etc.)", $hash2(["source_location"], {"source_location": reader.$cursor()})))
- }
- } else if ($truthy(preamble)) {
- if ($truthy(preamble['$blocks?']())) {
- if ($truthy(($truthy($a = ($truthy($b = book) ? $b : document.$blocks()['$[]'](1))) ? $a : $$($nesting, 'Compliance').$unwrap_standalone_preamble()['$!']()))) {
- if ($truthy(document.$sourcemap())) {
-
- $writer = [preamble.$blocks()['$[]'](0).$source_location()];
- $send(preamble, 'source_location=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- } else {
-
- document.$blocks().$shift();
- while ($truthy((child_block = preamble.$blocks().$shift()))) {
- document['$<<'](child_block)
- };
- }
- } else {
- document.$blocks().$shift()
- }};
- return [(function() {if ($truthy(section['$!='](parent))) {
- return section
- } else {
- return nil
- }; return nil; })(), attributes.$merge()];
- }, $Parser_next_section$9.$$arity = -3);
- Opal.defs(self, '$next_block', $Parser_next_block$10 = function $$next_block(reader, parent, attributes, options) {try {
-
- var $a, $b, $c, $d, $$11, $$12, $$13, self = this, skipped = nil, text_only = nil, document = nil, extensions = nil, block_extensions = nil, block_macro_extensions = nil, this_line = nil, doc_attrs = nil, style = nil, block = nil, block_context = nil, cloaked_context = nil, terminator = nil, delimited_block = nil, $writer = nil, indented = nil, md_syntax = nil, ch0 = nil, layout_break_chars = nil, ll = nil, blk_ctx = nil, target = nil, blk_attrs = nil, $case = nil, posattrs = nil, expanded_target = nil, scaledwidth = nil, block_title = nil, extension = nil, report_unknown_block_macro = nil, content = nil, ext_config = nil, default_attrs = nil, float_id = nil, float_reftext = nil, float_level = nil, lines = nil, content_adjacent = nil, admonition_name = nil, credit_line = nil, attribution = nil, citetitle = nil, language = nil, comma_idx = nil, block_cursor = nil, block_reader = nil, content_model = nil, positional_attrs = nil, block_id = nil;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
-
-
- if (attributes == null) {
- attributes = $hash2([], {});
- };
-
- if (options == null) {
- options = $hash2([], {});
- };
- if ($truthy((skipped = reader.$skip_blank_lines()))) {
- } else {
- return nil
- };
- if ($truthy(($truthy($a = (text_only = options['$[]']("text_only"))) ? $rb_gt(skipped, 0) : $a))) {
-
- options.$delete("text_only");
- text_only = nil;};
- document = parent.$document();
- if ($truthy(options.$fetch("parse_metadata", true))) {
- while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) {
-
- reader.$shift();
- ($truthy($b = reader.$skip_blank_lines()) ? $b : Opal.ret(nil));
- }};
- if ($truthy((extensions = document.$extensions()))) {
- $a = [extensions['$blocks?'](), extensions['$block_macros?']()], (block_extensions = $a[0]), (block_macro_extensions = $a[1]), $a};
- reader.$mark();
- $a = [reader.$read_line(), document.$attributes(), attributes['$[]'](1)], (this_line = $a[0]), (doc_attrs = $a[1]), (style = $a[2]), $a;
- block = (block_context = (cloaked_context = (terminator = nil)));
- if ($truthy((delimited_block = self['$is_delimited_block?'](this_line, true)))) {
-
- block_context = (cloaked_context = delimited_block.$context());
- terminator = delimited_block.$terminator();
- if ($truthy(style)) {
- if (style['$=='](block_context.$to_s())) {
- } else if ($truthy(delimited_block.$masq()['$include?'](style))) {
- block_context = style.$to_sym()
- } else if ($truthy(($truthy($a = delimited_block.$masq()['$include?']("admonition")) ? $$($nesting, 'ADMONITION_STYLES')['$include?'](style) : $a))) {
- block_context = "admonition"
- } else if ($truthy(($truthy($a = block_extensions) ? extensions['$registered_for_block?'](style, block_context) : $a))) {
- block_context = style.$to_sym()
- } else {
-
- if ($truthy(self.$logger()['$debug?']())) {
- self.$logger().$debug(self.$message_with_context("" + "unknown style for " + (block_context) + " block: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()})))};
- style = block_context.$to_s();
- }
- } else {
- style = (($writer = ["style", block_context.$to_s()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])
- };};
- if ($truthy(delimited_block)) {
- } else {
- while ($truthy(true)) {
-
- if ($truthy(($truthy($b = ($truthy($c = style) ? $$($nesting, 'Compliance').$strict_verbatim_paragraphs() : $c)) ? $$($nesting, 'VERBATIM_STYLES')['$include?'](style) : $b))) {
-
- block_context = style.$to_sym();
- reader.$unshift_line(this_line);
- break;;};
- if ($truthy(text_only)) {
- indented = this_line['$start_with?'](" ", $$($nesting, 'TAB'))
- } else {
-
- md_syntax = $$($nesting, 'Compliance').$markdown_syntax();
- if ($truthy(this_line['$start_with?'](" "))) {
-
- $b = [true, " "], (indented = $b[0]), (ch0 = $b[1]), $b;
- if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? $send(this_line.$lstrip(), 'start_with?', Opal.to_a($$($nesting, 'MARKDOWN_THEMATIC_BREAK_CHARS').$keys())) : $c)) ? $$($nesting, 'MarkdownThematicBreakRx')['$match?'](this_line) : $b))) {
-
- block = $$($nesting, 'Block').$new(parent, "thematic_break", $hash2(["content_model"], {"content_model": "empty"}));
- break;;};
- } else if ($truthy(this_line['$start_with?']($$($nesting, 'TAB')))) {
- $b = [true, $$($nesting, 'TAB')], (indented = $b[0]), (ch0 = $b[1]), $b
- } else {
-
- $b = [false, this_line.$chr()], (indented = $b[0]), (ch0 = $b[1]), $b;
- layout_break_chars = (function() {if ($truthy(md_syntax)) {
- return $$($nesting, 'HYBRID_LAYOUT_BREAK_CHARS')
- } else {
- return $$($nesting, 'LAYOUT_BREAK_CHARS')
- }; return nil; })();
- if ($truthy(($truthy($b = layout_break_chars['$key?'](ch0)) ? (function() {if ($truthy(md_syntax)) {
-
- return $$($nesting, 'ExtLayoutBreakRx')['$match?'](this_line);
- } else {
- return ($truthy($c = self['$uniform?'](this_line, ch0, (ll = this_line.$length()))) ? $rb_gt(ll, 2) : $c)
- }; return nil; })() : $b))) {
-
- block = $$($nesting, 'Block').$new(parent, layout_break_chars['$[]'](ch0), $hash2(["content_model"], {"content_model": "empty"}));
- break;;
- } else if ($truthy(($truthy($b = this_line['$end_with?']("]")) ? this_line['$include?']("::") : $b))) {
- if ($truthy(($truthy($b = ($truthy($c = ch0['$==']("i")) ? $c : this_line['$start_with?']("video:", "audio:"))) ? $$($nesting, 'BlockMediaMacroRx')['$=~'](this_line) : $b))) {
-
- $b = [(($c = $gvars['~']) === nil ? nil : $c['$[]'](1)).$to_sym(), (($c = $gvars['~']) === nil ? nil : $c['$[]'](2)), (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))], (blk_ctx = $b[0]), (target = $b[1]), (blk_attrs = $b[2]), $b;
- block = $$($nesting, 'Block').$new(parent, blk_ctx, $hash2(["content_model"], {"content_model": "empty"}));
- if ($truthy(blk_attrs)) {
-
- $case = blk_ctx;
- if ("video"['$===']($case)) {posattrs = ["poster", "width", "height"]}
- else if ("audio"['$===']($case)) {posattrs = []}
- else {posattrs = ["alt", "width", "height"]};
- block.$parse_attributes(blk_attrs, posattrs, $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}));};
- if ($truthy(attributes['$key?']("style"))) {
- attributes.$delete("style")};
- if ($truthy(target['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- if ($truthy(($truthy($b = ($truthy($c = (expanded_target = block.$sub_attributes(target))['$empty?']()) ? ($truthy($d = doc_attrs['$[]']("attribute-missing")) ? $d : $$($nesting, 'Compliance').$attribute_missing())['$==']("drop-line") : $c)) ? block.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']() : $b))) {
-
- attributes.$clear();
- return nil;
- } else {
- target = expanded_target
- }};
- if (blk_ctx['$==']("image")) {
-
- document.$register("images", target);
-
- $writer = ["imagesdir", doc_attrs['$[]']("imagesdir")];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- ($truthy($b = attributes['$[]']("alt")) ? $b : (($writer = ["alt", ($truthy($c = style) ? $c : (($writer = ["default-alt", $$($nesting, 'Helpers').$basename(target, true).$tr("_-", " ")]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy((scaledwidth = attributes.$delete("scaledwidth"))['$nil_or_empty?']())) {
- } else {
-
- $writer = ["scaledwidth", (function() {if ($truthy($$($nesting, 'TrailingDigitsRx')['$match?'](scaledwidth))) {
- return "" + (scaledwidth) + "%"
- } else {
- return scaledwidth
- }; return nil; })()];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy(attributes['$[]']("title"))) {
-
-
- $writer = [(block_title = attributes.$delete("title"))];
- $send(block, 'title=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- block.$assign_caption(attributes.$delete("caption"), "figure");};};
-
- $writer = ["target", target];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- break;;
- } else if ($truthy(($truthy($b = (($c = ch0['$==']("t")) ? this_line['$start_with?']("toc:") : ch0['$==']("t"))) ? $$($nesting, 'BlockTocMacroRx')['$=~'](this_line) : $b))) {
-
- block = $$($nesting, 'Block').$new(parent, "toc", $hash2(["content_model"], {"content_model": "empty"}));
- if ($truthy((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)))) {
- block.$parse_attributes((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), [], $hash2(["into"], {"into": attributes}))};
- break;;
- } else if ($truthy((function() {if ($truthy(block_macro_extensions)) {
-
- return ($truthy($b = ($truthy($c = $$($nesting, 'CustomBlockMacroRx')['$=~'](this_line)) ? (extension = extensions['$registered_for_block_macro?']((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) : $c)) ? $b : (report_unknown_block_macro = self.$logger()['$debug?']()));
- } else {
-
- return ($truthy($b = self.$logger()['$debug?']()) ? (report_unknown_block_macro = $$($nesting, 'CustomBlockMacroRx')['$=~'](this_line)) : $b);
- }; return nil; })())) {
- if ($truthy(report_unknown_block_macro)) {
- self.$logger().$debug(self.$message_with_context("" + "unknown name for block macro: " + ((($b = $gvars['~']) === nil ? nil : $b['$[]'](1))), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()})))
- } else {
-
- content = (($b = $gvars['~']) === nil ? nil : $b['$[]'](3));
- if ($truthy((target = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)))['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- if ($truthy(($truthy($b = ($truthy($c = (expanded_target = parent.$sub_attributes(target))['$empty?']()) ? ($truthy($d = doc_attrs['$[]']("attribute-missing")) ? $d : $$($nesting, 'Compliance').$attribute_missing())['$==']("drop-line") : $c)) ? parent.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']() : $b))) {
-
- attributes.$clear();
- return nil;
- } else {
- target = expanded_target
- }};
- if ((ext_config = extension.$config())['$[]']("content_model")['$==']("attributes")) {
- if ($truthy(content)) {
- document.$parse_attributes(content, ($truthy($b = ($truthy($c = ext_config['$[]']("positional_attrs")) ? $c : ext_config['$[]']("pos_attrs"))) ? $b : []), $hash2(["sub_input", "into"], {"sub_input": true, "into": attributes}))}
- } else {
-
- $writer = ["text", ($truthy($b = content) ? $b : "")];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy((default_attrs = ext_config['$[]']("default_attrs")))) {
- $send(attributes, 'update', [default_attrs], ($$11 = function(_, old_v){var self = $$11.$$s || this;
-
-
-
- if (_ == null) {
- _ = nil;
- };
-
- if (old_v == null) {
- old_v = nil;
- };
- return old_v;}, $$11.$$s = self, $$11.$$arity = 2, $$11))};
- if ($truthy((block = extension.$process_method()['$[]'](parent, target, attributes)))) {
-
- attributes.$replace(block.$attributes());
- break;;
- } else {
-
- attributes.$clear();
- return nil;
- };
- }}};
- };
- };
- if ($truthy(($truthy($b = ($truthy($c = indented['$!']()) ? (ch0 = ($truthy($d = ch0) ? $d : this_line.$chr()))['$==']("<") : $c)) ? $$($nesting, 'CalloutListRx')['$=~'](this_line) : $b))) {
-
- reader.$unshift_line(this_line);
- block = self.$parse_callout_list(reader, $gvars["~"], parent, document.$callouts());
-
- $writer = ["style", "arabic"];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- break;;
- } else if ($truthy($$($nesting, 'UnorderedListRx')['$match?'](this_line))) {
-
- reader.$unshift_line(this_line);
- if ($truthy(($truthy($b = ($truthy($c = style['$!']()) ? $$($nesting, 'Section')['$==='](parent) : $c)) ? parent.$sectname()['$==']("bibliography") : $b))) {
-
- $writer = ["style", (style = "bibliography")];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- block = self.$parse_list(reader, "ulist", parent, style);
- break;;
- } else if ($truthy($$($nesting, 'OrderedListRx')['$match?'](this_line))) {
-
- reader.$unshift_line(this_line);
- block = self.$parse_list(reader, "olist", parent, style);
- if ($truthy(block.$style())) {
-
- $writer = ["style", block.$style()];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- break;;
- } else if ($truthy(($truthy($b = ($truthy($c = this_line['$include?']("::")) ? $c : this_line['$include?'](";;"))) ? $$($nesting, 'DescriptionListRx')['$=~'](this_line) : $b))) {
-
- reader.$unshift_line(this_line);
- block = self.$parse_description_list(reader, $gvars["~"], parent);
- break;;
- } else if ($truthy(($truthy($b = ($truthy($c = style['$==']("float")) ? $c : style['$==']("discrete"))) ? (function() {if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) {
-
- return self['$is_section_title?'](this_line, reader.$peek_line());
- } else {
- return ($truthy($c = indented['$!']()) ? self['$atx_section_title?'](this_line) : $c)
- }; return nil; })() : $b))) {
-
- reader.$unshift_line(this_line);
- $c = self.$parse_section_title(reader, document, attributes['$[]']("id")), $b = Opal.to_ary($c), (float_id = ($b[0] == null ? nil : $b[0])), (float_reftext = ($b[1] == null ? nil : $b[1])), (block_title = ($b[2] == null ? nil : $b[2])), (float_level = ($b[3] == null ? nil : $b[3])), $c;
- if ($truthy(float_reftext)) {
-
- $writer = ["reftext", float_reftext];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- block = $$($nesting, 'Block').$new(parent, "floating_title", $hash2(["content_model"], {"content_model": "empty"}));
-
- $writer = [block_title];
- $send(block, 'title=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- attributes.$delete("title");
-
- $writer = [($truthy($b = float_id) ? $b : (function() {if ($truthy(doc_attrs['$key?']("sectids"))) {
-
- return $$($nesting, 'Section').$generate_id(block.$title(), document);
- } else {
- return nil
- }; return nil; })())];
- $send(block, 'id=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = [float_level];
- $send(block, 'level=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- break;;
- } else if ($truthy(($truthy($b = style) ? style['$!=']("normal") : $b))) {
- if ($truthy($$($nesting, 'PARAGRAPH_STYLES')['$include?'](style))) {
-
- block_context = style.$to_sym();
- cloaked_context = "paragraph";
- reader.$unshift_line(this_line);
- break;;
- } else if ($truthy($$($nesting, 'ADMONITION_STYLES')['$include?'](style))) {
-
- block_context = "admonition";
- cloaked_context = "paragraph";
- reader.$unshift_line(this_line);
- break;;
- } else if ($truthy(($truthy($b = block_extensions) ? extensions['$registered_for_block?'](style, "paragraph") : $b))) {
-
- block_context = style.$to_sym();
- cloaked_context = "paragraph";
- reader.$unshift_line(this_line);
- break;;
- } else {
-
- if ($truthy(self.$logger()['$debug?']())) {
- self.$logger().$debug(self.$message_with_context("" + "unknown style for paragraph: " + (style), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()})))};
- style = nil;
- }};
- reader.$unshift_line(this_line);
- if ($truthy(($truthy($b = indented) ? style['$!']() : $b))) {
-
- lines = self.$read_paragraph_lines(reader, (content_adjacent = (function() {if (skipped['$=='](0)) {
- return options['$[]']("list_type")
- } else {
- return nil
- }; return nil; })()), $hash2(["skip_line_comments"], {"skip_line_comments": text_only}));
- self['$adjust_indentation!'](lines);
- if ($truthy(($truthy($b = text_only) ? $b : content_adjacent['$==']("dlist")))) {
- block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes}))
- } else {
- block = $$($nesting, 'Block').$new(parent, "literal", $hash2(["content_model", "source", "attributes"], {"content_model": "verbatim", "source": lines, "attributes": attributes}))
- };
- } else {
-
- lines = self.$read_paragraph_lines(reader, (($b = skipped['$=='](0)) ? options['$[]']("list_type") : skipped['$=='](0)), $hash2(["skip_line_comments"], {"skip_line_comments": true}));
- if ($truthy(text_only)) {
-
- if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) {
- self['$adjust_indentation!'](lines)};
- block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes}));
- } else if ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'ADMONITION_STYLE_HEADS')['$include?'](ch0)) ? this_line['$include?'](":") : $c)) ? $$($nesting, 'AdmonitionParagraphRx')['$=~'](this_line) : $b))) {
-
-
- $writer = [0, (($b = $gvars['~']) === nil ? nil : $b.$post_match())];
- $send(lines, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["name", (admonition_name = (($writer = ["style", (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]).$downcase())];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["textlabel", ($truthy($b = attributes.$delete("caption")) ? $b : doc_attrs['$[]']("" + (admonition_name) + "-caption"))];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- block = $$($nesting, 'Block').$new(parent, "admonition", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes}));
- } else if ($truthy(($truthy($b = ($truthy($c = md_syntax) ? ch0['$=='](">") : $c)) ? this_line['$start_with?']("> ") : $b))) {
-
- $send(lines, 'map!', [], ($$12 = function(line){var self = $$12.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- if (line['$=='](">")) {
-
- return line.$slice(1, line.$length());
- } else {
-
- if ($truthy(line['$start_with?']("> "))) {
-
- return line.$slice(2, line.$length());
- } else {
- return line
- };
- };}, $$12.$$s = self, $$12.$$arity = 1, $$12));
- if ($truthy(lines['$[]'](-1)['$start_with?']("-- "))) {
-
- credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length());
- if ($truthy(lines['$empty?']())) {
- } else {
- while ($truthy(lines['$[]'](-1)['$empty?']())) {
- lines.$pop()
- }
- };};
-
- $writer = ["style", "quote"];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- block = self.$build_block("quote", "compound", false, parent, $$($nesting, 'Reader').$new(lines), attributes);
- if ($truthy(credit_line)) {
-
- $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c;
- if ($truthy(attribution)) {
-
- $writer = ["attribution", attribution];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(citetitle)) {
-
- $writer = ["citetitle", citetitle];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};};
- } else if ($truthy(($truthy($b = ($truthy($c = (($d = ch0['$==']("\"")) ? $rb_gt(lines.$size(), 1) : ch0['$==']("\""))) ? lines['$[]'](-1)['$start_with?']("-- ") : $c)) ? lines['$[]'](-2)['$end_with?']("\"") : $b))) {
-
-
- $writer = [0, this_line.$slice(1, this_line.$length())];
- $send(lines, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- credit_line = (credit_line = lines.$pop()).$slice(3, credit_line.$length());
- while ($truthy(lines['$[]'](-1)['$empty?']())) {
- lines.$pop()
- };
- lines['$<<'](lines.$pop().$chop());
-
- $writer = ["style", "quote"];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- block = $$($nesting, 'Block').$new(parent, "quote", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes}));
- $c = block.$apply_subs(credit_line).$split(", ", 2), $b = Opal.to_ary($c), (attribution = ($b[0] == null ? nil : $b[0])), (citetitle = ($b[1] == null ? nil : $b[1])), $c;
- if ($truthy(attribution)) {
-
- $writer = ["attribution", attribution];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(citetitle)) {
-
- $writer = ["citetitle", citetitle];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- } else {
-
- if ($truthy(($truthy($b = indented) ? style['$==']("normal") : $b))) {
- self['$adjust_indentation!'](lines)};
- block = $$($nesting, 'Block').$new(parent, "paragraph", $hash2(["content_model", "source", "attributes"], {"content_model": "simple", "source": lines, "attributes": attributes}));
- };
- self.$catalog_inline_anchors(lines.$join($$($nesting, 'LF')), block, document, reader);
- };
- break;;
- }
- };
- if ($truthy(block)) {
- } else {
- $case = block_context;
- if ("listing"['$===']($case) || "source"['$===']($case)) {
- if ($truthy(($truthy($a = block_context['$==']("source")) ? $a : ($truthy($b = attributes['$[]'](1)['$!']()) ? (language = ($truthy($c = attributes['$[]'](2)) ? $c : doc_attrs['$[]']("source-language"))) : $b)))) {
-
- if ($truthy(language)) {
-
-
- $writer = ["style", "source"];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["language", language];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- $$($nesting, 'AttributeList').$rekey(attributes, [nil, nil, "linenums"]);
- } else {
-
- $$($nesting, 'AttributeList').$rekey(attributes, [nil, "language", "linenums"]);
- if ($truthy(attributes['$key?']("language"))) {
- } else if ($truthy(doc_attrs['$key?']("source-language"))) {
-
- $writer = ["language", doc_attrs['$[]']("source-language")];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- };
- if ($truthy(attributes['$key?']("linenums"))) {
- } else if ($truthy(($truthy($a = attributes['$[]']("linenums-option")) ? $a : doc_attrs['$[]']("source-linenums-option")))) {
-
- $writer = ["linenums", ""];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(attributes['$key?']("indent"))) {
- } else if ($truthy(doc_attrs['$key?']("source-indent"))) {
-
- $writer = ["indent", doc_attrs['$[]']("source-indent")];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};};
- block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);}
- else if ("fenced_code"['$===']($case)) {
-
- $writer = ["style", "source"];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy($rb_gt((ll = this_line.$length()), 3))) {
- if ($truthy((comma_idx = (language = this_line.$slice(3, ll)).$index(",")))) {
- if ($truthy($rb_gt(comma_idx, 0))) {
-
- language = language.$slice(0, comma_idx).$strip();
- if ($truthy($rb_lt(comma_idx, $rb_minus(ll, 4)))) {
-
- $writer = ["linenums", ""];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- } else if ($truthy($rb_gt(ll, 4))) {
-
- $writer = ["linenums", ""];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- } else {
- language = language.$lstrip()
- }};
- if ($truthy(language['$nil_or_empty?']())) {
- if ($truthy(doc_attrs['$key?']("source-language"))) {
-
- $writer = ["language", doc_attrs['$[]']("source-language")];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}
- } else {
-
- $writer = ["language", language];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy(attributes['$key?']("linenums"))) {
- } else if ($truthy(($truthy($a = attributes['$[]']("linenums-option")) ? $a : doc_attrs['$[]']("source-linenums-option")))) {
-
- $writer = ["linenums", ""];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(attributes['$key?']("indent"))) {
- } else if ($truthy(doc_attrs['$key?']("source-indent"))) {
-
- $writer = ["indent", doc_attrs['$[]']("source-indent")];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- terminator = terminator.$slice(0, 3);
- block = self.$build_block("listing", "verbatim", terminator, parent, reader, attributes);}
- else if ("table"['$===']($case)) {
- block_cursor = reader.$cursor();
- block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_line_comments", "context", "cursor"], {"terminator": terminator, "skip_line_comments": true, "context": "table", "cursor": "at_mark"})), block_cursor);
- if ($truthy(terminator['$start_with?']("|", "!"))) {
- } else {
- ($truthy($a = attributes['$[]']("format")) ? $a : (($writer = ["format", (function() {if ($truthy(terminator['$start_with?'](","))) {
- return "csv"
- } else {
- return "dsv"
- }; return nil; })()]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- };
- block = self.$parse_table(block_reader, parent, attributes);}
- else if ("sidebar"['$===']($case)) {block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes)}
- else if ("admonition"['$===']($case)) {
-
- $writer = ["name", (admonition_name = style.$downcase())];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["textlabel", ($truthy($a = attributes.$delete("caption")) ? $a : doc_attrs['$[]']("" + (admonition_name) + "-caption"))];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);}
- else if ("open"['$===']($case) || "abstract"['$===']($case) || "partintro"['$===']($case)) {block = self.$build_block("open", "compound", terminator, parent, reader, attributes)}
- else if ("literal"['$===']($case)) {block = self.$build_block(block_context, "verbatim", terminator, parent, reader, attributes)}
- else if ("example"['$===']($case)) {
- if ($truthy(attributes['$[]']("collapsible-option"))) {
-
- $writer = ["caption", ""];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- block = self.$build_block(block_context, "compound", terminator, parent, reader, attributes);}
- else if ("quote"['$===']($case) || "verse"['$===']($case)) {
- $$($nesting, '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 ("stem"['$===']($case) || "latexmath"['$===']($case) || "asciimath"['$===']($case)) {
- if (block_context['$==']("stem")) {
-
- $writer = ["style", $$($nesting, 'STEM_TYPE_ALIASES')['$[]'](($truthy($a = attributes['$[]'](2)) ? $a : doc_attrs['$[]']("stem")))];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- block = self.$build_block("stem", "raw", terminator, parent, reader, attributes);}
- else if ("pass"['$===']($case)) {block = self.$build_block(block_context, "raw", terminator, parent, reader, attributes)}
- else if ("comment"['$===']($case)) {
- self.$build_block(block_context, "skip", terminator, parent, reader, attributes);
- attributes.$clear();
- return nil;}
- else {if ($truthy(($truthy($a = block_extensions) ? (extension = extensions['$registered_for_block?'](block_context, cloaked_context)) : $a))) {
-
- if ((content_model = (ext_config = extension.$config())['$[]']("content_model"))['$==']("skip")) {
- } else {
-
- if ($truthy((positional_attrs = ($truthy($a = ext_config['$[]']("positional_attrs")) ? $a : ext_config['$[]']("pos_attrs")))['$nil_or_empty?']())) {
- } else {
- $$($nesting, 'AttributeList').$rekey(attributes, $rb_plus([nil], positional_attrs))
- };
- if ($truthy((default_attrs = ext_config['$[]']("default_attrs")))) {
- $send(default_attrs, 'each', [], ($$13 = function(k, v){var self = $$13.$$s || this, $e;
-
-
-
- if (k == null) {
- k = nil;
- };
-
- if (v == null) {
- v = nil;
- };
- return ($truthy($e = attributes['$[]'](k)) ? $e : (($writer = [k, v]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));}, $$13.$$s = self, $$13.$$arity = 2, $$13))};
-
- $writer = ["cloaked-context", cloaked_context];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- };
- if ($truthy((block = self.$build_block(block_context, content_model, terminator, parent, reader, attributes, $hash2(["extension"], {"extension": extension}))))) {
- } else {
-
- attributes.$clear();
- return nil;
- };
- } else {
- self.$raise("" + "Unsupported block type " + (block_context) + " at " + (reader.$cursor()))
- }}
- };
- if ($truthy(document.$sourcemap())) {
-
- $writer = [reader.$cursor_at_mark()];
- $send(block, 'source_location=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(attributes['$[]']("title"))) {
-
-
- $writer = [(block_title = attributes.$delete("title"))];
- $send(block, 'title=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy($$($nesting, 'CAPTION_ATTRIBUTE_NAMES')['$[]'](block.$context()))) {
- block.$assign_caption(attributes.$delete("caption"))};};
-
- $writer = [attributes['$[]']("style")];
- $send(block, 'style=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy((block_id = ($truthy($a = block.$id()) ? $a : (($writer = [attributes['$[]']("id")]), $send(block, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) {
-
- if ($truthy((function() {if ($truthy(block_title)) {
-
- return block_title['$include?']($$($nesting, 'ATTR_REF_HEAD'));
- } else {
- return block['$title?']()
- }; return nil; })())) {
- block.$title()};
- if ($truthy(document.$register("refs", [block_id, block]))) {
- } else {
- self.$logger().$warn(self.$message_with_context("" + "id assigned to block already in use: " + (block_id), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()})))
- };};
- if ($truthy(attributes['$empty?']())) {
- } else {
- block.$update_attributes(attributes)
- };
- block.$commit_subs();
- if ($truthy(block['$sub?']("callouts"))) {
- if ($truthy(self.$catalog_callouts(block.$source(), document))) {
- } else {
- block.$remove_sub("callouts")
- }};
- return block;
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $Parser_next_block$10.$$arity = -3);
- Opal.defs(self, '$read_paragraph_lines', $Parser_read_paragraph_lines$14 = function $$read_paragraph_lines(reader, break_at_list, opts) {
- var self = this, $writer = nil, break_condition = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
-
- $writer = ["break_on_blank_lines", true];
- $send(opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["break_on_list_continuation", true];
- $send(opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["preserve_last_line", true];
- $send(opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- break_condition = (function() {if ($truthy(break_at_list)) {
-
- if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) {
- return $$($nesting, 'StartOfBlockOrListProc')
- } else {
- return $$($nesting, 'StartOfListProc')
- };
- } else {
-
- if ($truthy($$($nesting, 'Compliance').$block_terminates_paragraph())) {
- return $$($nesting, 'StartOfBlockProc')
- } else {
- return $$($nesting, 'NoOp')
- };
- }; return nil; })();
- return $send(reader, 'read_lines_until', [opts], break_condition.$to_proc());
- }, $Parser_read_paragraph_lines$14.$$arity = -3);
- Opal.defs(self, '$is_delimited_block?', $Parser_is_delimited_block$ques$15 = function(line, return_match_data) {
- var $a, $b, self = this, line_len = nil, tip = nil, tip_len = nil, context = nil, masq = nil;
-
-
-
- if (return_match_data == null) {
- return_match_data = nil;
- };
- if ($truthy(($truthy($a = $rb_gt((line_len = line.$length()), 1)) ? $$($nesting, 'DELIMITED_BLOCK_HEADS')['$[]'](line.$slice(0, 2)) : $a))) {
- } else {
- return nil
- };
- if (line_len['$=='](2)) {
-
- tip = line;
- tip_len = 2;
- } else {
-
- if ($truthy($rb_lt(line_len, 5))) {
-
- tip = line;
- tip_len = line_len;
- } else {
- tip = line.$slice(0, (tip_len = 4))
- };
- if ($truthy(($truthy($a = $$($nesting, 'Compliance').$markdown_syntax()) ? tip['$start_with?']("`") : $a))) {
- if (tip_len['$=='](4)) {
- if (tip['$==']("````")) {
- return nil
- } else if ((tip = tip.$chop())['$==']("```")) {
-
- line = tip;
- line_len = (tip_len = 3);
- } else {
- return nil
- }
- } else if (tip['$==']("```")) {
- } else {
- return nil
- }
- } else if (tip_len['$=='](3)) {
- return nil};
- };
- $b = $$($nesting, 'DELIMITED_BLOCKS')['$[]'](tip), $a = Opal.to_ary($b), (context = ($a[0] == null ? nil : $a[0])), (masq = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy(($truthy($a = context) ? ($truthy($b = line_len['$=='](tip_len)) ? $b : self['$uniform?'](line.$slice(1, line_len), $$($nesting, 'DELIMITED_BLOCK_TAILS')['$[]'](tip), $rb_minus(line_len, 1))) : $a))) {
- if ($truthy(return_match_data)) {
-
- return $$($nesting, 'BlockMatchData').$new(context, masq, tip, line);
- } else {
- return true
- }
- } else {
- return nil
- };
- }, $Parser_is_delimited_block$ques$15.$$arity = -2);
- Opal.defs(self, '$build_block', $Parser_build_block$16 = function $$build_block(block_context, content_model, terminator, parent, reader, attributes, options) {
- var $a, self = this, skip_processing = nil, parse_as_content_model = nil, lines = nil, block_reader = nil, block_cursor = nil, tab_size = nil, indent = nil, extension = nil, block = nil;
-
-
-
- if (options == null) {
- options = $hash2([], {});
- };
- if (content_model['$==']("skip")) {
- $a = [true, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a
- } else if (content_model['$==']("raw")) {
- $a = [false, "simple"], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a
- } else {
- $a = [false, content_model], (skip_processing = $a[0]), (parse_as_content_model = $a[1]), $a
- };
- if ($truthy(terminator['$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 = self.$read_paragraph_lines(reader, false, $hash2(["skip_line_comments", "skip_processing"], {"skip_line_comments": true, "skip_processing": skip_processing}));
- };
- block_reader = nil;
- } else if ($truthy(parse_as_content_model['$!=']("compound"))) {
-
- lines = reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"}));
- block_reader = nil;
- } else if (terminator['$=='](false)) {
-
- lines = nil;
- block_reader = reader;
- } else {
-
- lines = nil;
- block_cursor = reader.$cursor();
- block_reader = $$($nesting, 'Reader').$new(reader.$read_lines_until($hash2(["terminator", "skip_processing", "context", "cursor"], {"terminator": terminator, "skip_processing": skip_processing, "context": block_context, "cursor": "at_mark"})), block_cursor);
- };
- if (content_model['$==']("verbatim")) {
-
- tab_size = ($truthy($a = attributes['$[]']("tabsize")) ? $a : parent.$document().$attributes()['$[]']("tabsize")).$to_i();
- if ($truthy((indent = attributes['$[]']("indent")))) {
- self['$adjust_indentation!'](lines, indent.$to_i(), tab_size)
- } else if ($truthy($rb_gt(tab_size, 0))) {
- self['$adjust_indentation!'](lines, -1, tab_size)};
- } else if (content_model['$==']("skip")) {
- return nil};
- if ($truthy((extension = options['$[]']("extension")))) {
-
- attributes.$delete("style");
- if ($truthy((block = extension.$process_method()['$[]'](parent, ($truthy($a = block_reader) ? $a : $$($nesting, 'Reader').$new(lines)), attributes.$merge())))) {
-
- attributes.$replace(block.$attributes());
- if ($truthy((($a = block.$content_model()['$==']("compound")) ? (lines = block.$lines())['$empty?']()['$!']() : block.$content_model()['$==']("compound")))) {
-
- content_model = "compound";
- block_reader = $$($nesting, 'Reader').$new(lines);};
- } else {
- return nil
- };
- } else {
- block = $$($nesting, 'Block').$new(parent, block_context, $hash2(["content_model", "source", "attributes"], {"content_model": content_model, "source": lines, "attributes": attributes}))
- };
- if (content_model['$==']("compound")) {
- self.$parse_blocks(block_reader, block)};
- return block;
- }, $Parser_build_block$16.$$arity = -7);
- Opal.defs(self, '$parse_blocks', $Parser_parse_blocks$17 = function $$parse_blocks(reader, parent, attributes) {
- var $a, $b, $c, self = this, block = nil;
-
-
-
- if (attributes == null) {
- attributes = nil;
- };
- if ($truthy(attributes)) {
- while ($truthy(($truthy($b = ($truthy($c = (block = self.$next_block(reader, parent, attributes.$merge()))) ? parent.$blocks()['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) {
-
- }
- } else {
- while ($truthy(($truthy($b = ($truthy($c = (block = self.$next_block(reader, parent))) ? parent.$blocks()['$<<'](block) : $c)) ? $b : reader['$has_more_lines?']()))) {
-
- }
- };
- return nil;
- }, $Parser_parse_blocks$17.$$arity = -3);
- Opal.defs(self, '$parse_list', $Parser_parse_list$18 = function $$parse_list(reader, list_type, parent, style) {
- var $a, $b, self = this, list_block = nil, list_rx = nil, list_item = nil;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
-
- list_block = $$($nesting, 'List').$new(parent, list_type);
- list_rx = $$($nesting, 'ListRxMap')['$[]'](list_type);
- while ($truthy(($truthy($b = reader['$has_more_lines?']()) ? list_rx['$=~'](reader.$peek_line()) : $b))) {
-
- if ($truthy((list_item = self.$parse_list_item(reader, list_block, $gvars["~"], (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)), style)))) {
- list_block.$items()['$<<'](list_item)};
- if ($truthy($b = reader.$skip_blank_lines())) {
- $b
- } else {
- break;
- };
- };
- return list_block;
- }, $Parser_parse_list$18.$$arity = 4);
- Opal.defs(self, '$catalog_callouts', $Parser_catalog_callouts$19 = function $$catalog_callouts(text, document) {
- var $$20, self = this, found = nil, autonum = nil;
-
-
- found = false;
- autonum = 0;
- if ($truthy(text['$include?']("<"))) {
- $send(text, 'scan', [$$($nesting, 'CalloutScanRx')], ($$20 = function(){var self = $$20.$$s || this, $a;
-
-
- if ($truthy((($a = $gvars['~']) === nil ? nil : $a['$[]'](0))['$start_with?']("\\"))) {
- } else {
- document.$callouts().$register((function() {if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](2))['$=='](".")) {
- return (autonum = $rb_plus(autonum, 1)).$to_s()
- } else {
- return (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))
- }; return nil; })())
- };
- return (found = true);}, $$20.$$s = self, $$20.$$arity = 0, $$20))};
- return found;
- }, $Parser_catalog_callouts$19.$$arity = 2);
- Opal.defs(self, '$catalog_inline_anchor', $Parser_catalog_inline_anchor$21 = function $$catalog_inline_anchor(id, reftext, node, location, doc) {
- var $a, self = this;
-
-
-
- if (doc == null) {
- doc = node.$document();
- };
- if ($truthy(($truthy($a = reftext) ? reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $a))) {
- reftext = doc.$sub_attributes(reftext)};
- if ($truthy(doc.$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id}))]))) {
- } else {
-
- if ($truthy($$($nesting, 'Reader')['$==='](location))) {
- location = location.$cursor()};
- self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location})));
- };
- return nil;
- }, $Parser_catalog_inline_anchor$21.$$arity = -5);
- Opal.defs(self, '$catalog_inline_anchors', $Parser_catalog_inline_anchors$22 = function $$catalog_inline_anchors(text, block, document, reader) {
- var $a, $$23, self = this;
-
-
- if ($truthy(($truthy($a = text['$include?']("[[")) ? $a : text['$include?']("or:")))) {
- $send(text, 'scan', [$$($nesting, 'InlineAnchorScanRx')], ($$23 = function(){var self = $$23.$$s || this, $b, $c, $d, id = nil, reftext = nil, location = nil, offset = nil;
-
-
- if ($truthy((id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))))) {
- if ($truthy(($truthy($b = ($truthy($c = (reftext = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2)))) ? reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')) : $c)) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) {
- return nil;}
- } else {
-
- id = (($b = $gvars['~']) === nil ? nil : $b['$[]'](3));
- if ($truthy((reftext = (($b = $gvars['~']) === nil ? nil : $b['$[]'](4))))) {
- if ($truthy(reftext['$include?']("]"))) {
-
- reftext = reftext.$gsub("\\]", "]");
- if ($truthy(reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- reftext = document.$sub_attributes(reftext)};
- } else if ($truthy(($truthy($b = reftext['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (reftext = document.$sub_attributes(reftext))['$empty?']() : $b))) {
- return nil;}};
- };
- if ($truthy(document.$register("refs", [id, $$($nesting, 'Inline').$new(block, "anchor", reftext, $hash2(["type", "id"], {"type": "ref", "id": id}))]))) {
- return nil
- } else {
-
- location = reader.$cursor_at_mark();
- if ($truthy($rb_gt((offset = $rb_plus((($b = $gvars['~']) === nil ? nil : $b.$pre_match()).$count($$($nesting, 'LF')), (function() {if ($truthy((($b = $gvars['~']) === nil ? nil : $b['$[]'](0))['$start_with?']($$($nesting, 'LF')))) {
- return 1
- } else {
- return 0
- }; return nil; })())), 0))) {
- (location = location.$dup()).$advance(offset)};
- return self.$logger().$warn(self.$message_with_context("" + "id assigned to anchor already in use: " + (id), $hash2(["source_location"], {"source_location": location})));
- };}, $$23.$$s = self, $$23.$$arity = 0, $$23))};
- return nil;
- }, $Parser_catalog_inline_anchors$22.$$arity = 4);
- Opal.defs(self, '$catalog_inline_biblio_anchor', $Parser_catalog_inline_biblio_anchor$24 = function $$catalog_inline_biblio_anchor(id, reftext, node, reader) {
- var $a, self = this;
-
-
- if ($truthy(node.$document().$register("refs", [id, $$($nesting, 'Inline').$new(node, "anchor", ($truthy($a = reftext) ? "" + "[" + (reftext) + "]" : $a), $hash2(["type", "id"], {"type": "bibref", "id": id}))]))) {
- } else {
- self.$logger().$warn(self.$message_with_context("" + "id assigned to bibliography anchor already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor()})))
- };
- return nil;
- }, $Parser_catalog_inline_biblio_anchor$24.$$arity = 4);
- Opal.defs(self, '$parse_description_list', $Parser_parse_description_list$25 = function $$parse_description_list(reader, match, parent) {
- var $a, $b, self = this, list_block = nil, sibling_pattern = nil, current_pair = nil, next_pair = nil, $writer = nil;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
-
- list_block = $$($nesting, 'List').$new(parent, "dlist");
- sibling_pattern = $$($nesting, 'DescriptionListSiblingRx')['$[]'](match['$[]'](2));
- list_block.$items()['$<<']((current_pair = self.$parse_list_item(reader, list_block, match, sibling_pattern)));
- while ($truthy(($truthy($b = reader['$has_more_lines?']()) ? sibling_pattern['$=~'](reader.$peek_line()) : $b))) {
-
- next_pair = self.$parse_list_item(reader, list_block, $gvars["~"], sibling_pattern);
- if ($truthy(current_pair['$[]'](1))) {
- list_block.$items()['$<<']((current_pair = next_pair))
- } else {
-
- current_pair['$[]'](0)['$<<'](next_pair['$[]'](0)['$[]'](0));
-
- $writer = [1, next_pair['$[]'](1)];
- $send(current_pair, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- };
- };
- return list_block;
- }, $Parser_parse_description_list$25.$$arity = 3);
- Opal.defs(self, '$parse_callout_list', $Parser_parse_callout_list$26 = function $$parse_callout_list(reader, match, parent, callouts) {
- var $a, $b, $c, self = this, list_block = nil, next_index = nil, autonum = nil, num = nil, list_item = nil, coids = nil, $writer = nil;
-
-
- list_block = $$($nesting, 'List').$new(parent, "colist");
- next_index = 1;
- autonum = 0;
- while ($truthy(($truthy($b = match) ? $b : ($truthy($c = (match = $$($nesting, 'CalloutListRx').$match(reader.$peek_line()))) ? reader.$mark() : $c)))) {
-
- if ((num = match['$[]'](1))['$=='](".")) {
- num = (autonum = $rb_plus(autonum, 1)).$to_s()};
- if (num['$=='](next_index.$to_s())) {
- } else {
- self.$logger().$warn(self.$message_with_context("" + "callout list item index: expected " + (next_index) + ", got " + (num), $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()})))
- };
- if ($truthy((list_item = self.$parse_list_item(reader, list_block, match, "<1>")))) {
-
- list_block.$items()['$<<'](list_item);
- if ($truthy((coids = callouts.$callout_ids(list_block.$items().$size()))['$empty?']())) {
- self.$logger().$warn(self.$message_with_context("" + "no callout found for <" + (list_block.$items().$size()) + ">", $hash2(["source_location"], {"source_location": reader.$cursor_at_mark()})))
- } else {
-
- $writer = ["coids", coids];
- $send(list_item.$attributes(), '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };};
- next_index = $rb_plus(next_index, 1);
- match = nil;
- };
- callouts.$next_list();
- return list_block;
- }, $Parser_parse_callout_list$26.$$arity = 4);
- Opal.defs(self, '$parse_list_item', $Parser_parse_list_item$27 = function $$parse_list_item(reader, list_block, match, sibling_trait, style) {
- var $a, $b, self = this, list_type = nil, dlist = nil, list_term = nil, term_text = nil, item_text = nil, has_text = nil, list_item = nil, $writer = nil, sourcemap_assignment_deferred = nil, ordinal = nil, implicit_style = nil, block_cursor = nil, list_item_reader = nil, comment_lines = nil, subsequent_line = nil, content_adjacent = nil, block = nil, first_block = nil;
-
-
-
- if (style == null) {
- style = nil;
- };
- if ((list_type = list_block.$context())['$==']("dlist")) {
-
- dlist = true;
- list_term = $$($nesting, 'ListItem').$new(list_block, (term_text = match['$[]'](1)));
- if ($truthy(($truthy($a = term_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](term_text) : $a))) {
- self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), ($truthy($a = (($b = $gvars['~']) === nil ? nil : $b['$[]'](2))) ? $a : (($b = $gvars['~']) === nil ? nil : $b.$post_match()).$lstrip()), list_term, reader)};
- if ($truthy((item_text = match['$[]'](3)))) {
- has_text = true};
- list_item = $$($nesting, 'ListItem').$new(list_block, item_text);
- if ($truthy(list_block.$document().$sourcemap())) {
-
-
- $writer = [reader.$cursor()];
- $send(list_term, 'source_location=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(has_text)) {
-
- $writer = [list_term.$source_location()];
- $send(list_item, 'source_location=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
- sourcemap_assignment_deferred = true
- };};
- } else {
-
- has_text = true;
- list_item = $$($nesting, 'ListItem').$new(list_block, (item_text = match['$[]'](2)));
- if ($truthy(list_block.$document().$sourcemap())) {
-
- $writer = [reader.$cursor()];
- $send(list_item, 'source_location=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if (list_type['$==']("ulist")) {
-
-
- $writer = [sibling_trait];
- $send(list_item, 'marker=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(item_text['$start_with?']("["))) {
- if ($truthy(($truthy($a = style) ? style['$==']("bibliography") : $a))) {
- if ($truthy($$($nesting, 'InlineBiblioAnchorRx')['$=~'](item_text))) {
- self.$catalog_inline_biblio_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)}
- } else if ($truthy(item_text['$start_with?']("[["))) {
- if ($truthy($$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text))) {
- self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)}
- } else if ($truthy(item_text['$start_with?']("[ ] ", "[x] ", "[*] "))) {
-
- list_block.$set_option("checklist");
-
- $writer = ["checkbox", ""];
- $send(list_item.$attributes(), '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(item_text['$start_with?']("[ "))) {
- } else {
-
- $writer = ["checked", ""];
- $send(list_item.$attributes(), '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
-
- $writer = [item_text.$slice(4, item_text.$length())];
- $send(list_item, 'text=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;}};
- } else if (list_type['$==']("olist")) {
-
- $b = self.$resolve_ordered_list_marker(sibling_trait, (ordinal = list_block.$items().$size()), true, reader), $a = Opal.to_ary($b), (sibling_trait = ($a[0] == null ? nil : $a[0])), (implicit_style = ($a[1] == null ? nil : $a[1])), $b;
-
- $writer = [sibling_trait];
- $send(list_item, 'marker=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy((($a = ordinal['$=='](0)) ? style['$!']() : ordinal['$=='](0)))) {
-
- $writer = [($truthy($a = implicit_style) ? $a : ($truthy($b = $$($nesting, 'ORDERED_LIST_STYLES')['$[]']($rb_minus(sibling_trait.$length(), 1))) ? $b : "arabic").$to_s())];
- $send(list_block, 'style=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(($truthy($a = item_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text) : $a))) {
- self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)};
- } else {
-
-
- $writer = [sibling_trait];
- $send(list_item, 'marker=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(($truthy($a = item_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](item_text) : $a))) {
- self.$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), list_item, reader)};
- };
- };
- reader.$shift();
- block_cursor = reader.$cursor();
- list_item_reader = $$($nesting, 'Reader').$new(self.$read_lines_for_list_item(reader, list_type, sibling_trait, has_text), block_cursor);
- if ($truthy(list_item_reader['$has_more_lines?']())) {
-
- if ($truthy(sourcemap_assignment_deferred)) {
-
- $writer = [block_cursor];
- $send(list_item, 'source_location=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- comment_lines = list_item_reader.$skip_line_comments();
- if ($truthy((subsequent_line = list_item_reader.$peek_line()))) {
-
- if ($truthy(comment_lines['$empty?']())) {
- } else {
- list_item_reader.$unshift_lines(comment_lines)
- };
- if ($truthy(subsequent_line['$empty?']())) {
- } else {
-
- content_adjacent = true;
- if ($truthy(dlist)) {
- } else {
- has_text = nil
- };
- };};
- if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["text_only", "list_type"], {"text_only": (function() {if ($truthy(has_text)) {
- return nil
- } else {
- return true
- }; return nil; })(), "list_type": list_type}))))) {
- list_item.$blocks()['$<<'](block)};
- while ($truthy(list_item_reader['$has_more_lines?']())) {
- if ($truthy((block = self.$next_block(list_item_reader, list_item, $hash2([], {}), $hash2(["list_type"], {"list_type": list_type}))))) {
- list_item.$blocks()['$<<'](block)}
- };
- if ($truthy(($truthy($a = ($truthy($b = content_adjacent) ? (first_block = list_item.$blocks()['$[]'](0)) : $b)) ? first_block.$context()['$==']("paragraph") : $a))) {
- list_item.$fold_first()};};
- if ($truthy(dlist)) {
- return [[list_term], (function() {if ($truthy(($truthy($a = list_item['$text?']()) ? $a : list_item['$blocks?']()))) {
- return list_item
- } else {
- return nil
- }; return nil; })()]
- } else {
- return list_item
- };
- }, $Parser_parse_list_item$27.$$arity = -5);
- Opal.defs(self, '$read_lines_for_list_item', $Parser_read_lines_for_list_item$28 = function $$read_lines_for_list_item(reader, list_type, sibling_trait, has_text) {
- var $a, $b, $c, $$29, $$30, $$31, $$32, $$33, self = this, buffer = nil, continuation = nil, within_nested_list = nil, detached_continuation = nil, dlist = nil, this_line = nil, prev_line = nil, $writer = nil, match = nil, nested_list_type = nil, last_line = 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;
- dlist = list_type['$==']("dlist");
- while ($truthy(reader['$has_more_lines?']())) {
-
- this_line = reader.$read_line();
- if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) {
- break;};
- prev_line = (function() {if ($truthy(buffer['$empty?']())) {
- return nil
- } else {
- return buffer['$[]'](-1)
- }; return nil; })();
- if (prev_line['$==']($$($nesting, 'LIST_CONTINUATION'))) {
-
- if (continuation['$==']("inactive")) {
-
- continuation = "active";
- has_text = true;
- if ($truthy(within_nested_list)) {
- } else {
-
- $writer = [-1, ""];
- $send(buffer, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };};
- if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) {
-
- if ($truthy(continuation['$!=']("frozen"))) {
-
- continuation = "frozen";
- buffer['$<<'](this_line);};
- this_line = nil;
- continue;;};};
- if ($truthy((match = self['$is_delimited_block?'](this_line, true)))) {
- if (continuation['$==']("active")) {
-
- buffer['$<<'](this_line);
- buffer.$concat(reader.$read_lines_until($hash2(["terminator", "read_last_line", "context"], {"terminator": match.$terminator(), "read_last_line": true, "context": nil})));
- continuation = "inactive";
- } else {
- break;
- }
- } else if ($truthy(($truthy($b = ($truthy($c = dlist) ? continuation['$!=']("active") : $c)) ? $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line) : $b))) {
- break;
- } else if ($truthy((($b = continuation['$==']("active")) ? this_line['$empty?']()['$!']() : continuation['$==']("active")))) {
- if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) {
-
- reader.$unshift_line(this_line);
- if ($truthy(dlist)) {
- buffer.$concat($send(reader, 'read_lines_until', [$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})], ($$29 = function(line){var self = $$29.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return self['$is_sibling_list_item?'](line, list_type, sibling_trait);}, $$29.$$s = self, $$29.$$arity = 1, $$29)))
- } else {
- buffer.$concat(reader.$read_lines_until($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 ($truthy(($truthy($b = ($truthy($c = $$($nesting, 'BlockTitleRx')['$match?'](this_line)) ? $c : $$($nesting, 'BlockAttributeLineRx')['$match?'](this_line))) ? $b : $$($nesting, 'AttributeEntryRx')['$match?'](this_line)))) {
- buffer['$<<'](this_line)
- } else {
-
- if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) {
- return ["dlist"]
- } else {
- return $$($nesting, 'NESTABLE_LIST_CONTEXTS')
- }; return nil; })(), 'find', [], ($$30 = function(ctx){var self = $$30.$$s || this;
-
-
-
- if (ctx == null) {
- ctx = nil;
- };
- return $$($nesting, 'ListRxMap')['$[]'](ctx)['$match?'](this_line);}, $$30.$$s = self, $$30.$$arity = 1, $$30))))) {
-
- within_nested_list = true;
- if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) {
- has_text = false};};
- buffer['$<<'](this_line);
- continuation = "inactive";
- }
- } else if ($truthy(($truthy($b = prev_line) ? prev_line['$empty?']() : $b))) {
-
- if ($truthy(this_line['$empty?']())) {
-
- if ($truthy((this_line = ($truthy($b = reader.$skip_blank_lines()) ? reader.$read_line() : $b)))) {
- } else {
- break;
- };
- if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) {
- break;};};
- if (this_line['$==']($$($nesting, 'LIST_CONTINUATION'))) {
-
- detached_continuation = buffer.$size();
- buffer['$<<'](this_line);
- } else if ($truthy(has_text)) {
- if ($truthy(self['$is_sibling_list_item?'](this_line, list_type, sibling_trait))) {
- break;
- } else if ($truthy((nested_list_type = $send($$($nesting, 'NESTABLE_LIST_CONTEXTS'), 'find', [], ($$31 = function(ctx){var self = $$31.$$s || this;
-
-
-
- if (ctx == null) {
- ctx = nil;
- };
- return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, $$31.$$s = self, $$31.$$arity = 1, $$31))))) {
-
- buffer['$<<'](this_line);
- within_nested_list = true;
- if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) {
- has_text = false};
- } else if ($truthy($$($nesting, 'LiteralParagraphRx')['$match?'](this_line))) {
-
- reader.$unshift_line(this_line);
- if ($truthy(dlist)) {
- buffer.$concat($send(reader, 'read_lines_until', [$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})], ($$32 = function(line){var self = $$32.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return self['$is_sibling_list_item?'](line, list_type, sibling_trait);}, $$32.$$s = self, $$32.$$arity = 1, $$32)))
- } else {
- buffer.$concat(reader.$read_lines_until($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 ($truthy(within_nested_list)) {
- } else {
- buffer.$pop()
- };
- buffer['$<<'](this_line);
- has_text = true;
- };
- } else {
-
- if ($truthy(this_line['$empty?']())) {
- } else {
- has_text = true
- };
- if ($truthy((nested_list_type = $send((function() {if ($truthy(within_nested_list)) {
- return ["dlist"]
- } else {
- return $$($nesting, 'NESTABLE_LIST_CONTEXTS')
- }; return nil; })(), 'find', [], ($$33 = function(ctx){var self = $$33.$$s || this;
-
-
-
- if (ctx == null) {
- ctx = nil;
- };
- return $$($nesting, 'ListRxMap')['$[]'](ctx)['$=~'](this_line);}, $$33.$$s = self, $$33.$$arity = 1, $$33))))) {
-
- within_nested_list = true;
- if ($truthy((($b = nested_list_type['$==']("dlist")) ? (($c = $gvars['~']) === nil ? nil : $c['$[]'](3))['$nil_or_empty?']() : nested_list_type['$==']("dlist")))) {
- has_text = false};};
- buffer['$<<'](this_line);
- };
- this_line = nil;
- };
- if ($truthy(this_line)) {
- reader.$unshift_line(this_line)};
- if ($truthy(detached_continuation)) {
-
- $writer = [detached_continuation, ""];
- $send(buffer, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- while (!($truthy(buffer['$empty?']()))) {
- if ($truthy((last_line = buffer['$[]'](-1))['$empty?']())) {
- buffer.$pop()
- } else {
-
- if (last_line['$==']($$($nesting, 'LIST_CONTINUATION'))) {
- buffer.$pop()};
- break;;
- }
- };
- return buffer;
- }, $Parser_read_lines_for_list_item$28.$$arity = -3);
- Opal.defs(self, '$initialize_section', $Parser_initialize_section$34 = function $$initialize_section(reader, parent, attributes) {
- var $a, $b, self = this, document = nil, book = nil, doctype = nil, source_location = nil, sect_style = nil, sect_id = nil, sect_reftext = nil, sect_title = nil, sect_level = nil, sect_atx = nil, $writer = nil, sect_name = nil, sect_special = nil, sect_numbered = nil, section = nil, id = nil, generated_id = nil;
-
-
-
- if (attributes == null) {
- attributes = $hash2([], {});
- };
- document = parent.$document();
- book = (doctype = document.$doctype())['$==']("book");
- if ($truthy(document.$sourcemap())) {
- source_location = reader.$cursor()};
- sect_style = attributes['$[]'](1);
- $b = self.$parse_section_title(reader, document, attributes['$[]']("id")), $a = Opal.to_ary($b), (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])), (sect_atx = ($a[4] == null ? nil : $a[4])), $b;
- if ($truthy(sect_reftext)) {
-
- $writer = ["reftext", sect_reftext];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
- sect_reftext = attributes['$[]']("reftext")
- };
- if ($truthy(sect_style)) {
- if ($truthy(($truthy($a = book) ? sect_style['$==']("abstract") : $a))) {
- $a = ["chapter", 1], (sect_name = $a[0]), (sect_level = $a[1]), $a
- } else if ($truthy(($truthy($a = sect_style['$start_with?']("sect")) ? $$($nesting, 'SectionLevelStyleRx')['$match?'](sect_style) : $a))) {
- sect_name = "section"
- } else {
-
- $a = [sect_style, true], (sect_name = $a[0]), (sect_special = $a[1]), $a;
- if (sect_level['$=='](0)) {
- sect_level = 1};
- sect_numbered = sect_name['$==']("appendix");
- }
- } else if ($truthy(book)) {
- sect_name = (function() {if (sect_level['$=='](0)) {
- return "part"
- } else {
-
- if ($truthy($rb_gt(sect_level, 1))) {
- return "section"
- } else {
- return "chapter"
- };
- }; return nil; })()
- } else if ($truthy((($a = doctype['$==']("manpage")) ? sect_title.$casecmp("synopsis")['$=='](0) : doctype['$==']("manpage")))) {
- $a = ["synopsis", true], (sect_name = $a[0]), (sect_special = $a[1]), $a
- } else {
- sect_name = "section"
- };
- section = $$($nesting, 'Section').$new(parent, sect_level);
- $a = [sect_id, sect_title, sect_name, source_location], section['$id=']($a[0]), section['$title=']($a[1]), section['$sectname=']($a[2]), section['$source_location=']($a[3]), $a;
- if ($truthy(sect_special)) {
-
-
- $writer = [true];
- $send(section, 'special=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(sect_numbered)) {
-
- $writer = [true];
- $send(section, 'numbered=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else if (document.$attributes()['$[]']("sectnums")['$==']("all")) {
-
- $writer = [(function() {if ($truthy(($truthy($a = book) ? sect_level['$=='](1) : $a))) {
- return "chapter"
- } else {
- return true
- }; return nil; })()];
- $send(section, 'numbered=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- } else if ($truthy(($truthy($a = document.$attributes()['$[]']("sectnums")) ? $rb_gt(sect_level, 0) : $a))) {
-
- $writer = [(function() {if ($truthy(section.$special())) {
- return ($truthy($a = parent.$numbered()) ? true : $a)
- } else {
- return true
- }; return nil; })()];
- $send(section, 'numbered=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else if ($truthy(($truthy($a = ($truthy($b = book) ? sect_level['$=='](0) : $b)) ? document.$attributes()['$[]']("partnums") : $a))) {
-
- $writer = [true];
- $send(section, 'numbered=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy((id = ($truthy($a = section.$id()) ? $a : (($writer = [(function() {if ($truthy(document.$attributes()['$key?']("sectids"))) {
-
- return (generated_id = $$($nesting, 'Section').$generate_id(section.$title(), document));
- } else {
- return nil
- }; return nil; })()]), $send(section, 'id=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))))) {
-
- if ($truthy(generated_id)) {
- } else if ($truthy(sect_title['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- section.$title()};
- if ($truthy(document.$register("refs", [id, section]))) {
- } else {
- self.$logger().$warn(self.$message_with_context("" + "id assigned to section already in use: " + (id), $hash2(["source_location"], {"source_location": reader.$cursor_at_line($rb_minus(reader.$lineno(), (function() {if ($truthy(sect_atx)) {
- return 1
- } else {
- return 2
- }; return nil; })()))})))
- };};
- section.$update_attributes(attributes);
- reader.$skip_blank_lines();
- return section;
- }, $Parser_initialize_section$34.$$arity = -3);
- Opal.defs(self, '$is_next_line_section?', $Parser_is_next_line_section$ques$35 = function(reader, attributes) {
- var $a, $b, self = this, style = nil, next_lines = nil;
-
- if ($truthy(($truthy($a = (style = attributes['$[]'](1))) ? ($truthy($b = style['$==']("discrete")) ? $b : style['$==']("float")) : $a))) {
- return nil
- } else if ($truthy($$($nesting, 'Compliance').$underline_style_section_titles())) {
-
- next_lines = reader.$peek_lines(2, ($truthy($a = style) ? style['$==']("comment") : $a));
- return self['$is_section_title?'](($truthy($a = next_lines['$[]'](0)) ? $a : ""), next_lines['$[]'](1));
- } else {
- return self['$atx_section_title?'](($truthy($a = reader.$peek_line()) ? $a : ""))
- }
- }, $Parser_is_next_line_section$ques$35.$$arity = 2);
- Opal.defs(self, '$is_next_line_doctitle?', $Parser_is_next_line_doctitle$ques$36 = function(reader, attributes, leveloffset) {
- var $a, self = this, sect_level = nil;
-
- if ($truthy(leveloffset)) {
- return ($truthy($a = (sect_level = self['$is_next_line_section?'](reader, attributes))) ? $rb_plus(sect_level, leveloffset.$to_i())['$=='](0) : $a)
- } else {
- return self['$is_next_line_section?'](reader, attributes)['$=='](0)
- }
- }, $Parser_is_next_line_doctitle$ques$36.$$arity = 3);
- Opal.defs(self, '$is_section_title?', $Parser_is_section_title$ques$37 = function(line1, line2) {
- var $a, self = this;
-
-
-
- if (line2 == null) {
- line2 = nil;
- };
- return ($truthy($a = self['$atx_section_title?'](line1)) ? $a : (function() {if ($truthy(line2['$nil_or_empty?']())) {
- return nil
- } else {
- return self['$setext_section_title?'](line1, line2)
- }; return nil; })());
- }, $Parser_is_section_title$ques$37.$$arity = -2);
- Opal.defs(self, '$atx_section_title?', $Parser_atx_section_title$ques$38 = function(line) {
- var $a, self = this;
-
- if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) {
-
- return ($truthy($a = line['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line) : $a);
- } else {
-
- return ($truthy($a = line['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line) : $a);
- }; return nil; })())) {
- return $rb_minus((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)).$length(), 1)
- } else {
- return nil
- }
- }, $Parser_atx_section_title$ques$38.$$arity = 1);
- Opal.defs(self, '$setext_section_title?', $Parser_setext_section_title$ques$39 = function(line1, line2) {
- var $a, $b, $c, self = this, level = nil, line2_ch0 = nil, line2_len = nil;
-
- if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch0 = line2.$chr())))) ? self['$uniform?'](line2, line2_ch0, (line2_len = line2.$length())) : $c)) ? $$($nesting, 'SetextSectionTitleRx')['$match?'](line1) : $b)) ? $rb_lt($rb_minus(line1.$length(), line2_len).$abs(), 2) : $a))) {
- return level
- } else {
- return nil
- }
- }, $Parser_setext_section_title$ques$39.$$arity = 2);
- Opal.defs(self, '$parse_section_title', $Parser_parse_section_title$40 = function $$parse_section_title(reader, document, sect_id) {
- var $a, $b, $c, $d, $e, self = this, sect_reftext = nil, line1 = nil, sect_level = nil, sect_title = nil, atx = nil, line2 = nil, line2_ch0 = nil, line2_len = nil;
-
-
-
- if (sect_id == null) {
- sect_id = nil;
- };
- sect_reftext = nil;
- line1 = reader.$read_line();
- if ($truthy((function() {if ($truthy($$($nesting, 'Compliance').$markdown_syntax())) {
-
- return ($truthy($a = line1['$start_with?']("=", "#")) ? $$($nesting, 'ExtAtxSectionTitleRx')['$=~'](line1) : $a);
- } else {
-
- return ($truthy($a = line1['$start_with?']("=")) ? $$($nesting, 'AtxSectionTitleRx')['$=~'](line1) : $a);
- }; return nil; })())) {
-
- $a = [$rb_minus((($b = $gvars['~']) === nil ? nil : $b['$[]'](1)).$length(), 1), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), true], (sect_level = $a[0]), (sect_title = $a[1]), (atx = $a[2]), $a;
- if ($truthy(sect_id)) {
- } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) {
- $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a};
- } else if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = $$($nesting, 'Compliance').$underline_style_section_titles()) ? (line2 = reader.$peek_line(true)) : $e)) ? (sect_level = $$($nesting, 'SETEXT_SECTION_LEVELS')['$[]']((line2_ch0 = line2.$chr()))) : $d)) ? self['$uniform?'](line2, line2_ch0, (line2_len = line2.$length())) : $c)) ? (sect_title = ($truthy($c = $$($nesting, 'SetextSectionTitleRx')['$=~'](line1)) ? (($d = $gvars['~']) === nil ? nil : $d['$[]'](1)) : $c)) : $b)) ? $rb_lt($rb_minus(line1.$length(), line2_len).$abs(), 2) : $a))) {
-
- atx = false;
- if ($truthy(sect_id)) {
- } else if ($truthy(($truthy($a = ($truthy($b = sect_title['$end_with?']("]]")) ? $$($nesting, 'InlineSectionAnchorRx')['$=~'](sect_title) : $b)) ? (($b = $gvars['~']) === nil ? nil : $b['$[]'](1))['$!']() : $a))) {
- $a = [sect_title.$slice(0, $rb_minus(sect_title.$length(), (($b = $gvars['~']) === nil ? nil : $b['$[]'](0)).$length())), (($b = $gvars['~']) === nil ? nil : $b['$[]'](2)), (($b = $gvars['~']) === nil ? nil : $b['$[]'](3))], (sect_title = $a[0]), (sect_id = $a[1]), (sect_reftext = $a[2]), $a};
- reader.$shift();
- } else {
- self.$raise("" + "Unrecognized section at " + (reader.$cursor_at_prev_line()))
- };
- if ($truthy(document['$attr?']("leveloffset"))) {
-
- sect_level = $rb_plus(sect_level, document.$attr("leveloffset").$to_i());
- if ($truthy($rb_lt(sect_level, 0))) {
- sect_level = 0};};
- return [sect_id, sect_reftext, sect_title, sect_level, atx];
- }, $Parser_parse_section_title$40.$$arity = -3);
- Opal.defs(self, '$parse_header_metadata', $Parser_parse_header_metadata$41 = function $$parse_header_metadata(reader, document) {
- var $a, $$42, $$43, $$44, self = this, doc_attrs = nil, implicit_authors = nil, metadata = nil, implicit_author = nil, implicit_authorinitials = nil, author_metadata = nil, rev_metadata = nil, rev_line = nil, match = nil, $writer = nil, component = nil, author_line = nil, authors = nil, author_idx = nil, author_key = nil, explicit = nil, sparse = nil, author_override = nil;
-
-
-
- if (document == null) {
- document = nil;
- };
- doc_attrs = ($truthy($a = document) ? document.$attributes() : $a);
- self.$process_attribute_entries(reader, document);
- $a = [(implicit_authors = $hash2([], {})), nil, nil], (metadata = $a[0]), (implicit_author = $a[1]), (implicit_authorinitials = $a[2]), $a;
- if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) {
-
- if ($truthy((author_metadata = self.$process_authors(reader.$read_line()))['$empty?']())) {
- } else {
-
- if ($truthy(document)) {
-
- $send(author_metadata, 'each', [], ($$42 = function(key, val){var self = $$42.$$s || this, $writer = nil;
-
-
-
- if (key == null) {
- key = nil;
- };
-
- if (val == null) {
- val = nil;
- };
- if ($truthy(doc_attrs['$key?'](key))) {
- return nil
- } else {
-
- $writer = [key, (function() {if ($truthy($$$('::', 'String')['$==='](val))) {
-
- return document.$apply_header_subs(val);
- } else {
- return val
- }; return nil; })()];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };}, $$42.$$s = self, $$42.$$arity = 2, $$42));
- implicit_author = doc_attrs['$[]']("author");
- implicit_authorinitials = doc_attrs['$[]']("authorinitials");
- implicit_authors = doc_attrs['$[]']("authors");};
- metadata = author_metadata;
- };
- self.$process_attribute_entries(reader, document);
- rev_metadata = $hash2([], {});
- if ($truthy(($truthy($a = reader['$has_more_lines?']()) ? reader['$next_line_empty?']()['$!']() : $a))) {
-
- rev_line = reader.$read_line();
- if ($truthy((match = $$($nesting, 'RevisionInfoLineRx').$match(rev_line)))) {
-
- if ($truthy(match['$[]'](1))) {
-
- $writer = ["revnumber", match['$[]'](1).$rstrip()];
- $send(rev_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy((component = match['$[]'](2).$strip())['$empty?']())) {
- } else if ($truthy(($truthy($a = match['$[]'](1)['$!']()) ? component['$start_with?']("v") : $a))) {
-
- $writer = ["revnumber", component.$slice(1, component.$length())];
- $send(rev_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = ["revdate", component];
- $send(rev_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy(match['$[]'](3))) {
-
- $writer = ["revremark", match['$[]'](3).$rstrip()];
- $send(rev_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- } else {
- reader.$unshift_line(rev_line)
- };};
- if ($truthy(rev_metadata['$empty?']())) {
- } else {
-
- if ($truthy(document)) {
- $send(rev_metadata, 'each', [], ($$43 = function(key, val){var self = $$43.$$s || this;
-
-
-
- if (key == null) {
- key = nil;
- };
-
- if (val == null) {
- val = nil;
- };
- if ($truthy(doc_attrs['$key?'](key))) {
- return nil
- } else {
-
- $writer = [key, document.$apply_header_subs(val)];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };}, $$43.$$s = self, $$43.$$arity = 2, $$43))};
- metadata.$update(rev_metadata);
- };
- self.$process_attribute_entries(reader, document);
- reader.$skip_blank_lines();
- } else {
- author_metadata = $hash2([], {})
- };
- if ($truthy(document)) {
-
- if ($truthy(($truthy($a = doc_attrs['$key?']("author")) ? (author_line = doc_attrs['$[]']("author"))['$!='](implicit_author) : $a))) {
-
- author_metadata = self.$process_authors(author_line, true, false);
- if ($truthy(doc_attrs['$[]']("authorinitials")['$!='](implicit_authorinitials))) {
- author_metadata.$delete("authorinitials")};
- } else if ($truthy(($truthy($a = doc_attrs['$key?']("authors")) ? (author_line = doc_attrs['$[]']("authors"))['$!='](implicit_authors) : $a))) {
- author_metadata = self.$process_authors(author_line, true)
- } else {
-
- $a = [[], 1, "author_1", false, false], (authors = $a[0]), (author_idx = $a[1]), (author_key = $a[2]), (explicit = $a[3]), (sparse = $a[4]), $a;
- while ($truthy(doc_attrs['$key?'](author_key))) {
-
- if ((author_override = doc_attrs['$[]'](author_key))['$=='](author_metadata['$[]'](author_key))) {
-
- authors['$<<'](nil);
- sparse = true;
- } else {
-
- authors['$<<'](author_override);
- explicit = true;
- };
- author_key = "" + "author_" + ((author_idx = $rb_plus(author_idx, 1)));
- };
- if ($truthy(explicit)) {
-
- if ($truthy(sparse)) {
- $send(authors, 'each_with_index', [], ($$44 = function(author, idx){var self = $$44.$$s || this, $$45, name_idx = nil;
-
-
-
- if (author == null) {
- author = nil;
- };
-
- if (idx == null) {
- idx = nil;
- };
- if ($truthy(author)) {
- return nil
- } else {
-
- $writer = [idx, $send([author_metadata['$[]']("" + "firstname_" + ((name_idx = $rb_plus(idx, 1)))), author_metadata['$[]']("" + "middlename_" + (name_idx)), author_metadata['$[]']("" + "lastname_" + (name_idx))].$compact(), 'map', [], ($$45 = function(it){var self = $$45.$$s || this;
-
-
-
- if (it == null) {
- it = nil;
- };
- return it.$tr(" ", "_");}, $$45.$$s = self, $$45.$$arity = 1, $$45)).$join(" ")];
- $send(authors, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };}, $$44.$$s = self, $$44.$$arity = 2, $$44))};
- author_metadata = self.$process_authors(authors, true, false);
- } else {
- author_metadata = $hash2([], {})
- };
- };
- if ($truthy(author_metadata['$empty?']())) {
- ($truthy($a = metadata['$[]']("authorcount")) ? $a : (($writer = ["authorcount", (($writer = ["authorcount", 0]), $send(doc_attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])]), $send(metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))
- } else {
-
- doc_attrs.$update(author_metadata);
- if ($truthy(($truthy($a = doc_attrs['$key?']("email")['$!']()) ? doc_attrs['$key?']("email_1") : $a))) {
-
- $writer = ["email", doc_attrs['$[]']("email_1")];
- $send(doc_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- };};
- return metadata;
- }, $Parser_parse_header_metadata$41.$$arity = -2);
- Opal.defs(self, '$process_authors', $Parser_process_authors$46 = function $$process_authors(author_line, names_only, multiple) {
- var $a, $$47, self = this, author_metadata = nil, author_idx = nil, $writer = nil;
-
-
-
- if (names_only == null) {
- names_only = false;
- };
-
- if (multiple == null) {
- multiple = true;
- };
- author_metadata = $hash2([], {});
- author_idx = 0;
- $send((function() {if ($truthy(($truthy($a = multiple) ? author_line['$include?'](";") : $a))) {
-
- return author_line.$split($$($nesting, 'AuthorDelimiterRx'));
- } else {
- return [].concat(Opal.to_a(author_line))
- }; return nil; })(), 'each', [], ($$47 = function(author_entry){var self = $$47.$$s || this, $$48, $$49, $b, $$50, key_map = nil, $writer = nil, segments = nil, match = nil, author = nil, fname = nil, mname = nil, lname = nil;
-
-
-
- if (author_entry == null) {
- author_entry = nil;
- };
- if ($truthy(author_entry['$empty?']())) {
- return nil;};
- key_map = $hash2([], {});
- if ((author_idx = $rb_plus(author_idx, 1))['$=='](1)) {
- $send($$($nesting, 'AuthorKeys'), 'each', [], ($$48 = function(key){var self = $$48.$$s || this, $writer = nil;
-
-
-
- if (key == null) {
- key = nil;
- };
- $writer = [key.$to_sym(), key];
- $send(key_map, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$48.$$s = self, $$48.$$arity = 1, $$48))
- } else {
- $send($$($nesting, 'AuthorKeys'), 'each', [], ($$49 = function(key){var self = $$49.$$s || this, $writer = nil;
-
-
-
- if (key == null) {
- key = nil;
- };
- $writer = [key.$to_sym(), "" + (key) + "_" + (author_idx)];
- $send(key_map, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$49.$$s = self, $$49.$$arity = 1, $$49))
- };
- if ($truthy(names_only)) {
-
- if ($truthy(author_entry['$include?']("<"))) {
-
-
- $writer = [key_map['$[]']("author"), author_entry.$tr("_", " ")];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- author_entry = author_entry.$gsub($$($nesting, 'XmlSanitizeRx'), "");};
- if ((segments = author_entry.$split(nil, 3)).$size()['$=='](3)) {
- segments['$<<'](segments.$pop().$squeeze(" "))};
- } else if ($truthy((match = $$($nesting, 'AuthorInfoLineRx').$match(author_entry)))) {
- (segments = match.$to_a()).$shift()};
- if ($truthy(segments)) {
-
- author = (($writer = [key_map['$[]']("firstname"), (fname = segments['$[]'](0).$tr("_", " "))]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]);
-
- $writer = [key_map['$[]']("authorinitials"), fname.$chr()];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(segments['$[]'](1))) {
- if ($truthy(segments['$[]'](2))) {
-
-
- $writer = [key_map['$[]']("middlename"), (mname = segments['$[]'](1).$tr("_", " "))];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](2).$tr("_", " "))];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- author = $rb_plus($rb_plus($rb_plus($rb_plus(fname, " "), mname), " "), lname);
-
- $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (mname.$chr()) + (lname.$chr())];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
-
-
- $writer = [key_map['$[]']("lastname"), (lname = segments['$[]'](1).$tr("_", " "))];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- author = $rb_plus($rb_plus(fname, " "), lname);
-
- $writer = [key_map['$[]']("authorinitials"), "" + (fname.$chr()) + (lname.$chr())];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- }};
- ($truthy($b = author_metadata['$[]'](key_map['$[]']("author"))) ? $b : (($writer = [key_map['$[]']("author"), author]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- if ($truthy(($truthy($b = names_only) ? $b : segments['$[]'](3)['$!']()))) {
- } else {
-
- $writer = [key_map['$[]']("email"), segments['$[]'](3)];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- } else {
-
-
- $writer = [key_map['$[]']("author"), (($writer = [key_map['$[]']("firstname"), (fname = author_entry.$squeeze(" ").$strip())]), $send(author_metadata, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = [key_map['$[]']("authorinitials"), fname.$chr()];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- };
- if (author_idx['$=='](1)) {
-
- $writer = ["authors", author_metadata['$[]'](key_map['$[]']("author"))];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- if (author_idx['$=='](2)) {
- $send($$($nesting, 'AuthorKeys'), 'each', [], ($$50 = function(key){var self = $$50.$$s || this;
-
-
-
- if (key == null) {
- key = nil;
- };
- if ($truthy(author_metadata['$key?'](key))) {
-
- $writer = ["" + (key) + "_1", author_metadata['$[]'](key)];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- } else {
- return nil
- };}, $$50.$$s = self, $$50.$$arity = 1, $$50))};
-
- $writer = ["authors", "" + (author_metadata['$[]']("authors")) + ", " + (author_metadata['$[]'](key_map['$[]']("author")))];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- };}, $$47.$$s = self, $$47.$$arity = 1, $$47));
-
- $writer = ["authorcount", author_idx];
- $send(author_metadata, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return author_metadata;
- }, $Parser_process_authors$46.$$arity = -2);
- Opal.defs(self, '$parse_block_metadata_lines', $Parser_parse_block_metadata_lines$51 = function $$parse_block_metadata_lines(reader, document, attributes, options) {
- var $a, $b, self = this;
-
-
-
- if (attributes == null) {
- attributes = $hash2([], {});
- };
-
- if (options == null) {
- options = $hash2([], {});
- };
- while ($truthy(self.$parse_block_metadata_line(reader, document, attributes, options))) {
-
- reader.$shift();
- if ($truthy($b = reader.$skip_blank_lines())) {
- $b
- } else {
- break;
- };
- };
- return attributes;
- }, $Parser_parse_block_metadata_lines$51.$$arity = -3);
- Opal.defs(self, '$parse_block_metadata_line', $Parser_parse_block_metadata_line$52 = function $$parse_block_metadata_line(reader, document, attributes, options) {
- var $a, $b, self = this, next_line = nil, normal = nil, $writer = nil, reftext = nil, current_style = nil, ll = nil;
- if ($gvars["~"] == null) $gvars["~"] = nil;
-
-
-
- if (options == null) {
- options = $hash2([], {});
- };
- if ($truthy(($truthy($a = (next_line = reader.$peek_line())) ? (function() {if ($truthy(options['$[]']("text_only"))) {
-
- return next_line['$start_with?']("[", "/");
- } else {
-
- return (normal = next_line['$start_with?']("[", ".", "/", ":"));
- }; return nil; })() : $a))) {
- if ($truthy(next_line['$start_with?']("["))) {
- if ($truthy(next_line['$start_with?']("[["))) {
- if ($truthy(($truthy($a = next_line['$end_with?']("]]")) ? $$($nesting, 'BlockAnchorRx')['$=~'](next_line) : $a))) {
-
-
- $writer = ["id", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy((reftext = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2))))) {
-
- $writer = ["reftext", (function() {if ($truthy(reftext['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
-
- return document.$sub_attributes(reftext);
- } else {
- return reftext
- }; return nil; })()];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return true;
- } else {
- return nil
- }
- } else if ($truthy(($truthy($a = next_line['$end_with?']("]")) ? $$($nesting, 'BlockAttributeListRx')['$=~'](next_line) : $a))) {
-
- current_style = attributes['$[]'](1);
- if ($truthy(document.$parse_attributes((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), [], $hash2(["sub_input", "sub_result", "into"], {"sub_input": true, "sub_result": true, "into": attributes}))['$[]'](1))) {
-
- $writer = [1, ($truthy($a = self.$parse_style_attribute(attributes, reader)) ? $a : current_style)];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return true;
- } else {
- return nil
- }
- } else if ($truthy(($truthy($a = normal) ? next_line['$start_with?'](".") : $a))) {
- if ($truthy($$($nesting, 'BlockTitleRx')['$=~'](next_line))) {
-
-
- $writer = ["title", (($a = $gvars['~']) === nil ? nil : $a['$[]'](1))];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return true;
- } else {
- return nil
- }
- } else if ($truthy(($truthy($a = normal['$!']()) ? $a : next_line['$start_with?']("/")))) {
- if ($truthy(next_line['$start_with?']("//"))) {
- if (next_line['$==']("//")) {
- return true
- } else if ($truthy(($truthy($a = normal) ? self['$uniform?'](next_line, "/", (ll = next_line.$length())) : $a))) {
- if (ll['$=='](3)) {
- return nil
- } else {
-
- reader.$read_lines_until($hash2(["terminator", "skip_first_line", "preserve_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "preserve_last_line": true, "skip_processing": true, "context": "comment"}));
- return true;
- }
- } else if ($truthy(next_line['$start_with?']("///"))) {
- return nil
- } else {
- return true
- }
- } else {
- return nil
- }
- } else if ($truthy(($truthy($a = ($truthy($b = normal) ? next_line['$start_with?'](":") : $b)) ? $$($nesting, 'AttributeEntryRx')['$=~'](next_line) : $a))) {
-
- self.$process_attribute_entry(reader, document, attributes, $gvars["~"]);
- return true;
- } else {
- return nil
- }
- } else {
- return nil
- };
- }, $Parser_parse_block_metadata_line$52.$$arity = -4);
- Opal.defs(self, '$process_attribute_entries', $Parser_process_attribute_entries$53 = function $$process_attribute_entries(reader, document, attributes) {
- var $a, self = this;
-
-
-
- if (attributes == null) {
- attributes = nil;
- };
- reader.$skip_comment_lines();
- while ($truthy(self.$process_attribute_entry(reader, document, attributes))) {
-
- reader.$shift();
- reader.$skip_comment_lines();
- };
- }, $Parser_process_attribute_entries$53.$$arity = -3);
- Opal.defs(self, '$process_attribute_entry', $Parser_process_attribute_entry$54 = function $$process_attribute_entry(reader, document, attributes, match) {
- var $a, $b, $c, self = this, value = nil, con = nil, next_line = nil, keep_open = nil;
-
-
-
- if (attributes == null) {
- attributes = nil;
- };
-
- if (match == null) {
- match = nil;
- };
- if ($truthy(($truthy($a = match) ? $a : (match = (function() {if ($truthy(reader['$has_more_lines?']())) {
-
- return $$($nesting, 'AttributeEntryRx').$match(reader.$peek_line());
- } else {
- return nil
- }; return nil; })())))) {
-
- if ($truthy((value = match['$[]'](2))['$nil_or_empty?']())) {
- value = ""
- } else if ($truthy(value['$end_with?']($$($nesting, 'LINE_CONTINUATION'), $$($nesting, 'LINE_CONTINUATION_LEGACY')))) {
-
- $a = [value.$slice($rb_minus(value.$length(), 2), 2), value.$slice(0, $rb_minus(value.$length(), 2)).$rstrip()], (con = $a[0]), (value = $a[1]), $a;
- while ($truthy(($truthy($b = reader.$advance()) ? (next_line = ($truthy($c = reader.$peek_line()) ? $c : ""))['$empty?']()['$!']() : $b))) {
-
- next_line = next_line.$lstrip();
- if ($truthy((keep_open = next_line['$end_with?'](con)))) {
- next_line = next_line.$slice(0, $rb_minus(next_line.$length(), 2)).$rstrip()};
- value = "" + (value) + ((function() {if ($truthy(value['$end_with?']($$($nesting, 'HARD_LINE_BREAK')))) {
- return $$($nesting, 'LF')
- } else {
- return " "
- }; return nil; })()) + (next_line);
- if ($truthy(keep_open)) {
- } else {
- break;
- };
- };};
- self.$store_attribute(match['$[]'](1), value, document, attributes);
- return true;
- } else {
- return nil
- };
- }, $Parser_process_attribute_entry$54.$$arity = -3);
- Opal.defs(self, '$store_attribute', $Parser_store_attribute$55 = function $$store_attribute(name, value, doc, attrs) {
- var $a, self = this, resolved_value = nil;
-
-
-
- if (doc == null) {
- doc = nil;
- };
-
- if (attrs == null) {
- attrs = nil;
- };
- if ($truthy(name['$end_with?']("!"))) {
-
- name = name.$chop();
- value = nil;
- } else if ($truthy(name['$start_with?']("!"))) {
-
- name = name.$slice(1, name.$length());
- value = nil;};
- if ((name = self.$sanitize_attribute_name(name))['$==']("numbered")) {
- name = "sectnums"
- } else if (name['$==']("hardbreaks")) {
- name = "hardbreaks-option"
- } else if (name['$==']("showtitle")) {
- self.$store_attribute("notitle", (function() {if ($truthy(value)) {
- return nil
- } else {
- return ""
- }; return nil; })(), doc, attrs)};
- if ($truthy(doc)) {
- if ($truthy(value)) {
-
- if (name['$==']("leveloffset")) {
- if ($truthy(value['$start_with?']("+"))) {
- value = $rb_plus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s()
- } else if ($truthy(value['$start_with?']("-"))) {
- value = $rb_minus(doc.$attr("leveloffset", 0).$to_i(), value.$slice(1, value.$length()).$to_i()).$to_s()}};
- if ($truthy((resolved_value = doc.$set_attribute(name, value)))) {
-
- value = resolved_value;
- if ($truthy(attrs)) {
- $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)};};
- } else if ($truthy(($truthy($a = doc.$delete_attribute(name)) ? attrs : $a))) {
- $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)}
- } else if ($truthy(attrs)) {
- $$$($$($nesting, 'Document'), 'AttributeEntry').$new(name, value).$save_to(attrs)};
- return [name, value];
- }, $Parser_store_attribute$55.$$arity = -3);
- Opal.defs(self, '$resolve_list_marker', $Parser_resolve_list_marker$56 = function $$resolve_list_marker(list_type, marker, ordinal, validate, reader) {
- var self = this;
-
-
-
- if (ordinal == null) {
- ordinal = 0;
- };
-
- if (validate == null) {
- validate = false;
- };
-
- if (reader == null) {
- reader = nil;
- };
- if (list_type['$==']("ulist")) {
- return marker
- } else if (list_type['$==']("olist")) {
- return self.$resolve_ordered_list_marker(marker, ordinal, validate, reader)['$[]'](0)
- } else {
- return "<1>"
- };
- }, $Parser_resolve_list_marker$56.$$arity = -3);
- Opal.defs(self, '$resolve_ordered_list_marker', $Parser_resolve_ordered_list_marker$57 = function $$resolve_ordered_list_marker(marker, ordinal, validate, reader) {
- var $$58, $a, self = this, $case = nil, style = nil, expected = nil, actual = nil;
-
-
-
- if (ordinal == null) {
- ordinal = 0;
- };
-
- if (validate == null) {
- validate = false;
- };
-
- if (reader == null) {
- reader = nil;
- };
- if ($truthy(marker['$start_with?']("."))) {
- return [marker]};
- $case = (style = $send($$($nesting, 'ORDERED_LIST_STYLES'), 'find', [], ($$58 = function(s){var self = $$58.$$s || this;
-
-
-
- if (s == null) {
- s = nil;
- };
- return $$($nesting, 'OrderedListMarkerRxMap')['$[]'](s)['$match?'](marker);}, $$58.$$s = self, $$58.$$arity = 1, $$58)));
- if ("arabic"['$===']($case)) {
- if ($truthy(validate)) {
-
- expected = $rb_plus(ordinal, 1);
- actual = marker.$to_i();};
- marker = "1.";}
- else if ("loweralpha"['$===']($case)) {
- if ($truthy(validate)) {
-
- expected = $rb_plus("a"['$[]'](0).$ord(), ordinal).$chr();
- actual = marker.$chop();};
- marker = "a.";}
- else if ("upperalpha"['$===']($case)) {
- if ($truthy(validate)) {
-
- expected = $rb_plus("A"['$[]'](0).$ord(), ordinal).$chr();
- actual = marker.$chop();};
- marker = "A.";}
- else if ("lowerroman"['$===']($case)) {
- if ($truthy(validate)) {
-
- expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1)).$downcase();
- actual = marker.$chop();};
- marker = "i)";}
- else if ("upperroman"['$===']($case)) {
- if ($truthy(validate)) {
-
- expected = $$($nesting, 'Helpers').$int_to_roman($rb_plus(ordinal, 1));
- actual = marker.$chop();};
- marker = "I)";};
- if ($truthy(($truthy($a = validate) ? expected['$!='](actual) : $a))) {
- self.$logger().$warn(self.$message_with_context("" + "list item index: expected " + (expected) + ", got " + (actual), $hash2(["source_location"], {"source_location": reader.$cursor()})))};
- return [marker, style];
- }, $Parser_resolve_ordered_list_marker$57.$$arity = -2);
- Opal.defs(self, '$is_sibling_list_item?', $Parser_is_sibling_list_item$ques$59 = function(line, list_type, sibling_trait) {
- var $a, $b, self = this;
-
- if ($truthy($$$('::', 'Regexp')['$==='](sibling_trait))) {
- return sibling_trait['$match?'](line)
- } else {
- return ($truthy($a = $$($nesting, 'ListRxMap')['$[]'](list_type)['$=~'](line)) ? sibling_trait['$=='](self.$resolve_list_marker(list_type, (($b = $gvars['~']) === nil ? nil : $b['$[]'](1)))) : $a)
- }
- }, $Parser_is_sibling_list_item$ques$59.$$arity = 3);
- Opal.defs(self, '$parse_table', $Parser_parse_table$60 = function $$parse_table(table_reader, parent, attributes) {
- var $a, $b, $c, $d, self = this, table = nil, colspecs = nil, explicit_colspecs = nil, skipped = nil, $writer = nil, implicit_header = nil, parser_ctx = nil, format = nil, loop_idx = nil, implicit_header_boundary = nil, line = nil, beyond_first = nil, next_cellspec = nil, m = nil, pre_match = nil, post_match = nil, $case = nil, cell_text = nil, $logical_op_recvr_tmp_2 = nil;
-
-
- table = $$($nesting, 'Table').$new(parent, attributes);
- if ($truthy(($truthy($a = attributes['$key?']("cols")) ? (colspecs = self.$parse_colspecs(attributes['$[]']("cols")))['$empty?']()['$!']() : $a))) {
-
- table.$create_columns(colspecs);
- explicit_colspecs = true;};
- skipped = ($truthy($a = table_reader.$skip_blank_lines()) ? $a : 0);
- if ($truthy(attributes['$[]']("header-option"))) {
-
- $writer = [true];
- $send(table, 'has_header_option=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else if ($truthy((($a = skipped['$=='](0)) ? attributes['$[]']("noheader-option")['$!']() : skipped['$=='](0)))) {
-
-
- $writer = ["implicit"];
- $send(table, 'has_header_option=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- implicit_header = true;};
- parser_ctx = $$$($$($nesting, 'Table'), 'ParserContext').$new(table_reader, table, attributes);
- $a = [parser_ctx.$format(), -1, nil], (format = $a[0]), (loop_idx = $a[1]), (implicit_header_boundary = $a[2]), $a;
- $a = false; while ($a || $truthy((line = table_reader.$read_line()))) {$a = false;
-
- if ($truthy(($truthy($b = (beyond_first = $rb_gt((loop_idx = $rb_plus(loop_idx, 1)), 0))) ? line['$empty?']() : $b))) {
-
- line = nil;
- if ($truthy(implicit_header_boundary)) {
- implicit_header_boundary = $rb_plus(implicit_header_boundary, 1)};
- } else if (format['$==']("psv")) {
- if ($truthy(parser_ctx['$starts_with_delimiter?'](line))) {
-
- line = line.$slice(1, line.$length());
- parser_ctx.$close_open_cell();
- if ($truthy(implicit_header_boundary)) {
- implicit_header_boundary = nil};
- } else {
-
- $c = self.$parse_cellspec(line, "start", parser_ctx.$delimiter()), $b = Opal.to_ary($c), (next_cellspec = ($b[0] == null ? nil : $b[0])), (line = ($b[1] == null ? nil : $b[1])), $c;
- if ($truthy(next_cellspec)) {
-
- parser_ctx.$close_open_cell(next_cellspec);
- if ($truthy(implicit_header_boundary)) {
- implicit_header_boundary = nil};
- } else if ($truthy(($truthy($b = implicit_header_boundary) ? implicit_header_boundary['$=='](loop_idx) : $b))) {
-
- $writer = [(implicit_header = (implicit_header_boundary = nil))];
- $send(table, 'has_header_option=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- }};
- if ($truthy(beyond_first)) {
- } else {
-
- table_reader.$mark();
- if ($truthy(implicit_header)) {
- if ($truthy(($truthy($b = table_reader['$has_more_lines?']()) ? table_reader.$peek_line()['$empty?']() : $b))) {
- implicit_header_boundary = 1
- } else {
-
- $writer = [(implicit_header = nil)];
- $send(table, 'has_header_option=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }};
- };
- $b = false; while ($b || $truthy(true)) {$b = false;
- if ($truthy(($truthy($c = line) ? (m = parser_ctx.$match_delimiter(line)) : $c))) {
-
- $c = [m.$pre_match(), m.$post_match()], (pre_match = $c[0]), (post_match = $c[1]), $c;
- $case = format;
- if ("csv"['$===']($case)) {
- if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?'](pre_match))) {
-
- parser_ctx.$skip_past_delimiter(pre_match);
- if ($truthy((line = post_match)['$empty?']())) {
- break;};
- $b = true; continue;;};
-
- $writer = ["" + (parser_ctx.$buffer()) + (pre_match)];
- $send(parser_ctx, 'buffer=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;}
- else if ("dsv"['$===']($case)) {
- if ($truthy(pre_match['$end_with?']("\\"))) {
-
- parser_ctx.$skip_past_escaped_delimiter(pre_match);
- if ($truthy((line = post_match)['$empty?']())) {
-
-
- $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))];
- $send(parser_ctx, 'buffer=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- parser_ctx.$keep_cell_open();
- break;;};
- $b = true; continue;;};
-
- $writer = ["" + (parser_ctx.$buffer()) + (pre_match)];
- $send(parser_ctx, 'buffer=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;}
- else {
- if ($truthy(pre_match['$end_with?']("\\"))) {
-
- parser_ctx.$skip_past_escaped_delimiter(pre_match);
- if ($truthy((line = post_match)['$empty?']())) {
-
-
- $writer = ["" + (parser_ctx.$buffer()) + ($$($nesting, 'LF'))];
- $send(parser_ctx, 'buffer=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- parser_ctx.$keep_cell_open();
- break;;};
- $b = true; continue;;};
- $d = self.$parse_cellspec(pre_match), $c = Opal.to_ary($d), (next_cellspec = ($c[0] == null ? nil : $c[0])), (cell_text = ($c[1] == null ? nil : $c[1])), $d;
- parser_ctx.$push_cellspec(next_cellspec);
-
- $writer = ["" + (parser_ctx.$buffer()) + (cell_text)];
- $send(parser_ctx, 'buffer=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;};
- if ($truthy((line = post_match)['$empty?']())) {
- line = nil};
- parser_ctx.$close_cell();
- } else {
-
-
- $writer = ["" + (parser_ctx.$buffer()) + (line) + ($$($nesting, 'LF'))];
- $send(parser_ctx, 'buffer=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- $case = format;
- if ("csv"['$===']($case)) {if ($truthy(parser_ctx['$buffer_has_unclosed_quotes?']())) {
-
- if ($truthy(($truthy($c = implicit_header_boundary) ? loop_idx['$=='](0) : $c))) {
-
- $writer = [(implicit_header = (implicit_header_boundary = nil))];
- $send(table, 'has_header_option=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- parser_ctx.$keep_cell_open();
- } else {
- parser_ctx.$close_cell(true)
- }}
- else if ("dsv"['$===']($case)) {parser_ctx.$close_cell(true)}
- else {parser_ctx.$keep_cell_open()};
- break;;
- }
- };
- if ($truthy(parser_ctx['$cell_open?']())) {
- if ($truthy(table_reader['$has_more_lines?']())) {
- } else {
- parser_ctx.$close_cell(true)
- }
- } else {
- if ($truthy($b = table_reader.$skip_blank_lines())) {
- $b
- } else {
- break;
- }
- };
- };
- if ($truthy(($truthy($a = (($logical_op_recvr_tmp_2 = table.$attributes()), ($truthy($b = $logical_op_recvr_tmp_2['$[]']("colcount")) ? $b : (($writer = ["colcount", table.$columns().$size()]), $send($logical_op_recvr_tmp_2, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])))['$=='](0)) ? $a : explicit_colspecs))) {
- } else {
- table.$assign_column_widths()
- };
- if ($truthy(implicit_header)) {
-
- $writer = [true];
- $send(table, 'has_header_option=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- table.$partition_header_footer(attributes);
- return table;
- }, $Parser_parse_table$60.$$arity = 3);
- Opal.defs(self, '$parse_colspecs', $Parser_parse_colspecs$61 = function $$parse_colspecs(records) {
- var $$62, $$63, self = this, specs = nil;
-
-
- if ($truthy(records['$include?'](" "))) {
- records = records.$delete(" ")};
- if (records['$=='](records.$to_i().$to_s())) {
- return $send($$$('::', 'Array'), 'new', [records.$to_i()], ($$62 = function(){var self = $$62.$$s || this;
-
- return $hash2(["width"], {"width": 1})}, $$62.$$s = self, $$62.$$arity = 0, $$62))};
- specs = [];
- $send((function() {if ($truthy(records['$include?'](","))) {
-
- return records.$split(",", -1);
- } else {
-
- return records.$split(";", -1);
- }; return nil; })(), 'each', [], ($$63 = function(record){var self = $$63.$$s || this, $a, $b, $$64, m = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil, width = nil;
-
-
-
- if (record == null) {
- record = nil;
- };
- if ($truthy(record['$empty?']())) {
- return specs['$<<']($hash2(["width"], {"width": 1}))
- } else if ($truthy((m = $$($nesting, 'ColumnSpecRx').$match(record)))) {
-
- spec = $hash2([], {});
- if ($truthy(m['$[]'](2))) {
-
- $b = m['$[]'](2).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) {
-
- $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) {
-
- $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};};
- if ($truthy((width = m['$[]'](3)))) {
-
- $writer = ["width", (function() {if (width['$==']("~")) {
- return -1
- } else {
- return width.$to_i()
- }; return nil; })()];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = ["width", 1];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) {
-
- $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(m['$[]'](1))) {
- return $send((1), 'upto', [m['$[]'](1).$to_i()], ($$64 = function(){var self = $$64.$$s || this;
-
- return specs['$<<'](spec.$merge())}, $$64.$$s = self, $$64.$$arity = 0, $$64))
- } else {
- return specs['$<<'](spec)
- };
- } else {
- return nil
- };}, $$63.$$s = self, $$63.$$arity = 1, $$63));
- return specs;
- }, $Parser_parse_colspecs$61.$$arity = 1);
- Opal.defs(self, '$parse_cellspec', $Parser_parse_cellspec$65 = function $$parse_cellspec(line, pos, delimiter) {
- var $a, $b, self = this, m = nil, rest = nil, spec_part = nil, spec = nil, colspec = nil, rowspec = nil, $writer = nil;
-
-
-
- if (pos == null) {
- pos = "end";
- };
-
- if (delimiter == null) {
- delimiter = nil;
- };
- $a = [nil, ""], (m = $a[0]), (rest = $a[1]), $a;
- if (pos['$==']("start")) {
- if ($truthy(line['$include?'](delimiter))) {
-
- $b = line.$partition(delimiter), $a = Opal.to_ary($b), (spec_part = ($a[0] == null ? nil : $a[0])), (delimiter = ($a[1] == null ? nil : $a[1])), (rest = ($a[2] == null ? nil : $a[2])), $b;
- if ($truthy((m = $$($nesting, 'CellSpecStartRx').$match(spec_part)))) {
- if ($truthy(m['$[]'](0)['$empty?']())) {
- return [$hash2([], {}), rest]}
- } else {
- return [nil, line]
- };
- } else {
- return [nil, line]
- }
- } else if ($truthy((m = $$($nesting, 'CellSpecEndRx').$match(line)))) {
-
- if ($truthy(m['$[]'](0).$lstrip()['$empty?']())) {
- return [$hash2([], {}), line.$rstrip()]};
- rest = m.$pre_match();
- } else {
- return [$hash2([], {}), line]
- };
- spec = $hash2([], {});
- if ($truthy(m['$[]'](1))) {
-
- $b = m['$[]'](1).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b;
- colspec = (function() {if ($truthy(colspec['$nil_or_empty?']())) {
- return 1
- } else {
- return colspec.$to_i()
- }; return nil; })();
- rowspec = (function() {if ($truthy(rowspec['$nil_or_empty?']())) {
- return 1
- } else {
- return rowspec.$to_i()
- }; return nil; })();
- if (m['$[]'](2)['$==']("+")) {
-
- if (colspec['$=='](1)) {
- } else {
-
- $writer = ["colspan", colspec];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- if (rowspec['$=='](1)) {
- } else {
-
- $writer = ["rowspan", rowspec];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- } else if (m['$[]'](2)['$==']("*")) {
- if (colspec['$=='](1)) {
- } else {
-
- $writer = ["repeatcol", colspec];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }};};
- if ($truthy(m['$[]'](3))) {
-
- $b = m['$[]'](3).$split("."), $a = Opal.to_ary($b), (colspec = ($a[0] == null ? nil : $a[0])), (rowspec = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy(($truthy($a = colspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellHorzAlignments')['$key?'](colspec) : $a))) {
-
- $writer = ["halign", $$($nesting, 'TableCellHorzAlignments')['$[]'](colspec)];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(($truthy($a = rowspec['$nil_or_empty?']()['$!']()) ? $$($nesting, 'TableCellVertAlignments')['$key?'](rowspec) : $a))) {
-
- $writer = ["valign", $$($nesting, 'TableCellVertAlignments')['$[]'](rowspec)];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};};
- if ($truthy(($truthy($a = m['$[]'](4)) ? $$($nesting, 'TableCellStyles')['$key?'](m['$[]'](4)) : $a))) {
-
- $writer = ["style", $$($nesting, 'TableCellStyles')['$[]'](m['$[]'](4))];
- $send(spec, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return [spec, rest];
- }, $Parser_parse_cellspec$65.$$arity = -2);
- Opal.defs(self, '$parse_style_attribute', $Parser_parse_style_attribute$66 = function $$parse_style_attribute(attributes, reader) {
- var $a, $b, $$67, $$68, self = this, raw_style = nil, name = nil, accum = nil, parsed_attrs = nil, parsed_style = nil, $writer = nil, existing_role = nil;
-
-
-
- if (reader == null) {
- reader = nil;
- };
- if ($truthy(($truthy($a = ($truthy($b = (raw_style = attributes['$[]'](1))) ? raw_style['$include?'](" ")['$!']() : $b)) ? $$($nesting, 'Compliance').$shorthand_property_syntax() : $a))) {
-
- name = nil;
- accum = "";
- parsed_attrs = $hash2([], {});
- $send(raw_style, 'each_char', [], ($$67 = function(c){var self = $$67.$$s || this, $case = nil;
-
-
-
- if (c == null) {
- c = nil;
- };
- return (function() {$case = c;
- if ("."['$===']($case)) {
- self.$yield_buffered_attribute(parsed_attrs, name, accum, reader);
- accum = "";
- return (name = "role");}
- else if ("#"['$===']($case)) {
- self.$yield_buffered_attribute(parsed_attrs, name, accum, reader);
- accum = "";
- return (name = "id");}
- else if ("%"['$===']($case)) {
- self.$yield_buffered_attribute(parsed_attrs, name, accum, reader);
- accum = "";
- return (name = "option");}
- else {return (accum = $rb_plus(accum, c))}})();}, $$67.$$s = self, $$67.$$arity = 1, $$67));
- if ($truthy(name)) {
-
- self.$yield_buffered_attribute(parsed_attrs, name, accum, reader);
- if ($truthy((parsed_style = parsed_attrs['$[]']("style")))) {
-
- $writer = ["style", parsed_style];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(parsed_attrs['$key?']("id"))) {
-
- $writer = ["id", parsed_attrs['$[]']("id")];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(parsed_attrs['$key?']("role"))) {
-
- $writer = ["role", (function() {if ($truthy((existing_role = attributes['$[]']("role"))['$nil_or_empty?']())) {
-
- return parsed_attrs['$[]']("role").$join(" ");
- } else {
- return "" + (existing_role) + " " + (parsed_attrs['$[]']("role").$join(" "))
- }; return nil; })()];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(parsed_attrs['$key?']("option"))) {
- $send(parsed_attrs['$[]']("option"), 'each', [], ($$68 = function(opt){var self = $$68.$$s || this;
-
-
-
- if (opt == null) {
- opt = nil;
- };
- $writer = ["" + (opt) + "-option", ""];
- $send(attributes, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$68.$$s = self, $$68.$$arity = 1, $$68))};
- return parsed_style;
- } else {
-
- $writer = ["style", raw_style];
- $send(attributes, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };
- } else {
-
- $writer = ["style", raw_style];
- $send(attributes, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };
- }, $Parser_parse_style_attribute$66.$$arity = -2);
- Opal.defs(self, '$yield_buffered_attribute', $Parser_yield_buffered_attribute$69 = function $$yield_buffered_attribute(attrs, name, value, reader) {
- var $a, self = this, $writer = nil;
-
-
- if ($truthy(name)) {
- if ($truthy(value['$empty?']())) {
- if ($truthy(reader)) {
- self.$logger().$warn(self.$message_with_context("" + "invalid empty " + (name) + " detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()})))
- } else {
- self.$logger().$warn("" + "invalid empty " + (name) + " detected in style attribute")
- }
- } else if (name['$==']("id")) {
-
- if ($truthy(attrs['$key?']("id"))) {
- if ($truthy(reader)) {
- self.$logger().$warn(self.$message_with_context("multiple ids detected in style attribute", $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()})))
- } else {
- self.$logger().$warn("multiple ids detected in style attribute")
- }};
-
- $writer = [name, value];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
- ($truthy($a = attrs['$[]'](name)) ? $a : (($writer = [name, []]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))['$<<'](value)
- }
- } else if ($truthy(value['$empty?']())) {
- } else {
-
- $writer = ["style", value];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- return nil;
- }, $Parser_yield_buffered_attribute$69.$$arity = 4);
- Opal.defs(self, '$adjust_indentation!', $Parser_adjust_indentation$excl$70 = function(lines, indent_size, tab_size) {
- var $a, $$71, $$72, $$75, $$76, $$77, $$78, self = this, full_tab_space = nil, block_indent = nil, new_block_indent = nil;
-
-
-
- if (indent_size == null) {
- indent_size = 0;
- };
-
- if (tab_size == null) {
- tab_size = 0;
- };
- if ($truthy(lines['$empty?']())) {
- return nil};
- if ($truthy(($truthy($a = $rb_gt(tab_size, 0)) ? $send(lines, 'any?', [], ($$71 = function(line){var self = $$71.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- return line['$include?']($$($nesting, 'TAB'));}, $$71.$$s = self, $$71.$$arity = 1, $$71)) : $a))) {
-
- full_tab_space = $rb_times(" ", tab_size);
- (function(){var $brk = Opal.new_brk(); try {return $send(lines, 'map!', [], ($$72 = function(line){var self = $$72.$$s || this, $$73, $$74, tab_idx = nil, leading_tabs = nil, spaces_added = nil, idx = nil, result = nil;
-
-
-
- if (line == null) {
- line = nil;
- };
- if ($truthy(line['$empty?']())) {
- return line
- } else if ($truthy((tab_idx = line.$index($$($nesting, 'TAB'))))) {
-
- if (tab_idx['$=='](0)) {
-
- leading_tabs = 0;
- (function(){var $brk = Opal.new_brk(); try {return $send(line, 'each_byte', [], ($$73 = function(b){var self = $$73.$$s || this;
-
-
-
- if (b == null) {
- b = nil;
- };
- if (b['$=='](9)) {
- } else {
-
- Opal.brk(nil, $brk)
- };
- return (leading_tabs = $rb_plus(leading_tabs, 1));}, $$73.$$s = self, $$73.$$brk = $brk, $$73.$$arity = 1, $$73))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();
- line = "" + ($rb_times(full_tab_space, leading_tabs)) + (line.$slice(leading_tabs, line.$length()));
- if ($truthy(line['$include?']($$($nesting, 'TAB')))) {
- } else {
- return line;
- };};
- spaces_added = 0;
- idx = 0;
- result = "";
- $send(line, 'each_char', [], ($$74 = function(c){var self = $$74.$$s || this, offset = nil, spaces = nil;
-
-
-
- if (c == null) {
- c = nil;
- };
- if (c['$==']($$($nesting, 'TAB'))) {
- if ((offset = $rb_plus(idx, spaces_added))['$%'](tab_size)['$=='](0)) {
-
- spaces_added = $rb_plus(spaces_added, $rb_minus(tab_size, 1));
- result = $rb_plus(result, full_tab_space);
- } else {
-
- if ((spaces = $rb_minus(tab_size, offset['$%'](tab_size)))['$=='](1)) {
- } else {
- spaces_added = $rb_plus(spaces_added, $rb_minus(spaces, 1))
- };
- result = $rb_plus(result, $rb_times(" ", spaces));
- }
- } else {
- result = $rb_plus(result, c)
- };
- return (idx = $rb_plus(idx, 1));}, $$74.$$s = self, $$74.$$arity = 1, $$74));
- return result;
- } else {
- return line
- };}, $$72.$$s = self, $$72.$$brk = $brk, $$72.$$arity = 1, $$72))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();};
- if ($truthy($rb_lt(indent_size, 0))) {
- return nil};
- block_indent = nil;
- (function(){var $brk = Opal.new_brk(); try {return $send(lines, 'each', [], ($$75 = function(line){var self = $$75.$$s || this, $b, line_indent = nil;
-
-
-
- if (line == null) {
- line = nil;
- };
- if ($truthy(line['$empty?']())) {
- return nil;};
- if ((line_indent = $rb_minus(line.$length(), line.$lstrip().$length()))['$=='](0)) {
-
- block_indent = nil;
-
- Opal.brk(nil, $brk);};
- if ($truthy(($truthy($b = block_indent) ? $rb_lt(block_indent, line_indent) : $b))) {
- return nil
- } else {
- return (block_indent = line_indent)
- };}, $$75.$$s = self, $$75.$$brk = $brk, $$75.$$arity = 1, $$75))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();
- if (indent_size['$=='](0)) {
- if ($truthy(block_indent)) {
- $send(lines, 'map!', [], ($$76 = function(line){var self = $$76.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- if ($truthy(line['$empty?']())) {
- return line
- } else {
-
- return line.$slice(block_indent, line.$length());
- };}, $$76.$$s = self, $$76.$$arity = 1, $$76))}
- } else {
-
- new_block_indent = $rb_times(" ", indent_size);
- if ($truthy(block_indent)) {
- $send(lines, 'map!', [], ($$77 = function(line){var self = $$77.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- if ($truthy(line['$empty?']())) {
- return line
- } else {
- return $rb_plus(new_block_indent, line.$slice(block_indent, line.$length()))
- };}, $$77.$$s = self, $$77.$$arity = 1, $$77))
- } else {
- $send(lines, 'map!', [], ($$78 = function(line){var self = $$78.$$s || this;
-
-
-
- if (line == null) {
- line = nil;
- };
- if ($truthy(line['$empty?']())) {
- return line
- } else {
- return $rb_plus(new_block_indent, line)
- };}, $$78.$$s = self, $$78.$$arity = 1, $$78))
- };
- };
- return nil;
- }, $Parser_adjust_indentation$excl$70.$$arity = -2);
- Opal.defs(self, '$uniform?', $Parser_uniform$ques$79 = function(str, chr, len) {
- var self = this;
-
- return str.$count(chr)['$=='](len)
- }, $Parser_uniform$ques$79.$$arity = 3);
- return (Opal.defs(self, '$sanitize_attribute_name', $Parser_sanitize_attribute_name$80 = function $$sanitize_attribute_name(name) {
- var self = this;
-
- return name.$gsub($$($nesting, 'InvalidAttributeNameCharsRx'), "").$downcase()
- }, $Parser_sanitize_attribute_name$80.$$arity = 1), nil) && 'sanitize_attribute_name';
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/path_resolver"] = function(Opal) {
- 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_gt(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, $truthy = Opal.truthy, $hash2 = Opal.hash2, $send = Opal.send, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$include', '$attr_accessor', '$root?', '$posixify', '$expand_path', '$pwd', '$start_with?', '$==', '$match?', '$absolute_path?', '$+', '$length', '$descends_from?', '$slice', '$to_s', '$relative_path_from', '$new', '$include?', '$tr', '$partition_path', '$each', '$pop', '$<<', '$join_path', '$[]', '$web_root?', '$unc?', '$index', '$split', '$delete', '$[]=', '$-', '$join', '$raise', '$!', '$fetch', '$warn', '$logger', '$empty?', '$nil_or_empty?', '$chomp', '$!=', '$>', '$size', '$extract_uri_prefix', '$end_with?', '$gsub', '$private', '$=~']);
- 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, 'PathResolver');
-
- var $nesting = [self].concat($parent_nesting), $PathResolver_initialize$1, $PathResolver_absolute_path$ques$2, $a, $PathResolver_root$ques$3, $PathResolver_unc$ques$4, $PathResolver_web_root$ques$5, $PathResolver_descends_from$ques$6, $PathResolver_relative_path$7, $PathResolver_posixify$8, $PathResolver_expand_path$9, $PathResolver_partition_path$11, $PathResolver_join_path$12, $PathResolver_system_path$13, $PathResolver_web_path$16, $PathResolver_extract_uri_prefix$18;
-
- self.$$prototype.file_separator = self.$$prototype._partition_path_web = self.$$prototype._partition_path_sys = self.$$prototype.working_dir = nil;
-
- self.$include($$($nesting, 'Logging'));
- Opal.const_set($nesting[0], 'DOT', ".");
- Opal.const_set($nesting[0], 'DOT_DOT', "..");
- Opal.const_set($nesting[0], 'DOT_SLASH', "./");
- Opal.const_set($nesting[0], 'SLASH', "/");
- Opal.const_set($nesting[0], 'BACKSLASH', "\\");
- Opal.const_set($nesting[0], 'DOUBLE_SLASH', "//");
- Opal.const_set($nesting[0], 'WindowsRootRx', /^(?:[a-zA-Z]:)?[\\\/]/);
- self.$attr_accessor("file_separator");
- self.$attr_accessor("working_dir");
-
- Opal.def(self, '$initialize', $PathResolver_initialize$1 = function $$initialize(file_separator, working_dir) {
- var $a, $b, self = this;
-
-
-
- if (file_separator == null) {
- file_separator = nil;
- };
-
- if (working_dir == null) {
- working_dir = nil;
- };
- self.file_separator = ($truthy($a = ($truthy($b = file_separator) ? $b : $$$($$$('::', 'File'), 'ALT_SEPARATOR'))) ? $a : $$$($$$('::', 'File'), 'SEPARATOR'));
- self.working_dir = (function() {if ($truthy(working_dir)) {
-
- if ($truthy(self['$root?'](working_dir))) {
-
- return self.$posixify(working_dir);
- } else {
-
- return $$$('::', 'File').$expand_path(working_dir);
- };
- } else {
- return $$$('::', 'Dir').$pwd()
- }; return nil; })();
- self._partition_path_sys = $hash2([], {});
- return (self._partition_path_web = $hash2([], {}));
- }, $PathResolver_initialize$1.$$arity = -1);
-
- Opal.def(self, '$absolute_path?', $PathResolver_absolute_path$ques$2 = function(path) {
- var $a, $b, self = this;
-
- return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? $a : (($b = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? $$($nesting, 'WindowsRootRx')['$match?'](path) : self.file_separator['$==']($$($nesting, 'BACKSLASH'))))
- }, $PathResolver_absolute_path$ques$2.$$arity = 1);
- if ($truthy((($a = $$($nesting, 'RUBY_ENGINE')['$==']("opal")) ? $$$('::', 'JAVASCRIPT_IO_MODULE')['$==']("xmlhttprequest") : $$($nesting, 'RUBY_ENGINE')['$==']("opal")))) {
-
- Opal.def(self, '$root?', $PathResolver_root$ques$3 = function(path) {
- var $a, self = this;
-
- return ($truthy($a = self['$absolute_path?'](path)) ? $a : path['$start_with?']("file://", "http://", "https://"))
- }, $PathResolver_root$ques$3.$$arity = 1)
- } else {
- Opal.alias(self, "root?", "absolute_path?")
- };
-
- Opal.def(self, '$unc?', $PathResolver_unc$ques$4 = function(path) {
- var self = this;
-
- return path['$start_with?']($$($nesting, 'DOUBLE_SLASH'))
- }, $PathResolver_unc$ques$4.$$arity = 1);
-
- Opal.def(self, '$web_root?', $PathResolver_web_root$ques$5 = function(path) {
- var self = this;
-
- return path['$start_with?']($$($nesting, 'SLASH'))
- }, $PathResolver_web_root$ques$5.$$arity = 1);
-
- Opal.def(self, '$descends_from?', $PathResolver_descends_from$ques$6 = function(path, base) {
- var $a, self = this;
-
- if (base['$=='](path)) {
- return 0
- } else if (base['$==']($$($nesting, 'SLASH'))) {
- return ($truthy($a = path['$start_with?']($$($nesting, 'SLASH'))) ? 1 : $a)
- } else {
- return ($truthy($a = path['$start_with?']($rb_plus(base, $$($nesting, 'SLASH')))) ? $rb_plus(base.$length(), 1) : $a)
- }
- }, $PathResolver_descends_from$ques$6.$$arity = 2);
-
- Opal.def(self, '$relative_path', $PathResolver_relative_path$7 = function $$relative_path(path, base) {
- var self = this, offset = nil;
-
- if ($truthy(self['$root?'](path))) {
- if ($truthy((offset = self['$descends_from?'](path, base)))) {
- return path.$slice(offset, path.$length())
- } else {
-
- try {
- return $$($nesting, 'Pathname').$new(path).$relative_path_from($$($nesting, 'Pathname').$new(base)).$to_s()
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- return path
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- }
- } else {
- return path
- }
- }, $PathResolver_relative_path$7.$$arity = 2);
-
- Opal.def(self, '$posixify', $PathResolver_posixify$8 = function $$posixify(path) {
- var $a, self = this;
-
- if ($truthy(path)) {
- if ($truthy((($a = self.file_separator['$==']($$($nesting, 'BACKSLASH'))) ? path['$include?']($$($nesting, 'BACKSLASH')) : self.file_separator['$==']($$($nesting, 'BACKSLASH'))))) {
-
- return path.$tr($$($nesting, 'BACKSLASH'), $$($nesting, 'SLASH'));
- } else {
- return path
- }
- } else {
- return ""
- }
- }, $PathResolver_posixify$8.$$arity = 1);
- Opal.alias(self, "posixfy", "posixify");
-
- Opal.def(self, '$expand_path', $PathResolver_expand_path$9 = function $$expand_path(path) {
- var $a, $b, $$10, self = this, path_segments = nil, path_root = nil, resolved_segments = nil;
-
-
- $b = self.$partition_path(path), $a = Opal.to_ary($b), (path_segments = ($a[0] == null ? nil : $a[0])), (path_root = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy(path['$include?']($$($nesting, 'DOT_DOT')))) {
-
- resolved_segments = [];
- $send(path_segments, 'each', [], ($$10 = function(segment){var self = $$10.$$s || this;
-
-
-
- if (segment == null) {
- segment = nil;
- };
- if (segment['$==']($$($nesting, 'DOT_DOT'))) {
- return resolved_segments.$pop()
- } else {
- return resolved_segments['$<<'](segment)
- };}, $$10.$$s = self, $$10.$$arity = 1, $$10));
- return self.$join_path(resolved_segments, path_root);
- } else {
- return self.$join_path(path_segments, path_root)
- };
- }, $PathResolver_expand_path$9.$$arity = 1);
-
- Opal.def(self, '$partition_path', $PathResolver_partition_path$11 = function $$partition_path(path, web) {
- var self = this, result = nil, cache = nil, posix_path = nil, root = nil, path_segments = nil, $writer = nil;
-
-
-
- if (web == null) {
- web = nil;
- };
- if ($truthy((result = (cache = (function() {if ($truthy(web)) {
- return self._partition_path_web
- } else {
- return self._partition_path_sys
- }; return nil; })())['$[]'](path)))) {
- return result};
- posix_path = self.$posixify(path);
- if ($truthy(web)) {
- if ($truthy(self['$web_root?'](posix_path))) {
- root = $$($nesting, 'SLASH')
- } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) {
- root = $$($nesting, 'DOT_SLASH')}
- } else if ($truthy(self['$root?'](posix_path))) {
- if ($truthy(self['$unc?'](posix_path))) {
- root = $$($nesting, 'DOUBLE_SLASH')
- } else if ($truthy(posix_path['$start_with?']($$($nesting, 'SLASH')))) {
- root = $$($nesting, 'SLASH')
- } else {
- root = posix_path.$slice(0, $rb_plus(posix_path.$index($$($nesting, 'SLASH')), 1))
- }
- } else if ($truthy(posix_path['$start_with?']($$($nesting, 'DOT_SLASH')))) {
- root = $$($nesting, 'DOT_SLASH')};
- path_segments = (function() {if ($truthy(root)) {
-
- return posix_path.$slice(root.$length(), posix_path.$length());
- } else {
- return posix_path
- }; return nil; })().$split($$($nesting, 'SLASH'));
- path_segments.$delete($$($nesting, 'DOT'));
-
- $writer = [path, [path_segments, root]];
- $send(cache, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- }, $PathResolver_partition_path$11.$$arity = -2);
-
- Opal.def(self, '$join_path', $PathResolver_join_path$12 = function $$join_path(segments, root) {
- var self = this;
-
-
-
- if (root == null) {
- root = nil;
- };
- if ($truthy(root)) {
- return "" + (root) + (segments.$join($$($nesting, 'SLASH')))
- } else {
-
- return segments.$join($$($nesting, 'SLASH'));
- };
- }, $PathResolver_join_path$12.$$arity = -2);
-
- Opal.def(self, '$system_path', $PathResolver_system_path$13 = function $$system_path(target, start, jail, opts) {
- var $a, $b, $$14, $$15, self = this, target_path = nil, target_segments = nil, jail_segments = nil, jail_root = nil, recheck = nil, start_segments = nil, start_root = nil, resolved_segments = nil, unresolved_segments = nil, warned = nil;
-
-
-
- if (start == null) {
- start = nil;
- };
-
- if (jail == null) {
- jail = nil;
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy(jail)) {
-
- if ($truthy(self['$root?'](jail))) {
- } else {
- self.$raise($$$('::', 'SecurityError'), "" + "Jail is not an absolute path: " + (jail))
- };
- jail = self.$posixify(jail);};
- if ($truthy(target)) {
- if ($truthy(self['$root?'](target))) {
-
- target_path = self.$expand_path(target);
- if ($truthy(($truthy($a = jail) ? self['$descends_from?'](target_path, jail)['$!']() : $a))) {
- if ($truthy(opts.$fetch("recover", true))) {
-
- self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically");
- $b = self.$partition_path(target_path), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), $b;
- $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b;
- return self.$join_path($rb_plus(jail_segments, target_segments), jail_root);
- } else {
- self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)")
- }};
- return target_path;
- } else {
- $b = self.$partition_path(target), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), $b
- }
- } else {
- target_segments = []
- };
- if ($truthy(target_segments['$empty?']())) {
- if ($truthy(start['$nil_or_empty?']())) {
- return ($truthy($a = jail) ? $a : self.working_dir)
- } else if ($truthy(self['$root?'](start))) {
- if ($truthy(jail)) {
- start = self.$posixify(start)
- } else {
- return self.$expand_path(start)
- }
- } else {
-
- $b = self.$partition_path(start), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), $b;
- start = ($truthy($a = jail) ? $a : self.working_dir);
- }
- } else if ($truthy(start['$nil_or_empty?']())) {
- start = ($truthy($a = jail) ? $a : self.working_dir)
- } else if ($truthy(self['$root?'](start))) {
- if ($truthy(jail)) {
- start = self.$posixify(start)}
- } else {
- start = "" + (($truthy($a = jail) ? $a : self.working_dir).$chomp("/")) + "/" + (start)
- };
- if ($truthy(($truthy($a = ($truthy($b = jail) ? (recheck = self['$descends_from?'](start, jail)['$!']()) : $b)) ? self.file_separator['$==']($$($nesting, 'BACKSLASH')) : $a))) {
-
- $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (start_root = ($a[1] == null ? nil : $a[1])), $b;
- $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy(start_root['$!='](jail_root))) {
- if ($truthy(opts.$fetch("recover", true))) {
-
- self.$logger().$warn("" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail root; recovering automatically");
- start_segments = jail_segments;
- recheck = false;
- } else {
- self.$raise($$$('::', 'SecurityError'), "" + "start path for " + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (start) + " refers to location outside jail root: " + (jail) + " (disallowed in safe mode)")
- }};
- } else {
- $b = self.$partition_path(start), $a = Opal.to_ary($b), (start_segments = ($a[0] == null ? nil : $a[0])), (jail_root = ($a[1] == null ? nil : $a[1])), $b
- };
- if ($truthy((resolved_segments = $rb_plus(start_segments, target_segments))['$include?']($$($nesting, 'DOT_DOT')))) {
-
- $a = [resolved_segments, []], (unresolved_segments = $a[0]), (resolved_segments = $a[1]), $a;
- if ($truthy(jail)) {
-
- if ($truthy(jail_segments)) {
- } else {
- $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), $b
- };
- warned = false;
- $send(unresolved_segments, 'each', [], ($$14 = function(segment){var self = $$14.$$s || this, $c;
-
-
-
- if (segment == null) {
- segment = nil;
- };
- if (segment['$==']($$($nesting, 'DOT_DOT'))) {
- if ($truthy($rb_gt(resolved_segments.$size(), jail_segments.$size()))) {
- return resolved_segments.$pop()
- } else if ($truthy(opts.$fetch("recover", true))) {
- if ($truthy(warned)) {
- return nil
- } else {
-
- self.$logger().$warn("" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " has illegal reference to ancestor of jail; recovering automatically");
- return (warned = true);
- }
- } else {
- return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($c = opts['$[]']("target_name")) ? $c : "path")) + " " + (target) + " refers to location outside jail: " + (jail) + " (disallowed in safe mode)")
- }
- } else {
- return resolved_segments['$<<'](segment)
- };}, $$14.$$s = self, $$14.$$arity = 1, $$14));
- } else {
- $send(unresolved_segments, 'each', [], ($$15 = function(segment){var self = $$15.$$s || this;
-
-
-
- if (segment == null) {
- segment = nil;
- };
- if (segment['$==']($$($nesting, 'DOT_DOT'))) {
- return resolved_segments.$pop()
- } else {
- return resolved_segments['$<<'](segment)
- };}, $$15.$$s = self, $$15.$$arity = 1, $$15))
- };};
- if ($truthy(recheck)) {
-
- target_path = self.$join_path(resolved_segments, jail_root);
- if ($truthy(self['$descends_from?'](target_path, jail))) {
- return target_path
- } else if ($truthy(opts.$fetch("recover", true))) {
-
- self.$logger().$warn("" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " is outside of jail; recovering automatically");
- if ($truthy(jail_segments)) {
- } else {
- $b = self.$partition_path(jail), $a = Opal.to_ary($b), (jail_segments = ($a[0] == null ? nil : $a[0])), $b
- };
- return self.$join_path($rb_plus(jail_segments, target_segments), jail_root);
- } else {
- return self.$raise($$$('::', 'SecurityError'), "" + (($truthy($a = opts['$[]']("target_name")) ? $a : "path")) + " " + (target) + " is outside of jail: " + (jail) + " (disallowed in safe mode)")
- };
- } else {
- return self.$join_path(resolved_segments, jail_root)
- };
- }, $PathResolver_system_path$13.$$arity = -2);
-
- Opal.def(self, '$web_path', $PathResolver_web_path$16 = function $$web_path(target, start) {
- var $a, $b, $$17, self = this, uri_prefix = nil, target_segments = nil, target_root = nil, resolved_segments = nil, resolved_path = nil;
-
-
-
- if (start == null) {
- start = nil;
- };
- target = self.$posixify(target);
- start = self.$posixify(start);
- if ($truthy(($truthy($a = start['$nil_or_empty?']()) ? $a : self['$web_root?'](target)))) {
- } else {
- $b = self.$extract_uri_prefix("" + (start) + ((function() {if ($truthy(start['$end_with?']($$($nesting, 'SLASH')))) {
- return ""
- } else {
- return $$($nesting, 'SLASH')
- }; return nil; })()) + (target)), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (uri_prefix = ($a[1] == null ? nil : $a[1])), $b
- };
- $b = self.$partition_path(target, true), $a = Opal.to_ary($b), (target_segments = ($a[0] == null ? nil : $a[0])), (target_root = ($a[1] == null ? nil : $a[1])), $b;
- resolved_segments = [];
- $send(target_segments, 'each', [], ($$17 = function(segment){var self = $$17.$$s || this, $c;
-
-
-
- if (segment == null) {
- segment = nil;
- };
- if (segment['$==']($$($nesting, 'DOT_DOT'))) {
- if ($truthy(resolved_segments['$empty?']())) {
- if ($truthy(($truthy($c = target_root) ? target_root['$!=']($$($nesting, 'DOT_SLASH')) : $c))) {
- return nil
- } else {
- return resolved_segments['$<<'](segment)
- }
- } else if (resolved_segments['$[]'](-1)['$==']($$($nesting, 'DOT_DOT'))) {
- return resolved_segments['$<<'](segment)
- } else {
- return resolved_segments.$pop()
- }
- } else {
- return resolved_segments['$<<'](segment)
- };}, $$17.$$s = self, $$17.$$arity = 1, $$17));
- if ($truthy((resolved_path = self.$join_path(resolved_segments, target_root))['$include?'](" "))) {
- resolved_path = resolved_path.$gsub(" ", "%20")};
- if ($truthy(uri_prefix)) {
- return "" + (uri_prefix) + (resolved_path)
- } else {
- return resolved_path
- };
- }, $PathResolver_web_path$16.$$arity = -2);
- self.$private();
- return (Opal.def(self, '$extract_uri_prefix', $PathResolver_extract_uri_prefix$18 = function $$extract_uri_prefix(str) {
- var $a, self = this;
-
- if ($truthy(($truthy($a = str['$include?'](":")) ? $$($nesting, 'UriSniffRx')['$=~'](str) : $a))) {
- return [str.$slice((($a = $gvars['~']) === nil ? nil : $a['$[]'](0)).$length(), str.$length()), (($a = $gvars['~']) === nil ? nil : $a['$[]'](0))]
- } else {
- return str
- }
- }, $PathResolver_extract_uri_prefix$18.$$arity = 1), nil) && 'extract_uri_prefix';
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/reader"] = function(Opal) {
- function $rb_plus(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_minus(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs - rhs : lhs['$-'](rhs);
- }
- function $rb_times(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);
- }
- function $rb_lt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
- }
- function $rb_divide(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, $hash = Opal.hash;
-
- Opal.add_stubs(['$include', '$attr_reader', '$+', '$attr_accessor', '$!', '$===', '$split', '$file', '$dir', '$dirname', '$path', '$basename', '$lineno', '$prepare_lines', '$drop', '$empty?', '$nil_or_empty?', '$peek_line', '$>', '$slice', '$[]', '$length', '$process_line', '$times', '$shift', '$read_line', '$<<', '$-', '$unshift_all', '$has_more_lines?', '$join', '$read_lines', '$unshift', '$start_with?', '$==', '$*', '$read_lines_until', '$size', '$clear', '$cursor', '$[]=', '$!=', '$fetch', '$cursor_at_mark', '$warn', '$logger', '$message_with_context', '$new', '$tap', '$each', '$instance_variables', '$instance_variable_get', '$instance_variable_set', '$class', '$object_id', '$inspect', '$private', '$prepare_source_array', '$prepare_source_string', '$chomp', '$valid_encoding?', '$to_s', '$raise', '$to_i', '$attributes', '$catalog', '$pop_include', '$parse', '$path=', '$dup', '$end_with?', '$keys', '$rindex', '$rootname', '$key?', '$attr', '$>=', '$nil?', '$extensions?', '$include_processors?', '$extensions', '$include_processors', '$map', '$skip_front_matter!', '$pop', '$adjust_indentation!', '$include?', '$=~', '$preprocess_conditional_directive', '$preprocess_include_directive', '$downcase', '$error', '$none?', '$any?', '$all?', '$strip', '$send', '$resolve_expr_val', '$replace_next_line', '$rstrip', '$sub_attributes', '$attribute_missing', '$info', '$parse_attributes', '$find', '$handles?', '$instance', '$process_method', '$safe', '$resolve_include_path', '$method', '$split_delimited_value', '$partition', '$<', '$/', '$to_a', '$uniq', '$sort', '$call', '$each_line', '$infinite?', '$push_include', '$delete', '$create_include_cursor', '$delete_at', '$read', '$uriish?', '$attr?', '$require_library', '$normalize_system_path', '$file?', '$relative_path', '$path_resolver', '$base_dir', '$to_f']);
- 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, 'Reader');
-
- var $nesting = [self].concat($parent_nesting), $Reader_initialize$4, $Reader_has_more_lines$ques$5, $Reader_empty$ques$6, $Reader_next_line_empty$ques$7, $Reader_peek_line$8, $Reader_peek_lines$9, $Reader_read_line$11, $Reader_read_lines$12, $Reader_read$13, $Reader_advance$14, $Reader_unshift_line$15, $Reader_unshift_lines$16, $Reader_replace_next_line$17, $Reader_skip_blank_lines$18, $Reader_skip_comment_lines$19, $Reader_skip_line_comments$20, $Reader_terminate$21, $Reader_read_lines_until$22, $Reader_shift$23, $Reader_unshift$24, $Reader_unshift_all$25, $Reader_cursor$26, $Reader_cursor_at_line$27, $Reader_cursor_at_mark$28, $Reader_cursor_before_mark$29, $Reader_cursor_at_prev_line$30, $Reader_mark$31, $Reader_line_info$32, $Reader_lines$33, $Reader_string$34, $Reader_source$35, $Reader_save$36, $Reader_restore_save$39, $Reader_discard_save$41, $Reader_to_s$42, $Reader_prepare_lines$43, $Reader_process_line$44;
-
- self.$$prototype.file = self.$$prototype.lines = self.$$prototype.look_ahead = self.$$prototype.unescape_next_line = self.$$prototype.lineno = self.$$prototype.process_lines = self.$$prototype.dir = self.$$prototype.path = self.$$prototype.mark = self.$$prototype.source_lines = self.$$prototype.saved = nil;
-
- self.$include($$($nesting, 'Logging'));
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Cursor');
-
- var $nesting = [self].concat($parent_nesting), $Cursor_initialize$1, $Cursor_advance$2, $Cursor_line_info$3;
-
- self.$$prototype.lineno = self.$$prototype.path = nil;
-
- self.$attr_reader("file", "dir", "path", "lineno");
-
- Opal.def(self, '$initialize', $Cursor_initialize$1 = function $$initialize(file, dir, path, lineno) {
- var $a, self = this;
-
-
-
- if (dir == null) {
- dir = nil;
- };
-
- if (path == null) {
- path = nil;
- };
-
- if (lineno == null) {
- lineno = 1;
- };
- return $a = [file, dir, path, lineno], (self.file = $a[0]), (self.dir = $a[1]), (self.path = $a[2]), (self.lineno = $a[3]), $a;
- }, $Cursor_initialize$1.$$arity = -2);
-
- Opal.def(self, '$advance', $Cursor_advance$2 = function $$advance(num) {
- var self = this;
-
- return (self.lineno = $rb_plus(self.lineno, num))
- }, $Cursor_advance$2.$$arity = 1);
-
- Opal.def(self, '$line_info', $Cursor_line_info$3 = function $$line_info() {
- var self = this;
-
- return "" + (self.path) + ": line " + (self.lineno)
- }, $Cursor_line_info$3.$$arity = 0);
- return Opal.alias(self, "to_s", "line_info");
- })($nesting[0], null, $nesting);
- 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");
- self.$attr_accessor("unterminated");
-
- Opal.def(self, '$initialize', $Reader_initialize$4 = function $$initialize(data, cursor, opts) {
- var $a, $b, self = this;
-
-
-
- if (data == null) {
- data = nil;
- };
-
- if (cursor == null) {
- cursor = nil;
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy(cursor['$!']())) {
-
- self.file = nil;
- self.dir = ".";
- self.path = "";
- self.lineno = 1;
- } else if ($truthy($$$('::', 'String')['$==='](cursor))) {
-
- self.file = cursor;
- $b = $$$('::', 'File').$split(self.file), $a = Opal.to_ary($b), (self.dir = ($a[0] == null ? nil : $a[0])), (self.path = ($a[1] == null ? nil : $a[1])), $b;
- self.lineno = 1;
- } else {
-
- if ($truthy((self.file = cursor.$file()))) {
-
- self.dir = ($truthy($a = cursor.$dir()) ? $a : $$$('::', 'File').$dirname(self.file));
- self.path = ($truthy($a = cursor.$path()) ? $a : $$$('::', 'File').$basename(self.file));
- } else {
-
- self.dir = ($truthy($a = cursor.$dir()) ? $a : ".");
- self.path = ($truthy($a = cursor.$path()) ? $a : "");
- };
- self.lineno = ($truthy($a = cursor.$lineno()) ? $a : 1);
- };
- self.lines = self.$prepare_lines(data, opts);
- self.source_lines = self.lines.$drop(0);
- self.mark = nil;
- self.look_ahead = 0;
- self.process_lines = true;
- self.unescape_next_line = false;
- self.unterminated = nil;
- return (self.saved = nil);
- }, $Reader_initialize$4.$$arity = -1);
-
- Opal.def(self, '$has_more_lines?', $Reader_has_more_lines$ques$5 = function() {
- var self = this;
-
- if ($truthy(self.lines['$empty?']())) {
-
- self.look_ahead = 0;
- return false;
- } else {
- return true
- }
- }, $Reader_has_more_lines$ques$5.$$arity = 0);
-
- Opal.def(self, '$empty?', $Reader_empty$ques$6 = function() {
- var self = this;
-
- if ($truthy(self.lines['$empty?']())) {
-
- self.look_ahead = 0;
- return true;
- } else {
- return false
- }
- }, $Reader_empty$ques$6.$$arity = 0);
- Opal.alias(self, "eof?", "empty?");
-
- Opal.def(self, '$next_line_empty?', $Reader_next_line_empty$ques$7 = function() {
- var self = this;
-
- return self.$peek_line()['$nil_or_empty?']()
- }, $Reader_next_line_empty$ques$7.$$arity = 0);
-
- Opal.def(self, '$peek_line', $Reader_peek_line$8 = function $$peek_line(direct) {
- var $a, self = this, line = nil;
-
-
-
- if (direct == null) {
- direct = false;
- };
- if ($truthy(($truthy($a = direct) ? $a : $rb_gt(self.look_ahead, 0)))) {
- if ($truthy(self.unescape_next_line)) {
-
- return (line = self.lines['$[]'](0)).$slice(1, line.$length());
- } else {
- return self.lines['$[]'](0)
- }
- } else if ($truthy(self.lines['$empty?']())) {
-
- self.look_ahead = 0;
- return nil;
- } else if ($truthy((line = self.$process_line(self.lines['$[]'](0))))) {
- return line
- } else {
- return self.$peek_line()
- };
- }, $Reader_peek_line$8.$$arity = -1);
-
- Opal.def(self, '$peek_lines', $Reader_peek_lines$9 = function $$peek_lines(num, direct) {
- var $a, $$10, self = this, old_look_ahead = nil, result = nil;
-
-
-
- if (num == null) {
- num = nil;
- };
-
- if (direct == null) {
- direct = false;
- };
- old_look_ahead = self.look_ahead;
- result = [];
- (function(){var $brk = Opal.new_brk(); try {return $send(($truthy($a = num) ? $a : $$($nesting, 'MAX_INT')), 'times', [], ($$10 = function(){var self = $$10.$$s || this, line = nil;
- if (self.lineno == null) self.lineno = nil;
-
- if ($truthy((line = (function() {if ($truthy(direct)) {
- return self.$shift()
- } else {
- return self.$read_line()
- }; return nil; })()))) {
- return result['$<<'](line)
- } else {
-
- if ($truthy(direct)) {
- self.lineno = $rb_minus(self.lineno, 1)};
-
- Opal.brk(nil, $brk);
- }}, $$10.$$s = self, $$10.$$brk = $brk, $$10.$$arity = 0, $$10))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();
- if ($truthy(result['$empty?']())) {
- } else {
-
- self.$unshift_all(result);
- if ($truthy(direct)) {
- self.look_ahead = old_look_ahead};
- };
- return result;
- }, $Reader_peek_lines$9.$$arity = -1);
-
- Opal.def(self, '$read_line', $Reader_read_line$11 = function $$read_line() {
- var $a, self = this;
-
- if ($truthy(($truthy($a = $rb_gt(self.look_ahead, 0)) ? $a : self['$has_more_lines?']()))) {
- return self.$shift()
- } else {
- return nil
- }
- }, $Reader_read_line$11.$$arity = 0);
-
- Opal.def(self, '$read_lines', $Reader_read_lines$12 = function $$read_lines() {
- var $a, self = this, lines = nil;
-
-
- lines = [];
- while ($truthy(self['$has_more_lines?']())) {
- lines['$<<'](self.$shift())
- };
- return lines;
- }, $Reader_read_lines$12.$$arity = 0);
- Opal.alias(self, "readlines", "read_lines");
-
- Opal.def(self, '$read', $Reader_read$13 = function $$read() {
- var self = this;
-
- return self.$read_lines().$join($$($nesting, 'LF'))
- }, $Reader_read$13.$$arity = 0);
-
- Opal.def(self, '$advance', $Reader_advance$14 = function $$advance() {
- var self = this;
-
- if ($truthy(self.$shift())) {
- return true
- } else {
- return false
- }
- }, $Reader_advance$14.$$arity = 0);
-
- Opal.def(self, '$unshift_line', $Reader_unshift_line$15 = function $$unshift_line(line_to_restore) {
- var self = this;
-
-
- self.$unshift(line_to_restore);
- return nil;
- }, $Reader_unshift_line$15.$$arity = 1);
- Opal.alias(self, "restore_line", "unshift_line");
-
- Opal.def(self, '$unshift_lines', $Reader_unshift_lines$16 = function $$unshift_lines(lines_to_restore) {
- var self = this;
-
-
- self.$unshift_all(lines_to_restore);
- return nil;
- }, $Reader_unshift_lines$16.$$arity = 1);
- Opal.alias(self, "restore_lines", "unshift_lines");
-
- Opal.def(self, '$replace_next_line', $Reader_replace_next_line$17 = function $$replace_next_line(replacement) {
- var self = this;
-
-
- self.$shift();
- self.$unshift(replacement);
- return true;
- }, $Reader_replace_next_line$17.$$arity = 1);
- Opal.alias(self, "replace_line", "replace_next_line");
-
- Opal.def(self, '$skip_blank_lines', $Reader_skip_blank_lines$18 = function $$skip_blank_lines() {
- var $a, self = this, num_skipped = nil, next_line = nil;
-
-
- if ($truthy(self['$empty?']())) {
- return nil};
- num_skipped = 0;
- while ($truthy((next_line = self.$peek_line()))) {
- if ($truthy(next_line['$empty?']())) {
-
- self.$shift();
- num_skipped = $rb_plus(num_skipped, 1);
- } else {
- return num_skipped
- }
- };
- }, $Reader_skip_blank_lines$18.$$arity = 0);
-
- Opal.def(self, '$skip_comment_lines', $Reader_skip_comment_lines$19 = function $$skip_comment_lines() {
- var $a, $b, self = this, next_line = nil, ll = nil;
-
-
- if ($truthy(self['$empty?']())) {
- return nil};
- while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) {
- if ($truthy(next_line['$start_with?']("//"))) {
- if ($truthy(next_line['$start_with?']("///"))) {
- if ($truthy(($truthy($b = $rb_gt((ll = next_line.$length()), 3)) ? next_line['$==']($rb_times("/", ll)) : $b))) {
- self.$read_lines_until($hash2(["terminator", "skip_first_line", "read_last_line", "skip_processing", "context"], {"terminator": next_line, "skip_first_line": true, "read_last_line": true, "skip_processing": true, "context": "comment"}))
- } else {
- break;
- }
- } else {
- self.$shift()
- }
- } else {
- break;
- }
- };
- return nil;
- }, $Reader_skip_comment_lines$19.$$arity = 0);
-
- Opal.def(self, '$skip_line_comments', $Reader_skip_line_comments$20 = function $$skip_line_comments() {
- var $a, $b, self = this, comment_lines = nil, next_line = nil;
-
-
- if ($truthy(self['$empty?']())) {
- return []};
- comment_lines = [];
- while ($truthy(($truthy($b = (next_line = self.$peek_line())) ? next_line['$empty?']()['$!']() : $b))) {
- if ($truthy(next_line['$start_with?']("//"))) {
- comment_lines['$<<'](self.$shift())
- } else {
- break;
- }
- };
- return comment_lines;
- }, $Reader_skip_line_comments$20.$$arity = 0);
-
- Opal.def(self, '$terminate', $Reader_terminate$21 = function $$terminate() {
- var self = this;
-
-
- self.lineno = $rb_plus(self.lineno, self.lines.$size());
- self.lines.$clear();
- self.look_ahead = 0;
- return nil;
- }, $Reader_terminate$21.$$arity = 0);
-
- Opal.def(self, '$read_lines_until', $Reader_read_lines_until$22 = function $$read_lines_until(options) {
- var $a, $b, $c, $d, $iter = $Reader_read_lines_until$22.$$p, $yield = $iter || nil, self = this, result = nil, restore_process_lines = nil, terminator = nil, start_cursor = nil, break_on_blank_lines = nil, break_on_list_continuation = nil, skip_comments = nil, complete = nil, line_read = nil, line_restored = nil, line = nil, $writer = nil, context = nil;
-
- if ($iter) $Reader_read_lines_until$22.$$p = null;
-
-
- if (options == null) {
- options = $hash2([], {});
- };
- result = [];
- if ($truthy(($truthy($a = self.process_lines) ? options['$[]']("skip_processing") : $a))) {
-
- self.process_lines = false;
- restore_process_lines = true;};
- if ($truthy((terminator = options['$[]']("terminator")))) {
-
- start_cursor = ($truthy($a = options['$[]']("cursor")) ? $a : self.$cursor());
- 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_comments = options['$[]']("skip_line_comments");
- complete = (line_read = (line_restored = nil));
- if ($truthy(options['$[]']("skip_first_line"))) {
- self.$shift()};
- while ($truthy(($truthy($b = complete['$!']()) ? (line = self.$read_line()) : $b))) {
-
- complete = (function() {while ($truthy(true)) {
-
- if ($truthy(($truthy($c = terminator) ? line['$=='](terminator) : $c))) {
- return true};
- if ($truthy(($truthy($c = break_on_blank_lines) ? line['$empty?']() : $c))) {
- return true};
- if ($truthy(($truthy($c = ($truthy($d = break_on_list_continuation) ? line_read : $d)) ? line['$==']($$($nesting, 'LIST_CONTINUATION')) : $c))) {
-
-
- $writer = ["preserve_last_line", true];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- return true;};
- if ($truthy((($c = ($yield !== nil)) ? Opal.yield1($yield, line) : ($yield !== nil)))) {
- return true};
- return false;
- }; return nil; })();
- if ($truthy(complete)) {
-
- if ($truthy(options['$[]']("read_last_line"))) {
-
- result['$<<'](line);
- line_read = true;};
- if ($truthy(options['$[]']("preserve_last_line"))) {
-
- self.$unshift(line);
- line_restored = true;};
- } else if ($truthy(($truthy($b = ($truthy($c = skip_comments) ? line['$start_with?']("//") : $c)) ? line['$start_with?']("///")['$!']() : $b))) {
- } else {
-
- result['$<<'](line);
- line_read = true;
- };
- };
- if ($truthy(restore_process_lines)) {
-
- self.process_lines = true;
- if ($truthy(($truthy($a = line_restored) ? terminator['$!']() : $a))) {
- self.look_ahead = $rb_minus(self.look_ahead, 1)};};
- if ($truthy(($truthy($a = ($truthy($b = terminator) ? terminator['$!='](line) : $b)) ? (context = options.$fetch("context", terminator)) : $a))) {
-
- if (start_cursor['$==']("at_mark")) {
- start_cursor = self.$cursor_at_mark()};
- self.$logger().$warn(self.$message_with_context("" + "unterminated " + (context) + " block", $hash2(["source_location"], {"source_location": start_cursor})));
- self.unterminated = true;};
- return result;
- }, $Reader_read_lines_until$22.$$arity = -1);
-
- Opal.def(self, '$shift', $Reader_shift$23 = function $$shift() {
- var self = this;
-
-
- self.lineno = $rb_plus(self.lineno, 1);
- if (self.look_ahead['$=='](0)) {
- } else {
- self.look_ahead = $rb_minus(self.look_ahead, 1)
- };
- return self.lines.$shift();
- }, $Reader_shift$23.$$arity = 0);
-
- Opal.def(self, '$unshift', $Reader_unshift$24 = function $$unshift(line) {
- var self = this;
-
-
- self.lineno = $rb_minus(self.lineno, 1);
- self.look_ahead = $rb_plus(self.look_ahead, 1);
- return self.lines.$unshift(line);
- }, $Reader_unshift$24.$$arity = 1);
-
- Opal.def(self, '$unshift_all', $Reader_unshift_all$25 = function $$unshift_all(lines) {
- var self = this;
-
-
- self.lineno = $rb_minus(self.lineno, lines.$size());
- self.look_ahead = $rb_plus(self.look_ahead, lines.$size());
- return $send(self.lines, 'unshift', Opal.to_a(lines));
- }, $Reader_unshift_all$25.$$arity = 1);
-
- Opal.def(self, '$cursor', $Reader_cursor$26 = function $$cursor() {
- var self = this;
-
- return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, self.lineno)
- }, $Reader_cursor$26.$$arity = 0);
-
- Opal.def(self, '$cursor_at_line', $Reader_cursor_at_line$27 = function $$cursor_at_line(lineno) {
- var self = this;
-
- return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, lineno)
- }, $Reader_cursor_at_line$27.$$arity = 1);
-
- Opal.def(self, '$cursor_at_mark', $Reader_cursor_at_mark$28 = function $$cursor_at_mark() {
- var self = this;
-
- if ($truthy(self.mark)) {
- return $send($$($nesting, 'Cursor'), 'new', Opal.to_a(self.mark))
- } else {
- return self.$cursor()
- }
- }, $Reader_cursor_at_mark$28.$$arity = 0);
-
- Opal.def(self, '$cursor_before_mark', $Reader_cursor_before_mark$29 = function $$cursor_before_mark() {
- var $a, $b, self = this, m_file = nil, m_dir = nil, m_path = nil, m_lineno = nil;
-
- if ($truthy(self.mark)) {
-
- $b = self.mark, $a = Opal.to_ary($b), (m_file = ($a[0] == null ? nil : $a[0])), (m_dir = ($a[1] == null ? nil : $a[1])), (m_path = ($a[2] == null ? nil : $a[2])), (m_lineno = ($a[3] == null ? nil : $a[3])), $b;
- return $$($nesting, 'Cursor').$new(m_file, m_dir, m_path, $rb_minus(m_lineno, 1));
- } else {
- return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1))
- }
- }, $Reader_cursor_before_mark$29.$$arity = 0);
-
- Opal.def(self, '$cursor_at_prev_line', $Reader_cursor_at_prev_line$30 = function $$cursor_at_prev_line() {
- var self = this;
-
- return $$($nesting, 'Cursor').$new(self.file, self.dir, self.path, $rb_minus(self.lineno, 1))
- }, $Reader_cursor_at_prev_line$30.$$arity = 0);
-
- Opal.def(self, '$mark', $Reader_mark$31 = function $$mark() {
- var self = this;
-
- return (self.mark = [self.file, self.dir, self.path, self.lineno])
- }, $Reader_mark$31.$$arity = 0);
-
- Opal.def(self, '$line_info', $Reader_line_info$32 = function $$line_info() {
- var self = this;
-
- return "" + (self.path) + ": line " + (self.lineno)
- }, $Reader_line_info$32.$$arity = 0);
-
- Opal.def(self, '$lines', $Reader_lines$33 = function $$lines() {
- var self = this;
-
- return self.lines.$drop(0)
- }, $Reader_lines$33.$$arity = 0);
-
- Opal.def(self, '$string', $Reader_string$34 = function $$string() {
- var self = this;
-
- return self.lines.$join($$($nesting, 'LF'))
- }, $Reader_string$34.$$arity = 0);
-
- Opal.def(self, '$source', $Reader_source$35 = function $$source() {
- var self = this;
-
- return self.source_lines.$join($$($nesting, 'LF'))
- }, $Reader_source$35.$$arity = 0);
-
- Opal.def(self, '$save', $Reader_save$36 = function $$save() {
- var $$37, self = this;
-
-
- self.saved = $send($hash2([], {}), 'tap', [], ($$37 = function(accum){var self = $$37.$$s || this, $$38;
-
-
-
- if (accum == null) {
- accum = nil;
- };
- return $send(self.$instance_variables(), 'each', [], ($$38 = function(name){var self = $$38.$$s || this, $a, $writer = nil, val = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
- if ($truthy(($truthy($a = name['$==']("@saved")) ? $a : name['$==']("@source_lines")))) {
- return nil
- } else {
-
- $writer = [name, (function() {if ($truthy($$$('::', 'Array')['$===']((val = self.$instance_variable_get(name))))) {
-
- return val.$drop(0);
- } else {
- return val
- }; return nil; })()];
- $send(accum, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };}, $$38.$$s = self, $$38.$$arity = 1, $$38));}, $$37.$$s = self, $$37.$$arity = 1, $$37));
- return nil;
- }, $Reader_save$36.$$arity = 0);
-
- Opal.def(self, '$restore_save', $Reader_restore_save$39 = function $$restore_save() {
- var $$40, self = this;
-
- if ($truthy(self.saved)) {
-
- $send(self.saved, 'each', [], ($$40 = function(name, val){var self = $$40.$$s || this;
-
-
-
- if (name == null) {
- name = nil;
- };
-
- if (val == null) {
- val = nil;
- };
- return self.$instance_variable_set(name, val);}, $$40.$$s = self, $$40.$$arity = 2, $$40));
- return (self.saved = nil);
- } else {
- return nil
- }
- }, $Reader_restore_save$39.$$arity = 0);
-
- Opal.def(self, '$discard_save', $Reader_discard_save$41 = function $$discard_save() {
- var self = this;
-
- return (self.saved = nil)
- }, $Reader_discard_save$41.$$arity = 0);
-
- Opal.def(self, '$to_s', $Reader_to_s$42 = function $$to_s() {
- var self = this;
-
- return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line: " + (self.lineno) + "}>"
- }, $Reader_to_s$42.$$arity = 0);
- self.$private();
-
- Opal.def(self, '$prepare_lines', $Reader_prepare_lines$43 = function $$prepare_lines(data, opts) {
- var self = this, normalize = nil, trim_end = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- try {
- if ($truthy((normalize = opts['$[]']("normalize")))) {
-
- trim_end = (function() {if (normalize['$==']("chomp")) {
- return false
- } else {
- return true
- }; return nil; })();
- if ($truthy($$$('::', 'Array')['$==='](data))) {
-
- return $$($nesting, 'Helpers').$prepare_source_array(data, trim_end);
- } else {
-
- return $$($nesting, 'Helpers').$prepare_source_string(data, trim_end);
- };
- } else if ($truthy($$$('::', 'Array')['$==='](data))) {
- return data.$drop(0)
- } else if ($truthy(data)) {
- return data.$chomp().$split($$($nesting, 'LF'), -1)
- } else {
- return []
- }
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- if ($truthy((function() {if ($truthy($$$('::', 'Array')['$==='](data))) {
- return data.$join()
- } else {
- return data.$to_s()
- }; return nil; })()['$valid_encoding?']())) {
- return self.$raise()
- } else {
- return self.$raise($$$('::', 'ArgumentError'), "source is either binary or contains invalid Unicode data")
- }
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- }, $Reader_prepare_lines$43.$$arity = -2);
- return (Opal.def(self, '$process_line', $Reader_process_line$44 = function $$process_line(line) {
- var self = this;
-
-
- if ($truthy(self.process_lines)) {
- self.look_ahead = $rb_plus(self.look_ahead, 1)};
- return line;
- }, $Reader_process_line$44.$$arity = 1), nil) && 'process_line';
- })($nesting[0], null, $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'PreprocessorReader');
-
- var $nesting = [self].concat($parent_nesting), $PreprocessorReader_initialize$45, $PreprocessorReader_has_more_lines$ques$46, $PreprocessorReader_empty$ques$47, $PreprocessorReader_peek_line$48, $PreprocessorReader_push_include$49, $PreprocessorReader_include_depth$50, $PreprocessorReader_exceeds_max_depth$ques$51, $PreprocessorReader_shift$52, $PreprocessorReader_include_processors$ques$53, $PreprocessorReader_create_include_cursor$54, $PreprocessorReader_to_s$55, $PreprocessorReader_prepare_lines$57, $PreprocessorReader_process_line$58, $PreprocessorReader_preprocess_conditional_directive$59, $PreprocessorReader_preprocess_include_directive$64, $PreprocessorReader_resolve_include_path$77, $PreprocessorReader_pop_include$79, $PreprocessorReader_split_delimited_value$80, $PreprocessorReader_skip_front_matter$excl$81, $PreprocessorReader_resolve_expr_val$82;
-
- self.$$prototype.include_stack = self.$$prototype.lines = self.$$prototype.file = self.$$prototype.dir = self.$$prototype.path = self.$$prototype.lineno = self.$$prototype.maxdepth = self.$$prototype.process_lines = self.$$prototype.includes = self.$$prototype.document = self.$$prototype.unescape_next_line = self.$$prototype.include_processor_extensions = self.$$prototype.look_ahead = self.$$prototype.skipping = self.$$prototype.conditional_stack = nil;
-
- self.$attr_reader("include_stack");
-
- Opal.def(self, '$initialize', $PreprocessorReader_initialize$45 = function $$initialize(document, data, cursor, opts) {
- var $a, $iter = $PreprocessorReader_initialize$45.$$p, $yield = $iter || nil, self = this, default_include_depth = nil;
-
- if ($iter) $PreprocessorReader_initialize$45.$$p = null;
-
-
- if (data == null) {
- data = nil;
- };
-
- if (cursor == null) {
- cursor = nil;
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- self.document = document;
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $PreprocessorReader_initialize$45, false), [data, cursor, opts], null);
- if ($truthy($rb_gt((default_include_depth = ($truthy($a = document.$attributes()['$[]']("max-include-depth")) ? $a : 64).$to_i()), 0))) {
- self.maxdepth = $hash2(["abs", "curr", "rel"], {"abs": default_include_depth, "curr": default_include_depth, "rel": default_include_depth})
- } else {
- self.maxdepth = nil
- };
- self.include_stack = [];
- self.includes = document.$catalog()['$[]']("includes");
- self.skipping = false;
- self.conditional_stack = [];
- return (self.include_processor_extensions = nil);
- }, $PreprocessorReader_initialize$45.$$arity = -2);
-
- Opal.def(self, '$has_more_lines?', $PreprocessorReader_has_more_lines$ques$46 = function() {
- var self = this;
-
- if ($truthy(self.$peek_line())) {
- return true
- } else {
- return false
- }
- }, $PreprocessorReader_has_more_lines$ques$46.$$arity = 0);
-
- Opal.def(self, '$empty?', $PreprocessorReader_empty$ques$47 = function() {
- var self = this;
-
- if ($truthy(self.$peek_line())) {
- return false
- } else {
- return true
- }
- }, $PreprocessorReader_empty$ques$47.$$arity = 0);
- Opal.alias(self, "eof?", "empty?");
-
- Opal.def(self, '$peek_line', $PreprocessorReader_peek_line$48 = function $$peek_line(direct) {
- var $iter = $PreprocessorReader_peek_line$48.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $PreprocessorReader_peek_line$48.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if (direct == null) {
- direct = false;
- };
- if ($truthy((line = $send(self, Opal.find_super_dispatcher(self, 'peek_line', $PreprocessorReader_peek_line$48, false), $zuper, $iter)))) {
- return line
- } else if ($truthy(self.include_stack['$empty?']())) {
- return nil
- } else {
-
- self.$pop_include();
- return self.$peek_line(direct);
- };
- }, $PreprocessorReader_peek_line$48.$$arity = -1);
-
- Opal.def(self, '$push_include', $PreprocessorReader_push_include$49 = function $$push_include(data, file, path, lineno, attributes) {
- var $a, self = this, $writer = nil, dir = nil, rel_maxdepth = nil, curr_maxdepth = nil, abs_maxdepth = nil, old_leveloffset = nil;
-
-
-
- if (file == null) {
- file = nil;
- };
-
- if (path == null) {
- path = nil;
- };
-
- if (lineno == null) {
- lineno = 1;
- };
-
- if (attributes == null) {
- attributes = $hash2([], {});
- };
- self.include_stack['$<<']([self.lines, self.file, self.dir, self.path, self.lineno, self.maxdepth, self.process_lines]);
- if ($truthy((self.file = file))) {
-
- if ($truthy($$$('::', 'String')['$==='](file))) {
- self.dir = $$$('::', 'File').$dirname(file)
- } else if ($truthy($$($nesting, 'RUBY_ENGINE_OPAL'))) {
- self.dir = $$$('::', 'URI').$parse($$$('::', 'File').$dirname((file = file.$to_s())))
- } else {
-
-
- $writer = [(function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("/")) {
- return ""
- } else {
- return dir
- }; return nil; })()];
- $send((self.dir = file.$dup()), 'path=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- file = file.$to_s();
- };
- self.path = (path = ($truthy($a = path) ? $a : $$$('::', 'File').$basename(file)));
- if ($truthy((self.process_lines = $send(file, 'end_with?', Opal.to_a($$($nesting, 'ASCIIDOC_EXTENSIONS').$keys()))))) {
-
- $writer = [path.$slice(0, path.$rindex(".")), (function() {if ($truthy(attributes['$[]']("partial-option"))) {
- return nil
- } else {
- return true
- }; return nil; })()];
- $send(self.includes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- } else {
-
- self.dir = ".";
- self.process_lines = true;
- if ($truthy((self.path = path))) {
-
- $writer = [$$($nesting, 'Helpers').$rootname(path), (function() {if ($truthy(attributes['$[]']("partial-option"))) {
- return nil
- } else {
- return true
- }; return nil; })()];
- $send(self.includes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
- self.path = ""
- };
- };
- self.lineno = lineno;
- if ($truthy(($truthy($a = self.maxdepth) ? attributes['$key?']("depth") : $a))) {
- if ($truthy($rb_gt((rel_maxdepth = attributes['$[]']("depth").$to_i()), 0))) {
-
- if ($truthy($rb_gt((curr_maxdepth = $rb_plus(self.include_stack.$size(), rel_maxdepth)), (abs_maxdepth = self.maxdepth['$[]']("abs"))))) {
- curr_maxdepth = (rel_maxdepth = abs_maxdepth)};
- self.maxdepth = $hash2(["abs", "curr", "rel"], {"abs": abs_maxdepth, "curr": curr_maxdepth, "rel": rel_maxdepth});
- } else {
- self.maxdepth = $hash2(["abs", "curr", "rel"], {"abs": self.maxdepth['$[]']("abs"), "curr": self.include_stack.$size(), "rel": 0})
- }};
- if ($truthy((self.lines = self.$prepare_lines(data, $hash2(["normalize", "condense", "indent"], {"normalize": ($truthy($a = self.process_lines) ? $a : "chomp"), "condense": false, "indent": attributes['$[]']("indent")})))['$empty?']())) {
- self.$pop_include()
- } else {
-
- if ($truthy(attributes['$key?']("leveloffset"))) {
-
- self.lines.$unshift("");
- self.lines.$unshift("" + ":leveloffset: " + (attributes['$[]']("leveloffset")));
- self.lines['$<<']("");
- if ($truthy((old_leveloffset = self.document.$attr("leveloffset")))) {
- self.lines['$<<']("" + ":leveloffset: " + (old_leveloffset))
- } else {
- self.lines['$<<'](":leveloffset!:")
- };
- self.lineno = $rb_minus(self.lineno, 2);};
- self.look_ahead = 0;
- };
- return self;
- }, $PreprocessorReader_push_include$49.$$arity = -2);
-
- Opal.def(self, '$include_depth', $PreprocessorReader_include_depth$50 = function $$include_depth() {
- var self = this;
-
- return self.include_stack.$size()
- }, $PreprocessorReader_include_depth$50.$$arity = 0);
-
- Opal.def(self, '$exceeds_max_depth?', $PreprocessorReader_exceeds_max_depth$ques$51 = function() {
- var $a, $b, self = this;
-
- return ($truthy($a = ($truthy($b = self.maxdepth) ? $rb_ge(self.include_stack.$size(), self.maxdepth['$[]']("curr")) : $b)) ? self.maxdepth['$[]']("rel") : $a)
- }, $PreprocessorReader_exceeds_max_depth$ques$51.$$arity = 0);
- Opal.alias(self, "exceeded_max_depth?", "exceeds_max_depth?");
-
- Opal.def(self, '$shift', $PreprocessorReader_shift$52 = function $$shift() {
- var $iter = $PreprocessorReader_shift$52.$$p, $yield = $iter || nil, self = this, line = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $PreprocessorReader_shift$52.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if ($truthy(self.unescape_next_line)) {
-
- self.unescape_next_line = false;
- return (line = $send(self, Opal.find_super_dispatcher(self, 'shift', $PreprocessorReader_shift$52, false), $zuper, $iter)).$slice(1, line.$length());
- } else {
- return $send(self, Opal.find_super_dispatcher(self, 'shift', $PreprocessorReader_shift$52, false), $zuper, $iter)
- }
- }, $PreprocessorReader_shift$52.$$arity = 0);
-
- Opal.def(self, '$include_processors?', $PreprocessorReader_include_processors$ques$53 = function() {
- var $a, self = this;
-
- if ($truthy(self.include_processor_extensions['$nil?']())) {
- if ($truthy(($truthy($a = self.document['$extensions?']()) ? self.document.$extensions()['$include_processors?']() : $a))) {
- return (self.include_processor_extensions = self.document.$extensions().$include_processors())['$!']()['$!']()
- } else {
- return (self.include_processor_extensions = false)
- }
- } else {
- return self.include_processor_extensions['$!='](false)
- }
- }, $PreprocessorReader_include_processors$ques$53.$$arity = 0);
-
- Opal.def(self, '$create_include_cursor', $PreprocessorReader_create_include_cursor$54 = function $$create_include_cursor(file, path, lineno) {
- var self = this, dir = nil;
-
-
- if ($truthy($$$('::', 'String')['$==='](file))) {
- dir = $$$('::', 'File').$dirname(file)
- } else if ($truthy($$($nesting, 'RUBY_ENGINE_OPAL'))) {
- dir = $$$('::', 'File').$dirname((file = file.$to_s()))
- } else {
-
- dir = (function() {if ((dir = $$$('::', 'File').$dirname(file.$path()))['$==']("")) {
- return "/"
- } else {
- return dir
- }; return nil; })();
- file = file.$to_s();
- };
- return $$($nesting, 'Cursor').$new(file, dir, path, lineno);
- }, $PreprocessorReader_create_include_cursor$54.$$arity = 3);
-
- Opal.def(self, '$to_s', $PreprocessorReader_to_s$55 = function $$to_s() {
- var $$56, self = this;
-
- return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {path: " + (self.path.$inspect()) + ", line: " + (self.lineno) + ", include depth: " + (self.include_stack.$size()) + ", include stack: [" + ($send(self.include_stack, 'map', [], ($$56 = function(inc){var self = $$56.$$s || this;
-
-
-
- if (inc == null) {
- inc = nil;
- };
- return inc.$to_s();}, $$56.$$s = self, $$56.$$arity = 1, $$56)).$join(", ")) + "]}>"
- }, $PreprocessorReader_to_s$55.$$arity = 0);
- self.$private();
-
- Opal.def(self, '$prepare_lines', $PreprocessorReader_prepare_lines$57 = function $$prepare_lines(data, opts) {
- var $a, $b, $iter = $PreprocessorReader_prepare_lines$57.$$p, $yield = $iter || nil, self = this, result = nil, front_matter = nil, $writer = nil, last = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $PreprocessorReader_prepare_lines$57.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- result = $send(self, Opal.find_super_dispatcher(self, 'prepare_lines', $PreprocessorReader_prepare_lines$57, false), $zuper, $iter);
- if ($truthy(($truthy($a = self.document) ? self.document.$attributes()['$[]']("skip-front-matter") : $a))) {
- if ($truthy((front_matter = self['$skip_front_matter!'](result)))) {
-
- $writer = ["front-matter", front_matter.$join($$($nesting, 'LF'))];
- $send(self.document.$attributes(), '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}};
- if ($truthy(opts.$fetch("condense", true))) {
- while ($truthy(($truthy($b = (last = result['$[]'](-1))) ? last['$empty?']() : $b))) {
- result.$pop()
- }};
- if ($truthy(opts['$[]']("indent"))) {
- $$($nesting, 'Parser')['$adjust_indentation!'](result, opts['$[]']("indent").$to_i(), self.document.$attr("tabsize").$to_i())};
- return result;
- }, $PreprocessorReader_prepare_lines$57.$$arity = -2);
-
- Opal.def(self, '$process_line', $PreprocessorReader_process_line$58 = function $$process_line(line) {
- var $a, $b, self = this;
-
-
- if ($truthy(self.process_lines)) {
- } else {
- return line
- };
- if ($truthy(line['$empty?']())) {
-
- self.look_ahead = $rb_plus(self.look_ahead, 1);
- return line;};
- if ($truthy(($truthy($a = ($truthy($b = line['$end_with?']("]")) ? line['$start_with?']("[")['$!']() : $b)) ? line['$include?']("::") : $a))) {
- if ($truthy(($truthy($a = line['$include?']("if")) ? $$($nesting, 'ConditionalDirectiveRx')['$=~'](line) : $a))) {
- if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) {
-
- self.unescape_next_line = true;
- self.look_ahead = $rb_plus(self.look_ahead, 1);
- return line.$slice(1, line.$length());
- } else if ($truthy(self.$preprocess_conditional_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](4)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](5))))) {
-
- self.$shift();
- return nil;
- } else {
-
- self.look_ahead = $rb_plus(self.look_ahead, 1);
- return line;
- }
- } else if ($truthy(self.skipping)) {
-
- self.$shift();
- return nil;
- } else if ($truthy(($truthy($a = line['$start_with?']("inc", "\\inc")) ? $$($nesting, 'IncludeDirectiveRx')['$=~'](line) : $a))) {
- if ((($a = $gvars['~']) === nil ? nil : $a['$[]'](1))['$==']("\\")) {
-
- self.unescape_next_line = true;
- self.look_ahead = $rb_plus(self.look_ahead, 1);
- return line.$slice(1, line.$length());
- } else if ($truthy(self.$preprocess_include_directive((($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](3))))) {
- return nil
- } else {
-
- self.look_ahead = $rb_plus(self.look_ahead, 1);
- return line;
- }
- } else {
-
- self.look_ahead = $rb_plus(self.look_ahead, 1);
- return line;
- }
- } else if ($truthy(self.skipping)) {
-
- self.$shift();
- return nil;
- } else {
-
- self.look_ahead = $rb_plus(self.look_ahead, 1);
- return line;
- };
- }, $PreprocessorReader_process_line$58.$$arity = 1);
-
- Opal.def(self, '$preprocess_conditional_directive', $PreprocessorReader_preprocess_conditional_directive$59 = function $$preprocess_conditional_directive(keyword, target, delimiter, text) {
- var $a, $$60, $$61, $$62, $$63, self = this, no_target = nil, pair = nil, skip = nil, $case = nil, lhs = nil, op = nil, rhs = nil;
-
-
- if ($truthy((no_target = target['$empty?']()))) {
- } else {
- target = target.$downcase()
- };
- if (keyword['$==']("endif")) {
-
- if ($truthy(text)) {
- self.$logger().$error(self.$message_with_context("" + "malformed preprocessor directive - text not permitted: endif::" + (target) + "[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()})))
- } else if ($truthy(self.conditional_stack['$empty?']())) {
- self.$logger().$error(self.$message_with_context("" + "unmatched preprocessor directive: endif::" + (target) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()})))
- } else if ($truthy(($truthy($a = no_target) ? $a : target['$==']((pair = self.conditional_stack['$[]'](-1))['$[]']("target"))))) {
-
- self.conditional_stack.$pop();
- self.skipping = (function() {if ($truthy(self.conditional_stack['$empty?']())) {
- return false
- } else {
- return self.conditional_stack['$[]'](-1)['$[]']("skipping")
- }; return nil; })();
- } else {
- self.$logger().$error(self.$message_with_context("" + "mismatched preprocessor directive: endif::" + (target) + "[], expected endif::" + (pair['$[]']("target")) + "[]", $hash2(["source_location"], {"source_location": self.$cursor()})))
- };
- return true;
- } else if ($truthy(self.skipping)) {
- skip = false
- } else {
- $case = keyword;
- if ("ifdef"['$===']($case)) {
- if ($truthy(no_target)) {
-
- self.$logger().$error(self.$message_with_context("" + "malformed preprocessor directive - missing target: ifdef::[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()})));
- return true;};
- $case = delimiter;
- if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'none?', [], ($$60 = function(name){var self = $$60.$$s || this;
- if (self.document == null) self.document = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
- return self.document.$attributes()['$key?'](name);}, $$60.$$s = self, $$60.$$arity = 1, $$60))}
- else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'any?', [], ($$61 = function(name){var self = $$61.$$s || this;
- if (self.document == null) self.document = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
- return self.document.$attributes()['$key?'](name)['$!']();}, $$61.$$s = self, $$61.$$arity = 1, $$61))}
- else {skip = self.document.$attributes()['$key?'](target)['$!']()};}
- else if ("ifndef"['$===']($case)) {
- if ($truthy(no_target)) {
-
- self.$logger().$error(self.$message_with_context("" + "malformed preprocessor directive - missing target: ifndef::[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()})));
- return true;};
- $case = delimiter;
- if (","['$===']($case)) {skip = $send(target.$split(",", -1), 'any?', [], ($$62 = function(name){var self = $$62.$$s || this;
- if (self.document == null) self.document = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
- return self.document.$attributes()['$key?'](name);}, $$62.$$s = self, $$62.$$arity = 1, $$62))}
- else if ("+"['$===']($case)) {skip = $send(target.$split("+", -1), 'all?', [], ($$63 = function(name){var self = $$63.$$s || this;
- if (self.document == null) self.document = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
- return self.document.$attributes()['$key?'](name);}, $$63.$$s = self, $$63.$$arity = 1, $$63))}
- else {skip = self.document.$attributes()['$key?'](target)};}
- else if ("ifeval"['$===']($case)) {if ($truthy(no_target)) {
- if ($truthy(($truthy($a = text) ? $$($nesting, 'EvalExpressionRx')['$=~'](text.$strip()) : $a))) {
-
- lhs = (($a = $gvars['~']) === nil ? nil : $a['$[]'](1));
- op = (($a = $gvars['~']) === nil ? nil : $a['$[]'](2));
- rhs = (($a = $gvars['~']) === nil ? nil : $a['$[]'](3));
- skip = (function() {if ($truthy(self.$resolve_expr_val(lhs).$send(op, self.$resolve_expr_val(rhs)))) {
- return false
- } else {
- return true
- }; return nil; })();
- } else {
-
- self.$logger().$error(self.$message_with_context("" + "malformed preprocessor directive - " + ((function() {if ($truthy(text)) {
- return "invalid expression"
- } else {
- return "missing expression"
- }; return nil; })()) + ": ifeval::[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()})));
- return true;
- }
- } else {
-
- self.$logger().$error(self.$message_with_context("" + "malformed preprocessor directive - target not permitted: ifeval::" + (target) + "[" + (text) + "]", $hash2(["source_location"], {"source_location": self.$cursor()})));
- return true;
- }}
- };
- if ($truthy(($truthy($a = keyword['$==']("ifeval")) ? $a : text['$!']()))) {
-
- if ($truthy(skip)) {
- self.skipping = true};
- self.conditional_stack['$<<']($hash2(["target", "skip", "skipping"], {"target": target, "skip": skip, "skipping": self.skipping}));
- } else if ($truthy(($truthy($a = self.skipping) ? $a : skip))) {
- } else {
-
- self.$replace_next_line(text.$rstrip());
- self.$unshift("");
- if ($truthy(text['$start_with?']("include::"))) {
- self.look_ahead = $rb_minus(self.look_ahead, 1)};
- };
- return true;
- }, $PreprocessorReader_preprocess_conditional_directive$59.$$arity = 4);
-
- Opal.def(self, '$preprocess_include_directive', $PreprocessorReader_preprocess_include_directive$64 = function $$preprocess_include_directive(target, attrlist) {
- var $a, $b, $$65, $$66, $$67, $$68, $$69, $$70, $$72, $$75, $$76, self = this, doc = nil, expanded_target = nil, attr_missing = nil, ext = nil, parsed_attrs = nil, inc_path = nil, target_type = nil, relpath = nil, reader = nil, read_mode = nil, enc = nil, $writer = nil, read_mode_params = nil, inc_linenos = nil, inc_tags = nil, tag = nil, inc_lines = nil, inc_offset = nil, inc_lineno = nil, tag_stack = nil, tags_used = nil, active_tag = nil, select = nil, base_select = nil, wildcard = nil, missing_tags = nil, inc_content = nil;
-
-
- doc = self.document;
- if ($truthy(($truthy($a = (expanded_target = target)['$include?']($$($nesting, 'ATTR_REF_HEAD'))) ? (expanded_target = doc.$sub_attributes(target, $hash2(["attribute_missing"], {"attribute_missing": (function() {if ((attr_missing = ($truthy($b = doc.$attributes()['$[]']("attribute-missing")) ? $b : $$($nesting, 'Compliance').$attribute_missing()))['$==']("warn")) {
- return "drop-line"
- } else {
- return attr_missing
- }; return nil; })()})))['$empty?']() : $a))) {
- if ($truthy((($a = attr_missing['$==']("drop-line")) ? doc.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']() : attr_missing['$==']("drop-line")))) {
-
- $send(self.$logger(), 'info', [], ($$65 = function(){var self = $$65.$$s || this;
-
- return self.$message_with_context("" + "include dropped due to missing attribute: include::" + (target) + "[" + (attrlist) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))}, $$65.$$s = self, $$65.$$arity = 0, $$65));
- self.$shift();
- return true;
- } else if ($truthy(doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}))['$[]']("optional-option"))) {
-
- $send(self.$logger(), 'info', [], ($$66 = function(){var self = $$66.$$s || this, $c;
-
- return self.$message_with_context("" + "optional include dropped " + ((function() {if ($truthy((($c = attr_missing['$==']("warn")) ? doc.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']() : attr_missing['$==']("warn")))) {
- return "due to missing attribute"
- } else {
- return "because resolved target is blank"
- }; return nil; })()) + ": include::" + (target) + "[" + (attrlist) + "]", $hash2(["source_location"], {"source_location": self.$cursor()}))}, $$66.$$s = self, $$66.$$arity = 0, $$66));
- self.$shift();
- return true;
- } else {
-
- self.$logger().$warn(self.$message_with_context("" + "include dropped " + ((function() {if ($truthy((($a = attr_missing['$==']("warn")) ? doc.$sub_attributes($rb_plus(target, " "), $hash2(["attribute_missing", "drop_line_severity"], {"attribute_missing": "drop-line", "drop_line_severity": "ignore"}))['$empty?']() : attr_missing['$==']("warn")))) {
- return "due to missing attribute"
- } else {
- return "because resolved target is blank"
- }; return nil; })()) + ": include::" + (target) + "[" + (attrlist) + "]", $hash2(["source_location"], {"source_location": self.$cursor()})));
- return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]");
- }
- } else if ($truthy(($truthy($a = self['$include_processors?']()) ? (ext = $send(self.include_processor_extensions, 'find', [], ($$67 = function(candidate){var self = $$67.$$s || this;
-
-
-
- if (candidate == null) {
- candidate = nil;
- };
- return candidate.$instance()['$handles?'](expanded_target);}, $$67.$$s = self, $$67.$$arity = 1, $$67))) : $a))) {
-
- self.$shift();
- ext.$process_method()['$[]'](doc, self, expanded_target, doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true})));
- return true;
- } else if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')))) {
- return self.$replace_next_line("" + "link:" + (expanded_target) + "[]")
- } else if ($truthy(self.maxdepth)) {
-
- if ($truthy($rb_ge(self.include_stack.$size(), self.maxdepth['$[]']("curr")))) {
-
- self.$logger().$error(self.$message_with_context("" + "maximum include depth of " + (self.maxdepth['$[]']("rel")) + " exceeded", $hash2(["source_location"], {"source_location": self.$cursor()})));
- return nil;};
- parsed_attrs = doc.$parse_attributes(attrlist, [], $hash2(["sub_input"], {"sub_input": true}));
- $b = self.$resolve_include_path(expanded_target, attrlist, parsed_attrs), $a = Opal.to_ary($b), (inc_path = ($a[0] == null ? nil : $a[0])), (target_type = ($a[1] == null ? nil : $a[1])), (relpath = ($a[2] == null ? nil : $a[2])), $b;
- if (target_type['$==']("file")) {
-
- reader = $$$('::', 'File').$method("open");
- read_mode = $$($nesting, 'FILE_READ_MODE');
- } else if (target_type['$==']("uri")) {
-
- reader = $$$('::', 'OpenURI').$method("open_uri");
- read_mode = $$($nesting, 'URI_READ_MODE');
- } else {
- return inc_path
- };
- if ($truthy($$($nesting, 'RUBY_ENGINE_OPAL'))) {
- } else if ($truthy(($truthy($a = (enc = parsed_attrs['$[]']("encoding"))) ? (function() { try {
- return $$$('::', 'Encoding').$find(enc)
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- return nil
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- }})() : $a))) {
-
-
- $writer = [1, enc];
- $send((read_mode_params = read_mode.$split(":")), '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- read_mode = read_mode_params.$join(":");};
- inc_linenos = (inc_tags = nil);
- if ($truthy(attrlist)) {
- if ($truthy(parsed_attrs['$key?']("lines"))) {
-
- inc_linenos = [];
- $send(self.$split_delimited_value(parsed_attrs['$[]']("lines")), 'each', [], ($$68 = function(linedef){var self = $$68.$$s || this, $c, $d, from = nil, _ = nil, to = nil;
-
-
-
- if (linedef == null) {
- linedef = nil;
- };
- if ($truthy(linedef['$include?'](".."))) {
-
- $d = linedef.$partition(".."), $c = Opal.to_ary($d), (from = ($c[0] == null ? nil : $c[0])), (_ = ($c[1] == null ? nil : $c[1])), (to = ($c[2] == null ? nil : $c[2])), $d;
- return (inc_linenos = $rb_plus(inc_linenos, (function() {if ($truthy(($truthy($c = to['$empty?']()) ? $c : $rb_lt((to = to.$to_i()), 0)))) {
- return [from.$to_i(), $rb_divide(1, 0)]
- } else {
- return Opal.Range.$new(from.$to_i(), to, false).$to_a()
- }; return nil; })()));
- } else {
- return inc_linenos['$<<'](linedef.$to_i())
- };}, $$68.$$s = self, $$68.$$arity = 1, $$68));
- inc_linenos = (function() {if ($truthy(inc_linenos['$empty?']())) {
- return nil
- } else {
- return inc_linenos.$sort().$uniq()
- }; return nil; })();
- } else if ($truthy(parsed_attrs['$key?']("tag"))) {
- if ($truthy(($truthy($a = (tag = parsed_attrs['$[]']("tag"))['$empty?']()) ? $a : tag['$==']("!")))) {
- } else {
- inc_tags = (function() {if ($truthy(tag['$start_with?']("!"))) {
- return $hash(tag.$slice(1, tag.$length()), false)
- } else {
- return $hash(tag, true)
- }; return nil; })()
- }
- } else if ($truthy(parsed_attrs['$key?']("tags"))) {
-
- inc_tags = $hash2([], {});
- $send(self.$split_delimited_value(parsed_attrs['$[]']("tags")), 'each', [], ($$69 = function(tagdef){var self = $$69.$$s || this, $c;
-
-
-
- if (tagdef == null) {
- tagdef = nil;
- };
- if ($truthy(($truthy($c = tagdef['$empty?']()) ? $c : tagdef['$==']("!")))) {
- return nil
- } else if ($truthy(tagdef['$start_with?']("!"))) {
-
- $writer = [tagdef.$slice(1, tagdef.$length()), false];
- $send(inc_tags, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = [tagdef, true];
- $send(inc_tags, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- };}, $$69.$$s = self, $$69.$$arity = 1, $$69));
- if ($truthy(inc_tags['$empty?']())) {
- inc_tags = nil};}};
- if ($truthy(inc_linenos)) {
-
- $a = [[], nil, 0], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), $a;
-
- try {
- (function(){var $brk = Opal.new_brk(); try {return $send(reader, 'call', [inc_path, read_mode], ($$70 = function(f){var self = $$70.$$s || this, $$71, select_remaining = nil;
-
-
-
- if (f == null) {
- f = nil;
- };
- select_remaining = nil;
- return (function(){var $brk = Opal.new_brk(); try {return $send(f, 'each_line', [], ($$71 = function(l){var self = $$71.$$s || this, $c, $d, select = nil;
-
-
-
- if (l == null) {
- l = nil;
- };
- inc_lineno = $rb_plus(inc_lineno, 1);
- if ($truthy(($truthy($c = select_remaining) ? $c : ($truthy($d = $$$('::', 'Float')['$===']((select = inc_linenos['$[]'](0)))) ? (select_remaining = select['$infinite?']()) : $d)))) {
-
- inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno);
- return inc_lines['$<<'](l);
- } else {
-
- if (select['$=='](inc_lineno)) {
-
- inc_offset = ($truthy($c = inc_offset) ? $c : inc_lineno);
- inc_lines['$<<'](l);
- inc_linenos.$shift();};
- if ($truthy(inc_linenos['$empty?']())) {
-
- Opal.brk(nil, $brk)
- } else {
- return nil
- };
- };}, $$71.$$s = self, $$71.$$brk = $brk, $$71.$$arity = 1, $$71))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})();}, $$70.$$s = self, $$70.$$brk = $brk, $$70.$$arity = 1, $$70))
- } catch (err) { if (err === $brk) { return err.$v } else { throw err } }})()
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
-
- self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()})));
- return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]");
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };;
- self.$shift();
- if ($truthy(inc_offset)) {
-
-
- $writer = ["partial-option", ""];
- $send(parsed_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);};
- } else if ($truthy(inc_tags)) {
-
- $a = [[], nil, 0, [], $$$('::', 'Set').$new(), nil], (inc_lines = $a[0]), (inc_offset = $a[1]), (inc_lineno = $a[2]), (tag_stack = $a[3]), (tags_used = $a[4]), (active_tag = $a[5]), $a;
- if ($truthy(inc_tags['$key?']("**"))) {
- if ($truthy(inc_tags['$key?']("*"))) {
-
- select = (base_select = inc_tags.$delete("**"));
- wildcard = inc_tags.$delete("*");
- } else {
- select = (base_select = (wildcard = inc_tags.$delete("**")))
- }
- } else if ($truthy(inc_tags['$key?']("*"))) {
- select = (base_select = (wildcard = inc_tags.$delete("*"))['$!']())
- } else {
- select = (base_select = false)
- };
-
- try {
- $send(reader, 'call', [inc_path, read_mode], ($$72 = function(f){var self = $$72.$$s || this, $c, $$73, dbl_co = nil, dbl_sb = nil;
-
-
-
- if (f == null) {
- f = nil;
- };
- $c = ["::", "[]"], (dbl_co = $c[0]), (dbl_sb = $c[1]), $c;
- return $send(f, 'each_line', [], ($$73 = function(l){var self = $$73.$$s || this, $d, $e, $$74, this_tag = nil, include_cursor = nil, idx = nil;
-
-
-
- if (l == null) {
- l = nil;
- };
- inc_lineno = $rb_plus(inc_lineno, 1);
- if ($truthy(($truthy($d = ($truthy($e = l['$include?'](dbl_co)) ? l['$include?'](dbl_sb) : $e)) ? $$($nesting, 'TagDirectiveRx')['$=~'](l) : $d))) {
-
- this_tag = (($d = $gvars['~']) === nil ? nil : $d['$[]'](2));
- if ($truthy((($d = $gvars['~']) === nil ? nil : $d['$[]'](1)))) {
- if (this_tag['$=='](active_tag)) {
-
- tag_stack.$pop();
- return $e = (function() {if ($truthy(tag_stack['$empty?']())) {
- return [nil, base_select]
- } else {
- return tag_stack['$[]'](-1)
- }; return nil; })(), $d = Opal.to_ary($e), (active_tag = ($d[0] == null ? nil : $d[0])), (select = ($d[1] == null ? nil : $d[1])), $e;
- } else if ($truthy(inc_tags['$key?'](this_tag))) {
-
- include_cursor = self.$create_include_cursor(inc_path, expanded_target, inc_lineno);
- if ($truthy((idx = $send(tag_stack, 'rindex', [], ($$74 = function(key){var self = $$74.$$s || this;
-
-
-
- if (key == null) {
- key = nil;
- };
- return key['$=='](this_tag);}, $$74.$$s = self, $$74.$$arity = 1, $$74.$$has_trailing_comma_in_args = true, $$74))))) {
-
- if (idx['$=='](0)) {
- tag_stack.$shift()
- } else {
-
- tag_stack.$delete_at(idx);
- };
- return self.$logger().$warn(self.$message_with_context("" + "mismatched end tag (expected '" + (active_tag) + "' but found '" + (this_tag) + "') at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor})));
- } else {
- return self.$logger().$warn(self.$message_with_context("" + "unexpected end tag '" + (this_tag) + "' at line " + (inc_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": include_cursor})))
- };
- } else {
- return nil
- }
- } else if ($truthy(inc_tags['$key?'](this_tag))) {
-
- tags_used['$<<'](this_tag);
- return tag_stack['$<<']([(active_tag = this_tag), (select = inc_tags['$[]'](this_tag)), inc_lineno]);
- } else if ($truthy(wildcard['$nil?']()['$!']())) {
-
- select = (function() {if ($truthy(($truthy($d = active_tag) ? select['$!']() : $d))) {
- return false
- } else {
- return wildcard
- }; return nil; })();
- return tag_stack['$<<']([(active_tag = this_tag), select, inc_lineno]);
- } else {
- return nil
- };
- } else if ($truthy(select)) {
-
- inc_offset = ($truthy($d = inc_offset) ? $d : inc_lineno);
- return inc_lines['$<<'](l);
- } else {
- return nil
- };}, $$73.$$s = self, $$73.$$arity = 1, $$73));}, $$72.$$s = self, $$72.$$arity = 1, $$72))
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
-
- self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()})));
- return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]");
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };;
- if ($truthy(tag_stack['$empty?']())) {
- } else {
- $send(tag_stack, 'each', [], ($$75 = function(tag_name, _, tag_lineno){var self = $$75.$$s || this;
-
-
-
- if (tag_name == null) {
- tag_name = nil;
- };
-
- if (_ == null) {
- _ = nil;
- };
-
- if (tag_lineno == null) {
- tag_lineno = nil;
- };
- return self.$logger().$warn(self.$message_with_context("" + "detected unclosed tag '" + (tag_name) + "' starting at line " + (tag_lineno) + " of include " + (target_type) + ": " + (inc_path), $hash2(["source_location", "include_location"], {"source_location": self.$cursor(), "include_location": self.$create_include_cursor(inc_path, expanded_target, tag_lineno)})));}, $$75.$$s = self, $$75.$$arity = 3, $$75))
- };
- if ($truthy((missing_tags = $rb_minus(inc_tags.$keys(), tags_used.$to_a()))['$empty?']())) {
- } else {
- self.$logger().$warn(self.$message_with_context("" + "tag" + ((function() {if ($truthy($rb_gt(missing_tags.$size(), 1))) {
- return "s"
- } else {
- return ""
- }; return nil; })()) + " '" + (missing_tags.$join(", ")) + "' not found in include " + (target_type) + ": " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()})))
- };
- self.$shift();
- if ($truthy(inc_offset)) {
-
- if ($truthy(($truthy($a = ($truthy($b = base_select) ? wildcard : $b)) ? inc_tags['$empty?']() : $a))) {
- } else {
-
- $writer = ["partial-option", ""];
- $send(parsed_attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- self.$push_include(inc_lines, inc_path, relpath, inc_offset, parsed_attrs);};
- } else {
-
- try {
-
- inc_content = $send(reader, 'call', [inc_path, read_mode], ($$76 = function(f){var self = $$76.$$s || this;
-
-
-
- if (f == null) {
- f = nil;
- };
- return f.$read();}, $$76.$$s = self, $$76.$$arity = 1, $$76));
- self.$shift();
- self.$push_include(inc_content, inc_path, relpath, 1, parsed_attrs);
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
-
- self.$logger().$error(self.$message_with_context("" + "include " + (target_type) + " not readable: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()})));
- return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (expanded_target) + "[" + (attrlist) + "]");
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- };
- return true;
- } else {
- return nil
- };
- }, $PreprocessorReader_preprocess_include_directive$64.$$arity = 2);
-
- Opal.def(self, '$resolve_include_path', $PreprocessorReader_resolve_include_path$77 = function $$resolve_include_path(target, attrlist, attributes) {
- var $a, $b, $$78, self = this, doc = nil, inc_path = nil, relpath = nil;
-
-
- doc = self.document;
- if ($truthy(($truthy($a = $$($nesting, 'Helpers')['$uriish?'](target)) ? $a : (function() {if ($truthy($$$('::', 'String')['$==='](self.dir))) {
- return nil
- } else {
-
- return (target = "" + (self.dir) + "/" + (target));
- }; return nil; })()))) {
-
- if ($truthy(doc['$attr?']("allow-uri-read"))) {
- } else {
- return self.$replace_next_line("" + "link:" + (target) + "[" + (attrlist) + "]")
- };
- if ($truthy(doc['$attr?']("cache-uri"))) {
- if ($truthy((($b = $$$('::', 'OpenURI', 'skip_raise')) && ($a = $$$($b, 'Cache', 'skip_raise')) ? 'constant' : nil))) {
- } else {
- $$($nesting, 'Helpers').$require_library("open-uri/cached", "open-uri-cached")
- }
- } else if ($truthy($$($nesting, 'RUBY_ENGINE_OPAL')['$!']())) {
- $$$('::', 'OpenURI')};
- return [$$$('::', 'URI').$parse(target), "uri", target];
- } else {
-
- inc_path = doc.$normalize_system_path(target, self.dir, nil, $hash2(["target_name"], {"target_name": "include file"}));
- if ($truthy($$$('::', 'File')['$file?'](inc_path))) {
- } else if ($truthy(attributes['$[]']("optional-option"))) {
-
- $send(self.$logger(), 'info', [], ($$78 = function(){var self = $$78.$$s || this;
-
- return self.$message_with_context("" + "optional include dropped because include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()}))}, $$78.$$s = self, $$78.$$arity = 0, $$78));
- self.$shift();
- return true;
- } else {
-
- self.$logger().$error(self.$message_with_context("" + "include file not found: " + (inc_path), $hash2(["source_location"], {"source_location": self.$cursor()})));
- return self.$replace_next_line("" + "Unresolved directive in " + (self.path) + " - include::" + (target) + "[" + (attrlist) + "]");
- };
- relpath = doc.$path_resolver().$relative_path(inc_path, doc.$base_dir());
- return [inc_path, "file", relpath];
- };
- }, $PreprocessorReader_resolve_include_path$77.$$arity = 3);
-
- Opal.def(self, '$pop_include', $PreprocessorReader_pop_include$79 = function $$pop_include() {
- var $a, $b, self = this;
-
- if ($truthy($rb_gt(self.include_stack.$size(), 0))) {
-
- $b = self.include_stack.$pop(), $a = Opal.to_ary($b), (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])), $b;
- self.look_ahead = 0;
- return nil;
- } else {
- return nil
- }
- }, $PreprocessorReader_pop_include$79.$$arity = 0);
-
- Opal.def(self, '$split_delimited_value', $PreprocessorReader_split_delimited_value$80 = function $$split_delimited_value(val) {
- var self = this;
-
- if ($truthy(val['$include?'](","))) {
-
- return val.$split(",");
- } else {
-
- return val.$split(";");
- }
- }, $PreprocessorReader_split_delimited_value$80.$$arity = 1);
-
- Opal.def(self, '$skip_front_matter!', $PreprocessorReader_skip_front_matter$excl$81 = function(data, increment_linenos) {
- var $a, $b, self = this, front_matter = nil, original_data = nil;
-
-
-
- if (increment_linenos == null) {
- increment_linenos = true;
- };
- front_matter = nil;
- if (data['$[]'](0)['$==']("---")) {
-
- original_data = data.$drop(0);
- data.$shift();
- front_matter = [];
- if ($truthy(increment_linenos)) {
- self.lineno = $rb_plus(self.lineno, 1)};
- while ($truthy(($truthy($b = data['$empty?']()['$!']()) ? data['$[]'](0)['$!=']("---") : $b))) {
-
- front_matter['$<<'](data.$shift());
- if ($truthy(increment_linenos)) {
- self.lineno = $rb_plus(self.lineno, 1)};
- };
- if ($truthy(data['$empty?']())) {
-
- $send(data, 'unshift', Opal.to_a(original_data));
- if ($truthy(increment_linenos)) {
- self.lineno = 0};
- front_matter = nil;
- } else {
-
- data.$shift();
- if ($truthy(increment_linenos)) {
- self.lineno = $rb_plus(self.lineno, 1)};
- };};
- return front_matter;
- }, $PreprocessorReader_skip_front_matter$excl$81.$$arity = -2);
- return (Opal.def(self, '$resolve_expr_val', $PreprocessorReader_resolve_expr_val$82 = function $$resolve_expr_val(val) {
- var $a, $b, self = this, quoted = nil;
-
-
- if ($truthy(($truthy($a = ($truthy($b = val['$start_with?']("\"")) ? val['$end_with?']("\"") : $b)) ? $a : ($truthy($b = val['$start_with?']("'")) ? val['$end_with?']("'") : $b)))) {
-
- quoted = true;
- val = val.$slice(1, $rb_minus(val.$length(), 1));
- } else {
- quoted = false
- };
- if ($truthy(val['$include?']($$($nesting, 'ATTR_REF_HEAD')))) {
- val = self.document.$sub_attributes(val, $hash2(["attribute_missing"], {"attribute_missing": "drop"}))};
- if ($truthy(quoted)) {
- return val
- } else if ($truthy(val['$empty?']())) {
- return nil
- } else if (val['$==']("true")) {
- return true
- } else if (val['$==']("false")) {
- return false
- } else if ($truthy(val.$rstrip()['$empty?']())) {
- return " "
- } else if ($truthy(val['$include?']("."))) {
- return val.$to_f()
- } else {
- return val.$to_i()
- };
- }, $PreprocessorReader_resolve_expr_val$82.$$arity = 1), nil) && 'resolve_expr_val';
- })($nesting[0], $$($nesting, 'Reader'), $nesting);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/section"] = function(Opal) {
- function $rb_plus(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_minus(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, $send = Opal.send, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$attr_accessor', '$attr_reader', '$===', '$+', '$level', '$special', '$generate_id', '$title', '$==', '$>', '$sectnum', '$reftext', '$!', '$empty?', '$sub_placeholder', '$sub_quotes', '$compat_mode', '$[]', '$attributes', '$context', '$assign_numeral', '$class', '$object_id', '$inspect', '$size', '$length', '$chr', '$[]=', '$-', '$gsub', '$downcase', '$delete', '$tr_s', '$end_with?', '$chop', '$start_with?', '$slice', '$key?', '$catalog', '$unique_id_start_index']);
- 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, 'Section');
-
- var $nesting = [self].concat($parent_nesting), $Section_initialize$1, $Section_generate_id$2, $Section_sectnum$3, $Section_xreftext$4, $Section_$lt$lt$5, $Section_to_s$6, $Section_generate_id$7;
-
- self.$$prototype.document = self.$$prototype.level = self.$$prototype.parent = self.$$prototype.numeral = self.$$prototype.numbered = self.$$prototype.sectname = self.$$prototype.title = self.$$prototype.blocks = nil;
-
- self.$attr_accessor("index");
- self.$attr_accessor("sectname");
- self.$attr_accessor("special");
- self.$attr_accessor("numbered");
- self.$attr_reader("caption");
-
- Opal.def(self, '$initialize', $Section_initialize$1 = function $$initialize(parent, level, numbered, opts) {
- var $a, $b, $iter = $Section_initialize$1.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $Section_initialize$1.$$p = null;
-
-
- if (parent == null) {
- parent = nil;
- };
-
- if (level == null) {
- level = nil;
- };
-
- if (numbered == null) {
- numbered = false;
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $Section_initialize$1, false), [parent, "section", opts], null);
- if ($truthy($$($nesting, 'Section')['$==='](parent))) {
- $a = [($truthy($b = level) ? $b : $rb_plus(parent.$level(), 1)), parent.$special()], (self.level = $a[0]), (self.special = $a[1]), $a
- } else {
- $a = [($truthy($b = level) ? $b : 1), false], (self.level = $a[0]), (self.special = $a[1]), $a
- };
- self.numbered = numbered;
- return (self.index = 0);
- }, $Section_initialize$1.$$arity = -1);
- Opal.alias(self, "name", "title");
-
- Opal.def(self, '$generate_id', $Section_generate_id$2 = function $$generate_id() {
- var self = this;
-
- return $$($nesting, 'Section').$generate_id(self.$title(), self.document)
- }, $Section_generate_id$2.$$arity = 0);
-
- Opal.def(self, '$sectnum', $Section_sectnum$3 = function $$sectnum(delimiter, append) {
- var $a, self = this;
-
-
-
- if (delimiter == null) {
- delimiter = ".";
- };
-
- if (append == null) {
- append = nil;
- };
- append = ($truthy($a = append) ? $a : (function() {if (append['$=='](false)) {
- return ""
- } else {
- return delimiter
- }; return nil; })());
- if ($truthy(($truthy($a = $rb_gt(self.level, 1)) ? $$($nesting, 'Section')['$==='](self.parent) : $a))) {
- return "" + (self.parent.$sectnum(delimiter, delimiter)) + (self.numeral) + (append)
- } else {
- return "" + (self.numeral) + (append)
- };
- }, $Section_sectnum$3.$$arity = -1);
-
- Opal.def(self, '$xreftext', $Section_xreftext$4 = function $$xreftext(xrefstyle) {
- var $a, self = this, val = nil, $case = nil, type = nil, quoted_title = nil, signifier = nil;
-
-
-
- if (xrefstyle == null) {
- xrefstyle = nil;
- };
- if ($truthy(($truthy($a = (val = self.$reftext())) ? val['$empty?']()['$!']() : $a))) {
- return val
- } else if ($truthy(xrefstyle)) {
- if ($truthy(self.numbered)) {
- return (function() {$case = xrefstyle;
- if ("full"['$===']($case)) {
- if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) {
- quoted_title = self.$sub_placeholder(self.$sub_quotes("_%s_"), self.$title())
- } else {
- quoted_title = self.$sub_placeholder(self.$sub_quotes((function() {if ($truthy(self.document.$compat_mode())) {
- return "``%s''"
- } else {
- return "\"`%s`\""
- }; return nil; })()), self.$title())
- };
- if ($truthy((signifier = self.document.$attributes()['$[]']("" + (type) + "-refsig")))) {
- return "" + (signifier) + " " + (self.$sectnum(".", ",")) + " " + (quoted_title)
- } else {
- return "" + (self.$sectnum(".", ",")) + " " + (quoted_title)
- };}
- else if ("short"['$===']($case)) {if ($truthy((signifier = self.document.$attributes()['$[]']("" + (self.sectname) + "-refsig")))) {
- return "" + (signifier) + " " + (self.$sectnum(".", ""))
- } else {
- return self.$sectnum(".", "")
- }}
- else {if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) {
-
- return self.$sub_placeholder(self.$sub_quotes("_%s_"), self.$title());
- } else {
- return self.$title()
- }}})()
- } else if ($truthy(($truthy($a = (type = self.sectname)['$==']("chapter")) ? $a : type['$==']("appendix")))) {
-
- return self.$sub_placeholder(self.$sub_quotes("_%s_"), self.$title());
- } else {
- return self.$title()
- }
- } else {
- return self.$title()
- };
- }, $Section_xreftext$4.$$arity = -1);
-
- Opal.def(self, '$<<', $Section_$lt$lt$5 = function(block) {
- var $iter = $Section_$lt$lt$5.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Section_$lt$lt$5.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
- if (block.$context()['$==']("section")) {
- self.$assign_numeral(block)};
- return $send(self, Opal.find_super_dispatcher(self, '<<', $Section_$lt$lt$5, false), $zuper, $iter);
- }, $Section_$lt$lt$5.$$arity = 1);
-
- Opal.def(self, '$to_s', $Section_to_s$6 = function $$to_s() {
- var $iter = $Section_to_s$6.$$p, $yield = $iter || nil, self = this, formal_title = nil, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Section_to_s$6.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- if ($truthy(self.title)) {
-
- formal_title = (function() {if ($truthy(self.numbered)) {
- return "" + (self.$sectnum()) + " " + (self.title)
- } else {
- return self.title
- }; return nil; })();
- return "" + "#<" + (self.$class()) + "@" + (self.$object_id()) + " {level: " + (self.level) + ", title: " + (formal_title.$inspect()) + ", blocks: " + (self.blocks.$size()) + "}>";
- } else {
- return $send(self, Opal.find_super_dispatcher(self, 'to_s', $Section_to_s$6, false), $zuper, $iter)
- }
- }, $Section_to_s$6.$$arity = 0);
- return (Opal.defs(self, '$generate_id', $Section_generate_id$7 = function $$generate_id(title, document) {
- var $a, $b, self = this, attrs = nil, pre = nil, sep = nil, no_sep = nil, $writer = nil, sep_sub = nil, gen_id = nil, ids = nil, cnt = nil, candidate_id = nil;
-
-
- attrs = document.$attributes();
- pre = ($truthy($a = attrs['$[]']("idprefix")) ? $a : "_");
- if ($truthy((sep = attrs['$[]']("idseparator")))) {
- if ($truthy(($truthy($a = sep.$length()['$=='](1)) ? $a : ($truthy($b = (no_sep = sep['$empty?']())['$!']()) ? (sep = (($writer = ["idseparator", sep.$chr()]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)])) : $b)))) {
- sep_sub = (function() {if ($truthy(($truthy($a = sep['$==']("-")) ? $a : sep['$=='](".")))) {
- return " .-"
- } else {
- return "" + " " + (sep) + ".-"
- }; return nil; })()}
- } else {
- $a = ["_", " _.-"], (sep = $a[0]), (sep_sub = $a[1]), $a
- };
- gen_id = "" + (pre) + (title.$downcase().$gsub($$($nesting, 'InvalidSectionIdCharsRx'), ""));
- if ($truthy(no_sep)) {
- gen_id = gen_id.$delete(" ")
- } else {
-
- gen_id = gen_id.$tr_s(sep_sub, sep);
- if ($truthy(gen_id['$end_with?'](sep))) {
- gen_id = gen_id.$chop()};
- if ($truthy(($truthy($a = pre['$empty?']()) ? gen_id['$start_with?'](sep) : $a))) {
- gen_id = gen_id.$slice(1, gen_id.$length())};
- };
- if ($truthy(document.$catalog()['$[]']("refs")['$key?'](gen_id))) {
-
- ids = document.$catalog()['$[]']("refs");
- cnt = $$($nesting, 'Compliance').$unique_id_start_index();
- while ($truthy(ids['$[]']((candidate_id = "" + (gen_id) + (sep) + (cnt))))) {
- cnt = $rb_plus(cnt, 1)
- };
- return candidate_id;
- } else {
- return gen_id
- };
- }, $Section_generate_id$7.$$arity = 2), nil) && 'generate_id';
- })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/stylesheets"] = function(Opal) {
- 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, $truthy = Opal.truthy, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$join', '$new', '$rstrip', '$read', '$primary_stylesheet_data', '$write', '$primary_stylesheet_name', '$stylesheet_basename', '$for', '$read_stylesheet', '$coderay_stylesheet_data', '$coderay_stylesheet_name', '$pygments_stylesheet_data', '$pygments_stylesheet_name']);
- 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, 'Stylesheets');
-
- var $nesting = [self].concat($parent_nesting), $Stylesheets_instance$1, $Stylesheets_primary_stylesheet_name$2, $Stylesheets_primary_stylesheet_data$3, $Stylesheets_embed_primary_stylesheet$4, $Stylesheets_write_primary_stylesheet$5, $Stylesheets_coderay_stylesheet_name$6, $Stylesheets_coderay_stylesheet_data$7, $Stylesheets_embed_coderay_stylesheet$8, $Stylesheets_write_coderay_stylesheet$9, $Stylesheets_pygments_stylesheet_name$10, $Stylesheets_pygments_stylesheet_data$11, $Stylesheets_embed_pygments_stylesheet$12, $Stylesheets_write_pygments_stylesheet$13;
-
- self.$$prototype.primary_stylesheet_data = nil;
-
- Opal.const_set($nesting[0], 'DEFAULT_STYLESHEET_NAME', "asciidoctor.css");
- Opal.const_set($nesting[0], 'STYLESHEETS_DIR', $$$('::', 'File').$join($$($nesting, 'DATA_DIR'), "stylesheets"));
- self.__instance__ = self.$new();
- Opal.defs(self, '$instance', $Stylesheets_instance$1 = function $$instance() {
- var self = this;
- if (self.__instance__ == null) self.__instance__ = nil;
-
- return self.__instance__
- }, $Stylesheets_instance$1.$$arity = 0);
-
- Opal.def(self, '$primary_stylesheet_name', $Stylesheets_primary_stylesheet_name$2 = function $$primary_stylesheet_name() {
- var self = this;
-
- return $$($nesting, 'DEFAULT_STYLESHEET_NAME')
- }, $Stylesheets_primary_stylesheet_name$2.$$arity = 0);
-
- Opal.def(self, '$primary_stylesheet_data', $Stylesheets_primary_stylesheet_data$3 = function $$primary_stylesheet_data() {
- var $a, self = this;
-
- return (self.primary_stylesheet_data = ($truthy($a = self.primary_stylesheet_data) ? $a : $$$('::', 'File').$read($$$('::', 'File').$join($$($nesting, 'STYLESHEETS_DIR'), "asciidoctor-default.css"), $hash2(["mode"], {"mode": $$($nesting, 'FILE_READ_MODE')})).$rstrip()))
- }, $Stylesheets_primary_stylesheet_data$3.$$arity = 0);
-
- Opal.def(self, '$embed_primary_stylesheet', $Stylesheets_embed_primary_stylesheet$4 = function $$embed_primary_stylesheet() {
- var self = this;
-
- return "" + ""
- }, $Stylesheets_embed_primary_stylesheet$4.$$arity = 0);
-
- Opal.def(self, '$write_primary_stylesheet', $Stylesheets_write_primary_stylesheet$5 = function $$write_primary_stylesheet(target_dir) {
- var self = this;
-
-
-
- if (target_dir == null) {
- target_dir = ".";
- };
- return $$$('::', 'File').$write($$$('::', 'File').$join(target_dir, self.$primary_stylesheet_name()), self.$primary_stylesheet_data(), $hash2(["mode"], {"mode": $$($nesting, 'FILE_WRITE_MODE')}));
- }, $Stylesheets_write_primary_stylesheet$5.$$arity = -1);
-
- Opal.def(self, '$coderay_stylesheet_name', $Stylesheets_coderay_stylesheet_name$6 = function $$coderay_stylesheet_name() {
- var self = this;
-
- return $$($nesting, 'SyntaxHighlighter').$for("coderay").$stylesheet_basename()
- }, $Stylesheets_coderay_stylesheet_name$6.$$arity = 0);
-
- Opal.def(self, '$coderay_stylesheet_data', $Stylesheets_coderay_stylesheet_data$7 = function $$coderay_stylesheet_data() {
- var self = this;
-
- return $$($nesting, 'SyntaxHighlighter').$for("coderay").$read_stylesheet()
- }, $Stylesheets_coderay_stylesheet_data$7.$$arity = 0);
-
- Opal.def(self, '$embed_coderay_stylesheet', $Stylesheets_embed_coderay_stylesheet$8 = function $$embed_coderay_stylesheet() {
- var self = this;
-
- return "" + ""
- }, $Stylesheets_embed_coderay_stylesheet$8.$$arity = 0);
-
- Opal.def(self, '$write_coderay_stylesheet', $Stylesheets_write_coderay_stylesheet$9 = function $$write_coderay_stylesheet(target_dir) {
- var self = this;
-
-
-
- if (target_dir == null) {
- target_dir = ".";
- };
- return $$$('::', 'File').$write($$$('::', 'File').$join(target_dir, self.$coderay_stylesheet_name()), self.$coderay_stylesheet_data(), $hash2(["mode"], {"mode": $$($nesting, 'FILE_WRITE_MODE')}));
- }, $Stylesheets_write_coderay_stylesheet$9.$$arity = -1);
-
- Opal.def(self, '$pygments_stylesheet_name', $Stylesheets_pygments_stylesheet_name$10 = function $$pygments_stylesheet_name(style) {
- var self = this;
-
-
-
- if (style == null) {
- style = nil;
- };
- return $$($nesting, 'SyntaxHighlighter').$for("pygments").$stylesheet_basename(style);
- }, $Stylesheets_pygments_stylesheet_name$10.$$arity = -1);
-
- Opal.def(self, '$pygments_stylesheet_data', $Stylesheets_pygments_stylesheet_data$11 = function $$pygments_stylesheet_data(style) {
- var self = this;
-
-
-
- if (style == null) {
- style = nil;
- };
- return $$($nesting, 'SyntaxHighlighter').$for("pygments").$read_stylesheet(style);
- }, $Stylesheets_pygments_stylesheet_data$11.$$arity = -1);
-
- Opal.def(self, '$embed_pygments_stylesheet', $Stylesheets_embed_pygments_stylesheet$12 = function $$embed_pygments_stylesheet(style) {
- var self = this;
-
-
-
- if (style == null) {
- style = nil;
- };
- return "" + "";
- }, $Stylesheets_embed_pygments_stylesheet$12.$$arity = -1);
- return (Opal.def(self, '$write_pygments_stylesheet', $Stylesheets_write_pygments_stylesheet$13 = function $$write_pygments_stylesheet(target_dir, style) {
- var self = this;
-
-
-
- if (target_dir == null) {
- target_dir = ".";
- };
-
- if (style == null) {
- style = nil;
- };
- return $$$('::', 'File').$write($$$('::', 'File').$join(target_dir, self.$pygments_stylesheet_name(style)), self.$pygments_stylesheet_data(style), $hash2(["mode"], {"mode": $$($nesting, 'FILE_WRITE_MODE')}));
- }, $Stylesheets_write_pygments_stylesheet$13.$$arity = -1), nil) && 'write_pygments_stylesheet';
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/table"] = function(Opal) {
- function $rb_gt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs > rhs : lhs['$>'](rhs);
- }
- function $rb_lt(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_times(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs * rhs : lhs['$*'](rhs);
- }
- function $rb_divide(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);
- }
- 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, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$attr_accessor', '$attr_reader', '$new', '$[]', '$>', '$to_i', '$<', '$==', '$[]=', '$-', '$attributes', '$truncate', '$*', '$/', '$to_f', '$empty?', '$body', '$each', '$<<', '$size', '$+', '$assign_column_widths', '$warn', '$logger', '$update_attributes', '$assign_width', '$round', '$map', '$shift', '$reinitialize', '$head=', '$nil?', '$unshift', '$pop', '$foot=', '$parent', '$sourcemap', '$dup', '$header_row?', '$table', '$style', '$merge', '$delete', '$start_with?', '$rstrip', '$slice', '$length', '$advance', '$lstrip', '$strip', '$split', '$include?', '$readlines', '$catalog_inline_anchor', '$=~', '$apply_subs', '$convert', '$text', '$!=', '$file', '$lineno', '$to_s', '$include', '$to_set', '$mark', '$key?', '$nested?', '$document', '$error', '$message_with_context', '$cursor_at_prev_line', '$nil_or_empty?', '$escape', '$columns', '$match', '$chop', '$end_with?', '$gsub', '$!', '$push_cellspec', '$cell_open?', '$close_cell', '$take_cellspec', '$squeeze', '$upto', '$times', '$cursor_before_mark', '$rowspan', '$activate_rowspan', '$colspan', '$end_of_row?', '$close_row', '$private', '$rows', '$effective_column_visits']);
- 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, 'Table');
-
- var $nesting = [self].concat($parent_nesting), $Table_initialize$4, $Table_header_row$ques$5, $Table_create_columns$6, $Table_assign_column_widths$8, $Table_partition_header_footer$12;
-
- self.$$prototype.attributes = self.$$prototype.document = self.$$prototype.has_header_option = self.$$prototype.rows = self.$$prototype.columns = nil;
-
- Opal.const_set($nesting[0], 'DEFAULT_PRECISION', 4);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Rows');
-
- var $nesting = [self].concat($parent_nesting), $Rows_initialize$1, $Rows_by_section$2, $Rows_to_h$3;
-
- self.$$prototype.head = self.$$prototype.body = self.$$prototype.foot = nil;
-
- self.$attr_accessor("head", "foot", "body");
-
- Opal.def(self, '$initialize', $Rows_initialize$1 = function $$initialize(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);
- }, $Rows_initialize$1.$$arity = -1);
- Opal.alias(self, "[]", "send");
-
- Opal.def(self, '$by_section', $Rows_by_section$2 = function $$by_section() {
- var self = this;
-
- return [["head", self.head], ["body", self.body], ["foot", self.foot]]
- }, $Rows_by_section$2.$$arity = 0);
- return (Opal.def(self, '$to_h', $Rows_to_h$3 = function $$to_h() {
- var self = this;
-
- return $hash2(["head", "body", "foot"], {"head": self.head, "body": self.body, "foot": self.foot})
- }, $Rows_to_h$3.$$arity = 0), nil) && 'to_h';
- })($nesting[0], null, $nesting);
- self.$attr_accessor("columns");
- self.$attr_accessor("rows");
- self.$attr_accessor("has_header_option");
- self.$attr_reader("caption");
-
- Opal.def(self, '$initialize', $Table_initialize$4 = function $$initialize(parent, attributes) {
- var $a, $b, $iter = $Table_initialize$4.$$p, $yield = $iter || nil, self = this, pcwidth = nil, pcwidth_intval = nil, $writer = nil, abswidth_val = nil;
-
- if ($iter) $Table_initialize$4.$$p = null;
-
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $Table_initialize$4, false), [parent, "table"], null);
- self.rows = $$($nesting, 'Rows').$new();
- self.columns = [];
- self.has_header_option = false;
- if ($truthy((pcwidth = attributes['$[]']("width")))) {
- if ($truthy(($truthy($a = $rb_gt((pcwidth_intval = pcwidth.$to_i()), 100)) ? $a : $rb_lt(pcwidth_intval, 1)))) {
- if ($truthy((($a = pcwidth_intval['$=='](0)) ? ($truthy($b = pcwidth['$==']("0")) ? $b : pcwidth['$==']("0%")) : pcwidth_intval['$=='](0)))) {
- } else {
- pcwidth_intval = 100
- }}
- } else {
- pcwidth_intval = 100
- };
-
- $writer = ["tablepcwidth", pcwidth_intval];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(self.document.$attributes()['$[]']("pagewidth"))) {
-
- $writer = ["tableabswidth", (function() {if ((abswidth_val = $rb_times($rb_divide(pcwidth_intval, 100), self.document.$attributes()['$[]']("pagewidth").$to_f()).$truncate($$($nesting, 'DEFAULT_PRECISION')))['$=='](abswidth_val.$to_i())) {
- return abswidth_val.$to_i()
- } else {
- return abswidth_val
- }; return nil; })()];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(attributes['$[]']("rotate-option"))) {
-
- $writer = ["orientation", "landscape"];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- } else {
- return nil
- };
- }, $Table_initialize$4.$$arity = 2);
-
- Opal.def(self, '$header_row?', $Table_header_row$ques$5 = function() {
- var $a, self = this, val = nil;
-
- if ($truthy(($truthy($a = (val = self.has_header_option)) ? self.rows.$body()['$empty?']() : $a))) {
- return val
- } else {
- return nil
- }
- }, $Table_header_row$ques$5.$$arity = 0);
-
- Opal.def(self, '$create_columns', $Table_create_columns$6 = function $$create_columns(colspecs) {
- var $$7, $a, self = this, cols = nil, autowidth_cols = nil, width_base = nil, num_cols = nil, $writer = nil;
-
-
- cols = [];
- autowidth_cols = nil;
- width_base = 0;
- $send(colspecs, 'each', [], ($$7 = function(colspec){var self = $$7.$$s || this, $a, colwidth = nil;
-
-
-
- if (colspec == null) {
- colspec = nil;
- };
- colwidth = colspec['$[]']("width");
- cols['$<<']($$($nesting, 'Column').$new(self, cols.$size(), colspec));
- if ($truthy($rb_lt(colwidth, 0))) {
- return (autowidth_cols = ($truthy($a = autowidth_cols) ? $a : []))['$<<'](cols['$[]'](-1))
- } else {
- return (width_base = $rb_plus(width_base, colwidth))
- };}, $$7.$$s = self, $$7.$$arity = 1, $$7));
- if ($truthy($rb_gt((num_cols = (self.columns = cols).$size()), 0))) {
-
-
- $writer = ["colcount", num_cols];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- if ($truthy(($truthy($a = $rb_gt(width_base, 0)) ? $a : autowidth_cols))) {
- } else {
- width_base = nil
- };
- self.$assign_column_widths(width_base, autowidth_cols);};
- return nil;
- }, $Table_create_columns$6.$$arity = 1);
-
- Opal.def(self, '$assign_column_widths', $Table_assign_column_widths$8 = function $$assign_column_widths(width_base, autowidth_cols) {
- var $$9, $$10, $$11, self = this, precision = nil, total_width = nil, col_pcwidth = nil, autowidth = nil, autowidth_attrs = nil;
-
-
-
- if (width_base == null) {
- width_base = nil;
- };
-
- if (autowidth_cols == null) {
- autowidth_cols = nil;
- };
- precision = $$($nesting, 'DEFAULT_PRECISION');
- total_width = (col_pcwidth = 0);
- if ($truthy(width_base)) {
-
- if ($truthy(autowidth_cols)) {
-
- if ($truthy($rb_gt(width_base, 100))) {
-
- autowidth = 0;
- self.$logger().$warn("" + "total column width must not exceed 100% when using autowidth columns; got " + (width_base) + "%");
- } else {
-
- autowidth = $rb_divide($rb_minus(100, width_base), autowidth_cols.$size()).$truncate(precision);
- if (autowidth.$to_i()['$=='](autowidth)) {
- autowidth = autowidth.$to_i()};
- width_base = 100;
- };
- autowidth_attrs = $hash2(["width", "autowidth-option"], {"width": autowidth, "autowidth-option": ""});
- $send(autowidth_cols, 'each', [], ($$9 = function(col){var self = $$9.$$s || this;
-
-
-
- if (col == null) {
- col = nil;
- };
- return col.$update_attributes(autowidth_attrs);}, $$9.$$s = self, $$9.$$arity = 1, $$9));};
- $send(self.columns, 'each', [], ($$10 = function(col){var self = $$10.$$s || this;
-
-
-
- if (col == null) {
- col = nil;
- };
- return (total_width = $rb_plus(total_width, (col_pcwidth = col.$assign_width(nil, width_base, precision))));}, $$10.$$s = self, $$10.$$arity = 1, $$10));
- } else {
-
- col_pcwidth = $rb_divide(100, self.columns.$size()).$truncate(precision);
- if (col_pcwidth.$to_i()['$=='](col_pcwidth)) {
- col_pcwidth = col_pcwidth.$to_i()};
- $send(self.columns, 'each', [], ($$11 = function(col){var self = $$11.$$s || this;
-
-
-
- if (col == null) {
- col = nil;
- };
- return (total_width = $rb_plus(total_width, col.$assign_width(col_pcwidth, nil, precision)));}, $$11.$$s = self, $$11.$$arity = 1, $$11));
- };
- if (total_width['$=='](100)) {
- } else {
- self.columns['$[]'](-1).$assign_width($rb_plus($rb_minus(100, total_width), col_pcwidth).$round(precision), nil, precision)
- };
- return nil;
- }, $Table_assign_column_widths$8.$$arity = -1);
- return (Opal.def(self, '$partition_header_footer', $Table_partition_header_footer$12 = function $$partition_header_footer(attrs) {
- var $$13, $$14, $a, self = this, num_body_rows = nil, $writer = nil, body = nil;
-
-
- num_body_rows = (($writer = ["rowcount", (body = self.rows.$body()).$size()]), $send(self.attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]);
- if ($truthy($rb_gt(num_body_rows, 0))) {
- if ($truthy(self.has_header_option)) {
-
-
- $writer = [[$send(body.$shift(), 'map', [], ($$13 = function(cell){var self = $$13.$$s || this;
-
-
-
- if (cell == null) {
- cell = nil;
- };
- return cell.$reinitialize(true);}, $$13.$$s = self, $$13.$$arity = 1, $$13))]];
- $send(self.rows, 'head=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- num_body_rows = $rb_minus(num_body_rows, 1);
- } else if ($truthy(self.has_header_option['$nil?']())) {
-
- self.has_header_option = false;
- body.$unshift($send(body.$shift(), 'map', [], ($$14 = function(cell){var self = $$14.$$s || this;
-
-
-
- if (cell == null) {
- cell = nil;
- };
- return cell.$reinitialize(false);}, $$14.$$s = self, $$14.$$arity = 1, $$14)));}};
- if ($truthy(($truthy($a = $rb_gt(num_body_rows, 0)) ? attrs['$[]']("footer-option") : $a))) {
-
- $writer = [[body.$pop()]];
- $send(self.rows, 'foot=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return nil;
- }, $Table_partition_header_footer$12.$$arity = 1), nil) && 'partition_header_footer';
- })($nesting[0], $$($nesting, 'AbstractBlock'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Column');
-
- var $nesting = [self].concat($parent_nesting), $Column_initialize$15, $Column_assign_width$16, $Column_block$ques$17, $Column_inline$ques$18;
-
- self.$$prototype.attributes = nil;
-
- self.$attr_accessor("style");
-
- Opal.def(self, '$initialize', $Column_initialize$15 = function $$initialize(table, index, attributes) {
- var $a, $iter = $Column_initialize$15.$$p, $yield = $iter || nil, self = this, $writer = nil;
-
- if ($iter) $Column_initialize$15.$$p = null;
-
-
- if (attributes == null) {
- attributes = $hash2([], {});
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $Column_initialize$15, false), [table, "table_column"], null);
- self.style = attributes['$[]']("style");
-
- $writer = ["colnumber", $rb_plus(index, 1)];
- $send(attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- ($truthy($a = attributes['$[]']("width")) ? $a : (($writer = ["width", 1]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- ($truthy($a = attributes['$[]']("halign")) ? $a : (($writer = ["halign", "left"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- ($truthy($a = attributes['$[]']("valign")) ? $a : (($writer = ["valign", "top"]), $send(attributes, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- return self.$update_attributes(attributes);
- }, $Column_initialize$15.$$arity = -3);
- Opal.alias(self, "table", "parent");
-
- Opal.def(self, '$assign_width', $Column_assign_width$16 = function $$assign_width(col_pcwidth, width_base, precision) {
- var self = this, $writer = nil, col_abswidth = nil;
-
-
- if ($truthy(width_base)) {
-
- col_pcwidth = $rb_divide($rb_times(self.attributes['$[]']("width").$to_f(), 100), width_base).$truncate(precision);
- if (col_pcwidth.$to_i()['$=='](col_pcwidth)) {
- col_pcwidth = col_pcwidth.$to_i()};};
- if ($truthy(self.$parent().$attributes()['$[]']("tableabswidth"))) {
-
- $writer = ["colabswidth", (function() {if ((col_abswidth = $rb_times($rb_divide(col_pcwidth, 100), self.$parent().$attributes()['$[]']("tableabswidth")).$truncate(precision))['$=='](col_abswidth.$to_i())) {
- return col_abswidth.$to_i()
- } else {
- return col_abswidth
- }; return nil; })()];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
-
- $writer = ["colpcwidth", col_pcwidth];
- $send(self.attributes, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;
- }, $Column_assign_width$16.$$arity = 3);
-
- Opal.def(self, '$block?', $Column_block$ques$17 = function() {
- var self = this;
-
- return false
- }, $Column_block$ques$17.$$arity = 0);
- return (Opal.def(self, '$inline?', $Column_inline$ques$18 = function() {
- var self = this;
-
- return false
- }, $Column_inline$ques$18.$$arity = 0), nil) && 'inline?';
- })($$($nesting, 'Table'), $$($nesting, 'AbstractNode'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Cell');
-
- var $nesting = [self].concat($parent_nesting), $Cell_initialize$19, $Cell_reinitialize$20, $Cell_catalog_inline_anchor$21, $Cell_text$22, $Cell_text$eq$23, $Cell_content$24, $Cell_lines$26, $Cell_source$27, $Cell_file$28, $Cell_lineno$29, $Cell_to_s$30;
-
- self.$$prototype.document = self.$$prototype.reinitialize_args = self.$$prototype.attributes = self.$$prototype.cursor = self.$$prototype.text = self.$$prototype.subs = self.$$prototype.style = self.$$prototype.inner_document = self.$$prototype.source_location = self.$$prototype.colspan = self.$$prototype.rowspan = nil;
-
- Opal.const_set($nesting[0], 'DOUBLE_LF', $rb_times($$($nesting, 'LF'), 2));
- self.$attr_accessor("colspan");
- self.$attr_accessor("rowspan");
- Opal.alias(self, "column", "parent");
- self.$attr_reader("inner_document");
-
- Opal.def(self, '$initialize', $Cell_initialize$19 = function $$initialize(column, cell_text, attributes, opts) {
- var $a, $b, $c, $iter = $Cell_initialize$19.$$p, $yield = $iter || nil, self = this, in_header_row = nil, cell_style = nil, asciidoc = nil, inner_document_cursor = nil, lines_advanced = nil, literal = nil, normal_psv = nil, parent_doctitle = nil, inner_document_lines = nil, unprocessed_line1 = nil, preprocessed_lines = nil, $writer = nil;
-
- if ($iter) $Cell_initialize$19.$$p = null;
-
-
- if (attributes == null) {
- attributes = $hash2([], {});
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $Cell_initialize$19, false), [column, "table_cell"], null);
- self.cursor = (self.reinitialize_args = nil);
- if ($truthy(self.document.$sourcemap())) {
- self.source_location = opts['$[]']("cursor").$dup()};
- if ($truthy(column)) {
-
- if ($truthy((in_header_row = column.$table()['$header_row?']()))) {
- if ($truthy((($a = in_header_row['$==']("implicit")) ? (cell_style = ($truthy($b = column.$style()) ? $b : ($truthy($c = attributes) ? attributes['$[]']("style") : $c))) : in_header_row['$==']("implicit")))) {
-
- if ($truthy(($truthy($a = cell_style['$==']("asciidoc")) ? $a : cell_style['$==']("literal")))) {
- self.reinitialize_args = [column, cell_text, ($truthy($a = attributes) ? attributes.$merge() : $a), opts]};
- cell_style = nil;}
- } else {
- cell_style = column.$style()
- };
- self.$update_attributes(column.$attributes());};
- if ($truthy(attributes)) {
-
- if ($truthy(attributes['$empty?']())) {
- self.colspan = (self.rowspan = nil)
- } else {
-
- $a = [attributes.$delete("colspan"), attributes.$delete("rowspan")], (self.colspan = $a[0]), (self.rowspan = $a[1]), $a;
- if ($truthy(in_header_row)) {
- } else {
- cell_style = ($truthy($a = attributes['$[]']("style")) ? $a : cell_style)
- };
- self.$update_attributes(attributes);
- };
- if (cell_style['$==']("asciidoc")) {
-
- asciidoc = true;
- inner_document_cursor = opts['$[]']("cursor");
- if ($truthy((cell_text = cell_text.$rstrip())['$start_with?']($$($nesting, 'LF')))) {
-
- lines_advanced = 1;
- while ($truthy((cell_text = cell_text.$slice(1, cell_text.$length()))['$start_with?']($$($nesting, 'LF')))) {
- lines_advanced = $rb_plus(lines_advanced, 1)
- };
- inner_document_cursor.$advance(lines_advanced);
- } else {
- cell_text = cell_text.$lstrip()
- };
- } else if (cell_style['$==']("literal")) {
-
- literal = true;
- cell_text = cell_text.$rstrip();
- while ($truthy(cell_text['$start_with?']($$($nesting, 'LF')))) {
- cell_text = cell_text.$slice(1, cell_text.$length())
- };
- } else {
-
- normal_psv = true;
- cell_text = (function() {if ($truthy(cell_text)) {
- return cell_text.$strip()
- } else {
- return ""
- }; return nil; })();
- };
- } else {
-
- self.colspan = (self.rowspan = nil);
- if (cell_style['$==']("asciidoc")) {
-
- asciidoc = true;
- inner_document_cursor = opts['$[]']("cursor");};
- };
- if ($truthy(asciidoc)) {
-
- parent_doctitle = self.document.$attributes().$delete("doctitle");
- inner_document_lines = cell_text.$split($$($nesting, 'LF'), -1);
- if ($truthy(inner_document_lines['$empty?']())) {
- } else if ($truthy((unprocessed_line1 = inner_document_lines['$[]'](0))['$include?']("::"))) {
-
- preprocessed_lines = $$($nesting, 'PreprocessorReader').$new(self.document, [unprocessed_line1]).$readlines();
- if ($truthy((($a = unprocessed_line1['$=='](preprocessed_lines['$[]'](0))) ? $rb_lt(preprocessed_lines.$size(), 2) : unprocessed_line1['$=='](preprocessed_lines['$[]'](0))))) {
- } else {
-
- inner_document_lines.$shift();
- if ($truthy(preprocessed_lines['$empty?']())) {
- } else {
- $send(inner_document_lines, 'unshift', Opal.to_a(preprocessed_lines))
- };
- };};
- self.inner_document = $$($nesting, 'Document').$new(inner_document_lines, $hash2(["standalone", "parent", "cursor"], {"standalone": false, "parent": self.document, "cursor": inner_document_cursor}));
- if ($truthy(parent_doctitle['$nil?']())) {
- } else {
-
- $writer = ["doctitle", parent_doctitle];
- $send(self.document.$attributes(), '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- };
- self.subs = nil;
- } else if ($truthy(literal)) {
-
- self.content_model = "verbatim";
- self.subs = $$($nesting, 'BASIC_SUBS');
- } else {
-
- if ($truthy(normal_psv)) {
- if ($truthy(in_header_row)) {
- self.cursor = opts['$[]']("cursor")
- } else {
- self.$catalog_inline_anchor(cell_text, opts['$[]']("cursor"))
- }};
- self.content_model = "simple";
- self.subs = $$($nesting, 'NORMAL_SUBS');
- };
- self.text = cell_text;
- return (self.style = cell_style);
- }, $Cell_initialize$19.$$arity = -3);
-
- Opal.def(self, '$reinitialize', $Cell_reinitialize$20 = function $$reinitialize(has_header) {
- var self = this;
-
-
- if ($truthy(has_header)) {
- self.reinitialize_args = nil
- } else if ($truthy(self.reinitialize_args)) {
- return $send($$$($$($nesting, 'Table'), 'Cell'), 'new', Opal.to_a(self.reinitialize_args))
- } else {
- self.style = self.attributes['$[]']("style")
- };
- if ($truthy(self.cursor)) {
- self.$catalog_inline_anchor()};
- return self;
- }, $Cell_reinitialize$20.$$arity = 1);
-
- Opal.def(self, '$catalog_inline_anchor', $Cell_catalog_inline_anchor$21 = function $$catalog_inline_anchor(cell_text, cursor) {
- var $a, self = this;
-
-
-
- if (cell_text == null) {
- cell_text = self.text;
- };
-
- if (cursor == null) {
- cursor = nil;
- };
- if ($truthy(cursor)) {
- } else {
- $a = [self.cursor, nil], (cursor = $a[0]), (self.cursor = $a[1]), $a
- };
- if ($truthy(($truthy($a = cell_text['$start_with?']("[[")) ? $$($nesting, 'LeadingInlineAnchorRx')['$=~'](cell_text) : $a))) {
- return $$($nesting, 'Parser').$catalog_inline_anchor((($a = $gvars['~']) === nil ? nil : $a['$[]'](1)), (($a = $gvars['~']) === nil ? nil : $a['$[]'](2)), self, cursor, self.document)
- } else {
- return nil
- };
- }, $Cell_catalog_inline_anchor$21.$$arity = -1);
-
- Opal.def(self, '$text', $Cell_text$22 = function $$text() {
- var self = this;
-
- return self.$apply_subs(self.text, self.subs)
- }, $Cell_text$22.$$arity = 0);
-
- Opal.def(self, '$text=', $Cell_text$eq$23 = function(val) {
- var self = this;
-
- return (self.text = val)
- }, $Cell_text$eq$23.$$arity = 1);
-
- Opal.def(self, '$content', $Cell_content$24 = function $$content() {
- var $$25, $a, self = this, cell_style = nil, subbed_text = nil;
-
- if ((cell_style = self.style)['$==']("asciidoc")) {
- return self.inner_document.$convert()
- } else if ($truthy(self.text['$include?']($$($nesting, 'DOUBLE_LF')))) {
- return $send(self.$text().$split($$($nesting, 'BlankLineRx')), 'map', [], ($$25 = function(para){var self = $$25.$$s || this, $a;
-
-
-
- if (para == null) {
- para = nil;
- };
- if ($truthy(($truthy($a = cell_style) ? cell_style['$!=']("header") : $a))) {
- return $$($nesting, 'Inline').$new(self.$parent(), "quoted", para, $hash2(["type"], {"type": cell_style})).$convert()
- } else {
- return para
- };}, $$25.$$s = self, $$25.$$arity = 1, $$25))
- } else if ($truthy((subbed_text = self.$text())['$empty?']())) {
- return []
- } else if ($truthy(($truthy($a = cell_style) ? cell_style['$!=']("header") : $a))) {
- return [$$($nesting, 'Inline').$new(self.$parent(), "quoted", subbed_text, $hash2(["type"], {"type": cell_style})).$convert()]
- } else {
- return [subbed_text]
- }
- }, $Cell_content$24.$$arity = 0);
-
- Opal.def(self, '$lines', $Cell_lines$26 = function $$lines() {
- var self = this;
-
- return self.text.$split($$($nesting, 'LF'))
- }, $Cell_lines$26.$$arity = 0);
-
- Opal.def(self, '$source', $Cell_source$27 = function $$source() {
- var self = this;
-
- return self.text
- }, $Cell_source$27.$$arity = 0);
-
- Opal.def(self, '$file', $Cell_file$28 = function $$file() {
- var $a, self = this;
-
- return ($truthy($a = self.source_location) ? self.source_location.$file() : $a)
- }, $Cell_file$28.$$arity = 0);
-
- Opal.def(self, '$lineno', $Cell_lineno$29 = function $$lineno() {
- var $a, self = this;
-
- return ($truthy($a = self.source_location) ? self.source_location.$lineno() : $a)
- }, $Cell_lineno$29.$$arity = 0);
- return (Opal.def(self, '$to_s', $Cell_to_s$30 = function $$to_s() {
- var $a, $iter = $Cell_to_s$30.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Cell_to_s$30.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
- return "" + ($send(self, Opal.find_super_dispatcher(self, 'to_s', $Cell_to_s$30, false), $zuper, $iter).$to_s()) + " - [text: " + (self.text) + ", colspan: " + (($truthy($a = self.colspan) ? $a : 1)) + ", rowspan: " + (($truthy($a = self.rowspan) ? $a : 1)) + ", attributes: " + (self.attributes) + "]"
- }, $Cell_to_s$30.$$arity = 0), nil) && 'to_s';
- })($$($nesting, 'Table'), $$($nesting, 'AbstractBlock'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'ParserContext');
-
- var $nesting = [self].concat($parent_nesting), $ParserContext_initialize$31, $ParserContext_starts_with_delimiter$ques$32, $ParserContext_match_delimiter$33, $ParserContext_skip_past_delimiter$34, $ParserContext_skip_past_escaped_delimiter$35, $ParserContext_buffer_has_unclosed_quotes$ques$36, $ParserContext_take_cellspec$37, $ParserContext_push_cellspec$38, $ParserContext_keep_cell_open$39, $ParserContext_mark_cell_closed$40, $ParserContext_cell_open$ques$41, $ParserContext_cell_closed$ques$42, $ParserContext_close_open_cell$43, $ParserContext_close_cell$44, $ParserContext_close_row$47, $ParserContext_activate_rowspan$48, $ParserContext_end_of_row$ques$50, $ParserContext_effective_column_visits$51, $ParserContext_advance$52;
-
- self.$$prototype.delimiter = self.$$prototype.delimiter_rx = self.$$prototype.buffer = self.$$prototype.cellspecs = self.$$prototype.cell_open = self.$$prototype.format = self.$$prototype.start_cursor_data = self.$$prototype.reader = self.$$prototype.table = self.$$prototype.current_row = self.$$prototype.colcount = self.$$prototype.column_visits = self.$$prototype.active_rowspans = self.$$prototype.linenum = nil;
-
- self.$include($$($nesting, 'Logging'));
- Opal.const_set($nesting[0], 'FORMATS', ["psv", "csv", "dsv", "tsv"].$to_set());
- Opal.const_set($nesting[0], 'DELIMITERS', $hash2(["psv", "csv", "dsv", "tsv", "!sv"], {"psv": ["|", /\|/], "csv": [",", /,/], "dsv": [":", /:/], "tsv": ["\t", /\t/], "!sv": ["!", /!/]}));
- self.$attr_accessor("table");
- self.$attr_accessor("format");
- self.$attr_reader("colcount");
- self.$attr_accessor("buffer");
- self.$attr_reader("delimiter");
- self.$attr_reader("delimiter_re");
-
- Opal.def(self, '$initialize', $ParserContext_initialize$31 = function $$initialize(reader, table, attributes) {
- var $a, $b, self = this, xsv = nil, sep = nil;
-
-
-
- if (attributes == null) {
- attributes = $hash2([], {});
- };
- self.start_cursor_data = (self.reader = reader).$mark();
- self.table = table;
- if ($truthy(attributes['$key?']("format"))) {
- if ($truthy($$($nesting, 'FORMATS')['$include?']((xsv = attributes['$[]']("format"))))) {
- if (xsv['$==']("tsv")) {
- self.format = "csv"
- } else if ($truthy((($a = (self.format = xsv)['$==']("psv")) ? table.$document()['$nested?']() : (self.format = xsv)['$==']("psv")))) {
- xsv = "!sv"}
- } else {
-
- self.$logger().$error(self.$message_with_context("" + "illegal table format: " + (xsv), $hash2(["source_location"], {"source_location": reader.$cursor_at_prev_line()})));
- $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) {
- return "!sv"
- } else {
- return "psv"
- }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a;
- }
- } else {
- $a = ["psv", (function() {if ($truthy(table.$document()['$nested?']())) {
- return "!sv"
- } else {
- return "psv"
- }; return nil; })()], (self.format = $a[0]), (xsv = $a[1]), $a
- };
- if ($truthy(attributes['$key?']("separator"))) {
- if ($truthy((sep = attributes['$[]']("separator"))['$nil_or_empty?']())) {
- $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_rx = ($a[1] == null ? nil : $a[1])), $b
- } else if (sep['$==']("\\t")) {
- $b = $$($nesting, 'DELIMITERS')['$[]']("tsv"), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_rx = ($a[1] == null ? nil : $a[1])), $b
- } else {
- $a = [sep, new RegExp($$$('::', 'Regexp').$escape(sep))], (self.delimiter = $a[0]), (self.delimiter_rx = $a[1]), $a
- }
- } else {
- $b = $$($nesting, 'DELIMITERS')['$[]'](xsv), $a = Opal.to_ary($b), (self.delimiter = ($a[0] == null ? nil : $a[0])), (self.delimiter_rx = ($a[1] == null ? nil : $a[1])), $b
- };
- self.colcount = (function() {if ($truthy(table.$columns()['$empty?']())) {
- return -1
- } else {
- return table.$columns().$size()
- }; return nil; })();
- self.buffer = "";
- self.cellspecs = [];
- self.cell_open = false;
- self.active_rowspans = [0];
- self.column_visits = 0;
- self.current_row = [];
- return (self.linenum = -1);
- }, $ParserContext_initialize$31.$$arity = -3);
-
- Opal.def(self, '$starts_with_delimiter?', $ParserContext_starts_with_delimiter$ques$32 = function(line) {
- var self = this;
-
- return line['$start_with?'](self.delimiter)
- }, $ParserContext_starts_with_delimiter$ques$32.$$arity = 1);
-
- Opal.def(self, '$match_delimiter', $ParserContext_match_delimiter$33 = function $$match_delimiter(line) {
- var self = this;
-
- return self.delimiter_rx.$match(line)
- }, $ParserContext_match_delimiter$33.$$arity = 1);
-
- Opal.def(self, '$skip_past_delimiter', $ParserContext_skip_past_delimiter$34 = function $$skip_past_delimiter(pre) {
- var self = this;
-
-
- self.buffer = "" + (self.buffer) + (pre) + (self.delimiter);
- return nil;
- }, $ParserContext_skip_past_delimiter$34.$$arity = 1);
-
- Opal.def(self, '$skip_past_escaped_delimiter', $ParserContext_skip_past_escaped_delimiter$35 = function $$skip_past_escaped_delimiter(pre) {
- var self = this;
-
-
- self.buffer = "" + (self.buffer) + (pre.$chop()) + (self.delimiter);
- return nil;
- }, $ParserContext_skip_past_escaped_delimiter$35.$$arity = 1);
-
- Opal.def(self, '$buffer_has_unclosed_quotes?', $ParserContext_buffer_has_unclosed_quotes$ques$36 = function(append) {
- var $a, $b, self = this, record = nil, trailing_quote = nil;
-
-
-
- if (append == null) {
- append = nil;
- };
- if ((record = (function() {if ($truthy(append)) {
- return $rb_plus(self.buffer, append).$strip()
- } else {
- return self.buffer.$strip()
- }; return nil; })())['$==']("\"")) {
- return true
- } else if ($truthy(record['$start_with?']("\""))) {
- if ($truthy(($truthy($a = ($truthy($b = (trailing_quote = record['$end_with?']("\""))) ? record['$end_with?']("\"\"") : $b)) ? $a : record['$start_with?']("\"\"")))) {
- return ($truthy($a = (record = record.$gsub("\"\"", ""))['$start_with?']("\"")) ? record['$end_with?']("\"")['$!']() : $a)
- } else {
- return trailing_quote['$!']()
- }
- } else {
- return false
- };
- }, $ParserContext_buffer_has_unclosed_quotes$ques$36.$$arity = -1);
-
- Opal.def(self, '$take_cellspec', $ParserContext_take_cellspec$37 = function $$take_cellspec() {
- var self = this;
-
- return self.cellspecs.$shift()
- }, $ParserContext_take_cellspec$37.$$arity = 0);
-
- Opal.def(self, '$push_cellspec', $ParserContext_push_cellspec$38 = function $$push_cellspec(cellspec) {
- var $a, self = this;
-
-
-
- if (cellspec == null) {
- cellspec = $hash2([], {});
- };
- self.cellspecs['$<<'](($truthy($a = cellspec) ? $a : $hash2([], {})));
- return nil;
- }, $ParserContext_push_cellspec$38.$$arity = -1);
-
- Opal.def(self, '$keep_cell_open', $ParserContext_keep_cell_open$39 = function $$keep_cell_open() {
- var self = this;
-
-
- self.cell_open = true;
- return nil;
- }, $ParserContext_keep_cell_open$39.$$arity = 0);
-
- Opal.def(self, '$mark_cell_closed', $ParserContext_mark_cell_closed$40 = function $$mark_cell_closed() {
- var self = this;
-
-
- self.cell_open = false;
- return nil;
- }, $ParserContext_mark_cell_closed$40.$$arity = 0);
-
- Opal.def(self, '$cell_open?', $ParserContext_cell_open$ques$41 = function() {
- var self = this;
-
- return self.cell_open
- }, $ParserContext_cell_open$ques$41.$$arity = 0);
-
- Opal.def(self, '$cell_closed?', $ParserContext_cell_closed$ques$42 = function() {
- var self = this;
-
- return self.cell_open['$!']()
- }, $ParserContext_cell_closed$ques$42.$$arity = 0);
-
- Opal.def(self, '$close_open_cell', $ParserContext_close_open_cell$43 = function $$close_open_cell(next_cellspec) {
- var self = this;
-
-
-
- if (next_cellspec == null) {
- next_cellspec = $hash2([], {});
- };
- self.$push_cellspec(next_cellspec);
- if ($truthy(self['$cell_open?']())) {
- self.$close_cell(true)};
- self.$advance();
- return nil;
- }, $ParserContext_close_open_cell$43.$$arity = -1);
-
- Opal.def(self, '$close_cell', $ParserContext_close_cell$44 = function $$close_cell(eol) {try {
-
- var $a, $b, $$45, self = this, cell_text = nil, cellspec = nil, repeat = nil;
-
-
-
- if (eol == null) {
- eol = false;
- };
- if (self.format['$==']("psv")) {
-
- cell_text = self.buffer;
- self.buffer = "";
- if ($truthy((cellspec = self.$take_cellspec()))) {
- repeat = ($truthy($a = cellspec.$delete("repeatcol")) ? $a : 1)
- } else {
-
- self.$logger().$error(self.$message_with_context("table missing leading separator; recovering automatically", $hash2(["source_location"], {"source_location": $send($$$($$($nesting, 'Reader'), 'Cursor'), 'new', Opal.to_a(self.start_cursor_data))})));
- cellspec = $hash2([], {});
- repeat = 1;
- };
- } else {
-
- cell_text = self.buffer.$strip();
- self.buffer = "";
- cellspec = nil;
- repeat = 1;
- if ($truthy(($truthy($a = (($b = self.format['$==']("csv")) ? cell_text['$empty?']()['$!']() : self.format['$==']("csv"))) ? cell_text['$include?']("\"") : $a))) {
- if ($truthy(($truthy($a = cell_text['$start_with?']("\"")) ? cell_text['$end_with?']("\"") : $a))) {
- if ($truthy((cell_text = cell_text.$slice(1, $rb_minus(cell_text.$length(), 2))))) {
- cell_text = cell_text.$strip().$squeeze("\"")
- } else {
-
- self.$logger().$error(self.$message_with_context("unclosed quote in CSV data; setting cell to empty", $hash2(["source_location"], {"source_location": self.reader.$cursor_at_prev_line()})));
- cell_text = "";
- }
- } else {
- cell_text = cell_text.$squeeze("\"")
- }};
- };
- $send((1), 'upto', [repeat], ($$45 = function(i){var self = $$45.$$s || this, $c, $d, $$46, $e, column = nil, extra_cols = nil, offset = nil, cell = nil;
- if (self.colcount == null) self.colcount = nil;
- if (self.table == null) self.table = nil;
- if (self.current_row == null) self.current_row = nil;
- if (self.reader == null) self.reader = nil;
- if (self.column_visits == null) self.column_visits = nil;
- if (self.linenum == null) self.linenum = nil;
-
-
-
- if (i == null) {
- i = nil;
- };
- if (self.colcount['$=='](-1)) {
-
- self.table.$columns()['$<<']((column = $$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_minus($rb_plus(self.table.$columns().$size(), i), 1))));
- if ($truthy(($truthy($c = ($truthy($d = cellspec) ? cellspec['$key?']("colspan") : $d)) ? $rb_gt((extra_cols = $rb_minus(cellspec['$[]']("colspan").$to_i(), 1)), 0) : $c))) {
-
- offset = self.table.$columns().$size();
- $send(extra_cols, 'times', [], ($$46 = function(j){var self = $$46.$$s || this;
- if (self.table == null) self.table = nil;
-
-
-
- if (j == null) {
- j = nil;
- };
- return self.table.$columns()['$<<']($$$($$($nesting, 'Table'), 'Column').$new(self.table, $rb_plus(offset, j)));}, $$46.$$s = self, $$46.$$arity = 1, $$46));};
- } else if ($truthy((column = self.table.$columns()['$[]'](self.current_row.$size())))) {
- } else {
-
- self.$logger().$error(self.$message_with_context("dropping cell because it exceeds specified number of columns", $hash2(["source_location"], {"source_location": self.reader.$cursor_before_mark()})));
- Opal.ret(nil);
- };
- cell = $$$($$($nesting, 'Table'), 'Cell').$new(column, cell_text, cellspec, $hash2(["cursor"], {"cursor": self.reader.$cursor_before_mark()}));
- self.reader.$mark();
- if ($truthy(($truthy($c = cell.$rowspan()['$!']()) ? $c : cell.$rowspan()['$=='](1)))) {
- } else {
- self.$activate_rowspan(cell.$rowspan(), ($truthy($c = cell.$colspan()) ? $c : 1))
- };
- self.column_visits = $rb_plus(self.column_visits, ($truthy($c = cell.$colspan()) ? $c : 1));
- self.current_row['$<<'](cell);
- if ($truthy(($truthy($c = self['$end_of_row?']()) ? ($truthy($d = ($truthy($e = self.colcount['$!='](-1)) ? $e : $rb_gt(self.linenum, 0))) ? $d : ($truthy($e = eol) ? i['$=='](repeat) : $e)) : $c))) {
- return self.$close_row()
- } else {
- return nil
- };}, $$45.$$s = self, $$45.$$arity = 1, $$45));
- self.cell_open = false;
- return nil;
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $ParserContext_close_cell$44.$$arity = -1);
- self.$private();
-
- Opal.def(self, '$close_row', $ParserContext_close_row$47 = function $$close_row() {
- var $a, self = this, $writer = nil;
-
-
- self.table.$rows().$body()['$<<'](self.current_row);
- if (self.colcount['$=='](-1)) {
- self.colcount = self.column_visits};
- self.column_visits = 0;
- self.current_row = [];
- self.active_rowspans.$shift();
- ($truthy($a = self.active_rowspans['$[]'](0)) ? $a : (($writer = [0, 0]), $send(self.active_rowspans, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]));
- return nil;
- }, $ParserContext_close_row$47.$$arity = 0);
-
- Opal.def(self, '$activate_rowspan', $ParserContext_activate_rowspan$48 = function $$activate_rowspan(rowspan, colspan) {
- var $$49, self = this;
-
-
- $send((1), 'upto', [$rb_minus(rowspan, 1)], ($$49 = function(i){var self = $$49.$$s || this, $a, $writer = nil;
- if (self.active_rowspans == null) self.active_rowspans = nil;
-
-
-
- if (i == null) {
- i = nil;
- };
- $writer = [i, $rb_plus(($truthy($a = self.active_rowspans['$[]'](i)) ? $a : 0), colspan)];
- $send(self.active_rowspans, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$49.$$s = self, $$49.$$arity = 1, $$49));
- return nil;
- }, $ParserContext_activate_rowspan$48.$$arity = 2);
-
- Opal.def(self, '$end_of_row?', $ParserContext_end_of_row$ques$50 = function() {
- var $a, self = this;
-
- return ($truthy($a = self.colcount['$=='](-1)) ? $a : self.$effective_column_visits()['$=='](self.colcount))
- }, $ParserContext_end_of_row$ques$50.$$arity = 0);
-
- Opal.def(self, '$effective_column_visits', $ParserContext_effective_column_visits$51 = function $$effective_column_visits() {
- var self = this;
-
- return $rb_plus(self.column_visits, self.active_rowspans['$[]'](0))
- }, $ParserContext_effective_column_visits$51.$$arity = 0);
- return (Opal.def(self, '$advance', $ParserContext_advance$52 = function $$advance() {
- var self = this;
-
- return (self.linenum = $rb_plus(self.linenum, 1))
- }, $ParserContext_advance$52.$$arity = 0), nil) && 'advance';
- })($$($nesting, 'Table'), null, $nesting);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/writer"] = function(Opal) {
- function $rb_plus(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, $truthy = Opal.truthy, $hash2 = Opal.hash2;
-
- Opal.add_stubs(['$respond_to?', '$write', '$+', '$chomp', '$include']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting);
-
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'Writer');
-
- var $nesting = [self].concat($parent_nesting), $Writer_write$1;
-
-
- Opal.def(self, '$write', $Writer_write$1 = function $$write(output, target) {
- var self = this;
-
-
- if ($truthy(target['$respond_to?']("write"))) {
- target.$write($rb_plus(output.$chomp(), $$($nesting, 'LF')))
- } else {
- $$$('::', 'File').$write(target, output, $hash2(["mode"], {"mode": $$($nesting, 'FILE_WRITE_MODE')}))
- };
- return nil;
- }, $Writer_write$1.$$arity = 2)
- })($nesting[0], $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'VoidWriter');
-
- var $nesting = [self].concat($parent_nesting), $VoidWriter_write$2;
-
-
- self.$include($$($nesting, 'Writer'));
-
- Opal.def(self, '$write', $VoidWriter_write$2 = function $$write(output, target) {
- var self = this;
-
- return nil
- }, $VoidWriter_write$2.$$arity = 2);
- })($nesting[0], $nesting);
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/load"] = function(Opal) {
- function $rb_minus(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);
- }
- 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, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send;
-
- Opal.add_stubs(['$merge', '$[]', '$start', '$key?', '$!=', '$logger', '$new', '$logger=', '$-', '$!', '$===', '$dup', '$tap', '$each', '$partition', '$[]=', '$split', '$gsub', '$+', '$respond_to?', '$keys', '$raise', '$join', '$ancestors', '$class', '$==', '$at', '$to_i', '$mtime', '$absolute_path', '$path', '$dirname', '$basename', '$extname', '$read', '$rewind', '$drop', '$record', '$parse', '$exception', '$message', '$set_backtrace', '$backtrace', '$stack_trace', '$stack_trace=', '$open', '$load']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting);
-
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $load$1, $load_file$8;
-
-
-
- Opal.def(self, '$load', $load$1 = function $$load(input, options) {
- var $a, $b, $c, $d, $$2, $$4, $$6, self = this, timings = nil, logger = nil, $writer = nil, attrs = nil, input_path = nil, source = nil, doc = nil, ex = nil, context = nil, wrapped_ex = nil;
-
-
-
- if (options == null) {
- options = $hash2([], {});
- };
- try {
-
- options = options.$merge();
- if ($truthy((timings = options['$[]']("timings")))) {
- timings.$start("read")};
- if ($truthy(($truthy($a = options['$key?']("logger")) ? (logger = options['$[]']("logger"))['$!=']($$($nesting, 'LoggerManager').$logger()) : $a))) {
-
- $writer = [($truthy($a = logger) ? $a : $$($nesting, 'NullLogger').$new())];
- $send($$($nesting, 'LoggerManager'), 'logger=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy((attrs = options['$[]']("attributes"))['$!']())) {
- attrs = $hash2([], {})
- } else if ($truthy($$$('::', 'Hash')['$==='](attrs))) {
- attrs = attrs.$merge()
- } else if ($truthy(($truthy($a = (($d = $$$('::', 'Java', 'skip_raise')) && ($c = $$$($d, 'JavaUtil', 'skip_raise')) && ($b = $$$($c, 'Map', 'skip_raise')) ? 'constant' : nil)) ? $$$($$$($$$('::', 'Java'), 'JavaUtil'), 'Map')['$==='](attrs) : $a))) {
- attrs = attrs.$dup()
- } else if ($truthy($$$('::', 'Array')['$==='](attrs))) {
- attrs = $send($hash2([], {}), 'tap', [], ($$2 = function(accum){var self = $$2.$$s || this, $$3;
-
-
-
- if (accum == null) {
- accum = nil;
- };
- return $send(attrs, 'each', [], ($$3 = function(entry){var self = $$3.$$s || this, $e, $f, k = nil, _ = nil, v = nil;
-
-
-
- if (entry == null) {
- entry = nil;
- };
- $f = entry.$partition("="), $e = Opal.to_ary($f), (k = ($e[0] == null ? nil : $e[0])), (_ = ($e[1] == null ? nil : $e[1])), (v = ($e[2] == null ? nil : $e[2])), $f;
-
- $writer = [k, v];
- $send(accum, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;}, $$3.$$s = self, $$3.$$arity = 1, $$3));}, $$2.$$s = self, $$2.$$arity = 1, $$2))
- } else if ($truthy($$$('::', 'String')['$==='](attrs))) {
- attrs = $send($hash2([], {}), 'tap', [], ($$4 = function(accum){var self = $$4.$$s || this, $$5;
-
-
-
- if (accum == null) {
- accum = nil;
- };
- return $send(attrs.$gsub($$($nesting, 'SpaceDelimiterRx'), $rb_plus("\\1", $$($nesting, 'NULL'))).$gsub($$($nesting, 'EscapedSpaceRx'), "\\1").$split($$($nesting, 'NULL')), 'each', [], ($$5 = function(entry){var self = $$5.$$s || this, $e, $f, k = nil, _ = nil, v = nil;
-
-
-
- if (entry == null) {
- entry = nil;
- };
- $f = entry.$partition("="), $e = Opal.to_ary($f), (k = ($e[0] == null ? nil : $e[0])), (_ = ($e[1] == null ? nil : $e[1])), (v = ($e[2] == null ? nil : $e[2])), $f;
-
- $writer = [k, v];
- $send(accum, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];;}, $$5.$$s = self, $$5.$$arity = 1, $$5));}, $$4.$$s = self, $$4.$$arity = 1, $$4))
- } else if ($truthy(($truthy($a = attrs['$respond_to?']("keys")) ? attrs['$respond_to?']("[]") : $a))) {
- attrs = $send($hash2([], {}), 'tap', [], ($$6 = function(accum){var self = $$6.$$s || this, $$7;
-
-
-
- if (accum == null) {
- accum = nil;
- };
- return $send(attrs.$keys(), 'each', [], ($$7 = function(k){var self = $$7.$$s || this;
-
-
-
- if (k == null) {
- k = nil;
- };
- $writer = [k, attrs['$[]'](k)];
- $send(accum, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$7.$$s = self, $$7.$$arity = 1, $$7));}, $$6.$$s = self, $$6.$$arity = 1, $$6))
- } else {
- self.$raise($$$('::', 'ArgumentError'), "" + "illegal type for attributes option: " + (attrs.$class().$ancestors().$join(" < ")))
- };
- if ($truthy($$$('::', 'File')['$==='](input))) {
-
-
- $writer = ["input_mtime", (function() {if ($$($nesting, 'RUBY_ENGINE')['$==']("jruby")) {
-
- return $$$('::', 'Time').$at(input.$mtime().$to_i());
- } else {
- return input.$mtime()
- }; return nil; })()];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["docfile", (input_path = $$$('::', 'File').$absolute_path(input.$path()))];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["docdir", $$$('::', 'File').$dirname(input_path)];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
-
- $writer = ["docname", $$($nesting, 'Helpers').$basename(input_path, (($writer = ["docfilesuffix", $$($nesting, 'Helpers').$extname(input_path)]), $send(attrs, '[]=', Opal.to_a($writer)), $writer[$rb_minus($writer["length"], 1)]))];
- $send(attrs, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- source = input.$read();
- } else if ($truthy(input['$respond_to?']("read"))) {
-
- try {
- input.$rewind()
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- nil
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- source = input.$read();
- } else if ($truthy($$$('::', 'String')['$==='](input))) {
- source = input
- } else if ($truthy($$$('::', 'Array')['$==='](input))) {
- source = input.$drop(0)
- } else if ($truthy(input)) {
- self.$raise($$$('::', 'ArgumentError'), "" + "unsupported input type: " + (input.$class()))};
- if ($truthy(timings)) {
-
- timings.$record("read");
- timings.$start("parse");};
-
- $writer = ["attributes", attrs];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- doc = (function() {if (options['$[]']("parse")['$=='](false)) {
-
- return $$($nesting, 'Document').$new(source, options);
- } else {
- return $$($nesting, 'Document').$new(source, options).$parse()
- }; return nil; })();
- if ($truthy(timings)) {
- timings.$record("parse")};
- return doc;
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {ex = $err;
- try {
-
-
- try {
-
- context = "" + "asciidoctor: FAILED: " + (($truthy($a = attrs['$[]']("docfile")) ? $a : "")) + ": Failed to load AsciiDoc document";
- if ($truthy(ex['$respond_to?']("exception"))) {
-
- wrapped_ex = ex.$exception("" + (context) + " - " + (ex.$message()));
- wrapped_ex.$set_backtrace(ex.$backtrace());
- wrapped_ex.stack = ex.stack;
- } else {
-
- wrapped_ex = ex.$class().$new(context, ex);
-
- $writer = [ex.$stack_trace()];
- $send(wrapped_ex, 'stack_trace=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- };
- } catch ($err) {
- if (Opal.rescue($err, [$$($nesting, 'StandardError')])) {
- try {
- wrapped_ex = ex
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };;
- return self.$raise(wrapped_ex);
- } finally { Opal.pop_exception() }
- } else { throw $err; }
- };
- }, $load$1.$$arity = -2);
- return (Opal.def(self, '$load_file', $load_file$8 = function $$load_file(filename, options) {
- var $$9, self = this;
-
-
-
- if (options == null) {
- options = $hash2([], {});
- };
- return $send($$$('::', 'File'), 'open', [filename, $$($nesting, 'FILE_READ_MODE')], ($$9 = function(file){var self = $$9.$$s || this;
-
-
-
- if (file == null) {
- file = nil;
- };
- return self.$load(file, options);}, $$9.$$s = self, $$9.$$arity = 1, $$9));
- }, $load_file$8.$$arity = -2), nil) && 'load_file';
- })(Opal.get_singleton_class(self), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/convert"] = function(Opal) {
- 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);
- }
- function $rb_lt(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, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send;
-
- Opal.add_stubs(['$delete', '$merge', '$===', '$absolute_path', '$path', '$load', '$respond_to?', '$[]=', '$-', '$key?', '$fetch', '$[]', '$dirname', '$expand_path', '$join', '$attributes', '$outfilesuffix', '$==', '$raise', '$pwd', '$>=', '$safe', '$normalize_system_path', '$mkdir_p', '$directory?', '$!', '$convert', '$write', '$<', '$attr?', '$basebackend?', '$attr', '$uriish?', '$include?', '$syntax_highlighter', '$write_stylesheet?', '$write_primary_stylesheet', '$instance', '$to_s', '$!=', '$read_asset', '$file?', '$write_stylesheet', '$open']);
- return (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting);
-
- (function(self, $parent_nesting) {
- var $nesting = [self].concat($parent_nesting), $convert$1, $convert_file$2;
-
-
-
- Opal.def(self, '$convert', $convert$1 = function $$convert(input, options) {
- var $a, $b, $c, $d, $e, self = this, to_dir = nil, mkdirs = nil, $case = nil, to_file = nil, write_to_target = nil, sibling_path = nil, stream_output = nil, $writer = nil, outdir = nil, doc = nil, outfile = nil, working_dir = nil, jail = nil, output = nil, stylesdir = nil, stylesheet = nil, copy_asciidoctor_stylesheet = nil, copy_user_stylesheet = nil, copy_syntax_hl_stylesheet = nil, syntax_hl = nil, stylesoutdir = nil, stylesheet_src = nil, stylesheet_dest = nil, stylesheet_data = nil, stylesheet_outdir = nil;
-
-
-
- if (options == null) {
- options = $hash2([], {});
- };
- (options = options.$merge()).$delete("parse");
- to_dir = options.$delete("to_dir");
- mkdirs = options.$delete("mkdirs");
- $case = (to_file = options.$delete("to_file"));
- if (true['$===']($case) || nil['$===']($case)) {
- if ($truthy((write_to_target = to_dir))) {
- } else if ($truthy($$$('::', 'File')['$==='](input))) {
- sibling_path = $$$('::', 'File').$absolute_path(input.$path())};
- to_file = nil;}
- else if (false['$===']($case)) {to_file = nil}
- else if ("/dev/null"['$===']($case)) {return self.$load(input, options)}
- else {if ($truthy((stream_output = to_file['$respond_to?']("write")))) {
- } else {
-
- $writer = ["to_file", (write_to_target = to_file)];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }};
- if ($truthy(options['$key?']("standalone"))) {
- } else if ($truthy(($truthy($a = sibling_path) ? $a : write_to_target))) {
-
- $writer = ["standalone", options.$fetch("header_footer", true)];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else if ($truthy(options['$key?']("header_footer"))) {
-
- $writer = ["standalone", options['$[]']("header_footer")];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- if ($truthy(sibling_path)) {
-
- $writer = ["to_dir", (outdir = $$$('::', 'File').$dirname(sibling_path))];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else if ($truthy(write_to_target)) {
- if ($truthy(to_dir)) {
- if ($truthy(to_file)) {
-
- $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path(to_file, to_dir))];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
-
- $writer = ["to_dir", $$$('::', 'File').$expand_path(to_dir)];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- }
- } else if ($truthy(to_file)) {
-
- $writer = ["to_dir", $$$('::', 'File').$dirname($$$('::', 'File').$expand_path(to_file))];
- $send(options, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];}};
- doc = self.$load(input, options);
- if ($truthy(sibling_path)) {
-
- outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix()));
- if (outfile['$=='](sibling_path)) {
- self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))};
- } else if ($truthy(write_to_target)) {
-
- working_dir = (function() {if ($truthy(options['$key?']("base_dir"))) {
-
- return $$$('::', 'File').$expand_path(options['$[]']("base_dir"));
- } else {
- return $$$('::', 'Dir').$pwd()
- }; return nil; })();
- jail = (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) {
- return working_dir
- } else {
- return nil
- }; return nil; })();
- if ($truthy(to_dir)) {
-
- outdir = doc.$normalize_system_path(to_dir, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false}));
- if ($truthy(to_file)) {
-
- outfile = doc.$normalize_system_path(to_file, outdir, nil, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false}));
- outdir = $$$('::', 'File').$dirname(outfile);
- } else {
- outfile = $$$('::', 'File').$join(outdir, "" + (doc.$attributes()['$[]']("docname")) + (doc.$outfilesuffix()))
- };
- } else if ($truthy(to_file)) {
-
- outfile = doc.$normalize_system_path(to_file, working_dir, jail, $hash2(["target_name", "recover"], {"target_name": "to_dir", "recover": false}));
- outdir = $$$('::', 'File').$dirname(outfile);};
- if ($truthy(($truthy($a = $$$('::', 'File')['$==='](input)) ? outfile['$==']($$$('::', 'File').$absolute_path(input.$path())) : $a))) {
- self.$raise($$$('::', 'IOError'), "" + "input file and output file cannot be the same: " + (outfile))};
- if ($truthy(mkdirs)) {
- $$($nesting, 'Helpers').$mkdir_p(outdir)
- } else if ($truthy($$$('::', 'File')['$directory?'](outdir))) {
- } else {
- self.$raise($$$('::', 'IOError'), "" + "target directory does not exist: " + (to_dir) + " (hint: set :mkdirs option)")
- };
- } else {
-
- outfile = to_file;
- outdir = nil;
- };
- if ($truthy(($truthy($a = outfile) ? stream_output['$!']() : $a))) {
- output = doc.$convert($hash2(["outfile", "outdir"], {"outfile": outfile, "outdir": outdir}))
- } else {
- output = doc.$convert()
- };
- if ($truthy(outfile)) {
-
- doc.$write(output, outfile);
- if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = ($truthy($d = ($truthy($e = stream_output['$!']()) ? $rb_lt(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $e)) ? doc['$attr?']("linkcss") : $d)) ? doc['$attr?']("copycss") : $c)) ? doc['$basebackend?']("html") : $b)) ? ($truthy($b = (stylesdir = doc.$attr("stylesdir"))) ? $$($nesting, 'Helpers')['$uriish?'](stylesdir) : $b)['$!']() : $a))) {
-
- if ($truthy((stylesheet = doc.$attr("stylesheet")))) {
- if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](stylesheet))) {
- copy_asciidoctor_stylesheet = true
- } else if ($truthy($$($nesting, 'Helpers')['$uriish?'](stylesheet)['$!']())) {
- copy_user_stylesheet = true}};
- copy_syntax_hl_stylesheet = ($truthy($a = (syntax_hl = doc.$syntax_highlighter())) ? syntax_hl['$write_stylesheet?'](doc) : $a);
- if ($truthy(($truthy($a = ($truthy($b = copy_asciidoctor_stylesheet) ? $b : copy_user_stylesheet)) ? $a : copy_syntax_hl_stylesheet))) {
-
- stylesoutdir = doc.$normalize_system_path(stylesdir, outdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) {
- return outdir
- } else {
- return nil
- }; return nil; })());
- if ($truthy(mkdirs)) {
- $$($nesting, 'Helpers').$mkdir_p(stylesoutdir)
- } else if ($truthy($$$('::', 'File')['$directory?'](stylesoutdir))) {
- } else {
- self.$raise($$$('::', 'IOError'), "" + "target stylesheet directory does not exist: " + (stylesoutdir) + " (hint: set :mkdirs option)")
- };
- if ($truthy(copy_asciidoctor_stylesheet)) {
- $$($nesting, 'Stylesheets').$instance().$write_primary_stylesheet(stylesoutdir)
- } else if ($truthy(copy_user_stylesheet)) {
-
- if ($truthy(($truthy($a = (stylesheet_src = doc.$attr("copycss"))['$==']("")) ? $a : stylesheet_src['$=='](true)))) {
- stylesheet_src = doc.$normalize_system_path(stylesheet)
- } else {
- stylesheet_src = doc.$normalize_system_path(stylesheet_src.$to_s())
- };
- stylesheet_dest = doc.$normalize_system_path(stylesheet, stylesoutdir, (function() {if ($truthy($rb_ge(doc.$safe(), $$$($$($nesting, 'SafeMode'), 'SAFE')))) {
- return outdir
- } else {
- return nil
- }; return nil; })());
- if ($truthy(($truthy($a = stylesheet_src['$!='](stylesheet_dest)) ? (stylesheet_data = doc.$read_asset(stylesheet_src, $hash2(["warn_on_failure", "label"], {"warn_on_failure": $$$('::', 'File')['$file?'](stylesheet_dest)['$!'](), "label": "stylesheet"}))) : $a))) {
-
- if ($truthy(($truthy($a = (stylesheet_outdir = $$$('::', 'File').$dirname(stylesheet_dest))['$!='](stylesoutdir)) ? $$$('::', 'File')['$directory?'](stylesheet_outdir)['$!']() : $a))) {
- if ($truthy(mkdirs)) {
- $$($nesting, 'Helpers').$mkdir_p(stylesheet_outdir)
- } else {
- self.$raise($$$('::', 'IOError'), "" + "target stylesheet directory does not exist: " + (stylesheet_outdir) + " (hint: set :mkdirs option)")
- }};
- $$$('::', 'File').$write(stylesheet_dest, stylesheet_data, $hash2(["mode"], {"mode": $$($nesting, 'FILE_WRITE_MODE')}));};};
- if ($truthy(copy_syntax_hl_stylesheet)) {
- syntax_hl.$write_stylesheet(doc, stylesoutdir)};};};
- return doc;
- } else {
- return output
- };
- }, $convert$1.$$arity = -2);
-
- Opal.def(self, '$convert_file', $convert_file$2 = function $$convert_file(filename, options) {
- var $$3, self = this;
-
-
-
- if (options == null) {
- options = $hash2([], {});
- };
- return $send($$$('::', 'File'), 'open', [filename, $$($nesting, 'FILE_READ_MODE')], ($$3 = function(file){var self = $$3.$$s || this;
-
-
-
- if (file == null) {
- file = nil;
- };
- return self.$convert(file, options);}, $$3.$$s = self, $$3.$$arity = 1, $$3));
- }, $convert_file$2.$$arity = -2);
- Opal.alias(self, "render", "convert");
- return Opal.alias(self, "render_file", "convert_file");
- })(Opal.get_singleton_class(self), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/syntax_highlighter/highlightjs"] = function(Opal) {
- function $rb_minus(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, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$register_for', '$merge', '$proc', '$[]=', '$-', '$attr', '$[]', '$==', '$attr?', '$join', '$map', '$split', '$lstrip']);
- 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, 'HighlightJsAdapter');
-
- var $nesting = [self].concat($parent_nesting), $HighlightJsAdapter_initialize$1, $HighlightJsAdapter_format$2, $HighlightJsAdapter_docinfo$ques$4, $HighlightJsAdapter_docinfo$5;
-
-
- self.$register_for("highlightjs", "highlight.js");
-
- Opal.def(self, '$initialize', $HighlightJsAdapter_initialize$1 = function $$initialize($a) {
- var $post_args, args, $iter = $HighlightJsAdapter_initialize$1.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $HighlightJsAdapter_initialize$1.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- args = $post_args;;
- $send(self, Opal.find_super_dispatcher(self, 'initialize', $HighlightJsAdapter_initialize$1, false), $zuper, $iter);
- return (self.name = (self.pre_class = "highlightjs"));
- }, $HighlightJsAdapter_initialize$1.$$arity = -1);
-
- Opal.def(self, '$format', $HighlightJsAdapter_format$2 = function $$format(node, lang, opts) {
- var $$3, $iter = $HighlightJsAdapter_format$2.$$p, $yield = $iter || nil, self = this;
-
- if ($iter) $HighlightJsAdapter_format$2.$$p = null;
- return $send(self, Opal.find_super_dispatcher(self, 'format', $HighlightJsAdapter_format$2, false), [node, lang, opts.$merge($hash2(["transform"], {"transform": $send(self, 'proc', [], ($$3 = function(_, code){var self = $$3.$$s || this, $a, $writer = nil;
-
-
-
- if (_ == null) {
- _ = nil;
- };
-
- if (code == null) {
- code = nil;
- };
- $writer = ["class", "" + "language-" + (($truthy($a = lang) ? $a : "none")) + " hljs"];
- $send(code, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$3.$$s = self, $$3.$$arity = 2, $$3))}))], null)
- }, $HighlightJsAdapter_format$2.$$arity = 3);
-
- Opal.def(self, '$docinfo?', $HighlightJsAdapter_docinfo$ques$4 = function(location) {
- var self = this;
-
- return true
- }, $HighlightJsAdapter_docinfo$ques$4.$$arity = 1);
- return (Opal.def(self, '$docinfo', $HighlightJsAdapter_docinfo$5 = function $$docinfo(location, doc, opts) {
- var $$6, self = this, base_url = nil;
-
-
- base_url = doc.$attr("highlightjsdir", "" + (opts['$[]']("cdn_base_url")) + "/highlight.js/" + ($$($nesting, 'HIGHLIGHT_JS_VERSION')));
- if (location['$==']("head")) {
- return "" + " "
- } else {
- return "" + "\n" + ((function() {if ($truthy(doc['$attr?']("highlightjs-languages"))) {
- return $send(doc.$attr("highlightjs-languages").$split(","), 'map', [], ($$6 = function(lang){var self = $$6.$$s || this;
-
-
-
- if (lang == null) {
- lang = nil;
- };
- return "" + "\n";}, $$6.$$s = self, $$6.$$arity = 1, $$6)).$join()
- } else {
- return ""
- }; return nil; })()) + ""
- };
- }, $HighlightJsAdapter_docinfo$5.$$arity = 3), nil) && 'docinfo';
- })($$($nesting, 'SyntaxHighlighter'), $$$($$($nesting, 'SyntaxHighlighter'), 'Base'), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/syntax_highlighter"] = function(Opal) {
- function $rb_minus(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, $hash2 = Opal.hash2, $truthy = Opal.truthy, $send = Opal.send, $klass = Opal.klass;
-
- Opal.add_stubs(['$attr_reader', '$raise', '$class', '$private_class_method', '$extend', '$register', '$map', '$to_s', '$each', '$[]=', '$registry', '$-', '$[]', '$for', '$===', '$new', '$name', '$private', '$include', '$==', '$delete', '$join', '$content']);
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'Asciidoctor');
-
- var $nesting = [self].concat($parent_nesting);
-
- (function($base, $parent_nesting) {
- var self = $module($base, 'SyntaxHighlighter');
-
- var $nesting = [self].concat($parent_nesting), $SyntaxHighlighter_initialize$1, $SyntaxHighlighter_docinfo$ques$2, $SyntaxHighlighter_docinfo$3, $SyntaxHighlighter_highlight$ques$4, $SyntaxHighlighter_highlight$5, $SyntaxHighlighter_format$6, $SyntaxHighlighter_write_stylesheet$ques$7, $SyntaxHighlighter_write_stylesheet$8, $a, $SyntaxHighlighter_included$9;
-
-
- self.$attr_reader("name");
-
- Opal.def(self, '$initialize', $SyntaxHighlighter_initialize$1 = function $$initialize(name, backend, opts) {
- var self = this;
-
-
-
- if (backend == null) {
- backend = "html5";
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- return (self.name = (self.pre_class = name));
- }, $SyntaxHighlighter_initialize$1.$$arity = -2);
-
- Opal.def(self, '$docinfo?', $SyntaxHighlighter_docinfo$ques$2 = function(location) {
- var self = this;
-
- return nil
- }, $SyntaxHighlighter_docinfo$ques$2.$$arity = 1);
-
- Opal.def(self, '$docinfo', $SyntaxHighlighter_docinfo$3 = function $$docinfo(location, doc, opts) {
- var self = this;
-
- return self.$raise($$$('::', 'NotImplementedError'), "" + ($$($nesting, 'SyntaxHighlighter')) + " subclass " + (self.$class()) + " must implement the #" + ("docinfo") + " method since #docinfo? returns true")
- }, $SyntaxHighlighter_docinfo$3.$$arity = 3);
-
- Opal.def(self, '$highlight?', $SyntaxHighlighter_highlight$ques$4 = function() {
- var self = this;
-
- return nil
- }, $SyntaxHighlighter_highlight$ques$4.$$arity = 0);
-
- Opal.def(self, '$highlight', $SyntaxHighlighter_highlight$5 = function $$highlight(node, source, lang, opts) {
- var self = this;
-
- return self.$raise($$$('::', 'NotImplementedError'), "" + ($$($nesting, 'SyntaxHighlighter')) + " subclass " + (self.$class()) + " must implement the #" + ("highlight") + " method since #highlight? returns true")
- }, $SyntaxHighlighter_highlight$5.$$arity = 4);
-
- Opal.def(self, '$format', $SyntaxHighlighter_format$6 = function $$format(node, lang, opts) {
- var self = this;
-
- return self.$raise($$$('::', 'NotImplementedError'), "" + ($$($nesting, 'SyntaxHighlighter')) + " subclass " + (self.$class()) + " must implement the #" + ("format") + " method")
- }, $SyntaxHighlighter_format$6.$$arity = 3);
-
- Opal.def(self, '$write_stylesheet?', $SyntaxHighlighter_write_stylesheet$ques$7 = function(doc) {
- var self = this;
-
- return nil
- }, $SyntaxHighlighter_write_stylesheet$ques$7.$$arity = 1);
-
- Opal.def(self, '$write_stylesheet', $SyntaxHighlighter_write_stylesheet$8 = function $$write_stylesheet(doc, to_dir) {
- var self = this;
-
- return self.$raise($$$('::', 'NotImplementedError'), "" + ($$($nesting, 'SyntaxHighlighter')) + " subclass " + (self.$class()) + " must implement the #" + ("write_stylesheet") + " method since #write_stylesheet? returns true")
- }, $SyntaxHighlighter_write_stylesheet$8.$$arity = 2);
- self.$private_class_method(($truthy($a = (Opal.defs(self, '$included', $SyntaxHighlighter_included$9 = function $$included(into) {
- var self = this;
-
- return into.$extend($$($nesting, 'Config'))
- }, $SyntaxHighlighter_included$9.$$arity = 1), nil) && 'included') ? $a : "included"));
- (function($base, $parent_nesting) {
- var self = $module($base, 'Config');
-
- var $nesting = [self].concat($parent_nesting), $Config_register_for$10;
-
-
- Opal.def(self, '$register_for', $Config_register_for$10 = function $$register_for($a) {
- var $post_args, names, $$11, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- names = $post_args;;
- return $send($$($nesting, 'SyntaxHighlighter'), 'register', [self].concat(Opal.to_a($send(names, 'map', [], ($$11 = function(name){var self = $$11.$$s || this;
-
-
-
- if (name == null) {
- name = nil;
- };
- return name.$to_s();}, $$11.$$s = self, $$11.$$arity = 1, $$11)))));
- }, $Config_register_for$10.$$arity = -1)
- })($nesting[0], $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'Factory');
-
- var $nesting = [self].concat($parent_nesting), $Factory_register$12, $Factory_for$14, $Factory_create$15, $Factory_registry$16;
-
-
-
- Opal.def(self, '$register', $Factory_register$12 = function $$register(syntax_highlighter, $a) {
- var $post_args, names, $$13, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- names = $post_args;;
- return $send(names, 'each', [], ($$13 = function(name){var self = $$13.$$s || this, $writer = nil;
-
-
-
- if (name == null) {
- name = nil;
- };
- $writer = [name, syntax_highlighter];
- $send(self.$registry(), '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$13.$$s = self, $$13.$$arity = 1, $$13));
- }, $Factory_register$12.$$arity = -2);
-
- Opal.def(self, '$for', $Factory_for$14 = function(name) {
- var self = this;
-
- return self.$registry()['$[]'](name)
- }, $Factory_for$14.$$arity = 1);
-
- Opal.def(self, '$create', $Factory_create$15 = function $$create(name, backend, opts) {
- var self = this, syntax_hl = nil;
-
-
-
- if (backend == null) {
- backend = "html5";
- };
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy((syntax_hl = self.$for(name)))) {
-
- if ($truthy($$$('::', 'Class')['$==='](syntax_hl))) {
- syntax_hl = syntax_hl.$new(name, backend, opts)};
- if ($truthy(syntax_hl.$name())) {
- } else {
- self.$raise($$$('::', 'NameError'), "" + (syntax_hl.$class()) + " must specify a value for `name'")
- };
- return syntax_hl;
- } else {
- return nil
- };
- }, $Factory_create$15.$$arity = -2);
- self.$private();
-
- Opal.def(self, '$registry', $Factory_registry$16 = function $$registry() {
- var self = this;
-
- return self.$raise($$$('::', 'NotImplementedError'), "" + ($$($nesting, 'Factory')) + " subclass " + (self.$class()) + " must implement the #" + ("registry") + " method")
- }, $Factory_registry$16.$$arity = 0);
- })($nesting[0], $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'CustomFactory');
-
- var $nesting = [self].concat($parent_nesting), $CustomFactory_initialize$17, $CustomFactory_registry$18;
-
- self.$$prototype.registry = nil;
-
- self.$include($$($nesting, 'Factory'));
-
- Opal.def(self, '$initialize', $CustomFactory_initialize$17 = function $$initialize(seed_registry) {
- var $a, self = this;
-
-
-
- if (seed_registry == null) {
- seed_registry = nil;
- };
- return (self.registry = ($truthy($a = seed_registry) ? $a : $hash2([], {})));
- }, $CustomFactory_initialize$17.$$arity = -1);
- self.$private();
- return (Opal.def(self, '$registry', $CustomFactory_registry$18 = function $$registry() {
- var self = this;
-
- return self.registry
- }, $CustomFactory_registry$18.$$arity = 0), nil) && 'registry';
- })($nesting[0], null, $nesting);
- (function($base, $parent_nesting) {
- var self = $module($base, 'DefaultFactory');
-
- var $nesting = [self].concat($parent_nesting), $DefaultFactory_registry$19;
-
-
- self.$include($$($nesting, 'Factory'));
- self.$private();
- (Opal.class_variable_set($nesting[0], '@@registry', $hash2([], {})));
-
- Opal.def(self, '$registry', $DefaultFactory_registry$19 = function $$registry() {
- var $a, self = this;
-
- return (($a = $nesting[0].$$cvars['@@registry']) == null ? nil : $a)
- }, $DefaultFactory_registry$19.$$arity = 0);
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- } else {
- nil
- };
- })($nesting[0], $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'DefaultFactoryProxy');
-
- var $nesting = [self].concat($parent_nesting);
-
-
- self.$include($$($nesting, 'DefaultFactory'));
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- return nil
- } else {
- return nil
- };
- })($nesting[0], $$($nesting, 'CustomFactory'), $nesting);
- (function($base, $super, $parent_nesting) {
- var self = $klass($base, $super, 'Base');
-
- var $nesting = [self].concat($parent_nesting), $Base_format$20;
-
- self.$$prototype.pre_class = nil;
-
- self.$include($$($nesting, 'SyntaxHighlighter'));
- return (Opal.def(self, '$format', $Base_format$20 = function $$format(node, lang, opts) {
- var $$21, $$22, self = this, class_attr_val = nil, transform = nil, pre = nil, code = nil, $writer = nil;
-
-
- class_attr_val = (function() {if ($truthy(opts['$[]']("nowrap"))) {
- return "" + (self.pre_class) + " highlight nowrap"
- } else {
- return "" + (self.pre_class) + " highlight"
- }; return nil; })();
- if ($truthy((transform = opts['$[]']("transform")))) {
-
- transform['$[]']((pre = $hash2(["class"], {"class": class_attr_val})), (code = (function() {if ($truthy(lang)) {
- return $hash2(["data-lang"], {"data-lang": lang})
- } else {
- return $hash2([], {})
- }; return nil; })()));
- if ($truthy((lang = code.$delete("data-lang")))) {
-
- $writer = ["data-lang", lang];
- $send(code, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];};
- return "" + "" + (node.$content()) + " ";
- } else {
- return "" + "" + (node.$content()) + " "
- };
- }, $Base_format$20.$$arity = 3), nil) && 'format';
- })($nesting[0], null, $nesting);
- self.$extend($$($nesting, 'DefaultFactory'));
- })($nesting[0], $nesting)
- })($nesting[0], $nesting);
- self.$require("asciidoctor/syntax_highlighter.rb"+ '/../' + "syntax_highlighter/highlightjs");
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
- return nil
- } else {
- return nil
- };
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/timings"] = function(Opal) {
- function $rb_minus(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_gt(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, $send = Opal.send, $truthy = Opal.truthy, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$now', '$[]=', '$-', '$delete', '$reduce', '$+', '$[]', '$>', '$time', '$puts', '$%', '$to_f', '$read_parse', '$convert', '$read_parse_convert', '$private', '$const_defined?', '$==', '$clock_gettime']);
- 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, 'Timings');
-
- var $nesting = [self].concat($parent_nesting), $Timings_initialize$1, $Timings_start$2, $Timings_record$3, $Timings_time$4, $Timings_read$6, $Timings_parse$7, $Timings_read_parse$8, $Timings_convert$9, $Timings_read_parse_convert$10, $Timings_write$11, $Timings_total$12, $Timings_print_report$13, $a, $b, $c, $d, $e, $Timings_now$14, $Timings_now$15;
-
- self.$$prototype.timers = self.$$prototype.log = nil;
-
-
- Opal.def(self, '$initialize', $Timings_initialize$1 = function $$initialize() {
- var self = this;
-
-
- self.log = $hash2([], {});
- return (self.timers = $hash2([], {}));
- }, $Timings_initialize$1.$$arity = 0);
-
- Opal.def(self, '$start', $Timings_start$2 = function $$start(key) {
- var self = this, $writer = nil;
-
-
- $writer = [key, self.$now()];
- $send(self.timers, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- }, $Timings_start$2.$$arity = 1);
-
- Opal.def(self, '$record', $Timings_record$3 = function $$record(key) {
- var self = this, $writer = nil;
-
-
- $writer = [key, $rb_minus(self.$now(), self.timers.$delete(key))];
- $send(self.log, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];
- }, $Timings_record$3.$$arity = 1);
-
- Opal.def(self, '$time', $Timings_time$4 = function $$time($a) {
- var $post_args, keys, $$5, self = this, time = nil;
-
-
-
- $post_args = Opal.slice.call(arguments, 0, arguments.length);
-
- keys = $post_args;;
- time = $send(keys, 'reduce', [0], ($$5 = function(sum, key){var self = $$5.$$s || this, $b;
- if (self.log == null) self.log = nil;
-
-
-
- if (sum == null) {
- sum = nil;
- };
-
- if (key == null) {
- key = nil;
- };
- return $rb_plus(sum, ($truthy($b = self.log['$[]'](key)) ? $b : 0));}, $$5.$$s = self, $$5.$$arity = 2, $$5));
- if ($truthy($rb_gt(time, 0))) {
- return time
- } else {
- return nil
- };
- }, $Timings_time$4.$$arity = -1);
-
- Opal.def(self, '$read', $Timings_read$6 = function $$read() {
- var self = this;
-
- return self.$time("read")
- }, $Timings_read$6.$$arity = 0);
-
- Opal.def(self, '$parse', $Timings_parse$7 = function $$parse() {
- var self = this;
-
- return self.$time("parse")
- }, $Timings_parse$7.$$arity = 0);
-
- Opal.def(self, '$read_parse', $Timings_read_parse$8 = function $$read_parse() {
- var self = this;
-
- return self.$time("read", "parse")
- }, $Timings_read_parse$8.$$arity = 0);
-
- Opal.def(self, '$convert', $Timings_convert$9 = function $$convert() {
- var self = this;
-
- return self.$time("convert")
- }, $Timings_convert$9.$$arity = 0);
-
- Opal.def(self, '$read_parse_convert', $Timings_read_parse_convert$10 = function $$read_parse_convert() {
- var self = this;
-
- return self.$time("read", "parse", "convert")
- }, $Timings_read_parse_convert$10.$$arity = 0);
-
- Opal.def(self, '$write', $Timings_write$11 = function $$write() {
- var self = this;
-
- return self.$time("write")
- }, $Timings_write$11.$$arity = 0);
-
- Opal.def(self, '$total', $Timings_total$12 = function $$total() {
- var self = this;
-
- return self.$time("read", "parse", "convert", "write")
- }, $Timings_total$12.$$arity = 0);
-
- Opal.def(self, '$print_report', $Timings_print_report$13 = function $$print_report(to, subject) {
- var self = this;
- if ($gvars.stdout == null) $gvars.stdout = nil;
-
-
-
- if (to == null) {
- to = $gvars.stdout;
- };
-
- if (subject == null) {
- subject = nil;
- };
- if ($truthy(subject)) {
- to.$puts("" + "Input file: " + (subject))};
- to.$puts("" + " Time to read and parse source: " + ("%05.5f"['$%'](self.$read_parse().$to_f())));
- to.$puts("" + " Time to convert document: " + ("%05.5f"['$%'](self.$convert().$to_f())));
- return to.$puts("" + " Total time (read, parse and convert): " + ("%05.5f"['$%'](self.$read_parse_convert().$to_f())));
- }, $Timings_print_report$13.$$arity = -1);
- self.$private();
- if ($truthy(($truthy($a = $$$('::', 'Process')['$const_defined?']("CLOCK_MONOTONIC", false)) ? ((($b = $$$('::', 'Process', 'skip_raise')) && ($c = $b, $c) && ($d = $c) && ((($e = $d.$clock_gettime) && !$e.$$stub) || $d['$respond_to_missing?']('clock_gettime'))) ? 'method' : nil)['$==']("method") : $a))) {
-
- Opal.const_set($nesting[0], 'CLOCK_ID', $$$($$$('::', 'Process'), 'CLOCK_MONOTONIC'));
- return (Opal.def(self, '$now', $Timings_now$14 = function $$now() {
- var self = this;
-
- return $$$('::', 'Process').$clock_gettime($$($nesting, 'CLOCK_ID'))
- }, $Timings_now$14.$$arity = 0), nil) && 'now';
- } else {
- return (Opal.def(self, '$now', $Timings_now$15 = function $$now() {
- var self = this;
-
- return $$$('::', 'Time').$now()
- }, $Timings_now$15.$$arity = 0), nil) && 'now'
- };
- })($nesting[0], null, $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/converter/composite"] = function(Opal) {
- function $rb_minus(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, $send = Opal.send, $truthy = Opal.truthy;
-
- Opal.add_stubs(['$attr_reader', '$each', '$respond_to?', '$composed', '$init_backend_traits', '$backend_traits', '$new', '$find_converter', '$[]=', '$-', '$convert', '$converter_for', '$node_name', '$[]', '$handles?', '$raise']);
- 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, 'CompositeConverter');
-
- var $nesting = [self].concat($parent_nesting), $CompositeConverter_initialize$1, $CompositeConverter_convert$4, $CompositeConverter_converter_for$5, $CompositeConverter_find_converter$6;
-
- self.$$prototype.converter_cache = self.$$prototype.converters = nil;
-
- self.$attr_reader("converters");
-
- Opal.def(self, '$initialize', $CompositeConverter_initialize$1 = function $$initialize(backend, $a, $b) {
- var $post_args, $kwargs, converters, backend_traits_source, $$2, $$3, self = this;
-
-
-
- $post_args = Opal.slice.call(arguments, 1, arguments.length);
-
- $kwargs = Opal.extract_kwargs($post_args);
-
- if ($kwargs == null) {
- $kwargs = $hash2([], {});
- } else if (!$kwargs.$$is_hash) {
- throw Opal.ArgumentError.$new('expected kwargs');
- };
-
- converters = $post_args;;
-
- backend_traits_source = $kwargs.$$smap["backend_traits_source"];
- if (backend_traits_source == null) {
- backend_traits_source = nil
- };
- self.backend = backend;
- $send((self.converters = converters), 'each', [], ($$2 = function(converter){var self = $$2.$$s || this;
-
-
-
- if (converter == null) {
- converter = nil;
- };
- if ($truthy(converter['$respond_to?']("composed"))) {
- return converter.$composed(self)
- } else {
- return nil
- };}, $$2.$$s = self, $$2.$$arity = 1, $$2));
- if ($truthy(backend_traits_source)) {
- self.$init_backend_traits(backend_traits_source.$backend_traits())};
- return (self.converter_cache = $send($$$('::', 'Hash'), 'new', [], ($$3 = function(hash, key){var self = $$3.$$s || this, $writer = nil;
-
-
-
- if (hash == null) {
- hash = nil;
- };
-
- if (key == null) {
- key = nil;
- };
- $writer = [key, self.$find_converter(key)];
- $send(hash, '[]=', Opal.to_a($writer));
- return $writer[$rb_minus($writer["length"], 1)];}, $$3.$$s = self, $$3.$$arity = 2, $$3)));
- }, $CompositeConverter_initialize$1.$$arity = -2);
-
- Opal.def(self, '$convert', $CompositeConverter_convert$4 = function $$convert(node, transform, opts) {
- var $a, self = this;
-
-
-
- if (transform == null) {
- transform = nil;
- };
-
- if (opts == null) {
- opts = nil;
- };
- return self.$converter_for((transform = ($truthy($a = transform) ? $a : node.$node_name()))).$convert(node, transform, opts);
- }, $CompositeConverter_convert$4.$$arity = -2);
-
- Opal.def(self, '$converter_for', $CompositeConverter_converter_for$5 = function $$converter_for(transform) {
- var self = this;
-
- return self.converter_cache['$[]'](transform)
- }, $CompositeConverter_converter_for$5.$$arity = 1);
- return (Opal.def(self, '$find_converter', $CompositeConverter_find_converter$6 = function $$find_converter(transform) {try {
-
- var $$7, self = this;
-
-
- $send(self.converters, 'each', [], ($$7 = function(candidate){var self = $$7.$$s || this;
-
-
-
- if (candidate == null) {
- candidate = nil;
- };
- if ($truthy(candidate['$handles?'](transform))) {
- Opal.ret(candidate)
- } else {
- return nil
- };}, $$7.$$s = self, $$7.$$arity = 1, $$7));
- return self.$raise("" + "Could not find a converter to handle transform: " + (transform));
- } catch ($returner) { if ($returner === Opal.returner) { return $returner.$v } throw $returner; }
- }, $CompositeConverter_find_converter$6.$$arity = 1), nil) && 'find_converter';
- })($$($nesting, 'Converter'), $$$($$($nesting, 'Converter'), 'Base'), $nesting)
- })($nesting[0], $nesting)
-};
-
-/* Generated by Opal 0.11.99.dev */
-Opal.modules["asciidoctor/converter/html5"] = function(Opal) {
- function $rb_minus(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_le(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs <= rhs : lhs['$<='](rhs);
- }
- function $rb_lt(lhs, rhs) {
- return (typeof(lhs) === 'number' && typeof(rhs) === 'number') ? lhs < rhs : lhs['$<'](rhs);
- }
- function $rb_times(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, $send = Opal.send, $hash2 = Opal.hash2, $truthy = Opal.truthy, $gvars = Opal.gvars;
-
- Opal.add_stubs(['$register_for', '$default=', '$-', '$==', '$[]', '$init_backend_traits', '$node_name', '$convert_inline_quoted', '$convert_paragraph', '$convert_inline_anchor', '$convert_section', '$convert_listing', '$convert_literal', '$convert_ulist', '$convert_olist', '$convert_dlist', '$convert_admonition', '$convert_colist', '$convert_embedded', '$convert_example', '$convert_floating_title', '$convert_image', '$convert_inline_break', '$convert_inline_button', '$convert_inline_callout', '$convert_inline_footnote', '$convert_inline_image', '$convert_inline_indexterm', '$convert_inline_kbd', '$convert_inline_menu', '$convert_open', '$convert_page_break', '$convert_preamble', '$convert_quote', '$convert_sidebar', '$convert_stem', '$convert_table', '$convert_thematic_break', '$convert_verse', '$convert_video', '$convert_document', '$convert_toc', '$convert_pass', '$convert_audio', '$empty?', '$attr', '$attr?', '$<<', '$include?', '$sub_replacements', '$gsub', '$extname', '$slice', '$length', '$doctitle', '$normalize_web_path', '$primary_stylesheet_data', '$instance', '$read_contents', '$syntax_highlighter', '$size', '$docinfo', '$id', '$sections?', '$doctype', '$role?', '$role', '$join', '$noheader', '$convert', '$converter', '$generate_manname_section', '$header?', '$notitle', '$title', '$header', '$each', '$authors', '$>', '$name', '$email', '$sub_macros', '$+', '$downcase', '$concat', '$content', '$footnotes?', '$!', '$footnotes', '$index', '$text', '$nofooter', '$docinfo?', '$[]=', '$delete_at', '$inspect', '$!=', '$to_i', '$attributes', '$document', '$sections', '$level', '$caption', '$captioned_title', '$numbered', '$<=', '$<', '$sectname', '$sectnum', '$convert_outline', '$title?', '$icon_uri', '$compact', '$media_uri', '$option?', '$append_boolean_attribute', '$style', '$items', '$blocks?', '$===', '$text?', '$chomp', '$safe', '$read_svg_contents', '$alt', '$image_uri', '$encode_attribute_value', '$append_link_constraint_attrs', '$highlight?', '$to_sym', '$format', '$*', '$count', '$start_with?', '$end_with?', '$list_marker_keyword', '$parent', '$warn', '$logger', '$context', '$error', '$new', '$columns', '$to_h', '$rows', '$colspan', '$rowspan', '$unshift', '$shift', '$pop', '$split', '$nil_or_empty?', '$type', '$catalog', '$get_root_document', '$xreftext', '$target', '$reftext', '$map', '$chop', '$sub', '$match', '$private', '$upcase', '$nested?', '$parent_document', '$to_s', '$handles?', '$send']);
- 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, 'Html5Converter');
-
- var $nesting = [self].concat($parent_nesting), $Html5Converter_initialize$1, $Html5Converter_convert$2, $Html5Converter_convert_document$3, $Html5Converter_convert_embedded$6, $Html5Converter_convert_outline$8, $Html5Converter_convert_section$10, $Html5Converter_convert_admonition$11, $Html5Converter_convert_audio$12, $Html5Converter_convert_colist$13, $Html5Converter_convert_dlist$16, $Html5Converter_convert_example$23, $Html5Converter_convert_floating_title$24, $Html5Converter_convert_image$25, $Html5Converter_convert_listing$26, $Html5Converter_convert_literal$27, $Html5Converter_convert_stem$28, $Html5Converter_convert_olist$30, $Html5Converter_convert_open$32, $Html5Converter_convert_page_break$33, $Html5Converter_convert_paragraph$34, $Html5Converter_convert_preamble$35, $Html5Converter_convert_quote$36, $Html5Converter_convert_thematic_break$37, $Html5Converter_convert_sidebar$38, $Html5Converter_convert_table$39, $Html5Converter_convert_toc$44, $Html5Converter_convert_ulist$45, $Html5Converter_convert_verse$47, $Html5Converter_convert_video$48, $Html5Converter_convert_inline_anchor$49, $Html5Converter_convert_inline_break$50, $Html5Converter_convert_inline_button$51, $Html5Converter_convert_inline_callout$52, $Html5Converter_convert_inline_footnote$53, $Html5Converter_convert_inline_image$54, $Html5Converter_convert_inline_indexterm$57, $Html5Converter_convert_inline_kbd$58, $Html5Converter_convert_inline_menu$59, $Html5Converter_convert_inline_quoted$60, $Html5Converter_read_svg_contents$61, $Html5Converter_append_boolean_attribute$63, $Html5Converter_append_link_constraint_attrs$64, $Html5Converter_encode_attribute_value$65, $Html5Converter_generate_manname_section$66, $Html5Converter_get_root_document$67, $Html5Converter_method_missing$68, $writer = nil;
-
- self.$$prototype.void_element_slash = self.$$prototype.xml_mode = self.$$prototype.refs = self.$$prototype.resolving_xref = nil;
-
- self.$register_for("html5");
-
- $writer = [["", ""]];
- $send(Opal.const_set($nesting[0], 'QUOTE_TAGS', $hash2(["monospaced", "emphasis", "strong", "double", "single", "mark", "superscript", "subscript", "asciimath", "latexmath"], {"monospaced": ["", "", true], "emphasis": ["", " ", true], "strong": ["", " ", true], "double": ["“", "”"], "single": ["‘", "’"], "mark": ["", " ", true], "superscript": ["", " ", true], "subscript": ["", " ", true], "asciimath": ["\\$", "\\$"], "latexmath": ["\\(", "\\)"]})), 'default=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- Opal.const_set($nesting[0], 'DropAnchorRx', /<(?:a\b[^>]*|\/a)>/);
- Opal.const_set($nesting[0], 'StemBreakRx', / *\\\n(?:\\?\n)*|\n\n+/);
- if ($$($nesting, 'RUBY_ENGINE')['$==']("opal")) {
-
- Opal.const_set($nesting[0], 'SvgPreambleRx', new RegExp("" + "^" + ($$($nesting, 'CC_ALL')) + "*?(?=])"));
- Opal.const_set($nesting[0], 'SvgStartTagRx', /^]*)?>/);
- } else {
- nil
- };
- Opal.const_set($nesting[0], 'DimensionAttributeRx', new RegExp("" + "\\s(?:width|height|style)=([\"'])" + ($$($nesting, 'CC_ANY')) + "*?\\1"));
-
- Opal.def(self, '$initialize', $Html5Converter_initialize$1 = function $$initialize(backend, opts) {
- var self = this, syntax = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- self.backend = backend;
- if (opts['$[]']("htmlsyntax")['$==']("xml")) {
-
- syntax = "xml";
- self.xml_mode = true;
- self.void_element_slash = "/";
- } else {
-
- syntax = "html";
- self.xml_mode = nil;
- self.void_element_slash = "";
- };
- return self.$init_backend_traits($hash2(["basebackend", "filetype", "htmlsyntax", "outfilesuffix", "supports_templates"], {"basebackend": "html", "filetype": "html", "htmlsyntax": syntax, "outfilesuffix": ".html", "supports_templates": true}));
- }, $Html5Converter_initialize$1.$$arity = -2);
-
- Opal.def(self, '$convert', $Html5Converter_convert$2 = function $$convert(node, transform, opts) {
- var $iter = $Html5Converter_convert$2.$$p, $yield = $iter || nil, self = this, $zuper = nil, $zuper_i = nil, $zuper_ii = nil;
-
- if ($iter) $Html5Converter_convert$2.$$p = null;
- // Prepare super implicit arguments
- for($zuper_i = 0, $zuper_ii = arguments.length, $zuper = new Array($zuper_ii); $zuper_i < $zuper_ii; $zuper_i++) {
- $zuper[$zuper_i] = arguments[$zuper_i];
- }
-
-
- if (transform == null) {
- transform = node.$node_name();
- };
-
- if (opts == null) {
- opts = nil;
- };
- if (transform['$==']("inline_quoted")) {
- return self.$convert_inline_quoted(node)
- } else if (transform['$==']("paragraph")) {
- return self.$convert_paragraph(node)
- } else if (transform['$==']("inline_anchor")) {
- return self.$convert_inline_anchor(node)
- } else if (transform['$==']("section")) {
- return self.$convert_section(node)
- } else if (transform['$==']("listing")) {
- return self.$convert_listing(node)
- } else if (transform['$==']("literal")) {
- return self.$convert_literal(node)
- } else if (transform['$==']("ulist")) {
- return self.$convert_ulist(node)
- } else if (transform['$==']("olist")) {
- return self.$convert_olist(node)
- } else if (transform['$==']("dlist")) {
- return self.$convert_dlist(node)
- } else if (transform['$==']("admonition")) {
- return self.$convert_admonition(node)
- } else if (transform['$==']("colist")) {
- return self.$convert_colist(node)
- } else if (transform['$==']("embedded")) {
- return self.$convert_embedded(node)
- } else if (transform['$==']("example")) {
- return self.$convert_example(node)
- } else if (transform['$==']("floating_title")) {
- return self.$convert_floating_title(node)
- } else if (transform['$==']("image")) {
- return self.$convert_image(node)
- } else if (transform['$==']("inline_break")) {
- return self.$convert_inline_break(node)
- } else if (transform['$==']("inline_button")) {
- return self.$convert_inline_button(node)
- } else if (transform['$==']("inline_callout")) {
- return self.$convert_inline_callout(node)
- } else if (transform['$==']("inline_footnote")) {
- return self.$convert_inline_footnote(node)
- } else if (transform['$==']("inline_image")) {
- return self.$convert_inline_image(node)
- } else if (transform['$==']("inline_indexterm")) {
- return self.$convert_inline_indexterm(node)
- } else if (transform['$==']("inline_kbd")) {
- return self.$convert_inline_kbd(node)
- } else if (transform['$==']("inline_menu")) {
- return self.$convert_inline_menu(node)
- } else if (transform['$==']("open")) {
- return self.$convert_open(node)
- } else if (transform['$==']("page_break")) {
- return self.$convert_page_break(node)
- } else if (transform['$==']("preamble")) {
- return self.$convert_preamble(node)
- } else if (transform['$==']("quote")) {
- return self.$convert_quote(node)
- } else if (transform['$==']("sidebar")) {
- return self.$convert_sidebar(node)
- } else if (transform['$==']("stem")) {
- return self.$convert_stem(node)
- } else if (transform['$==']("table")) {
- return self.$convert_table(node)
- } else if (transform['$==']("thematic_break")) {
- return self.$convert_thematic_break(node)
- } else if (transform['$==']("verse")) {
- return self.$convert_verse(node)
- } else if (transform['$==']("video")) {
- return self.$convert_video(node)
- } else if (transform['$==']("document")) {
- return self.$convert_document(node)
- } else if (transform['$==']("toc")) {
- return self.$convert_toc(node)
- } else if (transform['$==']("pass")) {
- return self.$convert_pass(node)
- } else if (transform['$==']("audio")) {
- return self.$convert_audio(node)
- } else {
- return $send(self, Opal.find_super_dispatcher(self, 'convert', $Html5Converter_convert$2, false), $zuper, $iter)
- };
- }, $Html5Converter_convert$2.$$arity = -2);
-
- Opal.def(self, '$convert_document', $Html5Converter_convert_document$3 = function $$convert_document(node) {
- var $a, $b, $c, $$4, $$5, self = this, br = nil, slash = nil, asset_uri_scheme = nil, cdn_base_url = nil, linkcss = nil, max_width_attr = nil, result = nil, lang_attribute = nil, authors = nil, icon_href = nil, icon_type = nil, icon_ext = nil, webfonts = nil, iconfont_stylesheet = nil, syntax_hl = nil, syntax_hl_docinfo_head_idx = nil, docinfo_content = nil, id_attr = nil, sectioned = nil, classes = nil, details = nil, idx = nil, $writer = nil, eqnums_val = nil, eqnums_opt = nil;
-
-
- br = "" + " ";
- if ($truthy((asset_uri_scheme = node.$attr("asset-uri-scheme", "https"))['$empty?']())) {
- } else {
- asset_uri_scheme = "" + (asset_uri_scheme) + ":"
- };
- cdn_base_url = "" + (asset_uri_scheme) + "//cdnjs.cloudflare.com/ajax/libs";
- linkcss = node['$attr?']("linkcss");
- max_width_attr = (function() {if ($truthy(node['$attr?']("max-width"))) {
- return "" + " style=\"max-width: " + (node.$attr("max-width")) + ";\""
- } else {
- return ""
- }; return nil; })();
- result = [""];
- lang_attribute = (function() {if ($truthy(node['$attr?']("nolang"))) {
- return ""
- } else {
- return "" + " lang=\"" + (node.$attr("lang", "en")) + "\""
- }; return nil; })();
- result['$<<']("" + "");
- result['$<<']("" + "\n" + " \n" + " \n" + " \n" + " ");
- if ($truthy(node['$attr?']("app-name"))) {
- result['$<<']("" + " ")};
- if ($truthy(node['$attr?']("description"))) {
- result['$<<']("" + " ")};
- if ($truthy(node['$attr?']("keywords"))) {
- result['$<<']("" + " ")};
- if ($truthy(node['$attr?']("authors"))) {
- result['$<<']("" + " ")};
- if ($truthy(node['$attr?']("copyright"))) {
- result['$<<']("" + " ")};
- if ($truthy(node['$attr?']("favicon"))) {
-
- if ($truthy((icon_href = node.$attr("favicon"))['$empty?']())) {
-
- icon_href = "favicon.ico";
- icon_type = "image/x-icon";
- } else if ($truthy((icon_ext = $$($nesting, 'Helpers').$extname(icon_href, nil)))) {
- icon_type = (function() {if (icon_ext['$=='](".ico")) {
- return "image/x-icon"
- } else {
- return "" + "image/" + (icon_ext.$slice(1, icon_ext.$length()))
- }; return nil; })()
- } else {
- icon_type = "image/x-icon"
- };
- result['$<<']("" + " ");};
- result['$<<']("" + "" + (node.$doctitle($hash2(["sanitize", "use_fallback"], {"sanitize": true, "use_fallback": true}))) + " ");
- if ($truthy($$($nesting, 'DEFAULT_STYLESHEET_KEYS')['$include?'](node.$attr("stylesheet")))) {
-
- if ($truthy((webfonts = node.$attr("webfonts")))) {
- result['$<<']("" + " ")};
- if ($truthy(linkcss)) {
- result['$<<']("" + " ")
- } else {
- result['$<<']("" + "")
- };
- } else if ($truthy(node['$attr?']("stylesheet"))) {
- if ($truthy(linkcss)) {
- result['$<<']("" + " ")
- } else {
- result['$<<']("" + "")
- }};
- if ($truthy(node['$attr?']("icons", "font"))) {
- if ($truthy(node['$attr?']("iconfont-remote"))) {
- result['$<<']("" + " ")
- } else {
-
- iconfont_stylesheet = "" + (node.$attr("iconfont-name", "font-awesome")) + ".css";
- result['$<<']("" + " ");
- }};
- if ($truthy((syntax_hl = node.$syntax_highlighter()))) {
- result['$<<']((syntax_hl_docinfo_head_idx = result.$size()))};
- if ($truthy((docinfo_content = node.$docinfo())['$empty?']())) {
- } else {
- result['$<<'](docinfo_content)
- };
- result['$<<']("");
- id_attr = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = (sectioned = node['$sections?']())) ? node['$attr?']("toc-class") : $c)) ? node['$attr?']("toc") : $b)) ? node['$attr?']("toc-placement", "auto") : $a))) {
- classes = [node.$doctype(), node.$attr("toc-class"), "" + "toc-" + (node.$attr("toc-position", "header"))]
- } else {
- classes = [node.$doctype()]
- };
- if ($truthy(node['$role?']())) {
- classes['$<<'](node.$role())};
- result['$<<']("" + "");
- if ($truthy((docinfo_content = node.$docinfo("header"))['$empty?']())) {
- } else {
- result['$<<'](docinfo_content)
- };
- if ($truthy(node.$noheader())) {
- } else {
-
- result['$<<']("" + "");
- };
- result['$<<']("" + "\n" + (node.$content()) + "\n" + "
");
- if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) {
-
- result['$<<']("" + "");};
- if ($truthy(node.$nofooter())) {
- } else {
-
- result['$<<']("" + "");
- };
- if ($truthy(syntax_hl)) {
-
- if ($truthy(syntax_hl['$docinfo?']("head"))) {
-
- $writer = [syntax_hl_docinfo_head_idx, syntax_hl.$docinfo("head", node, $hash2(["cdn_base_url", "linkcss", "self_closing_tag_slash"], {"cdn_base_url": cdn_base_url, "linkcss": linkcss, "self_closing_tag_slash": slash}))];
- $send(result, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];
- } else {
- result.$delete_at(syntax_hl_docinfo_head_idx)
- };
- if ($truthy(syntax_hl['$docinfo?']("footer"))) {
- result['$<<'](syntax_hl.$docinfo("footer", node, $hash2(["cdn_base_url", "linkcss", "self_closing_tag_slash"], {"cdn_base_url": cdn_base_url, "linkcss": linkcss, "self_closing_tag_slash": slash})))};};
- if ($truthy(node['$attr?']("stem"))) {
-
- eqnums_val = node.$attr("eqnums", "none");
- if ($truthy(eqnums_val['$empty?']())) {
- eqnums_val = "AMS"};
- eqnums_opt = "" + " equationNumbers: { autoNumber: \"" + (eqnums_val) + "\" } ";
- result['$<<']("" + "\n" + "");};
- if ($truthy((docinfo_content = node.$docinfo("footer"))['$empty?']())) {
- } else {
- result['$<<'](docinfo_content)
- };
- result['$<<']("");
- result['$<<']("");
- return result.$join($$($nesting, 'LF'));
- }, $Html5Converter_convert_document$3.$$arity = 1);
-
- Opal.def(self, '$convert_embedded', $Html5Converter_convert_embedded$6 = function $$convert_embedded(node) {
- var $a, $b, $c, $$7, self = this, result = nil, id_attr = nil, toc_p = nil;
-
-
- result = [];
- if (node.$doctype()['$==']("manpage")) {
-
- if ($truthy(node.$notitle())) {
- } else {
-
- id_attr = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- result['$<<']("" + "" + (node.$doctitle()) + " Manual Page ");
- };
- if ($truthy(node['$attr?']("manpurpose"))) {
- result['$<<'](self.$generate_manname_section(node))};
- } else if ($truthy(($truthy($a = node['$header?']()) ? node.$notitle()['$!']() : $a))) {
-
- id_attr = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- result['$<<']("" + "" + (node.$header().$title()) + " ");};
- if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$sections?']()) ? node['$attr?']("toc") : $c)) ? (toc_p = node.$attr("toc-placement"))['$!=']("macro") : $b)) ? toc_p['$!=']("preamble") : $a))) {
- result['$<<']("" + "\n" + "
" + (node.$attr("toc-title")) + "
\n" + (node.$converter().$convert(node, "outline")) + "\n" + "
")};
- result['$<<'](node.$content());
- if ($truthy(($truthy($a = node['$footnotes?']()) ? node['$attr?']("nofootnotes")['$!']() : $a))) {
-
- result['$<<']("" + "");};
- return result.$join($$($nesting, 'LF'));
- }, $Html5Converter_convert_embedded$6.$$arity = 1);
-
- Opal.def(self, '$convert_outline', $Html5Converter_convert_outline$8 = function $$convert_outline(node, opts) {
- var $a, $b, $$9, self = this, sectnumlevels = nil, toclevels = nil, sections = nil, result = nil;
-
-
-
- if (opts == null) {
- opts = $hash2([], {});
- };
- if ($truthy(node['$sections?']())) {
- } else {
- return nil
- };
- sectnumlevels = ($truthy($a = opts['$[]']("sectnumlevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("sectnumlevels")) ? $b : 3).$to_i());
- toclevels = ($truthy($a = opts['$[]']("toclevels")) ? $a : ($truthy($b = node.$document().$attributes()['$[]']("toclevels")) ? $b : 2).$to_i());
- sections = node.$sections();
- result = ["" + ""];
- $send(sections, 'each', [], ($$9 = function(section){var self = $$9.$$s || this, $c, slevel = nil, stitle = nil, signifier = nil, child_toc_level = nil;
-
-
-
- if (section == null) {
- section = nil;
- };
- slevel = section.$level();
- if ($truthy(section.$caption())) {
- stitle = section.$captioned_title()
- } else if ($truthy(($truthy($c = section.$numbered()) ? $rb_le(slevel, sectnumlevels) : $c))) {
- if ($truthy(($truthy($c = $rb_lt(slevel, 2)) ? node.$document().$doctype()['$==']("book") : $c))) {
- if (section.$sectname()['$==']("chapter")) {
- stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("chapter-signifier")))) {
- return "" + (signifier) + " "
- } else {
- return ""
- }; return nil; })()) + (section.$sectnum()) + " " + (section.$title())
- } else if (section.$sectname()['$==']("part")) {
- stitle = "" + ((function() {if ($truthy((signifier = node.$document().$attributes()['$[]']("part-signifier")))) {
- return "" + (signifier) + " "
- } else {
- return ""
- }; return nil; })()) + (section.$sectnum(nil, ":")) + " " + (section.$title())
- } else {
- stitle = "" + (section.$sectnum()) + " " + (section.$title())
- }
- } else {
- stitle = "" + (section.$sectnum()) + " " + (section.$title())
- }
- } else {
- stitle = section.$title()
- };
- if ($truthy(stitle['$include?']("" + (stitle) + " ");
- result['$<<'](child_toc_level);
- return result['$<<']("");
- } else {
- return result['$<<']("" + "" + (stitle) + " ")
- };}, $$9.$$s = self, $$9.$$arity = 1, $$9));
- result['$<<'](" ");
- return result.$join($$($nesting, 'LF'));
- }, $Html5Converter_convert_outline$8.$$arity = -2);
-
- Opal.def(self, '$convert_section', $Html5Converter_convert_section$10 = function $$convert_section(node) {
- var $a, $b, self = this, doc_attrs = nil, level = nil, title = nil, signifier = nil, id_attr = nil, id = nil, role = nil;
-
-
- doc_attrs = node.$document().$attributes();
- level = node.$level();
- if ($truthy(node.$caption())) {
- title = node.$captioned_title()
- } else if ($truthy(($truthy($a = node.$numbered()) ? $rb_le(level, ($truthy($b = doc_attrs['$[]']("sectnumlevels")) ? $b : 3).$to_i()) : $a))) {
- if ($truthy(($truthy($a = $rb_lt(level, 2)) ? node.$document().$doctype()['$==']("book") : $a))) {
- if (node.$sectname()['$==']("chapter")) {
- title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("chapter-signifier")))) {
- return "" + (signifier) + " "
- } else {
- return ""
- }; return nil; })()) + (node.$sectnum()) + " " + (node.$title())
- } else if (node.$sectname()['$==']("part")) {
- title = "" + ((function() {if ($truthy((signifier = doc_attrs['$[]']("part-signifier")))) {
- return "" + (signifier) + " "
- } else {
- return ""
- }; return nil; })()) + (node.$sectnum(nil, ":")) + " " + (node.$title())
- } else {
- title = "" + (node.$sectnum()) + " " + (node.$title())
- }
- } else {
- title = "" + (node.$sectnum()) + " " + (node.$title())
- }
- } else {
- title = node.$title()
- };
- if ($truthy(node.$id())) {
-
- id_attr = "" + " id=\"" + ((id = node.$id())) + "\"";
- if ($truthy(doc_attrs['$[]']("sectlinks"))) {
- title = "" + "" + (title) + " "};
- if ($truthy(doc_attrs['$[]']("sectanchors"))) {
- if (doc_attrs['$[]']("sectanchors")['$==']("after")) {
- title = "" + (title) + " "
- } else {
- title = "" + " " + (title)
- }};
- } else {
- id_attr = ""
- };
- if (level['$=='](0)) {
- return "" + "" + (title) + " \n" + (node.$content())
- } else {
- return "" + "\n" + "
" + (title) + " \n" + ((function() {if (level['$=='](1)) {
- return "" + "
\n" + (node.$content()) + "\n" + "
"
- } else {
- return node.$content()
- }; return nil; })()) + "\n" + "
"
- };
- }, $Html5Converter_convert_section$10.$$arity = 1);
-
- Opal.def(self, '$convert_admonition', $Html5Converter_convert_admonition$11 = function $$convert_admonition(node) {
- var $a, self = this, id_attr = nil, name = nil, title_element = nil, label = nil, role = nil;
-
-
- id_attr = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- name = node.$attr("name");
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- if ($truthy(node.$document()['$attr?']("icons"))) {
- if ($truthy(($truthy($a = node.$document()['$attr?']("icons", "font")) ? node['$attr?']("icon")['$!']() : $a))) {
- label = "" + " "
- } else {
- label = "" + " "
- }
- } else {
- label = "" + "" + (node.$attr("textlabel")) + "
"
- };
- return "" + "\n" + "
\n" + "\n" + "\n" + (label) + "\n" + " \n" + "\n" + (title_element) + (node.$content()) + "\n" + " \n" + " \n" + "
\n" + "
";
- }, $Html5Converter_convert_admonition$11.$$arity = 1);
-
- Opal.def(self, '$convert_audio', $Html5Converter_convert_audio$12 = function $$convert_audio(node) {
- var $a, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, start_t = nil, end_t = nil, time_anchor = nil;
-
-
- xml = self.xml_mode;
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = ["audioblock", node.$role()].$compact();
- class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\"";
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- start_t = node.$attr("start");
- end_t = node.$attr("end");
- time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) {
- return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) {
- return "" + "," + (end_t)
- } else {
- return ""
- }; return nil; })())
- } else {
- return ""
- }; return nil; })();
- return "" + "\n" + (title_element) + "
\n" + "
\n" + "Your browser does not support the audio tag.\n" + " \n" + "
\n" + "
";
- }, $Html5Converter_convert_audio$12.$$arity = 1);
-
- Opal.def(self, '$convert_colist', $Html5Converter_convert_colist$13 = function $$convert_colist(node) {
- var $a, $$14, $$15, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, font_icons = nil, num = nil;
-
-
- result = [];
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = ["colist", node.$style(), node.$role()].$compact();
- class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\"";
- result['$<<']("" + "");
- if ($truthy(node['$title?']())) {
- result['$<<']("" + "
" + (node.$title()) + "
")};
- if ($truthy(node.$document()['$attr?']("icons"))) {
-
- result['$<<']("
");
- $a = [node.$document()['$attr?']("icons", "font"), 0], (font_icons = $a[0]), (num = $a[1]), $a;
- $send(node.$items(), 'each', [], ($$14 = function(item){var self = $$14.$$s || this, num_label = nil;
- if (self.void_element_slash == null) self.void_element_slash = nil;
-
-
-
- if (item == null) {
- item = nil;
- };
- num = $rb_plus(num, 1);
- if ($truthy(font_icons)) {
- num_label = "" + "" + (num) + " "
- } else {
- num_label = "" + " "
- };
- return result['$<<']("" + "\n" + "" + (num_label) + " \n" + "" + (item.$text()) + ((function() {if ($truthy(item['$blocks?']())) {
- return $rb_plus($$($nesting, 'LF'), item.$content())
- } else {
- return ""
- }; return nil; })()) + " \n" + " ");}, $$14.$$s = self, $$14.$$arity = 1, $$14));
- result['$<<']("
");
- } else {
-
- result['$<<']("
");
- $send(node.$items(), 'each', [], ($$15 = function(item){var self = $$15.$$s || this;
-
-
-
- if (item == null) {
- item = nil;
- };
- return result['$<<']("" + "\n" + "" + (item.$text()) + "
" + ((function() {if ($truthy(item['$blocks?']())) {
- return $rb_plus($$($nesting, 'LF'), item.$content())
- } else {
- return ""
- }; return nil; })()) + "\n" + " ");}, $$15.$$s = self, $$15.$$arity = 1, $$15));
- result['$<<'](" ");
- };
- result['$<<']("
");
- return result.$join($$($nesting, 'LF'));
- }, $Html5Converter_convert_colist$13.$$arity = 1);
-
- Opal.def(self, '$convert_dlist', $Html5Converter_convert_dlist$16 = function $$convert_dlist(node) {
- var $$17, $a, $$19, $$21, self = this, result = nil, id_attribute = nil, classes = nil, $case = nil, class_attribute = nil, slash = nil, col_style_attribute = nil, dt_style_attribute = nil;
-
-
- result = [];
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = (function() {$case = node.$style();
- if ("qanda"['$===']($case)) {return ["qlist", "qanda", node.$role()]}
- else if ("horizontal"['$===']($case)) {return ["hdlist", node.$role()]}
- else {return ["dlist", node.$style(), node.$role()]}})().$compact();
- class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\"";
- result['$<<']("" + "");
- if ($truthy(node['$title?']())) {
- result['$<<']("" + "
" + (node.$title()) + "
")};
- $case = node.$style();
- if ("qanda"['$===']($case)) {
- result['$<<']("
");
- $send(node.$items(), 'each', [], ($$17 = function(terms, dd){var self = $$17.$$s || this, $$18;
-
-
-
- if (terms == null) {
- terms = nil;
- };
-
- if (dd == null) {
- dd = nil;
- };
- result['$<<']("");
- $send(terms, 'each', [], ($$18 = function(dt){var self = $$18.$$s || this;
-
-
-
- if (dt == null) {
- dt = nil;
- };
- return result['$<<']("" + "" + (dt.$text()) + "
");}, $$18.$$s = self, $$18.$$arity = 1, $$18));
- if ($truthy(dd)) {
-
- if ($truthy(dd['$text?']())) {
- result['$<<']("" + "" + (dd.$text()) + "
")};
- if ($truthy(dd['$blocks?']())) {
- result['$<<'](dd.$content())};};
- return result['$<<'](" ");}, $$17.$$s = self, $$17.$$arity = 2, $$17));
- result['$<<'](" ");}
- else if ("horizontal"['$===']($case)) {
- slash = self.void_element_slash;
- result['$<<']("
");
- if ($truthy(($truthy($a = node['$attr?']("labelwidth")) ? $a : node['$attr?']("itemwidth")))) {
-
- result['$<<']("");
- col_style_attribute = (function() {if ($truthy(node['$attr?']("labelwidth"))) {
- return "" + " style=\"width: " + (node.$attr("labelwidth").$chomp("%")) + "%;\""
- } else {
- return ""
- }; return nil; })();
- result['$<<']("" + " ");
- col_style_attribute = (function() {if ($truthy(node['$attr?']("itemwidth"))) {
- return "" + " style=\"width: " + (node.$attr("itemwidth").$chomp("%")) + "%;\""
- } else {
- return ""
- }; return nil; })();
- result['$<<']("" + " ");
- result['$<<'](" ");};
- $send(node.$items(), 'each', [], ($$19 = function(terms, dd){var self = $$19.$$s || this, $$20, first_term = nil;
-
-
-
- if (terms == null) {
- terms = nil;
- };
-
- if (dd == null) {
- dd = nil;
- };
- result['$<<']("");
- result['$<<']("" + "");
- first_term = true;
- $send(terms, 'each', [], ($$20 = function(dt){var self = $$20.$$s || this;
-
-
-
- if (dt == null) {
- dt = nil;
- };
- if ($truthy(first_term)) {
- } else {
- result['$<<']("" + " ")
- };
- result['$<<'](dt.$text());
- return (first_term = nil);}, $$20.$$s = self, $$20.$$arity = 1, $$20));
- result['$<<'](" ");
- result['$<<']("");
- if ($truthy(dd)) {
-
- if ($truthy(dd['$text?']())) {
- result['$<<']("" + "" + (dd.$text()) + "
")};
- if ($truthy(dd['$blocks?']())) {
- result['$<<'](dd.$content())};};
- result['$<<'](" ");
- return result['$<<'](" ");}, $$19.$$s = self, $$19.$$arity = 2, $$19));
- result['$<<']("
");}
- else {
- result['$<<']("
");
- dt_style_attribute = (function() {if ($truthy(node.$style())) {
- return ""
- } else {
- return " class=\"hdlist1\""
- }; return nil; })();
- $send(node.$items(), 'each', [], ($$21 = function(terms, dd){var self = $$21.$$s || this, $$22;
-
-
-
- if (terms == null) {
- terms = nil;
- };
-
- if (dd == null) {
- dd = nil;
- };
- $send(terms, 'each', [], ($$22 = function(dt){var self = $$22.$$s || this;
-
-
-
- if (dt == null) {
- dt = nil;
- };
- return result['$<<']("" + "" + (dt.$text()) + " ");}, $$22.$$s = self, $$22.$$arity = 1, $$22));
- if ($truthy(dd)) {
-
- result['$<<']("");
- if ($truthy(dd['$text?']())) {
- result['$<<']("" + "" + (dd.$text()) + "
")};
- if ($truthy(dd['$blocks?']())) {
- result['$<<'](dd.$content())};
- return result['$<<'](" ");
- } else {
- return nil
- };}, $$21.$$s = self, $$21.$$arity = 2, $$21));
- result['$<<'](" ");};
- result['$<<']("
");
- return result.$join($$($nesting, 'LF'));
- }, $Html5Converter_convert_dlist$16.$$arity = 1);
-
- Opal.def(self, '$convert_example', $Html5Converter_convert_example$23 = function $$convert_example(node) {
- var self = this, id_attribute = nil, class_attribute = nil, summary_element = nil, title_element = nil, role = nil;
-
-
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- if ($truthy(node['$option?']("collapsible"))) {
-
- class_attribute = (function() {if ($truthy(node.$role())) {
- return "" + " class=\"" + (node.$role()) + "\""
- } else {
- return ""
- }; return nil; })();
- summary_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$title()) + " "
- } else {
- return "Details "
- }; return nil; })();
- return "" + "\n" + (summary_element) + "\n" + "\n" + (node.$content()) + "\n" + "
\n" + " ";
- } else {
-
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$captioned_title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- return "" + "\n" + (title_element) + "
\n" + (node.$content()) + "\n" + "
\n" + "
";
- };
- }, $Html5Converter_convert_example$23.$$arity = 1);
-
- Opal.def(self, '$convert_floating_title', $Html5Converter_convert_floating_title$24 = function $$convert_floating_title(node) {
- var self = this, tag_name = nil, id_attribute = nil, classes = nil;
-
-
- tag_name = "" + "h" + ($rb_plus(node.$level(), 1));
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = [node.$style(), node.$role()].$compact();
- return "" + "<" + (tag_name) + (id_attribute) + " class=\"" + (classes.$join(" ")) + "\">" + (node.$title()) + "" + (tag_name) + ">";
- }, $Html5Converter_convert_floating_title$24.$$arity = 1);
-
- Opal.def(self, '$convert_image', $Html5Converter_convert_image$25 = function $$convert_image(node) {
- var $a, $b, $c, self = this, target = nil, width_attr = nil, height_attr = nil, svg = nil, obj = nil, img = nil, fallback = nil, id_attr = nil, classes = nil, class_attr = nil, title_el = nil;
-
-
- target = node.$attr("target");
- width_attr = (function() {if ($truthy(node['$attr?']("width"))) {
- return "" + " width=\"" + (node.$attr("width")) + "\""
- } else {
- return ""
- }; return nil; })();
- height_attr = (function() {if ($truthy(node['$attr?']("height"))) {
- return "" + " height=\"" + (node.$attr("height")) + "\""
- } else {
- return ""
- }; return nil; })();
- if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = node['$attr?']("format", "svg")) ? $c : target['$include?'](".svg"))) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) {
- if ($truthy(svg)) {
- img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + " ")
- } else if ($truthy(obj)) {
-
- fallback = (function() {if ($truthy(node['$attr?']("fallback"))) {
- return "" + " "
- } else {
- return "" + "" + (node.$alt()) + " "
- }; return nil; })();
- img = "" + "" + (fallback) + " ";}};
- img = ($truthy($a = img) ? $a : "" + " ");
- if ($truthy(node['$attr?']("link"))) {
- img = "" + "" + (img) + " "};
- id_attr = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = ["imageblock"];
- if ($truthy(node['$attr?']("float"))) {
- classes['$<<'](node.$attr("float"))};
- if ($truthy(node['$attr?']("align"))) {
- classes['$<<']("" + "text-" + (node.$attr("align")))};
- if ($truthy(node.$role())) {
- classes['$<<'](node.$role())};
- class_attr = "" + " class=\"" + (classes.$join(" ")) + "\"";
- title_el = (function() {if ($truthy(node['$title?']())) {
- return "" + "\n" + (node.$captioned_title()) + "
"
- } else {
- return ""
- }; return nil; })();
- return "" + "\n" + "
\n" + (img) + "\n" + "
" + (title_el) + "\n" + "
";
- }, $Html5Converter_convert_image$25.$$arity = 1);
-
- Opal.def(self, '$convert_listing', $Html5Converter_convert_listing$26 = function $$convert_listing(node) {
- var $a, self = this, nowrap = nil, lang = nil, syntax_hl = nil, opts = nil, doc_attrs = nil, $writer = nil, pre_open = nil, pre_close = nil, id_attribute = nil, title_element = nil, role = nil;
-
-
- nowrap = ($truthy($a = node['$option?']("nowrap")) ? $a : node.$document()['$attr?']("prewrap")['$!']());
- if (node.$style()['$==']("source")) {
-
- lang = node.$attr("language");
- if ($truthy((syntax_hl = node.$document().$syntax_highlighter()))) {
-
- opts = (function() {if ($truthy(syntax_hl['$highlight?']())) {
- return $hash2(["css_mode", "style"], {"css_mode": ($truthy($a = (doc_attrs = node.$document().$attributes())['$[]']("" + (syntax_hl.$name()) + "-css")) ? $a : "class").$to_sym(), "style": doc_attrs['$[]']("" + (syntax_hl.$name()) + "-style")})
- } else {
- return $hash2([], {})
- }; return nil; })();
-
- $writer = ["nowrap", nowrap];
- $send(opts, '[]=', Opal.to_a($writer));
- $writer[$rb_minus($writer["length"], 1)];;
- } else {
-
- pre_open = "" + "";
- pre_close = " ";
- };
- } else {
-
- pre_open = "" + "";
- pre_close = " ";
- };
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$captioned_title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- return "" + "\n" + (title_element) + "
\n" + ((function() {if ($truthy(syntax_hl)) {
-
- return syntax_hl.$format(node, lang, opts);
- } else {
- return $rb_plus($rb_plus(pre_open, ($truthy($a = node.$content()) ? $a : "")), pre_close)
- }; return nil; })()) + "\n" + "
\n" + "
";
- }, $Html5Converter_convert_listing$26.$$arity = 1);
-
- Opal.def(self, '$convert_literal', $Html5Converter_convert_literal$27 = function $$convert_literal(node) {
- var $a, self = this, id_attribute = nil, title_element = nil, nowrap = nil, role = nil;
-
-
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- nowrap = ($truthy($a = node.$document()['$attr?']("prewrap")['$!']()) ? $a : node['$option?']("nowrap"));
- return "" + "\n" + (title_element) + "
\n" + "
" + (node.$content()) + " \n" + "
\n" + "
";
- }, $Html5Converter_convert_literal$27.$$arity = 1);
-
- Opal.def(self, '$convert_stem', $Html5Converter_convert_stem$28 = function $$convert_stem(node) {
- var $a, $b, $$29, self = this, id_attribute = nil, title_element = nil, style = nil, open = nil, close = nil, equation = nil, br = nil, role = nil;
-
-
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- $b = $$($nesting, 'BLOCK_MATH_DELIMITERS')['$[]']((style = 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((equation = node.$content()))) {
-
- if ($truthy((($a = style['$==']("asciimath")) ? equation['$include?']($$($nesting, 'LF')) : style['$==']("asciimath")))) {
-
- br = "" + ($$($nesting, 'LF')) + " ";
- equation = $send(equation, 'gsub', [$$($nesting, 'StemBreakRx')], ($$29 = function(){var self = $$29.$$s || this, $c;
-
- return "" + (close) + ($rb_times(br, $rb_minus((($c = $gvars['~']) === nil ? nil : $c['$[]'](0)).$count($$($nesting, 'LF')), 1))) + ($$($nesting, 'LF')) + (open)}, $$29.$$s = self, $$29.$$arity = 0, $$29));};
- if ($truthy(($truthy($a = equation['$start_with?'](open)) ? equation['$end_with?'](close) : $a))) {
- } else {
- equation = "" + (open) + (equation) + (close)
- };
- } else {
- equation = ""
- };
- return "" + "\n" + (title_element) + "
\n" + (equation) + "\n" + "
\n" + "
";
- }, $Html5Converter_convert_stem$28.$$arity = 1);
-
- Opal.def(self, '$convert_olist', $Html5Converter_convert_olist$30 = function $$convert_olist(node) {
- var $$31, self = this, result = nil, id_attribute = nil, classes = nil, class_attribute = nil, type_attribute = nil, keyword = nil, start_attribute = nil, reversed_attribute = nil;
-
-
- result = [];
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = ["olist", node.$style(), node.$role()].$compact();
- class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\"";
- result['$<<']("" + "");
- if ($truthy(node['$title?']())) {
- result['$<<']("" + "
" + (node.$title()) + "
")};
- type_attribute = (function() {if ($truthy((keyword = node.$list_marker_keyword()))) {
- return "" + " type=\"" + (keyword) + "\""
- } else {
- return ""
- }; return nil; })();
- start_attribute = (function() {if ($truthy(node['$attr?']("start"))) {
- return "" + " start=\"" + (node.$attr("start")) + "\""
- } else {
- return ""
- }; return nil; })();
- reversed_attribute = (function() {if ($truthy(node['$option?']("reversed"))) {
-
- return self.$append_boolean_attribute("reversed", self.xml_mode);
- } else {
- return ""
- }; return nil; })();
- result['$<<']("" + "
");
- $send(node.$items(), 'each', [], ($$31 = function(item){var self = $$31.$$s || this;
-
-
-
- if (item == null) {
- item = nil;
- };
- if ($truthy(item.$id())) {
- result['$<<']("" + "")
- } else if ($truthy(item.$role())) {
- result['$<<']("" + " ")
- } else {
- result['$<<'](" ")
- };
- result['$<<']("" + "" + (item.$text()) + "
");
- if ($truthy(item['$blocks?']())) {
- result['$<<'](item.$content())};
- return result['$<<'](" ");}, $$31.$$s = self, $$31.$$arity = 1, $$31));
- result['$<<'](" ");
- result['$<<']("
");
- return result.$join($$($nesting, 'LF'));
- }, $Html5Converter_convert_olist$30.$$arity = 1);
-
- Opal.def(self, '$convert_open', $Html5Converter_convert_open$32 = function $$convert_open(node) {
- var $a, $b, $c, self = this, style = nil, id_attr = nil, title_el = nil, role = nil;
-
- if ((style = node.$style())['$==']("abstract")) {
- if ($truthy((($a = node.$parent()['$=='](node.$document())) ? node.$document().$doctype()['$==']("book") : node.$parent()['$=='](node.$document())))) {
-
- self.$logger().$warn("abstract block cannot be used in a document without a title when doctype is book. Excluding block content.");
- return "";
- } else {
-
- id_attr = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- title_el = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- return "" + "\n" + (title_el) + "
\n" + (node.$content()) + "\n" + " \n" + "
";
- }
- } else if ($truthy((($a = style['$==']("partintro")) ? ($truthy($b = ($truthy($c = $rb_gt(node.$level(), 0)) ? $c : node.$parent().$context()['$!=']("section"))) ? $b : node.$document().$doctype()['$!=']("book")) : style['$==']("partintro")))) {
-
- self.$logger().$error("partintro block can only be used when doctype is book and must be a child of a book part. Excluding block content.");
- return "";
- } else {
-
- id_attr = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- title_el = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- return "" + "\n" + (title_el) + "
\n" + (node.$content()) + "\n" + "
\n" + "
";
- }
- }, $Html5Converter_convert_open$32.$$arity = 1);
-
- Opal.def(self, '$convert_page_break', $Html5Converter_convert_page_break$33 = function $$convert_page_break(node) {
- var self = this;
-
- return "
"
- }, $Html5Converter_convert_page_break$33.$$arity = 1);
-
- Opal.def(self, '$convert_paragraph', $Html5Converter_convert_paragraph$34 = function $$convert_paragraph(node) {
- var self = this, attributes = nil;
-
-
- if ($truthy(node.$role())) {
- attributes = "" + ((function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })()) + " class=\"paragraph " + (node.$role()) + "\""
- } else if ($truthy(node.$id())) {
- attributes = "" + " id=\"" + (node.$id()) + "\" class=\"paragraph\""
- } else {
- attributes = " class=\"paragraph\""
- };
- if ($truthy(node['$title?']())) {
- return "" + "\n" + "
" + (node.$title()) + "
\n" + "
" + (node.$content()) + "
\n" + "
"
- } else {
- return "" + "\n" + "
" + (node.$content()) + "
\n" + "
"
- };
- }, $Html5Converter_convert_paragraph$34.$$arity = 1);
- Opal.alias(self, "convert_pass", "content_only");
-
- Opal.def(self, '$convert_preamble', $Html5Converter_convert_preamble$35 = function $$convert_preamble(node) {
- var $a, $b, self = this, doc = nil, toc = nil;
-
-
- if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "preamble")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) {
- toc = "" + "\n" + "\n" + "
" + (doc.$attr("toc-title")) + "
\n" + (doc.$converter().$convert(doc, "outline")) + "\n" + "
"
- } else {
- toc = ""
- };
- return "" + "\n" + "
\n" + (node.$content()) + "\n" + "
" + (toc) + "\n" + "
";
- }, $Html5Converter_convert_preamble$35.$$arity = 1);
-
- Opal.def(self, '$convert_quote', $Html5Converter_convert_quote$36 = function $$convert_quote(node) {
- var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil;
-
-
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = ["quoteblock", node.$role()].$compact();
- class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\"";
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "\n" + (node.$title()) + "
"
- } else {
- return ""
- }; return nil; })();
- attribution = (function() {if ($truthy(node['$attr?']("attribution"))) {
-
- return node.$attr("attribution");
- } else {
- return nil
- }; return nil; })();
- citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) {
-
- return node.$attr("citetitle");
- } else {
- return nil
- }; return nil; })();
- if ($truthy(($truthy($a = attribution) ? $a : citetitle))) {
-
- cite_element = (function() {if ($truthy(citetitle)) {
- return "" + "" + (citetitle) + " "
- } else {
- return ""
- }; return nil; })();
- attribution_text = (function() {if ($truthy(attribution)) {
- return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) {
- return "" + " \n"
- } else {
- return ""
- }; return nil; })())
- } else {
- return ""
- }; return nil; })();
- attribution_element = "" + "\n\n" + (attribution_text) + (cite_element) + "\n
";
- } else {
- attribution_element = ""
- };
- return "" + "" + (title_element) + "\n" + "
\n" + (node.$content()) + "\n" + " " + (attribution_element) + "\n" + "
";
- }, $Html5Converter_convert_quote$36.$$arity = 1);
-
- Opal.def(self, '$convert_thematic_break', $Html5Converter_convert_thematic_break$37 = function $$convert_thematic_break(node) {
- var self = this;
-
- return "" + " "
- }, $Html5Converter_convert_thematic_break$37.$$arity = 1);
-
- Opal.def(self, '$convert_sidebar', $Html5Converter_convert_sidebar$38 = function $$convert_sidebar(node) {
- var self = this, id_attribute = nil, title_element = nil, role = nil;
-
-
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "" + (node.$title()) + "
\n"
- } else {
- return ""
- }; return nil; })();
- return "" + "";
- }, $Html5Converter_convert_sidebar$38.$$arity = 1);
-
- Opal.def(self, '$convert_table', $Html5Converter_convert_table$39 = function $$convert_table(node) {
- var $a, $$40, $$41, self = this, result = nil, id_attribute = nil, frame = nil, classes = nil, stripes = nil, styles = nil, autowidth = nil, tablewidth = nil, role = nil, class_attribute = nil, style_attribute = nil, slash = nil;
-
-
- result = [];
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- if ((frame = node.$attr("frame", "all", "table-frame"))['$==']("topbot")) {
- frame = "ends"};
- classes = ["tableblock", "" + "frame-" + (frame), "" + "grid-" + (node.$attr("grid", "all", "table-grid"))];
- if ($truthy((stripes = node.$attr("stripes", nil, "table-stripes")))) {
- classes['$<<']("" + "stripes-" + (stripes))};
- styles = [];
- if ($truthy(($truthy($a = (autowidth = node['$option?']("autowidth"))) ? node['$attr?']("width")['$!']() : $a))) {
- classes['$<<']("fit-content")
- } else if ((tablewidth = node.$attr("tablepcwidth"))['$=='](100)) {
- classes['$<<']("stretch")
- } else {
- styles['$<<']("" + "width: " + (tablewidth) + "%;")
- };
- if ($truthy(node['$attr?']("float"))) {
- classes['$<<'](node.$attr("float"))};
- if ($truthy((role = node.$role()))) {
- classes['$<<'](role)};
- class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\"";
- style_attribute = (function() {if ($truthy(styles['$empty?']())) {
- return ""
- } else {
- return "" + " style=\"" + (styles.$join(" ")) + "\""
- }; return nil; })();
- result['$<<']("" + "");
- if ($truthy(node['$title?']())) {
- result['$<<']("" + "" + (node.$captioned_title()) + " ")};
- if ($truthy($rb_gt(node.$attr("rowcount"), 0))) {
-
- slash = self.void_element_slash;
- result['$<<']("");
- if ($truthy(autowidth)) {
- result = $rb_plus(result, $$($nesting, 'Array').$new(node.$columns().$size(), "" + " "))
- } else {
- $send(node.$columns(), 'each', [], ($$40 = function(col){var self = $$40.$$s || this;
-
-
-
- if (col == null) {
- col = nil;
- };
- return result['$<<']((function() {if ($truthy(col['$option?']("autowidth"))) {
- return "" + " "
- } else {
- return "" + " "
- }; return nil; })());}, $$40.$$s = self, $$40.$$arity = 1, $$40))
- };
- result['$<<'](" ");
- $send(node.$rows().$to_h(), 'each', [], ($$41 = function(tsec, rows){var self = $$41.$$s || this, $$42;
-
-
-
- if (tsec == null) {
- tsec = nil;
- };
-
- if (rows == null) {
- rows = nil;
- };
- if ($truthy(rows['$empty?']())) {
- return nil;};
- result['$<<']("" + "");
- $send(rows, 'each', [], ($$42 = function(row){var self = $$42.$$s || this, $$43;
-
-
-
- if (row == null) {
- row = nil;
- };
- result['$<<']("");
- $send(row, 'each', [], ($$43 = function(cell){var self = $$43.$$s || this, $b, cell_content = nil, $case = nil, cell_tag_name = nil, cell_class_attribute = nil, cell_colspan_attribute = nil, cell_rowspan_attribute = nil, cell_style_attribute = nil;
-
-
-
- if (cell == null) {
- cell = nil;
- };
- if (tsec['$==']("head")) {
- cell_content = cell.$text()
- } else {
- $case = cell.$style();
- if ("asciidoc"['$===']($case)) {cell_content = "" + "" + (cell.$content()) + "
"}
- else if ("literal"['$===']($case)) {cell_content = "" + ""}
- else {cell_content = (function() {if ($truthy((cell_content = cell.$content())['$empty?']())) {
- return ""
- } else {
- return "" + "" + (cell_content.$join("" + "
\n" + "")) + "
"
- }; return nil; })()}
- };
- cell_tag_name = (function() {if ($truthy(($truthy($b = tsec['$==']("head")) ? $b : cell.$style()['$==']("header")))) {
- return "th"
- } else {
- return "td"
- }; return nil; })();
- cell_class_attribute = "" + " class=\"tableblock halign-" + (cell.$attr("halign")) + " valign-" + (cell.$attr("valign")) + "\"";
- cell_colspan_attribute = (function() {if ($truthy(cell.$colspan())) {
- return "" + " colspan=\"" + (cell.$colspan()) + "\""
- } else {
- return ""
- }; return nil; })();
- cell_rowspan_attribute = (function() {if ($truthy(cell.$rowspan())) {
- return "" + " rowspan=\"" + (cell.$rowspan()) + "\""
- } else {
- return ""
- }; return nil; })();
- cell_style_attribute = (function() {if ($truthy(node.$document()['$attr?']("cellbgcolor"))) {
- return "" + " style=\"background-color: " + (node.$document().$attr("cellbgcolor")) + ";\""
- } else {
- return ""
- }; return nil; })();
- return result['$<<']("" + "<" + (cell_tag_name) + (cell_class_attribute) + (cell_colspan_attribute) + (cell_rowspan_attribute) + (cell_style_attribute) + ">" + (cell_content) + "" + (cell_tag_name) + ">");}, $$43.$$s = self, $$43.$$arity = 1, $$43));
- return result['$<<'](" ");}, $$42.$$s = self, $$42.$$arity = 1, $$42));
- return result['$<<']("" + " ");}, $$41.$$s = self, $$41.$$arity = 2, $$41));};
- result['$<<']("
");
- return result.$join($$($nesting, 'LF'));
- }, $Html5Converter_convert_table$39.$$arity = 1);
-
- Opal.def(self, '$convert_toc', $Html5Converter_convert_toc$44 = function $$convert_toc(node) {
- var $a, $b, self = this, doc = nil, id_attr = nil, title_id_attr = nil, title = nil, levels = nil, role = nil;
-
-
- if ($truthy(($truthy($a = ($truthy($b = (doc = node.$document())['$attr?']("toc-placement", "macro")) ? doc['$sections?']() : $b)) ? doc['$attr?']("toc") : $a))) {
- } else {
- return ""
- };
- if ($truthy(node.$id())) {
-
- id_attr = "" + " id=\"" + (node.$id()) + "\"";
- title_id_attr = "" + " id=\"" + (node.$id()) + "title\"";
- } else {
-
- id_attr = " id=\"toc\"";
- title_id_attr = " id=\"toctitle\"";
- };
- title = (function() {if ($truthy(node['$title?']())) {
- return node.$title()
- } else {
-
- return doc.$attr("toc-title");
- }; return nil; })();
- levels = (function() {if ($truthy(node['$attr?']("levels"))) {
- return node.$attr("levels").$to_i()
- } else {
- return nil
- }; return nil; })();
- role = (function() {if ($truthy(node['$role?']())) {
- return node.$role()
- } else {
-
- return doc.$attr("toc-class", "toc");
- }; return nil; })();
- return "" + "\n" + "
" + (title) + "
\n" + (doc.$converter().$convert(doc, "outline", $hash2(["toclevels"], {"toclevels": levels}))) + "\n" + "
";
- }, $Html5Converter_convert_toc$44.$$arity = 1);
-
- Opal.def(self, '$convert_ulist', $Html5Converter_convert_ulist$45 = function $$convert_ulist(node) {
- var $$46, self = this, result = nil, id_attribute = nil, div_classes = nil, marker_checked = nil, marker_unchecked = nil, checklist = nil, ul_class_attribute = nil;
-
-
- result = [];
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- div_classes = ["ulist", node.$style(), node.$role()].$compact();
- marker_checked = (marker_unchecked = "");
- if ($truthy((checklist = node['$option?']("checklist")))) {
-
- div_classes.$unshift(div_classes.$shift(), "checklist");
- ul_class_attribute = " class=\"checklist\"";
- if ($truthy(node['$option?']("interactive"))) {
- if ($truthy(self.xml_mode)) {
-
- marker_checked = " ";
- marker_unchecked = " ";
- } else {
-
- marker_checked = " ";
- marker_unchecked = " ";
- }
- } else if ($truthy(node.$document()['$attr?']("icons", "font"))) {
-
- marker_checked = " ";
- marker_unchecked = " ";
- } else {
-
- marker_checked = "✓ ";
- marker_unchecked = "❏ ";
- };
- } else {
- ul_class_attribute = (function() {if ($truthy(node.$style())) {
- return "" + " class=\"" + (node.$style()) + "\""
- } else {
- return ""
- }; return nil; })()
- };
- result['$<<']("" + "");
- if ($truthy(node['$title?']())) {
- result['$<<']("" + "
" + (node.$title()) + "
")};
- result['$<<']("" + "
");
- result['$<<']("
");
- return result.$join($$($nesting, 'LF'));
- }, $Html5Converter_convert_ulist$45.$$arity = 1);
-
- Opal.def(self, '$convert_verse', $Html5Converter_convert_verse$47 = function $$convert_verse(node) {
- var $a, self = this, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, attribution = nil, citetitle = nil, cite_element = nil, attribution_text = nil, attribution_element = nil;
-
-
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = ["verseblock", node.$role()].$compact();
- class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\"";
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "\n" + (node.$title()) + "
"
- } else {
- return ""
- }; return nil; })();
- attribution = (function() {if ($truthy(node['$attr?']("attribution"))) {
-
- return node.$attr("attribution");
- } else {
- return nil
- }; return nil; })();
- citetitle = (function() {if ($truthy(node['$attr?']("citetitle"))) {
-
- return node.$attr("citetitle");
- } else {
- return nil
- }; return nil; })();
- if ($truthy(($truthy($a = attribution) ? $a : citetitle))) {
-
- cite_element = (function() {if ($truthy(citetitle)) {
- return "" + "" + (citetitle) + " "
- } else {
- return ""
- }; return nil; })();
- attribution_text = (function() {if ($truthy(attribution)) {
- return "" + "— " + (attribution) + ((function() {if ($truthy(citetitle)) {
- return "" + " \n"
- } else {
- return ""
- }; return nil; })())
- } else {
- return ""
- }; return nil; })();
- attribution_element = "" + "\n\n" + (attribution_text) + (cite_element) + "\n
";
- } else {
- attribution_element = ""
- };
- return "" + "" + (title_element) + "\n" + "
" + (node.$content()) + " " + (attribution_element) + "\n" + "
";
- }, $Html5Converter_convert_verse$47.$$arity = 1);
-
- Opal.def(self, '$convert_video', $Html5Converter_convert_video$48 = function $$convert_video(node) {
- var $a, $b, self = this, xml = nil, id_attribute = nil, classes = nil, class_attribute = nil, title_element = nil, width_attribute = nil, height_attribute = nil, $case = nil, asset_uri_scheme = nil, start_anchor = nil, delimiter = nil, autoplay_param = nil, loop_param = nil, muted_param = nil, rel_param_val = nil, start_param = nil, end_param = nil, has_loop_param = nil, mute_param = nil, controls_param = nil, fs_param = nil, fs_attribute = nil, modest_param = nil, theme_param = nil, hl_param = nil, target = nil, list = nil, list_param = nil, playlist = nil, poster_attribute = nil, val = nil, preload_attribute = nil, start_t = nil, end_t = nil, time_anchor = nil;
-
-
- xml = self.xml_mode;
- id_attribute = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- classes = ["videoblock"];
- if ($truthy(node['$attr?']("float"))) {
- classes['$<<'](node.$attr("float"))};
- if ($truthy(node['$attr?']("align"))) {
- classes['$<<']("" + "text-" + (node.$attr("align")))};
- if ($truthy(node.$role())) {
- classes['$<<'](node.$role())};
- class_attribute = "" + " class=\"" + (classes.$join(" ")) + "\"";
- title_element = (function() {if ($truthy(node['$title?']())) {
- return "" + "\n" + (node.$title()) + "
"
- } else {
- return ""
- }; return nil; })();
- width_attribute = (function() {if ($truthy(node['$attr?']("width"))) {
- return "" + " width=\"" + (node.$attr("width")) + "\""
- } else {
- return ""
- }; return nil; })();
- height_attribute = (function() {if ($truthy(node['$attr?']("height"))) {
- return "" + " height=\"" + (node.$attr("height")) + "\""
- } else {
- return ""
- }; return nil; })();
- return (function() {$case = node.$attr("poster");
- if ("vimeo"['$===']($case)) {
- if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) {
- } else {
- asset_uri_scheme = "" + (asset_uri_scheme) + ":"
- };
- start_anchor = (function() {if ($truthy(node['$attr?']("start"))) {
- return "" + "#at=" + (node.$attr("start"))
- } else {
- return ""
- }; return nil; })();
- delimiter = ["?"];
- autoplay_param = (function() {if ($truthy(node['$option?']("autoplay"))) {
- return "" + (($truthy($a = delimiter.$pop()) ? $a : "&")) + "autoplay=1"
- } else {
- return ""
- }; return nil; })();
- loop_param = (function() {if ($truthy(node['$option?']("loop"))) {
- return "" + (($truthy($a = delimiter.$pop()) ? $a : "&")) + "loop=1"
- } else {
- return ""
- }; return nil; })();
- muted_param = (function() {if ($truthy(node['$option?']("muted"))) {
- return "" + (($truthy($a = delimiter.$pop()) ? $a : "&")) + "muted=1"
- } else {
- return ""
- }; return nil; })();
- return "" + "" + (title_element) + "\n" + "
\n" + "\n" + "
\n" + "
";}
- else if ("youtube"['$===']($case)) {
- if ($truthy((asset_uri_scheme = node.$document().$attr("asset-uri-scheme", "https"))['$empty?']())) {
- } else {
- asset_uri_scheme = "" + (asset_uri_scheme) + ":"
- };
- rel_param_val = (function() {if ($truthy(node['$option?']("related"))) {
- return 1
- } else {
- return 0
- }; return 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; })();
- autoplay_param = (function() {if ($truthy(node['$option?']("autoplay"))) {
- return "&autoplay=1"
- } else {
- return ""
- }; return nil; })();
- loop_param = (function() {if ($truthy((has_loop_param = node['$option?']("loop")))) {
- return "&loop=1"
- } else {
- return ""
- }; return nil; })();
- mute_param = (function() {if ($truthy(node['$option?']("muted"))) {
- return "&mute=1"
- } else {
- return ""
- }; return nil; })();
- controls_param = (function() {if ($truthy(node['$option?']("nocontrols"))) {
- return "&controls=0"
- } else {
- return ""
- }; return nil; })();
- if ($truthy(node['$option?']("nofullscreen"))) {
-
- fs_param = "&fs=0";
- fs_attribute = "";
- } else {
-
- fs_param = "";
- fs_attribute = self.$append_boolean_attribute("allowfullscreen", xml);
- };
- modest_param = (function() {if ($truthy(node['$option?']("modest"))) {
- return "&modestbranding=1"
- } else {
- return ""
- }; return nil; })();
- theme_param = (function() {if ($truthy(node['$attr?']("theme"))) {
- return "" + "&theme=" + (node.$attr("theme"))
- } else {
- return ""
- }; return nil; })();
- hl_param = (function() {if ($truthy(node['$attr?']("lang"))) {
- return "" + "&hl=" + (node.$attr("lang"))
- } else {
- return ""
- }; return nil; })();
- $b = node.$attr("target").$split("/", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (list = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy((list = ($truthy($a = list) ? $a : node.$attr("list"))))) {
- list_param = "" + "&list=" + (list)
- } else {
-
- $b = target.$split(",", 2), $a = Opal.to_ary($b), (target = ($a[0] == null ? nil : $a[0])), (playlist = ($a[1] == null ? nil : $a[1])), $b;
- if ($truthy((playlist = ($truthy($a = playlist) ? $a : node.$attr("playlist"))))) {
- list_param = "" + "&playlist=" + (playlist)
- } else {
- list_param = (function() {if ($truthy(has_loop_param)) {
- return "" + "&playlist=" + (target)
- } else {
- return ""
- }; return nil; })()
- };
- };
- return "" + "" + (title_element) + "\n" + "
\n" + "\n" + "
\n" + "
";}
- else {
- poster_attribute = (function() {if ($truthy((val = node.$attr("poster"))['$nil_or_empty?']())) {
- return ""
- } else {
- return "" + " poster=\"" + (node.$media_uri(val)) + "\""
- }; return nil; })();
- preload_attribute = (function() {if ($truthy((val = node.$attr("preload"))['$nil_or_empty?']())) {
- return ""
- } else {
- return "" + " preload=\"" + (val) + "\""
- }; return nil; })();
- start_t = node.$attr("start");
- end_t = node.$attr("end");
- time_anchor = (function() {if ($truthy(($truthy($a = start_t) ? $a : end_t))) {
- return "" + "#t=" + (($truthy($a = start_t) ? $a : "")) + ((function() {if ($truthy(end_t)) {
- return "" + "," + (end_t)
- } else {
- return ""
- }; return nil; })())
- } else {
- return ""
- }; return nil; })();
- return "" + "" + (title_element) + "\n" + "
\n" + "\n" + "Your browser does not support the video tag.\n" + " \n" + "
\n" + "
";}})();
- }, $Html5Converter_convert_video$48.$$arity = 1);
-
- Opal.def(self, '$convert_inline_anchor', $Html5Converter_convert_inline_anchor$49 = function $$convert_inline_anchor(node) {
- var $a, $b, self = this, $case = nil, path = nil, attrs = nil, text = nil, ref = nil, refid = nil, top = nil, outer = nil;
-
- return (function() {$case = node.$type();
- if ("xref"['$===']($case)) {
- if ($truthy((path = node.$attributes()['$[]']("path")))) {
-
- attrs = self.$append_link_constraint_attrs(node, (function() {if ($truthy(node.$role())) {
- return ["" + " class=\"" + (node.$role()) + "\""]
- } else {
- return []
- }; return nil; })()).$join();
- text = ($truthy($a = node.$text()) ? $a : path);
- } else {
-
- attrs = (function() {if ($truthy(node.$role())) {
- return "" + " class=\"" + (node.$role()) + "\""
- } else {
- return ""
- }; return nil; })();
- if ($truthy((text = node.$text()))) {
- } else if ($truthy($$($nesting, 'AbstractNode')['$===']((ref = ($truthy($a = (self.refs = ($truthy($b = self.refs) ? $b : node.$document().$catalog()['$[]']("refs")))['$[]']((refid = node.$attributes()['$[]']("refid")))) ? $a : (function() {if ($truthy(refid['$nil_or_empty?']())) {
-
- return (top = self.$get_root_document(node));
- } else {
- return nil
- }; return nil; })()))))) {
- if ($truthy(($truthy($a = (self.resolving_xref = ($truthy($b = self.resolving_xref) ? $b : (outer = true)))) ? outer : $a))) {
-
- if ($truthy((text = ref.$xreftext(node.$attr("xrefstyle", nil, true))))) {
- if ($truthy(text['$include?']("" + (text) + " ";}
- else if ("ref"['$===']($case)) {return "" + " "}
- else if ("link"['$===']($case)) {
- attrs = (function() {if ($truthy(node.$id())) {
- return ["" + " id=\"" + (node.$id()) + "\""]
- } else {
- return []
- }; return nil; })();
- if ($truthy(node.$role())) {
- attrs['$<<']("" + " class=\"" + (node.$role()) + "\"")};
- if ($truthy(node['$attr?']("title"))) {
- attrs['$<<']("" + " title=\"" + (node.$attr("title")) + "\"")};
- return "" + "" + (node.$text()) + " ";}
- else if ("bibref"['$===']($case)) {return "" + " [" + (($truthy($a = node.$reftext()) ? $a : node.$id())) + "]"}
- else {
- self.$logger().$warn("" + "unknown anchor type: " + (node.$type().$inspect()));
- return nil;}})()
- }, $Html5Converter_convert_inline_anchor$49.$$arity = 1);
-
- Opal.def(self, '$convert_inline_break', $Html5Converter_convert_inline_break$50 = function $$convert_inline_break(node) {
- var self = this;
-
- return "" + (node.$text()) + " "
- }, $Html5Converter_convert_inline_break$50.$$arity = 1);
-
- Opal.def(self, '$convert_inline_button', $Html5Converter_convert_inline_button$51 = function $$convert_inline_button(node) {
- var self = this;
-
- return "" + "" + (node.$text()) + " "
- }, $Html5Converter_convert_inline_button$51.$$arity = 1);
-
- Opal.def(self, '$convert_inline_callout', $Html5Converter_convert_inline_callout$52 = function $$convert_inline_callout(node) {
- var self = this, src = nil, guard = nil;
-
- if ($truthy(node.$document()['$attr?']("icons", "font"))) {
- return "" + "(" + (node.$text()) + ") "
- } else if ($truthy(node.$document()['$attr?']("icons"))) {
-
- src = node.$icon_uri("" + "callouts/" + (node.$text()));
- return "" + " ";
- } else if ($truthy($$$('::', 'Array')['$===']((guard = node.$attributes()['$[]']("guard"))))) {
- return "" + "<!--(" + (node.$text()) + ") -->"
- } else {
- return "" + (guard) + "(" + (node.$text()) + ") "
- }
- }, $Html5Converter_convert_inline_callout$52.$$arity = 1);
-
- Opal.def(self, '$convert_inline_footnote', $Html5Converter_convert_inline_footnote$53 = function $$convert_inline_footnote(node) {
- var self = this, index = nil, id_attr = nil;
-
- if ($truthy((index = node.$attr("index")))) {
- if (node.$type()['$==']("xref")) {
- return "" + ""
- } else {
-
- id_attr = (function() {if ($truthy(node.$id())) {
- return "" + " id=\"_footnote_" + (node.$id()) + "\""
- } else {
- return ""
- }; return nil; })();
- return "" + "";
- }
- } else if (node.$type()['$==']("xref")) {
- return "" + ""
- } else {
- return nil
- }
- }, $Html5Converter_convert_inline_footnote$53.$$arity = 1);
-
- Opal.def(self, '$convert_inline_image', $Html5Converter_convert_inline_image$54 = function $$convert_inline_image(node) {
- var $a, $b, $$55, $$56, $c, $d, self = this, type = nil, class_attr_val = nil, title_attr = nil, img = nil, target = nil, attrs = nil, svg = nil, obj = nil, fallback = nil, role = nil;
-
-
- if ($truthy((($a = (type = ($truthy($b = node.$type()) ? $b : "image"))['$==']("icon")) ? node.$document()['$attr?']("icons", "font") : (type = ($truthy($b = node.$type()) ? $b : "image"))['$==']("icon")))) {
-
- class_attr_val = "" + "fa fa-" + (node.$target());
- $send($hash2(["size", "rotate", "flip"], {"size": "fa-", "rotate": "fa-rotate-", "flip": "fa-flip-"}), 'each', [], ($$55 = function(key, prefix){var self = $$55.$$s || this;
-
-
-
- if (key == null) {
- key = nil;
- };
-
- if (prefix == null) {
- prefix = nil;
- };
- if ($truthy(node['$attr?'](key))) {
- return (class_attr_val = "" + (class_attr_val) + " " + (prefix) + (node.$attr(key)))
- } else {
- return nil
- };}, $$55.$$s = self, $$55.$$arity = 2, $$55));
- title_attr = (function() {if ($truthy(node['$attr?']("title"))) {
- return "" + " title=\"" + (node.$attr("title")) + "\""
- } else {
- return ""
- }; return nil; })();
- img = "" + " ";
- } else if ($truthy((($a = type['$==']("icon")) ? node.$document()['$attr?']("icons")['$!']() : type['$==']("icon")))) {
- img = "" + "[" + (node.$alt()) + "]"
- } else {
-
- target = node.$target();
- attrs = $send(["width", "height", "title"], 'map', [], ($$56 = function(name){var self = $$56.$$s || this;
-
-
-
- if (name == null) {
- name = nil;
- };
- if ($truthy(node['$attr?'](name))) {
- return "" + " " + (name) + "=\"" + (node.$attr(name)) + "\""
- } else {
- return ""
- };}, $$56.$$s = self, $$56.$$arity = 1, $$56)).$join();
- if ($truthy(($truthy($a = ($truthy($b = ($truthy($c = type['$!=']("icon")) ? ($truthy($d = node['$attr?']("format", "svg")) ? $d : target['$include?'](".svg")) : $c)) ? $rb_lt(node.$document().$safe(), $$$($$($nesting, 'SafeMode'), 'SECURE')) : $b)) ? ($truthy($b = (svg = node['$option?']("inline"))) ? $b : (obj = node['$option?']("interactive"))) : $a))) {
- if ($truthy(svg)) {
- img = ($truthy($a = self.$read_svg_contents(node, target)) ? $a : "" + "" + (node.$alt()) + " ")
- } else if ($truthy(obj)) {
-
- fallback = (function() {if ($truthy(node['$attr?']("fallback"))) {
- return "" + " "
- } else {
- return "" + "" + (node.$alt()) + " "
- }; return nil; })();
- img = "" + "" + (fallback) + " ";}};
- img = ($truthy($a = img) ? $a : "" + " ");
- };
- if ($truthy(node['$attr?']("link"))) {
- img = "" + "" + (img) + " "};
- if ($truthy((role = node.$role()))) {
- if ($truthy(node['$attr?']("float"))) {
- class_attr_val = "" + (type) + " " + (node.$attr("float")) + " " + (role)
- } else {
- class_attr_val = "" + (type) + " " + (role)
- }
- } else if ($truthy(node['$attr?']("float"))) {
- class_attr_val = "" + (type) + " " + (node.$attr("float"))
- } else {
- class_attr_val = type
- };
- return "" + "" + (img) + " ";
- }, $Html5Converter_convert_inline_image$54.$$arity = 1);
-
- Opal.def(self, '$convert_inline_indexterm', $Html5Converter_convert_inline_indexterm$57 = function $$convert_inline_indexterm(node) {
- var self = this;
-
- if (node.$type()['$==']("visible")) {
- return node.$text()
- } else {
- return ""
- }
- }, $Html5Converter_convert_inline_indexterm$57.$$arity = 1);
-
- Opal.def(self, '$convert_inline_kbd', $Html5Converter_convert_inline_kbd$58 = function $$convert_inline_kbd(node) {
- var self = this, keys = nil;
-
- if ((keys = node.$attr("keys")).$size()['$=='](1)) {
- return "" + "" + (keys['$[]'](0)) + " "
- } else {
- return "" + "" + (keys.$join(" +")) + " "
- }
- }, $Html5Converter_convert_inline_kbd$58.$$arity = 1);
-
- Opal.def(self, '$convert_inline_menu', $Html5Converter_convert_inline_menu$59 = function $$convert_inline_menu(node) {
- var self = this, caret = nil, submenu_joiner = nil, menu = nil, submenus = nil, menuitem = nil;
-
-
- caret = (function() {if ($truthy(node.$document()['$attr?']("icons", "font"))) {
- return " "
- } else {
- return " › "
- }; return nil; })();
- submenu_joiner = "" + "" + (caret) + "