summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2016-02-25 14:31:22 -0500
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2016-02-25 14:31:22 -0500
commit02a6b529e479e49e3818fe0c9a4f08af42828742 (patch)
treef56d588da32eb50df3a516320b68504d615e5150
parentfa7c8e5172d5f48d93e3e9a35221dcc87692a579 (diff)
downloadksmap-02a6b529e479e49e3818fe0c9a4f08af42828742.tar.gz
Tweaks to the HTML rendering of the location popup
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-xyaml-to-kml.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/yaml-to-kml.py b/yaml-to-kml.py
index bf77791..1f22956 100755
--- a/yaml-to-kml.py
+++ b/yaml-to-kml.py
@@ -44,7 +44,7 @@ if __name__ == '__main__':
sys.exit(0)
for filename in glob.glob(args.filepattern):
- with open(filename) as data_file:
+ with open(filename) as data_file:
try:
ydata = yaml.load(data_file)
except yaml.ParserError as ex:
@@ -92,24 +92,28 @@ if __name__ == '__main__':
el_coordinates = SubElement(el_point, 'coordinates')
el_coordinates.text = coords
- desc = []
-
libavhash = hashlib.md5(ydata['email'].strip().lower()).hexdigest()
- desc.append(
- '<img style="float:right;margin:0 0 3pt 3pt;border:1px solid black;width:64;height:64" '
- 'src="https://seccdn.libravatar.org/avatar/%s?s=64&amp;d=retro"/>'
- '<b>Contact:</b> <a href="mailto:%s">%s</a>' % (libavhash, ydata['email'], ydata['email']))
+ desc = '''
+ <div style="min-width: 250pt">
+ <img style="float:left;margin:0 3pt 5pt 0;border:1px solid black;width:64;height:64"
+ src="https://seccdn.libravatar.org/avatar/%s?s=64&amp;d=retro"/>
+ <p><b>Contact:</b>&nbsp;<a href="mailto:%s">%s</a>
+ ''' % (libavhash, ydata['email'], ydata['email'])
if 'key' in ydata.keys():
- desc.append('<b>Key stats:</b> <a href="http://pgp.cs.uu.nl/stats/%s.html">%s</a>'
- % (ydata['key'], ydata['key']))
+ desc += '''<br/>
+ <b>Key stats:</b>&nbsp;<a href="http://pgp.cs.uu.nl/stats/%s.html">%s</a>
+ ''' % (ydata['key'], ydata['key'])
+ desc += '</p><p style="clear:both">'
if 'description' in location.keys():
- desc.append('<br/>' + location['description'].strip())
+ desc += location['description'].strip()
+
+ desc += '</p></div>'
el_description = SubElement(el_placemark, 'description')
- el_description.text = CDATA('<br/>'.join(desc))
+ el_description.text = CDATA(desc)
kml_data = tostring(el_kml, pretty_print=True)