antsibull-docs
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -54,3 +54,3 @@ "use strict"; | ||
if (part.plugin && opts.pluginOptionLikeLink) { | ||
url = opts.pluginOptionLikeLink(part.plugin, part.entrypoint, 'option', part.link, part.plugin === opts.current_plugin); | ||
url = opts.pluginOptionLikeLink(part.plugin, part.entrypoint, 'option', part.link, part.plugin === opts.currentPlugin); | ||
} | ||
@@ -74,3 +74,3 @@ destination.push(opts.formatOptionName(part, url)); | ||
if (part.plugin && opts.pluginOptionLikeLink) { | ||
url = opts.pluginOptionLikeLink(part.plugin, part.entrypoint, 'retval', part.link, part.plugin === opts.current_plugin); | ||
url = opts.pluginOptionLikeLink(part.plugin, part.entrypoint, 'retval', part.link, part.plugin === opts.currentPlugin); | ||
} | ||
@@ -77,0 +77,0 @@ destination.push(opts.formatReturnValue(part, url)); |
@@ -14,3 +14,3 @@ "use strict"; | ||
function quoteMD(text) { | ||
return text.replace(/([!"#$%&'()*+,:;<=>?@[\\\]^_`{|}~-])/g, '\\$1'); | ||
return text.replace(/([!"#$%&'()*+,:;<=>?@[\\\]^_`{|}~.-])/g, '\\$1'); | ||
} | ||
@@ -22,3 +22,3 @@ exports.quoteMD = quoteMD; | ||
if (url) { | ||
link_start = `<a href="${quoteMD((0, html_1.quoteHTMLArg)(encodeURI(url)))}">`; | ||
link_start = `<a href="${(0, html_1.quoteHTMLArg)(encodeURI(url))}">`; | ||
link_end = '</a>'; | ||
@@ -49,6 +49,6 @@ } | ||
formatItalic: (part) => `<em>${quoteMD(part.text)}</em>`, | ||
formatLink: (part) => `[${quoteMD(part.text)}](${quoteMD(encodeURI(part.url))})`, | ||
formatLink: (part) => `[${quoteMD(part.text)}](${encodeURI(part.url)})`, | ||
formatModule: (part, url) => (url ? `[${quoteMD(part.fqcn)}](${quoteMD(encodeURI(url))})` : `${quoteMD(part.fqcn)}`), | ||
formatRSTRef: (part) => `${quoteMD(part.text)}`, | ||
formatURL: (part) => `[${quoteMD(encodeURI(part.url))}](${quoteMD(encodeURI(part.url))})`, | ||
formatURL: (part) => `[${quoteMD(encodeURI(part.url))}](${encodeURI(part.url)})`, | ||
formatText: (part) => quoteMD(part.text), | ||
@@ -55,0 +55,0 @@ formatEnvVariable: (part) => `<code>${quoteMD(part.name)}</code>`, |
@@ -40,4 +40,4 @@ "use strict"; | ||
else { | ||
plugin = opts.current_plugin; | ||
entrypoint = opts.role_entrypoint; | ||
plugin = opts.currentPlugin; | ||
entrypoint = opts.roleEntrypoint; | ||
} | ||
@@ -44,0 +44,0 @@ if ((plugin === null || plugin === void 0 ? void 0 : plugin.type) === 'role') { |
@@ -51,3 +51,3 @@ /* | ||
if (part.plugin && opts.pluginOptionLikeLink) { | ||
url = opts.pluginOptionLikeLink(part.plugin, part.entrypoint, 'option', part.link, part.plugin === opts.current_plugin); | ||
url = opts.pluginOptionLikeLink(part.plugin, part.entrypoint, 'option', part.link, part.plugin === opts.currentPlugin); | ||
} | ||
@@ -71,3 +71,3 @@ destination.push(opts.formatOptionName(part, url)); | ||
if (part.plugin && opts.pluginOptionLikeLink) { | ||
url = opts.pluginOptionLikeLink(part.plugin, part.entrypoint, 'retval', part.link, part.plugin === opts.current_plugin); | ||
url = opts.pluginOptionLikeLink(part.plugin, part.entrypoint, 'retval', part.link, part.plugin === opts.currentPlugin); | ||
} | ||
@@ -74,0 +74,0 @@ destination.push(opts.formatReturnValue(part, url)); |
@@ -11,3 +11,3 @@ /* | ||
export function quoteMD(text) { | ||
return text.replace(/([!"#$%&'()*+,:;<=>?@[\\\]^_`{|}~-])/g, '\\$1'); | ||
return text.replace(/([!"#$%&'()*+,:;<=>?@[\\\]^_`{|}~.-])/g, '\\$1'); | ||
} | ||
@@ -18,3 +18,3 @@ function formatOptionLike(part, url, what) { | ||
if (url) { | ||
link_start = `<a href="${quoteMD(quoteHTMLArg(encodeURI(url)))}">`; | ||
link_start = `<a href="${quoteHTMLArg(encodeURI(url))}">`; | ||
link_end = '</a>'; | ||
@@ -45,6 +45,6 @@ } | ||
formatItalic: (part) => `<em>${quoteMD(part.text)}</em>`, | ||
formatLink: (part) => `[${quoteMD(part.text)}](${quoteMD(encodeURI(part.url))})`, | ||
formatLink: (part) => `[${quoteMD(part.text)}](${encodeURI(part.url)})`, | ||
formatModule: (part, url) => (url ? `[${quoteMD(part.fqcn)}](${quoteMD(encodeURI(url))})` : `${quoteMD(part.fqcn)}`), | ||
formatRSTRef: (part) => `${quoteMD(part.text)}`, | ||
formatURL: (part) => `[${quoteMD(encodeURI(part.url))}](${quoteMD(encodeURI(part.url))})`, | ||
formatURL: (part) => `[${quoteMD(encodeURI(part.url))}](${encodeURI(part.url)})`, | ||
formatText: (part) => quoteMD(part.text), | ||
@@ -51,0 +51,0 @@ formatEnvVariable: (part) => `<code>${quoteMD(part.name)}</code>`, |
@@ -19,5 +19,5 @@ import { TextPart, ItalicPart, BoldPart, ModulePart, PluginPart, URLPart, LinkPart, RSTRefPart, CodePart, OptionNamePart, OptionValuePart, EnvVariablePart, ReturnValuePart, HorizontalLinePart, ErrorPart } from './dom'; | ||
/** Should be provided if parsing documentation of a plugin/module/role. */ | ||
current_plugin?: PluginIdentifier; | ||
currentPlugin?: PluginIdentifier; | ||
/** Should be provided if parsing documentation of a specific role's entrypoint. */ | ||
role_entrypoint?: string; | ||
roleEntrypoint?: string; | ||
/** If set to 'true', only 'classic' Ansible docs markup is accepted. */ | ||
@@ -32,3 +32,3 @@ onlyClassicMarkup?: boolean; | ||
/** Should be provided if rendering documentation for a plugin/module/role. */ | ||
current_plugin?: PluginIdentifier; | ||
currentPlugin?: PluginIdentifier; | ||
} | ||
@@ -73,3 +73,3 @@ interface CommonFormatOptions { | ||
/** Provides a link to a plugin's option or return value. */ | ||
pluginOptionLikeLink?: (plugin: PluginIdentifier, entrypoint: string | undefined, what: 'option' | 'retval', name: string[], current_plugin: boolean) => string | undefined; | ||
pluginOptionLikeLink?: (plugin: PluginIdentifier, entrypoint: string | undefined, what: 'option' | 'retval', name: string[], currentPlugin: boolean) => string | undefined; | ||
} | ||
@@ -76,0 +76,0 @@ export interface HTMLOptions extends CommonExportOptions, CommonFormatOptions, LinkProviders { |
@@ -37,4 +37,4 @@ /* | ||
else { | ||
plugin = opts.current_plugin; | ||
entrypoint = opts.role_entrypoint; | ||
plugin = opts.currentPlugin; | ||
entrypoint = opts.roleEntrypoint; | ||
} | ||
@@ -41,0 +41,0 @@ if ((plugin === null || plugin === void 0 ? void 0 : plugin.type) === 'role') { |
{ | ||
"name": "antsibull-docs", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "TypeScript library for processing Ansible documentation markup", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -106,12 +106,13 @@ <!-- | ||
1. Update package version in `package.json`. | ||
1. Update package version in `package.json` (and remove things like `-post0`). | ||
2. Create `changelogs/fragments/<version>.yml` with a `release_summary` section. | ||
3. Run `rm -rf dist && npm ci && npm run build`. | ||
3. Run `rm -rf dist && npm install && npm run build`. | ||
4. Run `npm publish --dry-run` and check the output. | ||
5. Add modified files to git (if they are OK) and commit with message `Prepare <version>.`. | ||
6. Run `antsibull-changelog release` and add the updated files to git. | ||
7. Commit with message `Release <version>.` and run `git tag <version>`. | ||
8. Run `git push upstream main && git push`. | ||
9. Once CI passes on GitHub, run `npm publish`. | ||
10. On success, do `git push upstream --tags` and create a GitHub release. | ||
11. Add `.post0` to the version in `package.json`, commit as `Post-release version bump.`, and push to GitHub. | ||
5. Make sure to run `npm run format:write`, especially if you updated this README. | ||
6. Add modified files to git (if they are OK) and commit with message `Prepare <version>.`. | ||
7. Run `antsibull-changelog release` and add the updated files to git. | ||
8. Commit with message `Release <version>.` and run `git tag <version>`. | ||
9. Run `git push upstream main && git push`. | ||
10. Once CI passes on GitHub, run `npm publish`. | ||
11. On success, do `git push upstream --tags` and create a GitHub release. | ||
12. Add `-post0` to the version in `package.json`, run `npm install`, commit as `Post-release version bump.`, and push to GitHub. |
@@ -63,3 +63,3 @@ /* | ||
part.link, | ||
part.plugin === opts.current_plugin, | ||
part.plugin === opts.currentPlugin, | ||
); | ||
@@ -89,3 +89,3 @@ } | ||
part.link, | ||
part.plugin === opts.current_plugin, | ||
part.plugin === opts.currentPlugin, | ||
); | ||
@@ -92,0 +92,0 @@ } |
@@ -18,4 +18,4 @@ /* | ||
it('more complex', (): void => { | ||
expect(quoteMD('[]!.()-\\@<>?[]!.()-\\@<>?')).toBe( | ||
'\\[\\]\\!.\\(\\)\\-\\\\\\@\\<\\>\\?\\[\\]\\!.\\(\\)\\-\\\\\\@\\<\\>\\?', | ||
expect(quoteMD('[]!.()-\\@<>?[]!.()-\\@<>?&')).toBe( | ||
'\\[\\]\\!\\.\\(\\)\\-\\\\\\@\\<\\>\\?\\[\\]\\!\\.\\(\\)\\-\\\\\\@\\<\\>\\?\\&', | ||
); | ||
@@ -22,0 +22,0 @@ }); |
@@ -15,3 +15,3 @@ /* | ||
export function quoteMD(text: string): string { | ||
return text.replace(/([!"#$%&'()*+,:;<=>?@[\\\]^_`{|}~-])/g, '\\$1'); | ||
return text.replace(/([!"#$%&'()*+,:;<=>?@[\\\]^_`{|}~.-])/g, '\\$1'); | ||
} | ||
@@ -27,3 +27,3 @@ | ||
if (url) { | ||
link_start = `<a href="${quoteMD(quoteHTMLArg(encodeURI(url)))}">`; | ||
link_start = `<a href="${quoteHTMLArg(encodeURI(url))}">`; | ||
link_end = '</a>'; | ||
@@ -54,6 +54,6 @@ } | ||
formatItalic: (part) => `<em>${quoteMD(part.text)}</em>`, | ||
formatLink: (part) => `[${quoteMD(part.text)}](${quoteMD(encodeURI(part.url))})`, | ||
formatLink: (part) => `[${quoteMD(part.text)}](${encodeURI(part.url)})`, | ||
formatModule: (part, url) => (url ? `[${quoteMD(part.fqcn)}](${quoteMD(encodeURI(url))})` : `${quoteMD(part.fqcn)}`), | ||
formatRSTRef: (part) => `${quoteMD(part.text)}`, | ||
formatURL: (part) => `[${quoteMD(encodeURI(part.url))}](${quoteMD(encodeURI(part.url))})`, | ||
formatURL: (part) => `[${quoteMD(encodeURI(part.url))}](${encodeURI(part.url)})`, | ||
formatText: (part) => quoteMD(part.text), | ||
@@ -60,0 +60,0 @@ formatEnvVariable: (part) => `<code>${quoteMD(part.name)}</code>`, |
@@ -44,6 +44,6 @@ /* | ||
/** Should be provided if parsing documentation of a plugin/module/role. */ | ||
current_plugin?: PluginIdentifier; | ||
currentPlugin?: PluginIdentifier; | ||
/** Should be provided if parsing documentation of a specific role's entrypoint. */ | ||
role_entrypoint?: string; | ||
roleEntrypoint?: string; | ||
@@ -62,3 +62,3 @@ /** If set to 'true', only 'classic' Ansible docs markup is accepted. */ | ||
/** Should be provided if rendering documentation for a plugin/module/role. */ | ||
current_plugin?: PluginIdentifier; | ||
currentPlugin?: PluginIdentifier; | ||
} | ||
@@ -112,3 +112,3 @@ | ||
name: string[], | ||
current_plugin: boolean, | ||
currentPlugin: boolean, | ||
) => string | undefined; | ||
@@ -115,0 +115,0 @@ } |
@@ -165,3 +165,3 @@ /* | ||
]); | ||
expect(parse('O(ignore:foo)', { current_plugin: { fqcn: 'foo.bar.baz', type: 'bam' } })).toEqual([ | ||
expect(parse('O(ignore:foo)', { currentPlugin: { fqcn: 'foo.bar.baz', type: 'bam' } })).toEqual([ | ||
[ | ||
@@ -179,3 +179,3 @@ { | ||
]); | ||
expect(parse('O(foo)', { current_plugin: { fqcn: 'foo.bar.baz', type: 'bam' } })).toEqual([ | ||
expect(parse('O(foo)', { currentPlugin: { fqcn: 'foo.bar.baz', type: 'bam' } })).toEqual([ | ||
[ | ||
@@ -273,3 +273,3 @@ { | ||
]); | ||
expect(parse('RV(ignore:foo)', { current_plugin: { fqcn: 'foo.bar.baz', type: 'bam' } })).toEqual([ | ||
expect(parse('RV(ignore:foo)', { currentPlugin: { fqcn: 'foo.bar.baz', type: 'bam' } })).toEqual([ | ||
[ | ||
@@ -287,3 +287,3 @@ { | ||
]); | ||
expect(parse('RV(foo)', { current_plugin: { fqcn: 'foo.bar.baz', type: 'bam' } })).toEqual([ | ||
expect(parse('RV(foo)', { currentPlugin: { fqcn: 'foo.bar.baz', type: 'bam' } })).toEqual([ | ||
[ | ||
@@ -290,0 +290,0 @@ { |
@@ -63,4 +63,4 @@ /* | ||
} else { | ||
plugin = opts.current_plugin; | ||
entrypoint = opts.role_entrypoint; | ||
plugin = opts.currentPlugin; | ||
entrypoint = opts.roleEntrypoint; | ||
} | ||
@@ -67,0 +67,0 @@ if (plugin?.type === 'role') { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
399429
118