Changeset 7127
- Timestamp:
- 05/09/08 15:20:06 (2 months ago)
- Files:
-
- trunk/openlayers/examples/example-list.html (modified) (1 diff)
- trunk/openlayers/tools/exampleparser.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/examples/example-list.html
r7125 r7127 2 2 <html> 3 3 <head> 4 <title>OpenLayers Examples</title> 4 <title>OpenLayers Examples</title> 5 <link rel="alternate" href="example-list.xml" type="application/atom+xml" /> 5 6 <link rel="stylesheet" href="style.css" type="text/css" /> 6 7 <style type="text/css"> trunk/openlayers/tools/exampleparser.py
r7126 r7127 5 5 import re 6 6 import urllib2 7 from xml.dom.minidom import Document 7 8 8 9 missing_deps = False … … 82 83 return d 83 84 85 def createFeed(examples): 86 doc = Document() 87 feed = doc.createElementNS("http://www.w3.org/2005/Atom", "feed") 88 for example in examples: 89 entry = doc.createElementNS("http://www.w3.org/2005/Atom", "entry") 90 91 title = doc.createElementNS("http://www.w3.org/2005/Atom", "title") 92 title.appendChild(doc.createTextNode(example["title"] or example["example"])) 93 entry.appendChild(title) 94 95 link = doc.createElementNS("http://www.w3.org/2005/Atom", "link") 96 link.setAttribute("href", example["example"]) 97 entry.appendChild(link) 98 99 summary = doc.createElementNS("http://www.w3.org/2005/Atom", "summary") 100 summary.appendChild(doc.createTextNode(example["shortdesc"] or example["example"])) 101 entry.appendChild(summary) 102 103 feed.appendChild(entry) 104 105 doc.appendChild(feed) 106 return doc 107 108 def createEntry(doc, example): 109 110 return entry 111 112 84 113 def wordIndex(examples): 85 114 """ … … 139 168 exampleList.append(tagvalues) 140 169 170 print 171 141 172 exampleList.sort(key=lambda x:x['example'].lower()) 142 173 … … 148 179 outFile.write(json) 149 180 outFile.close() 181 182 print "writing feed to ../examples/example-list.xml " 183 atom = open('../examples/example-list.xml','w') 184 doc = createFeed(exampleList) 185 atom.write(doc.toprettyxml(" ")) 186 atom.close() 187 188 150 189 print 'complete' 151 190
