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

Investigate pExpr in the Markdown printer #3840

Open
BilalM04 opened this issue Jul 9, 2024 · 1 comment
Open

Investigate pExpr in the Markdown printer #3840

BilalM04 opened this issue Jul 9, 2024 · 1 comment
Labels
design Related to the current design of Drasil (not artifacts).

Comments

@BilalM04
Copy link
Collaborator

BilalM04 commented Jul 9, 2024

Current state of pExpr is detailed in #3823 (comment).

pExpr re-defines all the patterns that are different, then delegates to the TeX function in a catch all statement. But since the pExpr function involves recursive calls, the patterns which make a recursive call are redefined as well, leading to some duplication. This is because the current TeX.pExpr does not account for variabilities in the LaTeX commands.

The pExpr function in the Markdown printer needs to be revisited to avoid duplication. Additionally, the TeX.pExpr function needs to be revisited to account for variabilities in syntax.

@BilalM04 BilalM04 added the design Related to the current design of Drasil (not artifacts). label Jul 9, 2024
@JacquesCarette
Copy link
Owner

I think the (inevitable) conclusion here is that pExpr implements a context-dependent translation process. So we need to understand what the variabilities are, and what drives the choices between the options. Also, because of the clear duplication, it may well be that we need to do a bit more abstraction to get there.

One technical point to keep in mind: right now, we generate a raw Doc. I think we're hitting the limits of this context-free method of doing things. We might need to do

newtype TeXDoc = TeX Doc
newtype MarkdownDoc = MD Doc

which are then still essentially a Doc but we have additional information available that we can dispatch on (with Haskell's type classes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Related to the current design of Drasil (not artifacts).
Projects
None yet
Development

No branches or pull requests

2 participants