Solved: See edit below
I’ve tried to debug this a bit but can’t figure it out.
I’ve isolated the relevant code to this bit from the stamp:
linkNotes.each(l) {
var dtLink($SourceURL(l));
if(dtLink.beginsWith("x-devonthink-item")) {
var linkPath($HTMLExportPath(l));
linkPath = linkPath.substr(1, linkPath.size - 1);
theExport = theExport.replace(linkPath, dtLink);
};
};
$MyString = theExport;
I try inserting: $Text("/DEBUG") = dtLink
and $Text("/DEBUG") = linkPath
at various points in both my file and the original file Pat posted. I get the same results in each case, up until theExport
, where in Pat’s file the link path is replaced by the x-devonthink link and in my file it’s not. I can’t fathom what the difference is that would cause this issue. Any help greatly appreciated!
One other observation: when theExport
is created in the top part of the stamp, in Pat’s file it produces links that look like this:
<p>[[2019061718]] - <a href=\"second_zettel.html\">second zettel</a></p>
In my file it produces:
<p>[[201906171136]] - <a href=\"ZKN/201906171136 - second zettel.html\">second zettel</a></p>
In other words, my file produces text with spaces in the href attribute but Pat’s doesn’t. I had created a rule for changing HTMLExportFileName and that was the culprit here. I removed that rule, blanked out the HTMLExportFileName and am now getting the same results with theExport
at the beginning of the script. However, unfortunately, that didn’t solve the problem and the x-devonthink links are not being added.
Solution
After creating a new file based on Pat’s template, I went through it step by step until I found the change that made the difference. Basically, when I set the HTMLExportExtension to “.md” it would have the path in the links in DevonThink export. If I set the HTMLExportExtension to “.html” it works again. Dunno what’s going on there, but it seems to be stable. I created a Stamp to set this back and forth depending on what kind of export is desired and it has held so far.