summaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-22 21:32:21 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-22 21:32:21 -0800
commita71423f6ee1b77d9f79d42599ea00b4ca99f5da0 (patch)
treeb6007b211ffbedf996a7416dbbc26f6d33006913 /js/lib
parentacac9428faa1c3193fb44b3fb0e2dd3cbdaa4ac9 (diff)
Remove distinction btw atx and setext header in AST.
Now we just have 'header' -- Setext and ATX are just two ways of forming these; it's not a semantic difference that should remain in the AST.
Diffstat (limited to 'js/lib')
-rw-r--r--js/lib/blocks.js20
-rw-r--r--js/lib/html-renderer.js3
2 files changed, 9 insertions, 14 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js
index 65c2c46..cd42090 100644
--- a/js/lib/blocks.js
+++ b/js/lib/blocks.js
@@ -261,8 +261,7 @@ var incorporateLine = function(ln, line_number) {
}
break;
- case 'ATXHeader':
- case 'SetextHeader':
+ case 'Header':
case 'HorizontalRule':
// a header can never container > 1 line, so fail to match:
all_matched = false;
@@ -366,7 +365,7 @@ var incorporateLine = function(ln, line_number) {
// ATX header
offset = first_nonspace + match[0].length;
closeUnmatchedBlocks(this);
- container = this.addChild('ATXHeader', line_number, first_nonspace);
+ container = this.addChild('Header', line_number, first_nonspace);
container.level = match[0].trim().length; // number of #s
// remove trailing ###s:
container.strings =
@@ -396,7 +395,7 @@ var incorporateLine = function(ln, line_number) {
((match = ln.slice(first_nonspace).match(/^(?:=+|-+) *$/)))) {
// setext header line
closeUnmatchedBlocks(this);
- container.t = 'SetextHeader'; // convert Paragraph to SetextHeader
+ container.t = 'Header'; // convert Paragraph to SetextHeader
container.level = match[0][0] === '=' ? 1 : 2;
offset = ln.length;
@@ -469,7 +468,7 @@ var incorporateLine = function(ln, line_number) {
// on an empty list item.
container.last_line_blank = blank &&
!(container.t == 'BlockQuote' ||
- container.t == 'SetextHeader' ||
+ container.t == 'Header' ||
container.t == 'FencedCode' ||
(container.t == 'ListItem' &&
container.children.length === 0 &&
@@ -500,8 +499,7 @@ var incorporateLine = function(ln, line_number) {
}
break;
- case 'ATXHeader':
- case 'SetextHeader':
+ case 'Header':
case 'HorizontalRule':
// nothing to do; we already added the contents.
break;
@@ -512,7 +510,7 @@ var incorporateLine = function(ln, line_number) {
} else if (blank) {
// do nothing
} else if (container.t != 'HorizontalRule' &&
- container.t != 'SetextHeader') {
+ container.t != 'Header') {
// create paragraph container for line
container = this.addChild('Paragraph', line_number, first_nonspace);
this.addLine(ln, first_nonspace);
@@ -561,8 +559,7 @@ var finalize = function(block, line_number) {
}
break;
- case 'ATXHeader':
- case 'SetextHeader':
+ case 'Header':
case 'HtmlBlock':
block.string_content = block.strings.join('\n');
break;
@@ -632,8 +629,7 @@ var processInlines = function(block) {
newblock.inline_content =
this.inlineParser.parse(block.string_content.trim(), this.refmap);
break;
- case 'SetextHeader':
- case 'ATXHeader':
+ case 'Header':
newblock.inline_content =
this.inlineParser.parse(block.string_content.trim(), this.refmap);
newblock.level = block.level;
diff --git a/js/lib/html-renderer.js b/js/lib/html-renderer.js
index e55b103..faf5231 100644
--- a/js/lib/html-renderer.js
+++ b/js/lib/html-renderer.js
@@ -103,8 +103,7 @@ var renderBlock = function(block, in_tight_list) {
return inTags(tag, attr, this.innersep +
this.renderBlocks(block.children, block.tight) +
this.innersep);
- case 'ATXHeader':
- case 'SetextHeader':
+ case 'Header':
tag = 'h' + block.level;
return inTags(tag, [], this.renderInlines(block.inline_content));
case 'IndentedCode':