pandoc script to convert markdown to standalone html
This commit is contained in:
parent
79bf2f4847
commit
cd87d78f06
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ sources/
|
||||
.idea
|
||||
node_modules
|
||||
output/
|
||||
output/*
|
||||
|
9
export_md_to_html.sh
Normal file
9
export_md_to_html.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
echo " _____ convert the markdown on output with pandoc ____"
|
||||
|
||||
pandoc output/export_hebdo.md -t html -s -o output/export_hebdo.html
|
||||
pandoc output/export_tags.md -t html -s -o output/export_tags.html
|
||||
pandoc output/export_all.md -t html -s -o output/export_all.html
|
||||
ls -larth output/*.html
|
||||
|
||||
echo " _____ ok files converted to html ____"
|
@ -46,6 +46,7 @@ router.get('/', async function (req, res, next) {
|
||||
res.render('index', {
|
||||
title: "Conversion de GTG tâches",
|
||||
json : jsonAllData,
|
||||
markdown : markdownExportData,
|
||||
getPercent,
|
||||
computeBgColorOnProportionOfOpenTasks,
|
||||
getPercentOfOpenTasks
|
||||
@ -208,49 +209,55 @@ function computeBgColorOnProportionOfOpenTasks(someProportionNumber) {
|
||||
return result;
|
||||
}
|
||||
let datenow = new Date();
|
||||
let dataTagsMd = `# Export de Tâches GTG \n date: ` + datenow.toLocaleString()
|
||||
|
||||
let markdownExportData = ''
|
||||
function exportToMarkdown(res) {
|
||||
|
||||
|
||||
markdownExportData = `# Export de Tâches GTG \n date: ` + datenow.toLocaleString()
|
||||
// fichier de rapport des tâches fermées durant les 7 derniers jours
|
||||
dataTagsMd += `\n# Rapport hebdomadaire de dev `;
|
||||
dataTagsMd += `\n## ${jsonAllData.stats.listDevWeeklyClosed.length} ont été fermées `;
|
||||
markdownExportData += `\n# Rapport hebdomadaire de dev `;
|
||||
markdownExportData += `\n## ${jsonAllData.stats.listDevWeeklyClosed.length} ont été fermées `;
|
||||
jsonAllData.stats.listDevWeeklyClosed.map(elem => {
|
||||
dataTagsMd += `\n * ${elem.title}`;
|
||||
markdownExportData += `\n * ${elem.title}`;
|
||||
})
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n---`;
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n# Rapport des tâches durant les 7 derniers jours `;
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n## ${jsonAllData.stats.listClosedWeekly.length} ont été fermées `;
|
||||
dataTagsMd += `\n `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n---`;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n# Rapport des tâches durant les 7 derniers jours `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n## ${jsonAllData.stats.listClosedWeekly.length} ont été fermées `;
|
||||
markdownExportData += `\n `;
|
||||
jsonAllData.stats.listClosedWeekly.map(elem => {
|
||||
dataTagsMd += `\n * ${elem.title}`;
|
||||
markdownExportData += `\n * ${elem.title}`;
|
||||
})
|
||||
dataTagsMd += `\n## ${jsonAllData.stats.listOpenWeekly.length} ont été ouvertes `;
|
||||
dataTagsMd += `\n `;
|
||||
markdownExportData += `\n## ${jsonAllData.stats.listOpenWeekly.length} ont été ouvertes `;
|
||||
markdownExportData += `\n `;
|
||||
jsonAllData.stats.listOpenWeekly.map(elem => {
|
||||
dataTagsMd += `\n * ${elem.title}`;
|
||||
markdownExportData += `\n * ${elem.title}`;
|
||||
})
|
||||
dataTagsMd += `\n--- `;
|
||||
markdownExportData += `\n--- `;
|
||||
// fichier de rapport des tâches fermées durant les 31 derniers jours
|
||||
dataTagsMd += `\n# Rapport des autres tâches durant le mois `;
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n## ${jsonAllData.stats.listClosedWeekly.length} ont été fermées `;
|
||||
dataTagsMd += `\n `;
|
||||
markdownExportData += `\n# Rapport des autres tâches durant le mois `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n## ${jsonAllData.stats.listClosedMonthly.length} ont été fermées `;
|
||||
markdownExportData += `\n `;
|
||||
jsonAllData.stats.listClosedMonthly.map(elem => {
|
||||
markdownExportData += `\n * ${elem.title}`;
|
||||
})
|
||||
markdownExportData += `\n## ${jsonAllData.stats.listOpenMonthly.length} ont été ouvertes `;
|
||||
markdownExportData += `\n `;
|
||||
jsonAllData.stats.listOpenMonthly.map(elem => {
|
||||
markdownExportData += `\n * ${elem.title}`;
|
||||
})
|
||||
|
||||
dataTagsMd += `\n## ${jsonAllData.stats.listOpenWeekly.length} ont été ouvertes `;
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n--- `;
|
||||
markdownExportData += `\n--- `;
|
||||
// stats de fermeture des tâches
|
||||
dataTagsMd += `\n# Stats de fermeture des tâches `;
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n--- `;
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n# Export de toutes les ${jsonAllData.stats.listOpen.length} tâches ouvertes GTG \n `;
|
||||
dataTagsMd += `\n `;
|
||||
markdownExportData += `\n# Stats de fermeture des tâches `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n--- `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n# Export de toutes les ${jsonAllData.stats.listOpen.length} tâches ouvertes GTG \n `;
|
||||
markdownExportData += `\n `;
|
||||
|
||||
// jsonAllData.stats.listOpen.map(elem => {
|
||||
// dataTagsMd += `\n## ${elem.title} `;
|
||||
@ -260,32 +267,32 @@ function exportToMarkdown(res) {
|
||||
// dataTagsMd += `\n prévu pour : ${elem.duedate | ''} `;
|
||||
// dataTagsMd += `\n ${elem.content} `;
|
||||
// })
|
||||
dataTagsMd += `\n--- `;
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n# Export de toutes les ${jsonAllData.stats.listClosed.length} tâches fermées GTG \n `;
|
||||
dataTagsMd += `\n `;
|
||||
markdownExportData += `\n--- `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n# Export de toutes les ${jsonAllData.stats.listClosed.length} tâches fermées GTG \n `;
|
||||
markdownExportData += `\n `;
|
||||
//
|
||||
// jsonAllData.stats.listClosed.map(elem=>{
|
||||
// dataTagsMd += `\n * ${elem.title} `;
|
||||
// })
|
||||
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n# Export de Tags GTG \n `;
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n# Export de Tags GTG \n `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n `;
|
||||
|
||||
let sortedTagsByTitle = _.sortBy(jsonAllData.tags.tagstore.tag, [(o) => {
|
||||
o["$"].name
|
||||
}])
|
||||
|
||||
sortedTagsByTitle.map(elem => {
|
||||
dataTagsMd += `\n * ${elem['$'].name} , ${elem.tasks | 0}`;
|
||||
markdownExportData += `\n * ${elem['$'].name} , ${elem.tasks | 0}`;
|
||||
})
|
||||
|
||||
dataTagsMd += `\n `;
|
||||
dataTagsMd += `\n rapport généré avec gtg2nodejs par tykayn - contact@cipherbliss.com `;
|
||||
markdownExportData += `\n `;
|
||||
markdownExportData += `\n rapport généré avec gtg2nodejs par tykayn - contact@cipherbliss.com `;
|
||||
// write file to disk
|
||||
fs.writeFile(`output/export_tags.md`, dataTagsMd, `utf8`, (err) => {
|
||||
fs.writeFile(`output/export_hebdo.md`, markdownExportData, `utf8`, (err) => {
|
||||
|
||||
if (err) {
|
||||
console.log(`Error writing file: ${err}`);
|
||||
|
@ -12,6 +12,8 @@ block content
|
||||
li #{json.stats.listClosed.length} fermées
|
||||
li #{json.stats.listClosedWeekly.length} fermées cette semaine
|
||||
li #{json.stats.listClosedMonthly.length} fermées ce mois-ci
|
||||
section.markdown
|
||||
article(language="md")= markdown
|
||||
section.tags
|
||||
h2 #{json.tags.tagstore.tag.length} Tags
|
||||
p maximum de #{json.stats.maxTasksCountPerTag} tâches pour un tag.
|
||||
|
Loading…
Reference in New Issue
Block a user