Actions
Defect #20758
closedAmpersand+keyword in code highlighting
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Text formatting
Target version:
-
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
I came to incorrect behavior of code highlighting in wiki-like pages if keyword begins with an ampersand.
I create a new scanner for coderay for language, which contains a directive for example "&AtServer".
And then parse the string with scan_tokens procedure:
def scan_tokens encoder, options
state = :initial
until eos?
case state
when :initial
if match = scan(%r! & [[:alpha:]]+ !mx)
encoder.text_token match, :directive
else
encoder.text_token getch, :error
end
else
raise_inspect 'Unknown state', encoder
end
end
if state == :string
encoder.end_group :string
end
encoder
end
And then the strange behavior starts. Testing my scanner gives correct result (&AtServer is hightlighted as :directive) but in Redmine wiki the keyword
<pre><code class="my_lang"> &AtServer </code>
is not highlighted. However if I type ';'
<pre><code class="my_lang"> &AtServer; </code>
the directive becomes highlighted.
Files
Related issues
Actions