Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues related to LaTeX #598

Merged
merged 4 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
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
15 changes: 13 additions & 2 deletions eo-phi-normalizer/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ main = withUtf8 do
Nothing -> do
ruleSet :: RuleSet <- decodeThrow $(embedFileRelative "test/eo/phi/rules/new.yaml")
return (False, ruleSet.title, convertRuleNamed <$> ruleSet.rules)
unless (single || json || (chain && latex)) $ logStrLn ruleSetTitle
unless (single || json || latex) $ logStrLn ruleSetTitle
bindingsWithDeps <- case deepMergePrograms (program' : deps) of
Left err -> throw (CouldNotMergeDependencies err)
Right (Program bindingsWithDeps) -> return bindingsWithDeps
Expand Down Expand Up @@ -647,8 +647,19 @@ main = withUtf8 do
logStrLn [fmtTrim|{linesCombined}|]
logStrLn "\\end{phiquation*}"
logStrLn "\n\\end{document}"
| latex ->
| latex -> do
logStrLn
[fmtTrim|
% {ruleSetTitle}

\\documentclass{{article}}
\\usepackage{{eolang}}
\\begin{{document}}
|]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines together with the line that prints "\n\end{document}" can be moved into a separate function parameterized by an IO action. The function can be reused in the chain && latex case.

logStrLn "\\begin{phiquation*}"
logStrLn . toLatexString $ logEntryLog (head (head uniqueResults))
logStrLn "\\end{phiquation*}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines can be moved into a separate function parameterized by a String. The function can be reused in the chain && latex case.

logStrLn "\n\\end{document}"
| otherwise -> do
logStrLn "Input:"
logStrLn (printTree program')
Expand Down
Loading