This commit is contained in:
2025-05-12 05:38:44 +09:00
parent dced21c3f8
commit 6d78bfa46e
8120 changed files with 1161564 additions and 0 deletions

22
book/node_modules/@asciidoctor/cli/LICENSE generated vendored Normal file
View File

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015-2018 Asciidoctor
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.

12
book/node_modules/@asciidoctor/cli/README.md generated vendored Normal file
View File

@ -0,0 +1,12 @@
# Asciidoctor.js CLI
[![GitHub Actions Status](https://github.com/asciidoctor/asciidoctor-cli.js/actions/workflows/build.yml/badge.svg)](https://github.com/asciidoctor/asciidoctor-cli.js/actions/workflows/build.yml)
[![npm version](https://img.shields.io/npm/v/@asciidoctor/cli.svg)](https://www.npmjs.org/package/@asciidoctor/cli)
The Command Line Interface (CLI) for Asciidoctor.js.
Install Asciidoctor.js globally, and you'll have access to the `asciidoctor` command anywhere on your system:
$ npm i -g asciidoctor
Type `asciidoctor --help` for more information.

9
book/node_modules/@asciidoctor/cli/bin/asciidoctor generated vendored Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env node
'use strict'
process.title = 'asciidoctor'
const { Options, Invoker } = require('../lib/cli.js')
const options = new Options().parse(process.argv)
new Invoker(options).invoke()

View File

@ -0,0 +1,289 @@
= AsciiDoc Syntax
:icons: font
:stem:
:toc: left
:url-docs: https://asciidoctor.org/docs
:url-gem: https://rubygems.org/gems/asciidoctor
A brief reference of the most commonly used AsciiDoc syntax.
You can find the full documentation for the AsciiDoc syntax at {url-docs}.
== Paragraphs
A normal paragraph.
Line breaks are not preserved.
// line comments, which are lines that start with //, are skipped
A blank line separates paragraphs.
[%hardbreaks]
This paragraph carries the `hardbreaks` option.
Notice how line breaks are now preserved.
An indented (literal) paragraph disables text formatting,
preserves spaces and line breaks, and is displayed in a
monospaced font.
[sidebar#id.role]
A style, ID, and/or role gives a paragraph (or block) special meaning, like this sidebar.
NOTE: An admonition paragraph, like this note, grabs the reader's attention.
TIP: Convert this document using the `asciidoctor` command to see the output produced from it.
== Text Formatting
:hardbreaks:
.Constrained (applied at word boundaries)
*strong importance* (aka bold)
_stress emphasis_ (aka italic)
`monospaced` (aka typewriter text)
"`double`" and '`single`' typographic quotes
+passthrough text+ (substitutions disabled)
`+literal text+` (monospaced with substitutions disabled)
.Unconstrained (applied anywhere)
**C**reate+**R**ead+**U**pdate+**D**elete
fan__freakin__tastic
``mono``culture
.Replacements
A long time ago in a galaxy far, far away...
(C) 1976 Arty Artisan
I believe I shall--no, actually I won't.
.Macros
// where c=specialchars, q=quotes, a=attributes, r=replacements, m=macros, p=post_replacements, etc.
The European icon:flag[role=blue] is blue & contains pass:[************] arranged in a icon:circle-o[role=yellow].
The pass:c[->] operator is often referred to as the stabby lambda.
Since `pass:[++]` has strong priority in AsciiDoc, you can rewrite pass:c,a,r[C++ => C{pp}].
// activate stem support by adding `:stem:` to the document header
stem:[sqrt(4) = 2]
:!hardbreaks:
== Attributes
// define attributes in the document header; must be flush with left margin
:name: value
You can download and install Asciidoctor {asciidoctor-version} from {url-gem}.
C{pp} is not required, only Ruby.
Use a leading backslash to output a word enclosed in curly braces, like \{name}.
== Links
[%hardbreaks]
https://example.org/page[A webpage]
link:../path/to/file.txt[A local file]
xref:document.adoc[A sibling document]
mailto:hello@example.org[Email to say hello!]
== Anchors
[[idname,reference text]]
// or written using normal block attributes as `[#idname,reftext=reference text]`
A paragraph (or any block) with an anchor (aka ID) and reftext.
See <<idname>> or <<idname,optional text of internal link>>.
xref:document.adoc#idname[Jumps to anchor in another document].
This paragraph has a footnote.footnote:[This is the text of the footnote.]
== Lists
=== Unordered
* level 1
** level 2
*** level 3
**** level 4
***** etc.
* back at level 1
+
Attach a block or paragraph to a list item using a list continuation (which you can enclose in an open block).
.Some Authors
[circle]
- Edgar Allen Poe
- Sheri S. Tepper
- Bill Bryson
=== Ordered
. Step 1
. Step 2
.. Step 2a
.. Step 2b
. Step 3
.Remember your Roman numerals?
[upperroman]
. is one
. is two
. is three
=== Checklist
* [x] checked
* [ ] not checked
=== Callout
// enable callout bubbles by adding `:icons: font` to the document header
[,ruby]
----
puts 'Hello, World!' # <1>
----
<1> Prints `Hello, World!` to the console.
=== Description
first term:: description of first term
second term::
description of second term
== Document Structure
=== Header
// header must be flush with left margin
= Document Title
Author Name <author@example.org>
v1.0, 2019-01-01
=== Sections
// must be flush with left margin
= Document Title (Level 0)
== Level 1
=== Level 2
==== Level 3
===== Level 4
====== Level 5
== Back at Level 1
=== Includes
// must be flush with left margin
include::basics.adoc[]
// define -a allow-uri-read to allow content to be read from URI
include::https://example.org/installation.adoc[]
== Blocks
--
open - a general-purpose content wrapper; useful for enclosing content to attach to a list item
--
// recognized types include CAUTION, IMPORTANT, NOTE, TIP, and WARNING
// enable admonition icons by setting `:icons: font` in the document header
[NOTE]
====
admonition - a notice for the reader, ranging in severity from a tip to an alert
====
====
example - a demonstration of the concept being documented
====
.Toggle Me
[%collapsible]
====
collapsible - these details are revealed by clicking the title
====
****
sidebar - auxiliary content that can be read independently of the main content
****
....
literal - an exhibit that features program output
....
----
listing - an exhibit that features program input, source code, or the contents of a file
----
[,language]
----
source - a listing that is embellished with (colorized) syntax highlighting
----
```language
fenced code - a shorthand syntax for the source block
```
[,attribution,citetitle]
____
quote - a quotation or excerpt; attribution with title of source are optional
____
[verse,attribution,citetitle]
____
verse - a literary excerpt, often a poem; attribution with title of source are optional
____
++++
pass - content passed directly to the output document; often raw HTML
++++
// activate stem support by adding `:stem:` to the document header
[stem]
++++
x = y^2
++++
////
comment - content which is not included in the output document
////
== Tables
.Table Attributes
[cols=>1h;2d,width=50%,frame=topbot]
|===
| Attribute Name | Values
| options
| header,footer,autowidth
| cols
| colspec[;colspec;...]
| grid
| all \| cols \| rows \| none
| frame
| all \| sides \| topbot \| none
| stripes
| all \| even \| odd \| none
| width
| (0%..100%)
| format
| psv {vbar} csv {vbar} dsv
|===
== Multimedia
image::screenshot.png[block image,800,450]
Press image:reload.svg[reload,16,opts=interactive] to reload the page.
video::movie.mp4[width=640,start=60,end=140,options=autoplay]
video::aHjpOzsQ9YI[youtube]
video::300817511[vimeo]
== Breaks
// thematic break (aka horizontal rule)
---
// page break
<<<

10
book/node_modules/@asciidoctor/cli/lib/cli.js generated vendored Executable file
View File

@ -0,0 +1,10 @@
'use strict'
const Options = require('./options')
const Invoker = require('./invoker')
module.exports = {
processor: Invoker.asciidoctor,
Options,
Invoker
}

151
book/node_modules/@asciidoctor/cli/lib/invoker.js generated vendored Normal file
View File

@ -0,0 +1,151 @@
const fs = require('fs')
const ospath = require('path')
const asciidoctor = require('@asciidoctor/core')()
const pkg = require('../package.json')
const stdin = require('./stdin')
const DOT_RELATIVE_RX = new RegExp(`^\\.{1,2}[/${ospath.sep.replace('/', '').replace('\\', '\\\\')}]`)
class Invoker {
constructor (options) {
this.options = options
}
async invoke () {
const processArgs = this.options.argv.slice(2)
const { args } = this.options
const { verbose, version, files } = args
if (version || (verbose && processArgs.length === 1)) {
this.showVersion()
process.exit(0)
}
Invoker.prepareProcessor(args, asciidoctor)
const options = this.options.options
const failureLevel = options.failure_level
if (this.options.stdin) {
await Invoker.convertFromStdin(options, args)
Invoker.exit(failureLevel)
} else if (files && files.length > 0) {
Invoker.processFiles(files, verbose, args.timings, options)
Invoker.exit(failureLevel)
} else {
this.showHelp()
process.exit(0)
}
}
showHelp () {
if (this.options.args.help === 'syntax') {
console.log(fs.readFileSync(ospath.join(__dirname, '..', 'data', 'reference', 'syntax.adoc'), 'utf8'))
} else {
this.options.yargs.showHelp()
}
}
showVersion () {
console.log(this.version())
}
version () {
const releaseName = process.release ? process.release.name : 'node'
return `Asciidoctor.js ${asciidoctor.getVersion()} (Asciidoctor ${asciidoctor.getCoreVersion()}) [https://asciidoctor.org]
Runtime Environment (${releaseName} ${process.version} on ${process.platform})
CLI version ${pkg.version}`
}
/**
* @deprecated Use {#showVersion}. Will be removed in version 4.0.
*/
static printVersion () {
console.log(new Invoker().version())
}
static async readFromStdin () {
return stdin.read()
}
static async convertFromStdin (options, args) {
const data = await Invoker.readFromStdin()
if (args.timings) {
const timings = asciidoctor.Timings.create()
const instanceOptions = Object.assign({}, options, { timings })
Invoker.convert(asciidoctor.convert, data, instanceOptions)
timings.printReport(process.stderr, '-')
} else {
Invoker.convert(asciidoctor.convert, data, options)
}
}
static convert (processorFn, input, options) {
try {
processorFn.apply(asciidoctor, [input, options])
} catch (e) {
if (e && e.name === 'NotImplementedError' && e.message === `asciidoctor: FAILED: missing converter for backend '${options.backend}'. Processing aborted.`) {
console.error(`> Error: missing converter for backend '${options.backend}'. Processing aborted.`)
console.error('> You might want to require a Node.js package with --require option to support this backend.')
process.exit(1)
}
throw e
}
}
static convertFile (file, options) {
Invoker.convert(asciidoctor.convertFile, file, options)
}
static processFiles (files, verbose, timings, options) {
files.forEach((file) => {
if (verbose) {
console.log(`converting file ${file}`)
}
if (timings) {
const timings = asciidoctor.Timings.create()
const instanceOptions = Object.assign({}, options, { timings })
Invoker.convertFile(file, instanceOptions)
timings.printReport(process.stderr, file)
} else {
Invoker.convertFile(file, options)
}
})
}
static requireLibrary (requirePath, cwd = process.cwd()) {
if (requirePath.charAt(0) === '.' && 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)
}
static prepareProcessor (argv, asciidoctor) {
const requirePaths = argv.require
if (requirePaths) {
requirePaths.forEach((requirePath) => {
const lib = Invoker.requireLibrary(requirePath)
if (lib && typeof lib.register === 'function') {
// REMIND: it could be an extension or a converter.
// the register function on a converter does not take any argument
// but the register function on an extension expects one argument (the extension registry)
// Until we revisit the API for extension and converter, we pass the registry as the first argument
lib.register(asciidoctor.Extensions)
}
})
}
}
static exit (failureLevel) {
let code = 0
const logger = asciidoctor.LoggerManager.getLogger()
if (logger && typeof logger.getMaxSeverity === 'function' && logger.getMaxSeverity() && logger.getMaxSeverity() >= failureLevel) {
code = 1
}
process.exit(code)
}
}
module.exports = Invoker
module.exports.asciidoctor = asciidoctor

278
book/node_modules/@asciidoctor/cli/lib/options.js generated vendored Normal file
View File

@ -0,0 +1,278 @@
/* global Opal */
const yargs = require('yargs')
const asciidoctor = require('@asciidoctor/core')()
const convertOptions = (args, attrs) => {
const attributes = attrs || []
const backend = args.backend
const doctype = args.doctype
const safeMode = args['safe-mode']
const embedded = args.embedded === true || args['no-header-footer'] === true || args.standalone === false
const standalone = !embedded
const sectionNumbers = args['section-numbers']
const baseDir = args['base-dir']
const destinationDir = args['destination-dir']
const outFile = args['out-file']
const templateDir = args['template-dir']
const templateEngine = args['template-engine']
const quiet = args.quiet
const verbose = args.verbose
const timings = args.timings
const trace = args.trace
const requireLib = args.require
let level = args['failure-level'].toUpperCase()
if (level === 'WARNING') {
level = 'WARN'
}
const failureLevel = asciidoctor.LoggerSeverity[level]
const debug = verbose && args['verbose-sole-argument'] !== true
if (debug) {
console.log('require ' + requireLib)
console.log('backend ' + backend)
console.log('doctype ' + doctype)
console.log('standalone ' + standalone)
console.log('section-numbers ' + sectionNumbers)
console.log('failure-level ' + level)
console.log('quiet ' + quiet)
console.log('verbose ' + verbose)
console.log('timings ' + timings)
console.log('trace ' + trace)
console.log('base-dir ' + baseDir)
console.log('destination-dir ' + destinationDir)
console.log('template-dir ' + templateDir)
console.log('template-engine ' + templateEngine)
}
const verboseMode = quiet ? 0 : verbose ? 2 : 1
if (sectionNumbers) {
attributes.push('sectnums')
}
const cliAttributes = args.attribute
if (cliAttributes) {
attributes.push(...cliAttributes)
}
if (debug) {
console.log('verbose-mode ' + verboseMode)
console.log('attributes ' + attributes)
}
const options = {
doctype: doctype,
safe: safeMode,
standalone: standalone,
failure_level: failureLevel,
verbose: verboseMode,
timings: timings,
trace: trace
}
if (backend) {
options.backend = backend
}
if (baseDir != null) {
options.base_dir = baseDir
}
if (destinationDir != null) {
options.to_dir = destinationDir
}
if (templateDir) {
options.template_dirs = templateDir
}
if (templateEngine) {
options.template_engine = templateEngine
}
if (typeof outFile !== 'undefined') {
if (outFile === '') {
options.to_file = '-'
} else {
options.to_file = outFile
options.mkdirs = true
}
} else {
options.mkdirs = true
}
options.attributes = attributes
if (debug) {
console.log('options ' + JSON.stringify(options))
}
if (options.to_file === '-') {
options.to_file = Opal.gvars.stdout
}
return options
}
class Options {
constructor (options) {
this.options = options || {}
this.args = {
standalone: typeof this.options.standalone !== 'undefined' ? this.options.standalone : true,
backend: this.options.backend,
'safe-mode': typeof this.options.safe !== 'undefined' ? this.options.safe : 'unsafe'
}
if (Array.isArray(this.options.attributes)) {
this.attributes = options.attributes
} else if (typeof this.options.attributes === 'object') {
const attrs = this.options.attributes
const attributes = []
Object.keys(attrs).forEach((key) => {
attributes.push(`${key}=${attrs[key]}`)
})
this.attributes = attributes
} else {
this.attributes = []
}
this.cmd = yargs
.option('backend', {
alias: 'b',
describe: 'set output format backend',
type: 'string'
})
.option('doctype', {
alias: 'd',
describe: 'document type to use when converting document',
choices: ['article', 'book', 'manpage', 'inline']
})
.option('out-file', {
alias: 'o',
describe: 'output file (default: based on path of input file) use \'\' to output to STDOUT',
type: 'string'
})
.option('safe-mode', {
alias: 'S',
describe: 'set safe mode level explicitly, disables potentially dangerous macros in source files, such as include::[]',
choices: ['unsafe', 'safe', 'server', 'secure']
})
.option('embedded', {
alias: 'e',
describe: 'suppress enclosing document structure and output an embedded document',
type: 'boolean'
})
.option('no-header-footer', {
alias: 's',
describe: 'suppress enclosing document structure and output an embedded document',
type: 'boolean'
})
.option('section-numbers', {
alias: 'n',
default: false,
describe: 'auto-number section titles in the HTML backend disabled by default',
type: 'boolean'
})
.option('base-dir', {
// QUESTION: should we check that the directory exists ? coerce to a directory ?
alias: 'B',
describe: 'base directory containing the document and resources (default: directory of source file)',
type: 'string'
})
.option('destination-dir', {
// QUESTION: should we check that the directory exists ? coerce to a directory ?
alias: 'D',
describe: 'destination output directory (default: directory of source file)',
type: 'string'
})
.option('failure-level', {
default: 'FATAL',
describe: 'set minimum logging level that triggers non-zero exit code',
choices: ['info', 'INFO', 'warn', 'WARN', 'warning', 'WARNING', 'error', 'ERROR', 'fatal', 'FATAL']
})
.option('quiet', {
alias: 'q',
default: false,
describe: 'suppress warnings',
type: 'boolean'
})
.option('trace', {
default: false,
describe: 'include backtrace information on errors',
type: 'boolean'
})
.option('verbose', {
alias: 'v',
default: false,
describe: 'enable verbose mode',
type: 'boolean'
})
.option('timings', {
alias: 't',
default: false,
describe: 'enable timings mode',
type: 'boolean'
})
.option('template-dir', {
alias: 'T',
array: true,
describe: 'a directory containing custom converter templates that override the built-in converter (may be specified multiple times)',
type: 'string'
})
.option('template-engine', {
alias: 'E',
describe: 'template engine to use for the custom converter templates',
type: 'string'
})
.option('attribute', {
alias: 'a',
array: true,
describe: 'a document attribute to set in the form of key, key! or key=value pair',
type: 'string'
})
.option('require', {
alias: 'r',
array: true,
describe: 'require the specified library before executing the processor, using the standard Node require',
type: 'string'
})
.version(false)
.option('version', {
alias: 'V',
default: false,
describe: 'display the version and runtime environment (or -v if no other flags or arguments)',
type: 'boolean'
})
.help(false)
.option('help', {
describe: `print a help message
show this usage if TOPIC is not specified or recognized
show an overview of the AsciiDoc syntax if TOPIC is syntax`,
type: 'string'
})
.nargs('template-dir', 1)
.nargs('attribute', 1)
.nargs('require', 1)
.usage(`$0 [options...] files...
Translate the AsciiDoc source file or file(s) into the backend output format (e.g., HTML 5, DocBook 5, etc.)
By default, the output is written to a file with the basename of the source file and the appropriate extension`)
.example('$0 -b html5 doc.asciidoc', 'convert an AsciiDoc file to HTML5; result will be written in a file named doc.html')
.epilogue('For more information, please visit https://asciidoctor.org/docs')
this.yargs = yargs
}
parse (argv) {
const processArgs = argv.slice(2)
this.argv = argv
const args = this.argsParser().parse(processArgs)
Object.assign(this.args, args)
const files = this.args.files
this.stdin = files && files.length === 0 && processArgs[processArgs.length - 1] === '-'
if (this.stdin) {
this.args['out-file'] = this.args['out-file'] || '-'
}
this.args['verbose-sole-argument'] = this.args.verbose && processArgs.length === 1
const options = convertOptions(this.args, this.attributes)
Object.assign(this.options, options)
return this
}
addOption (key, opt) {
this.cmd.option(key, opt)
return this
}
argsParser () {
return this.yargs
.detectLocale(false)
.wrap(Math.min(120, this.yargs.terminalWidth()))
.command('$0 [files...]', '', () => this.cmd)
.parserConfiguration({
'boolean-negation': false
})
}
}
module.exports = Options

24
book/node_modules/@asciidoctor/cli/lib/stdin.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
const readFromStdin = async () => new Promise((resolve, reject) => {
const encoding = 'utf-8'
let data
data = ''
process.stdin.setEncoding(encoding)
process.stdin.on('readable', function () {
const chunk = process.stdin.read()
if (chunk !== null) {
data += chunk
}
})
process.stdin.on('error', (error) => {
reject(error)
})
process.stdin.on('end', function () {
// There will be a trailing \n from the user hitting enter. Get rid of it.
data = data.replace(/\n$/, '')
resolve(data)
})
})
module.exports = {
read: readFromStdin
}

66
book/node_modules/@asciidoctor/cli/package.json generated vendored Normal file
View File

@ -0,0 +1,66 @@
{
"name": "@asciidoctor/cli",
"version": "3.5.0",
"description": "The Command Line Interface (CLI) for Asciidoctor.js",
"main": "lib/cli.js",
"engines": {
"node": ">=8.11",
"npm": ">=5.0.0"
},
"files": [
"bin",
"lib",
"data"
],
"bin": {
"asciidoctor": "bin/asciidoctor",
"asciidoctorjs": "bin/asciidoctor"
},
"preferGlobal": true,
"scripts": {
"test": "./bin/asciidoctor --version && mocha",
"lint": "standard bin/* lib/*.js test/*.js"
},
"repository": {
"type": "git",
"url": "https://github.com/asciidoctor/asciidoctor-cli.js.git"
},
"publishConfig": {
"access": "public"
},
"keywords": [
"asciidoc",
"asciidoctor",
"asciidoctor-cli",
"opal",
"javascript",
"library"
],
"authors": [
"Dan Allen (https://github.com/mojavelinux)",
"Guillaume Grossetie (https://github.com/mogztter)",
"Anthonny Quérouil (https://github.com/anthonny)"
],
"license": "MIT",
"bugs": {
"url": "https://github.com/asciidoctor/asciidoctor-cli.js/issues"
},
"homepage": "https://github.com/asciidoctor/asciidoctor-cli.js",
"dependencies": {
"yargs": "16.2.0"
},
"devDependencies": {
"@asciidoctor/core": "^2.0.0-rc.1",
"chai": "^4.2.0",
"dirty-chai": "^2.0.1",
"mocha": "8.4.0",
"sinon": "^10.0.0",
"standard": "16.0.3"
},
"peerDependencies": {
"@asciidoctor/core": "^2.0.0-rc.1"
},
"standard": {
"env": "mocha"
}
}