Commit d0d286b4 authored by Guillaume Grossetie's avatar Guillaume Grossetie 🎧
Browse files

Add examples

parent a40c3f6e
[key=value]
== Section
:key: value
[key=value]
This is {key}.
{
"sections": [
{
"type": "Section",
"level": "1",
"title": "Section Title",
"attributes": {
"key": "value"
},
"children": [
{
"type": "Paragraph",
"attributes": {
"key": "value"
},
"children": [
{
"type": "Str",
"value": "This is value."
}
]
}
]
}
]
}
= Document Title
Guillaume Grossetie
:key: value
This is {key}.
{
"header": {
"title": "Document Title",
"authors": [
{
"name": "Guillaume Grossetie"
}
],
"attributes": {
"key": "value"
}
},
"sections": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"value": "This is value."
}
]
}
]
}
{
"sections": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"value": "blk1"
}
]
},
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"value": "blk1"
}
]
}
]
}
......@@ -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'
// Attributes are already resolved in an Abstract Semantic Graph
// QUESTION: attributes 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];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment