<s> EVENT_DATE_FORMAT = '<STR_LIT>' <EOL> def gene_timeline ( orgnodes ) : <EOL> events = [ ] <EOL> def add_event ( node , startdate , enddate = None ) : <EOL> if not startdate : <EOL> return <EOL> ev = { <EOL> '<STR_LIT:title>' : node . heading , <EOL> '<STR_LIT:start>' : startdate . strftime ( EVENT_DATE_FORMAT ) , <EOL> } <EOL> if enddate : <EOL> ev [ '<STR_LIT:end>' ] = enddate . strftime ( EVENT_DATE_FORMAT ) <EOL> events . append ( ev ) <EOL> for node in orgnodes : <EOL> add_event ( node , node . scheduled . start ) <EOL> add_event ( node , node . deadline . start ) <EOL> for date in node . datelist : <EOL> add_event ( node , date . start ) <EOL> for od in node . rangelist : <EOL> add_event ( node , od . start , od . end ) <EOL> return { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : events , <EOL> } </s>
