diff options
author | sternenseemann <git@lukasepple.de> | 2017-02-14 00:34:08 +0100 |
---|---|---|
committer | sternenseemann <git@lukasepple.de> | 2017-02-14 00:34:08 +0100 |
commit | bfba85afcb00cd82d69deb784f10ddd714787ef9 (patch) | |
tree | ee482b813eb5b4281cc96dcf6eda625031a093ee | |
parent | ad61e882b0c45537754f0de6c2a8698b0e020028 (diff) |
Add example log file, clarify TODOs
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | src/log.ml | 10 |
2 files changed, 23 insertions, 3 deletions
diff --git a/README.md b/README.md index 54346f7..75304fd 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,19 @@ logbook — tool for personal log files logbook is a small tool for dealing with log files, which were first [specified by Profpatsch](https://gist.github.com/Profpatsch/092ff68fa267b9fa0ccbe13e98149b21) (sadly only in german, I will add a translation as soon as possible). Parsing and Representation of log files works at the moment, more to come! + +## Example log file + +``` +[2017-02-11] +The 42nd day of the year. + ++ Public information. + foo bar + +- Private information. + Additional block + +* Semi-private information. + More text! +``` diff --git a/src/log.ml b/src/log.ml index 20d1d03..6939ca2 100644 --- a/src/log.ml +++ b/src/log.ml @@ -10,7 +10,7 @@ type privacy_level = Private | Semi_private | Public let compatible_privacy x mode = match mode with - | Private -> true (* who may see private post, may see all posts *) + | Private -> true (* who may see private posts, may see all posts *) | Semi_private -> x = Semi_private || x = Public | Public -> x = Public @@ -54,7 +54,6 @@ let rec fail_if_none p = | Some x -> return x in p >>= failer -(* TODO rework *) let rec block indent = let peeker = function | None -> false @@ -68,7 +67,6 @@ let rec block indent = if (peeker c) then (String.append "\n") <$> block indent else return "")) -(* TODO substitution *) let itemp = fail_if_none (privacy_level_of_char <$> any_char) <* any_char @@ -90,6 +88,12 @@ let log_entryp = return (Log_entry (date, summary, items))))) +(* Parser TODO + * - test edge cases (omitted, added parts, empty lines etc.) + * - substitutions + * - clean up block parser + * … + *) let log_parser = (editor_comment <|> return ()) *> skip_many empty_line *> |