Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Guillaume Grossetie
AsciiDoc Language
Commits
d0d286b4
Commit
d0d286b4
authored
Jul 13, 2021
by
Guillaume Grossetie
🎧
Browse files
Add examples
parent
a40c3f6e
Changes
7
Hide whitespace changes
Inline
Side-by-side
spec/abstract-semantic-graph/examples/attr.adoc
0 → 100644
View file @
d0d286b4
[key=value]
== Section
:key: value
[key=value]
This is {key}.
spec/abstract-semantic-graph/examples/attr.asg.json
0 → 100644
View file @
d0d286b4
{
"sections"
:
[
{
"type"
:
"Section"
,
"level"
:
"1"
,
"title"
:
"Section Title"
,
"attributes"
:
{
"key"
:
"value"
},
"children"
:
[
{
"type"
:
"Paragraph"
,
"attributes"
:
{
"key"
:
"value"
},
"children"
:
[
{
"type"
:
"Str"
,
"value"
:
"This is value."
}
]
}
]
}
]
}
spec/abstract-semantic-graph/examples/doc.adoc
0 → 100644
View file @
d0d286b4
= Document Title
Guillaume Grossetie
:key: value
This is {key}.
spec/abstract-semantic-graph/examples/doc.asg.json
0 → 100644
View file @
d0d286b4
{
"header"
:
{
"title"
:
"Document Title"
,
"authors"
:
[
{
"name"
:
"Guillaume Grossetie"
}
],
"attributes"
:
{
"key"
:
"value"
}
},
"sections"
:
[
{
"type"
:
"Paragraph"
,
"children"
:
[
{
"type"
:
"Str"
,
"value"
:
"This is value."
}
]
}
]
}
spec/abstract-semantic-graph/examples/paragraphs.adoc
0 → 100644
View file @
d0d286b4
blk1
blk2
spec/abstract-semantic-graph/examples/paragraphs.asg.json
0 → 100644
View file @
d0d286b4
{
"sections"
:
[
{
"type"
:
"Paragraph"
,
"children"
:
[
{
"type"
:
"Str"
,
"value"
:
"blk1"
}
]
},
{
"type"
:
"Paragraph"
,
"children"
:
[
{
"type"
:
"Str"
,
"value"
:
"blk1"
}
]
}
]
}
spec/abstract-semantic-graph/index.d.ts
View file @
d0d286b4
...
...
@@ -2,19 +2,25 @@ export namespace AsciiDoc {
interface
Attributes
{
[
key
:
string
]:
string
}
interface
AttributeEntries
{
[
key
:
string
]:
string
}
}
export
namespace
AsciiDocAbstractSemanticGraph
{
interface
Document
{
header
?:
Header
;
body
:
Body
;
preamble
?:
Node
;
sections
:
Node
[];
// QUESTION: should we use "body" instead of "sections" (the reasoning is that some Documents don't have Section block).
}
interface
Header
extends
Node
{
interface
Header
{
title
:
string
;
authors
?:
Author
[];
revision
:
Revision
;
// QUESTION: should we use a different name to disambiguate block attributes and document attributes (i.e., entries)?
attributes
?:
AsciiDoc
.
AttributeEntries
;
}
interface
Author
{
...
...
@@ -30,38 +36,25 @@ export namespace AsciiDocAbstractSemanticGraph {
date
:
string
;
}
type
Body
=
Node
[];
interface
Node
{
type
:
NodeType
;
// QUESTION: should we always include raw, range and loc?
raw
:
string
;
range
:
NodeRange
;
loc
:
NodeLineLocation
;
attributes
?:
AsciiDoc
.
Attributes
;
children
?:
Node
[]
}
type
NodeType
=
'
Preamble
'
|
'
Paragraph
'
|
'
Section
'
|
'
Verse
'
|
'
STEM
'
|
'
Sidebar
'
|
'
Quote
'
|
'
Open
'
|
'
Example
'
|
'
Listing
'
|
'
Literal
'
|
'
Admonition
'
|
'
Image
'
|
'
Video
'
|
'
Audio
'
|
'
Pass
'
//
A
ttributes are already resolved in an Abstract Semantic Graph
//
QUESTION: a
ttributes are already resolved in an Abstract Semantic Graph
?
//| 'AttributeReference' | 'AttributeDefinition'
|
'
Strong
'
|
'
Emphasis
'
|
'
Monospace
'
|
'
Subscript
'
|
'
Superscript
'
|
'
SingleQuotation
'
|
'
DoubleQuotation
'
|
'
Str
'
|
'
Anchor
'
|
'
OrderedList
'
|
'
UnorderedList
'
|
'
DescriptionList
'
|
'
InlineImage
'
|
'
InlineBreak
'
|
'
InlineButton
'
|
'
InlineMenu
'
|
'
InlineMacro
'
|
'
Table
'
;
}
/**
* Syntax tree.
*/
export
namespace
AsciiDocSyntaxTree
{
interface
Node
{
type
:
string
;
raw
:
string
;
range
:
NodeRange
;
loc
:
NodeLineLocation
;
attributes
?:
AsciiDoc
.
Attributes
;
children
?:
Node
[]
}
// 0-based index
type
NodeRange
=
[
number
,
number
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment