Ok, I have a parsing question problem, I have a file with a list of items in the reverse order than what I want.
The list is exported as:
URL | Name
(weird I know!) What I want is reversed and in Markdown format
[Name](URL)
Here is a sample of the list of URL addresses:
https://forum.eastgate.com/t/literature-review-with-tinderbox/5721/33 | Literature Review with Tinderbox - Tutorials and Examples - Tinderbox Forum
https://forum.eastgate.com/t/using-tinderbox-for-talking-points/7376/11 | Using Tinderbox for Talking Points - Tutorials and Examples - Tinderbox Forum
https://forum.eastgate.com/t/sense-making-of-academic-literature-using-tinderbox/389/64 | Sense-making of Academic Literature Using Tinderbox - Tutorials and Examples - Tinderbox Forum
https://forum.eastgate.com/t/struggling-with-tinderbox-and-a-suggestion/668/144 | Struggling with Tinderbox and a suggestion - Q & A - getting started with Tinderbox - Tinderbox Forum
The format I want is…
[Name](URL)
Here is a sample of the output I want
[Struggling with Tinderbox and a suggestion - Q & A - getting started with Tinderbox - Tinderbox Forum](https://forum.eastgate.com/t/struggling-with-tinderbox-and-a-suggestion/668/144)
How do I do this?
Thinking out loud: Pseudocode: What I THINK I know:
I can probably use the streaming operators or regex to extract the parts of the line I need
I probably need 2 lists
I probably need to use eachLine to loop through each line.
Stuck
No clue on how I can recreate each line in reverse. Any ideas?
5. Recreate the format I want using $MyString: “[” + $MyList + “]” + “(” + $MyList1 + “)”;
BTW… the source is the export of a useful (for me) chrome extension that will combine all your lists of open tabs to OneTab. Hence the extension is called OneTab. Super useful, I use it like a read it later tabs I am working on but for whatever reason I did not get around to it. In the past, I would leave the tabs open for days. Not anymore
If wanting to iterate and test paragraphs, rather than chain $Text.paragraphList.each(){}, use the newer stream parsing method $Text.eachLine(){}. In both instance a line—or paragraph—is a substring—delimited by one of more successive line breaks.
But also note, under .eachLine():
When parsing text paragraphs, this operator can substitute for the older method of chaining .paragraphList.each(){}.
Oh! But the last example above, if using .eachLine we’d have to recompile the reverse-ordered $Text back into a single string to use .eachLine(). So (not tested):
Recall there is often more than one way to do things and here we need to recall we were doing a paragraph-based transform on $Text. Thus the qualification ‘can substitute’ in the aTbRef quotes above. Often there is more than one right way. There is no hidden process here as regards the loop, the only reason you might explicitly want/need .eachLine() instead of .each() is if you wanted its extra affordance of its in-loop condition feature.
Broadly speaking… to summarize, in my own words , eachLine() for most use can be used instead of the older paragraphList.each() Would that be fair to say?
I will need to drill down on your above explanation and example (which is excellent) and aTBRef for my better understanding. Definitely a gap in my Tinderbox knowledge.
$Text.paragraphList.each(){...
// vs.
$Text.eachLine(){...
I’ve used $Text above but the source string can be any String-type attribute, variable or even a literal string: "Hello world.\nGoodbye world.".eachLine(){....
But, I don’t intend to make my docs over-prescriptive. Either works, neither is wrong nor indeed (noticeably) less efficient. Part of the point is to avoid people needlessly re-writing code when not necessary.