Hey Rob, if you’re up for some more fun, I’ve been thinking about this, and doing a bit of research. Nothing urgent. What you already did is working well enough for most cases.
If I knew the web DOM better, I’d tackle this myself. But I’m still on a steep learning curve there.
My thought is this: Can we design a script that considers a number of possibilities, and then executes on the one that fits?
From my research, a lot of sites use the <pre>
tag to start the code block. So maybe that is a common usage worth coding for.
The interesting thing is that when I use the “Inspect Elements” tool I can almost always spot by eye where the code block starts. If I can do it by eye, surely we (well, really you) can come up with a design to find the code.
Here’s the results of my research. I hope it helps:
EN forum:
https://discussion.evernote.com/topic/4046-importing-from-apple-mailapps-notes/?p=197286
<pre class="prettyprint prettyprinted">
Veritrope:
http://veritrope.com/code/evernote-list-of-note-titles-exporter/
<div class="codecolorer-container applescript default" style="/* overflow:auto; *//* white-space:nowrap; *//* height:300px; */">
MacScripter:
http://macscripter.net/viewtopic.php?id=44101
<blockquote><div class="incqbox">
StackOverflow.com
http://stackoverflow.com/questions/31759322/applescript-new-file-shortest-way
<pre><code>
http://macosxautomation.com/
http://macosxautomation.com/applescript/linktrigger/index.html
<pre> for some
<p class="code”> for others
github.com
https://github.com/RobTrew/tree-tools/blob/master/FoldingText%20scripts/Expand%20collapse/ExpandFT-ToLevelN-008.applescript
<table class="highlight tab-size js-file-line-container" data-tab-size="8">