cancel
Showing results for 
Search instead for 
Did you mean: 

Adding HTML tags to the description field

arikc
Champ in-the-making
Champ in-the-making
I would like to know if it is possible to add HTML tags to the description field of an article (ws:article). In some cases I would like to break the description into multiple lines and so forth and attempting to add a <br /> to the description field does not seem to do it. It looks like it's escaping it but I am not sure in what level it is being escaped (looks like it's not in the FreeMarker template level though).

I will be glad to know if you have any suggestions on how to go about this.
2 REPLIES 2

bremmington
Champ on-the-rise
Champ on-the-rise
I've had a prod around in this area and run a couple of tests, and I fear that you have found a bug  Smiley Sad

I have raised this in Jira and already have a fix that I will apply to HEAD later today (it's very simple). I think it may actually be caused by a bug in the dom4j library that we use, but that's probably not relevant.

So, the only suggestion I have to resolve this issue for you is to either wait for the next community release (which is likely to be made in August or September), take the source code for HEAD (or the next successful nightly build), or apply the fix yourself to your system (if you have and know how to build the source). If you decide to take from HEAD then I recommend you wait for a couple of weeks, as this is really quite volatile at the moment. If you decide to patch your copy of the code then the class you need to change is called "AssetSerializerXmlImpl" and the method is called "writeValue". In that method you will see this code snippet:

        case text:
            writer.startCDATA();
            writer.write(value.toString());
            writer.endCDATA();
            break;
The fix is to alter that piece of code to read:

        case text:
            writer.write(new FlyweightCDATA(value.toString()));
            break;
You will also need to add a corresponding import at the top of that class:

import org.dom4j.tree.FlyweightCDATA;

Sorry for the inconvenience, and thank you for asking your question here.

arikc
Champ in-the-making
Champ in-the-making
Thank you very much for your reply Brian. As this is not a burning issue for me right now I think I will just hold on for the next stable community release.