-
Notifications
You must be signed in to change notification settings - Fork 331
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
Draft of css to typst property translation #9387
Conversation
I don't think we've decided that. IIRC we don't really have anything like it right now in the codebase. The natural place for it is somewhere inside |
I think (but not sure) that the stream redirection you're using in |
Definitely not trivial to integrate this due to the weird lua-to-deno script execution. I've switched to using There are 7 CSS properties as features in the matrix, with 8 tests. Think I'm ready to put this down for now. Maybe we can figure out the remaining issues next week. |
I made the code at least somewhat portable by using However, EDIT: it may not be a bad idea to add Since the tests for these features are only in the feature-format matrix, it looks like I'm going to need to take a stab at a runner for matrix tests. |
70293ee
to
25de518
Compare
note still bad path to bootstrap not sure if it's helping
for consistent output
QUARTO_DENO is only defined during rendering, wretched --cached hack seems to work in tests
note oceanea is failing
more accurate, easier to see what happened
d415ca1
to
e012421
Compare
Hurray, all tests pass with cleaned up imports and paths/env usage. Remaining work:
We're also waiting for the next Pandoc release. |
Subsumed by #9619 |
Hi @cscheid! Thought I'd open a draft to show my work in progress on translation of CSS properties to Typst.
There are a few loose ends:
The
juice.ts
script is not integratedjuice
from the 'Net rather than using import mapswrong locationsrc/resources/scripts
parsehtml.lua
has hard-coded paths (wish I could disable tests for a draft PR, obv this won't work)parsehtml.lua
has to use a temporary file because the standard Lua library does not supportio.popen()
with both read and writejuice-in.html
which probably needs to be made more unique, and cleaned up.juice
output before it is parsed by Pandoc, but I see no need forkeep-juice
.typst-css-to-props.lua
is only a bare-bones implementation of the translator. It only handles tables and table cells, and only a handful of properties:font-family
,font-size
but notfont
shorthandbackground-color
, (text)color
but no synonymsvertical-align
- Pandoc does horizontaltext-align
itself, and the writer coalesces Typst'salign
property.(skipping for now, see below)padding-{left,top,right,bottom}
but notpadding
shorthandborder-{left,top,right-bottom}-{width,color,style}
but not shorthands likeborder
,border-left
,border-color
Pandoc also has support for Typst property output on divs and spans, but those are unused here so far.
Shorthands and more elements would require a little thought, particularly because Typst is statically typed and any mistakes lead to errors.
One nice thing about this design is that users can add their own filters if they want a property we don't support. I did all my development just using
filters:
in my notebook, and only integratedtypst-css-to-props.lua
today.It needs tests in the FF matrix (I propose a top-level folder called CSS). Will write those today and push to this branch.
I don't propose to merge this until the next Pandoc release, just want to wrap it up while it's fresh in my mind.