Introducing the all_todo gem

require 'all_todo'


s =<<EOF
all_todo.txt
============

# housework

## kitchen


dishes washed *
floor vacuumed (every week)

## bathroom

floor vacuumed (every week)
floor mopped (every week)
bath cleaned *



# gardening
EOF

all = AllTodo.new(s)

puts all.to_px.to_xml pretty: true

Output:

<?xml version='1.0' encoding='UTF-8'?>
<sections>
  <summary>
    <title/>
    <recordx_type>polyrex</recordx_type>
    <schema>sections[title]/section[x]</schema>
    <format_mask>["[!x]"]</format_mask>
  </summary>
  <records>
    <section id='1'>
      <summary>
        <x>housework  kitchen</x>
        <format_mask>[!x]</format_mask>
        <schema>section[x]</schema>
        <recordx_type>polyrex</recordx_type>
      </summary>
      <records>
        <section id='2'>
          <summary>
            <x>dishes washed *</x>
            <format_mask>[!x]</format_mask>
            <schema>section[x]</schema>
            <recordx_type>polyrex</recordx_type>
          </summary>
          <records>
            <section id='3'>
              <summary>
                <x>floor vacuumed (every week)</x>
                <format_mask>[!x]</format_mask>
                <schema>section[x]</schema>
                <recordx_type>polyrex</recordx_type>
              </summary>
              <records/>
            </section>
          </records>
        </section>
        <section id='4'>
          <summary>
            <x>bathroom</x>
            <format_mask>[!x]</format_mask>
            <schema>section[x]</schema>
            <recordx_type>polyrex</recordx_type>
          </summary>
          <records>
            <section id='5'>
              <summary>
                <x>floor vacuumed (every week)</x>
                <format_mask>[!x]</format_mask>
                <schema>section[x]</schema>
                <recordx_type>polyrex</recordx_type>
              </summary>
              <records/>
            </section>
            <section id='6'>
              <summary>
                <x>floor mopped (every week)</x>
                <format_mask>[!x]</format_mask>
                <schema>section[x]</schema>
                <recordx_type>polyrex</recordx_type>
              </summary>
              <records/>
            </section>
            <section id='7'>
              <summary>
                <x>bath cleaned *</x>
                <format_mask>[!x]</format_mask>
                <schema>section[x]</schema>
                <recordx_type>polyrex</recordx_type>
              </summary>
              <records/>
            </section>
          </records>
        </section>
      </records>
    </section>
    <section id='8'>
      <summary>
        <x>gardening</x>
        <format_mask>[!x]</format_mask>
        <schema>section[x]</schema>
        <recordx_type>polyrex</recordx_type>
      </summary>
      <records/>
    </section>
  </records>
</sections>

Resources