pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

Adding new features to the Typst template

Open christopherkenny opened this issue 1 year ago • 18 comments

This implements the changes suggested in #9956, with the exception of the filecolor/urlcolor one. These would require adding some regex to guess the link types. This is theoretically possible to do, but it wasn't clear to me that this is a good thing to put in a default template. Happy to adjust if you have thoughts on this.

Some things to note:

  • I'm converting colors by passing them as content, as I was seeing pandoc escape # if that was included. An alternative here is to just do something like: rgb(linkcolor.replace("\\#", "#")).
  • I set the default fonts for math and code ("raw") to fonts that are bundled with Typst. These need not be those fonts if there are more familiar pandoc preferences.

christopherkenny avatar Jul 10 '24 22:07 christopherkenny

Hi @jgm, I don't want to bother you if this is already on your radar, but should I add you as a reviewer (for when you have time)? I'm not 100% sure of the norms for contributions here.

christopherkenny avatar Aug 22 '24 00:08 christopherkenny

Sorry for the delay on this!

jgm avatar Aug 23 '24 18:08 jgm

Sorry for the long delay on this. I've been on the academic job market and a bit crazed. I'm using Quarto + pandoc + Typst for my dissertation and will resolve these over the next few days while in the midst of this.

christopherkenny avatar Mar 19 '25 02:03 christopherkenny

d05ca30 handles the merging with the pagenumber change

christopherkenny avatar Mar 19 '25 03:03 christopherkenny

Hi @jgm. I've rerequested your review for when you have a chance. These are all now set to be less opinionated and better fit with the default typst settings, especially removing colors and fonts unless specified.

christopherkenny avatar May 03 '25 02:05 christopherkenny

Apologies, spoke too soon on the last message. Just went through and triple checked things and now it is ready for re-review.

christopherkenny avatar May 03 '25 03:05 christopherkenny

looks pretty good -- I made one comment about "Abstract."

jgm avatar May 11 '25 23:05 jgm

The other thing that needs to be done is modifying MANUAL.txt so that the new variables are documented. There should be a section "Variables for Typst."

jgm avatar May 11 '25 23:05 jgm

TODO (for me): set abstract-title variable to a localized default in the typst writer.

jgm avatar May 15 '25 14:05 jgm

  abstractTitle <- translateTerm Abstract

and then when setting template variables,

                  defField "abstract-title" abstractTitle .

jgm avatar May 15 '25 14:05 jgm

The MANUAL.txt and abstract-title defaults are now updated. Thanks for the review!

christopherkenny avatar May 15 '25 14:05 christopherkenny

Looks like the branch has to be rebased on to main in order to be merged cleanly.

jgm avatar May 16 '25 22:05 jgm

So, I just rebased onto main, but I have a strong suspicion that this is not what you wanted. Before doing this, I made a backup branch which is just a copy prior to me rebasing. I can open a clean PR from that if this is not what you wanted.

christopherkenny avatar May 23 '25 02:05 christopherkenny

@christopherkenny -- I had a look at what may have gone wrong with your rebase. My theory is as follows (please correct me if any of this is wrong!):

  • During your work on this branch, you used the 'Update branch' button a few times to merge jgm:main into christopherkenny:typst-template.
  • Your pandoc fork hasn't been synced since June 2024 and so the latest commit on christopherkenny:main is correspondingly old.
  • When you rebased onto main, you therefore rebased onto a commit from June 2024 rather than the latest main. In addition, you ran rebase without the --rebase-merges option, so your merge commits (created previously via the 'Update branch' button) were replaced with all of the respective commits from jgm:main, which is how you ended up with 662 commits on your branch. If the --rebase-merges option had been used, I think the rebase would have had no effect (since the rebase would've been done on the same commit on jgm:main that your branch was branching out from anyway).

To fix this, you could restore your previous version of this branch (via your backup branch), sync your fork (and do a git pull to make sure your local main is up to date as well), and perform an interactive rebase on main, during which you would drop all merge commits.

rnwst avatar May 24 '25 03:05 rnwst

Yeah, that sounds exactly like what happened. Thanks for the help @rnwst. I will get this cleaned up tomorrow.

christopherkenny avatar May 24 '25 03:05 christopherkenny

Thanks @rnwst, that was exactly it. All cleaned up now. Thanks for the help!

christopherkenny avatar May 24 '25 03:05 christopherkenny

Looks like you have opted to undo and then redo (after merging jgm:main) the commit that would be causing a merge conflict, instead of rebasing the whole branch on top of latest jgm:main, which would result in a cleaner commit history. Some of the commit messages could also be tidied up, and perhaps some or all of the commits squashed. But I don't know if @jgm is as pedantic as I am, so let's wait to see what he says.

rnwst avatar May 24 '25 12:05 rnwst

I was thinking this could all be rebased into one commit (unless there's some strong reason for having more than one commit for this change).

jgm avatar May 27 '25 03:05 jgm

Sorry for the delay and thank you for your patience. It is now rebased into 1 commit and all check pass @jgm.

christopherkenny avatar Jun 18 '25 15:06 christopherkenny

I rebased this from the command line and committed it. Thank you!

jgm avatar Jul 24 '25 17:07 jgm

Thanks @jgm and @rnwst for the help and patience.

christopherkenny avatar Jul 25 '25 17:07 christopherkenny