| | 15 | def create_xml file_name |
| | 16 | xml = <<-XML |
| | 17 | <?xml version="1.0" encoding="UTF-8"?> |
| | 18 | <generator xmlns="http://www.mozilla.org/microsummaries/0.1" |
| | 19 | name="tDiary Entry Title"> |
| | 20 | <template> |
| | 21 | <transform xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
| | 22 | <output method="text"/> |
| | 23 | <template match="/"> |
| | 24 | <value-of select="html/head/title"/> |
| | 25 | <choose> |
| | 26 | <when test="boolean(descendant::div[attribute::class='body'][1]/div[attribute::class='section'][last()]/h3)"> |
| | 27 | <text> - </text> |
| | 28 | <value-of select="descendant::div[attribute::class='body'][1]/div[attribute::class='section'][last()]/h3"/> |
| | 29 | </when> |
| | 30 | <when test="boolean(descendant::div[attribute::class='day'][1]/h2)"> |
| | 31 | <text> - </text> |
| | 32 | <value-of select="descendant::div[attribute::class='day'][1]/h2"/> |
| | 33 | </when> |
| | 34 | </choose> |
| | 35 | </template> |
| | 36 | </transform> |
| | 37 | </template> |
| | 38 | <update interval="240"/> |
| | 39 | <pages> |
| | 40 | <include>^#{@conf.base_url.gsub(/\./, '\\.')}$</include> |
| | 41 | </pages> |
| | 42 | </generator> |
| | 43 | XML |
| | 44 | |
| | 45 | begin |
| | 46 | File::open( file_name, 'w' ) do |f| |
| | 47 | f.print to_utf8( xml ) |
| | 48 | end |
| | 49 | rescue |
| | 50 | end |
| | 51 | end |
| | 52 | |