Giter Site home page Giter Site logo

Comments (5)

bk avatar bk commented on July 26, 2024

Hello Kevin,

You are indeed right that the inline directive does not work properly inside pandoc-processed pages. Raw inlines do work, e.g.

[[!inline raw="yes" pages="ovipara/vertebrata/aves/*"]]

which means that the plugin is being called at the proper place, but the more common form of inline with archive="yes" for some reason fails. I will need to look further into this.

from ikiwiki-pandoc.

bk avatar bk commented on July 26, 2024

I have now investigated the issue further. The reason that content is dropped is the somehwat unfortunate method the inline plugin uses for inserting the content into the page:

  1. In the preprocess hook, which happens before the content has been transformed into HTML, it assembles the pages to be rendered and transforms them into HTML. Unless we're dealing with raw or nested inlines, these snippets of HTML are not inserted into the page at once. Instead, the plugin inserts placeholders which look like <div class="inline" id="XX"></div>, where XX the number of the snippet to be placed there.
  2. The markup processor (in our case pandoc) now processes the base page, which no longer contains inline directives, but instead contains these placeholders.
  3. In the format hook, the inline plugin comes onto the scene again and replaces the placeholders with their corresponding snippets. This is done with a regular expression replacement.

The problem with this process from our perspective is that pandoc parses and re-outputs the placeholders. In the process, their id and class attributes are reversed. As a consequence, the regular expression fails to match and no snippets are in fact inserted.

In my opinion, the placeholder pattern in the inline plugin should be changed so as to prevent such problems, which no doubt affect other plugins as well. But even if this would be done, we still would have to detect inline placeholders in the pandoc plugin before pandoc is run, and protect them somehow from being mangled, since many people will have older versions of the inline plugin which do not contain this putative fix. I'll try to implement this during the weekend.

from ikiwiki-pandoc.

bk avatar bk commented on July 26, 2024

I've now fixed the issue by protecting inline placeholders from being processed by pandoc. The fix is in release v0.4.2.

from ikiwiki-pandoc.

sciunto avatar sciunto commented on July 26, 2024

Thanks @bk !

from ikiwiki-pandoc.

hlzr avatar hlzr commented on July 26, 2024

Thank you very much!

from ikiwiki-pandoc.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.