Skip to content

Commit

Permalink
WebPlatform Docs plugin: Fix links. Fixes #1290
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Feb 12, 2018
1 parent ad2948f commit 7a9dbe0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions plugins/wpd/prism-wpd.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,26 @@ Prism.hooks.add('wrap', function(env) {
|| env.language == 'scss'
|| env.language == 'markup'
) {
var searchURL = 'w/index.php?fulltext&search=';

env.tag = 'a';

var href = 'http://docs.webplatform.org/';
var href = 'https://webplatform.github.io/docs/';
var content = env.content;

if (env.language == 'css' || env.language == 'scss') {
href += 'wiki/css/';
href += 'css/';

if (env.type == 'property') {
href += 'properties/';
}
else if (env.type == 'rule') {
href += 'atrules/';
content = content.substring(1);
}
else if (env.type == 'pseudo-class') {
href += 'selectors/pseudo-classes/';
content = content.substring(1);
}
else if (env.type == 'pseudo-element') {
href += 'selectors/pseudo-elements/';
content = content.substring(2);
}
}
else if (env.language == 'markup') {
Expand All @@ -93,24 +93,24 @@ Prism.hooks.add('wrap', function(env) {
language = getLanguage(env.content) || language;

if (language) {
href += 'wiki/' + language + '/elements/';
href += language + '/elements/';
}
else {
href += searchURL;
return; // Abort
}
}
else if (env.type == 'attr-name') {
if (language) {
href += 'wiki/' + language + '/attributes/';
href += language + '/attributes/';
}
else {
href += searchURL;
return; // Abort
}
}
}

href += env.content;

href += content;
env.tag = 'a';
env.attributes.href = href;
env.attributes.target = '_blank';
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/wpd/prism-wpd.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7a9dbe0

Please sign in to comment.