Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest]
ghc: ['9.2', '9.4']
ghc: ['9.8']
cabal: ['3.10']
include:
- ghc: '9.4'
- ghc: '9.8'
executable: true
steps:
- uses: actions/checkout@v3
Expand Down
22 changes: 17 additions & 5 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@ package *
source-repository-package
type: git
location: https://github.com/lucasvreis/lvar.git
tag: b5c16f1f48a784bdb0578a663c3bb0d355fe0fc6
tag: 7d5d776126df8199a7019fe16dc2e6f7fd5255ee

source-repository-package
type: git
location: https://github.com/lucasvreis/unionmount.git
tag: 5fef2d328b5c15b9feec7ca0dd71d2d403c39941
location: https://github.com/srid/unionmount.git
tag: fb401ce6030e0f516ea105e1f5c400260b3ade33

-- source-repository-package
-- type: git
-- location: https://github.com/lucasvreis/ondim.git
-- tag: e8a1918f979140c7fb72ec7c19315f8d19bd8d60
-- subdir: . ondim-html ondim-pandoc ondim-json ondim-latex

source-repository-package
type: git
location: https://github.com/lucasvreis/ix-cat.git
tag: fbacb089e0e8d231f376e63a6f0616c057450c28

source-repository-package
type: git
location: https://github.com/lucasvreis/ondim.git
tag: 6bbb553d1e75f1a2f45db915804292e80ce01396
location: https://gitlab.com/trupill/kind-generics.git
tag: a38287ccab9de3941c1103cc06090009ff965e50
subdir: kind-generics-th
10 changes: 10 additions & 0 deletions fourmolu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
indentation: 2
function-arrows: trailing
comma-style: leading
import-export-style: leading
indent-wheres: true
record-brace-space: true
newlines-between-decls: 1
haddock-style: multi-line
respectful: true
fixities: []
4 changes: 2 additions & 2 deletions org-cli/app/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ data AppOptions = AppOptions
}

data BackendOptions
= AST {pretty :: Bool}
= AST
| Ondim {ondimOptions :: OndimOptions}

data OndimFormat
Expand Down Expand Up @@ -92,7 +92,7 @@ backend' =
<> command "pandoc" (info pandoc (progDesc "Export to Pandoc JSON using Ondim."))
)
where
ast = AST . not <$> switch (long "no-pretty" <> help "Disable pretty-printing of the parsed AST")
ast = pure AST
html = Ondim <$> ondimOptions' HTML
latex = Ondim <$> ondimOptions' LaTeX
pandoc = Ondim <$> ondimOptions' Pandoc
Expand Down
19 changes: 9 additions & 10 deletions org-cli/app/org-cli.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ module Main where
import Control.Exception (try)
import Data.Text.IO qualified as T
import Ondim
import Ondim.Debug (OndimException)
import Ondim.Extra.Exceptions (prettyException)
import Ondim.Extra.Loading (LoadConfig (..), TemplateLoadingError (..), loadTemplates)
import Ondim.Loading (LoadConfig (..), TemplateLoadingException (..), loadTemplates)
import Ondim.Targets.HTML qualified as H
import Ondim.Targets.LaTeX qualified as L
import Ondim.Targets.Pandoc qualified as P
Expand All @@ -19,18 +20,17 @@ import Org.Exporters.LaTeX qualified as L
import Org.Exporters.Pandoc qualified as P
import Org.Exporters.Processing (OrgData, processAll)
import Org.Parser
import Org.Types (OrgDocument)
import Org.Types.Variants.Annotated (OrgDocument)
import System.Directory qualified as D
import System.FilePath (isDrive, takeDirectory, (</>))
import Text.Pretty.Simple

loadPandoc :: forall m. Monad m => LoadConfig m
loadPandoc :: forall m. (Monad m) => LoadConfig m
loadPandoc = (P.loadPandocMd @m) {initialState = templatesEmbed [P.loadPandocMd]}

loadHtml :: forall m. Monad m => LoadConfig m
loadHtml :: forall m. (Monad m) => LoadConfig m
loadHtml = (H.loadHtml @m) {initialState = templatesEmbed [H.loadHtml]}

loadLaTeX :: forall m. Monad m => LoadConfig m
loadLaTeX :: forall m. (Monad m) => LoadConfig m
loadLaTeX = (L.loadLaTeX @m) {initialState = templatesEmbed [L.loadLaTeX]}

renderDoc ::
Expand All @@ -49,8 +49,8 @@ renderDoc udirs oo datum doc = do
if null dirs
then return $ initialState cfg
else loadTemplates [cfg] dirs
evalOndimTWith tpls $
callTemplateFold @Rendered (O.layout oo)
evalOndimWith tpls $
renderTemplateOrError (O.layout oo)
`binding` documentExp bk datum doc

main :: IO ()
Expand Down Expand Up @@ -86,8 +86,7 @@ main = do
(processed, datum) = processAll parsed
out <- try
case O.backend opts of
O.AST False -> return $ Right $ show processed
O.AST True -> return $ Right $ encodeUtf8 $ pShowNoColor processed
O.AST -> return $ Right $ show processed
O.Ondim oo -> renderDoc udirs oo datum processed
case out of
Right (Right out') -> case O.output opts of
Expand Down
6 changes: 4 additions & 2 deletions org-cli/org-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ executable horg
main-is: org-cli.hs
other-modules: Options
build-depends:
, base >=4.15 && <4.19
, base >=4.17.2 && <4.19
, directory
, filepath
, megaparsec
, ondim
, ondim-html
, ondim-latex
, ondim-pandoc
, optparse-applicative >=0.17.0 && <0.18
, org-exporters
, org-parser
, pandoc
, pretty-simple >=4.1
, relude

ghc-options: -Wall -threaded
Expand Down
40 changes: 24 additions & 16 deletions org-exporters/baseline.csv
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
Name,Mean (ps),2*Stdev (ps)
All.config.Parse,39021067600,3031762928
All.config.Process.process,2722141412,143405412
All.config.Process.Export.html.export,159614359400,6297960142
All.config.Process.Export.html.render.render,1730125718,147106578
All.config.Process.Export.md.export,108419337300,2548007956
All.config.Process.Export.md.render.render,410768689,28265520
All.config.Process.Export.tex.export,52783477100,3147149626
All.config.Process.Export.tex.render.render,106205838500,2512305106
All.diagramas.Parse,19252348600,1912887730
All.diagramas.Process.process,1275592303,82426622
All.diagramas.Process.Export.html.export,33021328950,1155194530
All.diagramas.Process.Export.html.render.render,319007339,21307638
All.diagramas.Process.Export.md.export,47099573600,3057184338
All.diagramas.Process.Export.md.render.render,181065551,12232328
All.diagramas.Process.Export.tex.export,21078764800,1330461452
All.diagramas.Process.Export.tex.render.render,4106936100,191300142
All.config.parsing.bench,32842970800,1732831486
All.config.parsing.processing.bench,2258442325,84087782
All.config.parsing.processing.export.html.export,114053682700,3056975936
All.config.parsing.processing.export.html.render.render,1748998950,93245682
All.config.parsing.processing.export.md.export,73876882400,5872259756
All.config.parsing.processing.export.md.render.render,463439748,36056730
All.config.parsing.processing.export.tex.export,41567682500,2909580596
All.config.parsing.processing.export.tex.render.render,89240492900,2237442264
All.diagramas.parsing.bench,13953423700,1060804512
All.diagramas.parsing.processing.bench,1095703409,82110818
All.diagramas.parsing.processing.export.html.export,23569743650,885944890
All.diagramas.parsing.processing.export.html.render.render,325906117,26743512
All.diagramas.parsing.processing.export.md.export,31710374300,2403231500
All.diagramas.parsing.processing.export.md.render.render,192354867,10728048
All.diagramas.parsing.processing.export.tex.export,18296192350,990760128
All.diagramas.parsing.processing.export.tex.render.render,5496583775,465287396
All.config-tecosaur.parsing.bench,273457942600,14085829374
All.config-tecosaur.parsing.processing.bench,18877885050,1184465778
All.config-tecosaur.parsing.processing.export.html.export,564520696200,9637435540
All.config-tecosaur.parsing.processing.export.html.render.render,8354891500,689611190
All.config-tecosaur.parsing.processing.export.md.export,426179064400,39130553668
All.config-tecosaur.parsing.processing.export.md.render.render,2891376687,223670524
All.config-tecosaur.parsing.processing.export.tex.export,303972845600,15033282680
All.config-tecosaur.parsing.processing.export.tex.render.render,2528484429400,35206187284
2 changes: 1 addition & 1 deletion org-exporters/data/templates/extra/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ul>
<e:this.list section>
<li>
<a href="#${this.anchor}"><e:org.element.headline/></a>
<a href="#${this.id}"><e:org.element.headline/></a>
<e:this.subsections/>
</li>
</e:this.list>
Expand Down
7 changes: 3 additions & 4 deletions org-exporters/data/templates/org/element/paragraph.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<p e:this.affiliated>
<e:this:content/>
</p>
<p e:this.affiliated>
<e:this:content/>
</p>
2 changes: 1 addition & 1 deletion org-exporters/data/templates/org/element/plain-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<e:case ordered-num>
<ol e:this.affiliated style="list-style-type: decimal;">
<e:this.items:list>
<li value?="!(this.counter-set)">
<li value?="${this.counter-set}">
<e:my:checkbox/> <e:my:content/>
</li>
</e:this.items:list>
Expand Down
22 changes: 7 additions & 15 deletions org-exporters/data/templates/org/element/src-block.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@

<div class="org-src-container" e:this.affiliated>
<pre class="src src-${this.language}">
<e:this.lines:list as=line>
<e:match line.type>
<e:case plain>
<e:line.content/><br />
</e:case>
<e:case ref>
<span id="${line.id}" class="coderef-target"><e:line.content/><br /><span class="coderef">(<e:line.ref/>)</span></span>
</e:case>
</e:match>
</e:this.lines:list>
</pre>
</div>
<div class="org-src-container" e:this.affiliated>
<pre class="src src-${this.language}">
<e:this.lines:list as=line>
<e:line.content/><br />
</e:this.lines:list>
</pre>
</div>
4 changes: 2 additions & 2 deletions org-exporters/data/templates/org/sections.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<e:match sections.type>
<e:case normal>
<e:sections:list>
<section id="${this.anchor}">
<section id="${this.id}">
<e:my_hlevel><e:org.element.headline/></e:my_hlevel>
<e:my_planning/>
<e:this:children/>
Expand All @@ -45,7 +45,7 @@
<e:case over-level>
<ol>
<e:sections:list>
<li id="${this.anchor}">
<li id="${this.id}">
<p><b><e:org.element.headline/></b></p>
<e:this:children/>
<e:this:subsections/>
Expand Down
12 changes: 6 additions & 6 deletions org-exporters/data/templates/org/sections.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
::: {.e:bind #heading}
::::{.e:match #sections.level}
:::{.e:case #1}
# []{.e:org.element.headline} {id=!(this.anchor)}
# []{.e:org.element.headline} {id=!(this.id)}
:::
:::{.e:case #2}
## []{.e:org.element.headline} {id=!(this.anchor)}
## []{.e:org.element.headline} {id=!(this.id)}
:::
:::{.e:case #3}
### []{.e:org.element.headline} {id=!(this.anchor)}
### []{.e:org.element.headline} {id=!(this.id)}
:::
:::{.e:case #4}
#### []{.e:org.element.headline} {id=!(this.anchor)}
#### []{.e:org.element.headline} {id=!(this.id)}
:::
:::{.e:case #5}
##### []{.e:org.element.headline} {id=!(this.anchor)}
##### []{.e:org.element.headline} {id=!(this.id)}
:::
:::{.e:case #6}
###### []{.e:org.element.headline} {id=!(this.anchor)}
###### []{.e:org.element.headline} {id=!(this.id)}
:::
::::
:::
Expand Down
4 changes: 2 additions & 2 deletions org-exporters/data/templates/org/sections.tex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
\@case[normal]{
\@this@list[as=section]{%!
\@my@hlevel{}{\@my@headline}
\label{sec:\@section@anchor}
\label{sec:\@section@id}
\@section@children
\@section@subsections
}%!
Expand All @@ -29,7 +29,7 @@
\begin{enumerate}%!
\@this@list[as=section]{
\item \@my@headline
\label{sec:\@section@anchor}
\label{sec:\@section@id}

\@section@children%!
\@section@subsections%!
Expand Down
Loading