@podlite/schema 0.0.13 → 0.0.15

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.
Files changed (101) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/esm/ast-helpers.d.ts +2 -0
  3. package/esm/ast-helpers.js +10 -0
  4. package/esm/ast-helpers.js.map +1 -0
  5. package/esm/ast-inerator.d.ts +6 -0
  6. package/esm/ast-inerator.js +57 -0
  7. package/esm/ast-inerator.js.map +1 -0
  8. package/esm/blocks-helpers.d.ts +32 -0
  9. package/esm/blocks-helpers.js +65 -0
  10. package/esm/blocks-helpers.js.map +1 -0
  11. package/esm/exportAny.d.ts +19 -0
  12. package/esm/exportAny.js +65 -0
  13. package/esm/exportAny.js.map +1 -0
  14. package/esm/exportHtml.d.ts +15 -0
  15. package/esm/exportHtml.js +279 -0
  16. package/esm/exportHtml.js.map +1 -0
  17. package/esm/grammar.d.ts +14 -0
  18. package/esm/grammar.js +6404 -0
  19. package/esm/grammar.js.map +1 -0
  20. package/esm/grammarfc.d.ts +14 -0
  21. package/esm/grammarfc.js +4218 -0
  22. package/esm/grammarfc.js.map +1 -0
  23. package/esm/helpers/config.d.ts +12 -0
  24. package/esm/helpers/config.js +52 -0
  25. package/esm/helpers/config.js.map +1 -0
  26. package/esm/helpers/corePlugins.d.ts +12 -0
  27. package/esm/helpers/corePlugins.js +23 -0
  28. package/esm/helpers/corePlugins.js.map +1 -0
  29. package/esm/helpers/handlers.d.ts +47 -0
  30. package/esm/helpers/handlers.js +107 -0
  31. package/esm/helpers/handlers.js.map +1 -0
  32. package/esm/helpers/ids.d.ts +18 -0
  33. package/esm/helpers/ids.js +69 -0
  34. package/esm/helpers/ids.js.map +1 -0
  35. package/esm/helpers/makeInterator.d.ts +5 -0
  36. package/esm/helpers/makeInterator.js +52 -0
  37. package/esm/helpers/makeInterator.js.map +1 -0
  38. package/esm/helpers/makeQuery.d.ts +47 -0
  39. package/esm/helpers/makeQuery.js +100 -0
  40. package/esm/helpers/makeQuery.js.map +1 -0
  41. package/esm/helpers/makeQuery.test.d.ts +1 -0
  42. package/esm/helpers/makeQuery.test.js +51 -0
  43. package/esm/helpers/makeQuery.test.js.map +1 -0
  44. package/esm/helpers/makeTransformer.d.ts +7 -0
  45. package/esm/helpers/makeTransformer.js +61 -0
  46. package/esm/helpers/makeTransformer.js.map +1 -0
  47. package/esm/helpers/plugins.d.ts +2 -0
  48. package/esm/helpers/plugins.js +23 -0
  49. package/esm/helpers/plugins.js.map +1 -0
  50. package/esm/index.d.ts +82 -0
  51. package/esm/index.js +123 -0
  52. package/esm/index.js.map +1 -0
  53. package/esm/pluggableParser.d.ts +27 -0
  54. package/esm/pluggableParser.js +71 -0
  55. package/esm/pluggableParser.js.map +1 -0
  56. package/esm/plugin-clean-location.d.ts +2 -0
  57. package/esm/plugin-clean-location.js +19 -0
  58. package/esm/plugin-clean-location.js.map +1 -0
  59. package/esm/plugin-defn-fill-term.d.ts +2 -0
  60. package/esm/plugin-defn-fill-term.js +50 -0
  61. package/esm/plugin-defn-fill-term.js.map +1 -0
  62. package/esm/plugin-formatting-codes.d.ts +3 -0
  63. package/esm/plugin-formatting-codes.js +53 -0
  64. package/esm/plugin-formatting-codes.js.map +1 -0
  65. package/esm/plugin-group-defn.d.ts +2 -0
  66. package/esm/plugin-group-defn.js +71 -0
  67. package/esm/plugin-group-defn.js.map +1 -0
  68. package/esm/plugin-group-items.d.ts +2 -0
  69. package/esm/plugin-group-items.js +79 -0
  70. package/esm/plugin-group-items.js.map +1 -0
  71. package/esm/plugin-heading.d.ts +2 -0
  72. package/esm/plugin-heading.js +33 -0
  73. package/esm/plugin-heading.js.map +1 -0
  74. package/esm/plugin-items.d.ts +2 -0
  75. package/esm/plugin-items.js +41 -0
  76. package/esm/plugin-items.js.map +1 -0
  77. package/esm/plugin-tables.d.ts +5 -0
  78. package/esm/plugin-tables.js +141 -0
  79. package/esm/plugin-tables.js.map +1 -0
  80. package/esm/plugin-vmargin.d.ts +3 -0
  81. package/esm/plugin-vmargin.js +29 -0
  82. package/esm/plugin-vmargin.js.map +1 -0
  83. package/esm/query-helpers.d.ts +28 -0
  84. package/esm/query-helpers.js +131 -0
  85. package/esm/query-helpers.js.map +1 -0
  86. package/esm/types.d.ts +342 -0
  87. package/esm/types.js +2 -0
  88. package/esm/types.js.map +1 -0
  89. package/esm/writer.d.ts +30 -0
  90. package/esm/writer.js +85 -0
  91. package/esm/writer.js.map +1 -0
  92. package/esm/writerHtml.d.ts +11 -0
  93. package/esm/writerHtml.js +29 -0
  94. package/esm/writerHtml.js.map +1 -0
  95. package/lib/grammar.js +29 -21
  96. package/lib/grammarfc.js +1098 -243
  97. package/lib/plugin-formatting-codes.js +2 -1
  98. package/lib/types.d.ts +9 -1
  99. package/package.json +11 -8
  100. package/schema/AstTree.json +116 -0
  101. package/schema/PodliteDocument.json +116 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Upcoming
4
4
 
5
+ ## 0.0.14
6
+
7
+ - fix parse `=alias` and `=config` directives
8
+ - improve brackets support for C<> and L<> codes
9
+ - support for `=toc` block
10
+ - support for `=markdown` block
11
+
5
12
  ## 0.0.13
6
13
 
7
14
  - refactor
@@ -0,0 +1,2 @@
1
+ export declare const getNodeId: (node: any, ctx: any) => any;
2
+ export declare const makeAttrs: (node: any, ctx?: import("./helpers/config").Context) => import("./helpers/config").Attr;
@@ -0,0 +1,10 @@
1
+ import makeAttrsPod from './helpers/config';
2
+ export const getNodeId = (node, ctx) => {
3
+ const conf = makeAttrsPod(node, ctx);
4
+ if (conf.exists('id')) {
5
+ return conf.getFirstValue('id');
6
+ }
7
+ return node.id;
8
+ };
9
+ export const makeAttrs = makeAttrsPod;
10
+ //# sourceMappingURL=ast-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-helpers.js","sourceRoot":"","sources":["../src/ast-helpers.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,kBAAkB,CAAA;AAE3C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IACrC,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACpC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;KAChC;IACD,OAAO,IAAI,CAAC,EAAE,CAAA;AAChB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAA"}
@@ -0,0 +1,6 @@
1
+ export declare function isSemanticBlock(node: any): boolean;
2
+ export declare const makeInterator: (rule: any) => {
3
+ (node: any, context?: any): any;
4
+ rules: any[];
5
+ };
6
+ export default makeInterator;
@@ -0,0 +1,57 @@
1
+ import { makePlug, makeRule } from './helpers/makeQuery';
2
+ // skip warnings for semantic blocks
3
+ export function isSemanticBlock(node) {
4
+ const name = node.name || '';
5
+ const isTypeBlock = (node.type || '') === 'block';
6
+ return isTypeBlock && name === name.toUpperCase();
7
+ }
8
+ function flattenDeep(arr) {
9
+ return arr.reduce((acc, val) => (Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val)), []);
10
+ }
11
+ export const makeInterator = rule => {
12
+ let rules = [];
13
+ function use(key, fn) {
14
+ if (key instanceof Array) {
15
+ console.warn(`[podlite-interator] Unsupported param for ${key}`);
16
+ }
17
+ if (key instanceof Object) {
18
+ for (var prop in key) {
19
+ if (key.hasOwnProperty(prop)) {
20
+ use(prop, key[prop]);
21
+ }
22
+ }
23
+ return [];
24
+ }
25
+ rules.push(makeRule(makePlug(key), fn));
26
+ }
27
+ function visiter(node, context = {}) {
28
+ if (node instanceof Array) {
29
+ return flattenDeep(node.map(item => visiter(item, context))).filter(Boolean);
30
+ }
31
+ if ('string' === typeof node) {
32
+ // convert string to lex node with type
33
+ return visiter({ type: 'text', value: node }, context);
34
+ return node;
35
+ }
36
+ // get first rule for this node
37
+ const reversed = rules.slice();
38
+ reversed.reverse();
39
+ const ruleIndex = reversed.findIndex(rule => rule.isFor(node));
40
+ if (ruleIndex !== -1) {
41
+ return reversed[ruleIndex].fn(node, context, visiter);
42
+ }
43
+ else {
44
+ // not found rule
45
+ const newNode = { ...node };
46
+ if (newNode.hasOwnProperty('content')) {
47
+ newNode.content = visiter(newNode.content, context);
48
+ }
49
+ return newNode;
50
+ }
51
+ }
52
+ use(rule);
53
+ visiter.rules = rules;
54
+ return visiter;
55
+ };
56
+ export default makeInterator;
57
+ //# sourceMappingURL=ast-inerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast-inerator.js","sourceRoot":"","sources":["../src/ast-inerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACxD,oCAAoC;AACpC,MAAM,UAAU,eAAe,CAAC,IAAI;IAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAA;IAC5B,MAAM,WAAW,GAAG,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,KAAK,OAAO,CAAA;IACjD,OAAO,WAAW,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAA;AACnD,CAAC;AAED,SAAS,WAAW,CAAC,GAAG;IACtB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAC5G,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,EAAE;IAClC,IAAI,KAAK,GAAG,EAAE,CAAA;IACd,SAAS,GAAG,CAA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AE,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;SACtD;aAAM;YACL,iBAAiB;YACjB,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,EAAE,CAAA;YAC3B,IAAI,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;gBACrC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;aACpD;YACD,OAAO,OAAO,CAAA;SACf;IACH,CAAC;IACD,GAAG,CAAC,IAAI,CAAC,CAAA;IACT,OAAO,CAAC,KAAK,GAAG,KAAK,CAAA;IACrB,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AACD,eAAe,aAAa,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { AstTree, BlockCaption, BlockItem, Location, PodNode, RootBlock, Toc, TocItem, TocList, Node, Image } from './types';
2
+ export declare const mkNode: <P extends Record<string, any>>(attr: P) => P;
3
+ export declare const filterNulls: (content: any) => any[];
4
+ export declare const mkBlock: (attrs: any, content: any) => any;
5
+ export declare const mkBlankline: () => {
6
+ type: string;
7
+ };
8
+ export declare const mkFomattingCode: (attrs: any, content: any) => any;
9
+ export declare const mkFomattingCodeL: (attrs: any, content: any) => any;
10
+ export declare const mkFomattingCodeDelete: (content: any) => {
11
+ type: string;
12
+ name: string;
13
+ content: any[];
14
+ };
15
+ export declare const mkVerbatim: (text: any) => {
16
+ type: string;
17
+ value: any;
18
+ };
19
+ export declare const mkToc: (content: TocList, title?: string) => Toc;
20
+ export declare const mkTocList: (content: Array<TocItem | TocList>, level: number) => TocList;
21
+ export declare const mkTocItem: (content: PodNode) => TocItem;
22
+ export declare const mkCaption: (content: Array<Node>) => BlockCaption;
23
+ export declare const mkImage: (src: string, alt?: string) => Image;
24
+ export declare const mkRootBlock: ({ margin }: {
25
+ margin?: string;
26
+ }, content: any) => RootBlock;
27
+ export interface mkBlockItemParams {
28
+ level: number;
29
+ location: Location;
30
+ margin: string;
31
+ }
32
+ export declare const mkItemBlock: ({ level, location, margin }: mkBlockItemParams, content: AstTree) => BlockItem;
@@ -0,0 +1,65 @@
1
+ import { nanoid } from 'nanoid';
2
+ export const mkNode = (attr) => {
3
+ return { ...attr };
4
+ };
5
+ export const filterNulls = content => {
6
+ if (Array.isArray(content)) {
7
+ return content.filter(i => i);
8
+ }
9
+ console.warn('[podlite-schema] filterNulls got not array as content');
10
+ };
11
+ export const mkBlock = (attrs, content) => {
12
+ const type = 'block';
13
+ const name = attrs.name;
14
+ const attributes = { id: nanoid(), margin: '', ...attrs };
15
+ var result = mkNode({ type, ...attributes, content: filterNulls(content) });
16
+ return result;
17
+ };
18
+ export const mkBlankline = () => {
19
+ return mkNode({ type: 'blankline' });
20
+ };
21
+ export const mkFomattingCode = (attrs, content) => {
22
+ return mkNode({ type: 'fcode', ...attrs, content });
23
+ };
24
+ export const mkFomattingCodeL = (attrs, content) => {
25
+ let res = mkNode({ ...attrs, type: 'fcode', name: 'L', content: filterNulls(content) });
26
+ return res;
27
+ };
28
+ export const mkFomattingCodeDelete = content => {
29
+ let res = mkNode({ type: 'fcode', name: 'Delete', content: filterNulls(content) });
30
+ return res;
31
+ };
32
+ export const mkVerbatim = text => {
33
+ return mkNode({ type: 'verbatim', value: text });
34
+ };
35
+ // Table of contents helpers
36
+ export const mkToc = (content, title) => {
37
+ return mkNode({ type: 'toc', title, content });
38
+ };
39
+ export const mkTocList = (content, level) => {
40
+ return mkNode({ type: 'toc-list', level, content });
41
+ };
42
+ export const mkTocItem = (content) => {
43
+ return mkNode({ type: 'toc-item', node: content, content: [content] });
44
+ };
45
+ export const mkCaption = (content) => {
46
+ return {
47
+ type: 'block',
48
+ name: 'caption',
49
+ content,
50
+ };
51
+ };
52
+ export const mkImage = (src, alt) => {
53
+ return {
54
+ type: 'image',
55
+ src,
56
+ alt,
57
+ };
58
+ };
59
+ export const mkRootBlock = ({ margin = '' }, content) => {
60
+ return mkBlock({ name: 'root', margin }, content);
61
+ };
62
+ export const mkItemBlock = ({ level, location, margin }, content) => {
63
+ return mkBlock({ name: 'item', level, margin, location }, content);
64
+ };
65
+ //# sourceMappingURL=blocks-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blocks-helpers.js","sourceRoot":"","sources":["../src/blocks-helpers.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAgC,IAAO,EAAK,EAAE;IAClE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAA;AACpB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,EAAE;IACnC,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;KAC9B;IACD,OAAO,CAAC,IAAI,CAAC,uDAAuD,CAAC,CAAA;AACvE,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;IACxC,MAAM,IAAI,GAAG,OAAO,CAAA;IACpB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAA;IACvB,MAAM,UAAU,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,EAAE,CAAA;IACzD,IAAI,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,EAAE,GAAG,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC3E,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,OAAO,MAAM,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAA;AACtC,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,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AM,SAAS,GAAG,CAAC,OAAgB,EAAW,EAAE;IACrD,OAAO,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AACxE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAoB,EAAgB,EAAE;IAC9D,OAAO;QACL,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;QACf,OAAO;KACR,CAAA;AACH,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,GAAY,EAAS,EAAE;IAC1D,OAAO;QACL,IAAI,EAAE,OAAO;QACb,GAAG;QACH,GAAG;KACJ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,MAAM,GAAG,EAAE,EAAE,EAAE,OAAO,EAAa,EAAE;IACjE,OAAO,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAA;AACnD,CAAC,CAAA;AAOD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAqB,EAAE,OAAgB,EAAa,EAAE;IACzG,OAAO,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAA;AACpE,CAAC,CAAA"}
@@ -0,0 +1,19 @@
1
+ export declare type Options = {
2
+ processor?: any;
3
+ writer?: any;
4
+ };
5
+ export declare const toAny: (options?: Options, plugins?: any[]) => {
6
+ (root: any): void;
7
+ use: (key: any, fn?: any) => any;
8
+ run: (src: any, opt_writer?: any) => {
9
+ errors: any;
10
+ toString: () => string;
11
+ valueOf: () => string;
12
+ indexingTerms: any;
13
+ annotations: any;
14
+ defenitions: any;
15
+ interator: any;
16
+ };
17
+ getPlugins(): any[];
18
+ };
19
+ export default toAny;
@@ -0,0 +1,65 @@
1
+ import { makeRule, makePlug } from './helpers/makeQuery';
2
+ import makeInterator from './helpers/makeInterator';
3
+ import Writer from './writer';
4
+ import { parse } from './';
5
+ export const toAny = (options = {}, plugins = []) => {
6
+ let fns = plugins;
7
+ // setup pod6 processor
8
+ const processor = options.processor || parse;
9
+ const _writer = options.writer;
10
+ chain.use = use;
11
+ chain.run = run;
12
+ chain.getPlugins = () => fns;
13
+ return chain;
14
+ function chain(root) { }
15
+ function use(key, fn) {
16
+ if (key instanceof Array) {
17
+ return toAny(options, [...fns, ...fn]);
18
+ }
19
+ if (key instanceof Object) {
20
+ for (var prop in key) {
21
+ if (key.hasOwnProperty(prop)) {
22
+ use(prop, key[prop]);
23
+ }
24
+ }
25
+ return chain;
26
+ }
27
+ fns.push(makeRule(makePlug(key), fn));
28
+ return chain;
29
+ }
30
+ function run(src, opt_writer) {
31
+ let res = '';
32
+ const _tmp_writer = opt_writer ||
33
+ _writer ||
34
+ new Writer(s => {
35
+ res = res + s;
36
+ });
37
+ const writer = 'function' === typeof _tmp_writer
38
+ ? new _tmp_writer(s => {
39
+ res = res + s;
40
+ })
41
+ : _tmp_writer;
42
+ // src may be preparsed tree
43
+ const tree = 'string' === typeof src ? processor(src) : src;
44
+ // make new instance of HTML with initialized plugins
45
+ // reverse init
46
+ let newFns = fns.slice();
47
+ newFns.reverse();
48
+ const interator = makeInterator(newFns.map(rule => makeRule(rule.rule, rule.fn(writer, processor, tree))).reverse());
49
+ const context = {};
50
+ writer.startWrite(tree);
51
+ const result = interator(tree, context);
52
+ writer.endWrite();
53
+ return {
54
+ errors: writer.errors,
55
+ toString: () => res,
56
+ valueOf: () => res,
57
+ indexingTerms: writer.INDEXTERMS,
58
+ annotations: writer.FOOTNOTES,
59
+ defenitions: writer.DEFINITIONS,
60
+ interator: result,
61
+ };
62
+ }
63
+ };
64
+ export default toAny;
65
+ //# sourceMappingURL=exportAny.js.map
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nB,OAAO,EAAE,GAAG,EAAE,CAAC,GAAG;YAClB,aAAa,EAAE,MAAM,CAAC,UAAU;YAChC,WAAW,EAAE,MAAM,CAAC,SAAS;YAC7B,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,SAAS,EAAE,MAAM;SAClB,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAED,eAAe,KAAK,CAAA"}
@@ -0,0 +1,15 @@
1
+ declare const toHtml: (opt: any) => {
2
+ (root: any): void;
3
+ use: (key: any, fn?: any) => any;
4
+ run: (src: any, opt_writer?: any) => {
5
+ errors: any;
6
+ toString: () => string;
7
+ valueOf: () => string;
8
+ indexingTerms: any;
9
+ annotations: any;
10
+ defenitions: any;
11
+ interator: any;
12
+ };
13
+ getPlugins(): any[];
14
+ };
15
+ export default toHtml;
@@ -0,0 +1,279 @@
1
+ import toAny from './exportAny';
2
+ import { subUse, wrapContent, emptyContent, content, setFn, handleNested } from './helpers/handlers';
3
+ import { isNamedBlock } from './helpers/makeTransformer';
4
+ import makeAttrs from './helpers/config';
5
+ import htmlWriter from './writerHtml';
6
+ import clean_plugin from './plugin-clean-location';
7
+ import { getNodeId } from './ast-helpers';
8
+ const rules = {
9
+ ':text': (writer, processor) => (node, ctx, interator) => {
10
+ // handle text with content
11
+ if (node.value) {
12
+ writer.write(node.value);
13
+ }
14
+ else {
15
+ interator(node.content, ctx);
16
+ }
17
+ },
18
+ // Formatting codes
19
+ 'A<>': (writer, processor) => (node, ctx, interator) => {
20
+ //get replacement text
21
+ if (!(ctx.alias && ctx.alias.hasOwnProperty(node.content))) {
22
+ writer.write(`A<${node.content}>`);
23
+ }
24
+ else {
25
+ const src = ctx.alias[node.content].join('\n');
26
+ const tree_1 = processor(src);
27
+ // now clean locations
28
+ const tree = clean_plugin()(tree_1);
29
+ if (tree[0].type === 'para') {
30
+ interator(tree[0].content, ctx);
31
+ }
32
+ else {
33
+ interator(tree, ctx);
34
+ }
35
+ }
36
+ },
37
+ 'C<>': wrapContent('<code>', '</code>'),
38
+ 'D<>': (writer, processor) => (node, ctx, interator) => {
39
+ // @ts-ignore
40
+ let synonyms = { node };
41
+ let definition = [node.content[0]];
42
+ if (synonyms) {
43
+ definition = synonyms;
44
+ }
45
+ if (!writer.hasOwnProperty('DEFINITIONS')) {
46
+ writer.DEFINITIONS = [];
47
+ }
48
+ writer.DEFINITIONS.push({ definition });
49
+ writer.writeRaw('<dfn>');
50
+ interator(node.content, ctx);
51
+ writer.writeRaw('</dfn>');
52
+ },
53
+ 'B<>': wrapContent('<strong>', '</strong>'),
54
+ 'I<>': wrapContent('<em>', '</em>'),
55
+ 'R<>': wrapContent('<var>', '</var>'),
56
+ 'K<>': wrapContent('<kbd>', '</kbd>'),
57
+ 'L<>': setFn((node, ctx) => {
58
+ let { meta } = node;
59
+ if (meta === null) {
60
+ meta = node.content;
61
+ }
62
+ return wrapContent(`<a href="${meta}">`, `</a>`);
63
+ }),
64
+ /**
65
+ * CSS rules for footnotes
66
+
67
+ .footnote a {
68
+ text-decoration: none;
69
+ }
70
+ .footnotes {
71
+ border-top-style: solid;
72
+ border-top-width: 1px;
73
+ border-top-color: #eee;
74
+ }
75
+ */
76
+ 'N<>': (writer, processor) => {
77
+ writer.addListener('end', () => {
78
+ if (!writer.hasOwnProperty('FOOTNOTES')) {
79
+ return;
80
+ }
81
+ const footnotes = writer.FOOTNOTES;
82
+ if (footnotes.length < 1) {
83
+ return;
84
+ } // if empty footnotes
85
+ writer.writeRaw(`<div class="footnotes">`);
86
+ footnotes.map(footnote => {
87
+ writer.writeRaw(`<p><sup id="${footnote.fnId}" class="footnote"><a href="#${footnote.fnRefId}">[${footnote.gid}]</a></sup> `);
88
+ footnote.make();
89
+ writer.writeRaw(`</p>`);
90
+ });
91
+ writer.writeRaw(`</div>`);
92
+ });
93
+ return (node, ctx, interator) => {
94
+ // skip empty notes
95
+ if (node.content.length < 1) {
96
+ return;
97
+ }
98
+ if (!writer.hasOwnProperty('gid')) {
99
+ writer.gid = 1;
100
+ }
101
+ // get foot note id
102
+ const gid = writer.gid++;
103
+ const fnRefId = `fnref:${gid}`;
104
+ const fnId = `fn:${gid}`;
105
+ writer.writeRaw(`<sup id="${fnRefId}" class="footnote"><a href="#${fnId}">[${gid}]</a></sup>`);
106
+ if (!writer.hasOwnProperty('FOOTNOTES')) {
107
+ writer.FOOTNOTES = [];
108
+ }
109
+ writer.FOOTNOTES.push({
110
+ gid,
111
+ fnRefId,
112
+ fnId,
113
+ make: () => {
114
+ interator(node.content, ctx);
115
+ },
116
+ });
117
+ };
118
+ },
119
+ 'S<>': (writer, processor) => (node, ctx, interator) => {
120
+ const content = node.content || '';
121
+ const spaces = content.replace(/ /g, '&nbsp;');
122
+ const newFeed = spaces.replace(/\n/g, '</br>');
123
+ writer.writeRaw(newFeed);
124
+ },
125
+ 'T<>': wrapContent('<samp>', '</samp>'),
126
+ 'U<>': wrapContent('<u>', '</u>'),
127
+ 'V<>': content,
128
+ 'X<>': (writer, processor) => (node, ctx, interator) => {
129
+ interator(node.content, ctx);
130
+ let { entry } = node;
131
+ if (entry === null && node.content.length > 0) {
132
+ //@ts-ignore
133
+ entry = [node.content[0]];
134
+ }
135
+ else {
136
+ return;
137
+ }
138
+ if (!writer.hasOwnProperty('INDEXTERMS')) {
139
+ writer.INDEXTERMS = [];
140
+ }
141
+ writer.INDEXTERMS.push({
142
+ entry,
143
+ });
144
+ },
145
+ 'Z<>': emptyContent,
146
+ pod: content,
147
+ ':code': wrapContent('<pre><code>', '</code></pre>'),
148
+ code: handleNested(wrapContent('<pre><code>', '</code></pre>')),
149
+ data: emptyContent,
150
+ ':verbatim': (writer, processor) => (node, ctx, interator) => {
151
+ if (node.error) {
152
+ writer.emit('errors', node.location);
153
+ }
154
+ interator(node.value);
155
+ },
156
+ ':blankline': emptyContent,
157
+ ':ambient': emptyContent,
158
+ // Directives
159
+ ':config': setFn((node, ctx) => {
160
+ // setup context
161
+ if (!ctx.hasOwnProperty('config'))
162
+ ctx.config = {};
163
+ //collect configs in context
164
+ ctx.config[node.name] = node.config;
165
+ return emptyContent;
166
+ }),
167
+ ':alias': setFn((node, ctx) => {
168
+ // set alias
169
+ if (!ctx.hasOwnProperty('alias'))
170
+ ctx.alias = {};
171
+ //collect configs in context
172
+ ctx.alias[node.name] = node.replacement;
173
+ return emptyContent;
174
+ }),
175
+ // block =para
176
+ para: handleNested(content),
177
+ ':para': wrapContent('<p>', '</p>'),
178
+ 'head:block': subUse({
179
+ // inside head don't wrap into <p>
180
+ ':para': content,
181
+ }, setFn((node, ctx) => {
182
+ const { level } = node;
183
+ const id = getNodeId(node, ctx);
184
+ return wrapContent(`<h${level}${id ? ` id="${id}"` : ''}>`, `</h${level}>`);
185
+ })),
186
+ ':list': setFn((node, ctx) => node.list === 'ordered'
187
+ ? wrapContent('<ol>', '</ol>')
188
+ : node.list === 'variable'
189
+ ? wrapContent('<dl>', '</dl>')
190
+ : wrapContent('<ul>', '</ul>')),
191
+ 'item:block': (writer, processor) => (node, ctx, interator) => {
192
+ // make text from first para
193
+ if (!(node.content instanceof Array)) {
194
+ console.error('[pod6] item:block : Error in content of ' + JSON.stringify(node));
195
+ }
196
+ const [firstPara, ...other] = node.content;
197
+ writer.writeRaw('<li>');
198
+ // TODO: get cases for handle first para in items
199
+ // interator([...firstPara.content, ...other], ctx)
200
+ interator(node.content, ctx);
201
+ writer.writeRaw('</li>');
202
+ },
203
+ 'comment:block': emptyContent,
204
+ defn: wrapContent('', '</dd>'),
205
+ 'term:para': wrapContent('<dt>', '</dt><dd>'),
206
+ nested: handleNested(content, 1),
207
+ output: handleNested(wrapContent('<pre><samp>', '</samp></pre>'), 1),
208
+ input: handleNested(wrapContent('<pre><kbd>', '</kbd></pre>'), 1),
209
+ // table section
210
+ 'table:block': handleNested((writer, processor) => (node, ctx, interator) => {
211
+ const conf = makeAttrs(node, ctx);
212
+ writer.writeRaw('<table>');
213
+ if (conf.exists('caption')) {
214
+ writer.writeRaw('<caption>');
215
+ writer.write(conf.getFirstValue('caption'));
216
+ writer.writeRaw('</caption>');
217
+ }
218
+ interator(node.content, ctx);
219
+ writer.writeRaw('</table>');
220
+ }),
221
+ ':separator': emptyContent,
222
+ table_row: wrapContent('<tr>', '</tr>'),
223
+ table_cell: wrapContent('<td>', '</td>'),
224
+ table_head: subUse({
225
+ table_cell: wrapContent('<th>', '</th>'),
226
+ }, wrapContent('<tr>', '</tr>')),
227
+ // Toc
228
+ ':toc': (writer, processor) => (node, ctx, interator) => {
229
+ writer.writeRaw('<div className="toc">');
230
+ // get toc title
231
+ const conf = makeAttrs(node, ctx);
232
+ if (conf.exists('title')) {
233
+ const title = conf.getFirstValue('title');
234
+ writer.writeRaw('<div className="toctitle">');
235
+ writer.write(title);
236
+ writer.writeRaw('</div>');
237
+ }
238
+ interator(node.content, ctx);
239
+ writer.writeRaw('</div>');
240
+ },
241
+ ':toc-list': setFn((node, ctx) => wrapContent(`<ul class="toc-list listlevel${node.level}">`, '</ul>')),
242
+ ':toc-item': setFn((node, ctx) => wrapContent('<li class="toc-item">', '</li>')),
243
+ ':image': (writer, processor) => (node, ctx, interator) => {
244
+ writer.writeRaw(`<img src="${node.src}" alt="${node.alt}"/>`);
245
+ },
246
+ };
247
+ const toHtml = opt => toAny({ writer: htmlWriter, ...opt })
248
+ .use('*', (writer, processor) => {
249
+ return (node, ctx, interator) => {
250
+ // skip warnings for semantic blocks
251
+ const isSemanticBlock = node => {
252
+ const name = node.name || '';
253
+ const isTypeBlock = (node.type || '') === 'block';
254
+ return isTypeBlock && name === name.toUpperCase();
255
+ };
256
+ //Named blocks for which no explicit class has been defined or loaded are
257
+ //usually not rendered by the standard renderers.
258
+ if (isNamedBlock(node.name)) {
259
+ return true;
260
+ }
261
+ if (isSemanticBlock(node)) {
262
+ const name = node.name;
263
+ writer.writeRaw('<h1 class="');
264
+ writer.write(name);
265
+ writer.writeRaw('">');
266
+ writer.write(name);
267
+ writer.writeRaw('</h1>');
268
+ }
269
+ else {
270
+ console.warn('[pod6] Unhandled node' + JSON.stringify(node, null, 2));
271
+ }
272
+ if (node.hasOwnProperty('content')) {
273
+ interator(node.content, ctx);
274
+ }
275
+ };
276
+ })
277
+ .use(rules);
278
+ export default toHtml;
279
+ //# sourceMappingURL=exportHtml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exportHtml.js","sourceRoot":"","sources":["../src/exportHtml.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACpG,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,UAAU,MAAM,cAAc,CAAA;AACrC,OAAO,YAAY,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,MAAM,KAAK,GAAG;IACZ,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE;QACvD,2BAA2B;QAC3B,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SACzB;aAAM;YACL,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;SAC7B;IACH,CAAC;IAED,mBAAmB;IACnB,KAAK,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE;QACrD,sBAAsB;QACtB,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;YAC1D,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,OAAO,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,EAAE,CAAC,KAAK,OAAO,CAAA;YACjD,OAAO,WAAW,IAAI,IAAI,KAAK,IAAI,CAAC,WAAW,EAAE,CAAA;QACnD,CAAC,CAAA;QAED,yEAAyE;QACzE,iDAAiD;QACjD,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAA;SACZ;QAED,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;YACtB,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;YAC9B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAClB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;YACrB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAClB,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;SACzB;aAAM;YACL,OAAO,CAAC,IAAI,CAAC,uBAAuB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;SACtE;QACD,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;YAClC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;SAC7B;IACH,CAAC,CAAA;AACH,CAAC,CAAC;KACD,GAAG,CAAC,KAAK,CAAC,CAAA;AAEf,eAAe,MAAM,CAAA"}
@@ -0,0 +1,14 @@
1
+ declare function peg$SyntaxError(message: any, expected: any, found: any, location: any): void;
2
+ declare class peg$SyntaxError {
3
+ constructor(message: any, expected: any, found: any, location: any);
4
+ message: any;
5
+ expected: any;
6
+ found: any;
7
+ location: any;
8
+ name: string;
9
+ }
10
+ declare namespace peg$SyntaxError {
11
+ function buildMessage(expected: any, found: any): string;
12
+ }
13
+ declare function peg$parse(input: any, options: any): any;
14
+ export { peg$SyntaxError as SyntaxError, peg$parse as parse };