On Sat, May 22, 2021 at 11:00 AM Saq Imtiaz <[email protected]> wrote:
> Hi Mohammad, Hi Saq, > > I think it is time for you to try your hand at some JavaScript :) > Why not! let's give it a try ;-) :) > 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 :) > Sure! > > 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. > Okay, we may add a number then! e.g title.... 1 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 > <https://groups.google.com/d/msgid/tiddlywiki/4e0e72be-405f-45b3-8e36-6d1a889abcafn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAAV1gMB_7F9X6ZJ8UVwhwW2-GbtwbaLsmOm4O7neEts8oQ-y6A%40mail.gmail.com.

