ENV_CLASSES = { 'intro', 'zitat', 'hinweis' } local function context(s) return pandoc.RawBlock('context', s) end local function get_env_class(elem) if elem.classes then for i = 1, #elem.classes do for j = 1, #ENV_CLASSES do if elem.classes[i] == ENV_CLASSES[j] then return ENV_CLASSES[j] end end end else error('function has_class used on an element of type ' .. elem.t .. ' that cannot have classes.') end end function Div(el) local env_class = get_env_class(el) -- nil if there is none if env_class then -- false if env_class is nil return { context('\\startparagraph['.. env_class ..']'), el, context('\\stopparagraph') } end end