diff --git a/.gitignore b/.gitignore index 2988411b..7dd74b52 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ # Created by .ignore support plugin (hsz.mobi) /php/odt_reader/vendor/ /php/odt_reader/*.ods +/org-parse/tasks.org +**/*/node_modules \ No newline at end of file diff --git a/org-parse/index.js b/org-parse/index.js new file mode 100644 index 00000000..15172e31 --- /dev/null +++ b/org-parse/index.js @@ -0,0 +1,28 @@ +/** + afficher des infos depuis un fichier orgmode source + **/ + +import org from 'org'; +import fs from 'fs'; + +let input_orgmode_file_name = './tasks.org'; +input_orgmode_file_name = './input.org'; + +fs.readFile(input_orgmode_file_name, 'utf8', function read(err, data) { + if (err) { + throw err; + } + const org_content = data; + var parser = new org.Parser(); + var orgDocument = parser.parse(org_content); + + console.log('le fichier input.org a ce nombre de'); + console.log(' SOMEDAY:', org_content.toString().match(/SOMEDAY/g)?.length); + console.log(' TODO:', org_content.toString().match(/TODO/g)?.length); + console.log(' NEXT:', org_content.toString().match(/NEXT/g)?.length); + console.log(' CANCELLED:', org_content.toString().match(/CANCELLED/g)?.length); + console.log(' DONE:', org_content.toString().match(/DONE/g)?.length); + +}); + + diff --git a/org-parse/input.org b/org-parse/input.org new file mode 100644 index 00000000..6f3e9627 --- /dev/null +++ b/org-parse/input.org @@ -0,0 +1,11 @@ +* des choses +** TODO faire un truc +une tâche de niveau 2 sans tag, properties ni logbook +** TODO faire un autre truc :autre: + :LOGBOOK: + - State "CANCELLED" from "TODO" [2023-02-28 mar. 11:50] + :END: + ya du logbook ici wohoo +*** SOMEDAY avoir une idée :idea: +** CANCELLED envoyer un justificatif médical :ARCHIVE: + héééééé oui le texte de note \ No newline at end of file diff --git a/org-parse/output.txt b/org-parse/output.txt new file mode 100644 index 00000000..0bf31d64 --- /dev/null +++ b/org-parse/output.txt @@ -0,0 +1,6 @@ +le fichier input.org a ce nombre de + SOMEDAY: 1 + TODO: 3 + NEXT: undefined + CANCELLED: 2 + DONE: undefined diff --git a/org-parse/package-lock.json b/org-parse/package-lock.json new file mode 100644 index 00000000..7561f62e --- /dev/null +++ b/org-parse/package-lock.json @@ -0,0 +1,24 @@ +{ + "name": "org-parse", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "org": "^0.2.0" + } + }, + "node_modules/org": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/org/-/org-0.2.0.tgz", + "integrity": "sha512-jlArvMYhC9ZZSwrZQDfkC1q6lCX/200qr24hkEavQc6cbigA1Y92uwDfpvPgLqpOQSLfSQi6XvmTtglsKX9riw==" + } + }, + "dependencies": { + "org": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/org/-/org-0.2.0.tgz", + "integrity": "sha512-jlArvMYhC9ZZSwrZQDfkC1q6lCX/200qr24hkEavQc6cbigA1Y92uwDfpvPgLqpOQSLfSQi6XvmTtglsKX9riw==" + } + } +} diff --git a/org-parse/package.json b/org-parse/package.json new file mode 100644 index 00000000..2ce48021 --- /dev/null +++ b/org-parse/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "org": "^0.2.0" + }, + "type" : "module" +} diff --git a/org-parse/update_tasks.sh b/org-parse/update_tasks.sh new file mode 100644 index 00000000..36299f62 --- /dev/null +++ b/org-parse/update_tasks.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo "mise à jour du fichier de tâches orgmode du workflow nextcloud"; +cp /home/cipherbliss/Nextcloud/textes/orgmode/tasks.org . +node index.js > output.txt \ No newline at end of file