Skip to content

Commit

Permalink
Merge branch 'develop' into gh-pages
Browse files Browse the repository at this point in the history
* develop:
  v10.2.0
  tests(webidl-contiguous-spec): test linking to webidl spec
  tests(webidl-contiguous.html): section for standard links to WebIDL spec
  feat(core/webidl-contiguous): link to standard types and extAttr
  feat(core/link-to-dfn): link extended attributes
  refactor(profile-w3c-common): run data-cite after webidl
  fix(core/webidl-contiguous): improve parser error message (closes #1057)
  fix(core/biblio): missing space in warning
  style(core/markdown): unessasary semicol
  refactor(core/utils): eslint fixes
  feat(src): export names of generated modules
  fix(core/biblio): ReferenceError ls -ltFh fc -l 1 git log --graph --decorate --all git commit -s -m rm -f .git/index.lock && git reset && git rebase -i HEAD~2 git bisect bad mkdir -p git pull --rebase -v hg commit --amend git bisect good nocorrect ebuild git bisect reset git bisect start git diff-tree --no-commit-id --name-only -r git ls-files -v | grep "^[[:lower:]]" hg checkout git diff --word-diff mv -i git push --dry-run cd - git show --pretty=short --show-signature git diff master --name-only git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all cd - cd -2 ls -1Fcrt cd -3 cd -4 cd -5 cd -6 cd -7 cd -8 cd -9 $EDITOR ~/.zshrc git push upstream git commit -v -a -s --no-edit --amend git push -v grep --color nocorrect heroku ls -lah cp -i git-push-to-try --tip ~/hg-moz -p linux,linux64,macosx64,win32,win64 -u reftest,mochitests rm -rf ${PROFILE_DIR}; mkdir -p ${PROFILE_DIR}; cp -p ~/dev_settings/user.js ${PROFILE_DIR}/user.js; mach run --purgecaches --profile ${PROFILE_DIR} about:remote-newtab http://localhost:8000 git commit -v -a --amend defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder git fetch --all --prune git reset --hard && git clean -dfx hg diffmerge git fetch origin sudo git merge origin/master hg branch hg commit hg diff dirs -v | head -10 git hg incoming history git log --oneline --decorate --graph git remote add hg pull -u git rebase ls -lFh hg outgoing git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit hg push git gui citool --amend ps -f git reset HEAD hg status ls -1Fcart tail -f git remote set-url git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]" git remote remove git clean -fd cd $(git rev-parse --show-toplevel || echo ".") git push origin $(git_current_branch) git reset -- popd git remote -v pushd nocorrect mkdir git commit -v --no-edit --amend git status -sb hg qfinish -a && hg push inbound git svn dcommit display_info git submodule init git help git commit -a -m git reset HEAD --hard find . -type d -name find . -type f -name git svn rebase git status -s git status git push --set-upstream origin $(git_current_branch) git stash save git submodule update git stash clear git stash drop brew list -1 git stash list brew upgrade && brew cleanup git stash pop git stash show --text grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}  rmdir python -m SimpleHTTPServer sort -n -r git add brew update && brew outdated git branch git commit -v git diff git fetch hg log --limit 20 --template "{node|short} | {date|isodatesec} | {author|user}: {desc|strip|firstline}\n"  git gui citool git tag -s bubo && bubc rm -i git diff --cached git svn dcommit && git push github master:svntrunk git stash apply git tag | sort -V \gitk --all --branches git pull git merge unset git branch --set-upstream-to=origin/$(git_current_branch) git push git remote man nocorrect man git log --graph git describe --tags `git rev-list --tags --max-count=1` nocorrect hpodder git log --graph --max-count=10 git log --stat -p git pull --rebase git remote update git branch --no-merged nocorrect mysql git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1 git update-index --assume-unchanged ggu \gitk --all $(git log -g --pretty=%h) git log --oneline --decorate --graph --all du -d 1 -h git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d du -sh * hg resolve --list git mergetool --no-prompt --tool=vimdiff for branch in aurora beta esr nightly release;do git rebase gh-pages ;git checkout gh-pages;done; git cherry-pick --abort git pull origin $(git_current_branch) git cherry-pick --continue fc -El 0 | grep git add --all git whatchanged -p --abbrev-commit --pretty=medium git log --stat git commit -v --amend hg pull && hg update --clean -r tip && hg strip 'roots(outgoing())' git log --oneline --decorate _git_log_prettily git rev-parse HEAD | git format-patch -1 | xargs git-patch-to-hg-patch git merge upstream/master nocorrect gist git add --patch sudo git commit -v -a --no-edit --amend nocorrect sudo git push origin --all && git push origin --tags git add --update git shortlog -sn git pull upstream master git branch -a git rebase --abort git branch -d git rebase --continue git-push-to-try --tip ~/hg-moz -p all -u all -t none whence git rebase -i git blame -b -w git mergetool --no-prompt git rebase master open_command $PWD git branch --remote git bisect git remote rename hg pull --rebase git rebase --skip ls -1FSsh open -a Xcode ls -ld .* defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder git commit -v -a git checkout -b ls -lAFh git checkout develop git update-index --no-assume-unchanged git config --list git commit -m hg branches ack -il git clone --recursive noglob urlglobber  git checkout master ls -l git-push-to-try --tip ~/hg-moz -b do -p linux,linux64,macosx64,win64 -u mochitests -t none man git checkout git cherry-pick hg bookmarks git commit -S ls -tRFh ls -G is not defined
  chore(package): rename babel tasks, dont watch on npm start
  • Loading branch information
marcoscaceres committed Feb 20, 2017
2 parents 9179e16 + 6e8d680 commit b3ea419
Show file tree
Hide file tree
Showing 25 changed files with 274 additions and 132 deletions.
2 changes: 1 addition & 1 deletion builds/respec-w3c-common.build.js.map

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions builds/respec-w3c-common.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/core/link-to-dfn.js
Expand Up @@ -80,7 +80,7 @@ define(
});
if (!foundDfn) {
// ignore WebIDL
if (!$ant.parents(".idl, dl.methods, dl.attributes, dl.constants, dl.constructors, dl.fields, dl.dictionary-members, span.idlMemberType, span.idlTypedefType, div.idlImplementsDesc").length) {
if (!$ant.parents(".idl:not(.extAttr), dl.methods, dl.attributes, dl.constants, dl.constructors, dl.fields, dl.dictionary-members, span.idlMemberType, span.idlTypedefType, div.idlImplementsDesc").length) {
var link_for = linkTargets[0].for_;
var title = linkTargets[0].title;
this.classList.add("respec-offending-element");
Expand Down
257 changes: 170 additions & 87 deletions js/core/webidl-contiguous.js
Expand Up @@ -178,10 +178,22 @@ define(
idlType: idlType.idlType,
}) + arrayStr + nullable;
}
var type = "";
if (idlType.generic) {
return hb.Utils.escapeExpression(idlType.generic) + "&lt;" + idlType2Html(idlType.idlType) + ">" + nullable;
type = standardTypes.has(idlType.generic) ? linkStandardType(idlType.generic) : idlType2Html(idlType.generic);
type = type + "&lt;" + idlType2Html(idlType.idlType) + ">";
} else {
type = standardTypes.has(idlType.idlType) ? linkStandardType(idlType.idlType) : idlType2Html(idlType.idlType);
}
return idlType2Html(idlType.idlType) + nullable;
return type + nullable;
}

function linkStandardType(type) {
if (!standardTypes.has(type)) {
return type;
}
const safeType = hb.Utils.escapeExpression(type);
return "<a data-cite='" + standardTypes.get(safeType) + "'>" + safeType + "</a>";
}

function idlType2Text(idlType) {
Expand Down Expand Up @@ -227,6 +239,32 @@ define(
return whitespaceTypes[webIdlType];
}

const extenedAttributesLinks = new Map([
["CEReactions", "WHATWG-HTML#cereactions"],
["Clamp", "WebIDL-LS#Clamp"],
["Constructor", "WebIDL-LS#Constructor"],
["EnforceRange", "WebIDL-LS#EnforceRange"],
["Exposed", "WebIDL-LS#Exposed"],
["Global", "WebIDL-LS#Global"],
["HTMLConstructor", "WHATWG-HTML#htmlconstructor"],
["LegacyArrayClass", "WebIDL-LS#LegacyArrayClass"],
["LegacyUnenumerableNamedProperties", "WebIDL-LS#LegacyUnenumerableNamedProperties"],
["LenientSetter", "WebIDL-LS#LenientSetter"],
["LenientThis", "WebIDL-LS#LenientThis"],
["NamedConstructor", "WebIDL-LS#NamedConstructor"],
["NewObject", "WebIDL-LS#NewObject"],
["NoInterfaceObject", "WebIDL-LS#NoInterfaceObject"],
["OverrideBuiltins", "WebIDL-LS#OverrideBuiltins"],
["PutForwards", "WebIDL-LS#PutForwards"],
["Replaceable", "WebIDL-LS#Replaceable"],
["SameObject", "WebIDL-LS#SameObject"],
["SecureContext", "WebIDL-LS#SecureContext"],
["TreatNonObjectAsNull", "WebIDL-LS#TreatNonObjectAsNull"],
["TreatNullAs", "WebIDL-LS#TreatNullAs"],
["Unforgeable", "WebIDL-LS#Unforgeable"],
["Unscopable", "WebIDL-LS#Unscopable"],
]);

function extAttr(extAttrs, indent, singleLine) {
if (extAttrs.length === 0) {
// If there are no extended attributes, omit the [] entirely.
Expand All @@ -238,103 +276,148 @@ define(
sep: singleLine ? ", " : ",\n " + idn(indent),
end: singleLine ? " " : "\n",
};
return new hb.SafeString(idlExtAttributeTmpl(opt));
const safeString = new hb.SafeString(idlExtAttributeTmpl(opt));
const tmpParser = document.createElement("div");
tmpParser.innerHTML = safeString;
Array
.from(
tmpParser.querySelectorAll(".extAttrName")
)
.filter(function(elem) {
return extenedAttributesLinks.has(elem.textContent);
})
.forEach(function(elem) {
const a = elem.ownerDocument.createElement("a");
a.dataset.cite = extenedAttributesLinks.get(elem.textContent);
a.textContent = elem.textContent;
elem.replaceChild(a, elem.firstChild);
})
return new hb.SafeString(tmpParser.innerHTML);
}
var idlKeywords = [
"any",
"attribute",
"boolean",
"byte",
"ByteString",
"callback",
"const",
"creator",
"Date",
"deleter",
"dictionary",
"DOMString",
"double",
"enum",
"false",
"float",
"getter",
"implements",
"Infinity",
"inherit",
"interface",
"iterable",
"legacycaller",
"legacyiterable",
"long",
"maplike",
"NaN",
"null",
"object",
"octet",
"optional",
"or",
"partial",
"readonly",
"RegExp",
"required",
"sequence",
"serializer",
"setlike",
"setter",
"short",
"static",
"stringifier",
"true",
"typedef",
"unrestricted",
"unsigned",
"USVString",
"void",
],
ArgumentNameKeyword = [
"attribute",
"callback",
"const",
"creator",
"deleter",
"dictionary",
"enum",
"getter",
"implements",
"inherit",
"interface",
"iterable",
"legacycaller",
"legacyiterable",
"maplike",
"partial",
"required",
"serializer",
"setlike",
"setter",
"static",
"stringifier",
"typedef",
"unrestricted",
],
AttributeNameKeyword = ["required"];

const standardTypes = new Map([
["any", "WebIDL-LS#idl-any"],
["boolean", "WebIDL-LS#idl-boolean"],
["Buffer", "WebIDL-LS#idl-Buffer"],
["byte", "WebIDL-LS#idl-byte"],
["ByteString", "WebIDL-LS#idl-ByteString"],
["Callback", "WebIDL-LS#idl-Callback"],
["DOMException", "WebIDL-LS#idl-DOMException"],
["DOMString", "WebIDL-LS#idl-DOMString"],
["double", "WebIDL-LS#idl-double"],
["Error", "WebIDL-LS#idl-Error"],
["float", "WebIDL-LS#idl-float"],
["long long", "WebIDL-LS#idl-long-long"],
["long", "WebIDL-LS#idl-long"],
["object", "WebIDL-LS#idl-object"],
["octet", "WebIDL-LS#idl-octet"],
["Promise", "WebIDL-LS#idl-promise"],
["record", "WebIDL-LS#idl-record"],
["sequence", "WebIDL-LS#idl-sequence"],
["short", "WebIDL-LS#idl-short"],
["unrestricted double", "WebIDL-LS#idl-unrestricted-double"],
["unrestricted float", "WebIDL-LS#idl-unrestricted-float"],
["unsigned long long", "WebIDL-LS#idl-unsigned-long-long"],
["unsigned long", "WebIDL-LS#idl-unsigned-long"],
["unsigned short", "WebIDL-LS#idl-unsigned-short"],
["USVString", "WebIDL-LS#idl-USVString"],
]);

const idlKeywords = new Set([
"any",
"attribute",
"boolean",
"byte",
"ByteString",
"callback",
"const",
"creator",
"Date",
"deleter",
"dictionary",
"DOMString",
"double",
"enum",
"false",
"float",
"getter",
"implements",
"Infinity",
"inherit",
"interface",
"iterable",
"legacycaller",
"legacyiterable",
"long",
"maplike",
"NaN",
"null",
"object",
"octet",
"optional",
"or",
"partial",
"readonly",
"RegExp",
"required",
"sequence",
"serializer",
"setlike",
"setter",
"short",
"static",
"stringifier",
"true",
"typedef",
"unrestricted",
"unsigned",
"USVString",
"void",
]);
const argumentNameKeyword = new Set([
"attribute",
"callback",
"const",
"creator",
"deleter",
"dictionary",
"enum",
"getter",
"implements",
"inherit",
"interface",
"iterable",
"legacycaller",
"legacyiterable",
"maplike",
"partial",
"required",
"serializer",
"setlike",
"setter",
"static",
"stringifier",
"typedef",
"unrestricted",
]);
const attributeNameKeyword = new Set(["required"]);
var operationNames = {};
var idlPartials = {};

function escapeArgumentName(argumentName) {
if (idlKeywords.indexOf(argumentName) !== -1 && ArgumentNameKeyword.indexOf(argumentName) === -1)
if (idlKeywords.has(argumentName) && !argumentNameKeyword.has(argumentName))
return "_" + argumentName;
return argumentName;
}

function escapeAttributeName(attributeName) {
if (idlKeywords.indexOf(attributeName) !== -1 && AttributeNameKeyword.indexOf(attributeName) === -1)
if (idlKeywords.has(attributeName) && !attributeNameKeyword.has(attributeName))
return "_" + attributeName;
return attributeName;
}

function escapeIdentifier(identifier) {
if (idlKeywords.indexOf(identifier) !== -1)
if (idlKeywords.has(identifier))
return "_" + identifier;
return identifier;
}
Expand Down Expand Up @@ -856,13 +939,13 @@ define(
case "operation":
// ignore overloads
if (name.search("!overload") !== -1) {
name = name.toLowerCase();
name = name.toLowerCase();
break;
}
// Allow linking to both "method()" and "method" name.
const asMethodName = name.toLowerCase() + "()";
const asFullyQualifiedName = parent + "." + name.toLowerCase() + "()";

if (definitionMap[asMethodName] || definitionMap[asFullyQualifiedName]) {
const lookupName = (definitionMap[asMethodName]) ? asMethodName : asFullyQualifiedName;
const dfn = findDfn(parent, lookupName, definitionMap, null, idlElem);
Expand Down Expand Up @@ -980,7 +1063,7 @@ define(
try {
parse = webidl2.parse($(this).text(), { ws: true });
} catch (e) {
pubsubhub.pub("error", "Failed to parse <pre>" + $idl.text() + "</pre> as IDL: " + (e.stack || e));
pubsubhub.pub("error", "Failed to parse WebIDL: \n```\n" + this.textContent + "\n```\n" + (e.message || e)) + ".";
// Skip this <pre> and move on to the next one.
return;
}
Expand Down
4 changes: 2 additions & 2 deletions js/profile-w3c-common.js
Expand Up @@ -54,16 +54,16 @@ define([
"w3c/conformance",
"core/data-transform",
"core/inlines",
"core/data-cite",
"core/dfn",
"w3c/rfc2119",
"core/examples",
"core/issues-notes",
"core/requirements",
"core/best-practices",
"core/figures",
"core/biblio",
"core/webidl-contiguous",
"core/data-cite",
"core/biblio",
"core/webidl-index",
"core/webidl-oldschool",
"core/link-to-dfn",
Expand Down
21 changes: 11 additions & 10 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "respec",
"version": "10.1.18",
"version": "10.2.0",
"license": "W3C",
"description": "A technical specification pre-processor.",
"engines": {
Expand Down Expand Up @@ -51,30 +51,31 @@
"whatwg-fetch": "^2.0.2"
},
"scripts": {
"build": "npm run hb:build && npm run build:highlight && npm run build:babel && npm run copydeps && npm run build:respec-w3c-common",
"build:babel": "babel src -d js",
"babel:build": "babel src -d js --source-maps",
"babel:watch": "babel src -d js --watch --source-maps",
"build": "npm run hb:build && npm run build:highlight && npm run babel:build && npm run copydeps && npm run build:respec-w3c-common",
"build:highlight": "cd node_modules/highlight.js/ && npm install && node ./tools/build.js -n xml javascript css http markdown json abnf && cd ../../",
"build:respec-w3c-common": "./tools/build-w3c-common.js",
"copydeps": "node ./tools/copydeps.js",
"handlebars": "handlebars",
"hb:build": "npm run hb:w3c && npm run hb:webidlcontiguous",
"hb:w3c": "handlebars -a js/w3c/templates/*.html js/w3c/templates/*.css -f js/w3c/templates/compiled.js",
"hb:webidlcontiguous": "handlebars -a js/core/templates/webidl-contiguous/*.html -f js/core/templates/webidl-contiguous/compiled.js",
"jscs": "jscs --esnext tests tools js/w3c/linter.js",
"jscs:fix": "jscs --esnext --fix tests",
"jshint": "jshint karma.conf.js tests tools js/w3c/linter.js js/core/dfn.js js/core/data-transform.js",
"karma": "karma start --single-run",
"prepublish": "npm run build:highlight && npm run copydeps && npm run snyk-protect",
"copydeps": "node ./tools/copydeps.js",
"pretest": "npm run jshint && npm run jscs",
"server": "npm start",
"snyk-protect": "snyk protect",
"start": "babel src -d js --watch --source-maps & http-server",
"start": "http-server",
"test": "npm run test:headless && npm run test:karma",
"test:appveyor": "npm run pretest",
"test:build": "mocha ./tests/test-build.js",
"test:headless": "node ./tests/headless.js",
"test:karma": "npm run karma",
"test:travis": "npm run pretest && npm run test:build && karma start --single-run --reporters progress karma.conf.js && npm run test:headless",
"handlebars": "handlebars",
"hb:w3c": "handlebars -a js/w3c/templates/*.html js/w3c/templates/*.css -f js/w3c/templates/compiled.js",
"hb:webidlcontiguous": "handlebars -a js/core/templates/webidl-contiguous/*.html -f js/core/templates/webidl-contiguous/compiled.js",
"hb:build": "npm run hb:w3c && npm run hb:webidlcontiguous"
"test:travis": "npm run pretest && npm run test:build && karma start --single-run --reporters progress karma.conf.js && npm run test:headless"
},
"dependencies": {
"colors": "^1.1.2",
Expand Down
2 changes: 2 additions & 0 deletions src/core/aria.js
@@ -1,5 +1,7 @@
import { sub } from "core/pubsubhub";

export const name = "core/aria";

document.body.setAttribute("aria-busy", "true");

sub("end-all", () => {
Expand Down

0 comments on commit b3ea419

Please sign in to comment.