Skip to main content

LiterateX Progress

I have made great progress on LiterateX! I have done quite a bit of refactoring since the last progress report, as well as implemented the test suite. All tests now pass using the following GHC versions.

  • GHC 8.2.2
  • GHC 8.4.4
  • GHC 8.6.5
  • GHC 8.8.4
  • GHC 8.10.4
  • GHC 9.0.1

I am about ready to write the README and prepare for release!

API

One significant decision that I have been undecided about is which high-level API to expose. I implemented and wrote tests for two different styles of API. One exposes conduit details, while another hides such details and is less complex but also less flexible.

I started to write more details about the decision here, and doing so allowed me to decide what to do! (One often makes decisions or solves problems when describing them.) I am going to expose both APIs. The API that exposes conduit details can be used to implement any functionality supported. In addition, I will provide some functions for implementing the most common functionality used without exposing conduit. Those functions can be even more simple than the current implementation, as one can always use the conduit API when more control is needed.

CLI

At this point, I do not foresee any further changes to the utility. Here is the current design.

Usage: literatex [-s|--source SOURCE] [-t|--target TARGET]
                 [-l|--language LANGUAGE] [--ignore-shebang] [--no-code]
                 [--no-numbers] [--no-highlight] [-i|--input FILE]
                 [-o|--output FILE]
  transform literate source code to Markdown

Available options:
  -h,--help                show help and exit
  --version                show version and exit
  -s,--source SOURCE       source format
  -t,--target TARGET       target format (default: pandoc)
  -l,--language LANGUAGE   code language
  --ignore-shebang         ignore shebangs
  --no-code                do not display code
  --no-numbers             do not number code lines
  --no-highlight           do not highlight code
  -i,--input FILE          input file (default: STDIN)
  -o,--output FILE         output file (default: STDOUT)

SOURCE options:
  ddash    -- comments
  dslash   // comments
  hash     # comments
  lisp     Lisp semicolon comments
  lhs      literate Haskell
  percent  % comments

TARGET options:
  pandoc  Pandoc Markdown
  github  GitHub Flavored Markdown

Default options:
  .c     c (dslash)
  .clj   clojure (lisp)
  .css   css (dslash)
  .elm   elm (ddash)
  .erl   erlang (percent)
  .ex    elixir (hash)
  .exs   elixir (hash)
  .go    go (dslash)
  .hs    haskell (ddash)
  .idr   idris (ddash)
  .java  java (dslash)
  .js    javascript (dslash)
  .kt    kotlin (dslash)
  .lhs   haskell (lhs)
  .lisp  commonlisp (lisp)
  .lua   lua (ddash)
  .php   php (dslash)
  .pl    perl (hash)
  .py    python (hash)
  .r     r (hash)
  .rb    ruby (hash)
  .rkt   scheme (lisp)
  .rs    rust (dslash)
  .sc    scala (dslash)
  .scm   scheme (lisp)
  .sh    bash (hash)
  .sql   sql (ddash)
  .tex   latex (percent)
  .ts    typescript (dslash)
Author

Travis Cardwell

Published

Tags
Related Blog Entries