aboutsummaryrefslogtreecommitdiffstats
path: root/src/asciideck_reader.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-06-11 12:38:07 +0200
committerLoïc Hoguin <[email protected]>2018-06-11 12:38:07 +0200
commit976dfc5d92e3e23f356cb19f17ff51b22c75e634 (patch)
tree2589053dfc25bd6f38afdd9a06bdbbf63680464c /src/asciideck_reader.erl
parent524777054be30c848c1883ffd15b245c29f73004 (diff)
downloadasciideck-976dfc5d92e3e23f356cb19f17ff51b22c75e634.tar.gz
asciideck-976dfc5d92e3e23f356cb19f17ff51b22c75e634.tar.bz2
asciideck-976dfc5d92e3e23f356cb19f17ff51b22c75e634.zip
Add scripts/asciidoc ad-hoc replacement and HTML output
This allows me to build ninenines.eu using Asciideck and while the results are not perfect yet things are looking pretty, pretty good. Adding source-highlight support, showing images and fixing a few minor issues should bring me to the point where I can drop Asciidoc.
Diffstat (limited to 'src/asciideck_reader.erl')
-rw-r--r--src/asciideck_reader.erl33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/asciideck_reader.erl b/src/asciideck_reader.erl
new file mode 100644
index 0000000..d098417
--- /dev/null
+++ b/src/asciideck_reader.erl
@@ -0,0 +1,33 @@
+%% Copyright (c) 2018, Loïc Hoguin <[email protected]>
+%%
+%% Permission to use, copy, modify, and/or distribute this software for any
+%% purpose with or without fee is hereby granted, provided that the above
+%% copyright notice and this permission notice appear in all copies.
+%%
+%% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+%% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+%% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+%% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+%% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+-module(asciideck_reader).
+
+-export([read_line/1]).
+-export([get_position/1]).
+-export([set_position/2]).
+
+-spec read_line(pid()) -> binary() | eof.
+read_line(Pid) ->
+ gen_server:call(Pid, read_line).
+
+%% @todo peek_line
+
+-spec get_position(pid()) -> pos_integer().
+get_position(Pid) ->
+ gen_server:call(Pid, get_position).
+
+-spec set_position(pid(), pos_integer()) -> ok.
+set_position(Pid, Pos) ->
+ gen_server:cast(Pid, {set_position, Pos}).