-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(parser): support Basic DocType Declarations
This is not meant to support full DTD, only the declaration part to an external DTD BREAKING CHANGE: Implementing XmlCstVisitor now requires implementing two additional methods: (docTypeDecl and externalID)
- Loading branch information
Showing
11 changed files
with
411 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/parser/test/snapshots/valid/doc-type-public/input.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> | ||
<note></note> |
145 changes: 145 additions & 0 deletions
145
packages/parser/test/snapshots/valid/doc-type-public/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
module.exports = { | ||
cst: { | ||
name: "document", | ||
children: { | ||
docTypeDecl: [ | ||
{ | ||
name: "docTypeDecl", | ||
children: { | ||
DocType: [ | ||
{ | ||
image: "<!DOCTYPE", | ||
startOffset: 0, | ||
endOffset: 8, | ||
tokenType: "DocType" | ||
} | ||
], | ||
Name: [ | ||
{ | ||
image: "task", | ||
startOffset: 10, | ||
endOffset: 13, | ||
tokenType: "Name" | ||
} | ||
], | ||
externalID: [ | ||
{ | ||
name: "externalID", | ||
children: { | ||
Public: [ | ||
{ | ||
image: "PUBLIC", | ||
startOffset: 15, | ||
endOffset: 20, | ||
tokenType: "Name" | ||
} | ||
], | ||
PubIDLiteral: [ | ||
{ | ||
image: '"-//OASIS//DTD DITA Task//EN"', | ||
startOffset: 22, | ||
endOffset: 50, | ||
tokenType: "STRING" | ||
} | ||
], | ||
SystemLiteral: [ | ||
{ | ||
image: '"task.dtd"', | ||
startOffset: 52, | ||
endOffset: 61, | ||
tokenType: "STRING" | ||
} | ||
] | ||
}, | ||
location: { startOffset: 15, endOffset: 61 } | ||
} | ||
], | ||
CLOSE: [ | ||
{ image: ">", startOffset: 62, endOffset: 62, tokenType: "CLOSE" } | ||
] | ||
}, | ||
location: { startOffset: 0, endOffset: 62 } | ||
} | ||
], | ||
misc: [ | ||
{ | ||
name: "misc", | ||
children: { | ||
SEA_WS: [ | ||
{ | ||
image: "\n", | ||
startOffset: 63, | ||
endOffset: 63, | ||
tokenType: "SEA_WS" | ||
} | ||
] | ||
}, | ||
location: { startOffset: 63, endOffset: 63 } | ||
}, | ||
{ | ||
name: "misc", | ||
children: { | ||
SEA_WS: [ | ||
{ | ||
image: "\n", | ||
startOffset: 77, | ||
endOffset: 77, | ||
tokenType: "SEA_WS" | ||
} | ||
] | ||
}, | ||
location: { startOffset: 77, endOffset: 77 } | ||
} | ||
], | ||
element: [ | ||
{ | ||
name: "element", | ||
children: { | ||
OPEN: [ | ||
{ image: "<", startOffset: 64, endOffset: 64, tokenType: "OPEN" } | ||
], | ||
Name: [ | ||
{ | ||
image: "note", | ||
startOffset: 65, | ||
endOffset: 68, | ||
tokenType: "Name" | ||
} | ||
], | ||
START_CLOSE: [ | ||
{ image: ">", startOffset: 69, endOffset: 69, tokenType: "CLOSE" } | ||
], | ||
content: [ | ||
{ | ||
name: "content", | ||
children: {}, | ||
location: { startOffset: null, endOffset: null } | ||
} | ||
], | ||
SLASH_OPEN: [ | ||
{ | ||
image: "</", | ||
startOffset: 70, | ||
endOffset: 71, | ||
tokenType: "SLASH_OPEN" | ||
} | ||
], | ||
END_NAME: [ | ||
{ | ||
image: "note", | ||
startOffset: 72, | ||
endOffset: 75, | ||
tokenType: "Name" | ||
} | ||
], | ||
END: [ | ||
{ image: ">", startOffset: 76, endOffset: 76, tokenType: "CLOSE" } | ||
] | ||
}, | ||
location: { startOffset: 64, endOffset: 76 } | ||
} | ||
] | ||
}, | ||
location: { startOffset: 0, endOffset: 77 } | ||
} | ||
}; |
7 changes: 7 additions & 0 deletions
7
packages/parser/test/snapshots/valid/doc-type-public/sample.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const { | ||
executeValidSampleTest, | ||
testNameFromDir | ||
} = require("../../../sample-test"); | ||
describe(`${testNameFromDir(__dirname)}`, () => { | ||
executeValidSampleTest(__dirname); | ||
}); |
2 changes: 2 additions & 0 deletions
2
packages/parser/test/snapshots/valid/doc-type-system/input.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!DOCTYPE greeting SYSTEM "hello.dtd"> | ||
<note></note> |
Oops, something went wrong.