Lua filter in Quarto pdf render

Hi guys! I have been working for a while with Quarto to generate some pdf based on md files. Everything ran smoothly until I came across with lua filters. To make the history short, I create a lua filter to replace some inline code with strings in order to use the shortcodes feature you provide; however, I think that the time when this filter is applied does not match when the shortcode are render it.

Here is my lua filter:

-- Filtro Lua para reemplazar `=this.Producto` por `{{< meta Producto >}}`
function Code(el)
    -- Verificamos si el código inline es de la forma `=this.Producto`
    if el.text:match("^=this%.([%w_]+)$") then
      -- Extraemos el nombre del "Producto" (el texto después de "=this.")
      local producto = el.text:match("^=this%.([%w_]+)$")
      
      local nodos = {
      pandoc.Str("{{<"),
      pandoc.Space(),
      pandoc.Str("meta"),
      pandoc.Space(),
      pandoc.Str(producto),
      pandoc.Space(),
      pandoc.Str(">}}")
      }

      -- print(pandoc.Str("{{< meta " .. producto .. " >}}"))
      -- Reemplazamos `=this.Producto` por `{{< meta Producto >}}`
      -- return pandoc.Str("{{< meta " .. producto .. " >}}")
      return nodos
    end
    -- Si no coincide, retornamos el contenido tal cual
    return el
  end
  
  -- Devolvemos el filtro para que se aplique a todos los elementos de tipo "InlineCode"
  return {
    { Code = Code }
  }

The file that I am testing is similar to:

---
Producto: Producto1
title: Ejemplo
format: 
  pdf: 
    filters:
       - at: pre-render
         path: filtro.lua
---

# Hola, hoy vamos a hablar de `=this.Producto` y {{< meta title >}}

# encambio esto funciona {{< meta Producto >}}

The pdf result says:

Hola, hoy vamos a hablar de {{< meta Producto >}} y Ejemplo

encambio esto funciona Producto1

This means that the lua filter is not applied correctly by the time that I am looking at. What can I do differently? I am seeking another option to convert the text using bash rather that lua, but I would like to know if I am missing something at this point with the lua filter generated.

Finally, thanks for your support.
Regards

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.