jgm / jgm/typst-hs

Typst: Counter does not have a method "get" or FieldAccess requires a dictionary

Open
#79 1 comment 2 reactions 0 assignees View on GitHub
bug
Dominant language
Haskell
Stars
76
Forks
11
Avg merge
9h 5m
Merged PRs (30d)
1

Description

**Explain the problem.**
Include the **exact command line** you used and **all inputs necessary to reproduce the issue**. Please create as minimal an example as possible, to help the maintainers isolate the problem. Explain the output you received and how it differs from what you expected.

Here's the command I run and the output:
```
pandoc counter_get.typ -f typst -t docx -o test-out.docx
"counter_get.typ" (line 1, column 2):
Counter does not have a method "get" or FieldAccess requires a dictionary
```

Here's the content of `counter_get.typ`:
```
#let footer-context = context {
let pagee = counter(page).get().first()
align(if calc.odd(pagee) { right } else { left })[
#counter(page).display()
]
}
#set page(footer: footer-context)

Hello

```

The expected output is the page number alignment switching between left left right each page.

**Pandoc version?**
What version of pandoc are you using, on what OS? (If it's not the latest release, please try with the latest release before reporting the issue. Note that many linux distributions have old versions of pandoc in their repositories.)
Version 3.8.2.1 on MacOS, building it locally.

Thanks again for all the work on this one!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the minimal counter_get.typ example and run `pandoc counter_get.typ -f typst -t docx -o test-out.docx` to reproduce the error. Trace how `counter(page).get().first()` is handled during Typst parsing or evaluation. Done means the command succeeds and the footer page-number alignment switches as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.