Skip to content

Commit

Permalink
💄
Browse files Browse the repository at this point in the history
  • Loading branch information
yurrriq committed Sep 17, 2016
1 parent be7aca2 commit 89ee419
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
19 changes: 7 additions & 12 deletions src/levaindoc-util.lfe
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
;;; ===================================================== [ levaindoc-util.lfe ]

(defmodule levaindoc-util
"Utility functions for [levaindoc](https://github.com/quasiquoting/levaindoc).
For each `input`/`output` pair, there exist conversion functions
Expand All @@ -10,10 +12,7 @@
;; Random filename
(export (random-name 0)))


;;;===================================================================
;;; Conversions
;;;===================================================================
;;; ============================================================ [ Conversions ]

(defun input-formats ()
"The list of supported input formats.
Expand Down Expand Up @@ -69,19 +68,13 @@
"native" "odt" "opendocument" "opml" "org" "pdf" "plain" "revealjs"
"rst" "rtf" "s5" "slideous" "slidy" "tei" "texinfo" "textile"])


;;;===================================================================
;;; Random filename
;;;===================================================================
;;; ======================================================== [ Random filename ]

(defun random-name ()
"Generate a random filename, ending in `.temp`."
(++ (random-string) "-" (timestamp) ".temp"))


;;;===================================================================
;;; Internal functions
;;;===================================================================
;;; ===================================================== [ Internal functions ]

(defun random-string ()
"Generate a random, 11-character, alphanumeric string."
Expand All @@ -94,3 +87,5 @@
"Return the current timestamp, as a string."
(let ((`#(,megasec ,sec ,_microsec) (os:timestamp)))
(integer_to_list (+ sec (* megasec 1000000)))))

;;; ==================================================================== [ EOF ]
13 changes: 6 additions & 7 deletions src/levaindoc.lfe
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;;; ========================================================== [ levaindoc.lfe ]

(defmodule levaindoc
"A partial LFE port of [Pandex](https://github.com/FilterKaapi/pandex)."
;; API
(export (convert-string 1) (convert-string 3) (convert-string 4)
(convert-file 1) (convert-file 3) (convert-file 4)))

;;;===================================================================
;;; Conversions
;;;===================================================================
;;; ============================================================ [ Conversions ]

(eval-when-compile
(defun defn (name args doc body)
Expand Down Expand Up @@ -47,10 +47,7 @@
;; with the names, {{input-}}->{{output}} and {{input}}-file->{{output}}.
(defconversions)


;;;===================================================================
;;; API
;;;===================================================================
;;; ==================================================================== [ API ]

(defun convert-string (string)
"Equivalent to `markdown_github->html/1`, which calls [[convert-string/3]].
Expand Down Expand Up @@ -99,3 +96,5 @@
A list of `_options` is currently ignored."
(let ((output (os:cmd (++ "pandoc " file " -f " from " -t " to))))
`#(ok ,output)))

;;; ==================================================================== [ EOF ]

0 comments on commit 89ee419

Please sign in to comment.