User:Theleekycauldron/Scripts/PSHAW/dependencies/Hook.js: Difference between revisions

Content deleted Content added
capitalize article titles
def capitalize
 
Line 12:
copies or substantial portions of the Software.
*/
function capitalize(string) {
 
return string.charAt(0).toUpperCase() + string.slice(1);
}
class Hook {
constructor(id,content,credits){
Line 19 ⟶ 21:
this.articles = []
for (let m of this.content.matchAll(/'''[^']*?\[\[([^\]\|]+)[^\]]*\]\][^']*?'''|\[\[.*'''([^']+)'''\]\]/g)){
this.articles.push(capitalize(m[1].capitalize())
}
this.credits = credits
Line 94 ⟶ 96:
})
}
}
// </nowiki>