Skip to content

Commit

Permalink
💋 and drop all dependencies
Browse files Browse the repository at this point in the history
Update Lodox to forthcoming tag.
  • Loading branch information
yurrriq committed Apr 22, 2016
1 parent 98fb090 commit 308a06b
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 67 deletions.
7 changes: 0 additions & 7 deletions include/conditionals.lfe

This file was deleted.

8 changes: 5 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

{lfe_first_files, ["src/levaindoc-util.lfe"]}.

{deps, [lfe, clj]}.
{deps, []}.

{plugins, [rebar3_lfe_compile]}.
{plugins, [
{'lfe-compile', "0.4.1", {pkg, rebar3_lfe_compile}}
]}.

{provider_hooks, [{pre, [{compile, {lfe, compile}}]}]}.

{project_plugins, [
{lodox, {git, "git://github.com/lfe-rebar3/lodox.git", {tag, "0.12.12"}}}
{lodox, {git, "git://github.com/lfe-rebar3/lodox.git", {tag, "0.12.14"}}}
]}.

{lodox, [
Expand Down
4 changes: 1 addition & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
[{<<"clj">>,{pkg,<<"clj">>,<<"0.5.0">>},0},
{<<"kla">>,{pkg,<<"kla">>,<<"0.7.0">>},1},
{<<"lfe">>,{pkg,<<"lfe">>,<<"1.0.2">>},0}].
[].
83 changes: 39 additions & 44 deletions src/levaindoc-util.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
;; Conversions
(export (input-formats 0) (output-formats 0))
;; Random filename
(export (random-name 0)))
(export (random-name 0))
(import (from erlang (monotonic_time 0) (time_offset 0) (unique_integer 0))))

(include-lib "clj/include/compose.lfe")

;;;===================================================================
;;; Conversions
Expand All @@ -14,23 +14,23 @@
(defun input-formats ()
"The list of supported input formats.
```bash
$ pandoc --version | head -1
```
```
pandoc 1.15.0.6
```
```bash
$ pandoc --version | head -1
```
```
pandoc 1.15.0.6
```
```bash
$ pandoc --help | head -6 | tail +2
```
```
Input formats: commonmark, docbook, docx, epub, haddock, html, json*, latex,
markdown, markdown_github, markdown_mmd, markdown_phpextra,
markdown_strict, mediawiki, native, opml, org, rst, t2t,
textile, twiki
[ *only Pandoc's JSON version of native AST]
```"
```bash
$ pandoc --help | head -6 | tail +2
```
```
Input formats: commonmark, docbook, docx, epub, haddock, html, json*, latex,
markdown, markdown_github, markdown_mmd, markdown_phpextra,
markdown_strict, mediawiki, native, opml, org, rst, t2t,
textile, twiki
[ *only Pandoc's JSON version of native AST]
```"
'["commonmark" "docbook" "docx" "epub" "haddock" "html" "json" "latex"
"markdown" "markdown_github" "markdown_mmd" "markdown_phpextra"
"markdown_strict" "mediawiki" "native" "opml" "org" "rst" "t2t"
Expand All @@ -39,25 +39,25 @@ Input formats: commonmark, docbook, docx, epub, haddock, html, json*, latex,
(defun output-formats ()
"The list of supported output formats.
```bash
$ pandoc --version | head -1
```
```
pandoc 1.15.0.6
```
```bash
$ pandoc --version | head -1
```
```
pandoc 1.15.0.6
```
```bash
$ pandoc --help | tail +7 | head -7
```
```
Output formats: asciidoc, beamer, commonmark, context, docbook, docx, dokuwiki,
dzslides, epub, epub3, fb2, haddock, html, html5, icml, json*,
latex, man, markdown, markdown_github, markdown_mmd,
markdown_phpextra, markdown_strict, mediawiki, native, odt,
opendocument, opml, org, pdf**, plain, revealjs, rst, rtf, s5,
slideous, slidy, texinfo, textile
[**for pdf output, use latex or beamer and -o FILENAME.pdf]
```"
```bash
$ pandoc --help | tail +7 | head -7
```
```
Output formats: asciidoc, beamer, commonmark, context, docbook, docx, dokuwiki,
dzslides, epub, epub3, fb2, haddock, html, html5, icml, json*,
latex, man, markdown, markdown_github, markdown_mmd,
markdown_phpextra, markdown_strict, mediawiki, native, odt,
opendocument, opml, org, pdf**, plain, revealjs, rst, rtf, s5,
slideous, slidy, texinfo, textile
[**for pdf output, use latex or beamer and -o FILENAME.pdf]
```"
'["asciidoc" "beamer" "commonmark" "context" "docbook" "docx" "dokuwiki"
"dzslides" "epub" "epub3" "fb2" "haddock" "html" "html5" "icml" "json"
"latex" "man" "markdown" "markdown_github" "markdown_mmd"
Expand All @@ -81,15 +81,10 @@ Output formats: asciidoc, beamer, commonmark, context, docbook, docx, dokuwiki,

(defun random-string ()
"Generate a random, 11-character, alphanumeric string."
(random:seed (erlang:monotonic_time)
(erlang:time_offset)
(erlang:unique_integer))
(-> #0x100000000000000
(random:uniform)
(integer_to_list 36)
(string:to_lower)))
(random:seed (monotonic_time) (time_offset) (unique_integer))
(string:to_lower (integer_to_list (random:uniform #0x100000000000000) 36)))

(defun timestamp ()
"Return the current timestamp, as a string."
(let ((`#(,megasec ,sec ,_microsec) (os:timestamp)))
(-> (* megasec 1000000) (+ sec) (integer_to_list))))
(integer_to_list (+ sec (* megasec 1000000)))))
24 changes: 14 additions & 10 deletions src/levaindoc.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
;; Conversions
(export all))

(include-lib "levaindoc/include/conditionals.lfe")

(include-lib "levaindoc/include/conversions.lfe")


Expand All @@ -28,7 +26,10 @@
(defun convert-string (string)
"Equivalent to `markdown_github->html/1`, which calls [[convert-string/3]].
See [conversions](conversions.html) and [levaindoc-util](levaindoc-util.html)."
See [conversions][] and [levaindoc-util][].
[conversions]: conversions.html
[levaindoc-util]: levaindoc-util.html"
(markdown_github->html string))

(defun convert-string (string from to)
Expand All @@ -38,11 +39,11 @@ See [conversions](conversions.html) and [levaindoc-util](levaindoc-util.html)."
(defun convert-string (string from to options)
"Convert a `string` from input format `from` to output format `to`.
Write `string` to a random temporary file ([[levaindoc-util:random-name/0]]);
call [[convert-file/4]], capturing the output; delete the temporary file
and return `` `#(ok ,output) ``."
Write `string` to a random temporary file ([[levaindoc-util:random-name/0]]);
call [[convert-file/4]], capturing the output; delete the temporary file
and return `` `#(ok ,output) ``."
(let ((dot-temp ".temp"))
(when-not (filelib:is_dir dot-temp) (file:make_dir dot-temp))
(if (filelib:is_dir dot-temp) 'ok (file:make_dir dot-temp))
(let ((name (filename:join dot-temp (levaindoc-util:random-name))))
(file:write_file name string)
(let ((`#(ok ,output) (convert-file name from to options)))
Expand All @@ -52,7 +53,10 @@ and return `` `#(ok ,output) ``."
(defun convert-file (file)
"Equivalent to `markdown_github-file->html/1`, which calls [[convert-file/3]].
See [conversions](conversions.html) and [levaindoc-util](levaindoc-util.html)."
See [conversions][] and [levaindoc-util][].
[conversions]: conversions.html
[levaindoc-util]: levaindoc-util.html"
(markdown_github-file->html file))

(defun convert-file (file from to)
Expand All @@ -61,8 +65,8 @@ See [conversions](conversions.html) and [levaindoc-util](levaindoc-util.html)."

(defun convert-file (file from to _options)
"Convert a `file` from input format `from` to output format `to`.
Return `` `#(ok ,output) ``.
Return `` `#(ok ,output) ``.
A list of `_options` is currently ignored."
A list of `_options` is currently ignored."
(let ((output (os:cmd (++ "pandoc " file " -f " from " -t " to))))
`#(ok ,output)))

0 comments on commit 308a06b

Please sign in to comment.