Skip to content

Feature/multi author support#25

Open
cbr4l0k wants to merge 8 commits intopiepert:mainfrom
cbr4l0k:feature/multi-author-support
Open

Feature/multi author support#25
cbr4l0k wants to merge 8 commits intopiepert:mainfrom
cbr4l0k:feature/multi-author-support

Conversation

@cbr4l0k
Copy link
Copy Markdown
Contributor

@cbr4l0k cbr4l0k commented Feb 19, 2026

Just had this problem, for a group assignment. I know you are busy, and I'm currently mainly running my own version... so if you find it useful you can apply the implementation. Have a good one as always.

Copy link
Copy Markdown
Owner

@piepert piepert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like your idea. I'm sorry if I am opinionated on this, but I'd like to make sure that this package stays consistent in aesthetics and API design. So my intuition might be a bit nitpicky with your changes or how to approach this generally.

Some general ideas for this PR that I'm not going to review individually for each file:

  • I thought about every template offering a format-authors: (authors) => ... function that makes it customizable how the authors are formatted. But maybe it's just okay to not have this function and just be opinionated about how authors are displayed. I'd like to hear your thoughts on this.
  • Maybe the old author attribute can be deleted. At least I don't want to see templates where both author and authors are used in the same template functions. I tend to author and then just give it an array if there are multiple authors like you implemented. The package has to check if author is either (1) a single string like currently implemented, (2) just one author dictionary (name, email, ...) or (3) an array of authors just like you implemented. After normalization, formatting it could be handled by the format-authors function.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we already have enough example files and the examples don't need to display every possible version of a document. So I think it'd be best if no new example files are added.

table(columns: (auto, auto, auto, auto),
stroke: white,
inset: 0cm,
if is-multi-author {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest this:

if is-multi-author {
    stack(
        spacing: 3em,

        ..normalized-authors.map(e => grid(columns: 2,
            row-gutter: 2em,
            column-gutter: 1em,

            strong[Ort, Datum: ], box(width: 1fr, repeat(".", gap: 0.1em)),
            strong[Unterschrift: ], box(width: 1fr, repeat(".", gap: 0.1em)),
            none, [#v(-1em) (#e.name)]
        ))
    )
} else { ...

(
name: item.at("name"),
email: _dict-get(item, "email"),
student-number: _dict-get(item, "student-number", aliases: ("student_number",)),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aliases? I don't think it's a task of the package to correct users' typing mistakes.

if authors.len() == 0 {
none
} else {
authors.map(author => [
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, a bit hacky, but I'd suggest the following for more natural spacing:

box(stack(spacing: 1em, ..authors.map(author => [
    #let name = author-name(author, link-names: link-names)
    #let student-number = author.at("student-number")
    #if student-number != none {
        name + [ (#student-number)]
    } else {
        name
    }
    #if author.at("address") != none [\ #author.at("address")]
])))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants