Hi Mohammad,

I think it is time for you to try your hand at some JavaScript :)
This is a good opportunity, the deserializer code is very simple, it is 
less than 10 lines of code. If you get stuck I will be happy to help :)

So you need to do a String.replace 
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace>
 
to replace the characters not allowed in tiddler titles.

exports["application/x-bookmarks"] = function(text,fields) {
const parser = new DOMParser;
const vdoc = parser.parseFromString(text,"text/html");
const bookmarkAnchors = vdoc.querySelectorAll("a");

var results = [];

$tw.utils.each(bookmarkAnchors,function(anchor) {
results.push({
"add_date" : anchor.getAttribute("add_date"),
//"icon": anchor.getAttribute("icon"),
"title": anchor.textContent,
"url": anchor.getAttribute("href")
});
});
return results;
};

The other issue to consider is that in a bookmarks file, the title is not 
unique. So importing several bookmarks with the same title, only one will 
survive. So during the parsing, a unique title needs to be created.
On Saturday, May 22, 2021 at 7:19:37 AM UTC+2 Mohammad wrote:

> Saq,
>  I think the illegal letters by TW need to be scrapped e.g | [ ] { }
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/4e0e72be-405f-45b3-8e36-6d1a889abcafn%40googlegroups.com.

Reply via email to