Skip to content

[WiP] Frontmatter refactor#2767

Open
brucemiller wants to merge 34 commits intomasterfrom
frontmatter-refactor
Open

[WiP] Frontmatter refactor#2767
brucemiller wants to merge 34 commits intomasterfrom
frontmatter-refactor

Conversation

@brucemiller
Copy link
Copy Markdown
Owner

Revised infrastructure for managing frontmatter, especially navigating the maze of strategies used in different classes to associate a document creator (author, editor, ...) with various contact information (affiliation, address, email, ...).
Classic LaTeX uses only \author with multiple authors separated by \and, and affiliations (presumably) separated from each author by \\. Others use \author for single authors, followed by commands for \affiliation, etc. Another scheme uses \inst{marks} within the author, and the marks refer to marks in the affiliation, or the sequence, Or, or, or.

Will need to flesh out the description here. But while it's too early for a full review, it's a good time to start scoping out the scheme; There's undoubtedly lots of not-quite-right about. Probably easiest approach is to pick a class you're fond of and see how the binding has changed, whether it's readable, sensible, even intuitive?

@brucemiller brucemiller requested a review from dginev as a code owner March 5, 2026 00:01
Copy link
Copy Markdown
Collaborator

@dginev dginev left a comment

Choose a reason for hiding this comment

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

I have completed an initial read of the PR and am very encouraged. Congratulations on a much cleaner framework! I left some minor comments and will now proceed to testing out the branch on various examples.

If you want to rebase it on the latest master and pass CI, that would be helpful too.

### return ($marks ? map { CleanLabel($_, $prefix); } split(',', $marks) : ()); }
my @marks = ();
foreach my $mark (split(',', $marks)) {
$mark = ToString($mark);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Doesn't split(',' above already assume that $marks is a string? So this ToString call is unnecessary.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Doh!

my ($stomach, $kv, $content) = @_;
my $frontmatter = LookupValue('frontmatter');
my %options = ($kv ? $kv->beDigested($stomach)->getHash : ());
my $role = ToString($options{role}) || '';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Early quit, or Error, if $role isn't set?

Reading the body, we can get some strange behaviors using an empty string $role.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Not sure it should be disallowed, or error, but certainly should protect from nonsense! (kinda messy though)

'\lx@add@creator[role=author]{#2\lx@aas@checkorchid{#1}}');
DefMacro('\lx@aas@checkorchid{}', '\lx@aas@checkorchid@#1,\done');
# In later aas, $junk make be keywords? (gname,sname,suffix,...?)
DefMacro('\lx@aas@checkorchid@ Until:, Until:\done', sub {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mildly concerned that the PR uses both Until:\done and Until:\\done. Should we standardize to single backslash for Until: and Match: ?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Ugh! Perl!! Ugh!

DefMacro('\lx@aas@checkorchid@ Until:, Until:\done', sub {
my ($gullet, $possibleid, $junk) = @_;
if (ToString($possibleid) =~ /^\s*\d\d\d\d-\d\d\d\d-\d\d\d\d-\d\d\d\d\s*$/) {
return Invocation('\lx@add@contact[role=orcid]{#1}', $possibleid); }
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice Invocation upgrade!

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Why Thanks!! :>

brucemiller and others added 26 commits March 10, 2026 14:31
…s and email when either a sequence mark or labels are used to link them; use role=affiliation consistently, instead of institute; more consistent internal macro naming
…content) for better CSS control of appearance
…y multiple \emailAdd attach to authors (sequentially)
…hen being processed WITHIN stored (previously deferred) frontmatter
…f it is a string containing parameter tokens
…text, and converting role=orcid into an orcid link
…ort for marks to connect contacts to creators
…een author/affiliation work via marks; improve trailing \\ removal from frontmatter
@brucemiller brucemiller force-pushed the frontmatter-refactor branch from e5120f7 to 8784919 Compare March 10, 2026 20:57
… new \lx@add@to@frontmatter; begin more shorthands
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