Project

wiki_md

0.0
No commit activity in last 3 years
No release in over 3 years
Designed for maintaining many wiki entries within a single document in Markdown format. #nothrills #personalwiki
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.4.0, ~> 0.4
>= 0.5.0, ~> 0.5
 Project Readme

Generating an Accordion style menu from a WikiMd document

require 'wiki_md'


s = "<?wikimd version='1.0'?>
title: New Wikimd format

# Morning #bed #breakfast

Get out of bed

# Afternoon #lunch #ready

Have lunch

# Evening #relax #bed

Watch some TV

Make a list of what to do tomorrow, including:

* housework
* reading
* exercise

"
puts s
wmd = WikiMd.new(s, debug: true)
wmd.save
s2 = wmd.to_accordion ascending: false
html = Martile.new(s2).to_html
File.write '/tmp/menu.html', html

The above example code generates an HTML file containing an accordion style menu.

menu html accordion wikimd


Introducing the wiki_md gem

require 'wiki_md'


s=<<EOF
<?dynarex schema="sections[title]/section(x)" format_mask="[!x]"?>
title: MyWiki

--#

# Garden

The garden has potatoes, raspberries, strawberries, brocolli, and more.

# Kitchen

The kitchen includes a cooker, cupboard, fridge, washing machine, and sink.

# Fixing things

What can we fix today?

EOF

wmd = WikiMd.new s
puts wmd.to_s
<?dynarex schema="sections[title]/section(x)" format_mask="[!x]"?>
title: MyWiki
--#
# Garden

The garden has potatoes, raspberries, strawberries, brocolli, and more.

# Kitchen

The kitchen includes a cooker, cupboard, fridge, washing machine, and sink.

# Fixing things

What can we fix today?
wmd.create_section "# Working\n\nThis works just fine."
r = wmd.find 'kitchen'
#=> #<RecordX:47042485135240 @h={:x=>"# Kitchen\n\nThe kitchen includes a cooker, cupboard, fridge, washing machine, sink, and a kettle."}> 

wmd.update_section 'kitchen', "The kitchen includes a cooker, cupboard, fridge, washing machine, sink, and a kettle."
wmd.title = 'My Personal Wiki'
puts wmd.to_s
<?dynarex schema="sections[title]/section(x)" format_mask="[!x]"?>
title: My Personal Wiki
--#
# Garden

The garden has potatoes, raspberries, strawberries, brocolli, and more.

# Kitchen

The kitchen includes a cooker, cupboard, fridge, washing machine, sink, and a kettle.

# Fixing things

What can we fix today?

# Working

This works just fine.
puts wmd.to_sections
<section id='1' created='2018-09-15 20:34:41 +0100' last_modified=''>
  <details open='open'>
    <summary>
      <h1 id='garden'>Garden</h1>
    </summary>
    <p>The garden has potatoes, raspberries, strawberries, brocolli, and more.</p>
  </details>
</section>
<section id='2' created='2018-09-15 20:34:41 +0100' last_modified='2018-09-15 20:34:57 +0100'>
  <details open='open'>
    <summary>
      <h1 id='kitchen'>Kitchen</h1>
    </summary>
    <p>The kitchen includes a cooker, cupboard, fridge, washing machine, and sink.</p>
  </details>
</section>
<section id='3' created='2018-09-15 20:34:41 +0100' last_modified=''>
  <details open='open'>
    <summary>
      <h1 id='fixing-things'>Fixing things</h1>
    </summary>
    <p>What can we fix today?</p>
  </details>
</section>

Note: Instead of a string pattern, a section id can be passed to the find method to return an entry.

Resources

wiki md wiki_md gem dxsectionx sectionx