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

Improve logging and refactor AST utilities #109

Merged
merged 3 commits into from
Jan 28, 2024
Merged

Conversation

Omikhleia
Copy link
Owner

@Omikhleia Omikhleia commented Jan 28, 2024

I had planned these for some time:

  • refactor: AST utilities are in SU.ast in SILE 0.15-develop and silex.ast provides our compatibility layer for these with SILE 0.14.x, so it an obvious change for the future.
  • fix: Improve error handling in Djot to report location details

The latter greatly improves debugging... Now we get line and colum, and stack details:

! Ignoring unattached attribute near [[…x {.loose}]] at temp/test.dj: in <snippet>:
   	[[{lang="en-GB"}␤:::␤␤Later on...␤x {.loose}␤␤:toto:␤␤--- "Hello world"[^1]␤␤--- Lorem ipsum dolor con]]

! Symbol 'toto' was not expanded (no corresponding metadata found) at temp/test.dj:7:1: in symbol

! Failure to find footnote '1' at temp/test.dj:9:18: in footnote_reference

error summary:
   Processing at: temp/test.dj:9:18: in footnote_reference

Or with -t (snippet):

! Symbol 'toto' was not expanded (no corresponding metadata found) at:
	temp/test.dj:7:1: in symbol
	temp/test.dj:7:1: in para
	temp/test.dj:2:1: in div
	temp/test.dj: in <snippet>:
		[[{lang="en-GB"}␤:::␤␤Later on...␤x {.loose}␤␤:toto:␤␤--- "Hello world"[^1]␤␤--- Lorem ipsum dolor con]]

On the first parsing warning, we don't get line and column details ('cause jgm/djot.lua#14), but at least we can extract and show some bits of text to help with finding and fixing them.

And silex.ast provides our compatibility layer for these with
SILE 0.14.x
@Omikhleia Omikhleia marked this pull request as draft January 28, 2024 20:37
@Omikhleia Omikhleia force-pushed the some-2024-refactors branch from 17c86f6 to 2f3549c Compare January 28, 2024 22:38
@Omikhleia Omikhleia force-pushed the some-2024-refactors branch from 2f3549c to 8c7a22d Compare January 28, 2024 22:41
@Omikhleia Omikhleia changed the title Some 2024 refactors Improve logging and refactor AST utilities Jan 28, 2024
@Omikhleia Omikhleia marked this pull request as ready for review January 28, 2024 22:56
@Omikhleia Omikhleia merged commit efbb8a4 into main Jan 28, 2024
2 checks passed
@Omikhleia Omikhleia deleted the some-2024-refactors branch January 28, 2024 22:57
@Omikhleia Omikhleia self-assigned this Feb 3, 2024
@Omikhleia Omikhleia added bug Something isn't working refactor Something needs to be refactored labels Feb 3, 2024
@Omikhleia Omikhleia added this to the 1.6.0 milestone Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working refactor Something needs to be refactored
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant