Module:TagParser

--WIP

--script that'll allow you to just paste .json metadata from a doujin into it and it will assemble a neat tag table

require('Module:StrSplit') local p = {}

function p.main local str = mw.getCurrentFrame.args[1] local str =  "gallery_info": {    "title": "[Salmon Daisuki Club (Done)] Loli Baba ni Amaetai. [Digital]",    "title_original": "[サーモンだいすきクラブ (どね)] ろりばばに甘えたい.  [DL版]",    "category": "doujinshi",    "tags": {      "parody": [        "original"      ],      "group": [        "salmon daisuki club"      ],      "artist": [        "done"      ],      "male": [        "sole male"      ],      "female": [        "fox girl",        "kemonomimi",        "lolicon",        "sole female",        "thick eyebrows"      ]    },    "language": "Japanese",    "translated": false,    "favorite_category": null,    "upload_date": [      2020,      9,      15,      13,      32,      0    ],  },

str = str:gsub("\"","\'")   --mw.logObject("STR: "..str)    mw.logObject(str:match("'title': '(.-)',"))    local title = str:match("'title': '(.-)',")    local title_original = str:match("'title_original': '(.-)',")    local tags = str:match("'tags': %{(.-)%}")    --mw.logObject("TAGS: "..tags)    local tagsTab = {}    --local tags = tags:match("'(.-)': %[(.-)%],")

for k, v in string.gmatch(tags,"'.-': %[.-%]") do       local key = k:match("'(.-)': %[.-%]") local val = k:match("'.-': %[(.-)%]") val = val:gsub(\,"") valTab = {} --strSplit(val,",") for k, v in string.gmatch(val,"'(.-)'") do           table.insert(valTab,k) end --mw.logObject("KEY: "..key.."\nVAL: "..val) --mw.logObject(valTab) tagsTab[key] = valTab end mw.logObject("TAGS TAB:") mw.logObject(tagsTab)

--NOW ASSEMBLE PARSED DATA INTO TABLE

return end return p