[cm6] Include affiliation in document preamble (#14824)

* [cm6] Include affiliation in document preamble

* add affil command

* Add mapping to attributeValue

---------

Co-authored-by: Alf Eaton <alf.eaton@overleaf.com>
GitOrigin-RevId: 6034e07bc5fec23ea704d820acbbe4e77caba651
This commit is contained in:
Domagoj Kriskovic 2023-09-20 17:18:18 +02:00 committed by Copybot
parent 20f49ae325
commit f7cf7b9028
4 changed files with 23 additions and 0 deletions

View file

@ -217,6 +217,14 @@ export const atomicDecorations = (options: Options) => {
preamble.authors.push({ node, content })
preamble.to = nodeRef.node.to
}
} else if (
nodeRef.node.type.is('Affil') ||
nodeRef.node.type.is('Affiliation')
) {
const node = nodeRef.node.getChild('TextArgument')
if (node) {
preamble.to = nodeRef.node.to
}
}
if (nodeRef.type.is('$Environment')) {

View file

@ -178,6 +178,9 @@ export const LaTeXLanguage = LRLanguage.define({
Comment: t.comment,
'UsePackage/OptionalArgument/ShortOptionalArg/Normal': t.attributeValue,
'UsePackage/ShortTextArgument/ShortArg/Normal': t.tagName,
'Affiliation/OptionalArgument/ShortOptionalArg/Normal':
t.attributeValue,
'Affil/OptionalArgument/ShortOptionalArg/Normal': t.attributeValue,
'LiteralArgContent VerbContent VerbatimContent LstInlineContent':
t.string,
'NewCommand/LiteralArgContent': t.typeName,

View file

@ -88,6 +88,8 @@
BibliographyCtrlSeq,
BibliographyStyleCtrlSeq,
AuthorCtrlSeq,
AffilCtrlSeq,
AffiliationCtrlSeq,
MaketitleCtrlSeq,
TextColorCtrlSeq,
ColorBoxCtrlSeq,
@ -241,6 +243,12 @@ KnownCommand {
Author {
AuthorCtrlSeq optionalWhitespace? OptionalArgument? optionalWhitespace? TextArgument
} |
Affil {
AffilCtrlSeq optionalWhitespace? OptionalArgument? optionalWhitespace? TextArgument
} |
Affiliation {
AffiliationCtrlSeq optionalWhitespace? OptionalArgument? optionalWhitespace? TextArgument
} |
DocumentClass {
DocumentClassCtrlSeq optionalWhitespace? OptionalArgument?
DocumentClassArgument { ShortTextArgument }

View file

@ -24,6 +24,8 @@ import {
HboxCtrlSeq,
TitleCtrlSeq,
AuthorCtrlSeq,
AffilCtrlSeq,
AffiliationCtrlSeq,
DocumentClassCtrlSeq,
UsePackageCtrlSeq,
HrefCtrlSeq,
@ -589,6 +591,8 @@ const otherKnowncommands = {
'\\hbox': HboxCtrlSeq,
'\\title': TitleCtrlSeq,
'\\author': AuthorCtrlSeq,
'\\affil': AffilCtrlSeq,
'\\affiliation': AffiliationCtrlSeq,
'\\documentclass': DocumentClassCtrlSeq,
'\\usepackage': UsePackageCtrlSeq,
'\\href': HrefCtrlSeq,