Hello.
I used dostring function to execute code in string.
I will do this
PlotaDiario = function()
local s = [==[
---
${columns( preenche_semana2(editor.getCurrentPage()) ) }
Últimas mofificadas
${template.each (query[[from index.tag "page" order by lastModified desc limit 10]], templates.pageItem) }
]==]
return s
end
in a day page I put
${ PlotaDiario() }
I will use to execute the code when the page is open.
${ dostring(PlotaDiario()) }
Hey, I’m not 100% sure what you are trying to accomplish, but I got this to work. What you want here is not to evaluate your string as Lua code, but as markdown.
Note: I had to fix a bug to make this work, so please be sure to upgrade to the latest v2 commit.
```space-lua
function PlotaDiario()
local s = [==[
Últimas mofificadas
${template.each (query[[from index.tag "page" order by lastModified desc limit 10]], templates.pageItem) }
]==]
local parsed = markdown.parseMarkdown(s)
-- This replaces the ${...} stuff with actual values
local expanded = markdown.expandMarkdown(parsed)
return markdown.renderParseTree(expanded)
end
```
${PlotaDiario()}
In that case you don’t havethe latest version, this is exactly the error I fixed. Have you reloaded your browser a few times, the old version may also be cached.
I tested combining two Markdown blocks and both render. ${ UltimasModificadas().markdown.. ' \n ' .. UltimasModificadas().markdown }
If I pass only the HTML, it renders. ${ painelTarefasSemana() }
But when I pass two, and one of them is HTML, it doesn’t render. ${ painelTarefasSemana() .. ' \n ' .. painelTarefasSemana() }
or ${ painelTarefasSemana().html .. ' \n ' .. painelTarefasSemana().html }