Skip to content

Chore(npm): release v6.0.3 #541

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27,584 changes: 17,518 additions & 10,066 deletions package-lock.json

Large diffs are not rendered by default.

55 changes: 27 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@progfay/scrapbox-parser",
"version": "6.0.1",
"version": "6.0.3",
"description": "parse Scrapbox notation to JavaScript Object",
"files": [
"lib",
Expand Down Expand Up @@ -38,37 +38,36 @@
},
"homepage": "https://github.com/progfay/scrapbox-parser#readme",
"devDependencies": {
"@babel/core": "7.11.6",
"@babel/preset-env": "7.11.5",
"@babel/core": "7.12.17",
"@babel/preset-env": "7.12.17",
"@types/core-js": "2.5.4",
"@types/jest": "26.0.13",
"@types/node": "14.10.2",
"@typescript-eslint/eslint-plugin": "4.1.1",
"@typescript-eslint/parser": "4.1.1",
"babel-loader": "8.1.0",
"eslint": "7.9.0",
"eslint-config-prettier": "6.11.0",
"eslint-config-prettier-standard": "3.0.1",
"eslint-config-standard": "14.1.1",
"eslint-config-standard-with-typescript": "19.0.1",
"eslint-plugin-import": "2.22.0",
"eslint-plugin-jest": "24.0.1",
"@types/jest": "26.0.20",
"@types/node": "14.14.28",
"@typescript-eslint/eslint-plugin": "4.15.1",
"@typescript-eslint/parser": "4.15.1",
"babel-loader": "8.2.2",
"eslint": "7.20.0",
"eslint-config-prettier": "7.2.0",
"eslint-config-prettier-standard": "4.0.0",
"eslint-config-standard": "16.0.2",
"eslint-config-standard-with-typescript": "20.0.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jest": "24.1.5",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "3.1.4",
"eslint-plugin-promise": "4.2.1",
"eslint-plugin-standard": "4.0.1",
"jest": "26.4.2",
"jest-snapshot": "26.4.2",
"prettier": "2.1.2",
"prettier-config-standard": "1.0.1",
"eslint-plugin-prettier": "3.3.1",
"eslint-plugin-promise": "4.3.1",
"eslint-plugin-standard": "4.1.0",
"jest": "26.6.3",
"jest-snapshot": "26.6.2",
"prettier": "2.2.1",
"prettier-config-standard": "4.0.0",
"rimraf": "3.0.2",
"ts-jest": "26.3.0",
"ts-loader": "8.0.3",
"typescript": "4.0.2",
"webpack": "4.44.1",
"webpack-cli": "3.3.12"
"ts-jest": "26.5.1",
"ts-loader": "8.0.17",
"typescript": "4.1.5",
"webpack": "5.23.0",
"webpack-cli": "4.5.0"
},
"dependencies": {},
"publishConfig": {
"access": "public"
}
Expand Down
2 changes: 1 addition & 1 deletion src/block/node/DecorationNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { convertToNodes } from '.'
import type { DecorationNode } from './type'
import type { NodeCreator } from './creator'

const decorationRegExp = /\[[!"#%&'()*+,-./{|}<>_~]+ (?:\[[^\]]+\]|[^\]])+\]/
const decorationRegExp = /\[[!"#%&'()*+,-./{|}<>_~]+ (?:\[[^[\]]+\]|[^\]])+\]/

type DecorationChar =
| '*'
Expand Down
6 changes: 3 additions & 3 deletions src/block/node/ExternalLinkNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { createNodeParser } from './creator'
import type { LinkNode } from './type'
import type { NodeCreator } from './creator'

const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+(?:\s+[^\]]*[^\s])?\]/
const contentFirstUrlRegExp = /\[[^\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/
const httpRegExp = /(?<=^| )https?:\/\/[^\s\]]+/
const hrefFirstUrlRegExp = /\[https?:\/\/[^\s\]]+(?:\s+[^[\]]*[^\s])?\]/
const contentFirstUrlRegExp = /\[[^[\]]*[^\s]\s+https?:\/\/[^\s\]]+\]/
const httpRegExp = /(?<=^| )https?:\/\/[^[\s\]]+/

const createExternalLinkNode: NodeCreator<LinkNode> = target => {
if (target.startsWith('[') && target.endsWith(']')) {
Expand Down
2 changes: 1 addition & 1 deletion src/block/node/StrongNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { convertToNodes } from '.'
import type { StrongNode } from './type'
import type { NodeCreator } from './creator'

const strongRegExp = /\[\[.+?[\]]*\]\]/
const strongRegExp = /\[\[(?:[^[]|\[[^[]).*?\]*\]\]/

const createStrongNode: NodeCreator<StrongNode> = (target, opts) => ({
type: 'strong',
Expand Down
2 changes: 1 addition & 1 deletion src/block/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export const convertToNodes = combineNodeParsers(
CommandLineNodeParser,
FormulaNodeParser,
BlankNodeParser,
DecorationNodeParser,
StrongImageNodeParser,
StrongIconNodeParser,
StrongNodeParser,
DecorationNodeParser,
ImageNodeParser,
ExternalLinkNodeParser,
IconNodeParser,
Expand Down
150 changes: 150 additions & 0 deletions tests/line/__snapshots__/decoration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,156 @@ Array [
]
`;

exports[`decoration Decoration with many [ and link: toMatchSnapshotWhenParsing 1`] = `
Array [
Object {
"indent": 0,
"nodes": Array [
Object {
"decos": Array [
"!",
],
"nodes": Array [
Object {
"text": "[[[[[",
"type": "plain",
},
Object {
"content": "",
"href": "a",
"pathType": "relative",
"type": "link",
},
],
"type": "decoration",
},
],
"type": "line",
},
]
`;

exports[`decoration Decoration with many [: toMatchSnapshotWhenParsing 1`] = `
Array [
Object {
"indent": 0,
"nodes": Array [
Object {
"decos": Array [
"!",
],
"nodes": Array [
Object {
"text": "[[[[[[a",
"type": "plain",
},
],
"type": "decoration",
},
],
"type": "line",
},
]
`;

exports[`decoration Decoration with strong icon notation (it's just icon, not strong): toMatchSnapshotWhenParsing 1`] = `
Array [
Object {
"indent": 0,
"nodes": Array [
Object {
"decos": Array [
"*-1",
],
"nodes": Array [
Object {
"text": "[",
"type": "plain",
},
Object {
"content": "",
"href": "progfay.icon",
"pathType": "relative",
"type": "link",
},
],
"type": "decoration",
},
Object {
"text": "]",
"type": "plain",
},
],
"type": "line",
},
]
`;

exports[`decoration Decoration with strong image notation (it's just image, not strong): toMatchSnapshotWhenParsing 1`] = `
Array [
Object {
"indent": 0,
"nodes": Array [
Object {
"decos": Array [
"*-1",
],
"nodes": Array [
Object {
"text": "[",
"type": "plain",
},
Object {
"link": "",
"src": "https://example.com/image.png",
"type": "image",
},
],
"type": "decoration",
},
Object {
"text": "]",
"type": "plain",
},
],
"type": "line",
},
]
`;

exports[`decoration Decoration with strong notation (it's just link): toMatchSnapshotWhenParsing 1`] = `
Array [
Object {
"indent": 0,
"nodes": Array [
Object {
"decos": Array [
"*-1",
],
"nodes": Array [
Object {
"text": "[",
"type": "plain",
},
Object {
"content": "",
"href": "link",
"pathType": "relative",
"type": "link",
},
],
"type": "decoration",
},
Object {
"text": "]",
"type": "plain",
},
],
"type": "line",
},
]
`;

exports[`decoration Simple decoration: toMatchSnapshotWhenParsing 1`] = `
Array [
Object {
Expand Down
31 changes: 31 additions & 0 deletions tests/line/__snapshots__/strong.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,37 @@ Array [
]
`;

exports[`strong Decoration in Strong notation: toMatchSnapshotWhenParsing 1`] = `
Array [
Object {
"indent": 0,
"nodes": Array [
Object {
"text": "[[",
"type": "plain",
},
Object {
"decos": Array [
"!",
],
"nodes": Array [
Object {
"text": "deco",
"type": "plain",
},
],
"type": "decoration",
},
Object {
"text": "]]",
"type": "plain",
},
],
"type": "line",
},
]
`;

exports[`strong Simple strong: toMatchSnapshotWhenParsing 1`] = `
Array [
Object {
Expand Down
20 changes: 20 additions & 0 deletions tests/line/decoration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,24 @@ describe('decoration', () => {
hasTitle: false
})
})

it('Decoration with many [', () => {
expect('[! [[[[[[a]').toMatchSnapshotWhenParsing({ hasTitle: false })
})

it('Decoration with many [ and link', () => {
expect('[! [[[[[[a]]').toMatchSnapshotWhenParsing({ hasTitle: false })
})

it("Decoration with strong notation (it's just link)", () => {
expect('[* [[link]]]').toMatchSnapshotWhenParsing({ hasTitle: false })
})

it("Decoration with strong icon notation (it's just icon, not strong)", () => {
expect('[* [[progfay.icon]]]').toMatchSnapshotWhenParsing({ hasTitle: false })
})

it("Decoration with strong image notation (it's just image, not strong)", () => {
expect('[* [[https://example.com/image.png]]]').toMatchSnapshotWhenParsing({ hasTitle: false })
})
})
4 changes: 4 additions & 0 deletions tests/line/strong.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ describe('strong', () => {
it('[[]] is not strong', () => {
expect('[[]]').toMatchSnapshotWhenParsing({ hasTitle: false })
})

it('Decoration in Strong notation', () => {
expect('[[[! deco]]]').toMatchSnapshotWhenParsing({ hasTitle: false })
})
})