Version: unspecified (using KDE 4.6.2) OS: Linux In a katepart syntax highlighting file, I would expect to have some rule capable of matching empty lines. If I try the following: <RegExpr String="^\s*$" attribute="common" context="#pop"/> it only matches a line containing at least one space. I can't see any other rule which will match empty lines. Could this be fixed such that the above matches an empty line, please? P.S. this is also mentioned in #243740. Reproducible: Always
Asciidoc, which allows users to create text files without complex formatting characters and then post-process them into many different formats (html, pdf, docbook), depends on blank lines to separate blocks and terminate formatting. I've written an xml Kate highlighting file for asciidoc, but ran into this restriction. I would like to see some sort of notification of blank lines. Reference: http://www.methods.co.nz/asciidoc/userguide.html
Additional Information. A blank line is a transition to a different context. Simple Kate highlighting file: <language name="RTest" section="Other" > <highlighting> <contexts> <context attribute="NormalStyle" lineEndContext="#stay" name="_NormalText"> <RegExpr attribute="tstGreen" context="_Paragraph" String="^START" /> </context> <context attribute="tstBlue" lineEndContext="#stay" name="_Paragraph"> <RegExpr attribute="NormalStyle" context="#pop" String="^$" /> </contexts> <itemDatas> <itemData name="NormalStyle" defStyleNum="dsNormal" /> <itemData name="tstGreen" defStyleNum="dsNormal" color="#00A800" /> <itemData name="tstBlue" defStyleNum="dsNormal" color="#0000FF" /> </itemDatas> </highlighting> </language> Data example to go along with the above: This is the first line of the file. Look for START in column one. START This is a 1-line paragraph before a blank line. This is a 2-line paragraph after a blank line. Other formatting will occur within a paragraph. This is a new paragraph. This is a line within the same paragraph but indented after the first line. This is a literal paragraph because it does not start in column 1. Each paragraph should start a new context. START Try again. // <!-- kate: syntax RTest; space-indent on; indent-width 2; --> Hope this helps. Thank you.
I have a similar problem with the regex search&replace function in Kate. It has been bothering since KDE4 came out. cf http://forum.kde.org/viewtopic.php?f=15&t=91394 My current workaround is using "\n\n" to match "^$" (not exactly the same, but works for replacing) or use vim...
1. to search and replace: Just tried: search "^$" replace "MUH", works 2. for highlighting: true, empty lines are just skipped by the highlighting engine as all rules need at least one char to match (and no, end of line isn't counting). This can't be changed without regression many highlights, therefore you can now specify for each context an optional lineEmptyContext="..." where you tell to which context should be switched if a line with no content is found. Git commit 48cd0f3fec6dcd8a3a59fb4125fd6cdf759d7acc by Christoph Cullmann. Committed on 07/11/2012 at 23:50. Pushed by cullmann into branch 'master'. add lineEmptyContext to allow to specify what should happen if an empty line occurs M +2 -0 doc/kate/highlighting.docbook M +5 -0 kate/plugins/xmltools/language.dtd.xml M +2 -0 part/syntax/data/language.dtd M +148 -139 part/syntax/katehighlight.cpp M +7 -2 part/syntax/katehighlighthelpers.cpp M +6 -1 part/syntax/katehighlighthelpers.h http://commits.kde.org/kate/48cd0f3fec6dcd8a3a59fb4125fd6cdf759d7acc
(In reply to comment #1) > Asciidoc, which allows users to create text files without complex formatting > characters and then post-process them into many different formats (html, > pdf, docbook), depends on blank lines to separate blocks and terminate > formatting. > > I've written an xml Kate highlighting file for asciidoc, but ran into this > restriction. Is your AsciiDoc highlighting file for Kate available to others (such as me)? Thanks