displaying tags
This commit is contained in:
parent
33d0082543
commit
81528c2321
@ -5,6 +5,9 @@ var parseString = require("xml2js").parseString;
|
||||
var router = express.Router();
|
||||
var fileToOpen = 'gtg_tasks'
|
||||
|
||||
// const convertFiles = true;
|
||||
const convertFiles = false;
|
||||
|
||||
const json = {
|
||||
tasks : {},
|
||||
projects : {},
|
||||
@ -16,17 +19,24 @@ const json = {
|
||||
*/
|
||||
router.get('/', async function (req, res, next) {
|
||||
|
||||
if(convertFiles){
|
||||
|
||||
convertOneXmlToJson('gtg_tasks',res)
|
||||
convertOneXmlToJson('tags',res)
|
||||
convertOneXmlToJson('projects',res)
|
||||
}else{
|
||||
console.log('================== conversion de fichiers désactivée dans index.js ================== ')
|
||||
}
|
||||
|
||||
// récupérer le contenu des json
|
||||
fs.readFile(`sources/tags_gtg.json`, "utf-8", function (err, data) {
|
||||
if (err) console.log(err);
|
||||
json.tags = data
|
||||
json.tags = JSON.parse(data)
|
||||
console.log('json', json)
|
||||
res.render('index', {title: "Conversion de GTG tâches", json: json})
|
||||
});
|
||||
|
||||
res.render('index', {title: "Conversion de GTG tâches", json: json})
|
||||
|
||||
|
||||
});
|
||||
|
||||
@ -34,7 +44,6 @@ router.get('/', async function (req, res, next) {
|
||||
function convertOneXmlToJson(fileToOpen,res){
|
||||
fs.readFile(`sources/${fileToOpen}.xml`, "utf-8", function (err, data) {
|
||||
if (err) console.log(err);
|
||||
console.log(data);
|
||||
const results = transformToJson(data, fileToOpen, res)
|
||||
console.log('fichier converti en json', fileToOpen)
|
||||
|
||||
|
@ -3,3 +3,8 @@ extends layout
|
||||
block content
|
||||
h1= title
|
||||
p Welcome to #{title}
|
||||
section.tags
|
||||
h2= "Tags"
|
||||
ul
|
||||
each t in json.tags.tagstore
|
||||
li= t.$.name
|
||||
|
Loading…
Reference in New Issue
Block a user