leading whitespace lost in SubversionPlus code display

Aaron Mackey September 11, 2013

The bundled SVN web client isn't doing code highlighting, and all leading whitespace is lost, both in file display and diff viewing modes. I tried changing the character encoding, but that wasn't the issue; I suspect perhaps something to do with the code highlighter (GeSHi?) perhaps not recognizing my .R source code?

3 answers

1 accepted

0 votes
Answer accepted
Aaron Mackey September 16, 2013

the update to 4.0.4 seems to have fixed the whitespace issue, thanks again!

and yes, R highlighting is OK now but not great -- GeSHi's "rsplus" is better.

0 votes
Aaron Mackey September 15, 2013

Updated SubversionPlus to 4.0.2 -- I can now see a smidge of R syntax highlighting, but leading whitespace (indentation) is still lost. My JIRA is v6.0.4 if it's any help.

Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 15, 2013

leading whitespace (indentation) is still lost.

Likely, the R editor uses some non expected character for the identation. Might you send me an R file? Or try to identify what would be the special charater used for identation? (Should not be '\t')


I can now see a smidge of R syntax highlighting,

The prettify library automatically tries to identify the language (taken the C language the highest preference). If the identification fails, then it applies a sort of generic highlighting, which might result in a mess of key words colorizing. To avoid this, it supports an option to set the language for highlight the file conent, but I coded it in a very basic way based on the file extension:

What is the extension of your R files?. I forced to the Google's code prettify library to use the R syntax when the file extension is ".r" and not ".R". Hence, if your extensions is uppercase (.R) then the prettify library would apply a sillier parser algorithm.

Aaron Mackey September 15, 2013

I also confirmed using Chrome's inspect element feature that the rendered HTML does not itself have any whitespace; while if I use a different WebSVN client to browse the repository, all the whitespace is there.

Thanks again for your help demystifying things!

Aaron Mackey September 15, 2013

Here's a screenshot showing the ongoing problem with a simple .c file (note the lack of whitespace before the return statement):

Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2013

I think the problem is that I replaced '\t' tabs by ' ' (four times) but I left unchanged the ' ' space characters. Hence, I've also replaced all those spaces used to indent ' ' by ' '

Regarding the R files, I've directly set the file extension as lang option for the prettify library to force it to use the right extensions rather than let it to figure out this. Thus the .R and .r extensions should work in the same way.

Maybe this might solve some of your issues in the 4.0.3 version. Please, try it and let me know how it works for you. (I'm very sceptic regarding the R syntax highlighting)

Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2013

It might also occur that there are some bugs (or a poor impletantion) of the R extension for the prettify library. While other languages were highlighted more or less in a coherent way, I got a mess of colorizing for R in all the cases.

Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 16, 2013

R highlighting is OK now but not great

For sure, I dislike the result of the prettify library for any languages. Even the old jhighlight tool was much better, though for fewer languages.

On the other hand, the integration of the prettify library is quite straighforward, specially for the way how the Polarion Web Client for Subversion handles the file content which is never send back to the client browser as raw content. This made very complex integrating other alternatives like the syntaxhighlighter from Mr. Alex Gorbatchev, which never worked well during the tests.

However, I think the major problem might be partially resolved by changing the css style to something clearer/nicer, using bold and colorizing similar to Eclipse, for instance. The default highlighting is almost impossible to distinguish in my laptop in addition to ugly. But the main work is done.

0 votes
Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 11, 2013

The bundled Polarion web client uses a Java project named jhighlight in order to parse and decorate (CSS) the source files at the server side.

I've looked at the highlighter process and I've found it supports very few languges becasue the jhighliht project provides very few parser implementations:

Basically, there are four parsers: XML, Java, Cpp and Groovy. The latest is never used. And the other three are applied according the file extension:

extensions -> parser

=============

.java -> Java

.html, .xml, .jsp -> XML

.c, .cpp, .h, hpp -> Cpp

The rest of the files will be displayed without any source code highlighting.

The jhighlight project seems to be discontinued since long time ago, hence, it should be replaced by another source code highlighter like Google's Code Prettify or any other similar project actively maintained and supporting lots of more languages.

Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 12, 2013

It has already improved in the 4.1 version. I've replaced the original highlighter by the Google's Code Prettify which supports a lot of languages (including R, I think).

Please, add yourself as watcher of the plugin in order to be automatically notified when the 4.1 version is released.

Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2013

I've published it as 4.0.2 version rather 4.1.0 as the current replacement of the syntax highlighter has not yet the expected quality. It means that it works in many cases, but unfortunatelly not for all the languages (I've tested against the R and it did not work :(.

Regarding the

all leading whitespace is lost

I've fixed a bug which miht resolve it (or maybe not). Please, let me know whether it is fixed in the 4.0.2 version.

Thanks.

Aaron Mackey September 15, 2013

Thanks for the rapid responses, this is thrilling! It's not clear to me how to upgrade the plugin; uninstall/reinstall? Will this lose my current repo configurations?

Thanks again!

-Aaron

Kinto Soft
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 15, 2013

All the configuration and indexed data will remain even if you un-install the plug-in.

I would say that the easiest way would by by clicking on the add-on Update button from the UPM.

Un-install it and install the latest version should also work without loosing any data, though un-install would not necessary whether you uses the UPM update option.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events