GNOME Bugzilla – Bug 781893
Improve LaTeX highlighting for \url and \href
Last modified: 2017-06-16 09:38:55 UTC
Created attachment 350628 [details] [review] Patch which adds \url and \href highlighting - URLs, displayed with \url and \href commands, which contain dollars signs, break the syntax highlighting. - URLs won't be highlighted like the markdown syntax does
Comment on attachment 350628 [details] [review] Patch which adds \url and \href highlighting The patch needs to be created with the "git format-patch" command.
Created attachment 350805 [details] [review] Patch which adds \url and \href highlighting
I created a new attachment formatted with git format-patch.
Review of attachment 350805 [details] [review]: I think the regexes are good, after a quick look. For the commit message, the title should start with "latex.lang: ", otherwise it's difficult to know what the commit is about. And at the end of the commit message there should be the URL to the bugzilla ticket. Some more comments below. ::: data/language-specs/latex.lang @@ +47,3 @@ <style id="paragraph" _name="Paragraph Heading" map-to="def:heading5"/> <style id="subparagraph" _name="SubParagraph Heading" map-to="def:heading6"/> + <style id="url" _name="URL" map-to="def:underlined"/> I think it's better to not apply any style to the URL. Some text editors can underline the URL when the mouse is hover it, to do a right click -> open link. If the URL is constantly underlined, IMHO it would get in the way. @@ +111,3 @@ + Examples: \url{http://google.de}, \href{http://google.de}{Google} + + Supports also urls with math symbols: \url{https://zoidberg.ukp.informatik.tu-darmstadt.de/jenkins/job/DKPro\%20Core\%20Documentation\%20(GitHub)/de.tudarmstadt.ukp.dkpro.core$de.tudarmstadt.ukp.dkpro.core.doc-asl/doclinks/1/user-guide.html} The last URL is a bit long, you should place it on a new line, or shorten the URL (giving an abstract example).
OK, I will add prefix and ticket number to the commit message. Regarding the style I have a question. I looked at the markdown language spec and in this file they do the same thing for URL. Is this also wrong?
(In reply to info from comment #5) > Regarding the style I have a question. I looked at the markdown language > spec and in this file they do the same thing for URL. Is this also wrong? Mmh, yes it's maybe wrong. As I said I would prefer to underline the URL only on mouse hover, but currently GtkSourceView or gedit doesn't do that. Anyway for LaTeX I think it's better to not apply any style to the URL. When reading the text it's easy to recognize an URL.
Created attachment 352016 [details] [review] Patch which improves \url and \href highlighting
Review of attachment 352016 [details] [review]: The title in the commit message should not exceed 72 characters. The URL to the bugzilla should be the last line of the commit message. There are trailing spaces on some lines. git normally shows them in red when showing the diff. Please avoid trailing spaces. ::: data/language-specs/latex.lang @@ +130,3 @@ + + <include> + <context sub-pattern="1" class="no-spell-check" style-ref="command"/> The no-spell-check class should be applied to the whole context, the URL included.
Created attachment 353679 [details] [review] Patch which improves \url and \href highlighting
Created attachment 353690 [details] [review] Patch which improves \url and \href highlighting
Review of attachment 353690 [details] [review]: Thanks, the regexes are well explained and the no-spell-check class is well applied.
Pushed on master: commit d4f39a1315d9ee6f009d1f6fbdc0ee8b7818d627 And cherry-picked on gnome-3-24.