securemark 0.299.3 → 0.299.4
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/CHANGELOG.md +4 -0
- package/dist/index.js +2054 -2095
- package/index.ts +2 -2
- package/package.json +1 -1
- package/src/{parser/api → api}/bind.test.ts +2 -2
- package/src/{parser/api → api}/bind.ts +5 -5
- package/src/{parser/api → api}/body.test.ts +1 -1
- package/src/{parser/api → api}/cache.ts +1 -1
- package/src/{parser/api → api}/header.test.ts +1 -1
- package/src/{parser/api → api}/header.ts +2 -2
- package/src/{parser/api → api}/normalize.test.ts +1 -1
- package/src/{parser/api → api}/parse.test.ts +3 -3
- package/src/{parser/api → api}/parse.ts +5 -5
- package/src/combinator/data/{node.ts → list/list.ts} +4 -4
- package/src/combinator/data/parser/inits.ts +3 -3
- package/src/combinator/data/parser/sequence.ts +3 -3
- package/src/combinator/data/parser/subsequence.ts +3 -3
- package/src/combinator/data/parser/tails.ts +3 -3
- package/src/combinator/data/parser.ts +1 -1
- package/src/parser/block/blockquote.ts +1 -1
- package/src/parser/block/extension/aside.ts +1 -1
- package/src/parser/block/extension/example.ts +1 -1
- package/src/parser/inline/link.ts +2 -2
- package/src/parser/inline/media.ts +1 -1
- package/src/parser/node.ts +1 -1
- package/src/parser/visibility.ts +1 -1
- package/src/{parser/processor → processor}/figure.test.ts +4 -4
- package/src/{parser/processor → processor}/figure.ts +2 -2
- package/src/{parser/processor → processor}/note.test.ts +3 -3
- package/src/{parser/processor → processor}/note.ts +2 -2
- package/src/renderer/render/media/pdf.ts +1 -1
- package/src/renderer/render/media/twitter.ts +1 -1
- package/src/renderer/render/media.test.ts +1 -2
- package/src/renderer/render.test.ts +1 -1
- package/src/util/info.test.ts +1 -1
- package/src/util/quote.test.ts +1 -1
- package/src/util/toc.test.ts +1 -1
- package/src/parser.ts +0 -1
- /package/src/{parser/api → api}/body.ts +0 -0
- /package/src/{parser/api → api}/normalize.ts +0 -0
- /package/src/{parser/api.ts → api.ts} +0 -0
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Progress } from '
|
|
1
|
+
import { Progress } from '../..';
|
|
2
2
|
import { bind } from './bind';
|
|
3
3
|
import { frag, html } from 'typed-dom/dom';
|
|
4
4
|
|
|
5
|
-
describe('Unit:
|
|
5
|
+
describe('Unit: api/bind', () => {
|
|
6
6
|
describe('bind', () => {
|
|
7
7
|
function inspect(iter: IterableIterator<Progress>, count = Infinity) {
|
|
8
8
|
const acc: (string | undefined)[] = [];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ParserSettings, Progress } from '
|
|
2
|
-
import { Context, Options, Segment } from '../context';
|
|
3
|
-
import { input } from '
|
|
4
|
-
import { segment } from '../segment';
|
|
5
|
-
import { block } from '../block';
|
|
1
|
+
import { ParserSettings, Progress } from '../..';
|
|
2
|
+
import { Context, Options, Segment } from '../parser/context';
|
|
3
|
+
import { input } from '../combinator/data/parser';
|
|
4
|
+
import { segment } from '../parser/segment';
|
|
5
|
+
import { block } from '../parser/block';
|
|
6
6
|
import { headers } from './header';
|
|
7
7
|
import { figure } from '../processor/figure';
|
|
8
8
|
import { note } from '../processor/note';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parse } from './parse';
|
|
2
|
-
import { Context } from '../context';
|
|
2
|
+
import { Context } from '../parser/context';
|
|
3
3
|
import { html } from 'typed-dom/dom';
|
|
4
|
-
import { normalize } from '
|
|
4
|
+
import { normalize } from '../debug.test';
|
|
5
5
|
|
|
6
|
-
describe('Unit:
|
|
6
|
+
describe('Unit: api/parse', () => {
|
|
7
7
|
describe('parse', () => {
|
|
8
8
|
it('huge input', () => {
|
|
9
9
|
assert.deepStrictEqual(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ParserOptions } from '
|
|
2
|
-
import { input } from '
|
|
3
|
-
import { Context, Options, Segment } from '../context';
|
|
4
|
-
import { segment } from '../segment';
|
|
5
|
-
import { block } from '../block';
|
|
1
|
+
import { ParserOptions } from '../..';
|
|
2
|
+
import { input } from '../combinator/data/parser';
|
|
3
|
+
import { Context, Options, Segment } from '../parser/context';
|
|
4
|
+
import { segment } from '../parser/segment';
|
|
5
|
+
import { block } from '../parser/block';
|
|
6
6
|
import { headers } from './header';
|
|
7
7
|
import { figure } from '../processor/figure';
|
|
8
8
|
import { note } from '../processor/note';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Parser, Context } from '
|
|
1
|
+
import { Parser, Context } from '../parser';
|
|
2
2
|
|
|
3
3
|
export class List<N extends List.Node = List.Node, C extends Context = Context, D extends Parser<unknown, C>[] = any> {
|
|
4
4
|
constructor(nodes?: ArrayLike<N>) {
|
|
@@ -134,8 +134,8 @@ export class List<N extends List.Node = List.Node, C extends Context = Context,
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
export namespace List {
|
|
137
|
-
export
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
export interface Node {
|
|
138
|
+
next?: this;
|
|
139
|
+
prev?: this;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Parser, List, Node, Context } from '../parser';
|
|
2
2
|
|
|
3
|
-
export function inits<P extends Parser>(parsers: Parser.SubParsers<P
|
|
4
|
-
export function inits<N, D extends Parser<N>[]>(parsers: D): Parser<N, Context, D> {
|
|
3
|
+
export function inits<P extends Parser>(parsers: Parser.SubParsers<P>, delimitation?: boolean): Parser.SubNode<P> extends Parser.Node<P> ? P : Parser<Parser.SubNode<P>, Parser.Context<P>, Parser.SubParsers<P>>;
|
|
4
|
+
export function inits<N, D extends Parser<N>[]>(parsers: D, delimitation = false): Parser<N, Context, D> {
|
|
5
5
|
assert(parsers.every(f => f));
|
|
6
6
|
if (parsers.length === 1) return parsers[0];
|
|
7
7
|
return input => {
|
|
@@ -10,7 +10,7 @@ export function inits<N, D extends Parser<N>[]>(parsers: D): Parser<N, Context,
|
|
|
10
10
|
let nodes: List<Node<N>> | undefined;
|
|
11
11
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
12
12
|
if (context.position === source.length) break;
|
|
13
|
-
if (context.delimiters.test(input)) break;
|
|
13
|
+
if (delimitation && context.delimiters.test(input)) break;
|
|
14
14
|
const result = parsers[i](input);
|
|
15
15
|
if (result === undefined) break;
|
|
16
16
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Parser, List, Node, Context, failsafe } from '../parser';
|
|
2
2
|
|
|
3
|
-
export function sequence<P extends Parser>(parsers: Parser.SubParsers<P
|
|
4
|
-
export function sequence<N, D extends Parser<N>[]>(parsers: D): Parser<N, Context, D> {
|
|
3
|
+
export function sequence<P extends Parser>(parsers: Parser.SubParsers<P>, delimitation?: boolean): Parser.SubNode<P> extends Parser.Node<P> ? P : Parser<Parser.SubNode<P>, Parser.Context<P>, Parser.SubParsers<P>>;
|
|
4
|
+
export function sequence<N, D extends Parser<N>[]>(parsers: D, delimitation = false): Parser<N, Context, D> {
|
|
5
5
|
assert(parsers.every(f => f));
|
|
6
6
|
if (parsers.length === 1) return parsers[0];
|
|
7
7
|
return failsafe(input => {
|
|
@@ -10,7 +10,7 @@ export function sequence<N, D extends Parser<N>[]>(parsers: D): Parser<N, Contex
|
|
|
10
10
|
let nodes: List<Node<N>> | undefined;
|
|
11
11
|
for (let len = parsers.length, i = 0; i < len; ++i) {
|
|
12
12
|
if (context.position === source.length) return;
|
|
13
|
-
if (context.delimiters.test(input)) return;
|
|
13
|
+
if (delimitation && context.delimiters.test(input)) return;
|
|
14
14
|
const result = parsers[i](input);
|
|
15
15
|
if (result === undefined) return;
|
|
16
16
|
nodes = nodes?.import(result) ?? result;
|
|
@@ -2,12 +2,12 @@ import { Parser, Context } from '../parser';
|
|
|
2
2
|
import { union } from './union';
|
|
3
3
|
import { inits } from './inits';
|
|
4
4
|
|
|
5
|
-
export function subsequence<P extends Parser>(parsers: Parser.SubParsers<P
|
|
6
|
-
export function subsequence<N, D extends Parser<N>[]>(parsers: D): Parser<N, Context, D> {
|
|
5
|
+
export function subsequence<P extends Parser>(parsers: Parser.SubParsers<P>, delimitation?: boolean): Parser.SubNode<P> extends Parser.Node<P> ? P : Parser<Parser.SubNode<P>, Parser.Context<P>, Parser.SubParsers<P>>;
|
|
6
|
+
export function subsequence<N, D extends Parser<N>[]>(parsers: D, delimitation = false): Parser<N, Context, D> {
|
|
7
7
|
assert(parsers.every(f => f));
|
|
8
8
|
return union(
|
|
9
9
|
parsers.map((_, i) =>
|
|
10
10
|
i + 1 < parsers.length
|
|
11
|
-
? inits([parsers[i], subsequence(parsers.slice(i + 1))])
|
|
11
|
+
? inits([parsers[i], subsequence(parsers.slice(i + 1), delimitation)], delimitation)
|
|
12
12
|
: parsers[i]) as D);
|
|
13
13
|
}
|
|
@@ -2,7 +2,7 @@ import { Parser, Context } from '../parser';
|
|
|
2
2
|
import { union } from './union';
|
|
3
3
|
import { sequence } from './sequence';
|
|
4
4
|
|
|
5
|
-
export function tails<P extends Parser>(parsers: Parser.SubParsers<P
|
|
6
|
-
export function tails<N, D extends Parser<N>[]>(parsers: D): Parser<N, Context, D> {
|
|
7
|
-
return union(parsers.map((_, i) => sequence(parsers.slice(i))) as D);
|
|
5
|
+
export function tails<P extends Parser>(parsers: Parser.SubParsers<P>, delimitation?: boolean): Parser.SubNode<P> extends Parser.Node<P> ? P : Parser<Parser.SubNode<P>, Parser.Context<P>, Parser.SubParsers<P>>;
|
|
6
|
+
export function tails<N, D extends Parser<N>[]>(parsers: D, delimitation?: boolean): Parser<N, Context, D> {
|
|
7
|
+
return union(parsers.map((_, i) => sequence(parsers.slice(i), delimitation)) as D);
|
|
8
8
|
}
|
|
@@ -5,7 +5,7 @@ import { union, some, spend, recursion, block, validate, rewrite, open, convert,
|
|
|
5
5
|
import { autolink } from '../autolink';
|
|
6
6
|
import { contentline } from '../source';
|
|
7
7
|
import { unwrap, randomID } from '../util';
|
|
8
|
-
import { parse } from '
|
|
8
|
+
import { parse } from '../../api/parse';
|
|
9
9
|
import { html, defrag } from 'typed-dom/dom';
|
|
10
10
|
|
|
11
11
|
export const segment: BlockquoteParser.SegmentParser = block(union([
|
|
@@ -4,7 +4,7 @@ import { List, Node } from '../../../combinator/data/parser';
|
|
|
4
4
|
import { recursion, block, fence, fmap } from '../../../combinator';
|
|
5
5
|
import { identity } from '../../inline/extension/indexee';
|
|
6
6
|
import { unwrap, invalid, randomID } from '../../util';
|
|
7
|
-
import { parse } from '
|
|
7
|
+
import { parse } from '../../../api/parse';
|
|
8
8
|
import { html } from 'typed-dom/dom';
|
|
9
9
|
|
|
10
10
|
export const aside: ExtensionParser.AsideParser = block(recursion(Recursion.block, fmap(
|
|
@@ -4,7 +4,7 @@ import { List, Node, subinput } from '../../../combinator/data/parser';
|
|
|
4
4
|
import { recursion, block, fence, fmap } from '../../../combinator';
|
|
5
5
|
import { mathblock } from '../mathblock';
|
|
6
6
|
import { unwrap, invalid, randomID } from '../../util';
|
|
7
|
-
import { parse } from '
|
|
7
|
+
import { parse } from '../../../api/parse';
|
|
8
8
|
import { html } from 'typed-dom/dom';
|
|
9
9
|
|
|
10
10
|
export const example: ExtensionParser.ExampleParser = block(recursion(Recursion.block, fmap(
|
|
@@ -35,7 +35,7 @@ export const textlink: LinkParser.TextLinkParser = lazy(() => bind(
|
|
|
35
35
|
// 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
|
|
36
36
|
dup(surround(
|
|
37
37
|
/{(?![{}])/y,
|
|
38
|
-
|
|
38
|
+
inits([uri, some(option)]),
|
|
39
39
|
/ ?}/y,
|
|
40
40
|
false, [],
|
|
41
41
|
undefined,
|
|
@@ -83,7 +83,7 @@ export const medialink: LinkParser.MediaLinkParser = lazy(() => constraint(State
|
|
|
83
83
|
']')),
|
|
84
84
|
dup(surround(
|
|
85
85
|
/{(?![{}])/y,
|
|
86
|
-
|
|
86
|
+
inits([uri, some(option)]),
|
|
87
87
|
/ ?}/y)),
|
|
88
88
|
]),
|
|
89
89
|
([{ value: content }, { value: params }], context) =>
|
package/src/parser/node.ts
CHANGED
package/src/parser/visibility.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Parser, List, Node } from '../combinator/data/parser';
|
|
|
2
2
|
import { Command } from './context';
|
|
3
3
|
import { Flag } from './node';
|
|
4
4
|
import { convert, fmap } from '../combinator';
|
|
5
|
-
import { invisibleBlankHTMLEntityNames } from '
|
|
5
|
+
import { invisibleBlankHTMLEntityNames } from '../api/normalize';
|
|
6
6
|
|
|
7
7
|
namespace blank {
|
|
8
8
|
export const line = new RegExp(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { figure } from './figure';
|
|
2
|
-
import { ParserOptions } from '
|
|
3
|
-
import { parse as parse_ } from '
|
|
2
|
+
import { ParserOptions } from '../..';
|
|
3
|
+
import { parse as parse_ } from '../api';
|
|
4
4
|
import { html } from 'typed-dom/dom';
|
|
5
|
-
import { normalize } from '
|
|
5
|
+
import { normalize } from '../debug.test';
|
|
6
6
|
|
|
7
7
|
const parse = (s: string, o?: ParserOptions) => parse_(s, { test: true, ...o });
|
|
8
8
|
|
|
9
|
-
describe('Unit:
|
|
9
|
+
describe('Unit: processor/figure', () => {
|
|
10
10
|
describe('figure', () => {
|
|
11
11
|
it('empty', () => {
|
|
12
12
|
const target = parse('');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { number as calculate, isFixed } from '../inline/extension/label';
|
|
2
|
-
import { markInvalid, unmarkInvalid } from '../util';
|
|
1
|
+
import { number as calculate, isFixed } from '../parser/inline/extension/label';
|
|
2
|
+
import { markInvalid, unmarkInvalid } from '../parser/util';
|
|
3
3
|
import { MultiQueue } from 'spica/queue';
|
|
4
4
|
import { push } from 'spica/array';
|
|
5
5
|
import { define } from 'typed-dom/dom';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { note } from './note';
|
|
2
|
-
import { parse as parse_ } from '
|
|
2
|
+
import { parse as parse_ } from '../api';
|
|
3
3
|
import { html } from 'typed-dom/dom';
|
|
4
|
-
import { normalize } from '
|
|
4
|
+
import { normalize } from '../debug.test';
|
|
5
5
|
|
|
6
6
|
const parse = (s: string) => parse_(s, { test: true });
|
|
7
7
|
|
|
8
|
-
describe('Unit:
|
|
8
|
+
describe('Unit: processor/note', () => {
|
|
9
9
|
describe('annotation', () => {
|
|
10
10
|
it('empty', () => {
|
|
11
11
|
const target = parse('');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { identity, signature, text } from '../inline/extension/indexee';
|
|
2
|
-
import { markInvalid, unmarkInvalid } from '../util';
|
|
1
|
+
import { identity, signature, text } from '../parser/inline/extension/indexee';
|
|
2
|
+
import { markInvalid, unmarkInvalid } from '../parser/util';
|
|
3
3
|
import { memoize } from 'spica/memoize';
|
|
4
4
|
import { html, define } from 'typed-dom/dom';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { render as render_ } from './render';
|
|
2
2
|
import { RenderingOptions } from '../../';
|
|
3
|
-
import { parse } from '../
|
|
3
|
+
import { parse } from '../api/parse';
|
|
4
4
|
|
|
5
5
|
function render(target: HTMLElement, opts: RenderingOptions = {}): HTMLElement {
|
|
6
6
|
render_(target, opts);
|
package/src/util/info.test.ts
CHANGED
package/src/util/quote.test.ts
CHANGED
package/src/util/toc.test.ts
CHANGED
package/src/parser.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './parser/api';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|