18 lines
516 B
Plaintext
18 lines
516 B
Plaintext
process_tags = (tags_str) ->
|
|
-- split into a table to garuntee uniqueness
|
|
unique = {}
|
|
for tag in tags_str\gmatch "%S+"
|
|
unique[tag] = true
|
|
-- place back into an array
|
|
taglist = {}
|
|
for tag in pairs unique
|
|
table.insert taglist, tag
|
|
-- sort case-sensitively and then case-insensitively (so capitalized tags appear before their uncapitalized counterparts)
|
|
table.sort taglist
|
|
table.sort taglist, (a, b) -> a\lower! < b\lower!
|
|
return " #{table.concat taglist, " "} "
|
|
|
|
return {
|
|
:process_tags
|
|
}
|