packages feed

lima 0.2.1.2 → 0.2.1.3

raw patch · 5 files changed

+93/−36 lines, 5 files

Files

README.hs view
@@ -1,11 +1,20 @@ {- # lima -Convert between files in different formats.+Sync your `README.md` with your `Haskell` codebase. +## Supported formats++Convert files between:++- `Haskell` (`.hs`)+- `Literate Haskell` (`.lhs`)+- `GitHub Flavored Markdown` (`.md`)+- `TeX` (`.tex`)+ ## Related works -- [LiterateMarkdown](https://hackage.haskell.org/package/LiterateMarkdown) - `lima` is a fork of this (abandoned?) project.+- [LiterateMarkdown](https://hackage.haskell.org/package/LiterateMarkdown) - `lima` is a fork of this abandoned project.  - [pandoc](https://hackage.haskell.org/package/pandoc) - [supports](https://www.uv.es/wikibase/doc/cas/pandoc_manual_instalado.wiki?60) `Literate Haskell` and a ton of other formats. @@ -15,17 +24,10 @@  - [agda2lagda](https://hackage.haskell.org/package/agda2lagda) - Generate a literate Agda/Haskell script from an Agda/Haskell script. Produces LaTeX or Markdown literate scripts. -- [markdown-unlit](https://hackage.haskell.org/package/markdown-unlit) - `markdown-unlit` is a custom unlit program. It can be used to extract Haskell code from Markdown files..+- [markdown-unlit](https://hackage.haskell.org/package/markdown-unlit) - `markdown-unlit` is a custom unlit program. It can be used to extract Haskell code from Markdown files.  - [unlit](https://hackage.haskell.org/package/unlit) - Tool to convert literate code between styles or to code. -## Supported formats--- `Haskell` (`.hs`)-- `Literate Haskell` (`.lhs`)-- `GitHub Flavored Markdown` (`.md`)-- `TeX` (`.tex`)- ## Demo  ### Markdown@@ -42,8 +44,18 @@  ## Ideas +### TL;DR++- `Haskell` files can be type checked and nicely formatted.+- Convert a `Haskell` file with tags (== special comments) to `Markdown` or `TeX`.+- The file is parsed line by line, tags affect parsing of the following lines.+- Usually, it's possible to convert the file back to the source format.++### Full++- A document is a text in a supported format. - I introduced tags into supported formats.-  - E.g., in `.hs` files, tags are multiline comments written on a single line like `{- LIMA_ENABLE -}`.+  - E.g., in `.hs` documents, tags are multiline comments written on a single line like `{- LIMA_ENABLE -}`. - Tag names are configurable.   - A user may set `on` instead of `LIMA_ENABLE`. - A document can be parsed into a list of tokens.@@ -56,11 +68,11 @@ - Such a converter is usually invertible for a formatted document.   - Converting a document `A` to a document `B`, then converting `B` to `A` doesn't change the content of `A`. -## Setup+## Suggested setup  1. Create a test suite. 1. Add `lima` and `text` to its dependencies.-1. Create a test module. It can have the following content.+1. Create a test module. It may have the following content. -}  {- LIMA_INDENT 4 -}@@ -78,10 +90,10 @@  This package has two such test suites: -- [readme-hs-to-md](test/HsToMd/Main.hs) converts `README.hs` to `README.md`-- [readme-md-to-hs](test/MdToHs/Main.hs) converts `README.md` to `README.hs`+- [readme-hs-to-md](test/HsToMd/Main.hs) converts `README.hs` to `README.md`.+- [readme-md-to-hs](test/MdToHs/Main.hs) converts `README.md` to `README.hs`. -## Workflow+## Possible workflow  Here's a possible workflow for `Haskell` and `Markdown`: @@ -93,7 +105,7 @@  ## Contribute -Clone this repo and enter `lima`+Clone this repo and enter `lima`.  ```console git clone https://github.com/deemp/lima
README.md view
@@ -1,10 +1,19 @@ # lima -Convert between files in different formats.+Sync your `README.md` with your `Haskell` codebase. +## Supported formats++Convert files between:++- `Haskell` (`.hs`)+- `Literate Haskell` (`.lhs`)+- `GitHub Flavored Markdown` (`.md`)+- `TeX` (`.tex`)+ ## Related works -- [LiterateMarkdown](https://hackage.haskell.org/package/LiterateMarkdown) - `lima` is a fork of this (abandoned?) project.+- [LiterateMarkdown](https://hackage.haskell.org/package/LiterateMarkdown) - `lima` is a fork of this abandoned project.  - [pandoc](https://hackage.haskell.org/package/pandoc) - [supports](https://www.uv.es/wikibase/doc/cas/pandoc_manual_instalado.wiki?60) `Literate Haskell` and a ton of other formats. @@ -14,14 +23,9 @@  - [agda2lagda](https://hackage.haskell.org/package/agda2lagda) - Generate a literate Agda/Haskell script from an Agda/Haskell script. Produces LaTeX or Markdown literate scripts. -- [markdown-unlit](https://hackage.haskell.org/package/markdown-unlit) - `markdown-unlit` is a custom unlit program. It can be used to extract Haskell code from Markdown files..--## Supported formats+- [markdown-unlit](https://hackage.haskell.org/package/markdown-unlit) - `markdown-unlit` is a custom unlit program. It can be used to extract Haskell code from Markdown files. -- `Haskell` (`.hs`)-- `Literate Haskell` (`.lhs`)-- `GitHub Flavored Markdown` (`.md`)-- `TeX` (`.tex`)+- [unlit](https://hackage.haskell.org/package/unlit) - Tool to convert literate code between styles or to code.  ## Demo @@ -39,8 +43,18 @@  ## Ideas +### TL;DR++- `Haskell` files can be type checked and nicely formatted.+- Convert a `Haskell` file with tags (== special comments) to `Markdown` or `TeX`.+- The file is parsed line by line, tags affect parsing of the following lines.+- Usually, it's possible to convert the file back to the source format.++### Full++- A document is a text in a supported format. - I introduced tags into supported formats.-  - E.g., in `.hs` files, tags are multiline comments written on a single line like `{- LIMA_ENABLE -}`.+  - E.g., in `.hs` documents, tags are multiline comments written on a single line like `{- LIMA_ENABLE -}`. - Tag names are configurable.   - A user may set `on` instead of `LIMA_ENABLE`. - A document can be parsed into a list of tokens.@@ -53,11 +67,11 @@ - Such a converter is usually invertible for a formatted document.   - Converting a document `A` to a document `B`, then converting `B` to `A` doesn't change the content of `A`. -## Setup+## Suggested setup  1. Create a test suite. 1. Add `lima` and `text` to its dependencies.-1. Create a test module. It can have the following content.+1. Create a test module. It may have the following content.      <!-- LIMA_INDENT 4 --> @@ -75,10 +89,10 @@  This package has two such test suites: -- [readme-hs-to-md](test/HsToMd/Main.hs) converts `README.hs` to `README.md`-- [readme-md-to-hs](test/MdToHs/Main.hs) converts `README.md` to `README.hs`+- [readme-hs-to-md](test/HsToMd/Main.hs) converts `README.hs` to `README.md`.+- [readme-md-to-hs](test/MdToHs/Main.hs) converts `README.md` to `README.hs`. -## Workflow+## Possible workflow  Here's a possible workflow for `Haskell` and `Markdown`: @@ -90,7 +104,7 @@  ## Contribute -Clone this repo and enter `lima`+Clone this repo and enter `lima`.  ```console git clone https://github.com/deemp/lima
lima.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           lima-version:        0.2.1.2+version:        0.2.1.3 synopsis:       Convert between Haskell, Markdown, Literate Haskell, TeX description:    See the [README.md](https://github.com/deemp/lima#readme) category:       Productivity@@ -19,6 +19,7 @@     CHANGELOG.md     README.md     testdata/md/test.hs+    testdata/md/test.lhs     testdata/md/test.md     testdata/md/tokens.hs     testdata/tex/test.hs
src/Converter.hs view
@@ -52,7 +52,7 @@ --  -- There are several forms of @Haskell@ code blocks in @Literate Haskell@ recognized by @GHC@. ----- 1. Code between @\begin{code}@ and @\end{code}@ tags.+-- 1. Code between @'\\begin{code}'@ and @'\\end{code}'@ tags. -- --     @ --     \begin{code}@@ -63,7 +63,7 @@ --     \end{code} --     @ -- ---     - The line starting with @\begin{code}@ cannot have other non-space characters after @\begin{code}@.+--     - The line starting with @'\\begin{code}'@ cannot have other non-space characters after @'\\begin{code}'@. --     - The indentation of all expressions in code blocks must be the same. -- -- 1. Code lines starting with @'> '@.
+ testdata/md/test.lhs view
@@ -0,0 +1,30 @@+% LIMA_INDENT 3++% LIMA_DISABLE++% -- What's the answer?++% LIMA_ENABLE++% LIMA_INDENT 1++% LIMA_INDENT 2++- Intermediate results++>   a = const 3+>   b = a 4++% LIMA_DEDENT++> answer = b * 14++% Hello from comments,++% world!++% SINGLE_LINE Comment on a single line.++Hello from text,++world!