Introducing the weeklyplanner_template gem
require 'weeklyplanner_template'
xml = '/tmp/week.xml'
wpt = WeeklyplannerTemplate.new xml, template: 'default'
wpt.to_h.each {|filename, content| File.write filename, content}
The weeklyplanner_template gem accepts an XML file (Polyrex format) and generates an HTML page complete with CSS files.
Here's an example of the XML file used:
<week> <summary> <mon>May</mon> <no>18</no> <label/> </summary> <records> <day id='126'> <summary> <sdate>2017-May-01</sdate> <xday>1</xday> <event/> <bankholiday/> <title>Monday</title> <sunrise/> <sunset/> <schema>day[sdate, xday, event, bankholiday, title, sunrise, sunset]/entry[time_start, time_end, duration, title]</schema> <format_mask>[!sdate] [!xday] [!event] [!bankholiday] [!title] [!sunrise] [!sunset]</format_mask> <recordx_type>polyrex</recordx_type> </summary> <records> <entry> <summary> <time_start>9:00am</time_start> <title>fun time</title> </summary> <records/> </entry> </records> </day> <day id='127'> <summary> <sdate>2017-May-02</sdate> <xday>2</xday> <event/> <bankholiday/> <title>Tuesday</title> <sunrise/> <sunset/> <schema>day[sdate, xday, event, bankholiday, title, sunrise, sunset]/entry[time_start, time_end, duration, title]</schema> <format_mask>[!sdate] [!xday] [!event] [!bankholiday] [!title] [!sunrise] [!sunset]</format_mask> <recordx_type>polyrex</recordx_type> </summary> <records/> </day> <day id='128'> <summary> <sdate>2017-May-03</sdate> <xday>3</xday> <event/> <bankholiday/> <title>Wednesday</title> <sunrise/> <sunset/> <schema>day[sdate, xday, event, bankholiday, title, sunrise, sunset]/entry[time_start, time_end, duration, title]</schema> <format_mask>[!sdate] [!xday] [!event] [!bankholiday] [!title] [!sunrise] [!sunset]</format_mask> <recordx_type>polyrex</recordx_type> </summary> <records/> </day> <day id='129'> <summary> <sdate>2017-May-04</sdate> <xday>4</xday> <event/> <bankholiday/> <title>Thursday</title> <sunrise/> <sunset/> <schema>day[sdate, xday, event, bankholiday, title, sunrise, sunset]/entry[time_start, time_end, duration, title]</schema> <format_mask>[!sdate] [!xday] [!event] [!bankholiday] [!title] [!sunrise] [!sunset]</format_mask> <recordx_type>polyrex</recordx_type> </summary> <records/> </day> <day id='130'> <summary> <sdate>2017-May-05</sdate> <xday>5</xday> <event/> <bankholiday/> <title>Friday</title> <sunrise/> <sunset/> <schema>day[sdate, xday, event, bankholiday, title, sunrise, sunset]/entry[time_start, time_end, duration, title]</schema> <format_mask>[!sdate] [!xday] [!event] [!bankholiday] [!title] [!sunrise] [!sunset]</format_mask> <recordx_type>polyrex</recordx_type> </summary> <records/> </day> <day id='131'> <summary> <sdate>2017-May-06</sdate> <xday>6</xday> <event/> <bankholiday/> <title>Saturday</title> <sunrise/> <sunset/> <schema>day[sdate, xday, event, bankholiday, title, sunrise, sunset]/entry[time_start, time_end, duration, title]</schema> <format_mask>[!sdate] [!xday] [!event] [!bankholiday] [!title] [!sunrise] [!sunset]</format_mask> <recordx_type>polyrex</recordx_type> </summary> <records/> </day> <day id='132'> <summary> <sdate>2017-May-07</sdate> <xday>7</xday> <event/> <bankholiday/> <title>Sunday</title> <sunrise/> <sunset/> <schema>day[sdate, xday, event, bankholiday, title, sunrise, sunset]/entry[time_start, time_end, duration, title]</schema> <format_mask>[!sdate] [!xday] [!event] [!bankholiday] [!title] [!sunrise] [!sunset]</format_mask> <recordx_type>polyrex</recordx_type> </summary> <records/> </day> </records> </week>
Screenshot
Resources
- weeklyplanner_template https://rubygems.org/gems/weeklyplanner_template
weeklyplanner template gem weeklyplannertemplate planner