summaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-23 06:54:53 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-23 06:54:53 -0800
commit8ba087276c6cae9e1efde656ae973b4f714c88be (patch)
treebf90502882077bb8c7ea8bc041843c88c92a6526 /js/lib
parentd929a2983db96be22277c2052ea61cd8ec7ac6f1 (diff)
Revert "Revert "Remove distinction btw atx and setext header in AST.""
This reverts commit 4570eb2bff2e1b71fa5b6408abbc69c98ff5ff24.
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':