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

Correct (type-wise) raisebox's usage of sizing's buildHtml. #1361

Merged
merged 3 commits into from May 27, 2018

Conversation

marcianx
Copy link
Collaborator

No description provided.

@marcianx marcianx requested a review from ylemkimon May 26, 2018 18:08
@codecov
Copy link

codecov bot commented May 26, 2018

Codecov Report

Merging #1361 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1361      +/-   ##
==========================================
+ Coverage   81.22%   81.23%   +0.01%     
==========================================
  Files          77       77              
  Lines        4224     4227       +3     
  Branches      731      731              
==========================================
+ Hits         3431     3434       +3     
  Misses        673      673              
  Partials      120      120
Impacted Files Coverage Δ
src/buildMathML.js 98.27% <100%> (-0.03%) ⬇️
src/defineFunction.js 93.75% <100%> (+0.89%) ⬆️
src/buildHTML.js 95.38% <100%> (-0.04%) ⬇️
src/defineEnvironment.js 100% <100%> (ø) ⬆️
src/functions/sizing.js 100% <100%> (ø) ⬆️
src/functions/raisebox.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9fe716...698f3b9. Read the comment docs.

size: 6, // simulate \normalsize
}}, options);
}, group.mode);
const body = sizing.htmlBuilder(sizedText, options);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about importing sizingGroup and

const newOptions = options.havingSize(6); // simulate \normalsize
const body = sizingGroup([text], newOptions, options);

?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true. The reason I did this was so that there's only one place the canonical implementation lives. That way, if it's ever updated in sizing.js we wouldn't have to remember to update it here as well. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcianx That seems right 😄

Currently, functions defined in functions/* import all exports from buildHtml
and buildMathML, but they should never use `groupTypes` directly as it loses
type-safety. They should instead use more type-safe `htmlBuilder`s and
`mathmlBuilder`s exported directly from other definitions `functions/*` to allow
flow to catch errors.
@ylemkimon ylemkimon merged commit 9cde033 into KaTeX:master May 27, 2018
@@ -1,8 +1,8 @@
/**
* This file does the main work of building a domTree structure from a parse
* tree. The entry point is the `buildHTML` function, which takes a parse tree.
* Then, the buildExpression, buildGroup, and various groupTypes functions are
* called, to produce a final HTML tree.
* Then, the buildExpression, buildGroup, and various groupBuilders functions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming groupTypes to groupBuilders is an improvement.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoroughly agree! That was @ylemkimon's idea in the last PR.

size: 6, // simulate \normalsize
}}, options);
}, group.mode);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of ParseNode here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's required by the type system. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants