Re: Insert Next List Item
For anyone that was waiting, I did update the script to include handling of + listed items. I also added . I made some other enhancements too while I was at it. The numerical listing handles both going 3. to 4., but also 2.4. to 2.5. so it handles decimal numbering or sub sections. Lastly, I added HTML list item support; it creates a li tags, copies the li tag's attributes from the current line, and duplicates them and also places the cursor inside the tag. If you have visited the page before you'll likely need to hit refresh to ensure you're seeing the latest page updates. I haven't had a chance to do thorough testing so if you see issues or have other suggestions let me know. http://www.angelwatt.com/words/2011/04/11/bbedit-smart-newline-open-line/ -Kendall On Tuesday, March 27, 2012 9:50:05 AM UTC-4, Kendall Conrad wrote: The link I provided does have the latest code. If you visited the page somewhat recently you may need to do a refresh to see the latest changes. The code will state that is was last updated March 26 at the top of the code listing. The updated code does handle doing lists that start with *, #, and -, but not +. I thought about it, but couldn't think of anytime I've seen it used. It would be very easy to add though to the code. Just edit the section Check for lists and add \\+ to the two regex finds. It has to be escaped since it's a special character for regex. I'll make an update when I get a chance, probably within the next 20 hours. -Kendall On Tuesday, March 27, 2012 2:18:19 AM UTC-4, KG wrote: @Kendall : just one more thing, can you provide a link to the latest source. from the url you provided i don't see the numbered list edit that you said you made Thanks On Tuesday, March 27, 2012 5:14:31 AM UTC+3, Kendall Conrad wrote: My Smart Newline script can achieve this. You can examine the code near the top to see how I capture to white space at the start of the line if that's all you care about. I also updated the script this evening to also handle numbered lists, which was part of the original discussion question, though this is a little late for that I suppose, but others might find it useful. http://www.angelwatt.com/words/2011/04/11/bbedit-smart-newline-open-line/ -Kendall On Mar 26, 4:45 pm, KG for...@kaush.co wrote: Hey Christopher, Just a minor request to your existing script. This works fantastically if you line starts with the bullet. Assuming you have some indentation like 4 tab stops and then the bullet, the script stops. I made a couple of mods to the script as follows: --- tell application BBEdit try tell text of front text window set lineOfInsertionPoint to line (startLine of selection) set findReco to find ^\\d+\\. searching in lineOfInsertionPoint options {search mode:grep} if found of findReco = true then set leadingNumber to text 1 thru -2 of (found text of findReco) set text of selection to return (leadingNumber + 1) . select insertion point after selection else if found of findReco = false then set findReco to find ^\\* searching in lineOfInsertionPoint options {search mode:grep} if found of findReco = true then set text of selection to return * select insertion point after selection else set findReco to find ^\\s*\\+ searching in lineOfInsertionPoint options {search mode:grep} if found of findReco = true then set text of selection to return tab + select insertion point after selection end if end if end if end tell on error errMsg number errNum set sep to == set e to sep return Error: errMsg return sep return ¬ Error Number: errNum return sep beep display dialog e end try end tell --- Essentially the \s* helps ignore white space at the beginning. There's just one problem with my script. It inserts the new bullet point ignoring the previous number of tab stops. Is there a way in applescript to get hold of the number of tab stops and insert that at the beginning as well? Thanks again. On Monday, August 8, 2011 7:04:04 AM UTC+3, Christopher Stone wrote: On Aug
Tidy Cleanup Problem
I've put together a text factory to operate on XHTML files, and the last step is Tidy Cleanup Document, with the only checked items as Discard empty paragraphs and Enclose block text. It does just what I want -- different from anything I can get with Tidy Reflow Document (though glad to be proven wrong), but with one big problem: It changes numbered entities like #160; to named entities like nbsp; But named entities are not supported in the environment I'm working in. So how can I -- on an entire project -- get the result of Tidy Cleanup Document without the entity conversion -- or else, how can I reconvert the entities to their numeric form. Rick Gordon -- ___ RICK GORDON EMERALD VALLEY GRAPHICS AND CONSULTING ___ WWW: http://www.shelterpub.com -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Tidy Cleanup Problem
On Wed, Mar 28, 2012 at 5:21 AM, Rick Gordon li...@rickgordon.com wrote: So how can I -- on an entire project -- get the result of Tidy Cleanup Document without the entity conversion -- or else, how can I reconvert the entities to their numeric form. My first thought is that you might pipe the project to /usr/bin/tidy directly rather than using BBEdit's built-in. I don't know if BBEdit's tidy will respect the HTML_TIDY environmental setting, but that might be worth looking into as well. TjL -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Automating HTML in BBedit with AppleScript
Hello, I have the following task of creating a page with 1000 thumbnails linked to larger files. I want to automate the task and the automation part is an unfamiliar territory for me. I have two txt files containing 1000 thumbnail and original image filenames that look like this: original.txt: Photo_19001_2010-11-18_13.45.59_orig.jpg Photo_19002_2010-11-18_21.07.04_orig.jpg Photo_19003_2010-11-19_10.48.19_orig.jpg Photo_19004_2010-11-19_14.05.01_orig.jpg Photo_19005_2010-11-19_14.05.05_orig.jpg ... preview.txt: Photo_19001_2010-11-18_13.45.59_prev.jpg Photo_19002_2010-11-18_21.07.04_prev.jpg Photo_19003_2010-11-19_10.48.19_prev.jpg Photo_19004_2010-11-19_14.05.01_prev.jpg Photo_19005_2010-11-19_14.05.05_prev.jpg ... I have a HTML template: a href=urlOriginalimg src=urlPreview/a I want to replace the urlOriginal and urlPreview with the proper info from the txt files. Repeat 999 times. I understand this is not possible with BBEdit. AppleScript to the rescue? Where do I start? -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Automating HTML in BBedit with AppleScript
On Wed, Mar 28, 2012 at 5:21 AM, blue-orange goo...@etculli.com wrote: I have two txt files containing 1000 thumbnail and original image filenames that look like this: original.txt: Photo_19001_2010-11-18_13.45.59_orig.jpg Photo_19002_2010-11-18_21.07.04_orig.jpg Photo_19003_2010-11-19_10.48.19_orig.jpg Photo_19004_2010-11-19_14.05.01_orig.jpg Photo_19005_2010-11-19_14.05.05_orig.jpg ... preview.txt: Photo_19001_2010-11-18_13.45.59_prev.jpg Photo_19002_2010-11-18_21.07.04_prev.jpg Photo_19003_2010-11-19_10.48.19_prev.jpg Photo_19004_2010-11-19_14.05.01_prev.jpg Photo_19005_2010-11-19_14.05.05_prev.jpg Assuming that : 1. all of the filenames are exactly the same except that _orig.jpg changes to _prev.jpg 2. the file 'original.txt' has one filename per line then you can use a small shell script to do this: #!/bin/sh while read line do PREV=`echo $line | sed 's#_orig.jpg#_prev.jpg#g'` echo a href=\$line\img src=\$PREV\/a done original.txt I put this script up at http://dl.dropbox.com/u/18414/tmp/bbedit3282012.sh if you want to download it. Save it to the same directory as 'original.txt'. Assuming they are both on ~/Desktop/ then you would open Terminal.app and do cd ~/Desktop/ chmod 755 ./bbedit3282012.sh ./bbedit3282012.sh or, if you want to save the output of `bbedit3282012.sh`, then do ./bbedit3282012.sh out.html and then the file out.html will have the HTML that you need. TjL ps - I really can't help but mention that you should include WIDTH and HEIGHT on the IMG tags. Otherwise the page is going to jump all over the place as those 1,000 images load!! I assume you just left them off your example to reduce visual clutter. -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Tidy Cleanup Problem
At 09:18 -0400 03/28/2012, TJ Luoma wrote: On Wed, Mar 28, 2012 at 5:21 AM, Rick Gordon li...@rickgordon.com wrote: So how can I -- on an entire project -- get the result of Tidy Cleanup Document without the entity conversion -- or else, how can I reconvert the entities to their numeric form. My first thought is that you might pipe the project to /usr/bin/tidy directly rather than using BBEdit's built-in. I don't know if BBEdit's tidy will respect the HTML_TIDY environmental setting, but that might be worth looking into as well. Although BBEdit's built-in Tidy commands do not look at the environment, you can make use of any options supported by the command-line 'tidy' tool (see 'man tidy') by applying it as a text filter. To do this: 1. Create a tidy config file (e.g. ~/Documents/tidyconfig.txt) which contains whatever options you wish to apply. 2. Create a shell filter which invokes 'tidy'[1] as follows: #!/bin/sh /usr/bin/tidy -f /dev/null -config /path/to/your/tidyconfig.txt substituting the actual path to your tidy config file for the placeholder. 3. Save this filter as a file (e.g. tidy_it.sh) in the Text Filters folder of BBEdit's app support folder (~/Library/Application Support/BBEdit/Text Filters/) You can now apply this filter to the frontmost document by choosing Text - Apply Text Filter - [tidy_it] [1. Please note that whatever options you set for 'tidy', you'll need to redirect error output away from stderr, otherwise the combined output will be directed to BBEdit's Unix Script Output window instead of replacing the current document's contents.] Regards, Patrick Woolsey == Bare Bones Software, Inc. http://www.barebones.com P.O. Box 1048, Bedford, MA 01730-1048 -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Tidy Cleanup Problem
On 28 Mar 2012, at 09:57 , Patrick Woolsey wrote: [1. Please note that whatever options you set for 'tidy', you'll need to redirect error output away from stderr, otherwise the combined output will be directed to BBEdit's Unix Script Output window instead of replacing the current document's contents.] Do you mean /usr/bin/tidy -f /dev/null -config /path/to/your/tidyconfig.txt 2 /dev/null or do you mean something else? -- Gods don't like people not doing much work. People who aren't busy all the time might start to think. -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Tidy Cleanup Problem
At 10:20 -0600 03/28/2012, LuKreme wrote: On 28 Mar 2012, at 09:57 , Patrick Woolsey wrote: [1. Please note that whatever options you set for 'tidy', you'll need to redirect error output away from stderr, otherwise the combined output will be directed to BBEdit's Unix Script Output window instead of replacing the current document's contents.] Do you mean /usr/bin/tidy -f /dev/null -config /path/to/your/tidyconfig.txt 2 /dev/null or do you mean something else? Sorry, I should've made that clearer. The command in my post does that redirection via '-f /dev/null' but if you substitute your own options, you'll want to keep doing likewise. Regards, Patrick Woolsey == Bare Bones Software, Inc. http://www.barebones.com P.O. Box 1048, Bedford, MA 01730-1048 -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Tidy Cleanup Problem
Can this sort of substitution be done across multiple files at once? I am totally lost with shell scripts. If so, an example would be appreciated. -- Spencer Whetstone Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Wednesday, March 28, 2012 at 13:39, Patrick Woolsey wrote: At 10:20 -0600 03/28/2012, LuKreme wrote: On 28 Mar 2012, at 09:57 , Patrick Woolsey wrote: [1. Please note that whatever options you set for 'tidy', you'll need to redirect error output away from stderr, otherwise the combined output will be directed to BBEdit's Unix Script Output window instead of replacing the current document's contents.] Do you mean /usr/bin/tidy -f /dev/null -config /path/to/your/tidyconfig.txt 2 /dev/null or do you mean something else? Sorry, I should've made that clearer. The command in my post does that redirection via '-f /dev/null' but if you substitute your own options, you'll want to keep doing likewise. Regards, Patrick Woolsey == Bare Bones Software, Inc. http://www.barebones.com P.O. Box 1048, Bedford, MA 01730-1048 -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Tidy Cleanup Problem
On Wed, Mar 28, 2012 at 10:39 AM, Patrick Woolsey pwool...@barebones.com wrote: At 10:20 -0600 03/28/2012, LuKreme wrote: On 28 Mar 2012, at 09:57 , Patrick Woolsey wrote: [1. Please note that whatever options you set for 'tidy', you'll need to redirect error output away from stderr, otherwise the combined output will be directed to BBEdit's Unix Script Output window instead of replacing the current document's contents.] Do you mean /usr/bin/tidy -f /dev/null -config /path/to/your/tidyconfig.txt 2 /dev/null or do you mean something else? Sorry, I should've made that clearer. The command in my post does that redirection via '-f /dev/null' but if you substitute your own options, you'll want to keep doing likewise. Is there a way to specify the Unix Script Output window for errors instead of /dev/null? I don't actually want to ignore the errors. -- David Eves -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Tidy Cleanup Problem
Just set a file name in place of the '/dev/null' /usr/bin/tidy -f error1.log -config /path/to/your/tidyconfig.txt 2 error2.log You should check the man page for tidy, lots of good stuff there. man tidy François On Mar 28, 2012, at 2:29 PM, David Eves wrote: On Wed, Mar 28, 2012 at 10:39 AM, Patrick Woolsey pwool...@barebones.com wrote: At 10:20 -0600 03/28/2012, LuKreme wrote: On 28 Mar 2012, at 09:57 , Patrick Woolsey wrote: [1. Please note that whatever options you set for 'tidy', you'll need to redirect error output away from stderr, otherwise the combined output will be directed to BBEdit's Unix Script Output window instead of replacing the current document's contents.] Do you mean /usr/bin/tidy -f /dev/null -config /path/to/your/tidyconfig.txt 2 /dev/null or do you mean something else? Sorry, I should've made that clearer. The command in my post does that redirection via '-f /dev/null' but if you substitute your own options, you'll want to keep doing likewise. Is there a way to specify the Unix Script Output window for errors instead of /dev/null? I don't actually want to ignore the errors. -- David Eves -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Automating HTML in BBedit with AppleScript
On Mar 28, 2012, at 04:21, blue-orange wrote: I have the following task of creating a page with 1000 thumbnails linked to larger files. I want to automate the task and the automation part is an unfamiliar territory for me. __ Hey There, TJ's shell script looks quite spiffy, but this is maybe a little more user-friendly. The script expects open documents for your original and preview lists: Original_Images.txt Preview_Images.txt It will then assemble the requisite pieces into a new document. On my MacBook Pro it takes ~ 0.5 seconds to run from the BBEdit Script Menu using 1000 line image lists. Let me know whether or not that's what you had in mind. -- Best Regards, Chris # Author: Christopher C. Stone listmeis...@thestoneforge.com # Created: 2012-03-28 : 15:23 # Modified: 2012-03-28 : 15:23 # Application: BBEdit # Purpose: TEST FOR BLUE-ORANGE ON THE BBEDIT LIST. # : Create href list from template and original preview image url lists. # Dependencies: none try set previewDocName to Preview_Images.txt set originalDocName to Original_Images.txt set hrefTemplateOrig to a href=\ set hrefTemplatePrev to \img src=\ set hrefTemplateEnd to \/a set newDocContent to {} tell application BBEdit if (document originalDocName exists) and (document previewDocName exists) then set prevEndLine to endLine of text of document previewDocName set origEndLine to endLine of text of document originalDocName if prevEndLine = origEndLine then set prevLines to contents of lines of document previewDocName set origLines to contents of lines of document originalDocName repeat with i from 1 to length of prevLines set _temp to hrefTemplateOrig (item i of origLines) hrefTemplatePrev (item i of prevLines) hrefTemplateEnd set end of newDocContent to _temp end repeat set {oldTIDS, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return} set newDocContent to newDocContent as text make new text document with properties {text:newDocContent} set AppleScript's text item delimiters to oldTIDS end if end if end tell on error eMsg number eNum set {c, s} to {return, --} set e to s c Error: eMsg c s c Error Number: eNum c s beep display dialog e end try -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit
Re: Tidy Cleanup Problem
At 02:21 -0700 on 03/28/2012, Rick Gordon wrote about Tidy Cleanup Problem: So how can I -- on an entire project -- get the result of Tidy Cleanup Document without the entity conversion -- or else, how can I reconvert the entities to their numeric form. Depending on how many different numbered entries you use, you can add find/replace commands after the Tidy call. Another fix is to place a change # to # before the tidy and a fix-up change # to # after the tidy. Tidy would thus not see the #xxx; entries and would not replace them with named entries. It MAY however alter the to amp; so the fixup find may need to look for #amp;. -- You received this message because you are subscribed to the BBEdit Talk discussion group on Google Groups. To post to this group, send email to bbedit@googlegroups.com To unsubscribe from this group, send email to bbedit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a feature request or would like to report a problem, please email supp...@barebones.com rather than posting to the group. Follow @bbedit on Twitter: http://www.twitter.com/bbedit