-
Notifications
You must be signed in to change notification settings - Fork 118
fix: generate placeholder text for missing toTex implementations
#518
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1271,17 +1271,15 @@ instance : TeX.GenreTeX Manual (ReaderT ExtensionImpls IO) where | |
| let some descr := (← readThe ExtensionImpls).getBlock? b.name | ||
| | panic! s!"Unknown block {b.name} while rendering.\n\nKnown blocks: {(← readThe ExtensionImpls).blockDescrs.toArray |>.map (·.fst) |>.qsort (·.toString < ·.toString)}" | ||
| let some impl := descr.toTeX | ||
| | TeX.logError s!"Block {b.name} doesn't support TeX" | ||
| return .empty | ||
| | return .command "textcolor" #[] #[ .raw "red", .raw s!"Missing toTeX for Block {b.name}" ] | ||
| impl goI goB id b.data content | ||
| inline go i content := do | ||
| let some id := i.id | ||
| | panic! "Inline {i.name} wasn't assigned an ID during traversal" | ||
| let some descr := (← readThe ExtensionImpls).getInline? i.name | ||
| | panic! s!"Unknown inline {i.name} while rendering.\n\nKnown inlines: {(← readThe ExtensionImpls).inlineDescrs.toArray |>.map (·.fst) |>.qsort (·.toString < ·.toString)}" | ||
| let some impl := descr.toTeX | ||
| | TeX.logError s!"Inline {i.name} doesn't support TeX" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, I think this error message should be retained too. It's good to emit better TeX though.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
| return .empty | ||
| | return .command "textcolor" #[] #[ .raw "red", .raw s!"Missing toTeX for Inline {i.name}" ] | ||
| impl go id i.data content | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,7 +41,7 @@ def logError [Monad m] (message : String) : TeXT g m Unit := do | |
| def header [Monad m] (name : TeX) : TeXT g m TeX := do | ||
| let opts ← options | ||
| let some i := opts.headerLevel | ||
| | logError s!"No more header nesting available at {name.asString}"; return \TeX{\textbf{\Lean{name}}} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should also be a proper error, and it should insert a notice like the other two into the document that is unmistakable.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
| | return \TeX{\textbf{\Lean{name}}} | ||
| let header := opts.headerLevels[i] | ||
| pure <| .raw (s!"\\{header}" ++ "{") ++ name ++ .raw "}" | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this error message should be retained. It's important to prominently tell authors that their document isn't as they expect, without them needing to proofread the resulting text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.