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

Support for automatically generating backreferences for SDOs #276

Merged
merged 2 commits into from
Jan 24, 2021

Conversation

bakkot
Copy link
Contributor

@bakkot bakkot commented Dec 18, 2020

In pursuit of tc39/ecma262#1950, specifically tc39/ecma262#1950 (comment).

Marked as draft until I've tried it out on the full spec, with tc39/ecma262#1950 done.

css/elements.css Outdated Show resolved Hide resolved
js/menu.js Outdated Show resolved Hide resolved
@michaelficarra
Copy link
Member

I don't see sdoMap.js in this diff.

js/sdoMap.js Outdated Show resolved Hide resolved

sdoBox.deactiveTimeout = null;
[].forEach.call(document.querySelectorAll('emu-grammar[type=definition] emu-rhs'), function (node) {
node.addEventListener('pointerenter', function () {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure whether event delegation would be better for these two listeners. We should ask somebody who does more frontend stuff to advise.

js/sdoMap.js Outdated Show resolved Hide resolved
@bakkot
Copy link
Contributor Author

bakkot commented Jan 23, 2021

Updated. I uploaded a build of ecma262 made using this PR here so you can see how it looks.

@bakkot bakkot marked this pull request as ready for review January 23, 2021 20:52
js/menu.js Outdated
var parentName = rhs.parentNode.getAttribute('name')
rhs = rhs.cloneNode(true);
rhs.querySelectorAll('emu-params,emu-constraints').forEach(function (e) { e.remove(); });
rhs.querySelectorAll('emu-opt').forEach(function (e) { e.innerHTML = '_opt' });
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this rendering. I would much prefer these still be rendered as subscripts.

Screenshot 2021-01-23 at 22 52 13

@michaelficarra
Copy link
Member

I changed the styling of the productions in the menu header. I think it's acceptable this way, but I'd prefer the styling to be the same as in the main body (family, weight, italics). But other than subscripting the optionality mark as I mentioned above, I think that can wait until a follow-up PR.

}
let mainId = match.id;
if (rhs.id == '') {
rhs.id = 'prod-' + sha(`[${sdoName}] ${name} ${rhs.textContent}`);
Copy link
Member

Choose a reason for hiding this comment

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

You know I'd prefer this to be an hmac. This should be fine, though, if we don't have an hmac function handy.

@bakkot
Copy link
Contributor Author

bakkot commented Jan 24, 2021

I'd prefer the styling to be the same as in the main body

Eh, easy enough. I tightened the spacing slightly (vs the main document) and dropped the yellow coloring from the opt subscript, but otherwise it'll match.

Looks like this:

Screen Shot 2021-01-23 at 11 46 09 PM

Or when hovering the production:
Screen Shot 2021-01-23 at 11 46 13 PM

@bakkot
Copy link
Contributor Author

bakkot commented Jan 24, 2021

Fixed the italics for terminals. Edit: also the gap before the colon.

Screen Shot 2021-01-24 at 10 06 10 AM

Screen Shot 2021-01-24 at 10 06 16 AM

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.

2 participants