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

Properly inherit scriptminsize and scriptsizemultiplier #515

Merged
merged 1 commit into from
Jun 15, 2020
Merged
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion ts/core/MmlTree/MmlNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@ export abstract class AbstractMmlNode extends AbstractNode implements MmlNode {
mtable: {groupalign: true}
}
};

/**
* This lists the attributes that should always be inherited,
* even when there is no default value for the attribute.
*/
public static alwaysInherit: {[name: string]: boolean} = {
scriptminsize: true,
scriptsizemultiplier: true
};

/**
* This is the list of options for the verifyTree() method
*/
Expand Down Expand Up @@ -552,7 +562,7 @@ export abstract class AbstractMmlNode extends AbstractNode implements MmlNode {
display: boolean = false, level: number = 0, prime: boolean = false) {
let defaults = this.attributes.getAllDefaults();
for (const key of Object.keys(attributes)) {
if (defaults.hasOwnProperty(key)) {
if (defaults.hasOwnProperty(key) || AbstractMmlNode.alwaysInherit.hasOwnProperty(key)) {
let [node, value] = attributes[key];
let noinherit = (AbstractMmlNode.noInherit[node] || {})[this.kind] || {};
if (!noinherit[key]) {
Expand Down