Skip to content

Commit

Permalink
+ align attribute names with W3C standards
Browse files Browse the repository at this point in the history
  rename 'bgcolor' to 'background-color'
+ update upgrade_map_xml.py
  • Loading branch information
artemp committed Jul 19, 2010
1 parent c943447 commit 91a1091
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/load_map.cpp
Expand Up @@ -170,7 +170,7 @@ void map_parser::parse_map( Map & map, ptree const & pt )

try
{
optional<color> bgcolor = get_opt_attr<color>(map_node, "bgcolor");
optional<color> bgcolor = get_opt_attr<color>(map_node, "background-color");
if (bgcolor)
{
map.set_background( * bgcolor );
Expand Down
2 changes: 1 addition & 1 deletion src/save_map.cpp
Expand Up @@ -702,7 +702,7 @@ void serialize_map(ptree & pt, Map const & map, bool explicit_defaults)
optional<color> const& c = map.background();
if ( c )
{
set_attr( map_node, "bgcolor", * c );
set_attr( map_node, "background-color", * c );
}

optional<std::string> const& image_filename = map.background_image();
Expand Down
6 changes: 6 additions & 0 deletions utils/upgrade_map_xml/upgrade_map_xml.py
Expand Up @@ -46,6 +46,12 @@ def fixup_sym_attributes(sym):
xml = sys.argv[1]
tree = objectify.parse(xml)
root = tree.getroot()

# rename 'bgcolor' to 'background-color'
if root.attrib.get('bgcolor'):
root.attrib['background-color'] = root.attrib.get('bgcolor')
root.attrib.pop('bgcolor')

for style in root.Style:
if len(style.Rule):
for rule in style.Rule:
Expand Down

0 comments on commit 91a1091

Please sign in to comment.