Skip to content

Commit

Permalink
heredoc delimiters are counted as part of the string
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Oct 6, 2020
1 parent 9cbbce8 commit 4a7629b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 9 additions & 5 deletions src/languages/bash.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ export default function(hljs) {
};
const HERE_DOC = {
begin: /<<-?\s*(?=\w+)/,
starts: hljs.END_SAME_AS_BEGIN({
begin: /(\w+)/,
end: /(\w+)/,
className: 'string'
})
starts: {
contains: [
hljs.END_SAME_AS_BEGIN({
begin: /(\w+)/,
end: /(\w+)/,
className: 'string'
})
]
}
};
const QUOTE_STRING = {
className: 'string',
Expand Down
4 changes: 2 additions & 2 deletions test/markup/bash/strings.expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ SCRIPT_DIR=<span class="hljs-string">&quot;<span class="hljs-subst">$( cd <span
TLS_DIR=<span class="hljs-string">&quot;<span class="hljs-variable">$SCRIPT_DIR</span>/../src/main/resources/tls&quot;</span>
ROOT_DIR=<span class="hljs-string">&quot;<span class="hljs-variable">$SCRIPT_DIR</span>/..&quot;</span>

jshell -s - &lt;&lt; EOF<span class="hljs-string">
jshell -s - &lt;&lt; <span class="hljs-string">EOF
System.out.printf(&quot;Procs: %s%n&quot;, getdata())
</span>EOF
EOF</span>

jshell -s - &lt;&lt;&lt;<span class="hljs-string">&#x27;System.out.printf(&quot;Procs: %s%n&quot;, getdata())&#x27;</span>

Expand Down

0 comments on commit 4a7629b

Please sign in to comment.