diff --git a/.vscode/bookdetails-schema.json b/.vscode/bookdetails-schema.json new file mode 100644 index 0000000..db9251d --- /dev/null +++ b/.vscode/bookdetails-schema.json @@ -0,0 +1,166 @@ +{ + "$id": "bookdetails-schema.json#", + "default": { + "code": "ID3xx", + "title": "New book", + "desc": ["Nice", "A *new* book"], + "cover": { + "src": "", + "alt": "" + } + }, + + "properties": { + "code": { + "title": "Book code, follow the ID3xx pattern - Not used", + "type": "string", + "pattern": "^[A-Z0-9]{3}\\d{2}$" + }, + "title": { + "type": "string", + "maxLength": 30 + }, + "author": { + "title": "Book authors", + "type": "array", + "maxLength": 5, + "items": { + "title": "Author", + "type": "string", + "examples": ["Neil Gailman", "Team Agate"] + }, + "examples": [["Team Agate"], ["Neil Gailman", "Rachida Dati"]] + }, + "desc": { + "title": "Book desc, markdown formated, each row is a paragraph.", + "type": "array" + }, + "cover": { + "title": "Book cover", + "type": "object", + "required": ["src"], + "properties": { + "src": { + "title": "Source file path, in relative path", + "type": "string", + "format": "uri-reference", + "default": "", + "examples": ["img\\books\\ADV01_BC_FR.png"] + }, + "alt": { + "type": "string", + "examples": ["ADV01_BC_FR"] + }, + "title": { + "type": "string", + "examples": ["ADV01_BC_FR"] + } + }, + "examples": [ + { + "src": "img\\books\\ADV01_BC_FR.png", + "alt": "ADV01_BC_FR", + "title": "ADV01_BC_FR" + } + ] + }, + "published-date": { + "title": "The published-date Schema", + "type": "string", + "default": "", + "examples": ["01/04/2018"] + }, + "cf-date": { + "title": "The cf-date Schema", + "type": "string", + "format": "date", + "default": "", + "examples": ["14/03/2016"] + }, + "physical-link": { + "title": "The physical-link Schema", + "type": "object", + "default": {}, + "required": ["title", "href"], + "properties": { + "title": { + "title": "The title Schema", + "type": "string", + "default": "", + "examples": ["Acheter un exemplaire"] + }, + "href": { + "title": "The href Schema", + "type": "string", + "format":"uri", + "default": "", + "examples": [ + "https://www.philibertnet.com/fr/dragons/62090-dragons-1-aventuriers-livre-de-base-9782919256365.html" + ] + } + }, + "examples": [ + { + "title": "Acheter un exemplaire", + "href": "https://www.philibertnet.com/fr/dragons/62090-dragons-1-aventuriers-livre-de-base-9782919256365.html" + } + ] + }, + "pdf-link": { + "title": "The pdf-link Schema", + "type": "object", + "default": {}, + "required": ["title", "href"], + "properties": { + "title": { + "title": "The title Schema", + "type": "string", + "default": "", + "examples": ["Acheter le pdf"] + }, + "href": { + "title": "The href Schema", + "type": "string", + "default": "", + "examples": [ + "https://www.drivethrurpg.com/product/422886/Dragons--1--Livre-de-base--Aventuriers" + ] + } + }, + "examples": [ + { + "title": "Acheter le pdf", + "href": "https://www.drivethrurpg.com/product/422886/Dragons--1--Livre-de-base--Aventuriers" + } + ] + }, + "cf-link": { + "title": "The cf-link Schema", + "type": "object", + "default": {}, + "required": ["title", "href"], + "properties": { + "title": { + "title": "The title Schema", + "type": "string", + "default": "", + "examples": ["Ulule"] + }, + "href": { + "title": "The href Schema", + "type": "string", + "default": "", + "examples": ["https://fr.ulule.com/dragons-5e/"] + } + }, + "examples": [ + { + "title": "Ulule", + "href": "https://fr.ulule.com/dragons-5e/" + } + ] + } + }, + "additionalProperties": false, + "required": ["title", "desc", "cover"] +} diff --git a/.vscode/books-schemas.json b/.vscode/books-schemas.json new file mode 100644 index 0000000..ee32a6b --- /dev/null +++ b/.vscode/books-schemas.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "patternProperties": { + "^[A-Z0-9]{3}\\d{2}$": { + "title": "Book code, follow the ID3xx pattern", + "type": "object", + "$ref": "bookdetails-schema.json#" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index b71d5fe..ed03022 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,16 @@ { "json.schemas": [ - { "fileMatch": [ "data/spells/*.json" ], "url": "/./.vscode/spells-schemas.json" + }, + { + "fileMatch": [ + "data/books*.json" + ], + "url": "/./.vscode/books-schemas.json" } ], "stenography.apiKey": "caac2b35-1682-4741-a409-d687f69d9767", diff --git a/lang/books-en.json b/data/books-en.json similarity index 90% rename from lang/books-en.json rename to data/books-en.json index d31f823..aae50f1 100644 --- a/lang/books-en.json +++ b/data/books-en.json @@ -12,7 +12,14 @@ "title":"Acheter un exemplaire", "href":"https://www.philibertnet.com/fr/dragons/62090-dragons-1-aventuriers-livre-de-base-9782919256365.html" }, - "pdf-link": "https://www.drivethrurpg.com/product/422886/Dragons--1--Livre-de-base--Aventuriers", + "pdf-link":{ + "title":"Acheter le pdf", + "href":"https://www.drivethrurpg.com/product/422886/Dragons--1--Livre-de-base--Aventuriers" + }, + "cf-link":{ + "title":"Ulule", + "href":"https://fr.ulule.com/dragons-5e/" + }, "author": ["Agate Team"], "published-date": "01/04/2018", "cf-date": "14/03/2016", diff --git a/lang/books-fr.json b/data/books-fr.json similarity index 93% rename from lang/books-fr.json rename to data/books-fr.json index a7a2121..82fd7dc 100644 --- a/lang/books-fr.json +++ b/data/books-fr.json @@ -16,7 +16,7 @@ "title":"Acheter le pdf", "href":"https://www.drivethrurpg.com/product/422886/Dragons--1--Livre-de-base--Aventuriers" }, - "cf-link:":{ + "cf-link":{ "title":"Ulule", "href":"https://fr.ulule.com/dragons-5e/" }, @@ -32,7 +32,7 @@ "CRE02": { "code": "CRE02", "title": "Créatures : Inframonde", - "desc": ["*"], + "desc": [], "physical-link": { "title":"Acheter un exemplaire", "href":"" @@ -41,7 +41,7 @@ "title":"Acheter le pdf", "href":"https://www.drivethrurpg.com/product/422893/Dragons--5--Bestiaire--Creatures-2-Inframonde" }, - "cf-link:":{ + "cf-link":{ "title":"Ulule", "href":"https://fr.ulule.com/dragons-creatures-de-l-inframonde/" }, @@ -53,5 +53,15 @@ "alt": "CRE02_BC_FR", "title": "CRE02_BC_FR" } + },"ADV02":{ + "code": "ID3xx", + "title": "New book", + "desc": [ + "Nice", + "A *new* book" + ], + "cover": "" } + + }