private static String replaceInternalLinks()

in generator/src/main/groovy/generator/DocumentationHTMLCleaner.groovy [80:96]


    private static String replaceInternalLinks(String html) {
        def replacer = { List<String> it ->
            def (String tag, String attr, String url) = [it[1], it[2], it[3]]
            url = url.replaceAll(/x(.+)\.(?:pagespeed.+)/, '$1')
            if (!url.startsWith('http') && !url.startsWith('#') && 'target.html'!=url) {
                "$tag $attr'${DocUtils.DOCS_BASEURL}/html/documentation/$url'"
            } else {
                it[0]
            }
        }
        html = html.replaceAll(/(a)\s+(href=)["'](.+?)["']/,replacer)
        html = html.replaceAll(/(img)\s+(src=)["'](.+?)["']/,replacer)
        KNOWN_REPLACEMENTS.each { link, repl ->
            html = html.replaceAll(link, repl)
        }
        html
    }