SWADE tables

This commit is contained in:
LeRatierBretonnien 2023-09-06 21:50:16 +02:00
parent fd0ded8367
commit 2dab24eaa0
3 changed files with 178 additions and 1197 deletions

File diff suppressed because it is too large Load Diff

View File

@ -57,7 +57,7 @@
} }
], ],
"url": "https://www.uberwald.me/gitea/public/swade-fr-content", "url": "https://www.uberwald.me/gitea/public/swade-fr-content",
"version": "3.0.0", "version": "3.0.2",
"esmodules": [ "esmodules": [
"modules/swade-fr-init.js" "modules/swade-fr-init.js"
], ],
@ -73,7 +73,7 @@
} }
], ],
"manifest": "https://www.uberwald.me/gitea/public/swade-fr-content/raw/branch/master/module.json", "manifest": "https://www.uberwald.me/gitea/public/swade-fr-content/raw/branch/master/module.json",
"download": "https://www.uberwald.me/gitea/public/swade-fr-content/archive/swade-fr-content-3.0.0.zip", "download": "https://www.uberwald.me/gitea/public/swade-fr-content/archive/swade-fr-content-3.0.2.zip",
"id": "swade-fr-content", "id": "swade-fr-content",
"relationships": { "relationships": {
"requires": [ "requires": [

28
tools/convert_tables.lua Normal file
View File

@ -0,0 +1,28 @@
local jsonList = { 'swade-core-rules.swade-tables.json' }
local inFolder = '../compendiums/'
package.path = package.path .. ";luajson/?.lua"
local JSON = require'json'
for _, jsonFile in pairs(jsonList) do
local f = io.open(inFolder..jsonFile, "r")
local jsonIn = f:read("*a")
f:close()
local jsonInData = JSON.decode(jsonIn)
for key, entry in pairs(jsonInData.entries) do
if ( entry.results[1]) then
local newResults = {}
for key2, result in pairs(entry.results) do
newResults[tostring(result.range[1].."-"..result.range[2])] = result.text
end
entry.results = newResults
end
end
local jsonOut = JSON.encode(jsonInData )
f= io.open(inFolder..jsonFile.."NEW", "w+")
f:write(jsonOut)
f:close()
end