@@ -23,6 +23,7 @@ const stylus = require('stylus')
2323const ncp = require ( 'ncp' )
2424const junk = require ( 'junk' )
2525
26+ const githubLinks = require ( './scripts/plugins/githubLinks' )
2627const navigation = require ( './scripts/plugins/navigation' )
2728const anchorMarkdownHeadings = require ( './scripts/plugins/anchor-markdown-headings' )
2829const loadVersions = require ( './scripts/load-versions' )
@@ -209,33 +210,6 @@ function withPreserveLocale (preserveLocale) {
209210 }
210211}
211212
212- // This middleware adds "Edit on GitHub" links to every editable page
213- function githubLinks ( options ) {
214- return ( files , m , next ) => {
215- // add suffix (".html" or "/" or "\" for windows) to each part of regex
216- // to ignore possible occurrences in titles (e.g. blog posts)
217- const isEditable = / s e c u r i t y \. h t m l | a b o u t ( \/ | \\ ) | d o c s ( \/ | \\ ) | f o u n d a t i o n ( \/ | \\ ) | g e t - i n v o l v e d ( \/ | \\ ) | k n o w l e d g e ( \/ | \\ ) /
218-
219- Object . keys ( files ) . forEach ( ( path ) => {
220- if ( ! isEditable . test ( path ) ) {
221- return
222- }
223-
224- const file = files [ path ]
225- const url = `https://github.com/nodejs/nodejs.org/edit/master/locale/${ options . locale } /${ path . replace ( '.html' , '.md' ) . replace ( / \\ / g, '/' ) } `
226- const editText = options . site . editOnGithub || 'Edit on GitHub'
227-
228- const contents = file . contents . toString ( ) . replace ( / < h 1 ( .* ?) > ( .* ?) < \/ h 1 > / , ( match , $1 , $2 ) => {
229- return `<a class="edit-link" href="${ url } ">${ editText } </a> <h1${ $1 } >${ $2 } </h1>`
230- } )
231-
232- file . contents = Buffer . from ( contents )
233- } )
234-
235- next ( )
236- }
237- }
238-
239213// This function builds the static/css folder for all the Stylus files.
240214function buildCSS ( ) {
241215 console . log ( '[stylus] static/css started' )
0 commit comments