mediawiki-projects-list 2.3.7 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -98,7 +98,7 @@ function inputToWikiProject(input) {
|
|
|
98
98
|
if ( wikiProject ) {
|
|
99
99
|
let articlePath = ( wikiProject.regexPaths ? '/' : wikiProject.articlePath.split('?')[0] ).replace(/[.*+?^${}()|\[\]\\]/g, '\\$&');
|
|
100
100
|
let scriptPath = ( wikiProject.regexPaths ? '/' : wikiProject.scriptPath ).replace(/[.*+?^${}()|\[\]\\]/g, '\\$&');
|
|
101
|
-
let regex = input.match( new RegExp( wikiProject.regex + `(?:${articlePath}|${scriptPath}|/?$)
|
|
101
|
+
let regex = input.match( new RegExp( '(?:[\\w%]+(?::[\\w%]+)?@)?' + wikiProject.regex + `(?:${articlePath}|${scriptPath}|/?$)`, 'd' ) );
|
|
102
102
|
if ( regex ) {
|
|
103
103
|
scriptPath = wikiProject.scriptPath;
|
|
104
104
|
articlePath = wikiProject.articlePath;
|
|
@@ -110,9 +110,13 @@ function inputToWikiProject(input) {
|
|
|
110
110
|
articlePath = articlePath.replace( '?', '$1?' );
|
|
111
111
|
}
|
|
112
112
|
else articlePath += '$1';
|
|
113
|
+
let auth = '';
|
|
114
|
+
if ( regex.index < regex.indices[1][0] ) {
|
|
115
|
+
auth = input.slice(regex.index, regex.indices[1][0]);
|
|
116
|
+
}
|
|
113
117
|
result = {
|
|
114
118
|
fullArticlePath: 'https://' + regex[1] + articlePath,
|
|
115
|
-
fullScriptPath: 'https://' + regex[1] + scriptPath,
|
|
119
|
+
fullScriptPath: 'https://' + auth + regex[1] + scriptPath,
|
|
116
120
|
wikiProject: wikiProject
|
|
117
121
|
};
|
|
118
122
|
}
|