@antora/pdf-extension 1.0.0-beta.2 → 1.0.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/lib/converter.js +8 -7
- package/lib/index.js +1 -2
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -21,7 +21,9 @@ antora:
|
|
|
21
21
|
# ...
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
You can configure the behavior of the extension using the optional _antora-assembler.yml_
|
|
24
|
+
You can configure the behavior of the extension using the optional configuration file, named _antora-assembler.yml_ by default.
|
|
25
|
+
When using more than one exporter extension, you likely want to use a dedicated configuration file named according to the export filetype (e.g., _antora-assembler-pdf.yml_).
|
|
26
|
+
The configuration file can be specified using the `config_file` key on the extension entry.
|
|
25
27
|
|
|
26
28
|
## Copyright and License
|
|
27
29
|
|
package/lib/converter.js
CHANGED
|
@@ -4,11 +4,13 @@ const fsp = require('node:fs/promises')
|
|
|
4
4
|
const ospath = require('node:path')
|
|
5
5
|
|
|
6
6
|
const DEFAULT_COMMAND = 'asciidoctor-pdf'
|
|
7
|
+
const PACKAGE_NAME = require('../package.json').name
|
|
7
8
|
|
|
8
|
-
async function convert (
|
|
9
|
-
const { cwd = process.cwd(),
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
async function convert (file, convertAttributes, buildConfig, { logCommand, runCommand }) {
|
|
10
|
+
const { command, cwd = process.cwd(), attributeOptionFlag = '-a', stderr = 'print' } = buildConfig
|
|
11
|
+
logCommand?.(command, file, convertAttributes, attributeOptionFlag)
|
|
12
|
+
const args = convertAttributes.toArgs(attributeOptionFlag, command).concat('-o', convertAttributes.outfile, '-')
|
|
13
|
+
return runCommand(command, args, { parse: true, cwd, stdin: file.contents, stdout: 'print', stderr })
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
function getDefaultCommand (cwd) {
|
|
@@ -19,11 +21,10 @@ function getDefaultCommand (cwd) {
|
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
module.exports = {
|
|
22
|
-
bind (thisArg, runCommand) {
|
|
23
|
-
return Object.assign({}, this, { convert: convert.bind(thisArg, runCommand) })
|
|
24
|
-
},
|
|
25
24
|
convert,
|
|
26
25
|
backend: 'pdf',
|
|
26
|
+
getDefaultCommand,
|
|
27
27
|
extname: '.pdf',
|
|
28
28
|
mediaType: 'application/pdf',
|
|
29
|
+
loggerName: PACKAGE_NAME,
|
|
29
30
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
const converter = require('./converter')
|
|
4
|
-
const runCommand = require('@antora/run-command-helper')
|
|
5
4
|
|
|
6
5
|
module.exports.register = function ({ config }, providers) {
|
|
7
|
-
requireAssembler(this).configure(this, converter
|
|
6
|
+
requireAssembler(this).configure(this, converter, config, providers)
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
function requireAssembler (context, packageName = '@antora/assembler') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antora/pdf-extension",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"description": "An Antora extension that uses Assembler to merge pages into assembly files, export them to the PDF format, and
|
|
3
|
+
"version": "1.0.0-beta.20",
|
|
4
|
+
"description": "An Antora extension that uses Assembler to merge pages into assembly files, export them to the PDF format, and publish them with the site.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"author": "OpenDevise Inc. (https://opendevise.com)",
|
|
7
7
|
"contributors": [
|
|
@@ -32,8 +32,7 @@
|
|
|
32
32
|
"#package": "./package.json"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@antora/assembler": "1.0.0-beta.
|
|
36
|
-
"@antora/run-command-helper": "~1.0"
|
|
35
|
+
"@antora/assembler": "1.0.0-beta.20"
|
|
37
36
|
},
|
|
38
37
|
"engines": {
|
|
39
38
|
"node": ">=16.0.0"
|