Class AemApproximateMarkdownServicePlugin

    • Field Detail

      • FULLY_IGNORED_TYPES

        protected static final Pattern FULLY_IGNORED_TYPES
        If a resource renders as a resource type matching that pattern, we ignore it completely, including child nodes.
      • TEASER_TYPES

        protected static final Pattern TEASER_TYPES
      • EXPERIENCEFRAGMENT_TYPES

        protected static final Pattern EXPERIENCEFRAGMENT_TYPES
      • CONTENTFRAGMENT_TYPES

        protected static final Pattern CONTENTFRAGMENT_TYPES
    • Constructor Detail

      • AemApproximateMarkdownServicePlugin

        public AemApproximateMarkdownServicePlugin()
    • Method Detail

      • pageHandling

        protected boolean pageHandling​(org.apache.sling.api.resource.Resource resource,
                                       PrintWriter out,
                                       @Nonnull
                                       ApproximateMarkdownService service)
        Prints title and meta attributes, then continues to normal handling.

        ??? pageTitle vs. jcr:title , shortDescription

      • handleTeaser

        protected boolean handleTeaser​(org.apache.sling.api.resource.Resource resource,
                                       PrintWriter out,
                                       ApproximateMarkdownService service)
        Creates markdown for core/wcm/components/teaser/v1/teaser and derived components.
        See Also:
        "https://github.com/adobe/aem-core-wcm-components/blob/main/content/src/content/jcr_root/apps/core/wcm/components/teaser/v1/teaser/README.md"
      • getLinkedPage

        @Nullable
        protected org.apache.sling.api.resource.Resource getLinkedPage​(org.apache.sling.api.resource.Resource action)
      • handleExperienceFragment

        protected boolean handleExperienceFragment​(org.apache.sling.api.resource.Resource resource,
                                                   PrintWriter out,
                                                   ApproximateMarkdownService service,
                                                   org.apache.sling.api.SlingHttpServletRequest request,
                                                   org.apache.sling.api.SlingHttpServletResponse response)
        Creates markdown for core/wcm/components/experiencefragment/v1/experiencefragment and derived components.
        See Also:
        "https://github.com/adobe/aem-core-wcm-components/blob/main/content/src/content/jcr_root/apps/core/wcm/components/experiencefragment/v2/experiencefragment/README.md"
      • handleContentFragment

        protected boolean handleContentFragment​(org.apache.sling.api.resource.Resource resource,
                                                PrintWriter out,
                                                ApproximateMarkdownService service)
        Creates markdown for core/wcm/components/contentfragment/v1/contentfragment and derived components.
        See Also:
        "https://github.com/adobe/aem-core-wcm-components/blob/main/content/src/content/jcr_root/apps/core/wcm/components/contentfragment/v1/contentfragment/README.md"
      • renderReferencedContentFragment

        protected void renderReferencedContentFragment​(org.apache.sling.api.resource.Resource resource,
                                                       PrintWriter out,
                                                       ApproximateMarkdownService service,
                                                       org.apache.sling.api.resource.Resource referencedResource,
                                                       String variation,
                                                       String reference,
                                                       String[] elementNames)
      • findElementLabels

        protected void findElementLabels​(org.apache.sling.api.resource.Resource dataNode,
                                         Map<String,​String> labels,
                                         Map<String,​Integer> listOrder)
        Looks for the cq:model and determines the labels.
      • listModelResources

        protected List<org.apache.sling.api.resource.Resource> listModelResources​(List<org.apache.sling.api.resource.Resource> list,
                                                                                  org.apache.sling.api.resource.Resource traversed)
      • renderDamAssets

        protected boolean renderDamAssets​(org.apache.sling.api.resource.Resource resource,
                                          PrintWriter out,
                                          org.apache.sling.api.SlingHttpServletResponse response)
        If the resource is a dam:Asset or a dam:AssetContent jcr:content then we return an image link
      • resizeToMaxSize

        protected byte[] resizeToMaxSize​(@Nonnull
                                         byte[] imageData,
                                         String mimeType,
                                         int maxSize)
                                  throws IOException
        We resize the image to a maximum width and height of maxSize, keeping the aspect ratio. If it's smaller, it's returned as is. It could be of types image/jpeg, image/png or image/gif .
        Throws:
        IOException