Class FixSiteAnchorsMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- com.github.robtimus.maven.plugins.buildhelper.FixSiteAnchorsMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="fix-site-anchors", defaultPhase=SITE, requiresProject=true, threadSafe=true) public class FixSiteAnchorsMojo extends org.apache.maven.plugin.AbstractMojoFixes anchors in URLs in site files.If a Markdown file contains a link to a method's Javadoc, in modern Java versions this link contains
(and). Even if these are escaped, the site plugin replaces these with.28and.29respectively. This mojo can be used to fix these incorrect replacements.- Since:
- 2.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFixSiteAnchorsMojo.ReplacementA single replacement.
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.StringencodingThe encoding to use for reading and writing site files.(package private) java.io.File[]filesThe files to replace anchors in.(package private) org.apache.maven.project.MavenProjectproject(package private) FixSiteAnchorsMojo.Replacement[]replacementsThe replacements to make.private static java.util.regex.PatternTAG_PATTERN
-
Constructor Summary
Constructors Constructor Description FixSiteAnchorsMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute()private java.lang.StringfixSiteAnchors(java.lang.String filePath, java.lang.String content)(package private) voidfixSiteAnchors(java.nio.file.Path path, java.nio.charset.Charset charset)private java.lang.StringfixSiteAnchorsInUrl(java.lang.String url)(package private) java.nio.charset.CharsetgetCharset()private java.lang.StringreadContent(java.nio.file.Path file, java.nio.charset.Charset charset)private voidwriteContent(java.nio.file.Path file, java.lang.String content, java.nio.charset.Charset charset)
-
-
-
Field Detail
-
TAG_PATTERN
private static final java.util.regex.Pattern TAG_PATTERN
-
project
@Parameter(defaultValue="${project}", readonly=true) org.apache.maven.project.MavenProject project
-
files
@Parameter(required=true) java.io.File[] files
The files to replace anchors in.- Since:
- 2.0
-
replacements
@Parameter(required=false) FixSiteAnchorsMojo.Replacement[] replacements
The replacements to make. If not specified this is equal to the following:<replacements> <replacement> <search>.28</search> <replace>(</replace> </replacement> <replacement> <search>.29</search> <replace>)</replace> </replacement> <replacement> <search>.25</search> <replace>%</replace> </replacement> </replacements>- Since:
- 2.0
-
encoding
@Parameter(defaultValue="${project.build.sourceEncoding}") java.lang.String encodingThe encoding to use for reading and writing site files.- Since:
- 2.0
-
-
Method Detail
-
execute
public void execute() throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
getCharset
java.nio.charset.Charset getCharset()
-
fixSiteAnchors
void fixSiteAnchors(java.nio.file.Path path, java.nio.charset.Charset charset) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
readContent
private java.lang.String readContent(java.nio.file.Path file, java.nio.charset.Charset charset) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
writeContent
private void writeContent(java.nio.file.Path file, java.lang.String content, java.nio.charset.Charset charset) throws org.apache.maven.plugin.MojoExecutionException- Throws:
org.apache.maven.plugin.MojoExecutionException
-
fixSiteAnchors
private java.lang.String fixSiteAnchors(java.lang.String filePath, java.lang.String content)
-
fixSiteAnchorsInUrl
private java.lang.String fixSiteAnchorsInUrl(java.lang.String url)
-
-