summaryrefslogtreecommitdiff
path: root/src/Doc.lhs
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2020-08-24 17:09:34 +0200
committerLars-Dominik Braun <lars@6xq.net>2020-08-24 17:09:34 +0200
commit295dd897297722d07ec2ce5fb82e323fe495c775 (patch)
tree8d9de652a030c34c6be775ca31c159620f52fbf1 /src/Doc.lhs
parent39f9263fa38c32ce2e3a4f4bedb8349da47a3200 (diff)
downloadpesto-295dd897297722d07ec2ce5fb82e323fe495c775.tar.gz
pesto-295dd897297722d07ec2ce5fb82e323fe495c775.tar.bz2
pesto-295dd897297722d07ec2ce5fb82e323fe495c775.zip
GHC 8.8, cabal 3, pandoc 2.10 compatibility
Move files around to separate Pesto (the library) and Pesto (the executables). Fixes for pandoc API changes.
Diffstat (limited to 'src/Doc.lhs')
-rw-r--r--src/Doc.lhs61
1 files changed, 0 insertions, 61 deletions
diff --git a/src/Doc.lhs b/src/Doc.lhs
deleted file mode 100644
index a0d5121..0000000
--- a/src/Doc.lhs
+++ /dev/null
@@ -1,61 +0,0 @@
-Building documentation
-++++++++++++++++++++++
-
-.. class:: nodoc
-
-> {-# 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)
-
-The documentation can be generated running ``cabal run pesto-doc``. It is
-exclusively based on the restructuredText inside this packages’ literal Haskell
-source code.
-
-.. _restructuredText: http://docutils.sourceforge.net/rst.html
-
-> readDoc = readRST def {
-> readerExtensions = extensionsFromList [
-> Ext_literate_haskell
-> , Ext_implicit_header_references
-> ]
-> , readerStandalone = True }
-
-.. _Pandoc: http://www.pandoc.org/
-
-Pandoc_ outputs a single HTML5 page with syntax highlighting and MathJax for
-formulas.
-
-> writeDoc tpl = writeHtml5String def {
-> writerTemplate = Just 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")]
-> }
-
-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"
-> doc <- TIO.readFile "Pesto.lhs"
-> result <- runIO $ readDoc doc >>= writeDoc tpl
-> setCurrentDirectory "../../"
-> html <- handleError result
-
-Output is written to the directory ``_build``, which contains the corresponding
-stylesheet.
-
-> TIO.writeFile "_build/index.html" html
-