That's lovely regex. In my opinion we should be able to do it in TW eventually.
It needs work to develop a framework to cope with bulk. However BJ's FLEXITY plugin (a version of his Flexitype Plugin that allows arbitrary regex) is a great step in the right direction. http://flexibility.tiddlyspot.com/ Best wishes Josiah On Thursday, 7 December 2017 21:35:03 UTC+1, Diego Mesa wrote: > > > In case its useful to anyone, below is some regular expressions to turn > (at least some) of the local-relative links to tiddly pretty links: > > import re > > > regex = r"<a.+?href=\"(?!https?)([^\"]+?)(?:\.html)?\"[^>]*>([^<]+)<\/a>" > > > test_str = "I want to turn <a href=\"local-link.html\">title</a> to a > particular wiki format: [[title|local-link]]" > > > subst = "[[$2|$1]]" > > > # You can manually specify the number of replacements by changing the 4th > argument > result = re.sub(regex, subst, test_str, 0) > > > if result: > print (result) > > > See explanation here: https://regex101.com/r/vkN20z/3 > > > On Friday, October 13, 2017 at 12:32:46 PM UTC-5, Diego Mesa wrote: >> >> Hello, >> >> I frequently check Cosma Shalizi's "Notebooks": >> >> http://bactra.org/notebooks >> >> I find myself copying links from them, and copying/pasting etc. I thought >> it would be excellent for me to "import" each notebook into its own tiddler >> in my wiki, but I have no idea how to accomplish this. For one, Im using >> the single file version, which I like. Second, I'd have to change all of >> the <mathjax> calls to "$$". Third, I'd have to change all links like " >> bactra.org/noteboks/***" to be [[***]]", but keep all other bactra and >> non-bactra links intact. Fourth, I'd have to develop this script in such a >> way as to be able to be periodically run and import new changes to >> notebooks, while preserving the changes I've made to the tiddlers in the >> meantime. >> >> This seems like quite a task. Does anyone know of anything similar done >> in the past that I can use as a starting off point? >> >> Thank you, >> Diego >> > -- 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/f6ddb5b1-c276-486b-9f27-9ae5270eca76%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.