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}`)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -124,12 +124,13 @@ desc = 'Transform `:>` into `:` and a narrow arrow.'
|
|||
|
||||
###################################################################################################
|
||||
|
||||
[composite.calt]
|
||||
isOptOut = true # This feature is on by default by many software
|
||||
# This feature is on by default by many software
|
||||
[composite.default-calt]
|
||||
tag = 'calt'
|
||||
buildup = ['center-ops', 'arrow', 'html-comment', 'trig', 'llgg', 'llggeq', 'eqeq', 'exeq', 'ineq', 'plusplus', 'kern-dotty']
|
||||
brief = 'Default'
|
||||
desc = 'Default setting in text editors'
|
||||
longDesc = 'Inherit default ligation set'
|
||||
|
||||
[composite.dlig]
|
||||
tag = 'dlig'
|
||||
|
|
|
@ -31,9 +31,9 @@ l = 'italic'
|
|||
# Configure ligations
|
||||
|
||||
[buildPlans.iosevka-custom.ligations]
|
||||
inherits = "calt" # Optional; inherits an existing ligation set
|
||||
disables = [] # Optional; disable specific ligation groups, overrides inherited ligation set
|
||||
enables = [] # Optional; enable specific ligation groups, overrides inherited ligation set
|
||||
inherits = "default-calt" # Optional; inherits an existing ligation set
|
||||
disables = [] # Optional; disable specific ligation groups, overrides inherited ligation set
|
||||
enables = [] # Optional; enable specific ligation groups, overrides inherited ligation set
|
||||
|
||||
# End ligation section
|
||||
###################################################################################################
|
||||
|
|
|
@ -177,7 +177,6 @@ async function processLigSetPreDef() {
|
|||
const headerPath = path.resolve(__dirname, "fragments/description-predefined-ligation-sets.md");
|
||||
md.log(await fs.readFile(headerPath, "utf-8"));
|
||||
for (const gr in ligData.rawSets) {
|
||||
if (ligData.rawSets[gr].isOptOut) continue;
|
||||
const longDesc =
|
||||
ligData.rawSets[gr].longDesc ||
|
||||
`Default ligation set would be assigned to ${ligData.rawSets[gr].desc}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue