Last active
April 28, 2021 03:00
Revisions
-
robjwells revised this gist
Mar 20, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News|Sports) Desk|by Morning Star Reporter)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") -
robjwells revised this gist
Dec 12, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ on open theStories my grepRep(" [–-] ", " — ") -- En-dashes & hyphens to em-dashes my grepRep("^• *|^n ", "n") -- Blob-pars (nHeady heady) my grepRep("([.0-9]*) *(%|percent)(?!age)", "\\1 per cent") -- "per cent" my litRep("...", "…") -- Ellipses -- Break byline after name and ensure lower-case 'b' -
robjwells revised this gist
Dec 5, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News|Sport) Desk|by Morning Star Reporter)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") -
robjwells revised this gist
Sep 4, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,10 +30,10 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end -
robjwells revised this gist
Sep 4, 2013 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,8 @@ on open theStories repeat with aStory in theStories tell application "TextWrangler" open aStory tell the front text document set encoding to "Unicode (UTF-8)" educate quotes with replacing target @@ -29,10 +30,10 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter)(?:[ ,]*)(.*)\\r{2,}", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+)(?:[ ,]*)(.*)\\r{2,}", "\\l\\1\\r\\2\\r") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end -
Rob Wells revised this gist
Jun 15, 2013 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -29,11 +29,11 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end my grepRep("”([[:punct:]])", "\\1”") -- Transpose rdquo with punctuation. -
Rob Wells revised this gist
Jun 15, 2013 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -29,11 +29,11 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+)(?:[ ,]*)(.*)\\r+", "\\l\\1\\r\\2\\r") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end my grepRep("”([[:punct:]])", "\\1”") -- Transpose rdquo with punctuation. -
Rob Wells revised this gist
May 6, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -29,10 +29,10 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter)(?:[ ,]*)(.*)\\r{2,}", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+)(?:[ ,]*)(.*)\\r{2,}", "\\l\\1\\r\\2\\r") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end -
Rob Wells revised this gist
May 3, 2013 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -29,11 +29,11 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter) *(.*)\\r{2,}", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+) *(.*)\\r{2,}", "\\l\\1\\r\\2\\r") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end my grepRep("”([[:punct:]])", "\\1”") -- Transpose rdquo with punctuation. -
Rob Wells revised this gist
May 3, 2013 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -29,11 +29,11 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter) *(.*)\\r{2,}", "\\l\\1\\r\\2\\r") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+) *(.*)\\r{2,}", "\\l\\1\\r\\2\\r") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end my grepRep("”([[:punct:]])", "\\1”") -- Transpose rdquo with punctuation. -
Rob Wells revised this gist
Mar 12, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -29,10 +29,10 @@ on open theStories -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter) *(.*)", "\\l\\1\\r\\2") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+) *(.*)", "\\l\\1\\r\\2") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end -
Rob Wells revised this gist
Mar 3, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -31,8 +31,8 @@ on open theStories -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter) (.+)", "\\l\\1\\r\\2") if the result is 0 then -- 3-word byline not found -- Break two-word byline my grepRep("^(by [-[:alpha:]]+ [-[:alpha:]]+) (.+)", "\\l\\1\\r\\2") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end -
Rob Wells revised this gist
Feb 25, 2013 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -32,9 +32,8 @@ on open theStories my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter) (.+)", "\\l\\1\\r\\2") if the result is 0 then -- 3-word byline not found -- Break byline with title/location my grepRep("^(by [-a-z]+ [-a-z]+) (.+)", "\\l\\1\\r\\2") end if my grepRep("\\r+\\z", "") -- Delete empty lines at end my grepRep("”([[:punct:]])", "\\1”") -- Transpose rdquo with punctuation. -
Rob Wells revised this gist
Feb 25, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ on open theStories educate quotes with replacing target -- Remove hard-wraps (not perfect) my grepRep("([-,—:;[:alnum:]]) *\\r *([-,—:;[:alnum:]])", "\\1 \\2") -- Important thing to note is that it only finds non-terminal punctuation. -- It hits properly formatted bylines, but the byline replace fixes it later. -
Rob Wells revised this gist
Feb 25, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ on open theStories educate quotes with replacing target -- Remove hard-wraps (not perfect) my grepRep("([-,—:;[:alnum:]) *\\r *([-,—:;[:alnum:]])", "\\1 \\2") -- Important thing to note is that it only finds non-terminal punctuation. -- It hits properly formatted bylines, but the byline replace fixes it later. -
Rob Wells revised this gist
Feb 25, 2013 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ on open theStories my grepRep("^ ", "") -- Remove spaces at the start of lines my grepRep("\\t+", "") -- Remove tabs -- Superscript numbers to quote marks my litRep("¹", "’") -- Apostrophe my litRep("²", "”") -- Right double my litRep("³", "“") -- Left double @@ -28,10 +28,11 @@ on open theStories my litRep("...", "…") -- Ellipses -- Break byline after name and ensure lower-case 'b' -- Check for (rare) 3-word bylines, else handle 2-word bylines my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter) (.+)", "\\l\\1\\r\\2") if the result is 0 then -- 3-word byline not found -- Break byline with title/location my grepRep("^(by [-a-z]+ [-a-z]+) (.+)", "\\1\\r\\2") end if my grepRep("^(by ([-a-z]+)+\\r)", "\\l\\1") -- Makes sure "by" is lowercase -
Rob Wells revised this gist
Feb 25, 2013 . No changes.There are no files selected for viewing
-
Rob Wells created this gist
Feb 25, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,63 @@ -- By Rob Wells for the Morning Star on open theStories repeat with aStory in theStories tell application "TextWrangler" open aStory tell text 1 of text window 1 educate quotes with replacing target -- Remove hard-wraps (not perfect) my grepRep("([-,—:;a-zA-Z0-9]) *\\r *([-,—:;a-zA-Z0-9])", "\\1 \\2") -- Important thing to note is that it only finds non-terminal punctuation. -- It hits properly formatted bylines, but the byline replace fixes it later. my grepRep(" {2,}", " ") -- Multiple spaces to single space my grepRep("^ ", "") -- Remove spaces at the start of lines my grepRep("\\t+", "") -- Remove tabs -- Super-script numbers to quote marks my litRep("¹", "’") -- Apostrophe my litRep("²", "”") -- Right double my litRep("³", "“") -- Left double my grepRep(" [–-] ", " — ") -- En-dashes & hyphens to em-dashes my grepRep("^• *|^n ", "n") -- Blob-pars (nHeady heady) my grepRep("([.0-9]*) *(%|percent)", "\\1 per cent") -- "per cent" my litRep("...", "…") -- Ellipses -- Break byline after name and ensure lower-case 'b' -- Initial check is for 3-word bylines, regular (2-word) bylines handled in the if block my grepRep("^(by Our (?:Foreign|News) Desk|by Morning Star Reporter) (.+)", "\\l\\1\\r\\2") if the result is 0 then -- 3-word byline not found my grepRep("^(by [-a-z]+ [-a-z]+) (.+)", "\\1\\r\\2") -- Break byline with title/location end if my grepRep("^(by ([-a-z]+)+\\r)", "\\l\\1") -- Makes sure "by" is lowercase my grepRep("\\r+\\z", "") -- Delete empty lines at end my grepRep("”([[:punct:]])", "\\1”") -- Transpose rdquo with punctuation. end tell end tell end repeat end open -- Convenience wrapper functions on litRep(searchString, replaceString) -- Literal search and replace tell application "TextWrangler" tell text 1 of text window 1 replace searchString using replaceString options {search mode:literal, starting at top:true} end tell end tell end litRep on grepRep(searchString, replaceString) -- Grep search and replace tell application "TextWrangler" tell text 1 of text window 1 replace searchString using replaceString options {search mode:grep, starting at top:true} end tell end tell end grepRep