Merge pull request #14227 from overleaf/mj-table-gen-booktabs

[visual] Support booktabs horizontal borders

GitOrigin-RevId: 9e59341b514c667fbba4154e6316274f9e42db3d
This commit is contained in:
Mathias Jakobsen 2023-08-14 09:15:52 +01:00 committed by Copybot
parent 6d8c8e678e
commit 63b09c3da3
3 changed files with 14 additions and 5 deletions

View file

@ -71,7 +71,7 @@ const isRowSeparator = (node: SyntaxNode, state: EditorState) =>
const isHLine = (node: SyntaxNode) =>
node.type.is('Command') &&
Boolean(node.getChild('KnownCommand')?.getChild('HLine'))
Boolean(node.getChild('KnownCommand')?.getChild('HorizontalLine'))
type Position = {
from: number

View file

@ -90,8 +90,11 @@
AuthorCtrlSeq,
MaketitleCtrlSeq,
TextColorCtrlSeq,
ColorBoxCtrlSeq
HLineCtrlSeq
ColorBoxCtrlSeq,
HLineCtrlSeq,
TopRuleCtrlSeq,
MidRuleCtrlSeq,
BottomRuleCtrlSeq
}
@external specialize {EnvName} specializeEnvName from "./tokens.mjs" {
@ -338,8 +341,8 @@ KnownCommand {
Maketitle {
MaketitleCtrlSeq optionalWhitespace?
} |
HLine {
HLineCtrlSeq optionalWhitespace?
HorizontalLine {
(HLineCtrlSeq | TopRuleCtrlSeq | MidRuleCtrlSeq | BottomRuleCtrlSeq) optionalWhitespace?
}
}

View file

@ -73,6 +73,9 @@ import {
TextColorCtrlSeq,
ColorBoxCtrlSeq,
HLineCtrlSeq,
TopRuleCtrlSeq,
MidRuleCtrlSeq,
BottomRuleCtrlSeq,
} from './latex.terms.mjs'
function nameChar(ch) {
@ -622,6 +625,9 @@ const otherKnowncommands = {
'\\textcolor': TextColorCtrlSeq,
'\\colorbox': ColorBoxCtrlSeq,
'\\hline': HLineCtrlSeq,
'\\toprule': TopRuleCtrlSeq,
'\\midrule': MidRuleCtrlSeq,
'\\bottomrule': BottomRuleCtrlSeq,
}
// specializer for control sequences
// return new tokens for specific control sequences