protected Context createDocumentVelocityContext()

in doxia-site-renderer/src/main/java/org/apache/maven/doxia/siterenderer/DefaultSiteRenderer.java [527:578]


    protected Context createDocumentVelocityContext(
            DocumentRenderingContext docRenderingContext, SiteRenderingContext siteRenderingContext) {
        Context context = createToolManagedVelocityContext(siteRenderingContext);
        // ----------------------------------------------------------------------
        // Data objects
        // ----------------------------------------------------------------------

        context.put("relativePath", docRenderingContext.getRelativePath());

        String currentFilePath = docRenderingContext.getOutputName();
        context.put("currentFilePath", currentFilePath);
        // TODO Deprecated -- will be removed!
        context.put("currentFileName", currentFilePath);

        String alignedFilePath = PathTool.calculateLink(currentFilePath, docRenderingContext.getRelativePath());
        context.put("alignedFilePath", alignedFilePath);
        // TODO Deprecated -- will be removed!
        context.put("alignedFileName", alignedFilePath);

        context.put("site", siteRenderingContext.getSiteModel());
        // TODO Deprecated -- will be removed!
        context.put("decoration", siteRenderingContext.getSiteModel());

        context.put("locale", siteRenderingContext.getLocale());
        context.put("supportedLocales", Collections.unmodifiableList(siteRenderingContext.getSiteLocales()));

        context.put("publishDate", siteRenderingContext.getPublishDate());

        if (DOXIA_SITE_RENDERER_VERSION != null) {
            context.put("doxiaSiteRendererVersion", DOXIA_SITE_RENDERER_VERSION);
        }

        // Add user properties
        Map<String, ?> templateProperties = siteRenderingContext.getTemplateProperties();

        if (templateProperties != null) {
            for (Map.Entry<String, ?> entry : templateProperties.entrySet()) {
                context.put(entry.getKey(), entry.getValue());
            }
        }

        // ----------------------------------------------------------------------
        // Tools
        // ----------------------------------------------------------------------

        context.put("PathTool", new PathTool());

        context.put("StringUtils", new StringUtils());

        context.put("plexus", plexus);
        return context;
    }