Changeset 34245 for main


Ignore:
Timestamp:
2020-07-04T06:33:15+12:00 (4 years ago)
Author:
ak19
Message:

Crucially related to commit r34241, this was the other half of the GLI fix, but had been debugging the committed half separately at the end so forgot to add this back in.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/cdm/CollectionConfigXMLReadWrite.java

    r34243 r34245  
    4242import org.greenstone.gatherer.metadata.MetadataElement;
    4343import org.greenstone.gatherer.metadata.MetadataTools;
     44import org.greenstone.gatherer.util.Codec;
    4445import org.greenstone.gatherer.util.StaticStrings;
    4546import org.greenstone.gatherer.util.Utility;
     
    9899            // Sadly, XMLTools.getNodeText(item) returns empty for any HTML in displayItem
    99100            // so we have to do it the hard way
     101            // We can't take a shortcut like format statements, which also need to keep their
     102            // tags intact in collConfig.xml, because we know in advance the format tag name
     103            // Can't guess at what html tag names the user uses, and there may be several at
     104            // the same level inside collDescription (e.g. multiple paragraphs)
    100105            String text = isCollDescr ? preserveHTMLInDescriptionDisplayItem(item)
    101106                : XMLTools.getNodeText(item); // else as before for all other displayItems
     
    14731478        if(!lang_value.equals("")) {
    14741479            e.setAttribute(lang_att, lang_value);
     1480
     1481            // Handle collection description displayItems specially again: these are allowed to go
     1482            // into collConfig.xml file containing tag markers, to preserve any user-added html
     1483            // in a format easy to edit in collConfig (rather than filled with entities)
     1484            if(element_name.equals(StaticStrings.DISPLAYITEM_STR) && name_value.equals(StaticStrings.DESCRIPTION_STR)) {
     1485            //System.err.println("@@@ Before internal coll description converted to collConfig:\n" + text);
     1486            // special case again: the following is going to be undone shortly again,
     1487            // mirroring the inverse of going from collConfig.xml to internal collConfig format
     1488            // upon parse()
     1489            // but this is what works to preserve the ampersands for output to XML context
     1490            // past the next line
     1491            //text = text.replaceAll("&", "&");
     1492            //text = Codec.transform(text, Codec.ESCAPEDHTML_TO_UNESCAPED);
     1493            text = Codec.transform(text, Codec.REINSTATE_HTML_TAGS);           
     1494            //System.err.println("@@@ After coll description converted to collConfig:\n" + text);
     1495            }
    14751496            XMLTools.setNodeText(e, text);
     1497
    14761498        }       
    14771499        if(!key.equals("")) {
Note: See TracChangeset for help on using the changeset viewer.