Allow inherit ligations from calt
(#750)
* Allow inherit ligations from `calt` Add `calt` to `hives` so `inherit = 'calt'` works. Also get rid of `optInBuildup`/`optOutBuildup` because they just merged into `para.ligation.defaultBuildup`. * fixup! Allow inherit ligations from `calt` * fixup! Allow inherit ligations from `calt` Rename hives * fixup! Allow inherit ligations from `calt` Rename `calt` to `default-calt` * fixup! fixup! Allow inherit ligations from `calt`
This commit is contained in:
parent
e429b9ec10
commit
6d48193438
4 changed files with 15 additions and 22 deletions
|
@ -3,48 +3,41 @@
|
|||
const Parameters = require("./parameters");
|
||||
|
||||
module.exports = function applyLigationData(data, para, argv) {
|
||||
const optInBuildup = {};
|
||||
const optOutBuildup = {};
|
||||
const defaultBuildup = {};
|
||||
|
||||
const hives = {};
|
||||
hives["default"] = { caltBuildup: [] };
|
||||
for (const gr in data.simple) {
|
||||
hives["enable-" + gr] = { appends: { caltBuildup: [data.simple[gr].ligGroup] } };
|
||||
hives["disable-" + gr] = { removes: { caltBuildup: [data.simple[gr].ligGroup] } };
|
||||
hives[`ligset-enable-${gr}`] = { appends: { caltBuildup: [data.simple[gr].ligGroup] } };
|
||||
hives[`ligset-disable-${gr}`] = { removes: { caltBuildup: [data.simple[gr].ligGroup] } };
|
||||
}
|
||||
for (const gr in data.composite) {
|
||||
const comp = data.composite[gr];
|
||||
if (!comp.tag) continue;
|
||||
|
||||
const ligSets = createBuildup(data.simple, comp.buildup);
|
||||
if (comp.isOptOut) {
|
||||
optOutBuildup[comp.tag] = ligSets;
|
||||
} else {
|
||||
optInBuildup[comp.tag] = ligSets;
|
||||
}
|
||||
if (!comp.isOptOut) {
|
||||
hives["ligset-" + gr] = { caltBuildup: ligSets };
|
||||
}
|
||||
defaultBuildup[comp.tag] = ligSets;
|
||||
hives[`ligset-inherit-${gr}`] = { caltBuildup: ligSets };
|
||||
}
|
||||
|
||||
para.ligation = {
|
||||
defaultBuildup: { ...optInBuildup, ...optOutBuildup },
|
||||
defaultBuildup,
|
||||
caltBuildup: []
|
||||
};
|
||||
if (argv.ligations) {
|
||||
if (argv.ligations.inherits)
|
||||
Parameters.apply(para.ligation, hives, ["ligset-" + argv.ligations.inherits]);
|
||||
Parameters.apply(para.ligation, hives, [`ligset-inherit-${argv.ligations.inherits}`]);
|
||||
if (argv.ligations.disables)
|
||||
Parameters.apply(
|
||||
para.ligation,
|
||||
hives,
|
||||
argv.ligations.disables.map(x => `disable-${x}`)
|
||||
argv.ligations.disables.map(x => `ligset-disable-${x}`)
|
||||
);
|
||||
if (argv.ligations.enables)
|
||||
Parameters.apply(
|
||||
para.ligation,
|
||||
hives,
|
||||
argv.ligations.enables.map(x => `enable-${x}`)
|
||||
argv.ligations.enables.map(x => `ligset-enable-${x}`)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue