diff --git a/wiki/index.php b/wiki/index.php new file mode 100644 index 0000000..ed04058 --- /dev/null +++ b/wiki/index.php @@ -0,0 +1,30 @@ + + + + +

If you want to contribute, check out the + source repo and open a PR! +

+
+
+ parse(file_get_contents($page))->getYAML(); + if (!$yaml["published"]) continue; ?> + "> -
+ parse(file_get_contents("pages/{$_GET["page"]}.md")); + $yml = $pg->getYAML(); + $PageTitle = $yml['title']; + require_once '/var/www/tilde/server/header2.php';?> + < wiki + getContent()?> + diff --git a/wiki/json2mb.rb b/wiki/json2mb.rb new file mode 100644 index 0000000..0753837 --- /dev/null +++ b/wiki/json2mb.rb @@ -0,0 +1,36 @@ +#!/usr/bin/env ruby + +require 'yaml' +require 'json' +require 'optparse' +require 'ostruct' +require 'fileutils' + +#quit unless our script gets two command line arguments +unless ARGV.length == 3 + puts "Dude, not the right number of arguments." + puts "Usage: ruby json2md.rb [-j][-y] json_file.json yaml_file.yaml\n" + exit +end + +$json_file = ARGV[1] +$yaml_file = ARGV[2] + +options = OpenStruct.new +OptionParser.new do |opt| + opt.on('-j', '--json', 'Convert to JSON') { |o| options.json = o } + opt.on('-y', '--yaml', 'Convert to YAML') { |o| options.yaml = o } +end.parse! + +case + when options.yaml == true + y_file = File.open("#{$yaml_file}", 'a') + y_file.write(YAML.dump(JSON.parse(IO.read($json_file)))) + y_file.close + puts "Converted to YAML. Output file is #{$yaml_file}" + + when options.json == true + j_file = YAML.load_file(File.open("#{$yaml_file}", 'r')) + File.write "#{$json_file}", JSON.pretty_generate(j_file) + puts "Converted to JSON. Output file is #{$json_file}" +end diff --git a/wiki/pages/TEMPLATE b/wiki/pages/TEMPLATE new file mode 100644 index 0000000..6fa4888 --- /dev/null +++ b/wiki/pages/TEMPLATE @@ -0,0 +1,8 @@ +--- +published: false +date: January 1, 1980 +title: Title +author: anton +--- + +Content