On 6 August 2013 13:07,  <[email protected]> wrote:
> Author: olegk
> Date: Tue Aug  6 12:07:52 2013
> New Revision: 1510917
>
> URL: http://svn.apache.org/r1510917
> Log:
> Restored rewriting of Maven generated links

Not sure why this should be needed - I've not noticed a problem with
the site plugin so long as the home page URL is correctly defined.

Or rather, there are lots of problems with the Site plugin, but
generating completely bogus links containing scp: paths is not one of
them.

> Modified:
>     httpcomponents/project-release-tools/trunk/.gitignore
>     httpcomponents/project-release-tools/trunk/site.gradle
>
> Modified: httpcomponents/project-release-tools/trunk/.gitignore
> URL: 
> http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/.gitignore?rev=1510917&r1=1510916&r2=1510917&view=diff
> ==============================================================================
> --- httpcomponents/project-release-tools/trunk/.gitignore (original)
> +++ httpcomponents/project-release-tools/trunk/.gitignore Tue Aug  6 12:07:52 
> 2013
> @@ -3,4 +3,5 @@ build
>  .gradle
>  .idea
>  *.iml
> +out
>  gradle.properties
>
> Modified: httpcomponents/project-release-tools/trunk/site.gradle
> URL: 
> http://svn.apache.org/viewvc/httpcomponents/project-release-tools/trunk/site.gradle?rev=1510917&r1=1510916&r2=1510917&view=diff
> ==============================================================================
> --- httpcomponents/project-release-tools/trunk/site.gradle (original)
> +++ httpcomponents/project-release-tools/trunk/site.gradle Tue Aug  6 
> 12:07:52 2013
> @@ -68,6 +68,7 @@ task stage(dependsOn: prepareStage) << {
>                  with siteContent(file("${release.localDir}/${submodule}"))
>              }
>          }
> +        fixLinks(release, file("${prepareStage.localDir}/${releaseSeries}"))
>      }
>      println("Copying content 
> ${website.pom.artifactId}:${website.pom.version} to ${prepareStage.localDir}")
>      copy {
> @@ -91,3 +92,36 @@ CopySpec siteContent(File dir) {
>  CopySpec siteContent(HCProject hcProject) {
>      siteContent(hcProject.localDir)
>  }
> +
> +void fixLinks(HCProject hcProject, File dstDir) {
> +
> +    // Deal with crappy links generated by Maven Site Plugin
> +    project.fileTree(dir: dstDir, include: '*.html').each {
> +        File f ->
> +            Html.rewriteLinks(f, { URI href ->
> +                if (!href.isAbsolute()) {
> +                    def m1 = href.path =~ 
> /^..(\/..\/scp:\/people.apache.org\/www)?\/hc.apache.org\//
> +                    if (m1.find()) {
> +                        return new URI(m1.replaceFirst('../'))
> +                    }
> +                }
> +                return href
> +            })
> +    }
> +
> +    hcProject.pom.modules.each { String submodule ->
> +        project.fileTree(dir: new File(dstDir, submodule), include: 
> '*.html').each {
> +            File f ->
> +                Html.rewriteLinks(f, { URI href ->
> +                    if (!href.isAbsolute()) {
> +                        def m1 = href.path =~ 
> /^..\/..(\/..\/scp:\/people.apache.org\/www)?\/hc.apache.org\//
> +                        if (m1.find()) {
> +                            return new URI(m1.replaceFirst('../../'))
> +                        }
> +                    }
> +                    return href
> +                })
> +        }
> +    }
> +
> +}
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to