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

Sre v4 Integration #800

Merged
merged 39 commits into from
May 6, 2022
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
43a30ca
Initial integration working.
zorkow Sep 24, 2021
4edba7d
Fixes up the clearspeak configuration menu.
zorkow Sep 24, 2021
2360da5
Refactored into dedicated sre module.
zorkow Sep 24, 2021
2db8b31
Corrects components for packing and loading with systemjs.
zorkow Sep 24, 2021
b13bd33
Sets the correct mathmaps paths.
zorkow Sep 25, 2021
d58b16b
Adapts paths for sre.
zorkow Dec 14, 2021
40e9250
Integrates SRE v4 via node_modules.
zorkow Jan 18, 2022
f0136ef
Removes obsolete copy file.
zorkow Jan 18, 2022
378e663
Adds sre component for webpacking.
zorkow Jan 19, 2022
8504f19
Changes to resolvePath.
zorkow Jan 20, 2022
9fb814e
Changes to resolvePath.
zorkow Jan 20, 2022
4b484d3
Update component files for changes to sre component
dpvc Jan 20, 2022
4a754c3
Merge pull request #761 from mathjax/sre4_update
zorkow Jan 20, 2022
74df166
Cleaner export and import of SRE namespace.
zorkow Jan 20, 2022
4a8bec1
Merge branch 'sre4_components' into sre4_cleaner_export
zorkow Jan 21, 2022
158076d
Separate adding of paths, etc, to a separate startup init file, so th…
dpvc Jan 24, 2022
749a560
Add init.js left out of previous commit
dpvc Jan 25, 2022
7536017
Cleaner export and correct order for SRE.
zorkow Feb 6, 2022
4237df4
Merge pull request #762 from mathjax/sre4_update2
zorkow Feb 23, 2022
6aff2fc
Merge branch 'sre4_components' into sre4_cleaner_export
zorkow Feb 23, 2022
06fc25b
Merge branch 'develop' into sre4_cleaner_export
zorkow Apr 10, 2022
9eb3475
Merge branch 'sre4_cleaner_export' of github.com:mathjax/MathJax-src …
zorkow Apr 10, 2022
d303c44
Integrates mathmaps in the code base.
zorkow Apr 10, 2022
2dcdd4f
Integrates mathmaps for node.
zorkow Apr 10, 2022
74d8446
Adds missing mathmaps file.
zorkow Apr 12, 2022
34af95a
Components loading for web works.
zorkow Apr 12, 2022
c57d004
Using maps.
zorkow Apr 13, 2022
1582116
Moves preloading of locales from sre to a example combined component
zorkow Apr 13, 2022
eee43fb
Introduces separate config component for SRE.
zorkow Apr 25, 2022
2eeb346
Cleanup of SRE integration.
zorkow Apr 25, 2022
f739499
Name the remaining languages.
zorkow Apr 26, 2022
d36dc03
Merge branch 'develop' into sre4_new_top_component
zorkow Apr 26, 2022
f71d514
Removes unused compiler option.
zorkow Apr 26, 2022
bcf3c30
Cleanup components files.
zorkow Apr 26, 2022
112b44b
Cleanup components files.
zorkow Apr 26, 2022
caa35b2
Merge branch 'sre4_new_top_component' of github.com:mathjax/MathJax-s…
zorkow Apr 26, 2022
422688b
Adds correct computation of absolute mathmaps path in node.
zorkow Apr 29, 2022
f810c23
Incorporate review suggestions.
zorkow May 6, 2022
37372ef
Final changes.
zorkow May 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions components/src/a11y/complexity/build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"targets": [
"a11y/complexity.ts",
"a11y/complexity",
"a11y/semantic-enrich.ts",
"a11y/sre.ts"
"a11y/semantic-enrich.ts"
]
}
2 changes: 1 addition & 1 deletion components/src/a11y/explorer/build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"component": "a11y/explorer",
"targets": ["a11y/explorer.ts", "a11y/sre.ts", "a11y/explorer"]
"targets": ["a11y/explorer.ts", "a11y/explorer"]
}
1 change: 1 addition & 0 deletions components/src/a11y/explorer/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = PACKAGE(
[ // packages to link to
'components/src/ui/menu/lib',
'components/src/a11y/semantic-enrich/lib',
'components/src/a11y/sre/lib',
'components/src/input/mml/lib',
'components/src/core/lib'
],
Expand Down
2 changes: 1 addition & 1 deletion components/src/a11y/semantic-enrich/build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"component": "a11y/semantic-enrich",
"targets": ["a11y/semantic-enrich.ts", "a11y/sre.ts"]
"targets": ["a11y/semantic-enrich.ts"]
}

4 changes: 2 additions & 2 deletions components/src/a11y/semantic-enrich/semantic-enrich.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import './lib/semantic-enrich.js';

import {combineDefaults} from '../../../../js/components/global.js';
import {sreReady} from '../../../../js/a11y/sre.js';
import Sre from '../../../../js/a11y/sre.js';
import {EnrichHandler} from '../../../../js/a11y/semantic-enrich.js';
import {MathML} from '../../../../js/input/mathml.js';

if (MathJax.loader) {
combineDefaults(MathJax.config.loader, 'a11y/semantic-enrich', {checkReady: () => sreReady()});
combineDefaults(MathJax.config.loader, 'a11y/semantic-enrich', {checkReady: () => Sre.sreReady()});
}

if (MathJax.startup) {
Expand Down
3 changes: 2 additions & 1 deletion components/src/a11y/semantic-enrich/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ module.exports = PACKAGE(
'../../../../js', // location of the MathJax js library
[ // packages to link to
'components/src/input/mml/lib',
'components/src/core/lib'
'components/src/core/lib',
'components/src/a11y/sre/lib'
],
__dirname // our directory
);
5 changes: 5 additions & 0 deletions components/src/a11y/sre/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"component": "a11y/sre",
"targets": ["a11y/sre.ts"]
}

9 changes: 9 additions & 0 deletions components/src/a11y/sre/sre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import './lib/sre.js';
import './sre_config.js';
import Sre from '../../../../js/a11y/sre.js';

if (MathJax.startup) {
((typeof window !== 'undefined') ? window : global).
SREfeature.custom = (loc) => Sre.preloadLocales(loc);
}

22 changes: 22 additions & 0 deletions components/src/a11y/sre/sre_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {combineDefaults} from '../../../../js/components/global.js';
import {Package} from '../../../../js/components/package.js';

// This sets up the correct link to the mathmaps files.
if (MathJax.startup) {

// Combine path with user defined path and resolve it wrt. MathJax path.
combineDefaults(MathJax.config.loader, 'paths', {sre: '[mathjax]/sre'});
let path = Package.resolvePath('[sre]', false) + '/mathmaps';

if (typeof window !== 'undefined') {
window.SREfeature = {json: path};
} else {
// In Node get the absolute path to the mathmaps directory.
try {
path = MathJax.config.loader.require.resolve(
path + '/base.json').replace(/\/base\.json$/, '');
} catch(_err) { }
global.SREfeature = {json: path};
}
}

12 changes: 12 additions & 0 deletions components/src/a11y/sre/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const PACKAGE = require('../../../webpack.common.js');

module.exports = PACKAGE(
'a11y/sre', // the package to build
'../../../../js', // location of the MathJax js library
[ // packages to link to
'components/src/input/mml/lib',
'components/src/core/lib',
'components/src/startup/lib'
],
__dirname // our directory
);
4 changes: 2 additions & 2 deletions components/src/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

export const dependencies = {
'a11y/semantic-enrich': ['input/mml', '[sre]'],
'a11y/semantic-enrich': ['input/mml', 'a11y/sre'],
'a11y/complexity': ['a11y/semantic-enrich'],
'a11y/explorer': ['a11y/semantic-enrich', 'ui/menu'],
'[mml]/mml3': ['input/mml'],
Expand Down Expand Up @@ -58,7 +58,7 @@ export const dependencies = {
export const paths = {
tex: '[mathjax]/input/tex/extensions',
mml: '[mathjax]/input/mml/extensions',
sre: '[mathjax]/sre/' + (typeof window === 'undefined' ? 'sre-node' : 'sre_browser')
sre: '[mathjax]/sre'
zorkow marked this conversation as resolved.
Show resolved Hide resolved
};

const allPackages = Array.from(Object.keys(dependencies))
Expand Down
2 changes: 1 addition & 1 deletion components/src/mml-chtml/mml-chtml.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../startup/lib/startup.js';
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/mml/mml.js';
Expand Down
2 changes: 1 addition & 1 deletion components/src/mml-svg/mml-svg.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../startup/lib/startup.js';
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/mml/mml.js';
Expand Down
7 changes: 0 additions & 7 deletions components/src/node-main/copy.json

This file was deleted.

6 changes: 1 addition & 5 deletions components/src/node-main/node-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ const path = eval("require('path')"); // use actual node version, not webpack's
/*
* Load the needed MathJax components
*/
require('../startup/lib/startup.js');
require('../startup/init.js');
const {Loader, CONFIG} = require('../../../js/components/loader.js');
const {combineDefaults, combineConfig} = require('../../../js/components/global.js');
const {dependencies, paths, provides} = require('../dependencies.js');

/*
* Set up the initial configuration
Expand All @@ -32,9 +31,6 @@ combineDefaults(MathJax.config, 'loader', {
require: eval('require'), // use node's require() to load files
failed: (err) => {throw err} // pass on error message to init()'s catch function
});
combineDefaults(MathJax.config.loader, 'dependencies', dependencies);
combineDefaults(MathJax.config.loader, 'paths', paths);
combineDefaults(MathJax.config.loader, 'provides', provides);

/*
* Preload core and liteDOM adaptor (needed for node)
Expand Down
4 changes: 2 additions & 2 deletions components/src/source.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ export const source = {
'a11y/semantic-enrich': `${src}/a11y/semantic-enrich/semantic-enrich.js`,
'a11y/complexity': `${src}/a11y/complexity/complexity.js`,
'a11y/explorer': `${src}/a11y/explorer/explorer.js`,
'[sre]': (typeof window === 'undefined' ? `${src}/../../js/a11y/sre-node.js` :
`${src}/../../node_modules/speech-rule-engine/lib/sre_browser.js`),
'a11y/sre': `${src}/a11y/sre/sre.js`,
'[sre]': `${src}/../../es5/sre`,
zorkow marked this conversation as resolved.
Show resolved Hide resolved
'ui/lazy': `${src}/ui/lazy/lazy.js`,
'ui/menu': `${src}/ui/menu/menu.js`,
'ui/safe': `${src}/ui/safe/safe.js`,
Expand Down
1 change: 0 additions & 1 deletion components/src/sre/copy.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"to": "../../../es5/sre",
"from": "[node]/speech-rule-engine/lib",
"copy": [
"sre_browser.js",
"mathmaps"
]
}
9 changes: 9 additions & 0 deletions components/src/startup/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import './lib/startup.js';

import {combineDefaults} from '../../../js/components/global.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);
10 changes: 1 addition & 9 deletions components/src/startup/startup.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import './lib/startup.js';

import './init.js';
import {Loader, CONFIG} from '../../../js/components/loader.js';
import {combineDefaults} from '../../../js/components/global.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
9 changes: 9 additions & 0 deletions components/src/tex-chtml-full-speech/preload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {Loader} from '../../../js/components/loader.js';

Loader.preLoad(
'loader', 'startup',
'core',
'input/tex-full',
'output/chtml', 'output/chtml/fonts/tex.js',
'ui/menu', 'a11y/assistive-mml', 'a11y/sre'
);
19 changes: 19 additions & 0 deletions components/src/tex-chtml-full-speech/tex-chtml-full-speech.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/tex-full/tex-full.js';
import '../output/chtml/chtml.js';
import '../output/chtml/fonts/tex/tex.js';
import '../ui/menu/menu.js';
import '../a11y/assistive-mml/assistive-mml.js';
import '../a11y/sre/sre.js';
import MathMaps from '../../../js/a11y/mathmaps.js';
import base from 'speech-rule-engine/lib/mathmaps/base.json';
import en from 'speech-rule-engine/lib/mathmaps/en.json';
import nemeth from 'speech-rule-engine/lib/mathmaps/nemeth.json';

MathMaps.set('base', base);
MathMaps.set('en', en);
MathMaps.set('nemeth', nemeth);

import '../startup/startup.js';
9 changes: 9 additions & 0 deletions components/src/tex-chtml-full-speech/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const PACKAGE = require('../../webpack.common.js');

module.exports = PACKAGE(
'tex-chtml-full-speech', // the package to build
'../../../js', // location of the MathJax js library
[ // packages to link to
],
__dirname // our directory
);
2 changes: 1 addition & 1 deletion components/src/tex-chtml-full/tex-chtml-full.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../startup/lib/startup.js';
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/tex-full/tex-full.js';
Expand Down
2 changes: 1 addition & 1 deletion components/src/tex-chtml/tex-chtml.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../startup/lib/startup.js';
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/tex/tex.js';
Expand Down
2 changes: 1 addition & 1 deletion components/src/tex-mml-chtml/tex-mml-chtml.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../startup/lib/startup.js';
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/tex/tex.js';
Expand Down
2 changes: 1 addition & 1 deletion components/src/tex-mml-svg/tex-mml-svg.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../startup/lib/startup.js';
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/tex/tex.js';
Expand Down
2 changes: 1 addition & 1 deletion components/src/tex-svg-full/tex-svg-full.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../startup/lib/startup.js';
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/tex-full/tex-full.js';
Expand Down
2 changes: 1 addition & 1 deletion components/src/tex-svg/tex-svg.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '../startup/lib/startup.js';
import '../startup/init.js';
import './preload.js';
import '../core/core.js';
import '../input/tex/tex.js';
Expand Down
Loading