I often see spec files with bad syntax highlighting due to an apostrophe in the description. (example) The highlighter seems to interpret the ' as the beginning of a string and doesn't stop looking for the end, which more often than not goes on to until the end of the file.
'
I tried escaping as \' without success.
\'
Can we fix that? Code pointers or reference to the highlighting library welcome.
The syntax highlighting library is highlight.js. That's probably where to start.
highlight.js
Metadata Update from @ngompa: - Issue tagged with: JS, UI, bug
The spec language definition has it's own repo: Github - highlightjs-rpm-specfile/rpm-specfile.js
I guess that's what pagure is using. I'll see if I can fix it there.
I think we can just remove single quote highlighting, would anyone miss it? At least my spec looks much better without it.
Is there a standard for spec files where I could check if it needs single quotes I'm not aware of? Alternatively I could grep the "Fedora all specs" archive for single quote usage. I know that is a thing but unfortunately never find the link when I need it.
PR: https://github.com/highlightjs/highlightjs-rpm-specfile/pull/3
Thanks for merging that upstream! The pagure repo contains a built version of highlightjs-rpm-specfile: pagure/static/vendor/highlight.js/spec.js
I don't have the tools and knowledge at hand to properly rebuild that but I can file a PR removing hljs.ASM, which I'm 99.9% sure is the shorthand for hljs.APOS_STRING_MODE, and should apply the fix in pagure. Should I do that or can someone easily rebuild that file pulling in the fix?
hljs.ASM,
hljs.APOS_STRING_MODE,
Send a patch to sync the fix, you've got the right idea on how to fix it.
By "Send a patch" do you mean a PR? If you actually mean a patch, where should I send it to? PR is here: https://pagure.io/pagure/pull-request/5115
Commit fdef4129 fixes this issue