summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exe/Doc.lhs (renamed from src/Doc.lhs)27
-rw-r--r--src/exe/Main.lhs (renamed from src/Main.lhs)1
-rw-r--r--src/exe/Test.lhs (renamed from src/Test.lhs)0
-rw-r--r--src/lib/Codec/Pesto.lhs (renamed from src/Codec/Pesto.lhs)6
-rw-r--r--src/lib/Codec/Pesto/Graph.lhs (renamed from src/Codec/Pesto/Graph.lhs)0
-rw-r--r--src/lib/Codec/Pesto/Lint.lhs (renamed from src/Codec/Pesto/Lint.lhs)5
-rw-r--r--src/lib/Codec/Pesto/Parse.lhs (renamed from src/Codec/Pesto/Parse.lhs)0
-rw-r--r--src/lib/Codec/Pesto/Parse.lhs-boot (renamed from src/Codec/Pesto/Parse.lhs-boot)0
-rw-r--r--src/lib/Codec/Pesto/Serialize.lhs (renamed from src/Codec/Pesto/Serialize.lhs)0
9 files changed, 21 insertions, 18 deletions
diff --git a/src/Doc.lhs b/src/exe/Doc.lhs
index a0d5121..63e9847 100644
--- a/src/Doc.lhs
+++ b/src/exe/Doc.lhs
@@ -5,11 +5,13 @@ Building documentation
> {-# LANGUAGE OverloadedStrings #-}
> import Text.Pandoc
-> import Text.Pandoc.Error (handleError)
-> import Text.Pandoc.Extensions (extensionsFromList)
> import Text.Pandoc.Highlighting (tango)
> import qualified Data.Text.IO as TIO
> import System.Directory (setCurrentDirectory)
+> import Data.Map as M
+> import Text.DocTemplates (ToContext(toVal), Context(..))
+> import Data.Text (pack)
+> import Data.Either.Combinators (rightToMaybe)
The documentation can be generated running ``cabal run pesto-doc``. It is
exclusively based on the restructuredText inside this packages’ literal Haskell
@@ -30,28 +32,31 @@ Pandoc_ outputs a single HTML5 page with syntax highlighting and MathJax for
formulas.
> writeDoc tpl = writeHtml5String def {
-> writerTemplate = Just tpl
+> writerTemplate = tpl
> , writerHighlightStyle = Just tango
> , writerNumberSections = True
> , writerSectionDivs = True
> , writerTabStop = 4
> , writerHTMLMathMethod = MathJax "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
-> , writerVariables = [("css", "pesto.css"), ("lang", "en")]
+> , writerVariables = Context $ M.fromList [
+> ("css", toVal $ pack "pesto.css")
+> , ("lang", toVal $ pack "en")
+> , ("include-before", toVal $ pack "<div class=\"wrapper\">")
+> , ("include-after", toVal $ pack "</div>")
+> ]
> }
-
-A slightly customized template is used.
-
+>
> main = do
-> tpl <- readFile "template.html"
The module Codec.Pesto serves as starting point and it includes every other
module in a sensible order. For the relative includes to work, we need to
change our current working directory.
-> setCurrentDirectory "src/Codec"
+> tpl <- runIO $ compileDefaultTemplate "html5"
+> setCurrentDirectory "src/lib/Codec"
> doc <- TIO.readFile "Pesto.lhs"
-> result <- runIO $ readDoc doc >>= writeDoc tpl
-> setCurrentDirectory "../../"
+> result <- runIO $ readDoc doc >>= writeDoc (rightToMaybe tpl)
+> setCurrentDirectory "../../../"
> html <- handleError result
Output is written to the directory ``_build``, which contains the corresponding
diff --git a/src/Main.lhs b/src/exe/Main.lhs
index 61ed180..2f67ffd 100644
--- a/src/Main.lhs
+++ b/src/exe/Main.lhs
@@ -6,7 +6,6 @@ User interface
> module Main (main) where
> import System.Environment (getArgs)
> import Data.List (intercalate)
-> import Data.Monoid ((<>))
>
> import Codec.Pesto.Parse (parse, Instruction (Ingredient), Quantity (..))
> import Codec.Pesto.Graph (extract, toGraph, firstNodeId, resolveReferences)
diff --git a/src/Test.lhs b/src/exe/Test.lhs
index 400192e..400192e 100644
--- a/src/Test.lhs
+++ b/src/exe/Test.lhs
diff --git a/src/Codec/Pesto.lhs b/src/lib/Codec/Pesto.lhs
index 098f9cb..6940b4c 100644
--- a/src/Codec/Pesto.lhs
+++ b/src/lib/Codec/Pesto.lhs
@@ -280,7 +280,7 @@ This project uses cabal. It provides the Codec.Pesto library that implements
the Pesto language as described in the previous sections. It also comes with
three binaries.
-.. include:: ../Main.lhs
-.. include:: ../Test.lhs
-.. include:: ../Doc.lhs
+.. include:: ../../exe/Main.lhs
+.. include:: ../../exe/Test.lhs
+.. include:: ../../exe/Doc.lhs
diff --git a/src/Codec/Pesto/Graph.lhs b/src/lib/Codec/Pesto/Graph.lhs
index 511adca..511adca 100644
--- a/src/Codec/Pesto/Graph.lhs
+++ b/src/lib/Codec/Pesto/Graph.lhs
diff --git a/src/Codec/Pesto/Lint.lhs b/src/lib/Codec/Pesto/Lint.lhs
index 81cb5d6..bc99e14 100644
--- a/src/Codec/Pesto/Lint.lhs
+++ b/src/lib/Codec/Pesto/Lint.lhs
@@ -122,9 +122,8 @@ Both, title and description, are implicit.
> "title"
> , "description"
-The recipe’s language, as 2 character code (`ISO 639-1`__).
-
-__ http://www.loc.gov/standards/iso639-2/php/English_list.php
+The recipe’s language, as 2 character code (`ISO 639-1
+<http://www.loc.gov/standards/iso639-2/php/English_list.php>`_).
> , "language"
diff --git a/src/Codec/Pesto/Parse.lhs b/src/lib/Codec/Pesto/Parse.lhs
index 518b866..518b866 100644
--- a/src/Codec/Pesto/Parse.lhs
+++ b/src/lib/Codec/Pesto/Parse.lhs
diff --git a/src/Codec/Pesto/Parse.lhs-boot b/src/lib/Codec/Pesto/Parse.lhs-boot
index 9096ad7..9096ad7 100644
--- a/src/Codec/Pesto/Parse.lhs-boot
+++ b/src/lib/Codec/Pesto/Parse.lhs-boot
diff --git a/src/Codec/Pesto/Serialize.lhs b/src/lib/Codec/Pesto/Serialize.lhs
index f07e871..f07e871 100644
--- a/src/Codec/Pesto/Serialize.lhs
+++ b/src/lib/Codec/Pesto/Serialize.lhs