Changeset 11968 in josm


Ignore:
Timestamp:
2017-04-21T23:30:12+02:00 (8 years ago)
Author:
stoecker
Message:

add country code and icon

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/SyncEditorLayerIndex.groovy

    r11967 r11968  
    197197        myprintln "*** Loaded ${eliEntries.size()} entries (ELI). ***"
    198198    }
     199    String cdata(def s) {
     200        if(s =~ /[<>&]/)
     201            return "<![CDATA[$s]]>"
     202       return s
     203    }
    199204
    200205    String maininfo(def entry, String offset) {
    201206        String res = offset + "<type>${getType(entry)}</type>\n"
    202         res += offset + "<url><![CDATA[${getUrl(entry)}]]></url>\n"
     207        res += offset + "<url>${cdata(getUrl(entry))}</url>\n"
    203208        if(getType(entry) == "tms") {
    204209            if(getMinZoom(entry) != null)
     
    209214        return res
    210215    }
    211 
    212216   
    213217    void printentries(def entries, def stream) {
     
    221225            stream.write "        <name>${getName(e)}</name>\n"
    222226            stream.write "        <id>${getId(e)}</id>\n"
    223             if(getDate(e) != "")
    224                 stream.write "        <date>${getDate(e)}</date>\n"
     227            def t
     228            if((t = getDate(e)))
     229                stream.write "        <date>$t</date>\n"
     230            if((t = getCountryCode(e)))
     231                stream.write "        <country-code>$t</country-code>\n"
     232            if((t = getIcon(e)))
     233                stream.write "        <icon>${cdata(t)}</icon>\n"
    225234            stream.write maininfo(e, "        ")
    226235            for (def m : getMirrors(e)) {
Note: See TracChangeset for help on using the changeset viewer.