Skip to content

Commit

Permalink
Add injection grammars for fenced markdown blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Gama11 committed May 10, 2018
1 parent 3a561ec commit ea49e70
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 1 deletion.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions helper/haxe-markdown.YAML-tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
injectionSelector: L:markup.fenced_code.block.markdown
patterns:
- include: '#haxe-code-block'
repository:
haxe-code-block:
begin: haxe(\s+[^`~]*)?$
end: (^|\G)(?=\s*[`~]{3,}\s*$)
patterns:
- begin: (^|\G)(\s*)(.*)
while: (^|\G)(?!\s*([`~]{3,})\s*$)
contentName: meta.embedded.block.haxe
patterns:
- include: source.hx
scopeName: markdown.haxe.codeblock
1 change: 1 addition & 0 deletions helper/haxe-markdown.tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist><dict><key>injectionSelector</key><string>L:markup.fenced_code.block.markdown</string><key>scopeName</key><string>markdown.haxe.codeblock</string><key>repository</key><dict><key>haxe-code-block</key><dict><key>end</key><string>(^|\G)(?=\s*[`~]{3,}\s*$)</string><key>begin</key><string>haxe(\s+[^`~]*)?$</string><key>patterns</key><array><dict><key>while</key><string>(^|\G)(?!\s*([`~]{3,})\s*$)</string><key>contentName</key><string>meta.embedded.block.haxe</string><key>begin</key><string>(^|\G)(\s*)(.*)</string><key>patterns</key><array><dict><key>include</key><string>source.hx</string></dict></array></dict></array></dict></dict><key>patterns</key><array><dict><key>include</key><string>#haxe-code-block</string></dict></array></dict></plist>
14 changes: 14 additions & 0 deletions helper/hxml-markdown.YAML-tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
injectionSelector: L:markup.fenced_code.block.markdown
patterns:
- include: '#hxml-code-block'
repository:
hxml-code-block:
begin: hxml(\s+[^`~]*)?$
end: (^|\G)(?=\s*[`~]{3,}\s*$)
patterns:
- begin: (^|\G)(\s*)(.*)
while: (^|\G)(?!\s*([`~]{3,})\s*$)
contentName: meta.embedded.block.hxml
patterns:
- include: source.hxml
scopeName: markdown.hxml.codeblock
1 change: 1 addition & 0 deletions helper/hxml-markdown.tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist><dict><key>injectionSelector</key><string>L:markup.fenced_code.block.markdown</string><key>scopeName</key><string>markdown.hxml.codeblock</string><key>repository</key><dict><key>hxml-code-block</key><dict><key>end</key><string>(^|\G)(?=\s*[`~]{3,}\s*$)</string><key>begin</key><string>hxml(\s+[^`~]*)?$</string><key>patterns</key><array><dict><key>while</key><string>(^|\G)(?!\s*([`~]{3,})\s*$)</string><key>contentName</key><string>meta.embedded.block.hxml</string><key>begin</key><string>(^|\G)(\s*)(.*)</string><key>patterns</key><array><dict><key>include</key><string>source.hxml</string></dict></array></dict></array></dict></dict><key>patterns</key><array><dict><key>include</key><string>#hxml-code-block</string></dict></array></dict></plist>
7 changes: 6 additions & 1 deletion src/Converter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import sys.io.File;
class Converter {
static function main() {
Sys.print("Converting syntax files to plist...");

convert("haxe.YAML-tmLanguage", "haxe.tmLanguage");
convert("haxe-hover.YAML-tmLanguage", "haxe-hover.tmLanguage");
convert("hxml.YAML-tmLanguage", "hxml.tmLanguage");

convert("helper/haxe-hover.YAML-tmLanguage", "helper/haxe-hover.tmLanguage");
convert("helper/haxe-markdown.YAML-tmLanguage", "helper/haxe-markdown.tmLanguage");
convert("helper/hxml-markdown.YAML-tmLanguage", "helper/hxml-markdown.tmLanguage");

Sys.println(" Done.\n ");
}

Expand Down

0 comments on commit ea49e70

Please sign in to comment.