Extract text with particular formatting

Problem: Collect all the special passages from multiple notes, where the special passages (no longer than a paragraph) have been set off by a marker, in this case #.

This seems to work:

I create an agent called Juicy Bits, which collects all notes containing the marker. This agent has the following Rule:

$MyList=collect(children,$Text.split(“\n+”));
$MyList=$MyList.collect_if(x,x.contains(“#(.+)#”),$1);
$Text=$MyList.format(“\n”)

So the Text of Juicy Bits displays all the special passages. (There might be some redundancy or cruft here. I’m a newbie finding my way.)

1 Like

I’m now convinced that there ought to be a way to collect highlighted passages. This will take a couple of weeks. (I’m not yet sure whether we really need to distinguish “red-highlghiter” and “yellow-highlighter”: opinions on this are welcome.)

2 Likes

I vote for red and yellow at a minimum as two most commonly used colors

Tom

That is exactly what the action code example and the AppleScript above do. Easy to use. Wonder if you’ve had a chance to try them?

I find it much easier to just apply a style via command-b or command-i via the keyboard rather than type in markers, but it will work either way (though the end marker should be different from the start marker).

@eastgate Will there there be a way to apply colors to text as easily as selecting and typing command-b or command-i?

There are shortcuts for coloured highlights (Style menu), but I believe coloured text still requires the OS Fonts palette. It’s worth looking at the app’s existing shortcuts as many choices are already in use.

Colored text has shortcuts ⌘^1-⌘^5 (Format ▸ Style ▸ Red, etc)

Colored highlighting has shortcut ⌘⇧-Y for the common case (yellow) and can have user-assigned shortcuts if you like.

Thanks for that! I’ve haven’t much ventured deep into those Format submenus so as to reach highlighting, and forgot that was there, I think partly because I once tried highlighting and found it illegible under a dark color scheme.

On my machine the built-in shortcuts for text color work well, now that I remember they are there.

I see there is now a $String.following, which grabs all occurrences.

Maybe $String.between would be what we are talking about here?

The latest backstage release has native support for extracting highlighted passages — not precisely the same as bold text, but pretty close. @gleick : would love to know what you’re working on, if you’re at a stage where you can talk about it.

1 Like

Thank you! Highlighting seems more appropriate than bold, for this purpose.