Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
6 changes: 2 additions & 4 deletions src/verso-manual/VersoManual/Basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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 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"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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


Expand Down
2 changes: 1 addition & 1 deletion src/verso/Verso/Doc/TeX.lean
Original file line number Diff line number Diff line change
Expand Up @@ -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}}}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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 "}"

Expand Down