add conversion from wordpress to org files
This commit is contained in:
parent
f62285d9a3
commit
40852b2b0d
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="qzine@localhost" uuid="d6cd614f-c9ce-42f7-93ed-c3e4aa5ba341">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://localhost:3306/qzine</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -1,7 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="WEB_MODULE" version="4">
|
<module type="WEB_MODULE" version="4">
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/wp2org/.idea" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.idea/dataSources" />
|
||||||
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
default : copyTasksJson
|
||||||
|
convert:
|
||||||
|
npm start
|
||||||
|
copyTasksJson :
|
||||||
|
echo "update du fichier tasks.json dans le dossier de sources depuis Nextcloud"
|
||||||
|
cp ~/Nextcloud/textes/orgmode/tasks.json sources/
|
||||||
|
npm start;
|
||||||
|
render :
|
||||||
|
serve output
|
||||||
|
firefox http://localhost:3000/output_all_tasks_report
|
|
@ -13,3 +13,7 @@ Lancer l'exécution du fichier app avec node, et consulter l'output html.
|
||||||
```bash
|
```bash
|
||||||
npm start
|
npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
|
||||||
|
# DONE
|
15
app.js
15
app.js
|
@ -7,12 +7,19 @@ const stats = {
|
||||||
tasksByYear : [],
|
tasksByYear : [],
|
||||||
|
|
||||||
};
|
};
|
||||||
|
const myArgs = process.argv;
|
||||||
|
console.log('command arguments: ', myArgs);
|
||||||
|
|
||||||
// const enableFilterByTag = true;
|
const enableFilterByTag = true;
|
||||||
const enableFilterByTag = false;
|
// const enableFilterByTag = false;
|
||||||
|
|
||||||
|
let outputFileName = 'all_tasks_report';
|
||||||
const filterByTag = 'work';
|
const filterByTag = 'work';
|
||||||
// const outputFileName = "work_report";
|
if(enableFilterByTag){
|
||||||
const outputFileName = 'all_tasks_report';
|
outputFileName = `${filterByTag}_filtered_tasks_report`;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
let countExcluded = 0;
|
let countExcluded = 0;
|
||||||
let countIncluded = 0;
|
let countIncluded = 0;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
/output/*
|
||||||
|
/node_modules/
|
||||||
|
extractions_bdd/*.json
|
||||||
|
extractions_bdd/done/*.json
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||||
|
<data-source source="LOCAL" name="qzine@localhost" uuid="d6cd614f-c9ce-42f7-93ed-c3e4aa5ba341">
|
||||||
|
<driver-ref>mariadb</driver-ref>
|
||||||
|
<synchronize>true</synchronize>
|
||||||
|
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
|
||||||
|
<jdbc-url>jdbc:mariadb://localhost:3306/qzine</jdbc-url>
|
||||||
|
<working-dir>$ProjectFileDir$</working-dir>
|
||||||
|
</data-source>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/wp2org.iml" filepath="$PROJECT_DIR$/.idea/wp2org.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="WEB_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
|
@ -0,0 +1,19 @@
|
||||||
|
# exportateur de posts wordpress vers orgmode
|
||||||
|
Pour transformer, il faut un export json d'une base de données de posts de blogs wordpress.
|
||||||
|
ICi ces exports sont faits depuis l'onglet Database dans l'IDE PhpStorm et les tables wp_posts.
|
||||||
|
|
||||||
|
Fonctionne aussi avec:
|
||||||
|
- les posts de forum Vanilla
|
||||||
|
- un export de posts Mastodon
|
||||||
|
|
||||||
|
|
||||||
|
lancer
|
||||||
|
```
|
||||||
|
npm i
|
||||||
|
|
||||||
|
ts-node index.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
## Fonctionnement
|
||||||
|
|
||||||
|
Utilise Pandoc pour convertir des textes HTML en fichiers Orgmode.
|
|
@ -0,0 +1,161 @@
|
||||||
|
import * as heliablog from './extractions_bdd/helia_wp_posts.json';
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
|
||||||
|
// get all posts
|
||||||
|
console.log('heliablog.length', heliablog.length);
|
||||||
|
const formatHtml = require('html-format');
|
||||||
|
let ii = 0;
|
||||||
|
let max_counter = 100;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'heliablog';
|
||||||
|
let blog_title = 'Hélia blog';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
heliablog.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.post_type == 'post' || post.post_type == 'article')) {
|
||||||
|
console.log(ii, 'titre', post.post_name);
|
||||||
|
|
||||||
|
let postuniqID = uuidv4();
|
||||||
|
// console.log('post',post)
|
||||||
|
/**
|
||||||
|
header de fichier org roam
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
|
||||||
|
liens de notes org roam
|
||||||
|
|
||||||
|
[[id:720e9d47-f88f-4517-951f-403d47b01c10][blogs]]
|
||||||
|
|
||||||
|
** Helia blog [[id:5a4dab45-956b-4a8f-88e2-a50a0cdebe5c][helia]]
|
||||||
|
**/
|
||||||
|
|
||||||
|
let sitename = 'heliablog';
|
||||||
|
let fileName = (post.post_date.replace(' ', '').replace(/\-/g, '').replace(/\:/g, '')) + '_' + sitename + '_' + ii + '_' + post.post_name + '.org';
|
||||||
|
let contentConverted = '';
|
||||||
|
let guid = post.post_guid && post.post_guid.length ? '[[' + post.post_guid + ']]' : '';
|
||||||
|
let liens_bottom = '- [[id:5a4dab45-956b-4a8f-88e2-a50a0cdebe5c][Hélia blog]]\n- [[id:3011e9b1-4af3-4f7a-be31-cfc08903fb8d][Claire]]';
|
||||||
|
|
||||||
|
// convert to markdown
|
||||||
|
let source = post.post_excerpt + '<br/>' + post.post_content;
|
||||||
|
let picture = post.post_mime_type.includes('image') ? '** Image \n [[img:' + post.post.guid + ']]' : '';
|
||||||
|
console.log('add link to index', post.post_title);
|
||||||
|
lists_of_links_org.push({
|
||||||
|
title: post.post_title,
|
||||||
|
date: post.post_date,
|
||||||
|
org_id: postuniqID,
|
||||||
|
})
|
||||||
|
pandoc.convert('html', source + ' ', ['org'], function (result, err) {
|
||||||
|
|
||||||
|
if (result.org) {
|
||||||
|
|
||||||
|
contentConverted = result.org;
|
||||||
|
contentConverted = result.org.replace(' \\\\', '');
|
||||||
|
if (!contentConverted) {
|
||||||
|
console.log('------- content converted to nothing', source.length);
|
||||||
|
console.log('source', source);
|
||||||
|
contentConverted = '#+BEGIN_SRC html\n' + source + '\n#+END_SRC';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (err) {
|
||||||
|
console.log('pandoc exited with status code ' + err)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let fileContentConverted = `:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
* Article
|
||||||
|
- ID: ${post.ID}
|
||||||
|
- guid: ${guid}
|
||||||
|
- status: ${post.post_status}
|
||||||
|
- publié le: <${post.post_date ? post.post_date : ''}>
|
||||||
|
- modifié: <${post.post_modified ? post.post_modified : ''}>
|
||||||
|
- Index des articles du [[id:${indexUUID}][blog d'Hélia]]
|
||||||
|
${picture}
|
||||||
|
** ${post.post_title}
|
||||||
|
|
||||||
|
${contentConverted}
|
||||||
|
|
||||||
|
* Liens
|
||||||
|
${liens_bottom}
|
||||||
|
|
||||||
|
`;
|
||||||
|
writeNewFile(fileName, fileContentConverted)
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if (ii === heliablog.length) {
|
||||||
|
console.log('max_counter atteint', max_counter);
|
||||||
|
// on last element, create index
|
||||||
|
makeIndexOfFiles(lists_of_links_org);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
} else {
|
||||||
|
console.log(`File ${fileName} is written successfully!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
let res = loopOnJson();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
import * as blog_posts from './extractions_bdd/cil_wp_posts.json';
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
/**
|
||||||
|
header de fichier org roam
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
|
||||||
|
liens de notes org roam
|
||||||
|
|
||||||
|
- [[id:720e9d47-f88f-4517-951f-403d47b01c10][blogs]]
|
||||||
|
- index du blog [[id:02f6018b-9196-4326-8f09-9d45d7a548fc][cil_gometz]]
|
||||||
|
- [[id:a6b229ac-09aa-49fd-b626-8541278f1827][cil_gometz]]
|
||||||
|
**/
|
||||||
|
|
||||||
|
// get all posts
|
||||||
|
// @ts-ignore
|
||||||
|
console.log('posts length', blog_posts.length);
|
||||||
|
let ii = 0;
|
||||||
|
let real_post_ii = 0;
|
||||||
|
let max_counter = 3000;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'blog_cil_gometz'; // slug
|
||||||
|
let blog_title = 'blog cil_gometz posts'; // text title
|
||||||
|
let liens_bottom = '- blog_cil_gometz [[id:a6b229ac-09aa-49fd-b626-8541278f1827][' + blog_title + ']]\n';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
blog_posts.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.post_type == 'post' || post.post_type == 'article')) {
|
||||||
|
real_post_ii++;
|
||||||
|
console.log(ii,real_post_ii, 'titre', post.post_name);
|
||||||
|
|
||||||
|
let postuniqID = uuidv4();
|
||||||
|
let sitename = blog_name;
|
||||||
|
let fileName = (post.post_date.replace(' ', '').replace(/-/g, '').replace(/:/g, '')) + '_' + sitename + '_' + real_post_ii + '_' + post.post_name + '.org';
|
||||||
|
let contentConverted = '';
|
||||||
|
let guid = post.post_guid && post.post_guid.length ? '[[' + post.post_guid + ']]' : '';
|
||||||
|
|
||||||
|
|
||||||
|
let excerpt = post.post_excerpt ? post.post_excerpt + '<hr>' : '';
|
||||||
|
let source = excerpt + post.post_content + ' ';
|
||||||
|
let picture = post.post_mime_type.includes('image') ? '** Image \n [[img:' + post.post.guid + ']]' : '';
|
||||||
|
console.log('add link to index', post.post_title);
|
||||||
|
lists_of_links_org.push({
|
||||||
|
title: post.post_title,
|
||||||
|
date: post.post_date,
|
||||||
|
org_id: postuniqID,
|
||||||
|
})
|
||||||
|
console.log('convert source html to Org');
|
||||||
|
// convert to html with pandoc
|
||||||
|
pandoc.convert('html', source, ['org'], function (result, err) {
|
||||||
|
|
||||||
|
contentConverted = result.org
|
||||||
|
if (!contentConverted) {
|
||||||
|
console.log('------- content converted to nothing', source.length , post.post_title);
|
||||||
|
// console.log('source', source);
|
||||||
|
contentConverted = ':html: \n\n' + source + '';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
contentConverted = contentConverted.replace(' \\\\', '');
|
||||||
|
contentConverted = contentConverted.replace('http:\/\/', 'https://');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.log('pandoc exited with status code ' + err)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let fileContentConverted = `:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
* Article
|
||||||
|
- ID: ${post.ID}
|
||||||
|
- guid: ${guid}
|
||||||
|
- status: ${post.post_status}
|
||||||
|
- publié le: <${post.post_date ? post.post_date : ''}>
|
||||||
|
- modifié: <${post.post_modified ? post.post_modified : ''}>
|
||||||
|
- Index des articles du blog [[id:${indexUUID}][${blog_title}]]
|
||||||
|
${picture}
|
||||||
|
** ${post.post_title}
|
||||||
|
|
||||||
|
${contentConverted}
|
||||||
|
|
||||||
|
* Liens
|
||||||
|
${liens_bottom}
|
||||||
|
|
||||||
|
`;
|
||||||
|
writeNewFile(fileName, fileContentConverted)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
// @ts-ignore
|
||||||
|
} else if (ii === blog_posts.length) {
|
||||||
|
console.log('max_counter atteint', max_counter);
|
||||||
|
// on last element, create index
|
||||||
|
makeIndexOfFiles(lists_of_links_org);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
loopOnJson().catch(err => console.log(err))
|
||||||
|
//.then(r => console.log('response', r))
|
||||||
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,172 @@
|
||||||
|
import * as blog_posts from './extractions_bdd/cipherbliss_tkwp_posts.json';
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
/**
|
||||||
|
header de fichier org roam
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
|
||||||
|
liens de notes org roam
|
||||||
|
|
||||||
|
[[id:720e9d47-f88f-4517-951f-403d47b01c10][blogs]]
|
||||||
|
|
||||||
|
** tykayn blog [[id:02f6018b-9196-4326-8f09-9d45d7a548fc][tykayn_blog]]
|
||||||
|
** Helia blog [[id:5a4dab45-956b-4a8f-88e2-a50a0cdebe5c][helia]]
|
||||||
|
|
||||||
|
** [[id:cd68065a-9ede-4c9a-a26c-069c2d51f578][cipherbliss]]
|
||||||
|
** [[id:a6b229ac-09aa-49fd-b626-8541278f1827][cil_gometz]]
|
||||||
|
**/
|
||||||
|
|
||||||
|
// get all posts
|
||||||
|
// @ts-ignore
|
||||||
|
console.log('posts length', blog_posts.length);
|
||||||
|
let ii = 0;
|
||||||
|
let real_post_ii = 0;
|
||||||
|
let max_counter = 3000;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'cipherbliss_blog'; // slug
|
||||||
|
let blog_title = 'Cipherbliss blog'; // text title
|
||||||
|
let liens_bottom = '- cipherbliss [[id:cd68065a-9ede-4c9a-a26c-069c2d51f578][' + blog_title + ']]\n';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
blog_posts.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.post_type == 'post' || post.post_type == 'article')) {
|
||||||
|
real_post_ii++;
|
||||||
|
console.log(ii,real_post_ii, 'titre', post.post_name);
|
||||||
|
|
||||||
|
let postuniqID = uuidv4();
|
||||||
|
let sitename = blog_name;
|
||||||
|
let fileName = (post.post_date.replace(' ', '').replace(/-/g, '').replace(/:/g, '')) + '_' + sitename + '_' + real_post_ii + '_' + post.post_name + '.org';
|
||||||
|
let contentConverted = '';
|
||||||
|
let guid = post.post_guid && post.post_guid.length ? '[[' + post.post_guid + ']]' : '';
|
||||||
|
|
||||||
|
|
||||||
|
let excerpt = post.post_excerpt ? post.post_excerpt + '<hr>' : '';
|
||||||
|
let source = excerpt + post.post_content + ' ';
|
||||||
|
let picture = post.post_mime_type.includes('image') ? '** Image \n [[img:' + post.post.guid + ']]' : '';
|
||||||
|
console.log('add link to index', post.post_title);
|
||||||
|
lists_of_links_org.push({
|
||||||
|
title: post.post_title,
|
||||||
|
date: post.post_date,
|
||||||
|
org_id: postuniqID,
|
||||||
|
})
|
||||||
|
console.log('convert source html to Org');
|
||||||
|
// convert to html with pandoc
|
||||||
|
pandoc.convert('html', source, ['org'], function (result, err) {
|
||||||
|
|
||||||
|
contentConverted = result.org
|
||||||
|
if (!contentConverted) {
|
||||||
|
console.log('------- content converted to nothing', source.length , post.post_title);
|
||||||
|
// console.log('source', source);
|
||||||
|
contentConverted = ':html: \n\n' + source + '';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
contentConverted = contentConverted.replace(' \\\\', '');
|
||||||
|
contentConverted = contentConverted.replace('http:\/\/', 'https://');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.log('pandoc exited with status code ' + err)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let fileContentConverted = `:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
* Article
|
||||||
|
- ID: ${post.ID}
|
||||||
|
- guid: ${guid}
|
||||||
|
- status: ${post.post_status}
|
||||||
|
- publié le: <${post.post_date ? post.post_date : ''}>
|
||||||
|
- modifié: <${post.post_modified ? post.post_modified : ''}>
|
||||||
|
- Index des articles du blog [[id:${indexUUID}][${blog_title}]]
|
||||||
|
${picture}
|
||||||
|
** ${post.post_title}
|
||||||
|
|
||||||
|
${contentConverted}
|
||||||
|
|
||||||
|
* Liens
|
||||||
|
${liens_bottom}
|
||||||
|
|
||||||
|
`;
|
||||||
|
writeNewFile(fileName, fileContentConverted)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
// @ts-ignore
|
||||||
|
} else if (ii === blog_posts.length) {
|
||||||
|
console.log('max_counter atteint', max_counter);
|
||||||
|
// on last element, create index
|
||||||
|
makeIndexOfFiles(lists_of_links_org);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
loopOnJson().catch(err => console.log(err))
|
||||||
|
//.then(r => console.log('response', r))
|
||||||
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
import * as blog_posts from './extractions_bdd/helia_wp_posts.json';
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
/**
|
||||||
|
header de fichier org roam
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
|
||||||
|
liens de notes org roam
|
||||||
|
|
||||||
|
[[id:720e9d47-f88f-4517-951f-403d47b01c10][blogs]]
|
||||||
|
|
||||||
|
** Helia blog [[id:5a4dab45-956b-4a8f-88e2-a50a0cdebe5c][helia]]
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
// get all posts
|
||||||
|
// @ts-ignore
|
||||||
|
console.log('posts length', blog_posts.length);
|
||||||
|
let ii = 0;
|
||||||
|
let real_post_ii = 0;
|
||||||
|
let max_counter = 3000;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'hélia_blog'; // slug
|
||||||
|
let blog_title = 'hélia blog'; // text title
|
||||||
|
let liens_bottom = '- hélia [[id:cd68065a-9ede-4c9a-a26c-069c2d51f578][' + blog_title + ']]\n';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
blog_posts.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.post_type == 'post' && (post.post_status == 'publish' || post.post_status == 'draft'))) {
|
||||||
|
real_post_ii++;
|
||||||
|
console.log(ii, real_post_ii, 'titre', post.post_name);
|
||||||
|
|
||||||
|
let postuniqID = uuidv4();
|
||||||
|
let sitename = blog_name;
|
||||||
|
let fileName = (post.post_date.replace(' ', '').replace(/-/g, '').replace(/:/g, '')) + '_' + sitename + '_' + real_post_ii + '_' + post.post_name + '.org';
|
||||||
|
let contentConverted = '';
|
||||||
|
let guid = post.post_guid && post.post_guid.length ? '[[' + post.post_guid + ']]' : '';
|
||||||
|
|
||||||
|
|
||||||
|
let excerpt = post.post_excerpt ? post.post_excerpt + '<hr>' : '';
|
||||||
|
let source = excerpt + post.post_content + ' ';
|
||||||
|
let picture = post.post_mime_type.includes('image') ? '** Image \n [[img:' + post.post.guid + ']]' : '';
|
||||||
|
console.log('add link to index', post.post_title);
|
||||||
|
lists_of_links_org.push({
|
||||||
|
title: post.post_title,
|
||||||
|
date: post.post_date,
|
||||||
|
org_id: postuniqID,
|
||||||
|
})
|
||||||
|
console.log('convert source html to Org');
|
||||||
|
// convert to html with pandoc
|
||||||
|
pandoc.convert('html', source, ['org'], function (result, err) {
|
||||||
|
|
||||||
|
contentConverted = result.org
|
||||||
|
if (!contentConverted) {
|
||||||
|
console.log('------- content converted to nothing', source.length, post.post_title);
|
||||||
|
// console.log('source', source);
|
||||||
|
contentConverted = '** HTML \n\n' + source + '';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
contentConverted = contentConverted.replace(' \\\\', '');
|
||||||
|
contentConverted = contentConverted.replace('http:\/\/', 'https://');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.log('pandoc exited with status code ' + err)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let fileContentConverted = `:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: "${blog_title} - ${real_post_ii} - ${post.post_title} - ${post.post_status}"
|
||||||
|
|
||||||
|
* Article
|
||||||
|
- ID: ${post.ID}
|
||||||
|
- guid: ${guid}
|
||||||
|
- status: ${post.post_status}
|
||||||
|
- publié le: <${post.post_date ? post.post_date : ''}>
|
||||||
|
- modifié: <${post.post_modified ? post.post_modified : ''}>
|
||||||
|
- Index des articles du blog [[id:${indexUUID}][${blog_title}]]
|
||||||
|
${picture}
|
||||||
|
** ${post.post_title}
|
||||||
|
|
||||||
|
${contentConverted}
|
||||||
|
|
||||||
|
* Liens
|
||||||
|
${liens_bottom}
|
||||||
|
|
||||||
|
`;
|
||||||
|
writeNewFile(fileName, fileContentConverted)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
// @ts-ignore
|
||||||
|
} else if (ii === blog_posts.length) {
|
||||||
|
console.log('max_counter atteint', max_counter);
|
||||||
|
// on last element, create index
|
||||||
|
makeIndexOfFiles(lists_of_links_org);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
loopOnJson().catch(err => console.log(err))
|
||||||
|
//.then(r => console.log('response', r))
|
||||||
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,169 @@
|
||||||
|
import * as tkblog from './extractions_bdd/tykayn_wptkblog_posts.json';
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
|
||||||
|
// get all posts
|
||||||
|
// @ts-ignore
|
||||||
|
console.log('tkblog.length', tkblog.length);
|
||||||
|
let ii = 0;
|
||||||
|
let max_counter = 1500;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'tykayn_blog';
|
||||||
|
let blog_title = 'Tykayn blog';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
tkblog.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.post_type == 'post' || post.post_type == 'article')) {
|
||||||
|
console.log(ii, 'titre', post.post_name);
|
||||||
|
|
||||||
|
let postuniqID = uuidv4();
|
||||||
|
// console.log('post',post)
|
||||||
|
/**
|
||||||
|
header de fichier org roam
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
|
||||||
|
liens de notes org roam
|
||||||
|
|
||||||
|
[[id:720e9d47-f88f-4517-951f-403d47b01c10][blogs]]
|
||||||
|
|
||||||
|
** tykayn blog [[id:02f6018b-9196-4326-8f09-9d45d7a548fc][tykayn_blog]]
|
||||||
|
** Helia blog [[id:5a4dab45-956b-4a8f-88e2-a50a0cdebe5c][helia]]
|
||||||
|
|
||||||
|
** [[id:cd68065a-9ede-4c9a-a26c-069c2d51f578][cipherbliss]]
|
||||||
|
** [[id:a6b229ac-09aa-49fd-b626-8541278f1827][cil_gometz]]
|
||||||
|
**/
|
||||||
|
|
||||||
|
let sitename = 'tkblog';
|
||||||
|
let fileName = (post.post_date.replace(' ', '').replace(/-/g, '').replace(/:/g, '')) + '_' + sitename + '_' + ii + '_' + post.post_name + '.org';
|
||||||
|
let contentConverted = '';
|
||||||
|
let guid = post.post_guid && post.post_guid.length ? '[[' + post.post_guid + ']]' : '';
|
||||||
|
let liens_bottom = '- tykayn blog [[id:02f6018b-9196-4326-8f09-9d45d7a548fc][' + blog_title + ']]\n';
|
||||||
|
|
||||||
|
// convert to markdown
|
||||||
|
// let source = formatHtml(post.post_excerpt + '<br/>' + post.post_content);
|
||||||
|
let source = post.post_excerpt + '<br/>' + post.post_content;
|
||||||
|
let picture = post.post_mime_type.includes('image') ? '** Image \n [[img:' + post.post.guid + ']]' : '';
|
||||||
|
console.log('add link to index', post.post_title);
|
||||||
|
lists_of_links_org.push({
|
||||||
|
title: post.post_title,
|
||||||
|
date: post.post_date,
|
||||||
|
org_id: postuniqID,
|
||||||
|
})
|
||||||
|
console.log('convert source html to Org');
|
||||||
|
pandoc.convert('html', source, ['org'], function (result, err) {
|
||||||
|
|
||||||
|
contentConverted = result.org
|
||||||
|
if (!contentConverted) {
|
||||||
|
console.log('------- content converted to nothing', source.length);
|
||||||
|
console.log('source', source);
|
||||||
|
contentConverted = ':html: \n\n' + source + '';
|
||||||
|
}
|
||||||
|
contentConverted = contentConverted.replace(' \\\\', '');
|
||||||
|
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.log('pandoc exited with status code ' + err)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let fileContentConverted = `:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
* Article
|
||||||
|
- ID: ${post.ID}
|
||||||
|
- guid: ${guid}
|
||||||
|
- status: ${post.post_status}
|
||||||
|
- publié le: <${post.post_date ? post.post_date : ''}>
|
||||||
|
- modifié: <${post.post_modified ? post.post_modified : ''}>
|
||||||
|
- Index des articles du blog [[id:${indexUUID}][${blog_title}]]
|
||||||
|
${picture}
|
||||||
|
** ${post.post_title}
|
||||||
|
|
||||||
|
${contentConverted}
|
||||||
|
|
||||||
|
* Liens
|
||||||
|
${liens_bottom}
|
||||||
|
|
||||||
|
`;
|
||||||
|
writeNewFile(fileName, fileContentConverted)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
} else { // @ts-ignore
|
||||||
|
if (ii === tkblog.length) {
|
||||||
|
console.log('max_counter atteint', max_counter);
|
||||||
|
// on last element, create index
|
||||||
|
makeIndexOfFiles(lists_of_links_org);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
} else {
|
||||||
|
console.log(`File ${fileName} is written successfully!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
loopOnJson().then(r => console.log('response', r));
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
import * as blog_posts from './extractions_bdd/tykayn_LUM_Comment.json';
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
// get all posts
|
||||||
|
// @ts-ignore
|
||||||
|
console.log('posts length', blog_posts.length);
|
||||||
|
let ii = 0;
|
||||||
|
let real_post_ii = 0;
|
||||||
|
let max_counter = 3000;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'cipherbliss_blog'; // slug
|
||||||
|
let blog_title = 'Cipherbliss blog'; // text title
|
||||||
|
let liens_bottom = '- cipherbliss [[id:cd68065a-9ede-4c9a-a26c-069c2d51f578][' + blog_title + ']]\n';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
|
||||||
|
let filecontent = '* Posts sur le forum Qzine ';
|
||||||
|
|
||||||
|
let counter = 0;
|
||||||
|
// @ts-ignore
|
||||||
|
blog_posts.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.Body !== '' && post.AuthUserID == 1)) {
|
||||||
|
counter++;
|
||||||
|
filecontent += '** <'+post.DateCreated+'> - Topic '+ post.DiscussionID+'\n'
|
||||||
|
|
||||||
|
+ post.Body +'\n'
|
||||||
|
+ '\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
console.log('counter posts tk', counter );
|
||||||
|
writeNewFile('le_forum_qzine_tykayn_posts.org', filecontent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
loopOnJson().catch(err => console.log(err))
|
||||||
|
//.then(r => console.log('response', r))
|
||||||
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
import * as blog_posts from './extractions_bdd/mastodon_statuses.json';
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
// get all posts
|
||||||
|
// @ts-ignore
|
||||||
|
console.log('posts length', blog_posts.length);
|
||||||
|
let ii = 0;
|
||||||
|
let real_post_ii = 0;
|
||||||
|
let max_counter = 3000;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'cipherbliss_blog'; // slug
|
||||||
|
let blog_title = 'Cipherbliss blog'; // text title
|
||||||
|
let liens_bottom = '- cipherbliss [[id:cd68065a-9ede-4c9a-a26c-069c2d51f578][' + blog_title + ']]\n';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
|
||||||
|
let filecontent = '* Status Mastodon ';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
blog_posts.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.text !== '')) {
|
||||||
|
filecontent += '** '+post.created_at+'\n'
|
||||||
|
|
||||||
|
+ post.text +'\n'
|
||||||
|
+ '[['+post.uri +']]\n'
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
writeNewFile('mastodon_statuses.org', filecontent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
loopOnJson().catch(err => console.log(err))
|
||||||
|
//.then(r => console.log('response', r))
|
||||||
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,723 @@
|
||||||
|
{
|
||||||
|
"name": "wp2org",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"html-format": "^1.0.1",
|
||||||
|
"moment": "^2.29.1",
|
||||||
|
"mysql": "^2.18.1",
|
||||||
|
"node-fs": "^0.1.7",
|
||||||
|
"node-html-markdown": "^1.1.3",
|
||||||
|
"nodejs": "^0.0.0",
|
||||||
|
"pandoc": "^0.2.0",
|
||||||
|
"ts-node": "^10.4.0",
|
||||||
|
"uuid": "^8.3.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cspotcode/source-map-consumer": {
|
||||||
|
"version": "0.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
|
||||||
|
"integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cspotcode/source-map-support": {
|
||||||
|
"version": "0.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz",
|
||||||
|
"integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@cspotcode/source-map-consumer": "0.8.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tsconfig/node10": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg=="
|
||||||
|
},
|
||||||
|
"node_modules/@tsconfig/node12": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz",
|
||||||
|
"integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw=="
|
||||||
|
},
|
||||||
|
"node_modules/@tsconfig/node14": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg=="
|
||||||
|
},
|
||||||
|
"node_modules/@tsconfig/node16": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "17.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.9.tgz",
|
||||||
|
"integrity": "sha512-5dNBXu/FOER+EXnyah7rn8xlNrfMOQb/qXnw4NQgLkCygKBKhdmF/CA5oXVOKZLBEahw8s2WP9LxIcN/oDDRgQ==",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
|
"node_modules/acorn": {
|
||||||
|
"version": "8.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
|
||||||
|
"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==",
|
||||||
|
"bin": {
|
||||||
|
"acorn": "bin/acorn"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/acorn-walk": {
|
||||||
|
"version": "8.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||||
|
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/arg": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
|
||||||
|
},
|
||||||
|
"node_modules/bignumber.js": {
|
||||||
|
"version": "9.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
|
||||||
|
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/boolbase": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
|
||||||
|
},
|
||||||
|
"node_modules/core-util-is": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||||
|
},
|
||||||
|
"node_modules/create-require": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
|
||||||
|
},
|
||||||
|
"node_modules/css-select": {
|
||||||
|
"version": "4.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz",
|
||||||
|
"integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"boolbase": "^1.0.0",
|
||||||
|
"css-what": "^5.1.0",
|
||||||
|
"domhandler": "^4.3.0",
|
||||||
|
"domutils": "^2.8.0",
|
||||||
|
"nth-check": "^2.0.1"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/fb55"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/css-what": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/fb55"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/diff": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/dom-serializer": {
|
||||||
|
"version": "1.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",
|
||||||
|
"integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==",
|
||||||
|
"dependencies": {
|
||||||
|
"domelementtype": "^2.0.1",
|
||||||
|
"domhandler": "^4.2.0",
|
||||||
|
"entities": "^2.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/domelementtype": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/fb55"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"node_modules/domhandler": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==",
|
||||||
|
"dependencies": {
|
||||||
|
"domelementtype": "^2.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/fb55/domhandler?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/domutils": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==",
|
||||||
|
"dependencies": {
|
||||||
|
"dom-serializer": "^1.0.1",
|
||||||
|
"domelementtype": "^2.2.0",
|
||||||
|
"domhandler": "^4.2.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/fb55/domutils?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/entities": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/fb55/entities?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/he": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==",
|
||||||
|
"bin": {
|
||||||
|
"he": "bin/he"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/html-format": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/html-format/-/html-format-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-ePp+h+akaQiLeCGPefWQ4QJXVXhWx4sU4ZxJVFlaY0AeVgh/tnHGTL27ao09JrdEEelXYMAWi4ynKKheck4tdw=="
|
||||||
|
},
|
||||||
|
"node_modules/inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
|
"node_modules/isarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||||
|
},
|
||||||
|
"node_modules/make-error": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||||
|
},
|
||||||
|
"node_modules/moment": {
|
||||||
|
"version": "2.29.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||||
|
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mysql": {
|
||||||
|
"version": "2.18.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz",
|
||||||
|
"integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==",
|
||||||
|
"dependencies": {
|
||||||
|
"bignumber.js": "9.0.0",
|
||||||
|
"readable-stream": "2.3.7",
|
||||||
|
"safe-buffer": "5.1.2",
|
||||||
|
"sqlstring": "2.3.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/node-fs": {
|
||||||
|
"version": "0.1.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-fs/-/node-fs-0.1.7.tgz",
|
||||||
|
"integrity": "sha1-MjI8zLRsn78PwRgS1FAhzDHTJbs=",
|
||||||
|
"os": [
|
||||||
|
"linux",
|
||||||
|
"darwin",
|
||||||
|
"freebsd",
|
||||||
|
"win32",
|
||||||
|
"smartos",
|
||||||
|
"sunos"
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.1.97"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/node-html-markdown": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-html-markdown/-/node-html-markdown-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-iB5Nb8eQjeKHr1k9ot0FkVo5uah6IvYzSbOiNPbmtMt8OWf8os9TCsGEg1Xf51xwYLW461AvKl74HVjiMxvblg==",
|
||||||
|
"dependencies": {
|
||||||
|
"node-html-parser": "^4.1.5"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/node-html-parser": {
|
||||||
|
"version": "4.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-4.1.5.tgz",
|
||||||
|
"integrity": "sha512-NLgqUXtftqnBqIjlRjYSaApaqE7TTxfTiH4VqKCjdUJKFOtUzRwney83EHz2qYc0XoxXAkYdmLjENCuZHvsIFg==",
|
||||||
|
"dependencies": {
|
||||||
|
"css-select": "^4.1.3",
|
||||||
|
"he": "1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/nodejs": {
|
||||||
|
"version": "0.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nodejs/-/nodejs-0.0.0.tgz",
|
||||||
|
"integrity": "sha1-RyL6LhisTrc6Qq4W0B41hKErdTE="
|
||||||
|
},
|
||||||
|
"node_modules/nth-check": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==",
|
||||||
|
"dependencies": {
|
||||||
|
"boolbase": "^1.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/fb55/nth-check?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/pandoc": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pandoc/-/pandoc-0.2.0.tgz",
|
||||||
|
"integrity": "sha1-iXz0XRHnLvbF195menwwM2xdNhs=",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/process-nextick-args": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
||||||
|
},
|
||||||
|
"node_modules/readable-stream": {
|
||||||
|
"version": "2.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||||
|
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||||
|
"dependencies": {
|
||||||
|
"core-util-is": "~1.0.0",
|
||||||
|
"inherits": "~2.0.3",
|
||||||
|
"isarray": "~1.0.0",
|
||||||
|
"process-nextick-args": "~2.0.0",
|
||||||
|
"safe-buffer": "~5.1.1",
|
||||||
|
"string_decoder": "~1.1.1",
|
||||||
|
"util-deprecate": "~1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/safe-buffer": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
|
},
|
||||||
|
"node_modules/sqlstring": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
|
||||||
|
"integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A=",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/string_decoder": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "~5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ts-node": {
|
||||||
|
"version": "10.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
|
||||||
|
"integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
|
||||||
|
"dependencies": {
|
||||||
|
"@cspotcode/source-map-support": "0.7.0",
|
||||||
|
"@tsconfig/node10": "^1.0.7",
|
||||||
|
"@tsconfig/node12": "^1.0.7",
|
||||||
|
"@tsconfig/node14": "^1.0.0",
|
||||||
|
"@tsconfig/node16": "^1.0.2",
|
||||||
|
"acorn": "^8.4.1",
|
||||||
|
"acorn-walk": "^8.1.1",
|
||||||
|
"arg": "^4.1.0",
|
||||||
|
"create-require": "^1.1.0",
|
||||||
|
"diff": "^4.0.1",
|
||||||
|
"make-error": "^1.1.1",
|
||||||
|
"yn": "3.1.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"ts-node": "dist/bin.js",
|
||||||
|
"ts-node-cwd": "dist/bin-cwd.js",
|
||||||
|
"ts-node-script": "dist/bin-script.js",
|
||||||
|
"ts-node-transpile-only": "dist/bin-transpile.js",
|
||||||
|
"ts-script": "dist/bin-script-deprecated.js"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@swc/core": ">=1.2.50",
|
||||||
|
"@swc/wasm": ">=1.2.50",
|
||||||
|
"@types/node": "*",
|
||||||
|
"typescript": ">=2.7"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@swc/core": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@swc/wasm": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "4.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz",
|
||||||
|
"integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==",
|
||||||
|
"peer": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/util-deprecate": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||||
|
},
|
||||||
|
"node_modules/uuid": {
|
||||||
|
"version": "8.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||||
|
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||||
|
"bin": {
|
||||||
|
"uuid": "dist/bin/uuid"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/yn": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@cspotcode/source-map-consumer": {
|
||||||
|
"version": "0.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
|
||||||
|
"integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg=="
|
||||||
|
},
|
||||||
|
"@cspotcode/source-map-support": {
|
||||||
|
"version": "0.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz",
|
||||||
|
"integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==",
|
||||||
|
"requires": {
|
||||||
|
"@cspotcode/source-map-consumer": "0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@tsconfig/node10": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg=="
|
||||||
|
},
|
||||||
|
"@tsconfig/node12": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz",
|
||||||
|
"integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw=="
|
||||||
|
},
|
||||||
|
"@tsconfig/node14": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg=="
|
||||||
|
},
|
||||||
|
"@tsconfig/node16": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA=="
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "17.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.9.tgz",
|
||||||
|
"integrity": "sha512-5dNBXu/FOER+EXnyah7rn8xlNrfMOQb/qXnw4NQgLkCygKBKhdmF/CA5oXVOKZLBEahw8s2WP9LxIcN/oDDRgQ==",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
|
"acorn": {
|
||||||
|
"version": "8.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz",
|
||||||
|
"integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ=="
|
||||||
|
},
|
||||||
|
"acorn-walk": {
|
||||||
|
"version": "8.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||||
|
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA=="
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
|
||||||
|
},
|
||||||
|
"bignumber.js": {
|
||||||
|
"version": "9.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
|
||||||
|
"integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
|
||||||
|
},
|
||||||
|
"boolbase": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24="
|
||||||
|
},
|
||||||
|
"core-util-is": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ=="
|
||||||
|
},
|
||||||
|
"create-require": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
|
||||||
|
},
|
||||||
|
"css-select": {
|
||||||
|
"version": "4.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz",
|
||||||
|
"integrity": "sha512-/aUslKhzkTNCQUB2qTX84lVmfia9NyjP3WpDGtj/WxhwBzWBYUV3DgUpurHTme8UTPcPlAD1DJ+b0nN/t50zDQ==",
|
||||||
|
"requires": {
|
||||||
|
"boolbase": "^1.0.0",
|
||||||
|
"css-what": "^5.1.0",
|
||||||
|
"domhandler": "^4.3.0",
|
||||||
|
"domutils": "^2.8.0",
|
||||||
|
"nth-check": "^2.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"css-what": {
|
||||||
|
"version": "5.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz",
|
||||||
|
"integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw=="
|
||||||
|
},
|
||||||
|
"diff": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="
|
||||||
|
},
|
||||||
|
"dom-serializer": {
|
||||||
|
"version": "1.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",
|
||||||
|
"integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==",
|
||||||
|
"requires": {
|
||||||
|
"domelementtype": "^2.0.1",
|
||||||
|
"domhandler": "^4.2.0",
|
||||||
|
"entities": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domelementtype": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A=="
|
||||||
|
},
|
||||||
|
"domhandler": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g==",
|
||||||
|
"requires": {
|
||||||
|
"domelementtype": "^2.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"domutils": {
|
||||||
|
"version": "2.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
|
||||||
|
"integrity": "sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==",
|
||||||
|
"requires": {
|
||||||
|
"dom-serializer": "^1.0.1",
|
||||||
|
"domelementtype": "^2.2.0",
|
||||||
|
"domhandler": "^4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"entities": {
|
||||||
|
"version": "2.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz",
|
||||||
|
"integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A=="
|
||||||
|
},
|
||||||
|
"he": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
|
||||||
|
},
|
||||||
|
"html-format": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/html-format/-/html-format-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-ePp+h+akaQiLeCGPefWQ4QJXVXhWx4sU4ZxJVFlaY0AeVgh/tnHGTL27ao09JrdEEelXYMAWi4ynKKheck4tdw=="
|
||||||
|
},
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
|
"isarray": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||||
|
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||||
|
},
|
||||||
|
"make-error": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||||
|
},
|
||||||
|
"moment": {
|
||||||
|
"version": "2.29.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||||
|
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
|
||||||
|
},
|
||||||
|
"mysql": {
|
||||||
|
"version": "2.18.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz",
|
||||||
|
"integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==",
|
||||||
|
"requires": {
|
||||||
|
"bignumber.js": "9.0.0",
|
||||||
|
"readable-stream": "2.3.7",
|
||||||
|
"safe-buffer": "5.1.2",
|
||||||
|
"sqlstring": "2.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node-fs": {
|
||||||
|
"version": "0.1.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-fs/-/node-fs-0.1.7.tgz",
|
||||||
|
"integrity": "sha1-MjI8zLRsn78PwRgS1FAhzDHTJbs="
|
||||||
|
},
|
||||||
|
"node-html-markdown": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-html-markdown/-/node-html-markdown-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-iB5Nb8eQjeKHr1k9ot0FkVo5uah6IvYzSbOiNPbmtMt8OWf8os9TCsGEg1Xf51xwYLW461AvKl74HVjiMxvblg==",
|
||||||
|
"requires": {
|
||||||
|
"node-html-parser": "^4.1.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node-html-parser": {
|
||||||
|
"version": "4.1.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-4.1.5.tgz",
|
||||||
|
"integrity": "sha512-NLgqUXtftqnBqIjlRjYSaApaqE7TTxfTiH4VqKCjdUJKFOtUzRwney83EHz2qYc0XoxXAkYdmLjENCuZHvsIFg==",
|
||||||
|
"requires": {
|
||||||
|
"css-select": "^4.1.3",
|
||||||
|
"he": "1.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nodejs": {
|
||||||
|
"version": "0.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nodejs/-/nodejs-0.0.0.tgz",
|
||||||
|
"integrity": "sha1-RyL6LhisTrc6Qq4W0B41hKErdTE="
|
||||||
|
},
|
||||||
|
"nth-check": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==",
|
||||||
|
"requires": {
|
||||||
|
"boolbase": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pandoc": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pandoc/-/pandoc-0.2.0.tgz",
|
||||||
|
"integrity": "sha1-iXz0XRHnLvbF195menwwM2xdNhs="
|
||||||
|
},
|
||||||
|
"process-nextick-args": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
||||||
|
},
|
||||||
|
"readable-stream": {
|
||||||
|
"version": "2.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||||
|
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||||
|
"requires": {
|
||||||
|
"core-util-is": "~1.0.0",
|
||||||
|
"inherits": "~2.0.3",
|
||||||
|
"isarray": "~1.0.0",
|
||||||
|
"process-nextick-args": "~2.0.0",
|
||||||
|
"safe-buffer": "~5.1.1",
|
||||||
|
"string_decoder": "~1.1.1",
|
||||||
|
"util-deprecate": "~1.0.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"safe-buffer": {
|
||||||
|
"version": "5.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||||
|
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||||
|
},
|
||||||
|
"sqlstring": {
|
||||||
|
"version": "2.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
|
||||||
|
"integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
|
||||||
|
},
|
||||||
|
"string_decoder": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||||
|
"requires": {
|
||||||
|
"safe-buffer": "~5.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ts-node": {
|
||||||
|
"version": "10.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
|
||||||
|
"integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
|
||||||
|
"requires": {
|
||||||
|
"@cspotcode/source-map-support": "0.7.0",
|
||||||
|
"@tsconfig/node10": "^1.0.7",
|
||||||
|
"@tsconfig/node12": "^1.0.7",
|
||||||
|
"@tsconfig/node14": "^1.0.0",
|
||||||
|
"@tsconfig/node16": "^1.0.2",
|
||||||
|
"acorn": "^8.4.1",
|
||||||
|
"acorn-walk": "^8.1.1",
|
||||||
|
"arg": "^4.1.0",
|
||||||
|
"create-require": "^1.1.0",
|
||||||
|
"diff": "^4.0.1",
|
||||||
|
"make-error": "^1.1.1",
|
||||||
|
"yn": "3.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typescript": {
|
||||||
|
"version": "4.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz",
|
||||||
|
"integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==",
|
||||||
|
"peer": true
|
||||||
|
},
|
||||||
|
"util-deprecate": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||||
|
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||||
|
},
|
||||||
|
"uuid": {
|
||||||
|
"version": "8.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||||
|
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||||
|
},
|
||||||
|
"yn": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"dependencies": {
|
||||||
|
"html-format": "^1.0.1",
|
||||||
|
"moment": "^2.29.1",
|
||||||
|
"mysql": "^2.18.1",
|
||||||
|
"node-fs": "^0.1.7",
|
||||||
|
"node-html-markdown": "^1.1.3",
|
||||||
|
"nodejs": "^0.0.0",
|
||||||
|
"pandoc": "^0.2.0",
|
||||||
|
"ts-node": "^10.4.0",
|
||||||
|
"uuid": "^8.3.2"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,172 @@
|
||||||
|
import * as qzine_blog from './extractions_bdd/tykayn_qzinewp_posts.json';
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
/**
|
||||||
|
header de fichier org roam
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
|
||||||
|
liens de notes org roam
|
||||||
|
|
||||||
|
[[id:720e9d47-f88f-4517-951f-403d47b01c10][blogs]]
|
||||||
|
|
||||||
|
** tykayn blog [[id:02f6018b-9196-4326-8f09-9d45d7a548fc][tykayn_blog]]
|
||||||
|
** Helia blog [[id:5a4dab45-956b-4a8f-88e2-a50a0cdebe5c][helia]]
|
||||||
|
|
||||||
|
** [[id:cd68065a-9ede-4c9a-a26c-069c2d51f578][cipherbliss]]
|
||||||
|
** [[id:a6b229ac-09aa-49fd-b626-8541278f1827][cil_gometz]]
|
||||||
|
**/
|
||||||
|
|
||||||
|
// get all posts
|
||||||
|
// @ts-ignore
|
||||||
|
console.log('posts length', qzine_blog.length);
|
||||||
|
let ii = 0;
|
||||||
|
let real_post_ii = 0;
|
||||||
|
let max_counter = 3000;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'qzine_blog'; // slug
|
||||||
|
let blog_title = 'Qzine blog'; // text title
|
||||||
|
let liens_bottom = '- qzine [[id:437dfead-3236-4f56-8520-a68171ff956f][' + blog_title + ']]\n';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
qzine_blog.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.post_type == 'post' || post.post_type == 'article')) {
|
||||||
|
real_post_ii++;
|
||||||
|
console.log(ii,real_post_ii, 'titre', post.post_name);
|
||||||
|
|
||||||
|
let postuniqID = uuidv4();
|
||||||
|
let sitename = 'qzine_blog';
|
||||||
|
let fileName = (post.post_date.replace(' ', '').replace(/-/g, '').replace(/:/g, '')) + '_' + sitename + '_' + real_post_ii + '_' + post.post_name + '.org';
|
||||||
|
let contentConverted = '';
|
||||||
|
let guid = post.post_guid && post.post_guid.length ? '[[' + post.post_guid + ']]' : '';
|
||||||
|
|
||||||
|
|
||||||
|
let excerpt = post.post_excerpt ? post.post_excerpt + '<hr>' : '';
|
||||||
|
let source = excerpt + post.post_content + ' ';
|
||||||
|
let picture = post.post_mime_type.includes('image') ? '** Image \n [[img:' + post.post.guid + ']]' : '';
|
||||||
|
console.log('add link to index', post.post_title);
|
||||||
|
lists_of_links_org.push({
|
||||||
|
title: post.post_title,
|
||||||
|
date: post.post_date,
|
||||||
|
org_id: postuniqID,
|
||||||
|
})
|
||||||
|
console.log('convert source html to Org');
|
||||||
|
// convert to html with pandoc
|
||||||
|
pandoc.convert('html', source, ['org'], function (result, err) {
|
||||||
|
|
||||||
|
contentConverted = result.org
|
||||||
|
if (!contentConverted) {
|
||||||
|
console.log('------- content converted to nothing', source.length , post.post_title);
|
||||||
|
// console.log('source', source);
|
||||||
|
contentConverted = ':html: \n\n' + source + '';
|
||||||
|
} else {
|
||||||
|
|
||||||
|
contentConverted = contentConverted.replace(' \\\\', '');
|
||||||
|
contentConverted = contentConverted.replace('http:\/\/', 'https://');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.log('pandoc exited with status code ' + err)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let fileContentConverted = `:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
* Article
|
||||||
|
- ID: ${post.ID}
|
||||||
|
- guid: ${guid}
|
||||||
|
- status: ${post.post_status}
|
||||||
|
- publié le: <${post.post_date ? post.post_date : ''}>
|
||||||
|
- modifié: <${post.post_modified ? post.post_modified : ''}>
|
||||||
|
- Index des articles du blog [[id:${indexUUID}][${blog_title}]]
|
||||||
|
${picture}
|
||||||
|
** ${post.post_title}
|
||||||
|
|
||||||
|
${contentConverted}
|
||||||
|
|
||||||
|
* Liens
|
||||||
|
${liens_bottom}
|
||||||
|
|
||||||
|
`;
|
||||||
|
writeNewFile(fileName, fileContentConverted)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
// @ts-ignore
|
||||||
|
} else if (ii === qzine_blog.length) {
|
||||||
|
console.log('max_counter atteint', max_counter);
|
||||||
|
// on last element, create index
|
||||||
|
makeIndexOfFiles(lists_of_links_org);
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
loopOnJson().catch(err => console.log(err))
|
||||||
|
//.then(r => console.log('response', r))
|
||||||
|
;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
|
||||||
|
"lib": ["es2017", "dom"],
|
||||||
|
"outDir": "./dist/",
|
||||||
|
"sourceMap": true,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es6",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule" : true,
|
||||||
|
"jsx": "react",
|
||||||
|
"types": [
|
||||||
|
"node",
|
||||||
|
"vue-types",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"include": ["./**/*"]
|
||||||
|
}
|
|
@ -0,0 +1,164 @@
|
||||||
|
import * as tkblog from './extractions_bdd/tykayn_wptkblog_posts.json';
|
||||||
|
|
||||||
|
import {v4 as uuidv4} from 'uuid';
|
||||||
|
import moment = require('moment');
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
|
|
||||||
|
// get all posts
|
||||||
|
// @ts-ignore
|
||||||
|
console.log('tkblog.length', tkblog.length);
|
||||||
|
let ii = 0;
|
||||||
|
let max_counter = 1500;
|
||||||
|
// max_counter = 3;
|
||||||
|
let now: any = new Date();
|
||||||
|
now = now.getUTCDate();
|
||||||
|
let blog_name = 'tykayn_blog';
|
||||||
|
let blog_title = 'Tykayn blog';
|
||||||
|
let lists_of_links_org = [];
|
||||||
|
let indexUUID = uuidv4();
|
||||||
|
|
||||||
|
var pandoc = require('pandoc');
|
||||||
|
|
||||||
|
async function loopOnJson() {
|
||||||
|
|
||||||
|
// loop time
|
||||||
|
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
tkblog.map((post: any) => {
|
||||||
|
ii++;
|
||||||
|
if (ii < max_counter && (post.post_type == 'post' || post.post_type == 'article')) {
|
||||||
|
console.log(ii, 'titre', post.post_name);
|
||||||
|
|
||||||
|
let postuniqID = uuidv4();
|
||||||
|
// console.log('post',post)
|
||||||
|
/**
|
||||||
|
header de fichier org roam
|
||||||
|
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
|
||||||
|
liens de notes org roam
|
||||||
|
|
||||||
|
[[id:720e9d47-f88f-4517-951f-403d47b01c10][blogs]]
|
||||||
|
** tykayn blog [[id:02f6018b-9196-4326-8f09-9d45d7a548fc][tykayn_blog]]
|
||||||
|
**/
|
||||||
|
|
||||||
|
let sitename = 'tkblog';
|
||||||
|
let fileName = (post.post_date.replace(' ', '').replace(/-/g, '').replace(/:/g, '')) + '_' + sitename + '_' + ii + '_' + post.post_name + '.org';
|
||||||
|
let contentConverted = '';
|
||||||
|
let guid = post.post_guid && post.post_guid.length ? '[[' + post.post_guid + ']]' : '';
|
||||||
|
let liens_bottom = '- tykayn blog [[id:02f6018b-9196-4326-8f09-9d45d7a548fc][' + blog_title + ']]\n';
|
||||||
|
|
||||||
|
// convert to markdown
|
||||||
|
// let source = formatHtml(post.post_excerpt + '<br/>' + post.post_content);
|
||||||
|
let source = post.post_excerpt + '<br/>' + post.post_content;
|
||||||
|
let picture = post.post_mime_type.includes('image') ? '** Image \n [[img:' + post.post.guid + ']]' : '';
|
||||||
|
console.log('add link to index', post.post_title);
|
||||||
|
lists_of_links_org.push({
|
||||||
|
title: post.post_title,
|
||||||
|
date: post.post_date,
|
||||||
|
org_id: postuniqID,
|
||||||
|
})
|
||||||
|
console.log('convert source html to Org');
|
||||||
|
pandoc.convert('html', source, ['org'], function (result, err) {
|
||||||
|
|
||||||
|
contentConverted = result.org
|
||||||
|
if (!contentConverted) {
|
||||||
|
console.log('------- content converted to nothing', source.length);
|
||||||
|
console.log('source', source);
|
||||||
|
contentConverted = ':html: \n\n' + source + '';
|
||||||
|
}
|
||||||
|
contentConverted = contentConverted.replace(' \\\\', '');
|
||||||
|
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
console.log('pandoc exited with status code ' + err)
|
||||||
|
} else {
|
||||||
|
|
||||||
|
let fileContentConverted = `:PROPERTIES:
|
||||||
|
:ID: ${postuniqID}
|
||||||
|
:END:
|
||||||
|
#+title: ${post.post_name}
|
||||||
|
|
||||||
|
* Article
|
||||||
|
- ID: ${post.ID}
|
||||||
|
- guid: ${guid}
|
||||||
|
- status: ${post.post_status}
|
||||||
|
- publié le: <${post.post_date ? post.post_date : ''}>
|
||||||
|
- modifié: <${post.post_modified ? post.post_modified : ''}>
|
||||||
|
- Index des articles du blog [[id:${indexUUID}][${blog_title}]]
|
||||||
|
${picture}
|
||||||
|
** ${post.post_title}
|
||||||
|
|
||||||
|
${contentConverted}
|
||||||
|
|
||||||
|
* Liens
|
||||||
|
${liens_bottom}
|
||||||
|
|
||||||
|
`;
|
||||||
|
writeNewFile(fileName, fileContentConverted)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
} else { // @ts-ignore
|
||||||
|
if (ii === tkblog.length) {
|
||||||
|
console.log('max_counter atteint', max_counter);
|
||||||
|
// on last element, create index
|
||||||
|
makeIndexOfFiles(lists_of_links_org);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeNewFile(fileName, fileContent) {
|
||||||
|
console.log('write file ', fileName);
|
||||||
|
return fs.writeFile(
|
||||||
|
`./output/${fileName}`,
|
||||||
|
fileContent,
|
||||||
|
"utf8",
|
||||||
|
(err: any) => {
|
||||||
|
if (err) {
|
||||||
|
console.log(`Error writing file: ${err}`);
|
||||||
|
} else {
|
||||||
|
console.log(`File ${fileName} is written successfully!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeIndexOfFiles(lists_of_links_org) {
|
||||||
|
console.log('write index', lists_of_links_org.length, 'links');
|
||||||
|
// make an org file for each
|
||||||
|
|
||||||
|
let list_of_links_content = '';
|
||||||
|
|
||||||
|
lists_of_links_org.reverse().forEach(pair => {
|
||||||
|
list_of_links_content += `\n** <${pair.date}> [[id:${pair.org_id}][${pair.title}]]`
|
||||||
|
})
|
||||||
|
|
||||||
|
let file_index_content = `
|
||||||
|
:PROPERTIES:
|
||||||
|
:ID: ${indexUUID}
|
||||||
|
:END:
|
||||||
|
#+title: ${blog_name}_index
|
||||||
|
|
||||||
|
* Index des articles Org
|
||||||
|
${list_of_links_content}
|
||||||
|
`;
|
||||||
|
var today = moment().format('YYYYMMDDHHmmss');
|
||||||
|
console.log(today, 'list_of_links_content', file_index_content);
|
||||||
|
writeNewFile(today + '__' + blog_name + '_index.org', file_index_content);
|
||||||
|
}
|
||||||
|
|
||||||
|
loopOnJson().then(r => console.log('response', r));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue