File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,18 @@ function extractFunctions(tmLanguage, textContent) {
2828 matches . forEach ( m => {
2929 const lib = m [ 1 ] ;
3030 const funcs = m [ 2 ] . split ( "|" ) ;
31- funcs . forEach ( fn => result . add ( `${ lib } .${ fn } ` ) ) ;
31+
32+ funcs . forEach ( fn => {
33+ if ( lib === "math" && fn . endsWith ( "?" ) ) { // cosh?|sinh?|atan2?
34+ const base = fn . slice ( 0 , - 1 ) ;
35+ const baseWithoutLastLetter = fn . slice ( 0 , - 2 ) ;
36+
37+ result . add ( `${ lib } .${ base } ` ) ; // sinh|cosh|atan2
38+ result . add ( `${ lib } .${ baseWithoutLastLetter } ` ) ; // sin|cos|atan
39+ } else {
40+ result . add ( `${ lib } .${ fn } ` ) ;
41+ }
42+ } ) ;
3243 } ) ;
3344 return ;
3445 } else {
@@ -58,7 +69,9 @@ function initKeywordLinker() {
5869 url = `https://www.lua.org/manual/5.1/manual.html#pdf-${ text } ` ;
5970 }
6071
61- span . innerHTML = `<a href="${ url } " class="mta-keyword-link">${ text } </a>` ;
72+ const isExternalURL = url . startsWith ( "https://www." ) ;
73+
74+ span . innerHTML = `<a href="${ url } " class="mta-keyword-link" ${ isExternalURL ? 'target="_blank" rel="noopener noreferrer"' : "" } >${ text } </a>` ;
6275 }
6376 } ) ;
6477 }
You can’t perform that action at this time.
0 commit comments