Skip to content

Commit

Permalink
Merge pull request #2 from vladdancer/master
Browse files Browse the repository at this point in the history
fix: CI issues
  • Loading branch information
elringus authored Aug 4, 2020
2 parents 86df911 + 0459f1d commit 83ded98
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 48 deletions.
22 changes: 6 additions & 16 deletions components/prism-naniscript.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var horSpace = /[\t ]{1}/;
var expressionDef = function (isMultiline) {
if (isMultiline === void 0) { isMultiline = true; }
return isMultiline
Expand All @@ -19,13 +18,9 @@ Prism.languages.naniscript = {
alias: 'tag',
inside: {
value: {
pattern: /(^>[a-zA-Z0-9_]+)[\t ]{1}[^{}\r\n]+/,
pattern: /(^>[a-zA-Z0-9_]+)[\t ]+[^{}\r\n]+/,
alias: 'operator',
lookbehind: true,
inside: {
_hor_space: /^[\t ]{1}/,
_template: /.*/,
}
},
key: {
pattern: /(^>)[a-zA-Z0-9_]+/,
Expand All @@ -35,13 +30,9 @@ Prism.languages.naniscript = {
},
// # ...
'label': {
pattern: /^[\t ]*[#]{1}[\t ]*[a-zA-Z0-9]+[\t ]?$/m,
lookbehind: true,
pattern: /^([\t ]*)[#]{1}[\t ]*[a-zA-Z0-9]+[\t ]?$/m,
alias: 'regex',
inside: {
_hor_space: horSpace,
value: /[^# ]+/,
}
lookbehind: true
},
// Generic is any line that doesn't start with operators: ;>#@
'generic-text': {
Expand Down Expand Up @@ -88,7 +79,7 @@ Prism.languages.naniscript = {
lookbehind: true
},
{
pattern: /.*/,
pattern: /.+/,
alias: 'operator',
}
]
Expand Down Expand Up @@ -132,11 +123,10 @@ Prism.languages.naniscript = {
lookbehind: true
},
{
pattern: /.*/,
pattern: /.+/,
alias: 'operator',
}
],
_hor_space: horSpace
]
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-naniscript.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions examples/prism-naniscript.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ <h2>Comments</h2>
</code></pre>

<h2>Define</h2>
<pre><code>>DefineKey define 12 super usefull lines</code></pre>
<pre><code>
&gt;DefineKey define 12 super usefull lines
</code></pre>

<h2>Label</h2>
<pre><code># Section
Expand Down Expand Up @@ -64,7 +66,7 @@ <h2>Expressions</h2>
Expressions inside a generic text line: Loreim ipsu,{ Abs(a, d) + 12 - 1 / -230.0 + "Lol ipsum" } doler sit amen {¯\_(ツ)_/¯}.
@ExpressionInsteadOfNamelessParameterValue {x > 0}
@ExpressionBlendedWithNamelessParameterValue sdf{x > 0}df
@ExpressionsInsideNamedParameterValueWrappedInQuotes text:"{a} < {b}"
@ExpressionsInsideNamedParameterValueWrappedInQuotes text:"{a} &lt; {b}"
@ExpressionsBlendedWithNamedParameterValue param:32r2f,df{x > 0},d.{Abs(0) + 12.24 > 0}ff
@ExpressionsInsteadOfNamelessParameterAndQuotedParameter {remark} if:remark=="Saying \\"Stop { "the" } car\\" was a mistake."

Expand Down
9 changes: 2 additions & 7 deletions tests/languages/naniscript/define_feature.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
>
>DefineKey define _ + 3h f[29 j] value *
>DefineKey define _ + 3h f[29 j] value *

----------------------------------------------------

Expand All @@ -9,12 +9,7 @@
[
">",
["key", "DefineKey"],
["value",
[
["_hor_space", " "],
["_template", "define _ + 3h f[29 j] value *"]
]
]
["value", " \tdefine _ + 3h f[29 j] value *"]
]
]
]
Expand Down
26 changes: 4 additions & 22 deletions tests/languages/naniscript/label_feature.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,10 @@

[
"#\r\n",
["label", [
"#",
["_hor_space", " "],
["value", "Section1"]
]],
["label", [
"#",
["value", "Section2"],
["_hor_space", " "]
]],
["label", [
"#",
["_hor_space", " "],
["value", "Section4"]
]],
["label", [
"#",
["_hor_space", "\t"],
["_hor_space", "\t"],
["_hor_space", "\t"],
["value", "SectionWithMultipleTabsBefore"]
]],
["label", "# Section1"],
["label", "#Section2 "],
["label", "# Section4"],
["label", "#\t\t\tSectionWithMultipleTabsBefore"],
"\r\n## Section3\r\n# Section with multiple words\r\n\t# Section with \r\n\t# Section with tab"
]

Expand Down

0 comments on commit 83ded98

Please sign in to comment.