Skip to content

Define heavyweight macros in a scripting language #9

@dhasenan

Description

@dhasenan

Let's say I'm writing a novel about Zatanna Zatara from the DC universe. I want to define something to automatically generate her backwards-speech spell thing. I should be able to do that. Something like:

% main.sub
\loadscript{util.lua}
\chapter{}
\zataracast{mosquitos be gone}!
-- util.lua
function macro.zataracast(content)
  if content.type == text then
    text = ''
    for word of content.text:split(' ') do
      if text.length > 0 then text += ' ' end
      text += word:reverse()
    done
    content.text = text
  end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions