Skip to content

Block processor extension / parseContent() does not perform substitutions #1306

@d-gregorczyk

Description

@d-gregorczyk

I created a block processor extension that transform blocks of type "test" to regular sidebars, nothing spectacular (it does a bit more, but this is not of interest to the problem statement). Recently I found out that the block processor's parseContent() function does not perform substitutions, even if explicitly passed as attributes. Example code (Kotlin):

@Name("test")
@Contexts(Contexts.SIDEBAR)
@ContentModel(ContentModel.COMPOUND)
public class TestProcessor : BlockProcessor("test") {

    public override fun process(
        parent: StructuralNode,
        reader: Reader,
        attributes: MutableMap<String, Any>,
    ): Any {
        val block = createBlock(
            parent, "sidebar", mapOf(
                Options.ATTRIBUTES to attributes,
                ContentModel.KEY to ContentModel.COMPOUND
            )
        )

        parseContent(block, reader.readLines())
        return block
    }
}

The following content spits out the sidebar without any substution:

== Test

:attr: Foobar

[test#id, subs=normal]
****
Here is a sidebar with failed substitutions: {attr}
****

results in

Image

while the converter without any block processors being applied substitutes attributes correctly.

Is that behavior on purpose, is it a bug or did I do something wrong?

Thanks for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions