SwedbankPay/kramdown-plantuml

Support documents in _posts

Closed this issue · 3 comments

in jekyll_provider.rb, only render pages in site_post_write, posts are also needed to be rendered.

        def site_post_write(site)
          logger.debug 'Jekyll:site:post_write triggered.'
          @site_destination_dir ||= site.dest

          site.pages.each do |page|
            processor = JekyllPageProcessor.new(page)

            next unless processor.should_process?

            processor.process(site.dest)
          end

          site.posts.each do |post|
            processor = JekyllPageProcessor.new(post)

            next unless processor.should_process?

            processor.process(site.dest)
          end
        end

This behaviour was introduced in version 1.1.1 to support theming. However, I have different ideas about this now that should make it more compatible with the old behaviour:

  1. We should not invoke the Jekyll behaviour unless the plantuml configuration contains theme.
  2. We may circumvent most of the Jekyll integration by resolving theme.directory to site.source instead of site.dest, since we then shouldn't need to wait until Jekyll has written to site.dest before invoking PlantUML.

If we attempt to fix this as is, we should definitely iterate over site.posts as well. I'm just not sure how well the post object correlates to the Jekyll::Page class. It looks like site.posts is a Jekyll::Collection, so the processing of posts and pages seem so different within Jekyll that we may need different processing in kramdown-plantuml as well.

As just a user of this extension and has no knowledge of Ruby language, I just copy paste the iterate from page to post as described before. and it really works as expected, I can render the posts with the code slices now.

maybe there is better solution as you described(although I don't know the background and knowledge of it). Wishing this issue can be solved soon😊.

Please submit a PR with your code, so we can see whether the tests are successful @durd07. If they are, we can get a new version out today. Then we can work on the more long-term fixes for a future release.