DOM removals
This commit is contained in:
parent
cc3c1b1080
commit
8302e7c991
|
@ -546,20 +546,17 @@ class Article extends ArticleStub {
|
||||||
|
|
||||||
dom( '#bodyContent' ).replaceWith( content )
|
dom( '#bodyContent' ).replaceWith( content )
|
||||||
|
|
||||||
// remove comments
|
|
||||||
dom( '*' ).contents().each( (i, elem) => {
|
|
||||||
//~ log( 'comment', elem.type )
|
|
||||||
if ( elem.type === 'comment' ) {
|
|
||||||
dom( elem ).remove()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// display content inside <noscript> tags
|
// display content inside <noscript> tags
|
||||||
dom( 'noscript' ).each( (i, elem) => {
|
dom( 'noscript' ).each( (i, elem) => {
|
||||||
let e = dom( elem )
|
let e = dom( elem )
|
||||||
e.replaceWith( e.contents() )
|
e.replaceWith( e.contents() )
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
dom( wiki.pageRemovals ).each( (i, elem) => {
|
||||||
|
dom( elem ).remove()
|
||||||
|
})
|
||||||
|
|
||||||
// modify links
|
// modify links
|
||||||
let css = dom( '#layout-css' )
|
let css = dom( '#layout-css' )
|
||||||
css.attr( 'href', this.pathToTop() + css.attr( 'href' ))
|
css.attr( 'href', this.pathToTop() + css.attr( 'href' ))
|
||||||
|
@ -948,10 +945,11 @@ async function processSamplePage ( samplePageUrl, rmdir) {
|
||||||
return dom
|
return dom
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadTemplate () {
|
async function loadPreRequisites () {
|
||||||
const stubPath = osPath.resolve( module.filename, '../stub.html' )
|
const stubPath = osPath.resolve( module.filename, '../stub.html' )
|
||||||
return fs.readFile ( stubPath )
|
wiki.pageTemplate = await fs.readFile ( stubPath, 'utf8' )
|
||||||
.then( stub => (wiki.pageTemplate = stub))
|
const removalsPath = osPath.resolve( module.filename, '../removals.txt' )
|
||||||
|
wiki.pageRemovals = await fs.readFile ( removalsPath, 'utf8' )
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getSiteInfo () {
|
async function getSiteInfo () {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user