summaryrefslogtreecommitdiffstats
path: root/filters/emojis.lua
blob: 5eb9d4bf91a8f470b1256ae593472a6b90b29720 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
local common = require 'filters.lib.common'

function Str(el)
    local prefix, emojiref, suffix = el.text:match('^(.*):([^ ]+):(.*)$')

    if emojiref then
        local els = pandoc.List()
    
        els:insert(pandoc.Str(prefix))
        els:insert(pandoc.Image(emojiref, "/emojis/" .. emojiref .. ".png", emojiref, { class = 'o-emoji' }))
        els:insert(pandoc.Str(suffix))
    
        return els
    end

    return el
end