Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename extensions #485

Merged
merged 11 commits into from
May 26, 2020
25 changes: 18 additions & 7 deletions components/src/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ export const dependencies = {
'[tex]/action': ['input/tex-base', '[tex]/newcommand'],
'[tex]/autoload': ['input/tex-base', '[tex]/require'],
'[tex]/ams': ['input/tex-base'],
'[tex]/ams_cd': ['input/tex-base'],
'[tex]/amscd': ['input/tex-base'],
'[tex]/bbox': ['input/tex-base', '[tex]/ams', '[tex]/newcommand'],
'[tex]/boldsymbol': ['input/tex-base'],
'[tex]/braket': ['input/tex-base'],
'[tex]/bussproofs': ['input/tex-base'],
'[tex]/cancel': ['input/tex-base', '[tex]/enclose'],
'[tex]/color': ['input/tex-base'],
'[tex]/colorV2': ['input/tex-base'],
'[tex]/configMacros': ['input/tex-base', '[tex]/newcommand'],
'[tex]/colorv2': ['input/tex-base'],
'[tex]/configmacros': ['input/tex-base', '[tex]/newcommand'],
'[tex]/enclose': ['input/tex-base'],
'[tex]/extpfeil': ['input/tex-base', '[tex]/newcommand', '[tex]/ams'],
'[tex]/html': ['input/tex-base'],
Expand All @@ -24,7 +24,7 @@ export const dependencies = {
'[tex]/noundefined': ['input/tex-base'],
'[tex]/physics': ['input/tex-base'],
'[tex]/require': ['input/tex-base'],
'[tex]/tagFormat': ['input/tex-base'],
'[tex]/tagformat': ['input/tex-base'],
'[tex]/unicode': ['input/tex-base'],
'[tex]/verb': ['input/tex-base']
};
Expand All @@ -37,14 +37,14 @@ export const paths = {
const allPackages = [
'[tex]/action',
'[tex]/ams',
'[tex]/ams_cd',
'[tex]/amscd',
'[tex]/bbox',
'[tex]/boldsymbol',
'[tex]/braket',
'[tex]/bussproofs',
'[tex]/cancel',
'[tex]/color',
'[tex]/configMacros',
'[tex]/configmacros',
'[tex]/enclose',
'[tex]/extpfeil',
'[tex]/html',
Expand All @@ -54,6 +54,7 @@ const allPackages = [
'[tex]/noundefined',
'[tex]/physics',
'[tex]/require',
'[tex]/tagformat',
'[tex]/unicode',
'[tex]/verb'
];
Expand All @@ -67,7 +68,7 @@ export const provides = {
'[tex]/noundefined',
'[tex]/require',
'[tex]/autoload',
'[tex]/configMacros'
'[tex]/configmacros'
],
'input/tex-full': [
'input/tex-base',
Expand All @@ -76,3 +77,13 @@ export const provides = {
],
'[tex]/all-packages': allPackages
};

//
// Compatibility with v3.0 names for TeX extensions
//
export const compatibility = {
'[tex]/amsCd': '[tex]/amscd',
'[tex]/colorV2': '[tex]/colorv2',
'[tex]/configMacros': '[tex]/configmacros',
'[tex]/tagFormat': '[tex]/tagformat'
};
1 change: 0 additions & 1 deletion components/src/input/tex-full/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
"util/entities/r.ts"
],
"exclude": [
"input/tex/tag_format",
"input/tex/mhchem/mhchem_parser.d.ts"
]
}
Expand Down
2 changes: 1 addition & 1 deletion components/src/input/tex/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"input/tex/noundefined",
"input/tex/require",
"input/tex/autoload",
"input/tex/config_macros",
"input/tex/configmacros",
"util/entities/n.ts",
"util/entities/p.ts",
"util/entities/r.ts"
Expand Down
1 change: 0 additions & 1 deletion components/src/input/tex/extensions/ams_cd/amsCd.js

This file was deleted.

4 changes: 0 additions & 4 deletions components/src/input/tex/extensions/ams_cd/build.json

This file was deleted.

4 changes: 4 additions & 0 deletions components/src/input/tex/extensions/amscd/amscd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './lib/amscd.js';
import {rename} from '../../rename.js';

rename('amsCd', 'amscd', true);
4 changes: 4 additions & 0 deletions components/src/input/tex/extensions/amscd/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": "input/tex/extensions/amscd",
"targets": ["input/tex/amscd"]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const PACKAGE = require('../../../../../webpack.common.js');

module.exports = PACKAGE(
'input/tex/extensions/colorV2', // the package to build
'input/tex/extensions/amscd', // the package to build
'../../../../../../js', // location of the MathJax js library
[ // packages to link to
'components/src/input/tex-base/lib',
Expand Down
4 changes: 0 additions & 4 deletions components/src/input/tex/extensions/color_v2/build.json

This file was deleted.

1 change: 0 additions & 1 deletion components/src/input/tex/extensions/color_v2/colorV2.js

This file was deleted.

4 changes: 4 additions & 0 deletions components/src/input/tex/extensions/colorv2/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": "input/tex/extensions/colorv2",
"targets": ["input/tex/colorv2"]
}
4 changes: 4 additions & 0 deletions components/src/input/tex/extensions/colorv2/colorv2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './lib/colorv2.js';
import {rename} from '../rename.js';

rename('colorV2', 'colorv2', false);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const PACKAGE = require('../../../../../webpack.common.js');

module.exports = PACKAGE(
'input/tex/extensions/amsCd', // the package to build
'input/tex/extensions/colorv2', // the package to build
'../../../../../../js', // location of the MathJax js library
[ // packages to link to
'components/src/input/tex-base/lib',
Expand Down
4 changes: 0 additions & 4 deletions components/src/input/tex/extensions/config_macros/build.json

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions components/src/input/tex/extensions/configmacros/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": "input/tex/extensions/configmacros",
"targets": ["input/tex/configmacros"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './lib/configmacros.js';
import {rename} from '../rename.js';

rename('configMacros', 'configmacros', false);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const PACKAGE = require('../../../../../webpack.common.js');

module.exports = PACKAGE(
'input/tex/extensions/configMacros',// the package to build
'input/tex/extensions/configmacros',// the package to build
'../../../../../../js', // location of the MathJax js library
[ // packages to link to
'components/src/input/tex/extensions/newcommand/lib',
Expand Down
18 changes: 18 additions & 0 deletions components/src/input/tex/extensions/rename.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {combineConfig} from '../../../../../js/components/global.js';

//
// Look for a package name in the package list and change it to a new name
// and rename tex options for it, if there are any.
//
export function rename(oname, nname, options) {
const tex = MathJax.config.tex;
if (tex && tex.packages) {
const packages = tex.packages;
const n = packages.indexOf(oname);
if (n >= 0) packages[n] = nname;
if (options && tex[oname]) {
combineConfig(tex, {[nname]: tex[oname]});
delete tex[oname];
}
}
}
4 changes: 0 additions & 4 deletions components/src/input/tex/extensions/tag_format/build.json

This file was deleted.

This file was deleted.

4 changes: 4 additions & 0 deletions components/src/input/tex/extensions/tagformat/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"component": "input/tex/extensions/tagformat",
"targets": ["input/tex/tagformat"]
}
4 changes: 4 additions & 0 deletions components/src/input/tex/extensions/tagformat/tagformat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import './lib/tagformat.js';
import {rename} from '../rename.js';

rename('tagFormat', 'tagformat', true);
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const PACKAGE = require('../../../../../webpack.common.js');

module.exports = PACKAGE(
'input/tex/extensions/tagFormat', // the package to build
'input/tex/extensions/tagformat', // the package to build
'../../../../../../js', // location of the MathJax js library
[ // packages to link to
'components/src/input/tex-base/lib',
Expand Down
4 changes: 2 additions & 2 deletions components/src/input/tex/tex.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Loader.preLoad(
'[tex]/noundefined',
'[tex]/require',
'[tex]/autoload',
'[tex]/configMacros'
'[tex]/configmacros'
);

registerTeX([
Expand All @@ -20,5 +20,5 @@ registerTeX([
'noundefined',
'require',
'autoload',
'configMacros'
'configmacros'
]);
8 changes: 4 additions & 4 deletions components/src/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ export const source = {
'[tex]/all-packages': `${src}/input/tex/extensions/all-packages/all-packages.js`,
'[tex]/autoload': `${src}/input/tex/extensions/autoload/autoload.js`,
'[tex]/ams': `${src}/input/tex/extensions/ams/ams.js`,
'[tex]/amsCd': `${src}/input/tex/extensions/ams_cd/amsCd.js`,
'[tex]/amscd': `${src}/input/tex/extensions/amscd/amscd.js`,
'[tex]/bbox': `${src}/input/tex/extensions/bbox/bbox.js`,
'[tex]/boldsymbol': `${src}/input/tex/extensions/boldsymbol/boldsymbol.js`,
'[tex]/braket': `${src}/input/tex/extensions/braket/braket.js`,
'[tex]/bussproofs': `${src}/input/tex/extensions/bussproofs/bussproofs.js`,
'[tex]/cancel': `${src}/input/tex/extensions/cancel/cancel.js`,
'[tex]/color': `${src}/input/tex/extensions/color/color.js`,
'[tex]/colorV2': `${src}/input/tex/extensions/color_v2/colorV2.js`,
'[tex]/configMacros': `${src}/input/tex/extensions/config_macros/configMacros.js`,
'[tex]/colorv2': `${src}/input/tex/extensions/colorv2/colorv2.js`,
'[tex]/configmacros': `${src}/input/tex/extensions/configmacros/configmacros.js`,
'[tex]/enclose': `${src}/input/tex/extensions/enclose/enclose.js`,
'[tex]/extpfeil': `${src}/input/tex/extensions/extpfeil/extpfeil.js`,
'[tex]/html': `${src}/input/tex/extensions/html/html.js`,
Expand All @@ -28,7 +28,7 @@ export const source = {
'[tex]/noundefined': `${src}/input/tex/extensions/noundefined/noundefined.js`,
'[tex]/physics': `${src}/input/tex/extensions/physics/physics.js`,
'[tex]/require': `${src}/input/tex/extensions/require/require.js`,
'[tex]/tagFormat': `${src}/input/tex/extensions/tag_format/tagFormat.js`,
'[tex]/tagformat': `${src}/input/tex/extensions/tagformat/tagformat.js`,
'[tex]/unicode': `${src}/input/tex/extensions/unicode/unicode.js`,
'[tex]/verb': `${src}/input/tex/extensions/verb/verb.js`,
'input/mml': `${src}/input/mml/mml.js`,
Expand Down
3 changes: 2 additions & 1 deletion components/src/startup/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import './lib/startup.js';

import {Loader, CONFIG} from '../../../js/components/loader.js';
import {combineDefaults} from '../../../js/components/global.js';
import {dependencies, paths, provides} from '../dependencies.js';
import {dependencies, paths, provides, compatibility} from '../dependencies.js';

combineDefaults(MathJax.config.loader, 'dependencies', dependencies);
combineDefaults(MathJax.config.loader, 'paths', paths);
combineDefaults(MathJax.config.loader, 'provides', provides);
combineDefaults(MathJax.config.loader, 'source', compatibility);

Loader.preLoad('loader');

Expand Down
22 changes: 11 additions & 11 deletions ts/input/tex/AllPackages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
import './base/BaseConfiguration.js';
import './action/ActionConfiguration.js';
import './ams/AmsConfiguration.js';
import './ams_cd/AmsCdConfiguration.js';
import './amscd/AmsCdConfiguration.js';
import './bbox/BboxConfiguration.js';
import './boldsymbol/BoldsymbolConfiguration.js';
import './braket/BraketConfiguration.js';
import './bussproofs/BussproofsConfiguration.js';
import './cancel/CancelConfiguration.js';
import './color/ColorConfiguration.js';
import './color_v2/ColorV2Configuration.js';
import './config_macros/ConfigMacrosConfiguration.js';
import './colorv2/ColorV2Configuration.js';
import './configmacros/ConfigMacrosConfiguration.js';
import './enclose/EncloseConfiguration.js';
import './extpfeil/ExtpfeilConfiguration.js';
import './html/HtmlConfiguration.js';
Expand All @@ -41,7 +41,7 @@ import './newcommand/NewcommandConfiguration.js';
import './noerrors/NoErrorsConfiguration.js';
import './noundefined/NoUndefinedConfiguration.js';
import './physics/PhysicsConfiguration.js';
import './tag_format/TagFormatConfiguration.js';
import './tagformat/TagFormatConfiguration.js';
import './unicode/UnicodeConfiguration.js';
import './verb/VerbConfiguration.js';

Expand All @@ -50,14 +50,14 @@ if (typeof MathJax !== 'undefined' && MathJax.loader) {
MathJax.loader.preLoad(
'[tex]/action',
'[tex]/ams',
'[tex]/amsCd',
'[tex]/amscd',
'[tex]/bbox',
'[tex]/boldsymbol',
'[tex]/braket',
'[tex]/bussproofs',
'[tex]/cancel',
'[tex]/color',
'[tex]/color_v2',
'[tex]/colorv2',
'[tex]/enclose',
'[tex]/extpfeil',
'[tex]/html',
Expand All @@ -68,16 +68,16 @@ if (typeof MathJax !== 'undefined' && MathJax.loader) {
'[tex]/physics',
'[tex]/unicode',
'[tex]/verb',
'[tex]/configMacros',
'[tex]/tagFormat'
'[tex]/configmacros',
'[tex]/tagformat'
);
}

export const AllPackages: string[] = [
'base',
'action',
'ams',
'amsCd',
'amscd',
'bbox',
'boldsymbol',
'braket',
Expand All @@ -93,6 +93,6 @@ export const AllPackages: string[] = [
'noundefined',
'unicode',
'verb',
'configMacros',
'tagFormat'
'configmacros',
'tagformat'
];
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ import './AmsCdMappings.js';


export const AmsCdConfiguration = Configuration.create(
'amsCd', {
'amscd', {
handler: {
character: ['amsCd_special'],
macro: ['amsCd_macros'],
environment: ['amsCd_environment']
character: ['amscd_special'],
macro: ['amscd_macros'],
environment: ['amscd_environment']
},
options: {
amsCd: {
amscd: {
colspace: '5pt',
rowspace: '5pt',
harrowsize: '2.75em',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ import ParseMethods from '../ParseMethods.js';
import AmsCdMethods from './AmsCdMethods.js';


new sm.EnvironmentMap('amsCd_environment', ParseMethods.environment,
new sm.EnvironmentMap('amscd_environment', ParseMethods.environment,
{CD: 'CD'}, AmsCdMethods);

new sm.CommandMap('amsCd_macros', {
new sm.CommandMap('amscd_macros', {
minCDarrowwidth: 'minCDarrowwidth',
minCDarrowheight: 'minCDarrowheight',
}, AmsCdMethods);

new sm.MacroMap('amsCd_special', {'@': 'arrow'}, AmsCdMethods);
new sm.MacroMap('amscd_special', {'@': 'arrow'}, AmsCdMethods);
Loading