public Writer render()

in src/main/java/org/apache/commons/release/plugin/velocity/ReadmeHtmlVelocityDelegate.java [131:161]


    public Writer render(final Writer writer) {
        final VelocityEngine ve = new VelocityEngine();
        ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
        ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
        ve.init();
        final Template template = ve.getTemplate(TEMPLATE);
        final String[] splitArtifactId = artifactId.split("-");
        final String wordCommons = "commons";
        String artifactShortName = "";
        if (splitArtifactId.length > 1) {
            artifactShortName = splitArtifactId[1];
        } else if (splitArtifactId.length == 1) {
            artifactShortName = splitArtifactId[0];
        }
        // ".+\\d$" matches a non-empty string that terminates in a digit {0-9}.
        if (artifactShortName.matches(".+\\d$")) {
            artifactShortName = artifactShortName.substring(0, artifactShortName.length() - 1);
        }
        final String artifactIdWithFirstLetterscapitalized =
                StringUtils.capitalize(wordCommons)
                        + "-"
                        + artifactShortName.toUpperCase();
        final VelocityContext context = new VelocityContext();
        context.internalPut("artifactIdWithFirstLetterscapitalized", artifactIdWithFirstLetterscapitalized);
        context.internalPut("artifactShortName", artifactShortName.toUpperCase());
        context.internalPut("artifactId", artifactId);
        context.internalPut("version", version);
        context.internalPut("siteUrl", siteUrl);
        template.merge(context, writer);
        return writer;
    }