@@ -42,9 +42,20 @@ const expand = function (string) {
4242 return `〖${ here } 〗`
4343 }
4444 const unstash = ( match , digits ) => stashed [ + digits ]
45+ const internal = function ( match , name ) {
46+ const slug = wiki . asSlug ( name )
47+ const styling = name === name . trim ( ) ? 'internal' : 'internal spaced'
48+ if ( slug . length ) {
49+ return stash (
50+ `<a class="${ styling } " href="/${ slug } .html" data-page-name="${ slug } " title="view">${ escape ( name ) } </a>` ,
51+ )
52+ } else {
53+ return match
54+ }
55+ }
4556 const external = ( match , href , protocol ) =>
46- stash ( `\ "<a class="external" target="_blank" href="${ href } " title="${ href } " rel="nofollow">${ escape ( href ) } </a>\ "` )
47- string = string . replace ( / 〖 ( \d + ) 〗 / g, '〖 $1 〗' ) . replace ( / " ( ( h t t p | h t t p s | f t p ) : .* ?) " / gi, external )
57+ stash ( `"<a class="external" target="_blank" href="${ href } " title="${ href } " rel="nofollow">${ escape ( href ) } </a>"` )
58+ string = string . replace ( / 〖 ( \d + ) 〗 / g, '〖 $1 〗' ) . replace ( / \[ \[ ( [ ^ \] ] + ) \] \] / gi , internal ) . replace ( / " ( ( h t t p | h t t p s | f t p ) : .* ?) " / gi, external )
4859 return escape ( string ) . replace ( / 〖 ( \d + ) 〗 / g, unstash )
4960}
5061
@@ -167,8 +178,8 @@ const emit = function ($item, item) {
167178 return result2
168179 } ) ( ) . join ( '\n' )
169180 return `<center> \
170- <p><img src=' /favicon.png' width=16> <span style=' color:gray;' >${ window . location . host } </span></p> \
171- <table style=\ "width:100%;\ "><tr> ${ head } ${ result } </table> \
181+ <p><img src=" /favicon.png" width=16> <span style=" color:gray;" >${ window . location . host } </span></p> \
182+ <table style="width:100%;"><tr> ${ head } ${ result } </table> \
172183<button class=restart>restart</button> \
173184</center>`
174185 }
@@ -240,7 +251,7 @@ const emit = function ($item, item) {
240251 }
241252 return `<pre>${ expand ( JSON . stringify ( obj , null , ' ' ) ) } </pre>`
242253 }
243- const pages = obj => `<p><b><a href=#>${ obj . title } </a></b><br>${ obj . synopsis } </p>`
254+ const pages = obj => `<p><b><a href=#>${ obj . title } </a></b><br>${ expand ( obj . synopsis ) } </p>`
244255 const birth = function ( obj ) {
245256 if ( obj ) {
246257 return new Date ( obj ) . toString ( )
0 commit comments