Last active
August 5, 2018 15:26
-
-
Save lackac/b10dff552de741d0426c7d2bd7e54454 to your computer and use it in GitHub Desktop.
1. Copy from iBooks a code snippet; 2. Run ibook_paste; 3. Paste into text editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
pbpaste \ | |
| ruby -ne ' | |
BEGIN { $blanks = [] } | |
if ($_ =~ /^\s*$|^Excerpt From: */) | |
$blanks << $_ | |
else | |
puts($blanks) | |
$blanks = [] | |
puts $_.gsub(/^“|”$|\s*\p{InDingbats}$/, "") | |
end | |
' \ | |
| pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turns this:
into this: