Skip to content

Commit

Permalink
Adding parsing of old style headings. Updating the parser to be stric…
Browse files Browse the repository at this point in the history
…ter on block delimiters.
  • Loading branch information
ahus1 committed Nov 29, 2016
1 parent 73249b9 commit 22e0e66
Show file tree
Hide file tree
Showing 9 changed files with 556 additions and 204 deletions.
3 changes: 2 additions & 1 deletion META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin version="2" url="https://github.com/asciidoctor/asciidoctor-intellij-plugin">
<id>org.asciidoctor.intellij.asciidoc</id>
<name>AsciiDoc</name>
<version>0.16.4</version>
<version>0.17.0</version>
<vendor email="[email protected]" url="http://asciidoctor.org">Asciidoctor Project</vendor>

<description><![CDATA[
Expand All @@ -18,6 +18,7 @@

<change-notes><![CDATA[
<ul>
<li>0.17.0 Updated block parsing to support two styles of headings. Block starts and ends are need to be aligned in length and shape when parsed.</li>
<li>0.16.4 Improved darcula support for JavaFX. More block types are using proper dark background and light text colors.</li>
<li>0.16.3 Theme in preview can be switched from light to darcula independent of IDE theme</li>
<li>0.16.2 Handling of Linux and MacOS file names for image preview in JavaFX</li>
Expand Down
5 changes: 5 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ See https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting

== Release notes

=== 0.17.0 (preview, available from Github releases)

Updated block parsing to support two styles of headings.
Block starts and ends are need to be aligned in length and shape when parsed.

=== 0.16.4

Improved darcula support for JavaFX. More block types are using proper dark background and light text colors.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ public class AsciiDocHighlighter extends SyntaxHighlighterBase {
ImmutableMap.<IElementType, TextAttributesKey>builder()
.put(AsciiDocTokenTypes.LINE_COMMENT, ASCIIDOC_COMMENT)
.put(AsciiDocTokenTypes.BLOCK_COMMENT, ASCIIDOC_COMMENT)
.put(AsciiDocTokenTypes.COMMENT_BLOCK_DELIMITER, ASCIIDOC_COMMENT)
.put(AsciiDocTokenTypes.LISTING_TEXT, ASCIIDOC_LISTING_TEXT)
.put(AsciiDocTokenTypes.QUOTE_BLOCK, ASCIIDOC_LISTING_TEXT)
.put(AsciiDocTokenTypes.EXAMPLE_BLOCK, ASCIIDOC_LISTING_TEXT)
.put(AsciiDocTokenTypes.SIDEBAR_BLOCK, ASCIIDOC_LISTING_TEXT)
.put(AsciiDocTokenTypes.HEADING, ASCIIDOC_HEADING)
.put(AsciiDocTokenTypes.HEADING_OLDSTYLE, ASCIIDOC_HEADING)
.build();

@NotNull
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/org/asciidoc/intellij/lexer/AsciiDocTokenTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,29 @@ public interface AsciiDocTokenTypes {
IElementType LINE_BREAK = new AsciiDocElementType("LINE_BREAK");
IElementType LINE_COMMENT = new AsciiDocElementType("LINE_COMMENT");
IElementType BLOCK_COMMENT = new AsciiDocElementType("BLOCK_COMMENT");
IElementType LISTING_DELIMITER = new AsciiDocElementType("LISTING_DELIMITER");
IElementType PASSTRHOUGH_BLOCK_DELIMITER = new AsciiDocElementType("PASSTRHOUGH_BLOCK_DELIMITER");
IElementType PASSTRHOUGH_BLOCK = new AsciiDocElementType("PASSTRHOUGH_BLOCK");
IElementType QUOTE_BLOCK_DELIMITER = new AsciiDocElementType("QUOTE_BLOCK_DELIMITER");
IElementType QUOTE_BLOCK = new AsciiDocElementType("QUOTE_BLOCK");
IElementType LISTING_BLOCK_DELIMITER = new AsciiDocElementType("LISTING_BLOCK_DELIMITER");
IElementType COMMENT_BLOCK_DELIMITER = new AsciiDocElementType("COMMENT_BLOCK_DELIMITER");
IElementType LISTING_TEXT = new AsciiDocElementType("LISTING_TEXT");
IElementType HEADING = new AsciiDocElementType("HEADING");
IElementType HEADING_OLDSTYLE = new AsciiDocElementType("HEADING_OLDSTYLE");
IElementType TITLE = new AsciiDocElementType("TITLE");
IElementType BLOCK_MACRO_ID = new AsciiDocElementType("BLOCK_MACRO_ID");
IElementType BLOCK_MACRO_BODY = new AsciiDocElementType("BLOCK_MACRO_BODY");
IElementType BLOCK_MACRO_ATTRIBUTES = new AsciiDocElementType("BLOCK_MACRO_ATTRIBUTES");
IElementType EXAMPLE_BLOCK_DELIMITER = new AsciiDocElementType("EXAMPLE_BLOCK_DELIMITER");
IElementType EXAMPLE_BLOCK = new AsciiDocElementType("EXAMPLE_BLOCK");
IElementType SIDEBAR_BLOCK_DELIMITER = new AsciiDocElementType("SIDEBAR_BLOCK_DELIMITER");
IElementType SIDEBAR_BLOCK = new AsciiDocElementType("SIDEBAR_BLOCK");
IElementType BLOCK_ATTRS_START = new AsciiDocElementType("BLOCK_ATTRS_START");
IElementType BLOCK_ATTR_NAME = new AsciiDocElementType("BLOCK_ATTR_NAME");
IElementType BLOCK_ATTRS_END = new AsciiDocElementType("BLOCK_ATTRS_END");

TokenSet TOKENS_TO_MERGE = TokenSet.create(TEXT, LISTING_TEXT, HEADING, TITLE, BLOCK_COMMENT,
BLOCK_ATTR_NAME, BLOCK_MACRO_BODY, BLOCK_MACRO_ATTRIBUTES);
BLOCK_ATTR_NAME, BLOCK_MACRO_BODY, BLOCK_MACRO_ATTRIBUTES, EXAMPLE_BLOCK, PASSTRHOUGH_BLOCK,
QUOTE_BLOCK, SIDEBAR_BLOCK);
}

Loading

0 comments on commit 22e0e66

Please sign in to comment.