I am still fiddling with my flashcards.
I want to be able to enter a string and highlight certain parts of it in, e.g. by using a bold text style on these parts:
“This is not important, but this is.”
By bold text will then be manipulated further.
As I can see, KM has no macro or action to determine the text style of a string or part of it.
Therefore, I copy the styled text to the clipboard and convert the whole text including the RTF-metadata to sth. more readable, by using the output of:
osascript -e ‘the clipboard as «class RTF »’ |
perl -ne ‘print chr foreach unpack(“C*”,pack(“H*”,substr($_,11,-3)))’
(idea by a nice fellow in this thread: http://stackoverflow.com/questions/2545289/getting-rtf-data-out-of-mac-os-x-pasteboard-clipboard)
With a regex that finds where bold text begins or ends, if any, I can then save the highlighted text an proceed as I wish with it.
However, I have to clean all the text then of all other RTF metadata, which is now in clear text. Thus copying the styled text to a plain text clipboard would not work.
Do I really have to search and replace all possible RTF data I am not interested in? Am I on the right track? Thanks for any input!