@unified-latex/unified-latex-ctan
Advanced tools
Comparing version 1.2.2 to 1.3.0
{ | ||
"name": "@unified-latex/unified-latex-ctan", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "unified-latex tools relating to specific CTAN packages", | ||
@@ -8,14 +8,16 @@ "main": "index.js", | ||
"dependencies": { | ||
"@unified-latex/unified-latex-builder": "^1.2.2", | ||
"@unified-latex/unified-latex-types": "^1.2.2", | ||
"@unified-latex/unified-latex-util-arguments": "^1.2.2", | ||
"@unified-latex/unified-latex-util-comments": "^1.2.2", | ||
"@unified-latex/unified-latex-util-match": "^1.2.2", | ||
"@unified-latex/unified-latex-util-pegjs": "^1.2.2", | ||
"@unified-latex/unified-latex-util-print-raw": "^1.2.2", | ||
"@unified-latex/unified-latex-util-render-info": "^1.2.2", | ||
"@unified-latex/unified-latex-util-replace": "^1.2.2", | ||
"@unified-latex/unified-latex-util-split": "^1.2.2", | ||
"@unified-latex/unified-latex-util-trim": "^1.2.2", | ||
"@unified-latex/unified-latex-util-visit": "^1.2.2", | ||
"@unified-latex/unified-latex-builder": "^1.3.0", | ||
"@unified-latex/unified-latex-types": "^1.3.0", | ||
"@unified-latex/unified-latex-util-argspec": "^1.3.0", | ||
"@unified-latex/unified-latex-util-arguments": "^1.3.0", | ||
"@unified-latex/unified-latex-util-comments": "^1.3.0", | ||
"@unified-latex/unified-latex-util-match": "^1.3.0", | ||
"@unified-latex/unified-latex-util-pegjs": "^1.3.0", | ||
"@unified-latex/unified-latex-util-print-raw": "^1.3.0", | ||
"@unified-latex/unified-latex-util-render-info": "^1.3.0", | ||
"@unified-latex/unified-latex-util-replace": "^1.3.0", | ||
"@unified-latex/unified-latex-util-scan": "^1.3.0", | ||
"@unified-latex/unified-latex-util-split": "^1.3.0", | ||
"@unified-latex/unified-latex-util-trim": "^1.3.0", | ||
"@unified-latex/unified-latex-util-visit": "^1.3.0", | ||
"color": "^4.2.3" | ||
@@ -22,0 +24,0 @@ }, |
@@ -105,2 +105,3 @@ // package/beamer/provides.ts | ||
label: { signature: "d<> o m" }, | ||
// cleveref adds an optional argument to label; this gives maximum compatibility. | ||
action: { signature: "d<> m" }, | ||
@@ -138,2 +139,4 @@ beamerdefaultoverlayspecification: { signature: "m" }, | ||
hyperlinkmute: { signature: "m", renderInfo: { breakAround: true } }, | ||
// These signatures conflict with the default signatures. | ||
// Care must be taken when processing an AST. | ||
section: { | ||
@@ -140,0 +143,0 @@ signature: "s d<> o m", |
@@ -21,2 +21,4 @@ // package/cleveref/provides.ts | ||
crefname: { signature: "m m m" }, | ||
// XXX there are many more obscure commands to add here | ||
// https://ctan.org/pkg/cleveref | ||
crefdefaultlabelformat: { signature: "m" }, | ||
@@ -23,0 +25,0 @@ crefrangeconjunction: { signature: "m" } |
@@ -75,5 +75,8 @@ // package/latex2e/provides.ts | ||
var macros = { | ||
// Special | ||
"\\": { signature: "!s o" }, | ||
_: { signature: "m", escapeToken: "" }, | ||
"^": { signature: "m", escapeToken: "" }, | ||
// \newcommand arg signature from https://www.texdev.net/2020/08/19/the-good-the-bad-and-the-ugly-creating-document-commands | ||
// List can be found in latex2e.pdf "An unofficial reference manual" | ||
newcommand: { | ||
@@ -97,2 +100,3 @@ signature: "s +m o +o +m", | ||
}, | ||
// Counters | ||
newcounter: { | ||
@@ -121,2 +125,3 @@ signature: "m o", | ||
}, | ||
// Lengths | ||
newlength: { | ||
@@ -142,2 +147,3 @@ signature: "m", | ||
}, | ||
// Spaces | ||
stretch: { signature: "m" }, | ||
@@ -167,2 +173,3 @@ hspace: { signature: "s m" }, | ||
nopagebreak: { signature: "o", renderInfo: { breakAround: true } }, | ||
// Boxes | ||
newsavebox: { | ||
@@ -194,2 +201,3 @@ signature: "m", | ||
resizebox: { signature: "s m m m" }, | ||
// Define environments | ||
newenvironment: { | ||
@@ -211,2 +219,3 @@ signature: "s m o o m m", | ||
}, | ||
// Counters | ||
alph: { signature: "m" }, | ||
@@ -218,2 +227,3 @@ Alph: { signature: "m" }, | ||
fnsymbol: { signature: "m" }, | ||
// Other | ||
documentclass: { | ||
@@ -248,2 +258,3 @@ signature: "o m", | ||
}, | ||
// Math Commands | ||
sqrt: { signature: "o m", renderInfo: { inMathMode: true } }, | ||
@@ -253,2 +264,3 @@ frac: { signature: "m m", renderInfo: { inMathMode: true } }, | ||
ensuremath: { signature: "m", renderInfo: { inMathMode: true } }, | ||
// Layout commands | ||
abstract: { | ||
@@ -270,2 +282,3 @@ signature: "m", | ||
}, | ||
// amsart document class adds an optional argument | ||
title: { | ||
@@ -278,2 +291,3 @@ signature: "o m", | ||
thispagestyle: { signature: "m", renderInfo: { breakAround: true } }, | ||
// Colors | ||
definecolor: { signature: "m m m", renderInfo: { breakAround: true } }, | ||
@@ -283,2 +297,3 @@ pagecolor: { signature: "o m", renderInfo: { breakAround: true } }, | ||
multicolumn: { signature: "m m m" }, | ||
// Graphics | ||
includegraphics: { | ||
@@ -289,2 +304,3 @@ signature: "s o o m", | ||
rule: { signature: "o m m" }, | ||
// Sectioning | ||
part: { | ||
@@ -350,4 +366,6 @@ signature: "s o m", | ||
backmatter: { renderInfo: { breakAround: true, inParMode: true } }, | ||
// Citing and references | ||
bibitem: { signature: "o m", renderInfo: { hangingIndent: true } }, | ||
cite: { signature: "o m" }, | ||
// Fonts | ||
textrm: { signature: "m", renderInfo: { inParMode: true } }, | ||
@@ -372,5 +390,7 @@ textit: { signature: "m", renderInfo: { inParMode: true } }, | ||
mathrm: { signature: "m" }, | ||
// Other | ||
setlength: { signature: "m m", renderInfo: { breakAround: true } }, | ||
ref: { signature: "s m" }, | ||
label: { signature: "o m" }, | ||
// cleveref changes \label to have this signature | ||
printbibliography: { renderInfo: { breakAround: true } }, | ||
@@ -414,2 +434,3 @@ addtocontents: { signature: "m m", renderInfo: { breakAround: true } }, | ||
}, | ||
// Math | ||
math: { renderInfo: { inMathMode: true } } | ||
@@ -416,0 +437,0 @@ }; |
@@ -87,2 +87,3 @@ // package/mathtools/provides.ts | ||
xmathstrut: { signature: "o m" }, | ||
// amsthm | ||
newtheorem: { signature: "s m o m o", renderInfo: { breakAround: true } }, | ||
@@ -94,3 +95,5 @@ theoremstyle: { signature: "m", renderInfo: { breakAround: true } }, | ||
}, | ||
// amsmath | ||
text: { signature: "m", renderInfo: { inMathMode: false } }, | ||
// amsfonts | ||
mathbb: { signature: "m" }, | ||
@@ -102,2 +105,3 @@ mathscr: { signature: "m" }, | ||
bold: { signature: "m" }, | ||
// amsopn | ||
operatorname: { signature: "s m" }, | ||
@@ -186,2 +190,3 @@ DeclareMathOperator: { | ||
rgathered: { signature: "o", renderInfo: { inMathMode: true } }, | ||
// amsmath | ||
"align*": { renderInfo: { inMathMode: true, alignContent: true } }, | ||
@@ -201,3 +206,5 @@ align: { renderInfo: { inMathMode: true, alignContent: true } }, | ||
split: { renderInfo: { inMathMode: true } }, | ||
// Math environments | ||
displaymath: { renderInfo: { inMathMode: true } }, | ||
// Typical amsthm environments | ||
theorem: { signature: "o" }, | ||
@@ -204,0 +211,0 @@ lemma: { signature: "o" }, |
@@ -131,2 +131,3 @@ // package/systeme/provides.ts | ||
configurable: true | ||
// This makes it possible to `delete` the getter later. | ||
}); | ||
@@ -133,0 +134,0 @@ __magic__.globalThis = __magic__; |
export * from "./provides"; | ||
export * from "./libs/types"; | ||
export * from "./libs/print-raw"; | ||
export * from "./libs/parser"; | ||
//# sourceMappingURL=index.d.ts.map |
// package/tikz/provides.ts | ||
import { attachMacroArgsInArray } from "@unified-latex/unified-latex-util-arguments"; | ||
// package/tikz/libs/tikz-command-argument-parser.ts | ||
import { arg } from "@unified-latex/unified-latex-builder"; | ||
import { | ||
parse as parseArgspec | ||
} from "@unified-latex/unified-latex-util-argspec"; | ||
import { gobbleSingleArgument } from "@unified-latex/unified-latex-util-arguments"; | ||
import { match } from "@unified-latex/unified-latex-util-match"; | ||
import { scan } from "@unified-latex/unified-latex-util-scan"; | ||
import { trim } from "@unified-latex/unified-latex-util-trim"; | ||
var OPTIONAL_ARGUMENT_ARG_SPEC = parseArgspec("o")[0]; | ||
function blankArg() { | ||
return arg([], { openMark: "", closeMark: "" }); | ||
} | ||
var tikzCommandArgumentParser = (nodes, startPos) => { | ||
const origStartPos = startPos; | ||
let pos = startPos; | ||
let nodesRemoved = 0; | ||
const cursorPosAfterAnimations = eatAllAnimationSpecs(nodes, pos); | ||
let animationArg = blankArg(); | ||
if (cursorPosAfterAnimations !== pos) { | ||
const argContent = nodes.splice(pos, cursorPosAfterAnimations - pos); | ||
trim(argContent); | ||
animationArg = arg(argContent, { | ||
openMark: " ", | ||
closeMark: " " | ||
}); | ||
} | ||
nodesRemoved += cursorPosAfterAnimations - pos; | ||
const { | ||
argument: _optionalArgument, | ||
nodesRemoved: optionalArgumentNodesRemoved | ||
} = gobbleSingleArgument(nodes, OPTIONAL_ARGUMENT_ARG_SPEC, pos); | ||
nodesRemoved += optionalArgumentNodesRemoved; | ||
const optionalArg = _optionalArgument || blankArg(); | ||
while (match.whitespace(nodes[pos])) { | ||
pos++; | ||
} | ||
const firstNode = nodes[pos]; | ||
if (!firstNode) { | ||
return { | ||
args: [animationArg, optionalArg, blankArg()], | ||
nodesRemoved: 0 | ||
}; | ||
} | ||
if (match.group(firstNode)) { | ||
const args = [animationArg, optionalArg, arg(firstNode.content)]; | ||
nodes.splice(origStartPos, pos - origStartPos + 1); | ||
return { args, nodesRemoved: pos - origStartPos + 1 + nodesRemoved }; | ||
} | ||
const semicolonPosition = scan(nodes, ";", { startIndex: pos }); | ||
if (semicolonPosition != null) { | ||
const argNodes = nodes.splice( | ||
origStartPos, | ||
semicolonPosition - origStartPos + 1 | ||
); | ||
trim(argNodes); | ||
const args = [animationArg, optionalArg, arg(argNodes)]; | ||
return { | ||
args, | ||
nodesRemoved: origStartPos - semicolonPosition + 1 + nodesRemoved | ||
}; | ||
} | ||
return { | ||
args: [animationArg, optionalArg, blankArg()], | ||
nodesRemoved: 0 | ||
}; | ||
}; | ||
function eatAllAnimationSpecs(nodes, startPos) { | ||
const colonPos = scan(nodes, ":", { | ||
startIndex: startPos, | ||
allowSubstringMatches: true, | ||
onlySkipWhitespaceAndComments: true | ||
}); | ||
if (!colonPos) { | ||
return startPos; | ||
} | ||
let lastMatchPos = startPos; | ||
let i = colonPos + 1; | ||
for (; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
if (match.string(node, "[")) { | ||
break; | ||
} | ||
if (match.string(node, "=")) { | ||
i++; | ||
while (match.whitespace(nodes[i]) || match.comment(nodes[i])) { | ||
i++; | ||
} | ||
if (!match.group(nodes[i])) { | ||
break; | ||
} | ||
lastMatchPos = i + 1; | ||
const colonPos2 = scan(nodes, ":", { | ||
startIndex: lastMatchPos, | ||
allowSubstringMatches: true, | ||
onlySkipWhitespaceAndComments: true | ||
}); | ||
if (colonPos2 == null) { | ||
break; | ||
} | ||
i = colonPos2 + 1; | ||
} | ||
} | ||
return lastMatchPos; | ||
} | ||
// package/tikz/provides.ts | ||
var macros = { | ||
@@ -19,2 +128,4 @@ pgfkeys: { | ||
}, | ||
usepgfmodule: { signature: "m", renderInfo: { pgfkeysArgs: true } }, | ||
usepgflibrary: { signature: "m", renderInfo: { pgfkeysArgs: true } }, | ||
pgfplotsset: { | ||
@@ -27,12 +138,479 @@ signature: "m", | ||
renderInfo: { breakAround: true, pgfkeysArgs: true } | ||
}, | ||
tikz: { | ||
signature: "o o m", | ||
argumentParser: tikzCommandArgumentParser, | ||
renderInfo: { namedArguments: ["animation", "options", "command"] } | ||
} | ||
}; | ||
var environments = { | ||
tikzpicture: { signature: "o", renderInfo: { pgfkeysArgs: true } }, | ||
axis: { signature: "o", renderInfo: { pgfkeysArgs: true } } | ||
tikzpicture: { | ||
signature: "o", | ||
renderInfo: { pgfkeysArgs: true, tikzEnvironment: true }, | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
axis: { | ||
signature: "o", | ||
renderInfo: { pgfkeysArgs: true, tikzEnvironment: true }, | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
scope: { | ||
signature: "o", | ||
renderInfo: { pgfkeysArgs: true, tikzEnvironment: true }, | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
pgfonlayer: { | ||
signature: "m", | ||
renderInfo: { tikzEnvironment: true }, | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
pgflowlevelscope: { | ||
signature: "m", | ||
renderInfo: { tikzEnvironment: true }, | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
pgfviewboxscope: { | ||
signature: "m m m m m", | ||
renderInfo: { tikzEnvironment: true }, | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
pgftransparencygroup: { | ||
signature: "o", | ||
renderInfo: { pgfkeysArgs: true, tikzEnvironment: true }, | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
behindforegroundpath: { | ||
signature: "m", | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
pgfmetadecoration: { | ||
signature: "m", | ||
processContent: processTikzEnvironmentContent | ||
}, | ||
colormixin: { signature: "m", renderInfo: { pgfkeysArgs: true } } | ||
}; | ||
function processTikzEnvironmentContent(nodes) { | ||
attachMacroArgsInArray(nodes, conditionalMacros); | ||
return nodes; | ||
} | ||
var conditionalMacros = { | ||
pgfextra: { signature: "m" }, | ||
beginpgfgraphicnamed: { signature: "m" }, | ||
pgfrealjobname: { signature: "m" }, | ||
pgfplotstreampoint: { signature: "m" }, | ||
pgfplotstreampointoutlier: { signature: "m" }, | ||
pgfplotstreamspecial: { signature: "m" }, | ||
pgfplotxyfile: { signature: "m" }, | ||
pgfplotxyzfile: { signature: "m" }, | ||
pgfplotfunction: { signature: "mmm" }, | ||
pgfplotgnuplot: { signature: "o m" }, | ||
pgfplothandlerrecord: { signature: "m" }, | ||
pgfdeclareplothandler: { signature: "m m m" }, | ||
pgfdeclarelayer: { signature: "m" }, | ||
pgfsetlayers: { signature: "m", renderInfo: { pgfkeysArgs: true } }, | ||
pgfonlayer: { signature: "m" }, | ||
startpgfonlayer: { signature: "m" }, | ||
pgfdeclarehorizontalshading: { signature: "o m m m " }, | ||
pgfdeclareradialshading: { signature: "o m m m" }, | ||
pgfdeclarefunctionalshading: { signature: "o m m m m m" }, | ||
pgfshadecolortorgb: { signature: "m m" }, | ||
pgfshadecolortocmyk: { signature: "m m" }, | ||
pgfshadecolortogray: { signature: "m m" }, | ||
pgfuseshading: { signature: "m" }, | ||
pgfshadepath: { signature: "m m" }, | ||
pgfsetadditionalshadetransform: { signature: "m" }, | ||
pgfsetstrokeopacity: { signature: "m" }, | ||
pgfsetfillopacity: { signature: "m" }, | ||
pgfsetblendmode: { signature: "m" }, | ||
pgfdeclarefading: { signature: "m m" }, | ||
pgfsetfading: { signature: "m m" }, | ||
pgfsetfadingforcurrentpath: { signature: "m m" }, | ||
pgfsetfadingforcurrentpathstroked: { signature: "m m" }, | ||
pgfanimateattribute: { signature: "m m" }, | ||
pgfsnapshot: { signature: "m" }, | ||
pgfqpoint: { signature: "m m" }, | ||
pgfqpointxy: { signature: "m m" }, | ||
pgfqpointxyz: { signature: "m m m" }, | ||
pgfqpointscale: { signature: "m m" }, | ||
pgfpathqmoveto: { signature: "m m" }, | ||
pgfpathqlineto: { signature: "m m" }, | ||
pgfpathqcurveto: { signature: "m m m m m m" }, | ||
pgfpathqcircle: { signature: "m" }, | ||
pgfqbox: { signature: "m" }, | ||
pgfqboxsynced: { signature: "m" }, | ||
pgfaliasimage: { signature: "m m" }, | ||
pgfuseimage: { signature: "m" }, | ||
pgfimage: { signature: "o m", renderInfo: { pgfkeysArgs: true } }, | ||
pgfdeclaremask: { signature: "o m m", renderInfo: { pgfkeysArgs: true } }, | ||
pgfdeclarepatternformonly: { signature: "o m m m m m" }, | ||
pgfdeclarepatterninherentlycolored: { signature: "o m m m m m" }, | ||
pgfsetfillpattern: { signature: "m m" }, | ||
// Coordinate canvas and nonlinear transformations | ||
pgftransformshift: { signature: "m" }, | ||
pgftransformxshift: { signature: "m" }, | ||
pgftransformyshift: { signature: "m" }, | ||
pgftransformscale: { signature: "m" }, | ||
pgftransformxscale: { signature: "m" }, | ||
pgftransformyscale: { signature: "m" }, | ||
pgftransformxslant: { signature: "m" }, | ||
pgftransformyslant: { signature: "m" }, | ||
pgftransformrotate: { signature: "m" }, | ||
pgftransformtriangle: { signature: "m m m" }, | ||
pgftransformcm: { signature: "m m m m m" }, | ||
pgftransformarrow: { signature: "m m" }, | ||
pgftransformlineattime: { signature: "m m m" }, | ||
pgftransformcurveattime: { signature: "m m m m m" }, | ||
pgftransformarcaxesattime: { signature: "m m m m m m" }, | ||
pgfgettransform: { signature: "m" }, | ||
pgfsettransform: { signature: "m" }, | ||
pgfgettransformentries: { signature: "m m m m m m" }, | ||
pgfsettransformentries: { signature: "m m m m m m" }, | ||
pgfpointtransformed: { signature: "m" }, | ||
pgflowlevel: { signature: "m" }, | ||
pgflowlevelobj: { signature: "m m" }, | ||
pgflowlevelscope: { signature: "m" }, | ||
startpgflowlevelscope: { signature: "m" }, | ||
pgfviewboxscope: { signature: "m m m m m" }, | ||
startpgfviewboxscope: { signature: "m m m m m" }, | ||
pgftransformnonlinear: { signature: "m" }, | ||
pgfpointtransformednonlinear: { signature: "m" }, | ||
pgfsetcurvilinearbeziercurve: { signature: "m m m m" }, | ||
pgfcurvilineardistancetotime: { signature: "m" }, | ||
pgfpointcurvilinearbezierorthogonal: { signature: "m m" }, | ||
pgfpointcurvilinearbezierpolar: { signature: "m m" }, | ||
// Matrices | ||
pgfmatrix: { signature: "m m m m m m m" }, | ||
pgfsetmatrixcolumnsep: { signature: "m" }, | ||
pgfmatrixnextcell: { signature: "o" }, | ||
pgfsetmatrixrowsep: { signature: "m" }, | ||
pgfmatrixendrow: { signature: "o" }, | ||
// Nodes and shapes | ||
pgfnode: { signature: "m m m m m" }, | ||
pgfmultipartnode: { signature: "m m m m" }, | ||
pgfcoordinate: { signature: "m m" }, | ||
pgfnodealias: { signature: "m m" }, | ||
pgfnoderename: { signature: "m m" }, | ||
pgfpositionnodelater: { signature: "m" }, | ||
pgfpositionnodenow: { signature: "m" }, | ||
pgfnodepostsetupcode: { signature: "m m" }, | ||
pgfpointanchor: { signature: "m m" }, | ||
pgfpointshapeborder: { signature: "m m" }, | ||
pgfdeclareshape: { signature: "m m" }, | ||
saveddimen: { signature: "m m" }, | ||
savedmacro: { signature: " m" }, | ||
anchor: { signature: "m m" }, | ||
deferredanchor: { signature: "m m" }, | ||
anchorborder: { signature: "m" }, | ||
backgroundpath: { signature: "m" }, | ||
foregroundpath: { signature: "m" }, | ||
behindbackgroundpath: { signature: "m" }, | ||
beforebackgroundpath: { signature: "m" }, | ||
beforeforegroundpath: { signature: "m" }, | ||
behindforegroundpath: { signature: "m" }, | ||
// Arrows | ||
pgfdeclarearrow: { signature: "m" }, | ||
pgfarrowssettipend: { signature: "m" }, | ||
pgfarrowssetbackend: { signature: "m" }, | ||
pgfarrowssetlineend: { signature: "m" }, | ||
pgfarrowssetvisualbackend: { signature: "m" }, | ||
pgfarrowssetvisualtipend: { signature: "m" }, | ||
pgfarrowshullpoint: { signature: "m m" }, | ||
pgfarrowsupperhullpoint: { signature: "m m" }, | ||
pgfarrowssave: { signature: "m" }, | ||
pgfarrowssavethe: { signature: "m" }, | ||
pgfarrowsaddtooptions: { signature: "m" }, | ||
pgfarrowsaddtolateoptions: { signature: "m" }, | ||
pgfarrowsaddtolengthscalelist: { signature: "m" }, | ||
pgfarrowsaddtowidthscalelist: { signature: "m" }, | ||
pgfarrowsthreeparameters: { signature: "m" }, | ||
pgfarrowslinewidthdependent: { signature: "m m m" }, | ||
pgfarrowslengthdependent: { signature: "m" }, | ||
// Path | ||
pgfusepath: { signature: "m" }, | ||
pgfsetlinewidth: { signature: "m" }, | ||
pgfsetmiterlimit: { signature: "m" }, | ||
pgfsetdash: { signature: "m m" }, | ||
pgfsetstrokecolor: { signature: "m" }, | ||
pgfsetcolor: { signature: "m" }, | ||
pgfsetinnerlinewidth: { signature: "m" }, | ||
pgfsetinnerstrokecolor: { signature: "m" }, | ||
pgfsetarrowsstart: { signature: "m" }, | ||
pgfsetarrowsend: { signature: "m" }, | ||
pgfsetarrows: { signature: "m" }, | ||
pgfsetshortenstart: { signature: "m" }, | ||
pgfsetshortenend: { signature: "m" }, | ||
pgfsetfillcolor: { signature: "m" }, | ||
// Decorations | ||
pgfdeclaredecoration: { signature: "m m m" }, | ||
state: { signature: "m o m" }, | ||
pgfdecoratepath: { signature: "m m" }, | ||
startpgfdecoration: { signature: "m" }, | ||
pgfdecoration: { signature: "m" }, | ||
pgfdecoratecurrentpath: { signature: "m" }, | ||
pgfsetdecorationsegmenttransformation: { signature: "m" }, | ||
pgfdeclaremetadecorate: { signature: "m m m" }, | ||
pgfmetadecoration: { signature: "m" }, | ||
startpgfmetadecoration: { signature: "m" }, | ||
// Constructing paths | ||
pgfpathmoveto: { signature: "m" }, | ||
pgfpathlineto: { signature: "m" }, | ||
pgfpathcurveto: { signature: "m m m" }, | ||
pgfpathquadraticcurveto: { signature: "m m" }, | ||
pgfpathcurvebetweentime: { signature: "m m m m m m" }, | ||
pgfpathcurvebetweentimecontinue: { signature: "m m m m m m" }, | ||
pgfpatharc: { signature: "m m m" }, | ||
pgfpatharcaxes: { signature: "m m m m" }, | ||
pgfpatharcto: { signature: "m m m m m m" }, | ||
pgfpatharctoprecomputed: { signature: "m m m m m m m m" }, | ||
pgfpathellipse: { signature: "m m m" }, | ||
pgfpathcircle: { signature: "m m" }, | ||
pgfpathrectangle: { signature: "m m" }, | ||
pgfpathrectanglecorners: { signature: "m m" }, | ||
pgfpathgrid: { signature: " o m m" }, | ||
pgfpathparabola: { signature: "m m" }, | ||
pgfpathsine: { signature: "m" }, | ||
pgfpathcosine: { signature: "m" }, | ||
pgfsetcornersarced: { signature: "m" }, | ||
"pgf@protocolsizes": { signature: "m m" }, | ||
// Specifying coordinates | ||
pgfpoint: { signature: "m m" }, | ||
pgfpointpolar: { signature: "m m m" }, | ||
pgfpointxy: { signature: "m m" }, | ||
pgfsetxvec: { signature: "m" }, | ||
pgfsetyvec: { signature: "m" }, | ||
pgfpointpolarxy: { signature: "m m" }, | ||
pgfpointxyz: { signature: "m m m" }, | ||
pgfsetzvec: { signature: "m" }, | ||
pgfpointcylindrical: { signature: "m m m" }, | ||
pgfpointspherical: { signature: "m m m" }, | ||
pgfpointadd: { signature: "m m" }, | ||
pgfpointscale: { signature: "m m" }, | ||
pgfpointdiff: { signature: "m m" }, | ||
pgfpointnormalised: { signature: "m" }, | ||
pgfpointlineattime: { signature: "m m m" }, | ||
pgfpointlineatdistance: { signature: "m m m" }, | ||
pgfpointarcaxesattime: { signature: "m m m m m m" }, | ||
pgfpointcurveattime: { signature: "m m m m m" }, | ||
pgfpointborderrectangle: { signature: "m m" }, | ||
pgfpointborderellipse: { signature: "m m" }, | ||
pgfpointintersectionoflines: { signature: "m m m m" }, | ||
pgfpointintersectionofcircles: { signature: "m m m m m" }, | ||
pgfintersectionofpaths: { signature: "m m" }, | ||
pgfpointintersectionsolution: { signature: "m" }, | ||
pgfextractx: { signature: "m m" }, | ||
pgfextracty: { signature: "m m" }, | ||
pgfgetlastxy: { signature: "m m" }, | ||
"pgf@process": { signature: "m" }, | ||
// Heirarchical structres ... | ||
pgfsetbaseline: { signature: "m" }, | ||
pgfsetbaselinepointnow: { signature: "m" }, | ||
pgfsetbaselinepointlater: { signature: "m" }, | ||
pgftext: { signature: "o m", renderInfo: { pgfkeysArgs: true } }, | ||
pgfuseid: { signature: "m" }, | ||
pgfusetype: { signature: "m" }, | ||
pgfidrefnextuse: { signature: "m m" }, | ||
pgfidrefprevuse: { signature: "m m" }, | ||
pgfaliasid: { signature: "m m" }, | ||
pgfgaliasid: { signature: "m m" }, | ||
pgfifidreferenced: { signature: "m m m" }, | ||
pgfrdfabout: { signature: "m" }, | ||
pgfrdfcontent: { signature: "m" }, | ||
pgfrdfdatatype: { signature: "m" }, | ||
pgfrdfhref: { signature: "m" }, | ||
pgfrdfprefix: { signature: "m" }, | ||
pgfrdfproperty: { signature: "m" }, | ||
pgfrdfrel: { signature: "m" }, | ||
pgfrdfresource: { signature: "m" }, | ||
pgfrdfrev: { signature: "m" }, | ||
pgfrdfsrc: { signature: "m" }, | ||
pgfrdftypeof: { signature: "m" }, | ||
pgfrdfvocab: { signature: "m" }, | ||
pgferror: { signature: "m" }, | ||
pgfwarning: { signature: "m" }, | ||
path: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
draw: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
fill: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
filldraw: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
pattern: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
shade: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
clip: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
useasboundingbox: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
node: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
coordinate: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
graph: { | ||
signature: "u;", | ||
renderInfo: { breakAround: true, tikzPathCommand: true } | ||
}, | ||
scoped: { | ||
signature: "o o m", | ||
argumentParser: tikzCommandArgumentParser, | ||
renderInfo: { | ||
namedArguments: ["animation", "options", "command"], | ||
breakAround: true | ||
} | ||
} | ||
}; | ||
// package/tikz/libs/print-raw.ts | ||
import { printRaw as latexPrintRaw } from "@unified-latex/unified-latex-util-print-raw"; | ||
import { trim as trim2 } from "@unified-latex/unified-latex-util-trim"; | ||
function printRaw(node, root = false) { | ||
if (typeof node === "string") { | ||
return node; | ||
} | ||
if (Array.isArray(node)) { | ||
const sepToken = root ? " " : ""; | ||
const printed = []; | ||
for (let i = 0; i < node.length; i++) { | ||
const tok = node[i]; | ||
const prevTok = node[i - 1]; | ||
if (!prevTok) { | ||
printed.push(printRaw(tok)); | ||
continue; | ||
} | ||
if (prevTok.type === "comment") { | ||
printed.push(printRaw(tok)); | ||
continue; | ||
} | ||
if (tok.type !== "comment") { | ||
printed.push(sepToken); | ||
} | ||
printed.push(printRaw(tok)); | ||
} | ||
return printed.join(""); | ||
} | ||
const type = node.type; | ||
switch (type) { | ||
case "path_spec": | ||
return printRaw(node.content, root = true); | ||
case "coordinate": | ||
return `${latexPrintRaw(node.prefix)}(${latexPrintRaw( | ||
node.content | ||
)})`; | ||
case "operation": | ||
return latexPrintRaw(node.content); | ||
case "comment": | ||
return latexPrintRaw(node); | ||
case "line_to": | ||
return node.command; | ||
case "curve_to": { | ||
const comments = node.comments.map((c) => latexPrintRaw({ ...c, leadingWhitespace: false })).join(""); | ||
if (node.controls.length === 1) { | ||
return `${comments}.. controls ${printRaw( | ||
node.controls[0] | ||
)} ..`; | ||
} else { | ||
return `${comments}.. controls ${printRaw( | ||
node.controls[0] | ||
)} and ${printRaw(node.controls[1])} ..`; | ||
} | ||
} | ||
case "unknown": | ||
return latexPrintRaw(node.content); | ||
case "square_brace_group": | ||
return `[${latexPrintRaw(node.content)}]`; | ||
case "foreach": { | ||
const comments = node.comments.map((c) => latexPrintRaw({ ...c, leadingWhitespace: false })).join(""); | ||
let options = ""; | ||
if (node.options) { | ||
options = ` [${latexPrintRaw(node.options)}]`; | ||
} | ||
const start = latexPrintRaw(node.start); | ||
const variables = [...node.variables]; | ||
trim2(variables); | ||
let printedVariables = latexPrintRaw(variables); | ||
if (printedVariables.length > 0) { | ||
printedVariables = " " + printedVariables; | ||
} | ||
const command = node.command.type === "foreach" ? printRaw(node.command) : latexPrintRaw(node.command); | ||
return `${comments}${start}${printedVariables}${options} in ${latexPrintRaw( | ||
node.list | ||
)} ${command}`; | ||
} | ||
case "svg_operation": { | ||
const comments = node.comments.map((c) => latexPrintRaw({ ...c, leadingWhitespace: false })).join(""); | ||
let options = ""; | ||
if (node.options) { | ||
options = `[${latexPrintRaw(node.options)}]`; | ||
} | ||
return `${comments}svg${options} ${latexPrintRaw(node.content)}`; | ||
} | ||
case "animation": { | ||
const comments = node.comments.map((c) => latexPrintRaw({ ...c, leadingWhitespace: false })).join(""); | ||
return `${comments}:${node.attribute} = {${latexPrintRaw( | ||
node.content | ||
)}}`; | ||
} | ||
default: | ||
const unprintedType = type; | ||
console.warn(`Unknown node type "${unprintedType}" for node`, node); | ||
return ""; | ||
} | ||
} | ||
// package/tikz/libs/parser.ts | ||
import { match as match2 } from "@unified-latex/unified-latex-util-match"; | ||
import { decorateArrayForPegjs } from "@unified-latex/unified-latex-util-pegjs"; | ||
import { TikzPegParser } from "@unified-latex/unified-latex-util-pegjs"; | ||
function createMatchers() { | ||
return { | ||
isChar: match2.string, | ||
isTerminal: (node) => match2.string(node, ";"), | ||
isOperation: (node) => match2.anyString(node) && node.content.match(/[a-zA-Z]/), | ||
isWhitespace: (node) => match2.whitespace(node) || match2.parbreak(node), | ||
isComment: match2.comment, | ||
isGroup: match2.group, | ||
isMacro: match2.macro, | ||
isAnyMacro: match2.anyMacro | ||
}; | ||
} | ||
var matchers = createMatchers(); | ||
function parse(ast, options) { | ||
const { startRule = "path_spec" } = options || {}; | ||
if (!Array.isArray(ast)) { | ||
throw new Error("You must pass an array of nodes"); | ||
} | ||
ast = decorateArrayForPegjs([...ast]); | ||
return TikzPegParser.parse(ast, { | ||
...matchers, | ||
startRule | ||
}); | ||
} | ||
export { | ||
conditionalMacros, | ||
environments, | ||
macros | ||
macros, | ||
parse, | ||
printRaw | ||
}; | ||
//# sourceMappingURL=index.js.map |
import { MacroInfoRecord, EnvInfoRecord } from "@unified-latex/unified-latex-types"; | ||
export declare const macros: MacroInfoRecord; | ||
export declare const environments: EnvInfoRecord; | ||
/** | ||
* Macros that are only parsed inside a tikz environment. | ||
*/ | ||
export declare const conditionalMacros: MacroInfoRecord; | ||
//# sourceMappingURL=provides.d.ts.map |
@@ -700,2 +700,3 @@ // package/xcolor/provides.ts | ||
var PREDEFINED_XCOLOR_COLORS = { | ||
// Core colors | ||
red: XColorCoreModelToColor.rgb([1, 0, 0]), | ||
@@ -909,2 +910,3 @@ green: XColorCoreModelToColor.rgb([0, 1, 0]), | ||
configurable: true | ||
// This makes it possible to `delete` the getter later. | ||
}); | ||
@@ -911,0 +913,0 @@ __magic__.globalThis = __magic__; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1364068
166
12713
15