diff --git a/helpers/wiki_osm.mjs b/helpers/wiki_osm.mjs index f8aa645..75afee2 100644 --- a/helpers/wiki_osm.mjs +++ b/helpers/wiki_osm.mjs @@ -48,7 +48,7 @@ export default function getElementCartographique() { const titleSelector = "" - fs.readFile(__dirname + '/assets/documents/elements_carto_osm.html', 'utf8', function (err, html) { + return fs.readFile(__dirname + '/assets/documents/elements_carto_osm.html', 'utf8', function (err, html) { if (err) { return console.log(err); } @@ -121,12 +121,23 @@ export default function getElementCartographique() { // aller chercher le lien // image de description: let imgSelector = ".description a.image img" + const message = makePostMessageFromObj(result) + console.log("message", message) + return result; }); } +function makePostMessageFromObj(result) { + return ` +# [Le tag OSM du jour : ${result.key}=${result.value}](${result.link}) +> ${result.description.trim()} +#osm #openstreetmap #wiki #rtfw +` +} + function getQuery() { // var url = "https://wiki.openstreetmap.org/w/api.php"; var url = "https://fr.wikipedia.org/w/api.php"; @@ -165,4 +176,10 @@ function getQuery() { }); -} \ No newline at end of file +} + + +// run + +const res = getElementCartographique() +console.log("res", res) \ No newline at end of file