From 6b70398a902128d24f73737d57ded4b6ab4efaa0 Mon Sep 17 00:00:00 2001 From: Stavros Polymenis Date: Tue, 30 Aug 2016 22:04:12 +0100 Subject: [PATCH] initial simple example with omd --- Makefile | 5 +++++ README.md | 33 +++++++++++++++++++++++++++++++++ src/logarion.ml | 19 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100644 src/logarion.ml diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f16880f --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ + +all: foo + +foo: src/logarion.ml + ocamlfind ocamlopt -o logarion -linkpkg -package omd,Str src/logarion.ml diff --git a/README.md b/README.md new file mode 100644 index 0000000..169b13a --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Logarion + +## Summary + +A Yamado archive publisher. + +Focuses on: + +1. System simplicity by delegating all functionality but parsing Yamado archives and generating outputs. + Where possible it can compose with other programs (e.g. Pandoc). +2. Output quality +3. Distributed interactivity, like sharing with friends. + +_YMD_ files can be stored internally and controlled by Logarion, or they can be piped from other sources. + +Logarion can be used in two modes: + +- Static, published upon a command + + Suitable for situations where installation on the server is not possible. + Has the limitation that it can only output specific output once. + +- Dynamic, published upon request according to query + + Supports interactive features like searching and more advanced Atom feed parameters. + +## Source file structure + +- `src/`: Source code directory + +## Requirements + +- [omd](https://github.com/ocaml/omd diff --git a/src/logarion.ml b/src/logarion.ml new file mode 100644 index 0000000..7ae4b9d --- /dev/null +++ b/src/logarion.ml @@ -0,0 +1,19 @@ + +let ymd s = + let open Str in + bounded_split_delim (regexp "---") s 5 + +let html_of string = + let open Omd in + to_html (of_string string) + +let test = "--- +title: Test +author: orbifx +--- +Hello _world_!" + +let () = + let md_str = List.nth (ymd test) 2 in + + Printf.printf "%s" (html_of md_str)