Re: Working example of #SCRIPT# place holder in clipping

2024-05-22 Thread jj
Hi Gari,

Use this script for a 90 characters line width:

*tell* *application* "BBEdit"

*set* vCount *to* 91 - (startColumn *of* selection)

*set* vTxt *to* ""

*if* vCount > 0 *then*

*repeat* vCount *times*

*set* vTxt *to* vTxt & "*"

*end* *repeat*

*end* *if*

*return* vTxt

*end* *tell*



name it *line-of-asterisk.scpt* and place it in the *same folder* as the 
clipping.

And use this clipping with just the filename:

#SCRIPT line-of-asterisk.scpt#

See BBEdit 15.1 manual p. 336.

HTH

Jean Jourdain

On Sunday, May 19, 2024 at 9:50:19 PM UTC+2 Gary Ash wrote:

> I've got an AppleScript that I'm trying to run from a clipping but it 
> doesn't seem to work.
> The script does work from the script editor
>
> #SCRIPT /Users/garyash/Library/Application 
> Support/BBEdit/Scripts/line-of-asterisk.scpt #
>
> line-of-asterisk.scpt
>
> *tell* *application* "BBEdit"
>
> *set* theLineNumber *to* ((*startLine* *of* *selection*) *of* *text 
> window* 1)
>
> *set* theColumnNumber *to* ((*startColumn* *of* *selection*) *of* *text 
> window* 1)
>
> *set* txt *to* ""
>
> *repeat* (90 - theColumnNumber) *times*
>
> *set* txt *to* (txt & "*")
>
> *end* *repeat*
>
> *set* *selection* *to* txt
>
> *tell* *text* 1 *of* *window* 1
>
> *select* *insertion point* *after* *line* theLineNumber
>
> *end* *tell*
>
> *end* *tell*
>
>
> i did a chmod +x in case that was it
>
> thanks for any help
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"supp...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/17872de5-0d38-47a2-b5e6-74575143d7c8n%40googlegroups.com.


Re: Use bbdiff to view differences between branches

2024-04-28 Thread jj
Using the -d flag seems to do what you expect.

git difftool *-d* goodbranch buggybranch

HTH

Jean Jourdain

On Saturday, April 27, 2024 at 11:19:43 AM UTC+2 Ted Stresen-Reuter wrote:

> On Fri, Apr 26, 2024 at 8:51 PM Marshall Clow  wrote:
>
>> On Apr 26, 2024, at 12:29 PM, Ted Stresen-Reuter  
>> wrote:
>> > 
>> > but when I execute:
>> > 
>> > git difftool goodbranch buggybranch
>> > 
>> > each file is opened in a separate window. It used to be that bbdiff 
>> would open two folders in a unified window. Is that not possible with git 
>> difftool?
>>
>> What happens if you try `git difftool goodbranch..buggybranch` instead?
>>
>>
> Exactly the same behavior, but I like your thinking!
>
> Ted 
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"supp...@barebones.com" rather than posting here. Follow @bbedit on Mastodon: 

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/a124cd3a-fdd8-4aa7-9878-39ad22e6e247n%40googlegroups.com.


Re: RegExp and search / replace question - removing "" when around a single word without whitespace

2024-04-18 Thread jj
Oops, previous regex will flag :

"tomato-sauce" or "mayonnaise-sauce"

This one is a bit more strict:
(?<=\s)"[\s\N{U+00A0}]*([^\s\N{U+00A0}"-]+?)[\s\N{U+00A0}]*"

But it will still flag (see the space after tomato-sauce) :
"tomato-sauce " or "mayonnaise-sauce"

There might be more edge cases, so be cautious.

Jean
On Thursday, April 18, 2024 at 4:46:17 PM UTC+2 jj wrote:

> Building on Kerri's solution to include non-breaking spaces, tabs and 
> linefeeds, etc.
>
> find:
> "[\s\N{U+00A0}]*([^\s\N{U+00A0}"-]+?)[\s\N{U+00A0}]*"
>
> replace:
> \1
>
> [image: Screenshot 2024-04-18 at 16.42.39.png]
>
> HTH
>
> Jean Jourdain
> On Thursday, April 18, 2024 at 3:19:21 PM UTC+2 Kerri Hicks wrote:
>
>> Maybe this will help?
>>
>> --Kerri
>>
>> [image: Screenshot 2024-04-18 at 9.16.46 AM.png]
>>
>> On Thu, Apr 18, 2024 at 8:37 AM Rainer Krug  wrote:
>>
>>> Sure.
>>> Should be removed: (single words without whitespace or "-")
>>>
>>> "singleword" -> singleworls
>>> "Hello" -> Hello
>>> " Hello" -> Hello [whitespace after removal of " do not matter]
>>> " Hello " -> Hello
>>> "Hello " -> Hello
>>>
>>> Should NOT be removed: (strings with whitespace or "-" except ), i.e. 
>>> remain unchanged
>>>
>>> "Hello World" 
>>> "Hello big world"
>>> "tomato-sauce"
>>> " Hello World "
>>>
>>> Hope this helps,
>>>
>>> Rainer
>>>
>>>
>>> On Thursday, April 18, 2024 at 11:40:14 AM UTC+2 Kaveh Bazargan wrote:
>>>
>>>> can you be more specific? What is the determining factor?
>>>>
>>>>- Exactly "this" > this
>>>>- Only single words
>>>>
>>>> pls give some examples of before and after so we can see logic. thanks. 
>>>>
>>>> On Thu, 18 Apr 2024 at 08:04, Rainer Krug  wrote:
>>>>
>>>>> Hi
>>>>>
>>>>> I had a regex but can't find it anymore (I found the "Manage Pattern" 
>>>>> only now - it always reminds me of Google...).
>>>>>
>>>>> Could somebody give me a regex which removes the `"` around "this" 
>>>>> word, but not "this word"?
>>>>>
>>>>> Thanks
>>>>>
>>>>> Rainer
>>>>>
>>>>> -- 
>>>>> This is the BBEdit Talk public discussion group. If you have a feature 
>>>>> request or believe that the application isn't working correctly, please 
>>>>> email "sup...@barebones.com" rather than posting here. Follow @bbedit 
>>>>> on Mastodon: <https://mastodon.social/@bbedit>
>>>>> --- 
>>>>> You received this message because you are subscribed to the Google 
>>>>> Groups "BBEdit Talk" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>>> an email to bbedit+un...@googlegroups.com.
>>>>> To view this discussion on the web visit 
>>>>> https://groups.google.com/d/msgid/bbedit/871a5d1f-aa12-49c5-a058-cec16619ea8cn%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/bbedit/871a5d1f-aa12-49c5-a058-cec16619ea8cn%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>>
>>>>
>>>> -- 
>>>> Kaveh Bazargan PhD
>>>> Director
>>>> River Valley Technologies <http://rivervalley.io> ● Twitter 
>>>> <https://twitter.com/rivervalley1000> ● LinkedIn 
>>>> <https://www.linkedin.com/in/bazargankaveh/> ● ORCID 
>>>> <https://orcid.org/-0002-1414-9098> ● @kave...@mastodon.social 
>>>> <https://mastodon.social/@kaveh1000>
>>>> *Accelerating the Communication of Research*
>>>>
>>>> * 
>>>> <https://www.linkedin.com/posts/bazargankaveh_ismte-innovation-award-recipient-kaveh-bazargan-activity-7039348552526921728-XAEB/?utm_source=share_medium=member_desktop>
>>>>   [image: 
>>>> https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/]
>>>>  
>>>> <https://rivervalley.io/gi

Re: Any way to print differences of two text files?

2024-02-27 Thread jj
Hi Allen,

I don't know if this is possible with BBEdit alone.
But you could do it in a terminal with the help of command line utilities 
diff  and aha 
, generating a colored HTML file.

Install Diffutils and Aha:

% brew install diffutils
% brew install aha

Run this command in Teminal with your files:

% diff -y --color=always ~/Desktop/A.txt ~/Desktop/B.txt | aha 
--stylesheet > ~/Desktop/output.html

Within BBEdit with a differences window in the foreground with the help of 
Applescript:

*tell* *application* "BBEdit"

   *if* *class* *of* *front* *window* = *differences window* *then*

   *set* vFileA *to* POSIX path *of* ((*file* *of* *first* *document* 
*of* *front* *window*) *as* *string*)

   *set* vFileB *to* POSIX path *of* ((*file* *of* *second* *document* 
*of* *front* *window*) *as* *string*)

   *set* vCommand *to* "/opt/homebrew/bin/diff -y --color=always" & 
space & *the* quoted form *of* vFileA & space & *the* quoted form *of* 
vFileB & space & "| /opt/homebrew/bin/aha --stylesheet > 
~/Desktop/output.html"

   *do shell script* (vCommand)

   *do shell script* "open ~/Desktop/output.html"

   *end* *if*

*end* *tell*


HTH


Jean Jourdain
On Monday, February 26, 2024 at 10:17:37 PM UTC+1 Allen Watson wrote:

> I love the ability to find the differences between two text files. I would 
> really like to have a printed version of the result, showing the 
>  differences, so that I could pass out a handout to students in my class. 
>
> Is it possible somehow to print the differences? Just printing only prints 
> the panel at the bottom, not the two side-by-side texts. A screen shot 
> seems to lose the highlighting that shows the differences.
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/df4999f3-ab42-4d8c-83fe-4fdf26ce7266n%40googlegroups.com.


Re: Move cursor to start of indented line?

2024-02-20 Thread jj
You could do this with a bit of AppleScript:

*try*

   *tell* *application* "BBEdit"

   *tell* *first* *window*

   *set* vLine *to* startLine *of* selection

   *tell* *first* *document*

   *set* vResult *to* *find* "^\\h*" searching in *its* *line* 
vLine options {search mode:*grep*, wrap around:*false*, starting at top:
*true*}

   *if* vResult's found *then*

   *if* vResult's found text *is* "" *then*

   *select* *insertion point* *before* *its* *line* 
vLine

   *else*

   *select* *insertion point* *after* *last* *character* 
*of* vResult's found object

   *end* *if*

   *end* *if*

   *end* *tell*

   *end* *tell*

   *end* *tell*

*on* *error* aMessage

   *display alert* aMessage

*end* *try*

HTH

Jean Jourdain
On Monday, February 19, 2024 at 11:32:01 PM UTC+1 Marshall Clow wrote:

> On Feb 19, 2024, at 1:30 PM, KevinC  wrote:
> > 
> > Hi, 
> > 
> > Is there a shortcut for moving to the start of an indented line (to just 
> before the first non-blank character)?
> > 
> > In most other text editors that I've used, Cmd+Left Arrow does this.
> > 
>
> > However, in BBEdit, it seems to always move it to the start of the 
> actual line. Is there a setting that I'm missing somewhere?
>
> Control-left arrow followed by option-right arrow is what I use.
> I don’t know if there’s a single-keystroke version.
>
> — Marshall
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/e0eb2740-22eb-4a41-a7a4-cab68b0fdcd2n%40googlegroups.com.


Re: Is this possible to GREP?

2024-01-26 Thread jj
Hi Victoria,

Here is a possible two pass solution:

First: 

A Case sensitive Find / Replace :


(?<=href=")([^#]+)#[^_]+_([A-Z][a-z]+)([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?([A-Z][a-z]+)?(?=")

Replacement:

\1#\L\2-\3-\4-\5-\6-\7-\8-\9-\10-\11

That will give you:

Installing
 
Lightroom
Multiple
 
Computers
 Keeping
 
Lightroom Updated
Managing
 
Folders in Lightroom and on the Hard Drive
Changing
 
the Folder Structure

Second:

Find / Replace: 

-+(?=">)

Let the replacement be empty:

That should work up to 10 terms camelCased query fragments.

HTH

Jean Jourdain

On Friday, January 26, 2024 at 4:01:09 PM UTC+1 MediaMouth wrote:

> The grep experts here are always impressive.  If they can't get it done 
> with regex, a JS solution can.
>
> On Jan 26, 2024, at 05:49, Victoria Bampton  
> wrote:
>
> There's clearly lots of experience here... can anyone tell me if this is 
> possible to do a find/replace GREP?
>
>
> Links like those following are spread throughout a series of documents. I 
> need to change the bit after the hash (e.g., #sub_InstallingLightroom) to 
> remove the chunk before the underscore, put a hyphen before each uppercase 
> character, and change the uppercase to lowercase (e.g., it becomes 
> #installing-lightroom). That could be multiple finds/replacements, as I can 
> deal with some of it, but I'm getting stuck on targeting and transforming 
> those uppercase characters. Is it doable? Any bright ideas would be greatly 
> appreciated!
>
>  href="/premium-classic/before-you-start.xhtml#sub_InstallingLightroom">Installing
>  
> Lightroom
>  href="/premium-classic/before-you-start.xhtml#box_MultipleComputers">Multiple 
> Computers
>   href="/premium-classic/before-you-start.xhtml#sub_KeepingLightroomUpdated">Keeping
>  
> Lightroom Updated
>  href="/premium-classic/managing-your-photos.xhtml#sub_ManagingFoldersInLightroomAndOnTheHardDrive">Managing
>  
> Folders in Lightroom and on the Hard Drive
>  href="/premium-classic/managing-your-photos.xhtml#sub_ChangingTheFolderStructure">Changing
>  
> the Folder Structure 
>
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "sup...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/f3743619-5c95-4161-8107-b81affbdd6dan%40googlegroups.com
>  
> 
> .
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/67518cb6-6957-4837-840f-71298b02d5f6n%40googlegroups.com.


Re: Trouble creating a CLM

2024-01-15 Thread jj
Hi Joaquin,

My guess is that keywords are whitespace separated character runs – they 
don't contain whitespace.
BBEdit probably chunks the keywords "before" matching against the regular 
expression chunk by chunk.
For example what your regular expression matches against is the string 
"label2:", not the whole line. Thus the start of line anchor always applies.

The Numeric Tags appear correctly because they are excluded from the 
"Number Pattern" not because of the start of line anchor.

I fear that keyword patterns won't let you do what you want. You will have 
to use the other patterns that are whitespace aware… but there is a limited 
number of those.

HTH,

Jean Jourdain
On Monday, January 15, 2024 at 5:42:48 PM UTC+1 Joaquin Adiego wrote:

> Hi Maarten,
>
> Thank you for your kind reply. I have already tested the expression you 
> suggest (I haven't tried that variant yet) and the result is the same. The 
> fact is that it is a bit strange that it works for one subexpression and 
> not for another very similar one.
>
> Regards.
>
> El domingo, 14 de enero de 2024 a las 20:09:34 UTC+1, Maarten Sneep 
> escribió:
>
>> Hi,
>>
>> I think you need to anchor the whole expression:
>>
>> (?x:
>> ^(([a-zA-Z_]{1}[a-zA-Z0-9_]*:)|
>> ([1-9]{1}[0-9]*))
>> )
>>
>> (I have not tested this yet).
>>
>> Maarten
>>
>> On 14 Jan 2024, at 11:32, Joaquin Adiego  wrote:
>>
>> Hi,
>>
>> I'm developing a codeless language module for Boriel ZX Basic. Everything 
>> works fine except the labels (which can be the old Basic line numbers, at 
>> the beginning of the line, or an identifier ending with ':' also at the 
>> beginning of a line).  I have used regular expressions to recognize all 
>> language elements (see file attached). Numeric tags are recognized well 
>> (appearing in green, see the screenshot attached), but text tags are not, 
>> recognizing strings that are not at the beginning of a line as tags as 
>> well.  The two regular expressions are similar, so I don't understand very 
>> well why it works well in one case and doesn't work in the other.  I have 
>> tried rewriting the regular expression in different ways but have not been 
>> successful, so I deduce that the problem must lie in the module 
>> specification, but I am not able to locate it.
>>
>> Can anyone help me with this?
>>
>> Regards
>>
>>
>>
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or need technical support, please email "sup...@barebones.com" 
>> rather than posting here. Follow @bbedit on Twitter: <
>> https://twitter.com/bbedit>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "BBEdit Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to bbedit+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/cf17d86a-e9dc-4851-bfb3-e82ae386008an%40googlegroups.com
>>  
>> 
>> .
>> 
>>
>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/83a187f5-3f7c-4c0f-9016-5534337026e8n%40googlegroups.com.


Re: Automatically indent python code

2023-12-27 Thread jj
Hi Claudio,

You should never infer that something cannot be done with BBEdit.
BBEdit has an incredibly useful toolset for editing text and code.
So there is certainly a way with regular expressions to do what you want. 

But ... reformatting Python code is not as simple as it sounds because of 
indentation,
line width wrapping, etc.

The recommended *Black* Python formatter is a tool that addresses those 
difficulties.

You can install it on you system with *Homebrew* <https://brew.sh>.

Once *Homebrew *is installed, use it in the terminal to install *black*:

% brew install black

Once *black *is installed, you can use it from the terminal:

% black /path/to/your/python_file.py
  
Or you can also create a BBEdit Text Filter that will allow you to use it 
from BBEdit.

Create a file with this content at this location ~/Library/Application 
Support/BBEdit/Text Filters/black.sh.

#!/usr/bin/env zsh

black -q -

Give the *black.sh* shell script the executable permissions.
You should now have in BBEdit a menu *Text > Apply Text Filter > black* you 
can use to reformat you python files.

If you need help on *black*, in the terminal type:

% black --help

HTH

Jean Jourdain

On Tuesday, December 26, 2023 at 2:30:07 PM UTC+1 Claudio Pedrazzi wrote:

> Hi Jean
>
> thanks a lot for the reply!
>
> So can I infer from your answer, that BBEdit is not able to do the 
> requested task, even in the paid (pro) version?
>
> Claudio
>
> Il giorno lunedì 25 dicembre 2023 alle 21:09:05 UTC+1 jj ha scritto:
>
>> Claudio,
>>
>> You should take a look at :
>> https://github.com/psf/black
>> HTH
>>
>> Jean Jourdain
>>
>> On Monday, December 25, 2023 at 6:05:52 PM UTC+1 Claudio Pedrazzi wrote:
>>
>>> Hi everyone,
>>> this is my first post here and I hope I am in the right place. I have a 
>>> python code of about a thousand lines, contained in a .py file, and I would 
>>> like to fix, possibly automatically, the indentation (i.e. at the first 
>>> level four characters, then eight, and so on, as the standard requires).
>>> To explain myself better, the code is correct and it works, but some 
>>> parts are indented 2 characters, some 3, and some 4. I am trying to do this 
>>> with BBedit, of which I have the pro version (the paid one). I don't know 
>>> if this is the right way but I use Markup > Utilities > Format and I always 
>>> get an error: Unespected EOF; Document ended in the middle of a tag. Maybe 
>>> I'm not using the right function? Are there ways to get this result?  
>>> If not, are there other free tools to perform this task?
>>> I have to say that I am not very proficient with scripting and such 
>>> extensions, I would like a simple "menu based" solution, of course if it 
>>> exists.
>>>
>>> Thanks a lots in advance
>>> Best regards
>>> Claudio
>>>
>>>
>>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/e79ac135-dfd9-41d7-a314-0ccda42b49c7n%40googlegroups.com.


Re: Automatically indent python code

2023-12-25 Thread jj
Claudio,

You should take a look at :
https://github.com/psf/black
HTH

Jean Jourdain

On Monday, December 25, 2023 at 6:05:52 PM UTC+1 Claudio Pedrazzi wrote:

> Hi everyone,
> this is my first post here and I hope I am in the right place. I have a 
> python code of about a thousand lines, contained in a .py file, and I would 
> like to fix, possibly automatically, the indentation (i.e. at the first 
> level four characters, then eight, and so on, as the standard requires).
> To explain myself better, the code is correct and it works, but some parts 
> are indented 2 characters, some 3, and some 4. I am trying to do this with 
> BBedit, of which I have the pro version (the paid one). I don't know if 
> this is the right way but I use Markup > Utilities > Format and I always 
> get an error: Unespected EOF; Document ended in the middle of a tag. Maybe 
> I'm not using the right function? Are there ways to get this result?  
> If not, are there other free tools to perform this task?
> I have to say that I am not very proficient with scripting and such 
> extensions, I would like a simple "menu based" solution, of course if it 
> exists.
>
> Thanks a lots in advance
> Best regards
> Claudio
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/7e8de123-5852-4a14-810d-f68f9cb0a1c2n%40googlegroups.com.


Re: Piping to bbresults

2023-12-20 Thread jj
Hi Christopher,

You could aggregate your patterns into a single regular expression and use 
it directly from BBEdit 
with the benefit of result sets, multi-file searches, matches highlighting, 
etc.

Here is an unrolled example pattern:

(?xx)
(?i)(?# Case insensitive.)
(?n)(?# No auto capture.)
\b
(
(   (?#: Weasel words.)
zzz
|very
|vast
|various
|tiny
|surprisingly
|substantially
|significantly
|several
|remarkably
|relatively
|quite
|mostly
|many
|largely
|interestingly
|huge
|few
|fairly
|extremely
|excellent
|exceedingly
|completely
|clearly
|((are|is) a number)
)
|
(   (?#: Passive voices.)
zzz
|wrung
|written
|woven
|wound
|worn
|won
|woken
|withstood
|withheld
|wept
|wed
|upset
|upheld
|understood
|trodden
|torn
|told
|thrust
|thrown
|thrived
|thought
|taught
|taken
|swung
|swum
|sworn
|swollen
|swept
|sunk
|sung
|stunk
|stung
|stuck
|strung
|struck
|striven
|stridden
|stood
|stolen
|spun
|sprung
|spread
|spoken
|split
|spit
|spilt
|spent
|sped
|sown
|sought
|sold
|smitten
|slung
|slit
|slid
|slept
|slain
|shut
|shrunk
|shown
|shot
|shorn
|shone
|shod
|shed
|shaven
|shaken
|sewn
|set
|sent
|seen
|sawn
|sat
|said
|rung
|run
|risen
|ridden
|rid
|read
|quit
|put
|proven
|pled
|paid
|overthrown
|overtaken
|overdone
|overcome
|mown
|mistaken
|misspelt
|met
|meant
|made
|lost
|lighted
|let
|lent
|left
|led
|learnt
|leapt
|lain
|laid
|known
|knit
|knelt
|kept
|hurt
|hung
|hit
|hidden
|held
|heard
|grown
|ground
|gotten
|gone
|given
|frozen
|found
|fought
|forsaken
|forgotten
|forgiven
|foregone
|forbidden
|flung
|flown
|fled
|fit
|felt
|fed
|fallen
|eaten
|dug
|drunk
|driven
|dreamt
|drawn
|done
|dived
|dealt
|cut
|crept
|cost
|come
|clung
|chosen
|caught
|cast
|burst
|burnt
|built
|brought
|broken
|broadcast
|bred
|bound
|bought
|born
|blown
|bled
|bitten
|bidden
|bid
|bet
|beset
|bent
|begun
|been
|become
|beat
|awoken
)
|
(?P\p{L}{2,})\s+(?P=DUPLICATE)   (?#: Duplicate words.)
)
\b

HTH

Jean Jourdain

On Tuesday, December 19, 2023 at 10:40:42 PM UTC+1 Christopher Finazzo 
wrote:

> I am consolidating a set of proofreading scripts 
> 
>  
> into a Makefile that includes a "proof" rule. This rule calls each of the 
> underlying scripts - and Aspell  - in sequence. At the 
> moment, running these will print output to the screen, but I would like to 
> go one step further.
>
> As these are "interactive" scripts, which return a text UI when run, is it 
> possible to pass the results to bbresults and present matching items in a 
> differences window?
>
> The end result would look similar to the following:
>
> proof:
> duplicates.sh
> passive-voice.sh
> weasel-words.sh
> aspell check $document
>
> I have done something similar with a function bbshellcheck, which has the 
> following form: 
>
> bbshellcheck {
> shellcheck -f gcc "$@" | bbresults
> }
>
> On paper, this makes sense. However, it isn't working exactly as I expect 
> -- Is this the wrong approach, or am I missing something obvious? 
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email 

Re: Switching to project unix worksheet when in project

2023-12-18 Thread jj
Given that a worksheet named '*project.worksheet*' exists in your project 
and that your project window is the front window,
this applescript should open it:

*tell* *application* "BBEdit"

   *activate*

   *set* vFile *to* *file* *of* *first* *item* *of* (*documents* *of* 
*first* *project window* *whose* name *is* "project.worksheet")

   *open* vFile opening in *first* *project window* *with* «*class* MdDa» 
*and* adding to recent list

*end* *tell*

HTH

Jean Jourdain
On Monday, December 18, 2023 at 8:36:40 PM UTC+1 Steve deRosier wrote:

> Hm.  Yeah, I guess I assumed it opened the project's one if you're in a 
> project.  And indeed you're right, it always opens the global, as does the 
> scratchpad in that menu.  No clue how/if to make it open the project one. 
> Did you look to see if there's an expert option to switch it? I didn't see 
> one in my quick scan, but I didn't read through in detail.
>
> Perhaps the BB guys will also jump on this thread, though you can catch 
> them directly and maybe make a feature request using the 
> sup...@barebones.com address; I've found they're very responsive to 
> feature requests when they're easy to accomplish.
>
> - Steve
>
>
> On Mon, Dec 18, 2023 at 5:52 AM 'Todd Ingalls' via BBEdit Talk <
> bbe...@googlegroups.com> wrote:
>
>> Thank Steve. I guess I should have mentioned I tried that and it brings 
>> up just the introductory worksheet that  is located at 
>> ~/Library/Application Support/BBEdit/Unix Worksheet.worksheet 
>>
>> Is it possible to open the Unix Worksheet that is in myproject.bbprojectd 
>> ?
>>
>>
>> [image: Untitled.png]
>>
>>
>> On Sunday, December 17, 2023 at 8:47:25 PM UTC-5 Steve deRosier wrote:
>>
>>> You can setup a key combo in Preferences.
>>> [image: 
>>> BBEdit_Menus___Shortcuts_Preferences_and_g3_iperf_py_—_g3_hybrid_testing_and_ux_device_descriptors_c_—_Ux_Device_HID_CDC_ACM.png]
>>>
>>> - Steve
>>>
>>>
>>> On Sun, Dec 17, 2023 at 4:14 PM 'Todd Ingalls' via BBEdit Talk <
>>> bbe...@googlegroups.com> wrote:
>>>
 Hello
 I am working using a project and when I have my project frontmost I 
 would like to be able to switch to unix worksheet contained in the 
 project. 
 It seems there is not a command to do this and I am unsure if it is even 
 possible from AppleScript. Just wanted to see if anyone had any 
 suggestions 
 for this.

 Thanks

 Todd Ingalls

 -- 
 This is the BBEdit Talk public discussion group. If you have a feature 
 request or need technical support, please email "sup...@barebones.com" 
 rather than posting here. Follow @bbedit on Twitter: <
 https://twitter.com/bbedit>
 --- 
 You received this message because you are subscribed to the Google 
 Groups "BBEdit Talk" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to bbedit+un...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/bbedit/314E1217-C1AB-4DF9-9398-3A92D968DCCC%40me.com
 .

>>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or need technical support, please email "sup...@barebones.com" 
>> rather than posting here. Follow @bbedit on Twitter: <
>> https://twitter.com/bbedit>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "BBEdit Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to bbedit+un...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/58f37d98-5482-4bbf-a21f-61df9573cd04n%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/09787807-df5f-45e5-827b-ea132a02508fn%40googlegroups.com.


Re: Search pattern works in Notepad++ , but not in BBEdit

2023-11-30 Thread jj
Hi Samir,

A few remarks.

1. The  tag is not correctly closed in you XML 
example.

2. I can reproduce the issue you mention and effectively BBEdit is 
returning garbage in the 'Replacement Text' field of the playground even if 
it shows the correct \2 in the 'Capture Groups' table.

3. If you use your pattern/replacement in a find/replace over you sample 
text and extract the results in a new document,  you can clearly see with 
'File > Hex Dump Front Document' that the replacements are pointing to 
random memory.

4. There is apparently a bug somewhere.

5. You should send an email to supp...@barebones.com with your issue to 
open a case.

HTH,

Jean Jourdain


On Wednesday, November 29, 2023 at 9:22:15 PM UTC+1 Samir Vasaya wrote:

> Hello.
> I have a .xlm file with below sample contents.
>
>  
>   MYNoodles_5Rs_0720
>   
>   
>Main Location
>   
>   
>
> -1
>
>Sales @ 12% GST
>  
>  
>   PF 05 CNS0720
>   
>   
>Main Location
>   
>   
>
> -1
>
>Sales @ 12% GST
>  
>
>
> I do a Search and Replace using Grep in BBEdit with
>
> Search pattern:
>
>
> (?s)(?=(?|()|.)*?(?(1)(?=([^<]+)<\/STOCKITEMNAME>)|<\/ALLINVENTORYENTRIES\.LIST>))(?(2)(?=(?|()|.)*?(?(3)(?=(\2))?|<\/ALLINVENTORYENTRIES\.LIST>))(?(3)(?(4)^\b$|.*?(?=)\K)|^\b$)|^\b$)
>
>
>
> Replace pattern:
>
> \2
>
>
> Im not getting the desired results, Pattern playground hi lights sub 
> patterns 1, 2 and 3 Correctly, But the Replacement text: for \2 shows the 
> captured text incorrectly.
>
>
> Am I m doing something wrong. I have gone through BBEdit manual, but 
> couldn’t find anything that helped.
>
> I ran the same pattern in Notepad++ and it works flawlessly.
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/7d195ba8-f5c6-4feb-beea-6fb0358124abn%40googlegroups.com.


Re: short-cut 'Notes' window

2023-11-24 Thread jj
Hi Peter,

 1. Activate the system AppleScript Menu in the menubar
  • Launch the Script Editor at Applications/Utilities/Script Editor.app
  • In Script Editor's settings, check the 'Show Script menu in menu 
bar' checkbox
  • Now you should have a permanent new Script menu on the right of 
your  menubar
  • In this Script menu, choose 'Open Scripts Folder' > 'Open User 
Scripts Folder'
  
[image: Screenshot 2023-11-24 at 08.53.22.png]

2. Copy this AppleScript into the folder that was just opened, naming the 
script 'Open BBEdit Notes.applescript'

*use* AppleScript version "2.8"

*use* *scripting additions*

*tell* *application* "System Events" *to* *tell* *process* "BBEdit"

   *set* frontmost *to* *true*

   *click* *menu item* "Notes" *of* *first* *menu* *of* *menu bar item* 
"Window" *of* *first* *menu bar*

*end* *tell*

3. The menu item 'Open BBEdit Notes' should now appear somewhere in the 
menubar Script menu.

Now on, you will be able to open the BBEdit's Notes window from everywhere.

HTH

Jean Jourdain

On Friday, November 24, 2023 at 12:19:25 AM UTC+1 Bruce Van Allen wrote:

> Look again at setting up services.
>
> > Thank you GP for answering. The shortcut for "New Note in BBEdit" with 
> selected text is certainly useful, but it is not what I am looking for.
>
> I’m re-stating GP’s suggestion to make sure you get that this wasn’t about 
> assigning a keyboard shortcut in BBEdit to use while running BBEdit.
>
> Here's what I did just now that I think gets what you want:
>
> In Services Settings, I made sure the main heading “Text" is checked. 
> Clicking its down arrow to show text services, I made sure “New Note in 
> BBEdit” is checked. 
>
> Simply taking those steps now provides New Note in BBEdit in the Services 
> menu of any* application - ** provided that I have some text selected in 
> the front-running application whose Services menu I’ve invoked. If I choose 
> New Note in BBEdit, it grabs the selected text and opens a BBEdit note with 
> that text.
>
> Now, back in Services Settings, when confirming that New Note in BBEdit is 
> checked, I can also see whether a keyboard combination has been assigned to 
> it. I can double-click at the right side of the service to add a keyboard 
> combo if necessary.
>
> Now, in any cooperating* application, if I have some text selected, by 
> keyboard or mouse-dragging, I can hit that keyboard command and the 
> selected text opens in a BBEdit note.
>
> *Not all Mac apps cooperate - I couldn’t get this to work in Apple News, 
> which didn’t seem to recognize that an article’s text was selected, so 
> wouldn’t reveal the text-related Services options.
>
> HTH
>
> — Bruce
>
> _bruce__van_allen__santa_cruz_ca_
>
>
>
>
>
> > On Nov 23, 2023, at 2:34 PM, Peter Schoo  wrote:
> > 
> > Thank you GP for answering. The shortcut for "New Note in BBEdit" with 
> selected text is certainly useful, but it is not what I am looking for.
> > 
> > I search for a way to go to the 'Notes' window from random places, i.e. 
> any other app or the OS, by keyboard command only.
> > 
> > GP schrieb am Donnerstag, 23. November 2023 um 20:54:13 UTC+1:
> > While it might not be exactly what you want, the "New Note in BBEdit" 
> service might satisfy your needs.
> > 
> > In system Settings -> Keyboard -> Keyboard Shortcuts ... -> Services -> 
> Text you can assign a keyboard shortcut to the "New Note in BBEdit" entry. 
> In order for that service to become active where you want to use it you'll 
> need to select a bit of text. Once you've assigned the keyboard shortcut to 
> the service item, you can verify the assignment by selecting a bit of text 
> then under the application menu select Services and look at the keyboard 
> shortcut associated with the "New Note in BBEdit" item in the Services menu 
> items list.
> > 
> > On Thursday, November 23, 2023 at 4:21:30 AM UTC-8 Peter Schoo wrote:
> > Using BBedit 14.6, I like a lot the notes windows allowing me to take 
> notes and manage them i.e. my half-down work in an efficient way. The 
> 'Notes' window plays a central role.
> > 
> > However, sometimes I experience the situation that, while in another 
> application or on MosOS, I'd like to switch instantly into the 'Notes' 
> window to add or continue on existing notes. 
> > 
> > Any idea how to create a keyboard shortcut or similar that allows me to 
> bring this 'Notes' window in front and focus?
> > 
> > -- 
> > This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "sup...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups "BBEdit Talk" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to bbedit+un...@googlegroups.com.
> > To view this discussion on the web visit 
> 

Re: Preventing a newline from being recognized by [\s]+ *without* using [[:blank:]]

2023-09-25 Thread jj
Hi Jim,

As per the PCRE2 documentation, you could use *\h* instead of *\s* :

https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC4

CHARACTER TYPES


. any character except newline; in dotall mode, any character whatsoever 

\C one code unit, even in UTF mode (best avoided) 

\d a decimal digit 

\D a character that is not a decimal digit 

\h *a horizontal white space character *

\H a character that is not a horizontal white space character 

\N a character that is not a newline 

\p{xx} a character with the xx property 

\P{xx} a character without the xx property 

\R a newline sequence 

\s a white space character 

\S a character that is not a white space character 

\v *a vertical white space character *

\V a character that is not a vertical white space character 

\w a "word" character 

\W a "non-word" character 

\X a Unicode extended grapheme cluster

HTH

Jean Jourdain

On Sunday, September 24, 2023 at 8:56:21 PM UTC+2 Patrick Woolsey wrote:

> Since per the discussion of character classes in Chapter 8, the special 
> class \s intrinsically includes linefeeds:
>
> 
>
> * Other Special Character Classes *
>
> BBEdit uses several other sequences for matching different types or 
> categories of characters.
>
> Special Character Matches
>
> \s any whitespace character (space, tab, carriage return, line feed, form 
> feed)
>
> 
>
> I suggest you instead define a character class which contains only the 
> whitespace characters that you explicitly wish to exclude, e.g. [^\t ] 
> since you needn't worry about carriage returns and I expect you aren't 
> likely to encounter form feeds. :-)
>
> Regards,
>
> Patrick Woolsey
> ==
> Bare Bones Software, Inc. 
>
>
>
> > On Sep 24, 2023, at 12:48, Jim Witte  wrote:
> > 
> > I'm trying to create a pattern that will find two Chinese characters 
> separated by 1 or more spaces and covert it to a single ideographic space 
> (\x{3000}), using the following pattern:
> > 
> > Find: ([\x{2f00}-\x{}]){1}[\s^$]+([\x{2f00}-\x{}])
> > Replace: \1\x{3000}\2
> > 
> > But this also recognizes newlines as spaces. I figure out how to do it 
> using [[:blank:]] with
> > 
> > Find: ([\x{2f00}-\x{}]){1}[[:blank:]]+([\x{2f00}-\x{}])
> > 
> > But is there another way? Something like [\s^$] ? "[\s^\n]" doesn't work.
> > 
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/a23d224b-11f1-40b5-a490-5a177007da91n%40googlegroups.com.


Re: Use the Number of Matches as Part of Replace Pattern

2023-08-22 Thread jj
Hi Christopher,

You could use a perl Text Filter.

Place this script in *~/Library/Application Support/BBEdit/Text 
Filters/add_reference_numbers.pl*:

*#!/usr/bin/env perl*

*use v5.14;*

*use strict;*

*use warnings;*


*$/ = undef;*


*my $i = 1;*

*print <> =~ s/(?<=BEGINREF\s)\d*(?=ENDREF)/$i++/grimse;*


*=for test*


*BEGINREF ENDREF*


*foo*


*BEGINREF ENDREF buzz*


*bar*

*BEGINREF ENDREF.*


*baz*



*hello   BEGINREF ENDREF world*


*BEGINREF*

*ENDREF*


*=cut*

And call it from menu *Text > Apply Text Filter > add_reference_numbers.*

HTH,

Jean Jourdain


On Monday, August 21, 2023 at 10:32:09 PM UTC+2 Christopher Werby wrote:

> I'm trying to bring Word documents with footnote reference markers into 
> BBEdit in plain text for further editing.  I can surround the special 
> footnote reference markers in Word with strings. I used to have a macro in 
> Word which could grab that reference marker and turn it into text so that 
> it would paste into BBEdit.  But that macro has broken.
>
> Now, in BBEdit, I just have the markers without the actual reference 
> number:
>
> BEGINREF ENDREF
>
> What I would like to do is search using a non-capturing look ahead 
> assertion for the ENDREF (?=ENDREF) and prefix it with the number of 
> matches.  It would look like:
>
> BEGINREF 1ENDREF
>
> BEGINREF 2ENDREF
>
> BEGINREF 3ENDREF ...
>
> Is there a way of doing that?  In UNIX there's a count option flag, but I 
> can't think of how to use that here.
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/4ef04c25-6c1c-44f8-b07d-0b8a9639e3a4n%40googlegroups.com.


Re: Using AppleScript to find and set an AS variable collects TMI (too much information)

2023-08-19 Thread jj
Hi Eric,

As requested, some additional comments.

1. The time regular expression commented

(?x)(?# Allow comments and 
ignore whitespace in regex.)
(?: (?# Non-capturing OR 
opening parenthesis.)
[01][0-9]   (?# Double digit from 00 to 
19.)
|   (?# or)
2[0-3]  (?# Double digit from 20 to 
23.)
)   (?# Non-capturing OR 
closing parenthesis.)
:   (?# A colon.)
[0-5][0-9]  (?# Double digit from 00 to 
59.)

This expression should match any hh:mm time from 00:00 to 23:59.

2. Commented Applescript

*tell* *application* "BBEdit"

*set* vDocument *to* *first* *text document* *of* *first* *window*

*set* vTimeRegex *to* "(?:[01][0-9]|2[0-3]):[0-5][0-9]" -- Regex to match 
any time from 00:00 to 23:59.

*set* vRegex *to* "^(" & vTimeRegex & ")-(" & vTimeRegex & 
")\\h+([A-Z]{3})" -- Regex to captures 3 informations:

-- at beginning of a line 

-- a start time to be captured

-- a colon 

-- a end time to be captured

-- one or more horizontal spaces

-- 3 letters to be captured

*set* vOptions *to* {search mode:*grep*, starting at top:*true*, wrap around
:*false*, returning results:*true*} -- We want `find` to return a list of 
the found matches with offsets in the document.

*set* vResult *to* *find* vRegex searching in vDocument options vOptions

*log* vResult

*if* vResult's found *then* -- The find command succeeded. vResult has a 
`found matches` property that lists the matches.

*repeat* *with* vMatch *in* found matches *of* vResult -- Lets loop over 
each match and extract the captured strings.

*log* vMatch

*set* vOptions *to* {search mode:*grep*, starting at top:*true*, wrap around
:*false*, returning results:*false*} -- This time, we don't want find to 
return results because we want to extract the captured strings.

*set* vTag *to* *characters* (vMatch's start_offset) *thru* (vMatch's 
end_offset) *of* vDocument -- Create a reference to the substring we want 
to decompose by using grep substitutions.

*set* vTagMatch *to* *find* vRegex searching in vTag options vOptions -- 
Use `find` again against each substring (e.g. '08:30-11:30 UWA') to capture 
the matching parts.

*if* vTagMatch's found *then* -- This should always succeed.

*set* vStartTime *to* *grep substitution* of "\\1" -- matched by the first 
capturing parentheses: '08:30'   

*set* vEndTime *to* *grep substitution* of "\\2" -- matched by the second 
capturing parentheses: '11:30'

*set* vClientCode *to* *grep substitution* of "\\3" -- matched by the third 
capturing parentheses: 'UWA'

*log* {vStartTime:vStartTime, vEndTime:vEndTime, vClientCode:vClientCode}

*end* *if*

*end* *repeat*

*end* *if*

*end* *tell*

Best regards

Jean Jourdain
On Friday, August 18, 2023 at 5:54:58 AM UTC+2 e2o wrote:

> phew! work my way bit-by-bit through the expression 
> (?:[01][0-9]|2[0-3]):[0-5][0-9]
> and got that sorted.
>
> On Thursday, August 17, 2023 at 8:23:17 PM UTC-7 e2o wrote:
>
>> I'm also struggling with the expression:
>>
>> (?:[01][0-9]|2[0-3]):[0-5][0-9]
>>
>> On Thursday, August 17, 2023 at 8:04:20 PM UTC-7 e2o wrote:
>>
>>> JJ,
>>>
>>> I've been going over this script you sent trying to wrap my head around 
>>> it. I haven't been able to get through it completely "plain-english" in my 
>>> head yet. Could you briefly elaborate? I love the way the variables are set 
>>> to build the find. But I'm not clear on the need for repeat statement and 
>>> the overall strategy. All I know is that if I could grok this script - 
>>> which does things I find myself needing a LOT - then it could open up a 
>>> whole new world.
>>> Could you shed a bit of light for an old dog learning new tricks?
>>>
>>> Thanks!
>>>
>>> - eric
>>>
>>> On Monday, August 14, 2023 at 7:59:45 AM UTC-7 jj wrote:
>>>
>>>> Hi Eric,
>>>>
>>>> Here is an example of how to get the values captured by a regex.
>>>>
>>>> *tell* *application* "BBEdit"
>>>>
>>>> *set* vDocument *to* *first* *text document* *of* *first* *window*
>>>>
>>>> *set* vTimeRegex *to* "(?:[01][0-9]|2[0-3]):[0-5][0-9]"
>>>>
>>>> *set* vRegex *to* "^(" & vTimeRegex & ")-(" & vTimeRegex & 
>>>> ")\\h+([A-Z]{3})"
>>>>
>>>> *set* vOpti

Re: Using AppleScript to find and set an AS variable collects TMI (too much information)

2023-08-14 Thread jj
Hi Eric,

Here is an example of how to get the values captured by a regex.

*tell* *application* "BBEdit"

*set* vDocument *to* *first* *text document* *of* *first* *window*

*set* vTimeRegex *to* "(?:[01][0-9]|2[0-3]):[0-5][0-9]"

*set* vRegex *to* "^(" & vTimeRegex & ")-(" & vTimeRegex & ")\\h+([A-Z]{3})"

*set* vOptions *to* {search mode:*grep*, starting at top:*true*, wrap around
:*false*, returning results:*true*}

*set* vResult *to* *find* vRegex searching in vDocument options vOptions

*if* vResult's found *then*

*repeat* *with* vMatch *in* found matches *of* vResult

*log* vMatch

*set* vOptions *to* {search mode:*grep*, starting at top:*true*, wrap around
:*false*, returning results:*false*}

*set* vTag *to* *characters* (vMatch's start_offset) *thru* (vMatch's 
end_offset) *of* vDocument

*set* vTagMatch *to* *find* vRegex searching in vTag options vOptions

*if* vTagMatch's found *then*

*set* vStartTime *to* *grep substitution* of "\\1"

*set* vEndTime *to* *grep substitution* of "\\2"

*set* vClientCode *to* *grep substitution* of "\\3"

*log* {vStartTime:vStartTime, vEndTime:vEndTime, vClientCode:vClientCode}

*end* *if*

*end* *repeat*

*end* *if*

*end* *tell*

HTH,

Jean Jourdain
On Monday, August 14, 2023 at 8:23:11 AM UTC+2 Rick Gordon wrote:

> I haven't worked with Keyboard Maestro, but what about *found text of 
> TicketTimeEntryBegin*?
>
> On August 13, 2023 at 11:20:24 PM [-0700], E2o wrote in an email 
> entitled "Using AppleScript to find and set an AS variable collects TMI 
> (too
> much information)":
> > found text:08:30
>
> ___
> RICK GORDON
> EMERALD VALLEY GRAPHICS AND CONSULTING
> ___
> WWW: http://www.shelterpub.com
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b5ded429-3718-466d-855f-bed7a5d4f8fen%40googlegroups.com.


Re: Deleting all \n which are not followed by a number and a .

2023-07-07 Thread jj
Hi Rainer,

To remove all line breaks (`\n`) except for the ones where the lines starts 
with a number followed by `.` :

Search Pattern : `\n(?!\d+\.)`
Replace Pattern: ` ` 

Note that the Replace pattern is a space to avoid concatenating together 
the lines.

Best regards,

Jean

On Friday, July 7, 2023 at 6:24:09 PM UTC+2 Rainer Krug wrote:

> OK - found it.
> Search Pattern: `^[0-9]\. `
> Replace Pattern: `###\0`
>
> Same for two digits.
>
> I was always trying `\1'...
>
> Thanks Pattern Playground!!!
>
> On Friday, July 7, 2023 at 6:10:51 PM UTC+2 Rainer Krug wrote:
>
>> I have a file as followed:
>>
>> 4. Leach M et al.: Equity and sustainability in the anthropocene: a
>> social–ecological systems perspective on their intertwined
>> futures. Glob Sustain 2018, 1
>> This important review by some of the leading authorities in the field,
>> summarizes the state of knowledge concerning the interlinked challenges
>> of equity and sustainability. Emphasizing that they cannot be addressed
>> separately, it outlines emerging new thinking which recognizes the 
>> multiple perspectives and dimensions involved.
>> 24. Scoones I: The politics of sustainability and development. Annu
>> Rev Environ Resour 2016:1-27
>> 5.Feola G: Societal transformation in response to global
>> environmental change: a review of emerging concepts. Ambio
>> 2014, 44:376-390.
>>
>> Now I want to remove all line breaks (`\n`) except for the ones where the 
>> lines starts with a number followed by `.`.
>>
>> I was thinking: Replace all `xx. ` with `xx. ` - but how can I do 
>> this?
>>
>> After that, I could remove all `\n` and replace `` with `\n` and 
>> I have it.
>>
>> Any suggestions?
>>
>> Thanks,
>>
>> Rainer
>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/7b05bcf9-2a34-4f03-b62c-73a9d42972ban%40googlegroups.com.


Re: Need help with Bash text filter

2022-12-28 Thread jj
In case you want to close the terminal and stay in BBEdit, you can create a 
shell script in ~/Library/Application\ 
Support/BBEdit/Scripts/php-cs-fixer-example.sh  
(Adapt php-cs-fixer's path as per your configuration) :

#!/usr/bin/env sh
/opt/homebrew/bin/php-cs-fixer fix --rules=no_whitespace_in_blank_line 
-- "$BB_DOC_PATH" ;

And apply it to the front document from the BBEdit's Script menu.

HTH,

Jean Jourdain
On Thursday, December 29, 2022 at 4:58:46 AM UTC+1 ryen...@gmail.com wrote:

> Thank you! I came here wondering why a text filter wasn't working, but it 
> did when run in terminal. Mine was the same issue. I was passing the text 
> contents instead of the file which php-cs-fixer expects. Oh well, guess 
> I'll just keep terminal open when needed.
>
> On Tuesday, December 20, 2022 at 10:01:20 AM UTC-5 y2k...@gmail.com wrote:
>
>> I haven't used beautysh but it looks like it's expecting to be passed the 
>> name/path of a file to operate on, and rewrites the file in place?
>>
>> A text filter, on the other hand, is passed the contents of the file you 
>> run it against, in the standard input (sys.stdin in Python).
>>
>> So you may need to adapt the module interface mentioned in the docs ("You 
>> can also call beautysh as a module") in order to use it as a text filter.
>>
>> --Kevin
>>
>> On Tue, Dec 20, 2022 at 9:24 AM Greg Raven  wrote:
>>
>>> I have a couple of Bash-language text filters that work great. I just 
>>> tried to create a new one, which instead of working as expected generates 
>>> an error message.
>>>
>>> Here's the code:
>>>
>>> ```
>>> #!/bin/sh
>>>
>>> ## requires macOS CommandLineTools
>>> ## requires pip3 install beautysh
>>>
>>> python3 ~/Library/Python/3.9/bin/beautysh
>>> ```
>>> When I run beautysh from the command line, it seems to work fine, just 
>>> like my text filter that employs css-beautity, js-beautify, and json.tool 
>>> and uses similar coding.
>>>
>>> Can anyone shed any light on this?
>>>
>>> -- 
>>> This is the BBEdit Talk public discussion group. If you have a feature 
>>> request or need technical support, please email "sup...@barebones.com" 
>>> rather than posting here. Follow @bbedit on Twitter: <
>>> https://twitter.com/bbedit>
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "BBEdit Talk" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to bbedit+un...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/bbedit/b58483e7-bf67-4e06-899c-a506a2ed88fcn%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2d2960fd-8bfa-4663-9d6c-b750bdcb7904n%40googlegroups.com.


Re: Need help with Bash text filter

2022-12-20 Thread jj
Hi Greg,

If you use your script as a text filter, you should add an hyphen '-' after 
the beautysh command to have stdin as input to the command.
like so:
...
python3 ~/Library/Python/3.9/bin/beautysh -
...

HTH,

Jean Jourdain

On Tuesday, December 20, 2022 at 4:01:20 PM UTC+1 y2k...@gmail.com wrote:

> I haven't used beautysh but it looks like it's expecting to be passed the 
> name/path of a file to operate on, and rewrites the file in place?
>
> A text filter, on the other hand, is passed the contents of the file you 
> run it against, in the standard input (sys.stdin in Python).
>
> So you may need to adapt the module interface mentioned in the docs ("You 
> can also call beautysh as a module") in order to use it as a text filter.
>
> --Kevin
>
> On Tue, Dec 20, 2022 at 9:24 AM Greg Raven  wrote:
>
>> I have a couple of Bash-language text filters that work great. I just 
>> tried to create a new one, which instead of working as expected generates 
>> an error message.
>>
>> Here's the code:
>>
>> ```
>> #!/bin/sh
>>
>> ## requires macOS CommandLineTools
>> ## requires pip3 install beautysh
>>
>> python3 ~/Library/Python/3.9/bin/beautysh
>> ```
>> When I run beautysh from the command line, it seems to work fine, just 
>> like my text filter that employs css-beautity, js-beautify, and json.tool 
>> and uses similar coding.
>>
>> Can anyone shed any light on this?
>>
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or need technical support, please email "sup...@barebones.com" 
>> rather than posting here. Follow @bbedit on Twitter: <
>> https://twitter.com/bbedit>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "BBEdit Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to bbedit+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/b58483e7-bf67-4e06-899c-a506a2ed88fcn%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/d98670e7-44b5-40e1-a911-d6808d424bfdn%40googlegroups.com.


Re: Grep help for musicxml

2022-12-05 Thread jj
Hi Marcel,

You could try this.

Find:

   
 (?s)())+)()\n((?:.(?!)

Replace:

\n\n\2\n\n\n\1\3

HTH

Jean Jourdain
On Monday, December 5, 2022 at 8:27:49 PM UTC+1 Marcel Lamers wrote:

> It gets much simpler if I add e.g. a ! before every  first.
> I can then search for
> ()([^!]+)()([^!]+)()
>
> On Monday, 5 December 2022 at 17:13:42 UTC+1 Marcel Lamers wrote:
>
>> Hi,
>>
>> I have a musicxml file that is not properly imported into my music 
>> notation app and I have to change the syntax to do a better import.
>> I gave it a go with grep but can't seem to get the proper pattern to make 
>> the change.
>>
>> In short, I want to remove the dynamics tags plus content from a note tag 
>> and place it before the note tag with new closing tags.
>> Difficulty is the occurrence of several  tags and the greediness of 
>> the patterns I tested.
>> I also gave the must not occur (?!) a go but to no avail. 
>> Any help in the matter would be greatly appreciated
>>
>> Here is an example:
>>
>> before
>>
>> 
>> 
>> 
>> 48
>> 
>> 
>> 
>> D
>> 6
>> 
>> 48
>> 1
>> quarter
>> 1
>> 
>> 
>> 
>> G
>> 5
>> 
>> 48
>> 1
>> quarter
>> 1
>> 
>> 
>> 
>> D
>> 5
>> 
>> 48
>> 1
>> quarter
>> 1
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> G
>> 5
>> 
>> 48
>> 1
>> quarter
>> 1
>> 
>> 
>>
>>
>> **
>> 
>> 
>> 
>> 
>>
>> after
>>
>> 
>> 
>> 
>> 48
>> 
>> 
>> 
>> D
>> 6
>> 
>> 48
>> 1
>> quarter
>> 1
>> 
>> 
>> 
>> G
>> 5
>> 
>> 48
>> 1
>> quarter
>> 1
>> 
>> 
>> 
>> D
>> 5
>> 
>> 48
>> 1
>> quarter
>> 1
>> 
>> 
>> 
>> 
>> 
>> 
>>
>>
>>
>>
>>
>>
>>
>>
>> **
>> 
>> 
>> G
>> 5
>> 
>> 48
>> 1
>> quarter
>> 1
>> 
>> 
>> 
>> 
>> 
>> 
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/12abf2b1-9373-4b60-8647-36ac016b1c65n%40googlegroups.com.


Re: Split a text file with tabs based on character position in a line?

2022-11-11 Thread jj
Another option (pun intended) is to select a multiline vertical insertion 
point selection by  the cursor vertically (that is 
creating a vertical selection while holding the  key)
 |
  ---+
/
   v
abc*|*def
abc*|*def
abc*|*def

And then typing a .

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b774074e-de89-4440-a441-12ae605d2110n%40googlegroups.com.


Re: Split a text file with tabs based on character position in a line?

2022-11-10 Thread jj
You could try a 'Replace All' with a regular expression using column width 
instead of character positions.

Find:

(.{65})(.{25})(.{35})

Replace:

\1\t\2\t\3

HTH,

Jean Jourdain

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/c4b0ab86-36ab-48f8-8dbd-e2a94c9b89d6n%40googlegroups.com.


Re: Copy markdown as HTML

2022-11-08 Thread jj
Oups! Hastily copy/pasted:
* ... and call the script from menu Script > Apply Text Filter > 
copy_markdown_as_html.

Should read:
and call the script from menu Scripts > copy_markdown_as_html.
On Tuesday, November 8, 2022 at 5:54:00 PM UTC+1 jj wrote:

> You could try pandoc <https://pandoc.org>.
>
>  Install it from Terminal with homebrew <https://brew.sh>:
>
> % brew install pandoc
> 
> Create this simple BBEdit script 
> <https://gist.github.com/mixio/02b1e24a7ef7033ead55c7d91bcfb449> in 
> ~/Library/Application\ 
> Support/BBEdit/Scripts/copy_markdown_as_html.applescript
> 
> and call the script from menu Script > Apply Text Filter > 
> copy_markdown_as_html.
>
> HTH,
>
> Jean Jourdain
>
> On Tuesday, November 8, 2022 at 4:18:56 PM UTC+1 Greg Raven wrote:
>
>> The obvious answer is to copy the Markdown and paste it into WordPress. 
>> WordPress will convert it to it's own special format(s), and then your 
>> should be good to go.
>>
>> If you insist on using HTML for WordPress, Daring Fireball offers a 
>> BBEdit plugin that converts Markdown to HTML.
>>
>> https://daringfireball.net/projects/markdown/
>>
>> On Monday, November 7, 2022 at 1:01:21 PM UTC-8 drfra...@gmail.com wrote:
>>
>>> Markdown focused applications like iA Writer, Marked2 and Ulysses have 
>>> an Edit Menu item 'Copy as HTML'. I find it handy when creating WordPress 
>>> content. Unfortunately, for my purposes, BBEdit's Edit menu's 'Copy as 
>>> Styled HTML' outputs more complex text. Can someone suggest an easy way to 
>>> copy markdown as basic HTML in BBEdit?
>>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/9188702d-8538-4c10-9b24-1d86ef7ee060n%40googlegroups.com.


Re: Copy markdown as HTML

2022-11-08 Thread jj
You could try pandoc .

 Install it from Terminal with homebrew :

% brew install pandoc

Create this simple BBEdit script 
 in 
~/Library/Application\ 
Support/BBEdit/Scripts/copy_markdown_as_html.applescript

and call the script from menu Script > Apply Text Filter > 
copy_markdown_as_html.

HTH,

Jean Jourdain

On Tuesday, November 8, 2022 at 4:18:56 PM UTC+1 Greg Raven wrote:

> The obvious answer is to copy the Markdown and paste it into WordPress. 
> WordPress will convert it to it's own special format(s), and then your 
> should be good to go.
>
> If you insist on using HTML for WordPress, Daring Fireball offers a BBEdit 
> plugin that converts Markdown to HTML.
>
> https://daringfireball.net/projects/markdown/
>
> On Monday, November 7, 2022 at 1:01:21 PM UTC-8 drfra...@gmail.com wrote:
>
>> Markdown focused applications like iA Writer, Marked2 and Ulysses have an 
>> Edit Menu item 'Copy as HTML'. I find it handy when creating WordPress 
>> content. Unfortunately, for my purposes, BBEdit's Edit menu's 'Copy as 
>> Styled HTML' outputs more complex text. Can someone suggest an easy way to 
>> copy markdown as basic HTML in BBEdit?
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/07d2ccd3-621f-414c-bed7-c2e209d5c85bn%40googlegroups.com.


Re: Convert XML to JSON?

2022-11-04 Thread jj
You could try yq .

 Install it from Terminal with homebrew :

brew install python-yq

Create this simple BBEdit text filter in *~/Library/Application\ 
Support/BBEdit/Text\ Filters/xml2json.sh*

#!/bin/sh
xq '.'

and call the filter from menu Text > Apply Text Filter > xml2json.

HTH,

Jean Jourdain

On Thursday, November 3, 2022 at 1:28:42 AM UTC+1 severdia wrote:

> Is there an easy way to so a simple XML to JSON conversion in BBedit? 
> Oxygen and some other tools seem to do this, but short of creating a 
> TextFactory or similar, I don't see an easy way to do it. 
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/7fabe477-4df4-42ce-b3c4-2f993577505dn%40googlegroups.com.


Re: Sort via GREP involving tabs and invisibles

2022-10-16 Thread jj
Considering that list indentation is a form of compression, this BBEdit 
script *sort_and_merge_indented_list.applescript* 

 decompresses 
the list, sorts it with the shell `sort` command, and compresses it back 
again.
In doing so, the indented list will be sorted, sub lists will be merged and 
duplicates will be eliminated.
For sorting options (case insensitive, etc.) see the `sort` man page in 
terminal and  adapt the do shell script according to your needs.
This script work on the selection of the front document or on the whole 
document if  nothing is selected. Selected lines should cover whole 
sub-lists appropriately to make sense.
By default the script accepts TAB or 4 SPACES indented lists but outputs 
TAB indented lists. 
If you'd prefer a final 4 SPACES indented list, change the `vIndentation` 
variable.

INSTALL

Copy this script to ~/Library/Library/Application\ 
Support/BBEdit/Scripts/sort_and_merge_indented_list.applescript
Call it from BBEdit's AppleScript menu.

HTH,

Jean Jourdain
On Wednesday, October 12, 2022 at 9:59:34 PM UTC+2 Harvey Pikelberger wrote:

> What comes to mind that might work would be to layer on (and eventually 
> migrate to) a database-managed system.
> As an approach it's not necessarily super easy, but it's also not 
> impossible or beyond the reach.  FileMaker is actually a pretty good / 
> easy-to-learn system for this kind of stuff.
> There's a TROI plugin for it that handles metadata. Even better (if you 
> have the patience) is to build your own metadata integration using 
> something like exiftool (an open source command line app, very powerful) 
> which, with a little jujitsu, integrates with FMP very nicely.
>
> Process would go something like this:
> Database that includes a "Photos" table.
> From each photo you extract a list of all associated keywords
> Each new keyword is added to a "Keywords" table in the same database.  Any 
> duplicate keyword is not added.
> Each item in the Photos table "knows" its associated keywords by means of 
> a reference to the Keywords table.
>
> The icing on the cake would be to not only extract but also push-to-update 
> those keywords into the IPTC metadata of each individual photo in such a 
> way that PM continues to recognize them -- so you use both your custom 
> solution and PM seamlessly with each other.
>
> All that assumes you even need embedded keywords.  If the point is to 
> coordinate how images are presented on a web page or how they appear in web 
> searches, you might be able to forego the IPTC data altogether and handle 
> everything via database + dynamic web pages with keywords attached.
>
> It can take a while to figure out the best approach, but it sounds like 
> you're doing cool stuff.
>
> On Wednesday, October 12, 2022 at 12:23:10 PM UTC-7 
> stu...@matthewbenderstudios.com wrote:
>
>> Got it, thanks. It's fine, I know it's a complex topic. The 'assets' in 
>> this particular case is my keyword library. I love PM, but the limitations 
>> it has with managing a keyword library in-program is a severe limitation. A 
>> change of any real size clearly needs to be done through a second program 
>> and then loaded back into PM. 
>> Yeah, I'll want duplicates removed. I've deleted them manually for this, 
>> but it's not ideal in a long term solution.
>> PM uses IPTC metadata, and they're linked on a per-photo basis, you're 
>> correct. I use PM to attach appropriate keywords to each image and then 
>> upload them to my archive site. The structured keyword feature of PM lets 
>> me attach them faster and more consistently to a group of many related 
>> images. It's just unfortunate that it's not easier to manage the keywords 
>> themselves through the program.
>> -Matt
>>
>> On Wednesday, October 12, 2022 at 1:49:24 PM UTC-4 Harvey Pikelberger 
>> wrote:
>>
>>> Basically I'm using JavaScript as the solution, and my impression is a 
>>> reliable solution might take a while to develop.
>>>
>>> For instance, the 2nd list you sent tripped up the original JS solution 
>>> because it included keywords with spaces.
>>> No big deal / easy enough to tweak, but kind of shows how one fix 
>>> reveals underlying additional challenges.
>>>
>>> So check this out: You might notice that the case-insensitive sorted 
>>> list reveals a lot of duplicate keywords.
>>> I imagine you'd want those removed, which in turn would involve 
>>> preserving but not duplicating sub-keywords.
>>>
>>> I'm not familiar with Photo Mechanic, but apparently it uses IPTC 
>>> metadata.  I wonder if that means the keywords are embedded into the 
>>> metadata on a per-photo basis.  The best solution would involve better 
>>> understanding the underlying logic (along with the idiosyncratic quirks) of 
>>> the software + knowing what you're trying to achieve (and how that might 
>>> evolve).
>>>
>>> Apologies for the not-so-concise 

Re: Scriptless Language Module help for text documents

2022-09-15 Thread jj
Hi Travis,

There are a few issues with your module.

1. BBEdit reports an error in your module

Menu BBEdit > Folders > Logs
Check 
~/Library/Containers/com.barebones.bbedit/Data/Library/Logs/BBEdit/Language 
Module Errors.log



2022-09-15 10:30:24.678: Startup
The following problem(s) were encountered while loading the 
language module at ~/Library/Application Support/BBEdit/Language 
Modules/foldingtext.plist:
The Comment Pattern was invalid (missing closing parenthesis 
(error 112114) at offset 224 in pattern).
The reported problems will prevent the language module from loading.

This is due to the '#' characters not being escaped in '(?s:^#.*?#$)' 
when using the (?x) modifier. Should be '(?s:^\#.*?\#$)' .

 2. Not sure if Codeless Language Modules will do Comment Pattern folding. 
 You could use Function Pattern folding instead.
 

http://www.apple.com/DTDs/PropertyList-1.0.dtd;>


BBLMCanSpellCheckCodeRuns

BBLMCommentPrefixDefault
#
BBLMCommentSuffixDefault
#
BBLMCommentLineDefault
//
BBEditDocumentType
CodelessLanguageModule
BBLMColorsSyntax

BBLMIsCaseSensitive

BBLMLanguageCode
txtF
BBLMLanguageDisplayName
Folding Text
BBLMScansFunctions

BBLMSuffixMap


BBLMLanguageSuffix
.txt


BBLMScansFunctions

BBLMFunctionScannerDoesFoldsToo

Language Features

Identifier and Keyword Character Class
\p{Xwd}
Function Pattern





HTH,

Jean Jourdain

On Wednesday, September 14, 2022 at 11:18:04 PM UTC+2 trais...@gmail.com 
wrote:

> I use BBEdit for all of my generic text needs, but one thing I love from 
> programming that is not available (as far as I can tell) is folding for 
> generic text files.  Sometimes when I am using Bbedit for notes I will 
> create blocks like I am writing code.  I wanted to be able to fold these 
> blocks out of the way when I don’t need them.  I decided to make a Language 
> Module that lets me add comments and blocks using common programming 
> comment styrax like // or /* */ or .  I think I am where I want it to 
> be, my comment pattern’s all work as expected, and I used a pList editor, 
> but when I save and restart BBEdit it does not appear in the list.
> Could anyone help me figure out why it's not loading (guessing I have an 
> error). I know I have the pList in the right folder.  I have a github 
> started at https://github.com/traisjames/BBEdit-FoldingText because if 
> its working I am happy to share my crazy.
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b05da67c-21f6-4a84-bb0e-967900dd9dc6n%40googlegroups.com.


Re: Generating markdown table of contents?

2022-08-11 Thread jj
Sticking with Pandoc, you could use a BBEdit shell script to create a 
clickable table of contents at the beginning of the document.

Create script in ~/Library/Application Support/BBEdit/pandoc-toc.sh

#!/usr/bin/env sh

pandoc \
--standalone \
--from=markdown \
--to=markdown \
--table-of-contents \
-V toc-title:"Table of Contents" \
--template="${HOME}/.pandoc/template.markdown" \
--toc-depth=4 \
--reference-links \
--reference-location=section \
-o "${BB_DOC_PATH}" -

Create the following template in ~/.pandoc/template.markdown

$if(titleblock)$
$titleblock$

$endif$
$for(header-includes)$
$header-includes$

$endfor$
$for(include-before)$
$include-before$

$endfor$
$if(toc)$

$if(toc-title)$
# $toc-title$
$endif$

$table-of-contents$

$endif$
$body$
$for(include-after)$

$include-after$
$endfor$

And use the straight Pandoc Markdown Processor in BBEdit's Preferences.

This is not exactly what you want, but maybe by reading the documentation 
and tweaking Pandoc a bit more you could get what you are after.

HTH

Jean Jourdain


On Thursday, August 11, 2022 at 6:48:25 PM UTC+2 craigh wrote:

> It looks like the default cmark preprocessor doesn’t include a “tag” for 
> generating a table of contents? I have used MultiMarkdown in the past so I 
> just installed v6.6.0 and inserted a {{TOC}} in my document - select 
> MultiMarkdown as the Markdown processor in the BBEdit preferences and I get 
> a clickable TOC in the preview. I believe this is similar to what Jean 
> recommended except using MultiMarkdown instead of Pandoc.
>
> Good idea on the use of a preview template but in the end, I would need to 
> have the preview window open to see or make use of the TOC. I have too many 
> windows open as it is so I’m trying to avoid that option.
>
> Other options I’ve explored:
>
> Joplin - I have a co-worker who’s a big fan but our setup has been 
> unstable (server at his location, everything encrypted, lost some files, 
> etc.) so I’m avoiding this at the moment. Also not a big electron-based app 
> fan but that’s a minor point. I do like the fact that you can easily toggle 
> between plain text and markdown preview in the editor via a “Toggle 
> editors” button. It also supports automatic TOC generation via [[toc]].
>
> Obsidian - similar to Joplin in that you can easily switch views between 
> plain text and processed. You can also open a parallel pane to see the 
> processed text. Requires a plugin for TOC generation but it does seem to 
> work well. The plugin includes some support for external editors (e.g. 
> [/toc/], {{doc}}, [[__TOC__]], and [toc]). If the editor pane is set to 
> source mode, you can’t see the TOC but if set to live preview mode, the TOC 
> is visible and clickable (need to click an edit button to edit the TOC when 
> in this mode).
>
> I’ve been a Bbedit user since the earliest days so hoping to find a 
> workable solution. Maybe a simple request to BBEdit support for a “toggle 
> view” button in the editor window to switch between plain text and markdown 
> preview mode!
>
> Thanks,
>
> Craig
>
>
> On Aug 11, 2022, at 10:30 AM, Greg Raven  wrote:
>
> I was thinking you could have your Markdown window on one side of your 
> screen and BBEdit's preview window (which is HTML) on the other side. 
> Changes to the Markdown file show virtually immediately in the preview 
> window. You could even create a preview template with the TOC tag in it so 
> you wouldn't have to add that to each working file in order for it to 
> appear in your preview window.
>
> On Thursday, August 11, 2022 at 8:12:14 AM UTC-7 craigh wrote:
>
>> Thanks for the good ideas but all those solutions only seem to show the 
>> TOC in the markdown preview. I probably wasn’t clear enough that the main 
>> goal is to *generate the TOC in the .md file and have it display in the 
>> .md file while still editing in BBEdit.*
>>
>> I’d prefer to not have to manually add any special attributes such as > name=“my section name"> to each header as some tools require but 
>> that wouldn’t be a show stopper.
>>
>> For example, after putting the insertion point at the start of my 
>> document (or not doing that if the script is smart enough to do it for me), 
>> then running the script/plugin/etc. I’d expect to see the TOC inserted at 
>> the start of the document or just below the “title” (H1 header). Something 
>> similar to the following...
>>
>> *Before*
>>
>> Document Title
>> ==
>>
>> ---
>> ## Section One
>>
>> Blah
>>
>> ---
>> ## Section Two
>>
>> Blah blah
>>
>>
>>
>> *After without clickable links*
>>
>> Document Title
>> ==
>>
>> ---
>> ## Table of Contents
>> 1. Section One
>> 2. Section Two
>>
>> ---
>> ## Section One
>>
>> Blah
>>
>> ---
>> ## Section Two
>>
>> Blah blah
>>
>>
>> *After with clickable links*
>>
>> Document Title
>> ==
>>
>> ---
>> ## 

Re: Selecting/Highlighting Text via trackpad gesture not possible

2022-08-06 Thread jj
Good to know. Thank you for reporting back.

On Friday, August 5, 2022 at 2:16:47 PM UTC+2 Nora wrote:

> Just in case anyone else is running into this issue, I got it to work by 
> turning 
> *off* the "Force Click and haptic feedback" option in the macOS "Trackpad" 
> system preferences; a tip provided by Barebones Support.
>
> On Thursday, August 4, 2022 at 11:08:20 AM UTC-4 Nora wrote:
>
>> BBEdit version 14.5.1 (14C208, Apple Silicon, sandboxed)
>>
>> I recently moved to a new macbook and for reasons unclear I can no longer 
>> use normal trackpad gestures to select/highlight text in any open document 
>> in BBEdit. 
>>
>> These same gestures work fine in any other app. 
>>
>> I even restored all my BBEdit preferences to default, to no avail.
>>
>> If anyone has any idea as to what could be the problem here, please do 
>> not hesitate to respond as I am drawing a blank.
>>
>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2d981369-f0f7-43e2-b382-75977a968988n%40googlegroups.com.


Re: Selecting/Highlighting Text via trackpad gesture not possible

2022-08-04 Thread jj
Hi Nora,

Might it be that the Preferences > Editing > Allow pinch-to-zoom to change 
magnification checkbox is deselected ?

HTH

Jean Jourdain

On Thursday, August 4, 2022 at 5:08:20 PM UTC+2 Nora wrote:

> BBEdit version 14.5.1 (14C208, Apple Silicon, sandboxed)
>
> I recently moved to a new macbook and for reasons unclear I can no longer 
> use normal trackpad gestures to select/highlight text in any open document 
> in BBEdit. 
>
> These same gestures work fine in any other app. 
>
> I even restored all my BBEdit preferences to default, to no avail.
>
> If anyone has any idea as to what could be the problem here, please do not 
> hesitate to respond as I am drawing a blank.
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/075eb454-63b0-42b4-9475-2f20f097ac9en%40googlegroups.com.


Re: How to set the cursor at the top of the document

2022-06-08 Thread jj
Hi Omar,

>From Mac keyboard shortcuts  :

   - *Command–Up Arrow*: Move the insertion point to the beginning of the 
   document

HTH

Jean Jourdain
On Wednesday, June 8, 2022 at 1:53:07 PM UTC+2 omn...@gmail.com wrote:

> Hi and good day,
>
> If the excellent BBEdit app had a command to set the cursor at the top of 
> the document when necessary - it would be great! 
> Or with AppleScript?
>
> /
>
> with best regards, Omar K Neusser, Stockholm, Sweden
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/6236bb0a-7f77-4063-b5dc-662cb0d7caecn%40googlegroups.com.


Re: Project collection object in BBEdit applescript

2022-06-04 Thread jj
The question here is that the file/directory project items of the first 
level project collection of a project document are returned as «class furl» 
objects instead of the expected project item objects.
I have sent a mail to Bare Bones technical support concerning this.

Jean Jourdain

On Saturday, June 4, 2022 at 12:17:27 AM UTC+2 Neil Faiman wrote:

> Well, it confirms what I had already seen. That is, even though the, 
> according to ScriptDebugger, the *project collections* of the 
> *project document *really are *project collections* (and ScriptDebugger 
> lets me zoom in and look at their contents), when I get one of those *project 
> collections* in an AppleScript, what I actually get is a file reference, 
> not a *project collection*.
>
> Neil Faiman
>
> On Jun 3, 2022, at 3:11 PM, jj  wrote:
>
> Hi Neil,
>
> This AppleScript snippet might help you understand how BBEdit sees the 
> project document hierarchy.
>
> set v4Spaces to ""
> tell application "BBEdit"
> set vProjectDocument to first project document
> set vProjectCollections to project collections of vProjectDocument
> repeat with vProjectCollection in vProjectCollections
> my logProjectCollection(vProjectCollection, space)
> end repeat
> end tell
>
> on logProjectCollection(aProjectCollection, aIndent)
> tell application "BBEdit"
> set vClass to (class of aProjectCollection) as string
> if class of aProjectCollection is project collection then
> log (aIndent & vClass & " : " & (name of 
> aProjectCollection) as string) & space
> repeat with vSubProjectCollection in aProjectCollection
> my logProjectCollection(vSubProjectCollection, aIndent 
> & my v4Spaces)
> end repeat
> return
> else if class of aProjectCollection is project item then
> set vPath to POSIX path of ((file of aProjectCollection) 
> as string)
> else if aProjectCollection is not missing value then
> set vPath to POSIX path of ((aProjectCollection) as string)
> end if
> if vPath ends with "/" then
> set vType to ""
> else
> set vType to ""
> end if
> if vClass is "«class furl»" then
> set vClass to "url"
> end if
> log aIndent & vClass & " " & vType & ": " & vPath & space
> end tell
> end logProjectCollection
>
> HTH,
>
> Jean Jourdain
>
> On Friday, June 3, 2022 at 7:26:59 PM UTC+2 Neil Faiman wrote:
>
>> BBEdit 14.1.2, Mac OS Monterey 12.4
>>
>> Using AppleScript, I want to navigate into a folder in a collection in a 
>> project window. I have the following script:
>>
>> *tell* *application* "BBEdit"
>> *try*
>> *set* project *to* *project document* "ZBA.bbprojectd"
>> *on* *error*
>> *display alert* ¬
>> "The ZBA project is not open in BBEdit" as *warning* message ¬
>> "Open the ZBA project and try again" buttons "OK" default button "OK"
>> *return*
>> *end* *try*
>> *set* site *to* project's *project collection* "Site"
>> *set* cases *to* site's *first* *project item* *whose* name *is* "cases"
>> *end* *tell*
>>
>> Debugging it in ScriptDebugger, the "*set* project” command successfully 
>> accesses the project, and sets project to a BBEdit *project document* 
>> object. 
>> When I examine it  in the debugger, it contains a dozen *project 
>> collection* elements. *project collection 10* is named “Site” and 
>> represents a folder on disk. However, after executing the “*set* site” 
>> command, site is *not* a BBEdit *project collection* object — it is a 
>> file reference to the folder represented by the collection ( «class file» 
>> "Macintosh HD:Users:neil:Library:Mobile 
>> Documents:com~apple~CloudDocs:zba:Web Site:wiltonzba.org:" ).
>>
>> Can anyone explain this behavior, or, even better, how to get at the 
>> *project 
>> collection* (and its contents0 as I intended?
>>
>> Thanks,
>> Neil Faiman
>>
>>
>>
>>
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "sup...@barebones.com" 
> rather than posting here. Follow @bbedit on T

Re: Project collection object in BBEdit applescript

2022-06-03 Thread jj
Hi Neil,

This AppleScript snippet might help you understand how BBEdit sees the 
project document hierarchy.

set v4Spaces to ""
tell application "BBEdit"
set vProjectDocument to first project document
set vProjectCollections to project collections of vProjectDocument
repeat with vProjectCollection in vProjectCollections
my logProjectCollection(vProjectCollection, space)
end repeat
end tell

on logProjectCollection(aProjectCollection, aIndent)
tell application "BBEdit"
set vClass to (class of aProjectCollection) as string
if class of aProjectCollection is project collection then
log (aIndent & vClass & " : " & (name of 
aProjectCollection) as string) & space
repeat with vSubProjectCollection in aProjectCollection
my logProjectCollection(vSubProjectCollection, aIndent 
& my v4Spaces)
end repeat
return
else if class of aProjectCollection is project item then
set vPath to POSIX path of ((file of aProjectCollection) as 
string)
else if aProjectCollection is not missing value then
set vPath to POSIX path of ((aProjectCollection) as string)
end if
if vPath ends with "/" then
set vType to ""
else
set vType to ""
end if
if vClass is "«class furl»" then
set vClass to "url"
end if
log aIndent & vClass & " " & vType & ": " & vPath & space
end tell
end logProjectCollection

HTH,

Jean Jourdain

On Friday, June 3, 2022 at 7:26:59 PM UTC+2 Neil Faiman wrote:

> BBEdit 14.1.2, Mac OS Monterey 12.4
>
> Using AppleScript, I want to navigate into a folder in a collection in a 
> project window. I have the following script:
>
> *tell* *application* "BBEdit"
> *try*
> *set* project *to* *project document* "ZBA.bbprojectd"
> *on* *error*
> *display alert* ¬
> "The ZBA project is not open in BBEdit" as *warning* message ¬
> "Open the ZBA project and try again" buttons "OK" default button "OK"
> *return*
> *end* *try*
> *set* site *to* project's *project collection* "Site"
> *set* cases *to* site's *first* *project item* *whose* name *is* "cases"
> *end* *tell*
>
> Debugging it in ScriptDebugger, the "*set* project” command successfully 
> accesses the project, and sets project to a BBEdit *project document* object. 
> When I examine it  in the debugger, it contains a dozen *project 
> collection* elements. *project collection 10* is named “Site” and 
> represents a folder on disk. However, after executing the “*set* site” 
> command, site is *not* a BBEdit *project collection* object — it is a 
> file reference to the folder represented by the collection ( «class file» 
> "Macintosh HD:Users:neil:Library:Mobile 
> Documents:com~apple~CloudDocs:zba:Web Site:wiltonzba.org:" ).
>
> Can anyone explain this behavior, or, even better, how to get at the *project 
> collection* (and its contents0 as I intended?
>
> Thanks,
> Neil Faiman
>
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/00f1b217-7a97-4ce7-a874-3e5ae8d3cc36n%40googlegroups.com.


Re: Drag image into markdown document and generate HTML tag instead of markdown reference?

2022-05-28 Thread jj
Hi Craig,

You should check the `documentWillInsertTextForDroppedImageFile` document 
attachment point.

Manual page: 347/348

on documentWillInsertTextForDroppedImageFile(theDocument, theImageFile, 
proposedText)
tell application "Acorn" to open theImageFile
return proposedText
end documentWillInsertTextForDroppedImageFile.

HTH,

Jean Jourdain

On Friday, May 27, 2022 at 6:34:40 PM UTC+2 craigh wrote:

> I know that I can drag an image file into a BBEdit markdown document and 
> BBEdit will give me a markdown reference like so (image and markdown 
> document are in the same folder):
>
> ![<# alt text #>](diagram.png "diagram.png")
>
> I often have to adjust the size of an image in markdown documents so I end 
> up having to change the markdown references to HTML image tags something 
> like this:
>
> 
>
> Is there a way to change the default BBEdit behavior to get an HTML tag 
> instead of a markdown reference when dragging an image file into the 
> document?
>
> Thanks,
>
> Craig
>
>
> --
> Craig Heilman
> Bugaboo Software
>
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/9374b397-17ac-4ff1-bed4-2c236d632762n%40googlegroups.com.


Re: CLM question

2022-05-16 Thread jj
Hi Tim,

Good to know it worked.

Here is the commented regular expression.

(?P   (?# FUNCTION NAMED CAPTURE GROUP used by BBEdit for FOLDS. 
)
\h* (?# Zero or more horizontal whitespace. 
   )
\n  (?# One linefeed.   
   )
(   (?# LINE GROUP. 
   )
\d+ (?# One or more digits. 
   )
\h  (?# One horizontal space. Important: means line is 
in function body.   )
.+  (?# Rest of the line. By default, dot is not 
allowed to match EOL. )
(   (?# EOL options group. See comment below.   
   )
\n  (?# One linefeed.   
   )
|   (?# or 
)
\z  (?# EOF. Needed for catching the last line. 
   )
)   (?# End of LINE GROUP. 
)
)*  (?# Zero or more LINEs. 
   )
(?# A Mandatory last LINE. 
)
\d+ (?# One or more digits. 
   )
\h  (?# One horizontal space. Important: means line is in 
function body.   )
.+  (?# Rest of the line. Not including EOL.   
)
)   (?# The FOLD should end before the optional next linefeed 
as it is the functions separator.)

The secret sauce is in catching only lines that start by digits followed by 
a space as they are function body lines.

Rethinking it, the `EOL options group` is overkill, a single "\n" will 
suffice as those lines are never the last line of the file.

(?P
\h*\n
(\d+\h.+\n)*
\d+\h.+
)

Regards,

Jean

On Monday, May 16, 2022 at 1:37:30 AM UTC+2 Tim Gray wrote:

> Thank you!  This is great. 
>
> Can I bother you for an explanation for the folding part of the pattern? 
>  I assume this is the second part of the function pattern (the part named 
> ‘function’).
>
> On Sun, May 15, 2022, at 5:11 AM, jj wrote:
>
> Hi Tim,
>
> Here is an attempt for you special case CLM.
>
> Save it as ~/Library/Application\ Support/BBEdit/Language\ 
> Modules/free42.plist
> and restart BBEdit.
>
> You should now have a 'Free42' language module that highlights files with 
> the .free42 extension.
>
> HTH,
>
> Jean Jourdain
>
> --
>
> 
>  http://www.apple.com/DTDs/PropertyList-1.0.dtd;>
> 
> 
> BBEditDocumentType
> CodelessLanguageModule
> BBLMColorsSyntax
> 
> BBLMIsCaseSensitive
> 
> BBLMSupportsTextCompletion 
>  
> BBLMKeywordList
>  
> GTO 
> RTN 
> LSTO 
> RCL 
> END
> SIGN
> R
> XEQ
>  
> BBLMLanguageCode
> FR42
> BBLMLanguageDisplayName
> Free42
> BBLMScansFunctions
> 
> BBLMFunctionScannerDoesFoldsToo
> 
> BBLMSuffixMap
> 
> 
> BBLMLanguageSuffix
> .free42
> 
> 
> Language Features
> 
> Close Block Comments
> 
> Close Statement Blocks
> 
> End-of-line Ends Strings 1
> 
> End-of-line Ends Strings 2
> 
> Escape Char in Strings 1
> \
> Escape Char in Strings 2
> \
> Identifier and Keyword Character Class
> \p{Xwd}
> Open Block Comments
> 
> Open Line Comments
> 
> Open Statement Blocks
> 
> Close Strings 1
> 
> Close Strings 2
> 
> Open Strings 1
> 
> Open Strings 2
> 
> String Pattern
> 
> Function Pattern
> 
> 
> 
> 
> --

Re: CLM question

2022-05-15 Thread jj
Hi Tim,

Here is an attempt for you special case CLM.

Save it as ~/Library/Application\ Support/BBEdit/Language\ 
Modules/free42.plist
and restart BBEdit.

You should now have a 'Free42' language module that highlights files with 
the .free42 extension.

HTH,

Jean Jourdain

--


http://www.apple.com/DTDs/PropertyList-1.0.dtd;>


BBEditDocumentType
CodelessLanguageModule
BBLMColorsSyntax

BBLMIsCaseSensitive

BBLMSupportsTextCompletion 
 
BBLMKeywordList
 
GTO 
RTN 
LSTO 
RCL 
END
SIGN
R
XEQ
 
BBLMLanguageCode
FR42
BBLMLanguageDisplayName
Free42
BBLMScansFunctions

BBLMFunctionScannerDoesFoldsToo

BBLMSuffixMap


BBLMLanguageSuffix
.free42


Language Features

Close Block Comments

Close Statement Blocks

End-of-line Ends Strings 1

End-of-line Ends Strings 2

Escape Char in Strings 1
\
Escape Char in Strings 2
\
Identifier and Keyword Character Class
\p{Xwd}
Open Block Comments

Open Line Comments

Open Statement Blocks

Close Strings 1

Close Strings 2

Open Strings 1

Open Strings 2

String Pattern

Function Pattern





--
On Saturday, May 14, 2022 at 10:36:49 PM UTC+2 Tim Gray wrote:

> I'm trying to write a codeless language module for an obscure 'language' - 
> keystroke program listings for an HP42S calculator (or the Free42 program 
> as the case may be). I think I've got all the keywords and special 
> characters figured out but am struggling with two things. First, here's a 
> sample program listing:
>
> 00 { 37-Byte Prgm }
> 01▸LBL "FAC"
> 02 X≠0?
> 03 GTO 00
> 04 SIGN
> 05 RTN
> 06▸LBL 00
> 07 R↑
> 08 LSTO "T"
> 09 R↓
> 10 LSTO "N"
> 11 1
> 12 -
> 13 XEQ "FAC"
> 14 RCL "N"
> 15 ×
> 16 RCL "T"
> 17 R↓
> 18 END
>
> I'd like to have the 'LBL' lines show up in the function popup with the 
> correct label ("FAC" or "00"). Code folding for each section would be nice, 
> but not necessary. I'm not sure the best way to implement this - I tried 
> "Prefix for Functions" but I'm assuming I need "Function Pattern" instead.
>
> My second question pertains to the line numbers. The line numbers are 
> often part of a listing, but are not actually part of the program. I'd like 
> some way to highlight those if possible. Is that doable in a CLM? The regex 
> is easy: '^\d+( |▸)' but I don't know if there is anyway to implement it...
>
> Thanks,
> Tim
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/1796707b-1847-485a-93ce-b948255fb795n%40googlegroups.com.


Re: I'm trying to script the Save Document command

2022-05-10 Thread jj
David,

A couple of reasons your script is not working:

  • `if vDocument is FTP then`

As this is not in a `tell application "BBEdit` block, AppleScript 
interprets
the `is` as the equals operator `=` as in `if Document = FTP then`.
To interpret the `is FTP` as a BBEdit `Document` property AppleScript 
needs the 
BBEdit terminology which is imported by the `tell application "BBEdit"`.

There is a second issue. `is FTP` is a property of `vDocument`.
This should be stated as `is FTP of vDocument` or in the shorter 
possessive
form `vDocument's is FTP` (note the `'s`).

  • `FTPInfo`

This property of `Document` should be spelled `FTP info` in two words 
as 
indicated in the BBEdit terminology.

Here is a snippet that seems to work on my setup:

use AppleScript version "2.7"
use scripting additions
--
on trace(aMessage)
set vDesktopFolder to POSIX path of (path to desktop folder as 
string)
set vTraceFile to vDesktopFolder & "trace.txt"
do shell script ("echo" & space & (the quoted form of aMessage) & 
">>" & (the quoted form of vTraceFile))
end trace
--
on documentDidSave(vDocument)
try
tell application "BBEdit"
if class of vDocument is text document then
if vDocument's is FTP then
set vFTPInfo to FTP Info of vDocument
set vFile to vFTPInfo's file
set vHost to vFTPInfo's host
set vURL to vDocument's URL
my trace("is FTP file" & linefeed & vHost & 
linefeed & vURL)
else
my trace("is NOT FTP file")
set vFile to vDocument's file
end if
set vPosixPath to POSIX path of (vFile as string)
my trace(vPosixPath)
my trace("")
end if
end tell
on error aMessage
display alert aMessage
end try
end documentDidSave

HTH,

Jean Jourdain

On Monday, May 9, 2022 at 5:02:17 PM UTC+2 kdb...@gmail.com wrote:

> Jean, your script works when run as an osascript, however I'm trying to 
> run the script as a BBEdit OnDocumentSave
>
> In that case I've fixed the syntax errors (as best I can, probably 
> incorrectly) and it only runs to the first 'do shell script', nothing after 
> that executes.
>
> $HOME/asecho is just "echo $* >> $HOME/Desktop/trace" for logging purposes.
>
>  David
>
>
> -- text document doc
>
> *on* documentDidSave(vDocument)
>
>*do shell script* "$HOME/asecho run"
>
>*if* vDocument *is* FTP *then*
>
>*do shell script* "$HOME/asecho is FTP file"
>
>*set* vFTPInfo *to* FTPInfo *of* vDocument
>
>*set* vFile *to* vFTPInfo's *file*
>
>*set* vHost *to* vFTPInfo's host
>
>-- set vURL to vFTPInfo's URL -- WARNING: triggers an error even 
> though the property exists and is visible in the results pane.
>
>*set* vURL *to* vDocument's *URL*
>
>*log* {vHost, vURL}
>
>*do shell script* "$HOME/asecho is FTP file" & vHost & " " & vURL
>
>*else*
>
>*do shell script* "echo is NOT FTP file"
>
>*if* vDocument's modified *then*
>
>*save* vDocument
>
>*end* *if*
>
>*set* vFile *to* vDocument's *file*
>
>*set* vPosixPath *to* POSIX path *of* (vFile *as* *string*)
>
>*do shell script* "$HOME/asecho is NOT FTP file" & *the* quoted 
> form *of* vPosixPath
>
>*end* *if*
>
>*log* vFile
>
>*set* vPosixPath *to* POSIX path *of* (vFile *as* *string*)
>
>*log* vPosixPath
>
>*do shell script* "$HOME/asecho run ls on " & *the* quoted form *of* 
> vPosixPath
>
>*do shell script* "ls -al" & space & *the* quoted form *of* vPosixPath
>
> *end* documentDidSave
>
> On Sunday, May 8, 2022 at 2:12:53 AM UTC-7 jj wrote:
>
>> Hi David,
>>
>> `try ... on error`  blocks  are very useful for debugging scripts.
>>
>> Before porting it to a Document Script, test your logic in the Script 
>> Editor where you can use the `log` and `display alert/dialog` commands 
>> to debug.
>>
>> Use `the quoted form of`  for paths included  in your `do shell script` 
>> commands, otherwise any space in the path will break your command.
>>
>>
>>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/e0486b00-4e3a-41e9-8918-21d8240c538an%40googlegroups.com.


Re: I'm trying to script the Save Document command

2022-05-09 Thread jj
David,

This works on my setup:

use AppleScript version "2.7"
use scripting additions
--
on trace(aMessage)
set vDesktopFolder to POSIX path of (path to desktop folder as 
string)
set vTraceFile to vDesktopFolder & "trace.txt"
do shell script ("echo" & space & (the quoted form of aMessage) & 
">>" & (the quoted form of vTraceFile))
end trace
--
on documentDidSave(vDocument)
try
tell application "BBEdit"
my trace("run")
if vDocument's is FTP then
my trace("is FTP file")
set vFTPInfo to FTPInfo of vDocument
set vFile to vFTPInfo's file
set vHost to vFTPInfo's host
set vURL to vDocument's URL
my trace("is FTP file" & vHost & " " & vURL)
else
my trace("is NOT FTP file")
set vFile to vDocument's file
end if
set vPosixPath to POSIX path of (vFile as string)
my trace(vPosixPath)
my trace("")
end tell
on error aMessage
display alert aMessage
end try
end documentDidSave

HTH,

Jean

On Monday, May 9, 2022 at 5:02:17 PM UTC+2 kdb...@gmail.com wrote:

> Jean, your script works when run as an osascript, however I'm trying to 
> run the script as a BBEdit OnDocumentSave
>
> In that case I've fixed the syntax errors (as best I can, probably 
> incorrectly) and it only runs to the first 'do shell script', nothing after 
> that executes.
>
> $HOME/asecho is just "echo $* >> $HOME/Desktop/trace" for logging purposes.
>
>  David
>
>
> -- text document doc
>
> *on* documentDidSave(vDocument)
>
>*do shell script* "$HOME/asecho run"
>
>*if* vDocument *is* FTP *then*
>
>*do shell script* "$HOME/asecho is FTP file"
>
>*set* vFTPInfo *to* FTPInfo *of* vDocument
>
>*set* vFile *to* vFTPInfo's *file*
>
>*set* vHost *to* vFTPInfo's host
>
>-- set vURL to vFTPInfo's URL -- WARNING: triggers an error even 
> though the property exists and is visible in the results pane.
>
>*set* vURL *to* vDocument's *URL*
>
>*log* {vHost, vURL}
>
>*do shell script* "$HOME/asecho is FTP file" & vHost & " " & vURL
>
>*else*
>
>*do shell script* "echo is NOT FTP file"
>
>*if* vDocument's modified *then*
>
>*save* vDocument
>
>*end* *if*
>
>*set* vFile *to* vDocument's *file*
>
>*set* vPosixPath *to* POSIX path *of* (vFile *as* *string*)
>
>*do shell script* "$HOME/asecho is NOT FTP file" & *the* quoted 
> form *of* vPosixPath
>
>*end* *if*
>
>*log* vFile
>
>*set* vPosixPath *to* POSIX path *of* (vFile *as* *string*)
>
>*log* vPosixPath
>
>*do shell script* "$HOME/asecho run ls on " & *the* quoted form *of* 
> vPosixPath
>
>*do shell script* "ls -al" & space & *the* quoted form *of* vPosixPath
>
> *end* documentDidSave
>
> On Sunday, May 8, 2022 at 2:12:53 AM UTC-7 jj wrote:
>
>> Hi David,
>>
>> `try ... on error`  blocks  are very useful for debugging scripts.
>>
>> Before porting it to a Document Script, test your logic in the Script 
>> Editor where you can use the `log` and `display alert/dialog` commands 
>> to debug.
>>
>> Use `the quoted form of`  for paths included  in your `do shell script` 
>> commands, otherwise any space in the path will break your command.
>>
>>
>>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/f317a6c4-1f6b-42a0-bb67-c9e28943997fn%40googlegroups.com.


Re: Changing file NAMES with regex

2022-05-08 Thread jj
Hi Luca,

For renaming folder contents with regular expressions I would recommend the 
command line utility rename .

You can install it from Homebrew . 
In the terminal:

% brew install rename

And for help:

% man rename

HTH,

Jean Jourdain

On Sunday, May 8, 2022 at 6:05:10 PM UTC+2 jajls wrote:

> On 2022 May 8, at 04:20, LUCA LORENZO Bonatti  wrote:
> > 
> > Hello, is there any way to change, not the content of all files in a 
> folder, but the NAMES of all files in a folder, by using BBedit directly 
> and regex?
>
> This is a good application for a Shell Worksheet.
>
> Make two lists of the files. Apply your changes to one list. Paste the 
> changed list as a second column after the unchanged list. Prepend each line 
> with "mv ". Execute the block.
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/454ce171-be2d-4834-8e2a-78f6e5443fd3n%40googlegroups.com.


Re: I'm trying to script the Save Document command

2022-05-08 Thread jj
Hi David,

`try ... on error`  blocks  are very useful for debugging scripts.

Before porting it to a Document Script, test your logic in the Script 
Editor where you can use the `log` and `display alert/dialog` commands to 
debug.

Use `the quoted form of`  for paths included  in your `do shell script` 
commands, otherwise any space in the path will break your command.

This example snippet run from the Script Editor might help you.

tell application "BBEdit"
try
set vDocument to first text document
if vDocument's is FTP then
set vFTPInfo to (vDocument's FTP Info) as record
set vFile to vFTPInfo's file
set vHost to vFTPInfo's host

*-- set vURL to vFTPInfo's URL -- WARNING: triggers an 
error even though the property exists and is visible in the results pane.*  
  set vURL to vDocument's URL
log {vHost, vURL}
else
if vDocument's modified then
save vDocument
end if
set vFile to vDocument's file
end if
log vFile
set vPosixPath to POSIX path of (vFile as string)
log vPosixPath
do shell script "ls -al" & space & the quoted form of vPosixPath
on error aMessage
display alert aMessage
end try
end tell

HTH,

Jean Jourdain
On Saturday, May 7, 2022 at 11:00:19 PM UTC+2 kdb...@gmail.com wrote:

> What I've got will run to the first 'asecho ' command and not reach the 
> second.
>
> What I'd like to do is create a backup of any file being edited on my 
> local host even if it is a remote document. I'm quite sure that the fault 
> is in my script and not in BBEdit. I searched the archives here and found 
> nothing related to this problem.
>
> Anyone smarter about AppleScript (and almost everyone here would fit that 
> statement) care to point out the error of my ways?
>
> Thanks
>
>David
>
> -- text document doc
>
> *on* documentDidSave(doc)
>
>-- do shell script "~/asecho 1 running"
>
>*set* fromFTP *to* doc *is* FTP
>
>-- do shell script "~/asecho 2 post fromFTP"
>
>*if* fromFTP *then*
>
>-- set path to URL of doc
>
>*set* _ftpinfo *to* FTPInfo *of* doc
>
>*set* _path *to* path *of* _ftpinfo
>
>*set* _host *to* host *of* _ftpinfo
>
>*do shell script* "~/asecho 3 " & quoted form *of* _host
>
>*set* u *to* *URL* *of* doc
>
>*do shell script* "~/asecho 4 " & u
>
>*set* p *to* POSIX path *of* _path
>
>*do shell script* "~/UnixEnvironment/src/script/backuptext " & p
>
>*else*
>
>*set* f *to* *file* *of* doc
>
>*set* p *to* POSIX path *of* f
>
>*do shell script* "~/UnixEnvironment/src/script/backuptext " & p
>
>*end* *if*
>
> *end* documentDidSave
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b9fa8c36-d5c8-450d-88fb-ca0a7a76c657n%40googlegroups.com.


Re: how to find a repeated 200-character sentence in a large text file

2022-04-30 Thread jj
Here is a BBEdit Text Filter that will scan the frontmost document's 
selected text (or the whole document in no selection) for the longest 
repeated substring and log a regular expression in the 'Unix Script 
Output.log' that allows to find the repetition.

It works by replacing all non alphanumeric or underscore characters with a 
regular expression, thus comparing only the 'text' and ignoring anything 
else: whitespace, punctuation, math operators, etc.

As a consequence, it's more useful on textual content than on code.

It is derived from the go version of Ukkonen’s suffix tree construction 
 
and uses the gorun utility  that allows to 
execute a go source file as a shell script.

 1. To install Go 

  • from Go's installer: https://go.dev/doc/install

  • or with Homebrew at the terminal:

% brew install go

 2. To install gorun at the terminal:

% go install github.com/erning/gorun@latest 

 3. Copy the file find_longest_repeated_substring.go 
 to 
~/Library/Application 
Support/BBEdit/Text Filters

 4. Use the text filter from the *Text menu > Apply Text Filter > 
find_longest_repeated_substring*

 5. In case the 'Unix Script Output.log' doesn't show up, use the *Menu Go 
> Commands...* panel to find the 'Unix Script Output.log'

 6. In the 'Unix Script Output.log', select the logged regular expression 
and copy it to the find window with **. 
(Warning: Do not copy the trailing return character as it is not part 
of the regular expression)
 
 7. Activate you document and use the find window to search the occurrences 
of the repetition.
(Warning: if the repetition is very long, the generated regular 
expression might not compile. Just select a shorter portion from its 
beginning to some sensible length.)


HTH,

Jean Jourdain

On Tuesday, April 26, 2022 at 8:15:06 AM UTC+2 arne...@bluewin.ch wrote:

> The online demo you linked to, Sam, does exactly what I need! I've found a 
> few other doublets in the file that clearly should not be there. Thank you 
> all for your thoughts and inputs.
>
> On Monday, April 25, 2022 at 8:38:09 PM UTC+2 Sam Hathaway wrote:
>
>> This sounds like a case of the Longest repeated substring problem 
>> . 
>> Regular expressions are not the right tool for the job, unfortunately.
>>
>> There’s an online demo 
>>  that might do 
>> what you need.
>>
>> If you want to find all long repeated substrings, you can take an 
>> iterative approach: find the longest, remove the duplicates from the source 
>> text, and again find the longest.
>>
>> Hope this helps,
>> -sam
>>
>> On 25 Apr 2022, at 11:42, samar wrote:
>>
>> Hi all
>>
>> While copyediting a text for a scholarly book (500+ pages when printed), 
>> I noticed that the author wrote exactly the same long sentence (= an 
>> identical string of 337 characters) once on page 23 and once on page 326. 
>> No doubt this happened because the author copied and pasted some text from 
>> his notes, unaware that he had already copied and pasted the same text 
>> earlier. I thought it would be a good idea to find out whether this has 
>> happened to the author more than one time in his 1,000,000-character book, 
>> so that I can alert him (to give him a chance to omit the repetition).
>>
>> And so I turned to BBEdit. The text of the whole book is now in a txt 
>> file. When I search for the sentence that in the Word document is on page 
>> 23, I can find it in BBEdit both in paragraph 117 and in paragraph 7831. 
>> What regular expression can I use to find other such repetitions?
>>
>> I tried using the following string:
>>
>> (?s)(.{200}).*?\1
>>
>> This is what I understand it to mean (roughly):
>>
>> (?s): search across paragraphs
>> (.{200}).*?: search for, and capture, a string of 200 characters, 
>> optionally followed by any characters
>> \1: stop the search as soon as you reach a second instance of the 
>> captured string
>>
>> The string does what I need if I replace 200 with a shorter number, such 
>> as 10 (but in this case BBEdit finds a lot of unproblematic repetitions, of 
>> course). Given that the sentence I have in mind is more than 300 characters 
>> long I should even have been able to use 300 instead of just 200.
>>
>> Unfortunately, however, something seems to be amiss: BBEdit kept on 
>> searching and searching, without finding anything, and my notebook started 
>> fanning, and after about 20 minutes it became clear that nothing would 
>> happen, and that I cannot do anything else but to Force Quit BBEdit.
>>
>> So my question is, what's wrong with the above string? How else can I 
>> find a repeated 200-character sentence in a large text file?
>>
>> Thanks
>> Sam
>>
>> --
>> This is 

Re: Canonize emoji for an XML file

2022-04-16 Thread jj
Hi Community,

Let's celebrate BBEdit's 30 years of existence.        

壟  ‍ & ️  & 列 & 

Here is a Swift text filter that could help you prepare your inDesign 
birthday cards.

Based on Unicode's Emoji regular expression and Swift's ICU regular 
expression engine.

Save in ~/Library/Application Support/BBEdit/Text 
Filters/encode_emojis.swift

#!/usr/bin/env swift

// Based on: https://unicode.org/reports/tr51/#EBNF_and_Regex
//
// Changed \p{Emoji} to \p{Basic_Emoji} to avoid matching '#', numbers, 
etc.
// Tweaked to match uncovered cases revealed by test files.
//
// Tested against the contents of those test files:
// 
// https://unicode.org/emoji/charts/full-emoji-list.html
// 
https://raw.githubusercontent.com/unicode-org/icu/main/icu4c/source/data/unidata/emoji-sequences.txt
// 
https://raw.githubusercontent.com/unicode-org/icu/main/icu4c/source/data/unidata/emoji-zwj-sequences.txt
// https://unicode.org/Public/emoji/14.0/emoji-test.txt

// example: France , Snail , Family‍‍‍, man 
technologist with skin tone ‍
// decimal: France (ef)(\ef), Snail 
(ef)(\ef), 
Family(ef)(\ef), 
man technologist with skin tone (ef)(\ef)
// hex: France (ef)(\ef), Snail 
(ef)(\ef), 
Family(ef)(\ef), 
man technologist with skin tone (ef)(\ef)
import Foundation

let useDecimalEntities = true   // Change to false to encode as 
hexadecimal entities.
let openingWrapperTag = "(ef)"  // Set to "" if no wrapper tag 
needed.
let closingWrapperTag = "(\\ef)"// Set to "" if no wrapper tag 
needed.

let pattern = #"""
(?x-i)
(?:
\p{RI} \p{RI}
|
[
\x{00A9}
\x{00AE}
\x{203C}
\x{2049}
\x{2122}
\x{2139}
\x{2194}
\x{2195}
\x{2196}
\x{2197}
\x{2198}
\x{2199}
\x{21A9}
\x{21AA}
\x{2328}
\x{23CF}
\x{23ED}
\x{23EE}
\x{23EF}
\x{23F1}
\x{23F2}
\x{23F8}
\x{23F9}
\x{23FA}
\x{24C2}
\x{25AA}
\x{25AB}
\x{25B6}
\x{25C0}
\x{25FB}
\x{25FC}
\x{2702}
\x{2708}
\x{2709}
\x{270F}
\x{2712}
\x{2714}
\x{2716}
\x{271D}
\x{2721}
\x{2733}
\x{2734}
\x{2744}
\x{2747}
\x{2763}
\x{27A1}
\x{2934}
\x{2935}
\x{2B05}
\x{2B06}
\x{2B07}
\x{3030}
\x{303D}
\x{3297}
\x{3299}
\x{1F170}
\x{1F171}
\x{1F17E}
\x{1F17F}
\x{1F202}
\x{1F237}
]
\x{FE0F}
|
[
\x{0023}
\x{002A}
\x{0030}
\x{0031}
\x{0032}
\x{0033}
\x{0034}
\x{0035}
\x{0036}
\x{0037}
\x{0038}
\x{0039}
]
\x{FE0F} \x{20E3}

|
[
\p{Basic_Emoji}
\x{1F300}-\x{1F5FF}
\x{1F3CA}-\x{1F3CC}
\x{1F3F3}
\x{1F3F4}
\x{1F441}
\x{1F574}
\x{1F575}
\x{1F590}
\x{1F680}-\x{1F6FF}
\x{2600}-\x{26FF}
\x{261D}
\x{26F9}
\x{270C}
\x{270D}
\x{2764}
]
(?:
\p{EMod}
|
\x{FE0F} \x{20E3}?
|
[\x{E0020}-\x{E007E}]+ 
\x{E007F}
)?
(?:
\x{200D} 
[
\p{Basic_Emoji}
\x{1F32B}
\x{1F5E8}
\x{2620}
\x{2640}
\x{2642}
\x{2695}
\x{2696}
\x{26A7}
\x{2708}
\x{2744}
\x{2764}
]
(?:
\p{EMod}
|
\x{FE0F} \x{20E3}?
| 
[\x{E0020}-\x{E007E}]+ 
\x{E007F}
)?
)*
)
"""#

let regex = try NSRegularExpression(pattern: pattern, options: [])
var output: [String] = []

while var line = readLine() {
let range = NSRange(line.startIndex.. Sorted it.
>
> The only way for it to work with extra text on either end is to move all 
> the single entity codes (e.g. ) below the multiple entity ones 
> (e.g. ) in the canonize file.
>
> So it would look something like this...
>
> 
> 
> 
> 
> 
> 
>
> On Sunday, 10 April 2022 

Re: Formatting markdown tables in bbedit

2022-04-13 Thread jj
Hi Rainer,

Did you check https://github.com/darkriszty/MarkdownTablePrettify-VSCodeExt 
?

Install with:

% brew install node
% npm install -g markdown-table-prettify

Create a BBEdit Text Filter ~/Library/Application Support/BBEdit/Text 
Filters/markdown_table_prettify.sh:

#!/usr/bin/env node
const { CliPrettify } = require('markdown-table-prettify');
process.stdin.setEncoding('utf8');

process.stdin.on('data', function(text) {
  console.log(CliPrettify.prettify(text));
})

HTH,

Jean Jourdain

On Wednesday, April 13, 2022 at 1:48:44 PM UTC+2 Rainer Krug wrote:

> Hi
> How can I align the | in a markdown table in bbedit? 
> Any scripts / filters which help me working with tables in bbedit? 
> All the ones I found are REALLY old.
>
> Thanks,
>
> Rainer
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/eabb6781-ee12-47b6-83cc-3c408f339246n%40googlegroups.com.


Re: Running script in background - i.e. not blocking BBEdit

2022-03-24 Thread jj
Added a test to 00) Start Quarto Preview.sh so the previewer will not be 
launched more than once.

#!/bin/bash
pid=$(ps -A -mm | grep -v grep | grep 
"/Applications/quarto/bin/quarto.js preview ${BB_DOC_PATH}" | awk '{print 
$1}')
if [ -z "$pid" ]; then
nohup quarto preview "$BB_DOC_PATH" >& /dev/null & 
fi

Jean
On Thursday, March 24, 2022 at 4:48:57 PM UTC+1 jj wrote:

> Hi Rainer,
>
> Good to see your are getting somewhere.
>
> I tested this on my setup and it seems to do what you are after (no pid 
> file needed, no dialog):
>
> Start quarto preview:
>
> #!/bin/bash
> nohup quarto preview "$BB_DOC_PATH" >& /dev/null & 
>
> Stop quarto preview:
>
> #!/bin/bash
> pid=$(ps -A -mm | grep -v grep | grep 
> "/Applications/quarto/bin/quarto.js preview ${BB_DOC_PATH}" | awk '{print 
> $1}')
> kill -9 $pid
>
> HTH,
>
> Jean Jourdain
> On Thursday, March 24, 2022 at 11:51:17 AM UTC+1 Rainer Krug wrote:
>
>> OK - Please see the scripts here: 
>> https://github.com/rkrug/R-BBEdit/tree/main/R.bbpackage/Contents/Scripts/Quarto
>>
>> Start quart preview:
>> ```
>> #!/bin/bash
>> quarto preview "$BB_DOC_PATH" & 
>>
>> pid=$(ps -A -mm | grep -v grep | grep "quarto" | grep "preview 
>> ${BB_DOC_PATH}" | awk '{print $1}')
>>
>> pidfile=$(dirname "${BB_DOC_PATH}")/quarto.$BB_DOC_NAME.pid 
>>
>> echo pid: $pid 
>>
>> echo pidfile: "$pidfile"
>> ```
>>
>> and
>>
>> Stop quarto preview:
>> ```
>> #!/bin/bash
>>
>> pidfile="$(dirname "${BB_DOC_PATH}")/quarto.$BB_DOC_NAME.pid"
>>
>> pkill -F "$pidfile"
>>
>> rm -f "$pidfile"
>> ```
>>
>> They run nicely, only the initial backgrounding is not working and I have 
>> to Cancel the dialog box.
>>
>> Also, I do not see a dialog box in the Stop script.
>>
>> But I am happy with how it works (although automatic backgrounding ad 
>> closing ot=f the dialog box would be nice).
>>
>> Thanks,
>>
>> Rainer
>> On Thursday, March 24, 2022 at 10:30:44 AM UTC+1 Rainer Krug wrote:
>>
>>> Shellcheck is great - thanks. I am using it now!
>>>
>>> Concerning disown: I tried to add the `disown -a` command, but still had 
>>> to quit with the Cancel button.
>>>
>>> On Wednesday, March 23, 2022 at 7:10:23 PM UTC+1 Sam Hathaway wrote:
>>>
>>>> I don’t recall the details of this, but you may need to disown the 
>>>> quarto process so that bash doesn’t wait around for it to finish before 
>>>> exiting.
>>>>
>>>> P.S.: Shell scripting is a minefield and I suggest taking a look at 
>>>> shellcheck <https://www.shellcheck.net/> if you haven’t already.
>>>>
>>>> Cheers,
>>>> -sam
>>>>
>>>> On 23 Mar 2022, at 4:55, Rainer Krug wrote:
>>>>
>>>> Thanks Jean - these sound interesting options and definitely worth 
>>>> following. But thew (especially the launch agent approach) made me 
>>>> thinking: what if I background the quarto process?
>>>>
>>>> I have now written the following script to start the previewer:
>>>>
>>>> #!/bin/bash
>>>>
>>>> quarto preview $BB_DOC_PATH & 
>>>> pid=$! 
>>>> pidfile=$(dirname "${BB_DOC_PATH}")/quarto.$BB_DOC_NAME.pid 
>>>> echo pid: $pid 
>>>> echo pidfile: $pidfile 
>>>> echo $pid > $pidfile
>>>>
>>>> But it has two problems:
>>>>
>>>> 1) I still have to click "cancel", but the previewer continues running, 
>>>> which is nice. 
>>>> 2) the file .pid does not contain the pid of the quarto process
>>>>
>>>> The second one, I will solve with quarto, and the first one, I can live 
>>>> with. It would be nice, to have a message pops up which tells the user 
>>>> to 
>>>> close the dialog once the preview is visible?
>>>>
>>>> Thanks,
>>>>
>>>> Rainer
>>>>
>>>> On Tuesday, March 22, 2022 at 8:12:56 PM UTC+1 jj wrote:
>>>>
>>>> Hi Rainer,
>>>>
>>>> I suspect that BBEdit's Script menu will always be blocking because as 
>>>> far 
>>>> as I know it 

Re: Running script in background - i.e. not blocking BBEdit

2022-03-24 Thread jj
Hi Rainer,

Good to see your are getting somewhere.

I tested this on my setup and it seems to do what you are after (no pid 
file needed, no dialog):

Start quarto preview:

#!/bin/bash
nohup quarto preview "$BB_DOC_PATH" >& /dev/null & 

Stop quarto preview:

#!/bin/bash
pid=$(ps -A -mm | grep -v grep | grep 
"/Applications/quarto/bin/quarto.js preview ${BB_DOC_PATH}" | awk '{print 
$1}')
kill -9 $pid

HTH,

Jean Jourdain
On Thursday, March 24, 2022 at 11:51:17 AM UTC+1 Rainer Krug wrote:

> OK - Please see the scripts here: 
> https://github.com/rkrug/R-BBEdit/tree/main/R.bbpackage/Contents/Scripts/Quarto
>
> Start quart preview:
> ```
> #!/bin/bash
> quarto preview "$BB_DOC_PATH" & 
>
> pid=$(ps -A -mm | grep -v grep | grep "quarto" | grep "preview 
> ${BB_DOC_PATH}" | awk '{print $1}')
>
> pidfile=$(dirname "${BB_DOC_PATH}")/quarto.$BB_DOC_NAME.pid 
>
> echo pid: $pid 
>
> echo pidfile: "$pidfile"
> ```
>
> and
>
> Stop quarto preview:
> ```
> #!/bin/bash
>
> pidfile="$(dirname "${BB_DOC_PATH}")/quarto.$BB_DOC_NAME.pid"
>
> pkill -F "$pidfile"
>
> rm -f "$pidfile"
> ```
>
> They run nicely, only the initial backgrounding is not working and I have 
> to Cancel the dialog box.
>
> Also, I do not see a dialog box in the Stop script.
>
> But I am happy with how it works (although automatic backgrounding ad 
> closing ot=f the dialog box would be nice).
>
> Thanks,
>
> Rainer
> On Thursday, March 24, 2022 at 10:30:44 AM UTC+1 Rainer Krug wrote:
>
>> Shellcheck is great - thanks. I am using it now!
>>
>> Concerning disown: I tried to add the `disown -a` command, but still had 
>> to quit with the Cancel button.
>>
>> On Wednesday, March 23, 2022 at 7:10:23 PM UTC+1 Sam Hathaway wrote:
>>
>>> I don’t recall the details of this, but you may need to disown the 
>>> quarto process so that bash doesn’t wait around for it to finish before 
>>> exiting.
>>>
>>> P.S.: Shell scripting is a minefield and I suggest taking a look at 
>>> shellcheck <https://www.shellcheck.net/> if you haven’t already.
>>>
>>> Cheers,
>>> -sam
>>>
>>> On 23 Mar 2022, at 4:55, Rainer Krug wrote:
>>>
>>> Thanks Jean - these sound interesting options and definitely worth 
>>> following. But thew (especially the launch agent approach) made me 
>>> thinking: what if I background the quarto process?
>>>
>>> I have now written the following script to start the previewer:
>>>
>>> #!/bin/bash
>>>
>>> quarto preview $BB_DOC_PATH & 
>>> pid=$! 
>>> pidfile=$(dirname "${BB_DOC_PATH}")/quarto.$BB_DOC_NAME.pid 
>>> echo pid: $pid 
>>> echo pidfile: $pidfile 
>>> echo $pid > $pidfile
>>>
>>> But it has two problems:
>>>
>>> 1) I still have to click "cancel", but the previewer continues running, 
>>> which is nice. 
>>> 2) the file .pid does not contain the pid of the quarto process
>>>
>>> The second one, I will solve with quarto, and the first one, I can live 
>>> with. It would be nice, to have a message pops up which tells the user 
>>> to 
>>> close the dialog once the preview is visible?
>>>
>>> Thanks,
>>>
>>> Rainer
>>>
>>> On Tuesday, March 22, 2022 at 8:12:56 PM UTC+1 jj wrote:
>>>
>>> Hi Rainer,
>>>
>>> I suspect that BBEdit's Script menu will always be blocking because as 
>>> far 
>>> as I know it uses an XPCService. (This should be checked with Bare Bones 
>>> support though!)
>>>
>>> I think of 2 other options that you could try:
>>>
>>> *Option 1. Use the menubar Script Menu.* 
>>>
>>> • Activate the menubar Script Menu in Script Editor > Preferences > 
>>> General > Script Menu.
>>>
>>> • Create BBEdit's application scripts directory :
>>>
>>> % mkdir -p ~/Library/Scripts/Applications/BBEdit
>>>
>>> • Scripts placed in this directory should appear in the menubar Script 
>>> Menu when BBEdit is the frontmost application. Generally they act as if 
>>> they where run from the Script Editor.
>>>
>>> • Sometimes this allows you to do things you couldn't do from BBEdit's 
>>> Script menu (like restarting BBEdit for example).
>>>
>>> *Option 2. Create a launchAgent

Re: Running script in background - i.e. not blocking BBEdit

2022-03-23 Thread jj
You should quote all paths otherwise if they contain spaces the script 
won't do what you expect.

On Wednesday, March 23, 2022 at 9:55:10 AM UTC+1 Rainer Krug wrote:

> Thanks Jean - these sound interesting options and definitely worth 
> following. But thew (especially the launch agent approach) made me 
> thinking: what if I background the quarto process?
>
> I have now written the following script to start the previewer:
>
> #!/bin/bash
>
> quarto preview $BB_DOC_PATH &
> pid=$!
> pidfile=$(dirname "${BB_DOC_PATH}")/quarto.$BB_DOC_NAME.pid
> echo pid: $pid
> echo pidfile: $pidfile
> echo $pid > $pidfile
>
> But it has two problems:
>
> 1) I still have to click "cancel", but the previewer continues running, 
> which is nice.
> 2) the file .pid does not contain the pid of the quarto process
>
> The second one, I will solve with quarto, and the first one, I can live 
> with. It would be nice, to have a message pops up which tells the user to 
> close the dialog once the preview is visible?
>
> Thanks,
>
> Rainer
>
>
> On Tuesday, March 22, 2022 at 8:12:56 PM UTC+1 jj wrote:
>
>> Hi Rainer,
>>
>> I suspect that BBEdit's Script menu will always be blocking because as 
>> far as I know it uses an XPCService. (This should be checked with Bare 
>> Bones support though!)
>>
>> I think of 2 other options that you could try:
>>
>>
>> *Option 1. Use the menubar Script Menu.* 
>>   • Activate the menubar Script Menu in Script Editor > Preferences > 
>> General > Script Menu.
>>   
>>   • Create BBEdit's application scripts directory : 
>> 
>> % mkdir -p ~/Library/Scripts/Applications/BBEdit
>>
>>   • Scripts placed in this directory should appear in the menubar Script 
>> Menu when BBEdit is the frontmost application. Generally they act as if 
>> they where run from the Script Editor. 
>>   
>>   • Sometimes this allows you to do things you couldn't do from BBEdit's 
>> Script menu (like restarting BBEdit for example).
>> 
>> *Option 2. Create a launchAgent that watches the folder containing your 
>> quarto files and that executes a script whenever a file is saved and thus 
>> refreshes the preview. *(Replace '' with your user account in 
>> the below paths.)
>>  
>>   • Save this launchAgent in ~/Library/LaunchAgents/quarto_watcher.plist
>>   
>> 
>> > http://www.apple.com/DTDs/PropertyList-1.0.dtd>
>> 
>> 
>> Label
>> quarto_watcher
>> ProgramArguments
>> 
>> /Users//Library/Application 
>> Support/BBEdit/Scripts/quarto_previewer.sh
>> 
>> WatchPaths
>> 
>> /Users//Documents/Quarto
>> 
>> 
>> 
>>   
>>   • Save this script in ~/Library/Application 
>> Support/BBEdit/Scripts/quarto_previewer.sh and give it the execution 
>> permission.
>>   
>> #!/usr/bin/env sh
>> 
>> DOCPATH=$(osascript -e 'tell application "BBEdit" to (URL of 
>> first document) as string')
>> EXTENSION="${DOCPATH##*.}"
>> 
>> #echo $DOCPATH
>> #echo $EXTENSION
>> 
>> if [ $EXTENSION == "quarto" ]; then
>> /usr/bin/open -a quarto "$DOCPATH"
>> fi
>>  
>>   • Create the /Users//Documents/Quarto directory. (Or some 
>> other directory and change the launchAgent accordingly.)
>>   
>>   • Start the launchAgent in the terminal with:
>>   
>>  % launchctl load 
>> /Users//Library/LaunchAgents/quarto_watcher.plist
>>  
>>   • Now whenever a file with extension ".quarto" is saved in the 
>> ~/Documents/Quarto directory, the quarto_previewer.sh script should 
>> execute and open or reload this file in quarto.
>>   
>> HTH
>>
>> Jean Jourdain
>>
>> On Tuesday, March 22, 2022 at 2:52:19 PM UTC+1 Rainer Krug wrote:
>>
>>> I have an using quarto <https://quarto.org> to render technical 
>>> documents (it is very nice!) and writing them in BBEdit.
>>>
>>> Now I have a script which I want to start from BBEdit as I do with all 
>>> scripts, but this script runs continuously and updates the preview. I would 
>>> very much like to have this in BBEdit (in the Scripts Menu), but when I 
>>> start this script, it blocks BBEdi

Re: Running script in background - i.e. not blocking BBEdit

2022-03-22 Thread jj
Hi Rainer,

I suspect that BBEdit's Script menu will always be blocking because as far 
as I know it uses an XPCService. (This should be checked with Bare Bones 
support though!)

I think of 2 other options that you could try:


*Option 1. Use the menubar Script Menu.* 
  • Activate the menubar Script Menu in Script Editor > Preferences > 
General > Script Menu.
  
  • Create BBEdit's application scripts directory : 

% mkdir -p ~/Library/Scripts/Applications/BBEdit

  • Scripts placed in this directory should appear in the menubar Script 
Menu when BBEdit is the frontmost application. Generally they act as if 
they where run from the Script Editor. 
  
  • Sometimes this allows you to do things you couldn't do from BBEdit's 
Script menu (like restarting BBEdit for example).

*Option 2. Create a launchAgent that watches the folder containing your 
quarto files and that executes a script whenever a file is saved and thus 
refreshes the preview. *(Replace '' with your user account in the 
below paths.)
 
  • Save this launchAgent in ~/Library/LaunchAgents/quarto_watcher.plist
  

http://www.apple.com/DTDs/PropertyList-1.0.dtd>


Label
quarto_watcher
ProgramArguments

/Users//Library/Application 
Support/BBEdit/Scripts/quarto_previewer.sh

WatchPaths

/Users//Documents/Quarto



  
  • Save this script in ~/Library/Application 
Support/BBEdit/Scripts/quarto_previewer.sh and give it the execution 
permission.
  
#!/usr/bin/env sh

DOCPATH=$(osascript -e 'tell application "BBEdit" to (URL of first 
document) as string')
EXTENSION="${DOCPATH##*.}"

#echo $DOCPATH
#echo $EXTENSION

if [ $EXTENSION == "quarto" ]; then
/usr/bin/open -a quarto "$DOCPATH"
fi
 
  • Create the /Users//Documents/Quarto directory. (Or some other 
directory and change the launchAgent accordingly.)
  
  • Start the launchAgent in the terminal with:
  
 % launchctl load 
/Users//Library/LaunchAgents/quarto_watcher.plist
 
  • Now whenever a file with extension ".quarto" is saved in the 
~/Documents/Quarto directory, the quarto_previewer.sh script should execute 
and open or reload this file in quarto.
  
HTH

Jean Jourdain

On Tuesday, March 22, 2022 at 2:52:19 PM UTC+1 Rainer Krug wrote:

> I have an using quarto  to render technical documents 
> (it is very nice!) and writing them in BBEdit.
>
> Now I have a script which I want to start from BBEdit as I do with all 
> scripts, but this script runs continuously and updates the preview. I would 
> very much like to have this in BBEdit (in the Scripts Menu), but when I 
> start this script, it blocks BBEdit.
>
> Is there a way of having that dialog non-blocking? Or is there another way 
> of running that script (at the moment I am running it from a different 
> terminal)?
>
> Thanks.
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/9002fa2b-f8c5-4ddc-8177-2a6c3d26730en%40googlegroups.com.


Re: Sort lines sorting options Applescript difficulty

2022-03-21 Thread jj
Try this (Note the use of pipes to protect the name from conversion):

  *set* listSorted *to* *sort lines* *it* sorting options {|sort 
pattern|:bbed_sortPattern, 
sort subpattern:bbed_sortPattern} output options {replacing target:*true*}

Seems like AppleScript replaces the `sort pattern` by `match pattern` when 
the script is compiled and that in turn confuses BBEdit.

HTH

Jean Jourdain


On Monday, March 21, 2022 at 4:56:39 PM UTC+1 profj...@gmail.com wrote:

> I have a Sort Lines… that works perfectly when I use BBEdit/Text/Sort 
> Lines… menu with a text file, but when I attempt to write an AppleScript 
> with the same Regex and replacement string I get the dreaded "BBEdit got an 
> error: macOS error code: -1701 sort lines". 
>
> I am writing something wrong in the Applescript and I could use some help. 
>
> *set* bbed_sortPattern *to* "^(\\w+)(-.)? (.')?(\\w+){1}(-\\w+)?"
>
> *set* bbed_sortSubPattern *to* "\\3\\4\\1\\2"
>
> *tell* *application* "BBEdit"
>
> *tell* *text* *of* *front* *text window*
>
> *set* listSorted *to* *sort lines* *it* sorting options {match 
> pattern:bbed_sortPattern, sort subpattern:bbed_sortPattern} output options 
> {replacing target:*true*}
>
> *end* *tell*
>
> *end* *tell*
>
> The script debugger dictionary says that it should be "sorting options 
> {sort pattern:" but Script Debugger stubbornly translates it as "sorting 
> options {match pattern";  the problem does not seem to come from this.
>
> I would like to see an Applescript with the correct wording! Thank you
>
>
> *[image: BBEditSortLines.jpg]*
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b41ec246-d35c-419f-aaf7-24173658a2ebn%40googlegroups.com.


Re: Converting decimal value of some numbers using Grep

2022-03-17 Thread jj
Howard,

If it applies to you case you could use a literal find/replace.
Uncheck the Grep checkbox in the Find/Replace window.

Find: .1
Replace: .33

Find: .2
Replace: .67

Just my .2 cents.

Best Regards,

Jean

On Thursday, March 17, 2022 at 12:21:53 AM UTC+1 Howard wrote:

> Patrick,
>
> Thanks for your help,
>
> Howard
>
> On Wednesday, 16 March 2022 at 5:24:21 pm UTC-4 Patrick Woolsey wrote:
>
>> On 3/16/22 at 3:10 PM, leadwi...@gmail.com (Howard) wrote:
>>
>> >In *Find: ^(\d+?)\.1 *what is the purpose of the question mark? 
>> >I know what *\d+* does.
>> >
>>
>> It makes matching "non-greedy", so the pattern won't try to 
>> extend beyond the first possible match.
>>
>>
>> [For details, please see "Non-Greedy Quantifiers" in Chapter 8 
>> (page 201) of the ubiquitous PDF manual. :-) ]
>>
>>
>> Regards,
>>
>> Patrick Woolsey
>> ==
>> Bare Bones Software, Inc. 
>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/3ee2132b-2671-4fbc-8919-d12e3251bba2n%40googlegroups.com.


Re: Method for finding the Nth occurrence of a string in a data file?

2022-03-15 Thread jj
Hi Devon,

Good to know it worked.
I just updated the Gist to try to fix a "macOS error code: -2706"  that 
could happen when running the script on big files.

Jean

On Tuesday, March 15, 2022 at 2:53:42 AM UTC+1 devo...@gmail.com wrote:

> a … Super Cool !   Thanks Jean !!
>
> works like a charm.  
>
>
>
> On Mar 14, 2022, at 5:32 PM, jj  wrote:
>
> Hi Devon,
>
> This AppleScript script 
> <https://gist.github.com/mixio/0cc693aa710e42ebae2a6094141b2971> should 
> help you to select the inner contents of any Nth .
>
> HTH,
>
> Jean Jourdain
>
>
> On Monday, March 14, 2022 at 8:53:48 PM UTC+1 devo...@gmail.com wrote:
>
>> Thanks Sam.  That grep pattern is fantastic!  
>>
>> We can have a small worksheet with the grep pattern. We’ll search for 
>> N-1, then in the worksheet select  and cmd+E, toggle to the data 
>> file window and cmd+G to find the next one.   
>>
>> If this becomes a needed routine we’ll create something with XPath.  
>>
>> Thanks! 
>>
>> dEVoN 
>>
>>
>>
>> On Mar 14, 2022, at 11:48, Sam Birch  wrote:
>>
>> Devon,
>>
>> XPath is probably the right move here, to be honest.
>>
>> That said, BBEdit can select everything up to (and including) the 200th 
>> occurrence of  with this regular expression:
>>
>> (?s)(.*?){200}
>>
>> Hope this helps.
>> -sam
>>
>> On 14 Mar 2022, at 13:51, Devon Hubbard wrote:
>>
>> We have the need to search through a ton of transactional data for things 
>> like the 200th occurrence of  to dig into that specific node. 
>> One 
>> of our team members is thinking of writing an XPath thing, but then we 
>> thought there might be a way to do with this in BBEdit. Not through any 
>> grep magic I've been able to get working so far. Maybe a cool extension 
>> out there that does this?
>>
>> thanks
>>
>>
>
>
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/bd7ed3cd-c991-429a-8614-d0172ac7eb08n%40googlegroups.com.


Re: Method for finding the Nth occurrence of a string in a data file?

2022-03-14 Thread jj
Hi Devon,

This AppleScript script 
 should 
help you to select the inner contents of any Nth .

HTH,

Jean Jourdain


On Monday, March 14, 2022 at 8:53:48 PM UTC+1 devo...@gmail.com wrote:

> Thanks Sam.  That grep pattern is fantastic!  
>
> We can have a small worksheet with the grep pattern. We’ll search for N-1, 
> then in the worksheet select  and cmd+E, toggle to the data file 
> window and cmd+G to find the next one.   
>
> If this becomes a needed routine we’ll create something with XPath.  
>
> Thanks! 
>
> dEVoN 
>
>
>
> On Mar 14, 2022, at 11:48, Sam Birch  wrote:
>
> Devon,
>
> XPath is probably the right move here, to be honest.
>
> That said, BBEdit can select everything up to (and including) the 200th 
> occurrence of  with this regular expression:
>
> (?s)(.*?){200}
>
> Hope this helps.
> -sam
>
> On 14 Mar 2022, at 13:51, Devon Hubbard wrote:
>
> We have the need to search through a ton of transactional data for things 
> like the 200th occurrence of  to dig into that specific node. One 
> of our team members is thinking of writing an XPath thing, but then we 
> thought there might be a way to do with this in BBEdit. Not through any 
> grep magic I've been able to get working so far. Maybe a cool extension 
> out there that does this?
>
> thanks
>
> -- 
>
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/23ddce74-7d65-49c4-836b-2001e2c5a94dn%40googlegroups.com.


Re: Tag conversion to a new format

2022-02-25 Thread jj
Hi Lux,

Here are two perl text filters.
Copy them to ~/Library/Application Support/BBEdit/Text Filters.
You can test them from menu Text > Apply Text Filter.

This one (tags_and_categories_to_list_pl.pl) is for your initial case (CSV 
-> hyphenated item per line) :

#!/usr/bin/env perl
use v5.14;
use strict;
use warnings;

while(my $line = <>)  {   
if (my ($field, $items) = $line =~ 
/^(tags|categories):\s*(.+)\s*$/gi) {
my $yaml_items = $items =~ s/\s*,\s*/\n- /gr; 
print "${field}:\n- ${yaml_items}\n";
} else {
print $line;   
}
}

=for test

I got a huge number of posts from an old static blog. Inside the header 
there's a "tags" line, made this way:

tags: Steve Jobs, Steve Throughton-Smith, T'Bone, Better to Be a Pirate 
Than Join the Navy, Ben & Jerry, NBA75

The actual number of tags in the line can be any. Comma act as a 
delimiter and, after that, any character can be used inside a tag, spaces 
included.

categories: Education

=cut

This other one (tags_and_categories_to_array_pl.pl) if for your second case 
(hyphenated item per line -> array):

#!/usr/bin/env perl
use v5.14;
use strict;
use warnings;

$/ = undef;

sub replace {
my $match = shift;
my @splitted = split /[[:blank:]]*\n[[:blank:]]*-[[:blank:]]/, 
$match;
my $field = shift @splitted;
map { s/^\s+|\s+$//g; } @splitted;
my $joined = join ", ", @splitted;
return "${field} [${joined}]\n";
}

print <> =~ 
s/^((?:tags|categories)[[:blank:]]*:[[:blank:]]*\n[[:blank:]]*(?:-[^\n]+\n)+)/replace
 
$1/grimse; 

=for test

title: "Più uguali degli altri"
date: 2022-02-24T01:43:23+01:00
draft: false
toc: false
comments: false
categories:
- Education
tags:
- MacBook Pro
- iPad mini
- Apple Pencil
- Bowdoin

=cut

HTH,

Jean Jourdain

On Friday, February 25, 2022 at 5:05:02 AM UTC+1 lux wrote:

> On Wednesday, February 23, 2022 at 6:30:31 PM UTC+1 wagsw...@gmail.com 
> wrote:
>
>> When you state header, this implies that there is more data than what you 
>> present. Could you provide a small selection of what the data file actually 
>> looks like? ;)
>>
>
> This is an example of a complete header:
>
> *((( header begins )))*
> ---
> title: "Più uguali degli altri"
> date: 2022-02-24T01:43:23+01:00
> draft: false
> toc: false
> comments: false
> categories:
> - Education
> tags:
> - MacBook Pro
> - iPad mini
> - Apple Pencil
> - Bowdoin
> ---
> *((( header ends )))*
>
> Right under the header, the body text begins.
>
> The count for categories and tags items can be zero, one, or more than one.
>
> My main issue is to refrain from mistakenly capturing sentences inside the 
> body text that share the same structure (i.e., lists beginning with dashes).
>
> Working on the problem, I could somewhat simplify the problem. I'd like 
> now to convert the former header in the following one:
>
> *((( header begins )))*
> ---
> title: "Più uguali degli altri"
> date: 2022-02-24T01:43:23+01:00
> draft: false
> toc: false
> comments: false
> categories: [Education]
> tags: [MacBook Pro, iPad mini, Apple Pencil, Bowdoin]
> ---
> *((( header ends )))*
>
> Again, thanks very much for the attention. :-)
>
> lux
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/f076b205-ab47-4542-a08a-e7ee79637913n%40googlegroups.com.


Re: CLM pattern question

2022-02-16 Thread jj
Hi Tim,

As far as I understand it, BBLMKeywordPatterns are matched against 
individual words composed of characters in the  or .

As a consequence the ^ anchor in a BBLMKeywordPatterns is sort of 
equivalent to \b and will always match at the start of a word. 
Start of line for an individual word doesn't make much sense.

(*Please Rich or Patrick, correct me if I am wrong*)

You could kind of achieve what you are looking for by including the '%' and 
':' characters in the  and matching 
in the BBLMKeywordPatterns with:

keyword: 

and 

%keywordtwo:

Watch out though that those sequences might be present in some other 
unwanted positions in the text, for example at the end of a line before a 
bullet list.

Another solution could be to use the  which is matched 
against the text of the document and thus can detect ^ anchors at the start 
of lines.

...
Language Features

...
Keyword Pattern

...

...

HTH

Jean Jourdain

On Tuesday, February 15, 2022 at 4:44:59 PM UTC+1 Tim Gray wrote:

> I have a question about defining keyword pattern matching in codeless 
> language modules using BBLMKeywordPatterns. Can a pattern be defined to 
> match only words at the beginning of a line? I’m not having much success 
> using the standard ^ regular expression.
>
> To give context, I’d like to define two types of run kinds. Both are 
> always at the beginning of a line and end with a colon; one also leads off 
> with a %. Example:
>
> Keyword: do not match anything after the colon
> %keywordtwo: don’t match this either
>
> Thanks
> Tim
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/89ea7013-1814-44f6-abde-3ef03aaeefa8n%40googlegroups.com.


Re: Using GREP, need help to extract names and numbers from column

2022-02-10 Thread jj
Hi Howard,

You could try this to get tab separated fields:

Find:

(\S+\.)(\S+)\h*\((\d+-\d+)\)\h*(?:and\h*(\S+\.)(\S+)\h*\((\d+-\d+)\))?

Replace:

\1 \2\t\3\t\4 \5\t\6

HTH,

Jean Jourdain

On Wednesday, February 9, 2022 at 10:42:41 PM UTC+1 Howard wrote:

>
> *I have a column with data like this, where each name contains just the 
> first initial, a period, and the last name:*
> D.Green (59-72) and B.Valentine (12-19)
> D.Green (69-75)
> D.Green (55-58)
> J.Torborg (13-25) and D.Green (46-78)
> J.Torborg (72-90)
> B.Harrelson (74-80) and M.Cubbage (3-4)
> D.Johnson (20-22) and B.Harrelson (71-49)
> D.Johnson (87-75)
>
> Some rows have one name and a pair of numbers in parentheses separated by 
> a dash, and some rows have two names, each followed by a pair of numbers in 
> parentheses separated by a dash.
>
> In each row, I can extract the first name (both the initial and the last 
> name) and put a space between them using `^([A-Z]\.)([A-z,a-z]+)` and `\1 
> \2`
> with all results appearing in their own column.
>
> *What I need help to do is this:*
> 1. Using GREP, I need to extract the numbers in parentheses *after the 
> first names* and put them in their own column without parentheses.
> 59-72
> 69-75
> 55-58 etc.
>
> 2. In those rows with a second name, using GREP I need to extract the *second 
> names* and put them in their own column, so they look like this:
> B. Valentine
> D. Green
> M. Cubbage
> B. Harrelson 
>
> I also need to extract the *numbers in parentheses after the second names*, 
> but believe that I can figure out how to do that from the answer to #1 
> above.
>
> Thanks,
> Howard
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/32f97811-72ef-4b0f-844b-6489620eb03an%40googlegroups.com.


Re: grep for searching

2022-02-06 Thread jj
Find:

(?<=/)(?:d([^\s/]|\\\x20)*?\.zip)\b

Or commented:

(?x)(?# Use multi-line and comments)
(?<=/)  (?# Look behind a slash not including it in the match)
(   (?# Start of capture \1)
d   (?# Literal 'd')
(?: (?# Start non capturing parentheses)
[^\s/]  (?# NOT [whitespace or slash] character)
|   (?# or)
\\\x20  (?# Backslash escaped space)
)   (?# End non capturing parentheses)
*?  (?# Match 0 or more greedily)
\.  (?# Literal '.')
zip (?# Literal 'zip')
)   (?# End of capture \1)
\b  (?# Word boundary)

Should match:
ftp://ftp.scene.org/pub/demos/artists/0xf/drunkchessboard.zip
ftp://ftp.scene.org/pub/demos/artists/0xf/d.zip 
"ftp://ftp.scene.org/pub/demos/artists/0xf/d0xf+==.zip;
/path/to/unicode/files/d你好.zip
/path/to/document\ with_escaped_space.zip

Should NOT match:
ftp://ftp.scene.org/pub/demos/artists/0xf/d.zipped  -- Wrong extension.
/path/to/document with_unescaped_space.zip  -- Has unescaped 
space.
document.zip-- Missing /.

HTH

Jean Jourdain

On Sunday, February 6, 2022 at 10:39:09 AM UTC+1 Kaveh wrote:

> not clear for me what you want to do. can you put a sample of input lines 
> and output needed?
>
> On Sat, 5 Feb 2022 at 23:09, ejonesss  wrote:
>
>> i was wondering what is the grep i would need to find all occurrences of 
>> a word that begins with
>>
>> ftp://ftp.scene.org/pub/demos/artists/0xf/drunkchessboard.zip
>>
>>
>> for example i want to find all lines who has file of “.zip" and begins 
>> with “d"
>>
>> drunkchessboard.zip
>>
>> i got the finding .zip part ok that is how i extracted all the zips from 
>> a massive 60 line list
>>
>> now the tricky part is detecting the “/d” part
>>
>>
>>
>> -- 
>> This is the BBEdit Talk public discussion group. If you have a feature 
>> request or need technical support, please email "sup...@barebones.com" 
>> rather than posting here. Follow @bbedit on Twitter: <
>> https://twitter.com/bbedit>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "BBEdit Talk" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to bbedit+un...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/bbedit/9029aa96-cd05-4724-8126-4ea34ef23e99n%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> Kaveh Bazargan PhD
> Director
> River Valley Technologies  ● Twitter 
>  ● LinkedIn 
>  ● ORCID 
> 
> *Accelerating the Communication of Research*
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/141970c2-2cdc-4fa5-bf98-e91602e29291n%40googlegroups.com.


Re: Need GREP to reorder a list of names

2022-02-03 Thread jj
Hi Howard,

BBEdit has a nice option to help rearrange columns in CSV files 
:

BBEdit > menu Edit > Columns > Rearrange Columns…

Once the columns are in the desired order, if required you can remove the 
commas with a find/replace.

HTH

Jean Jourdain

On Friday, February 4, 2022 at 2:50:37 AM UTC+1 ThePorgie wrote:

> Find:
> ([^,\r]+), (.+)
> Replace:
> \2 \1
>
> ([^,\r]+)//finds everything but a comma or return
> , //finds the comma space
> (.+)//finds everything after the comma space
> //Parentheses capture the two groups
>
> \2 //Replace with found group 2 follow by a space
> \1//Replace with found group 1
> On Thursday, February 3, 2022 at 8:12:54 PM UTC-5 Howard wrote:
>
>> *Here is a sample of the data I have in a column:*
>> Guerrero Jr., Vladimir
>> Perez, Salvador
>> Machado, Manny
>> Bichette, Bo
>> Goldschmidt, Paul
>> Devers, Rafael
>> Judge, Aaron
>> Freeman, Freddie
>>
>> *Desired output*
>> For each name, I need all the characters after each comma moved to the 
>> start of the name followed by a space and the comma removed so that the 
>> names appear this way:
>> Vladimir Guerrero Jr.
>> Salvador Perez
>> Manny Machado 
>> Bo Bichette
>> Paul Goldschmidt
>> Rafael Devers 
>> Aaron Judge
>> Freddie Freeman 
>>
>> Thanks in advance for any help you can provide,
>> Howard
>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/5008573f-a53d-41dc-94de-f913bc521595n%40googlegroups.com.


Re: Project specific keyboard shortcuts?

2022-02-03 Thread jj
Hi Rainer,

This script looks for the existence of an optional *.rainer.conf* file in 
the parent directories.
If the file exists it reads it, parses it and acts in consequence.

Same logic could be applied based on project window names, document file 
types, document file languages, etc.

HTH

Jean Jourdain

--

on readRainerConf(aFile)
set vRainerConf to ".rainer.conf"
tell application "Finder"
set vContainer to container of file aFile
repeat while true
try
if exists file vRainerConf of vContainer then
set vConfFile to (file vRainerConf of vContainer) 
as alias
set vConfig to read vConfFile
return vConfig
end if
set vContainer to container of vContainer
on error
exit repeat
end try
end repeat
return missing value
end tell
end readRainerConf

tell application "BBEdit"
set vDocument to first document of first window
if not vDocument's on disk then
return
end if
-- Check for a configuration file.
set vConfig to my readRainerConf(vDocument's file)
-- Parse the the config and act appropriately.
if vConfig contains "optionA" then
set vCommand to "do A command"
else if vConfig contains "optionB" then
set vCommand to "do B command"
else
set vCommand to "do default command"
end if
display dialog vCommand
end tell

On Thursday, February 3, 2022 at 3:48:38 PM UTC+1 Rainer Krug wrote:

> Hi
>
> Is it possible, to run project / folder specific keyboard shortcuts?
>
> In different projects I do different things regularly and would like to 
> put these in the same keyboard shortcut.
>
> Thanks,
>
> Rainer
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/adda5f27-59ec-4297-bff8-e91dc9eac85en%40googlegroups.com.


Re: Convert to CDATA/XML?

2022-01-26 Thread jj
Hi @lbutlr,

One possible approach is with node.js and the node module html-entities 
.

Create a BBEdit Text Filter with this snippet into ~/Library/Application 
Support/BBEdit/Text\ Filters/html_entities_to_xml_entities.js

#!/usr/bin/env node
const html_entities = require('html-entities');
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(text) {
  let decoded = html_entities.decode(text);
  let reencoded = html_entities.encode(decoded, {mode: 
'nonAsciiPrintable', level: 'xml'});
  process.stdout.write(reencoded);
})

In case node.js is not already installed on your system:

% brew install node

In case the node html-entities  
module in not already installed on your system:

% npm install -g html-entities

HTH

Jean Jourdain

On Wednesday, January 26, 2022 at 2:42:25 AM UTC+1 kre...@kreme.com wrote:

> Is there a way to easily convert a block of HTML text with entities in, 
> like  into CDATA XML-compatible codes like ?
>
> The only thing I see in the manual for CDATA is
>
> > • Escape : This option controls whether BBEdit should convert 
>  sections to normal text.
>
> -- 
> If you have any young friends who aspire to become writers, the
> second-greatest favor you can do them is to present them with
> copies of The Elements of Style. The first-greatest, of course,
> is to shoot them now, while they're happy. -Dorothy Parker
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2840c053-470f-479f-b974-d24d027cd74fn%40googlegroups.com.


Re: Activer un Language Module?

2022-01-25 Thread jj
Christian,

BBEdit reports the errors it meets while loading a Code Language Module in 
this log file:

~/Library/Containers/com.barebones.bbedit/Data/Library/Logs/BBEdit/Language\ 
Module\ Errors.log

and reports this error when loading your module:


2022-01-25 12:22:01.693: Startup
The following problem(s) were encountered while loading the language module 
at ~/Library/Application Support/BBEdit/Language 
Modules/ArianeCodelessLanguageModule.plist:
The Skip Pattern was invalid (reference to non-existent subpattern 
(error 112115) at offset 7 in pattern).
The reported problems will prevent the language module from loading.


I sent you offlist a working example.

For more info here is a link to BBEdit's Code Language Modules 
documentation :

https://www.barebones.com/support/develop/clm.html

HTH

Jean Jourdain
 

On Sunday, January 23, 2022 at 10:25:23 AM UTC+1 jj wrote:

> Bonjour Christian,
>
>  1. Vérifiez que votre module est au format correct. Dans le terminal:
>
>  % *plutil** ~**/Library/Application\ Support/BBEdit/Language\ 
> Modules/Ariane.plist* 
> *~/Library/Application Support/BBEdit/Language 
> Modules/Ariane.plist: OK*
>
>  2. BBEdit associe un fichier à un language en utilisant l'extension 
> définie dans la .plist:
>
> BBLMSuffixMap
> 
> 
> BBLMLanguageSuffix
> .ariane
> 
> 
>
>  3. Si le module est valide il devrait s'afficher dans la liste des 
> Preferences > Languages > Installed Languages.
> Si ce n'est pas le cas, le plus simple serait de joindre votre module 
> à un message que l'on puisse y jeter un œil.
>
> HTH,
>
> Jean Jourdain
> On Sunday, January 23, 2022 at 1:01:05 AM UTC+1 boite...@yahoo.fr wrote:
>
>> Bonsoir, 22/1/22
>> J'ai créé un "Language Module" (Codeless Language Module, ou CLM) nommé 
>> "Ariane" (code à 4 lettres "AYAY", chaîne "Ariane") par  copie et 
>> modification du module "IgorPro" (code "Igor", chaîne "Igor Pro") trouvé 
>> sur le web.
>> Les deux sont dans le bon dossier (/Library/Application\ Support/BBEdit/)
>>
>> Après avoir quitté et relancé BBEdit, "Igor Pro" s'affiche bien dans le 
>> menu de langues de BBEdit (ma version est 14.0.4), mais "Ariane" ne 
>> s'affiche pas. 
>>
>> Je n'ai modifié que des valeurs, en vérifiant que j'avais bien les mêmes 
>> clés.
>> Auriez-vous une idée de ce qui peut bloquer l'activation  d'un CLM?
>> Merci d'avance! Xan
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/4e825c9f-9e39-4d31-9fbe-0a478bf3d5a1n%40googlegroups.com.


Re: Activer un Language Module?

2022-01-23 Thread jj
Bonjour Christian,

 1. Vérifiez que votre module est au format correct. Dans le terminal:

 % *plutil** ~**/Library/Application\ Support/BBEdit/Language\ 
Modules/Ariane.plist* 
*~/Library/Application Support/BBEdit/Language 
Modules/Ariane.plist: OK*

 2. BBEdit associe un fichier à un language en utilisant l'extension 
définie dans la .plist:

BBLMSuffixMap


BBLMLanguageSuffix
.ariane



 3. Si le module est valide il devrait s'afficher dans la liste des 
Preferences > Languages > Installed Languages.
Si ce n'est pas le cas, le plus simple serait de joindre votre module à 
un message que l'on puisse y jeter un œil.

HTH,

Jean Jourdain
On Sunday, January 23, 2022 at 1:01:05 AM UTC+1 boite...@yahoo.fr wrote:

> Bonsoir, 22/1/22
> J'ai créé un "Language Module" (Codeless Language Module, ou CLM) nommé 
> "Ariane" (code à 4 lettres "AYAY", chaîne "Ariane") par  copie et 
> modification du module "IgorPro" (code "Igor", chaîne "Igor Pro") trouvé 
> sur le web.
> Les deux sont dans le bon dossier (/Library/Application\ Support/BBEdit/)
>
> Après avoir quitté et relancé BBEdit, "Igor Pro" s'affiche bien dans le 
> menu de langues de BBEdit (ma version est 14.0.4), mais "Ariane" ne 
> s'affiche pas. 
>
> Je n'ai modifié que des valeurs, en vérifiant que j'avais bien les mêmes 
> clés.
> Auriez-vous une idée de ce qui peut bloquer l'activation  d'un CLM?
> Merci d'avance! Xan
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2621a954-47e6-467f-8ba2-ad068e0d47d1n%40googlegroups.com.


Re: Custom Completion List?

2022-01-19 Thread jj
Hi Shawn,

If you are not yet able to autocomplete within the Shawn language, try 
adding this to your Shawn.plist

BBLMSpellableRunKinds

*

BBLMCompletableRunKinds

*


Jean

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/95e505d7-f83e-48e8-8398-9d86a03ba382n%40googlegroups.com.


Re: Custom Completion List?

2022-01-18 Thread jj
Shawn,

If you have hundreds/thousands of possible completions, you could simply 
use the System Text Replacement feature.

https://support.apple.com/en-bh/guide/mac-help/mchl2a7bd795/mac

You can export/import a hand crafted Text Substitutions.plist into 'System 
Preferences > Keyboard > Text' by drag & drop.

Here is a sample Text Substitutions.plist 
 with ± 250 
entries if you want to test the concept.

WARNING: Backup your existing Substitutions if you have some by dragging 
them to the finder before adding new entries.

HTH

Jean Jourdain

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/e4aa4749-5d80-4b1c-bb25-9ceb30e8050fn%40googlegroups.com.


Re: Custom Completion List?

2022-01-18 Thread jj
Shawn,

1. It seems that the problem is in the "Identifier and Keyword Character 
Class".
By specifying *\S* (Anything that is not whitespace) the starting square 
bracket is included in the completion prefix.
Obviously there is no "[ra..." entry in "BBLMPredefinedNameList".

Try with this:

Identifier and Keyword Character Class
*\p{Xwd}*
 
\p{Xwd} is a unicode character class that matches letters, digits and 
underscores.
The BBEdit keyword parser should now use "ra..." as a completion prefix.


2. BTW, a *completely different but probably easier approach* whould be to 
use *Clippings*. (BBEdit manual p. 315).

Create a directory for the Shawn language clippings:

% mkdir -p ~/Library/Application\ Support/BBEdit/Clippings/Shawn.shawn/

Inside that directory create a file named "ys".
and inside that file paste this content: "We all live in a yellow 
submarine."

% echo "We all live in a yellow submarine." > ~/Library/Application\ 
Support/BBEdit/Clippings/Shawn.shawn/ys

The "ys" entry should now appear in the completion menu after you type a 
"y" in a Shawn language document .

This approach *doesn't need* you to restart BBEdit.
Just keep adding clipping files to the Shawn.shawn/ directory.
The name of the file should be the abbreviation, the contents of the file 
should be the replacement string.

HTH

Jean Jourdain

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/111ce72f-ca27-4c4e-96c3-a15041ec3d13n%40googlegroups.com.


Re: Custom Completion List?

2022-01-18 Thread jj
Hi Shawn,

Here is a Shawn.plist that follows Rich's recommendations and seems to work 
regarding completions.

There was a misconfiguration in the .plist I originally posted. Sorry for 
that.
Apparently the key defining 'Identifier and Keyword Characters' prevented 
BBEdit from displaying completions.

The key:

Identifier and Keyword *Characters*
\S

is now replaced by: 

Identifier and Keyword *Character Class*
\S

I also note that you changed the Number Pattern. 
Be aware that <[\d+]> is a regular expression that will only match a single 
decimal or a '+' sign in between angle brackets (i.e., <0>, ..., <9>, <+>) :

Number Pattern


If what you want to match is someting in the form <123,456> then this 
pattern is more appropriate:

Number Pattern


HTH,

Jean Jourdain

--
Shawn.plist

```

http://www.apple.com/DTDs/PropertyList-1.0.dtd;>


BBEditDocumentType
CodelessLanguageModule
BBLMColorsSyntax

BBLMIsCaseSensitive

BBLMSupportsTextCompletion 
 
BBLMPredefinedNameList 
 
John Lennon 
Paul McCartney 
George Harrison 
Ringo Starr 
Beyoncé With Accent
 
BBLMLanguageCode
SHAW
BBLMLanguageDisplayName
Shawn
BBLMScansFunctions

BBLMFunctionScannerDoesFoldsToo

BBLMSuffixMap


BBLMLanguageSuffix
.shawn


Language Features

Close Block Comments

Close Statement Blocks

End-of-line Ends Strings 1

End-of-line Ends Strings 2

Escape Char in Strings 1
\
Escape Char in Strings 2
\
Identifier and Keyword Character Class
\S
Open Block Comments

Open Line Comments

Open Statement Blocks

Close Strings 1

Close Strings 2

Open Strings 1

Open Strings 2

Number Pattern

String Pattern

Comment Pattern





-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/18007b06-9d89-47a4-a4c4-793e5485a4ffn%40googlegroups.com.


Re: Style all occurrences of text

2022-01-08 Thread jj
Hi Raleigh,

This Applescript snippet 
 is a bit 
of a hack that takes advantage of Unicode combining codepoints to create a 
p͇s͇e͇u͇d͇o͇ ͇u͇n͇d͇e͇r͇l͇i͇n͇e͇ ͇s͇t͇y͇l͇e͇.

It works by inserting the combining underline codepoint (U+0347 COMBINING 
EQUALS SIGN BELOW) after each character of the selection, skipping 
linefeeds.

Applying the script on a selection will u͇n͇d͇e͇r͇l͇i͇n͇e͇ it.

Applying the script on a selection that already contains some 
u͇n͇d͇e͇r͇l͇i͇n͇e͇ will remove all the selection's underlines.

Applying the script when all of the document is selected (after a 
"Select All") will removes all the document underlines.

You can find / replace / mark the u͇n͇d͇e͇r͇l͇i͇n͇e͇d͇ ͇s͇e͇c͇t͇i͇o͇n͇s͇ 
with this regular expression:

((?:(?:.\x{0347})+\n?)+)

HTH

Jean Jourdain
On Friday, January 7, 2022 at 7:03:48 PM UTC+1 Patrick Woolsey wrote:

> On 1/7/22 at 11:28 AM, rale...@gmail.com (Raleigh Rinehart) wrote:
>
> >I was wondering if there is a way to set a specific style for 
> >particular text matches, regardless of what language is 
> >selected for the document.
> >
> >[...]
> >
> >What I am looking for is[...] to be able to select some text 
> >and "mark" it with a highlight or different style permanently 
> >(until explicitly cleared/"un-marked" by the user).
>
>
> I regret there is not; the closest it's feasible to come at 
> present would be to create a codeless language module, within 
> which you can define any desired custom elements.
>
> This is however a "fixed", string/pattern-driven solution rather 
> than an interactive one of the sort you describe.
>
> (NB: We have previously gotten other requests for this general 
> capability and it is on our radar; further than that, I cannot 
> speculate. :-)
>
>
> Regards,
>
> Patrick Woolsey
> ==
> Bare Bones Software, Inc. 
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/ad6f5f70-3534-4e6f-8f8f-42c13101e37fn%40googlegroups.com.


Applescript & Javascript for automation resources

2022-01-07 Thread jj
Hi, Media Mouth,

Starting a new thread in response to your question:
https://groups.google.com/g/bbedit/c/ZfG2rHr89rA/m/4cvnFM4eBgAJ

Some links to Applescript and Javascript for automation online 
documentation:

https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/index.html#//apple_ref/doc/uid/TP40016239
https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html
https://developer.apple.com/library/archive/technotes/tn2002/tn2106.html
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_intro/SAppsIntro.html#//apple_ref/doc/uid/TP40002164.
https://github.com/JXA-Cookbook/JXA-Cookbook/wiki
https://developer.apple.com/library/archive/releasenotes/InterapplicationCommunication/RN-JavaScriptForAutomation/Articles/Introduction.html
https://developer.apple.com/library/archive/releasenotes/AppleScript/RN-AppleScript/Introduction/Introduction.html
https://forum.latenightsw.com
https://macscripter.net/index.php
https://applescriptlibrary.wordpress.com
https://www.macinchem.org/applescript/applescript_index.php

HTH

Jean Jourdain

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/17016df2-5ceb-44f7-9b5d-39a283c1deb2n%40googlegroups.com.


Re: [ OFFLIST ] Re: Need to increment a counter for chapter count

2022-01-07 Thread jj
Hi David,

Here is another option with Javascript for automation this time.

Copy this snippet into the Script Editor, choose Javascript as the language 
in the languages menu under the window titlebar and run it on BBEdit's 
front window.

function run() {
var chapterNumber = 1;
let vDocument = 
Application('BBEdit').textWindows()[0].documents()[0]
vDocument.contents = 
vDocument.contents().replace(/#start#\s+\d*\s*/ig, () => "#start#\n" + 
(chapterNumber++) + " ")
}

HTH

Jean Jourdain

On Thursday, January 6, 2022 at 10:53:27 PM UTC+1 wagsw...@gmail.com wrote:

> Chris S, I tried your script, but nothing appears to happen. No changes.
>
> I made mods to your code. I was not as clear as I should have been on 
> explanation desired results.
>
> What I am working on is 50 chapters which are of the format:
> #start#
> 1 xx
> 2 xxx
> ….
> n xxx
> #endofGen#
> What I am trying to do is after I find a start, then the next line should 
> be a 1 and text. I want to change that 1 to whatever the current chapter 
> number it should be. All the chapters ar in order. Example for 20 chapter, 
> the output would look like:
>
> #start#
> 20 xx
> 2 xxx
> ….
> n xxx
> #endofGen#
>
> That line starting with a 1 and following a start is the only change 
> desired.
>
> I am on MacOS 10.15.7 and the very latest BBEdit 14.0.5. The Perl I  am 
> executing is 5.28.2.
>
> I get no errors when I run the the filter.
>
> Here is what I have as a script after my minor changes:
>
> my $cntr = 0;
> my $ChgSw = 0;
> while (<>) {
> if ( /^#Start#/i ) {
> $cntr++;
> $ChgSw = 1;
>  }
> if ( $ChgSw ) {
> if ( /^1\h/ ) {
> s!^1!$cntr!;
>  }
> $ChgSw = 0;
>  }
> print;
> }
>
> Sorry for delay in getting back to you. I truly appreciate the insight 
> from what I see in the scripts and the way they work with BBEdit.
>
> Wags ;)
> WagsWorld
> Hebrews 4:15
> Ph(primary) : 408-914-1341 <(408)%20914-1341>
> Ph(secondary): 408-761-7391 <(408)%20761-7391>
> On Jan 6, 2022, 04:56 -0800, Christopher Stone , 
> wrote:
>
> Hey Chris,
>
> This fails on my Mojave system with the stock `awk`.
>
> --
>
> #Start#Start#Start#
> 2 In the beginning, God created the heavens and
> Xxccx
> #Start#EndOfGen#Start#
> #Start#Start#Start#
> 6 Thus the heavens and the earth were finished,
> Xxxx
> #Start#EndOfGen#Start#
> #Start#Start#Start#
> 10 Now the serpent was more crafty than any other beast of the field that 
> the LORD God had made.
> Xxx
> #Start#EndOfGen#Start#
>
> --
>
> It works if I use the current version of `gawk`.
>
> It looks like David has an older version of macOS as well.
>
> --
> Take Care,
> Chris
>
> --
>
> On Jan 05, 2022, at 21:52, Christopher Waterman  
> wrote:
>
> Sorry David, 
>
> I did make a mistake but the output you're getting still confuses me.
> All my chapter numbers were off by one, but that was it. 
>
> Anyway here is the fixed script. ( I think 爛)
>
> I provided an example of my input and output, also a screenshot.
> Be sure to copy the script exactly.
>
> #!/usr/bin/env awk -f
>
> BEGIN {
> RS = "#Start#"
> ORS = ""
> FS = "\n"
> OFS = "\n"
> }
>
> { 
> sub( /[0-9]+/, NR-1 , $2 )
> }
>
> NR != 1 {
> print "#Start#" $0
> }
>
> Input:
> #Start#
> 1 In the beginning, God created the heavens and
> Xxccx
> #EndOfGen#
> #Start#
> 1 Thus the heavens and the earth were finished,
> Xxxx
> #EndOfGen#
> #Start#
> 1 Now the serpent was more crafty than any other beast of the field that 
> the LORD God had made.
> Xxx
> #EndOfGen#
>
>
> --
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "sup...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+un...@googlegroups.com.
>
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/18DA528B-9E6C-4B84-BAD4-1462489AB0ED%40gmail.com
>  
> 
> .
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Re: Multi-file search error "Operation not permitted by the OS.

2022-01-05 Thread jj
Hi Ed,

This tech note about App Sandboxing might help you:

https://www.barebones.com/support/bbedit/AppSandboxing.html

HTH

Jean Jourdain

On Wednesday, January 5, 2022 at 1:55:25 AM UTC+1 buckyjunior wrote:

> The first thing I might ask is if you have the App Store version or 
> directly from BareBones. There may be a difference in what the App Store 
> version can access.
>
> If you’re using the App Store version, or just to get quick, qualified 
> help, you can always write to sup...@barebones.com.
>
> Sorry I can’t help. I’m just an amateur.
>
> On Jan 4, 2022, at 12:44 PM, Ed Stockly  wrote:
>
> I'm running BBEdit 14 on Big Sur and when I try to do a multi-file search, 
> I get an error saying:   "Operation not permitted by the OS."
>
> I looked in System Preferences and BBEdit has full disk access. It's also 
> listed under Files and folders but that doesn't seem to do anything.
>
> Any Suggestions?
>
> ES
>
> --> BBEdit 14.0.4
> --> MacOS 11.6.2
>
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "sup...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/f1fec5e3-93cc-4dc6-8602-1bef6f76a672n%40googlegroups.com
>  
> 
> .
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/777856e4-e976-4ac0-9f79-c89c1dcfb33dn%40googlegroups.com.


Re: First Use - quick way to get a list of numbers for output

2021-12-30 Thread jj
Hi Lorenz,

Execute this snippet of AppleScript with Script Editor:

tell application "BBEdit"
set vContents to ""
repeat with i from 1 to 15
set vNumber to i as string
if i < 10 then
set vNumber to "0" & vNumber
end if
set vContents to vContents & "word" & vNumber & linefeed
end repeat
make new document with properties {contents:vContents}
end tell

HTH

Jean Jourdain
On Thursday, December 30, 2021 at 9:20:45 PM UTC+1 T Burger wrote:

> Not what you asked for,but I would use a spreadsheet for that.
>
> Put your words in the first column.
> In the second column have it fill down with a series of numbers.
> Now select both columns and copy.
> Paste in BBEdit and delete the tab characters.
>
> Ted
>
> Sent from the Burger's iPad
>
> On Dec 30, 2021, at 2:53 PM, Lorenz Groth  wrote:
>
> Hello!
>
> I used to use programs like maple (math software) and latex for text 
> editing. But I am new at programming other stuff. 
> What I want to learn is how to produce a simple list of numbered word such 
> as
> word01
> word02
> word03
> word04
> 
> automatically to not have to do this by typing.
> Can anyone tell me how to do that with BBEdit? I guess there will be some 
> loop stuff, for, while, if, do and something like this. But I have NO 
> experiences with that in BBEdit. All I got is this
>  [image: BBEditWorksheet.png] and
> [image: BBEditVersuchCompiler.png]
> I hope my problem is understandable. I write in German English...
>
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "sup...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/727fc16f-a0a2-4c0c-813f-3ff40381968fn%40googlegroups.com
>  
> 
> .
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/2b1397b3-3e95-43a4-96d5-7c7fcad9178cn%40googlegroups.com.


Re: Custom Text Colors for Defined Elements?

2021-12-23 Thread jj
Hi Shawn,

Here is a minimal Codeless Language Module 
 that should do what 
you want.

Name it "Shawn.plist".
Copy it in ~/Library/Application Support/BBEdit/Language Modules.
Restart BBEdit.

The Language Module should now be listed in the Preferences > Languages > 
Installed Languages.
If a file as the extension .shawn it will be recognized by BBEdit as a 
Shawn Language file, otherwise use the Language menu at the bottom of the 
document window.

To configure your favorite colors:

  • go to Preferences > Text Colors
  
  • create a new Color Scheme
  
  • setup the 'Comments', 'Strings' and 'Numbers' colors to your liking
  
  • go to Preferences > Languages
  
  • add the Shawn Language in the Language-specific settings list (bottom 
[+] button)
  
  • double-click the Shawn language you just added 
  
  • in the 'Display' pane select your just create Color scheme
  
  • Restart BBEdit
  
Now on, if you select a 'Shawn' language document it should be highlighted 
as you want.

HTH

Jean Jourdain

--
Shawn.plist

```


http://www.apple.com/DTDs/PropertyList-1.0.dtd;>


BBEditDocumentType
CodelessLanguageModule
BBLMColorsSyntax

BBLMIsCaseSensitive

BBLMKeywordList


BBLMLanguageCode
SHAW
BBLMLanguageDisplayName
Shawn
BBLMScansFunctions

BBLMFunctionScannerDoesFoldsToo

BBLMSuffixMap


BBLMLanguageSuffix
.shawn


Language Features

Close Block Comments

Close Statement Blocks

End-of-line Ends Strings 1

End-of-line Ends Strings 2

Escape Char in Strings 1
\
Escape Char in Strings 2
\
Identifier and Keyword Characters
\S
Open Block Comments

Open Line Comments

Open Statement Blocks

Close Strings 1

Close Strings 2

Open Strings 1

Open Strings 2

Number Pattern

String Pattern

Comment Pattern





```

On Thursday, December 23, 2021 at 7:57:58 PM UTC+1 Harvey Pikelberger wrote:

> Something you might consider, esp. if you want to keep things simple, is 
> custom tags in your HTML -- simple HTML + CSS.  There are ways of working 
> with it that are pretty tight and minimal.
>
> For instance
>
> "Hello everyone," John exclaimed. He looked at the 
> crowed.  "Let's begin this conversation with a fun story."
>
>  and  are not actual recognized HTML tags, so they get 
> interpreted as inline objects (like a )
> In major broswers they are responsive to CSS, for instance
>
> blu {color:blue;}
> dlg {color:#aaa;}
>
>
> The shorter your custom tag names, the cleaner your document.  Obviously 
> be careful not to accidentally use existing short HTML tags (e.g.   
> ) (actually, you can even use them, so long as you use CSS to define 
> out their default properties)
>
> This approach can allow you to get pretty sophisticated quickly while 
> keeping your document clean.
>
>
>
> Also, you might consider Markdown . 
>  There's a whole world of developers out there whose goal is to simply HTML 
> (the idea behind "Markdown" is to make "Markup" more abbreviated)
>
>
> On Dec 23, 2021, at 9:30 AM, Shawn Liebling  wrote:
>
> Hi people! I'm not super technical, so simple explanations would be great.
>
> So, I am working on a huge project where it would really help to have 
> certain elements color coded.  Here is an example (numbers are not 
> accurate):
>
> [John Smith] <3435,3549>"Hello everyone," John exclaimed. He looked at the 
> crowd. <3685,3798>"Let's begin this conversation with a fun story."
>
> What I want is for the attribution ([John Smith]) to be a blue color, the 
> number codes (<3435,3549>) to be very light grey so  they don't distract 
> me, the dialogue (text inside quote marks) to be brown, and the 
> non-dialogue text to be black.
>
> I searched this group a bit and found a couple conversations that as 
> asking a similar question, but there aren't any answers that work for what 
> I'm wanting to do. 
>
> So how might I go about this? I'm ok with adding a little code to make it 
> work, but ideally I would be able to have something set up where anything 
> within certain confines are color coded, like anything inside <> is light 
> grey, etc.
>
> I am currently getting around this by having my file be in HTML and using 
> the elements already defined, but it looks messy and I don't know what all 
> the syntax means. Here is an example screenshot of my 

Re: How to have \D ignore newline character?

2021-12-12 Thread jj
Hi Tim,

Try using a negative character class like [^\d\n\r] instead of \D.

HTH

Jean Jourdain

On Sunday, December 12, 2021 at 6:21:10 PM UTC+1 Tim A wrote:

> Simple task to strip out all non-digits in telephone numbers. \D works but 
> also matches newline at the end of every line. Is there a way to 'turn off' 
> the newline match?
>
> I can do a 
> Find: [-() ]   which will match the usual possible non-digit characters 
> which I can replace with nothing, but figure I am missing something simple 
> and worth knowing here.
>
> Thanks.
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/80befb98-1764-4d0f-b2e6-bc9bd1fabb43n%40googlegroups.com.


Re: Custom sequencing

2021-12-08 Thread jj
Execute this snippet of AppleScript with Script Editor:

tell application "BBEdit"
set vContents to ""
repeat with i from 1 to 250
set vNumber to i as string
if i < 10 then
set vNumber to "00" & vNumber
else if i < 100 then
set vNumber to "0" & vNumber
end if
set vContents to vContents & "\n\n\n"
end repeat
make new document with properties {contents:vContents}
end tell

HTH

Jean Jourdain
On Wednesday, December 8, 2021 at 4:24:18 AM UTC+1 Tom Robinson wrote:

> Right, that’s an issue.
>
> You could search for a single digit and replace with 00, then do 
> the same for double digits — or start at 1000 and remove the leading digit 
> — but easier to use a spreadsheet :]
>
>
> On 2021-12-08, at 15:18, Tim A  wrote:
>
> Still are faced with adding 0 or 00 to numbers less than 100 of the 
> generated line numbers, no? Or is there a buried preference for asserting 
> the number of leading zeros?
> Numbers.app allows this with the Cells/Data Format/Numeral System   Base 
> and Places 
>
>
> On Monday, December 6, 2021 at 5:11:48 PM UTC-8 Tom Robinson wrote:
>
>> No need for a spreadsheet, BBEdit has a line numbering command :]
>> 1. create document with 250 blank lines
>> 2. Text > Add/Remove Line Numbers.  Don’t add spaces or justify — we just 
>> want a plain number
>> 3. Do a Grep search for an entire line:
>> ^.*$
>>
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/9ae01ca7-9ed4-48e2-9cda-152027d8f973n%40googlegroups.com.


Re: Grep searching - how to ignore the first word of the sentence

2021-12-08 Thread jj
It all depends on the definition of a sentence and if you want to match the 
exact word or words "starting with".

Considering sentences as strings of characters separated by dots and exact 
word matching then:

Find:

([^\.\s]\s+)(Potato)\b

Replace:

\1\l\2

Sample:

Potato is good and I have a Potato and the Potato were born well this year. 
Some more text. Potato is good but Potato chips are good too.

With some indent:

Potato, singular but not Potatoes nor Potatory.

HTH

Jean Jourdain 

On Wednesday, December 8, 2021 at 5:27:42 AM UTC+1 listmei...@gmail.com 
wrote:

> On Dec 07, 2021, at 17:50, Pavel  wrote:
>
>
> Would anyone please know what must contain grep so that the first words of 
> the sentence do not appear in the search results? 
>
> --
>
> Hey Pavel,
>
> Tom's idea is simpler, but you can do this:
>
> Find:
>
> (?
> Replace:
>
> \L\1
>
>
> --
> Best Regards,
> Chris
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/3d4d0185-5cc3-4eb3-9fe3-f96ebd64e828n%40googlegroups.com.


Re: TextEdit acts like default text editor at times

2021-11-29 Thread jj
Hi Brian,

The duti  command line utility might 
help you.

You can install it with Homebrew:

% brew install duti

Read the man page:

% man duti

To get default applications information for .txt files:

% duti -x txt
BBEdit.app
/Applications/BBEdit.app
com.barebones.bbedit
 
To set BBEdit as the default application for .txt files:
 
% duti -s com.barebones.bbedit txt all

HTH,

Jean Jourdain

On Monday, November 29, 2021 at 4:59:50 PM UTC+1 Ulrich Kapp wrote:

> Hi Brian
>
> Did you try to „First Aid“ from the Disk Utility App on your startup 
> volume?
> This helped for me some years ago.
>
> You may also try to assign .text and .txt files to another application 
> like Atom  (Don’t forget to use „Change All…“!) and then 
> set it back to BBEdit again.
>
> Otherwise you may want to delete the TextEdit App, because it’s mostly 
> useless anyway…
> I could tell you how to do this. But without any warranty!
>
> Cheers!
> Ulrich
>
>
>
> Am 29.11.2021 um 16:22 schrieb Brian Gollands :
>
> rMBP 2012 / OS10.15 / BBEdit 14
>
> Anybody else have a problem with TextEdit being invoked when 
> double-clicking on a .txt file that is set to be opened with BBEdit? This 
> has been an annoyance over several versions of the OS.
>
> All .txt files are set to BB and their file icons reflect this. But 
> double-clicking them or choosing Open opens them in TextEdit. Choosing my 
> contextual command Open in BBEdit works OK. The latest straw was in using 
> Hook's command to Make a New Note in BBEdit. It, too, makes the file in 
> TextEdit.
>
> Have tried making a zip of TE and deleting the original (so I didn't lose 
> it completely), but can't seem to do this even in Terminal due to some 
> magical protection conveyed by its living in /System/Applications/ I guess.
>
> I have a lot of apps installed, but don't recall any other setting I've 
> changed that would cause this. Is there a default text editor config I'm 
> missing?
>
> Thanks for any help,
> Brian
>
>
>
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "sup...@barebones.com" 
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/6efc1994-b969-46b8-94b2-dffe73aa4909n%40googlegroups.com
>  
> 
> .
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/68ca7ab1-59cb-457a-8aee-3360c3d92b1bn%40googlegroups.com.


Re: Padding a missing line

2021-11-26 Thread jj
Hi Tim,

Find:

(? On Friday, November 26, 2021 at 6:14:55 AM UTC-8 Kaveh wrote:
>
>> Is "Joint" or "Single" the only words that can be on line after phone 
>> number?
>>
>
> There are a few more...here's the complete set:
> Joint
> Joint Lifetime
> Joint Non-resident
> Joint Senior
> Senior Single
> Single
> Single Lifetime
> Single Non-resident
>  
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b39cd7fc-fa62-4db1-9f6b-9ec42a123da9n%40googlegroups.com.


Re: Typewriter mode possible?

2021-11-24 Thread jj
Correct. *At the moment*, that's all I can think of to try to mimic 
typewriter mode.

On Wednesday, November 24, 2021 at 12:15:23 PM UTC+1 Rainer Krug wrote:

> Interesting. But I have to use the shortcut ⌃↩︎ to execute the typewriter 
> scrolling - so it is not automatic. Correct?
>
> On Wednesday, November 24, 2021 at 10:21:19 AM UTC+1 jj wrote:
>
>> Hi Rainer,
>>
>> You can *"kind of"* simulate typewriter mode with this applescript.
>> It only has effect once your text overflows the window because it takes 
>> advantage of the fact that, when jumping around, BBEdit repositions the 
>> current line at ± 25% of the window height. 
>> Note that there is a bit of blinking that I don't know how to avoid.
>> Save it to the Scripts folder and give it a keyboard shortcut like 
>> .
>>
>> --
>> # ~/Application 
>> Support/BBEdit/Scripts/0-[⌃↩︎]-[typewriter_return].applescript
>> try
>> tell application "BBEdit"
>> tell first window
>> if class of its selection is not insertion point then
>> return
>> end if
>> tell its selection
>> set vCharacterOffset to (its characterOffset) as 
>> integer
>> set its contents to linefeed
>> end tell
>> tell its first document
>> select insertion point before its first text
>> select insertion point after its character 
>> vCharacterOffset
>> end tell
>> end tell
>> end tell
>> on error aMessage 
>> display alert aMessage
>> end try
>> --
>>
>> HTH,
>>
>> Jean Jourdain
>>
>>
>> On Monday, November 22, 2021 at 11:02:52 AM UTC+1 Rainer Krug wrote:
>>
>>> Hi
>>>
>>> is it possible to have typewriter mode (i.e. the line I am typing in 
>>> stays in the middle off the screen) in BBEdit? I haven't found anything 
>>> along these lines. Did I miss it?
>>>
>>> Thanks,
>>>
>>> Rainer
>>>  
>>>
>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/feab4d61-a9ac-417a-9a35-d99792898af3n%40googlegroups.com.


Re: Typewriter mode possible?

2021-11-24 Thread jj
BTW, you should also set BBEdit Preferences > Editing > 'Extra vertical 
space ("overscroll") in text view' to 'Full Window'.

Jean

On Wednesday, November 24, 2021 at 10:21:19 AM UTC+1 jj wrote:

> Hi Rainer,
>
> You can *"kind of"* simulate typewriter mode with this applescript.
> It only has effect once your text overflows the window because it takes 
> advantage of the fact that, when jumping around, BBEdit repositions the 
> current line at ± 25% of the window height. 
> Note that there is a bit of blinking that I don't know how to avoid.
> Save it to the Scripts folder and give it a keyboard shortcut like 
> .
>
> --
> # ~/Application 
> Support/BBEdit/Scripts/0-[⌃↩︎]-[typewriter_return].applescript
> try
> tell application "BBEdit"
> tell first window
> if class of its selection is not insertion point then
> return
> end if
> tell its selection
> set vCharacterOffset to (its characterOffset) as 
> integer
> set its contents to linefeed
> end tell
> tell its first document
> select insertion point before its first text
> select insertion point after its character 
> vCharacterOffset
> end tell
> end tell
> end tell
> on error aMessage 
> display alert aMessage
> end try
> --
>
> HTH,
>
> Jean Jourdain
>
>
> On Monday, November 22, 2021 at 11:02:52 AM UTC+1 Rainer Krug wrote:
>
>> Hi
>>
>> is it possible to have typewriter mode (i.e. the line I am typing in 
>> stays in the middle off the screen) in BBEdit? I haven't found anything 
>> along these lines. Did I miss it?
>>
>> Thanks,
>>
>> Rainer
>>  
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/32d025ee-0170-4442-879b-2f6458cab854n%40googlegroups.com.


Re: Typewriter mode possible?

2021-11-24 Thread jj
Hi Rainer,

You can *"kind of"* simulate typewriter mode with this applescript.
It only has effect once your text overflows the window because it takes 
advantage of the fact that, when jumping around, BBEdit repositions the 
current line at ± 25% of the window height. 
Note that there is a bit of blinking that I don't know how to avoid.
Save it to the Scripts folder and give it a keyboard shortcut like 
.

--
# ~/Application 
Support/BBEdit/Scripts/0-[⌃↩︎]-[typewriter_return].applescript
try
tell application "BBEdit"
tell first window
if class of its selection is not insertion point then
return
end if
tell its selection
set vCharacterOffset to (its characterOffset) as integer
set its contents to linefeed
end tell
tell its first document
select insertion point before its first text
select insertion point after its character 
vCharacterOffset
end tell
end tell
end tell
on error aMessage 
display alert aMessage
end try
--

HTH,

Jean Jourdain


On Monday, November 22, 2021 at 11:02:52 AM UTC+1 Rainer Krug wrote:

> Hi
>
> is it possible to have typewriter mode (i.e. the line I am typing in stays 
> in the middle off the screen) in BBEdit? I haven't found anything along 
> these lines. Did I miss it?
>
> Thanks,
>
> Rainer
>  
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/ebe605cb-29fd-4222-971a-d6163ac1fa88n%40googlegroups.com.


Re: Emmet for css

2021-11-11 Thread jj

Hi Johan,

I don't know if at the moment BBEdit expands Emmet CSS abbreviations.
Meanwhile this applescript does:

emmet_expand_css_abbreviation.applescript 


Copy it to your ~/Application Support/BBEdit/Scripts/ directory.

Configure the paths to the *node* executable and to the global 
*nodes_modules* directory if you have a custom installation.

HTH,

Jean Jourdain

On Wednesday, November 10, 2021 at 2:33:39 PM UTC+1 Johan Sölve wrote:

> I have Emmet working for expanding html abbreviations, but is the BBEdit 
> implementation supposed to work also for css abbreviations?
>
> I've looked in the language settings for css and scss but see nothing that 
> seems relevant for Emmet. 
>
> https://docs.emmet.io/css-abbreviations/
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/73cc6b6f-8637-42b5-8a19-1b14acdbe30en%40googlegroups.com.


Re: The incredible shrinking selections.

2021-11-08 Thread jj


Hi Christopher & Christopher,

Seems there is an off by one somewhere.

You should mail the issue to supp...@barebones.com.

Regards,

Jean Jourdain

*tell* *application* "BBEdit"

*set* vDocument *to* *make* new *document* with properties {contents:"def 
do_something( doohickeis )\ndoohickeis.each do | whatsit 
|\nwhatsit.this!\nwhatsit.that!\nprint whatsit\nend\nend\n"}

*set* vNeedle *to* "whatsit"

*set* vFoundObjects *to* {}

*select* *insertion point* *before* *text* *of* vDocument

*repeat*

*set* vResult *to* *find* vNeedle searching in vDocument options {starting 
at top:*false*, wrap around:*false*, search mode:*literal*, returning 
results:*false*} *with* selecting match

*if* (vResult's found) *then*

*set* *end* *of* vFoundObjects *to* vResult's found object

*log* {(vResult's found object) *as* *string*, vResult's found text, *its* 
selection *as* *string*}

*else*

*exit* *repeat*

*end* *if*

*end* *repeat*

*select* vFoundObjects

selection

*end* *tell*

*-- Replies*

*tell* *application* "BBEdit"

*make* new *document* with properties {contents:"def do_something( 
doohickeis )\ndoohickeis.each do | whatsit 
|\nwhatsit.this!\nwhatsit.that!\nprint whatsit\nend\nend\n"}

--> *text document* 1

*select* *insertion point* *before* *every* *text* *of* *text document* 1

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*true*, found object:*characters* 53 *thru* 59 *of* *text 
document* 1, found text:"whatsit"}

*get* *characters* 53 *thru* 59 *of* *text document* 1

--> "whatsit"

*get* selection

--> "whatsit"

(*whatsit, whatsit, whatsit*)

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*true*, found object:*characters* 63 *thru* 69 *of* *text 
document* 1, found text:"whatsit"}

*get* *characters* 63 *thru* 69 *of* *text document* 1

--> "whatsit"

*get* selection

--> "whatsit"

(*whatsit, whatsit, whatsit*)

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*true*, found object:*characters* 77 *thru* 83 *of* *text 
document* 1, found text:"whatsit"}

*get* *characters* 77 *thru* 83 *of* *text document* 1

--> "whatsit"

*get* selection

--> "whatsit"

(*whatsit, whatsit, whatsit*)

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*true*, found object:*characters* 97 *thru* 103 *of* *text 
document* 1, found text:"whatsit"}

*get* *characters* 97 *thru* 103 *of* *text document* 1

--> "whatsit"

*get* selection

--> "whatsit"

(*whatsit, whatsit, whatsit*)

*find* "whatsit" searching in *text document* 1 options {starting at top:
*false*, wrap around:*false*, search mode:*literal*, returning results:
*false*} *with* selecting match

--> {found:*false*}

*select* {*characters* 53 *thru* 59 *of* *text document* 1, *characters* 63 
*thru* 69 *of* *text document* 1, *characters* 77 *thru* 83 *of* *text 
document* 1, *characters* 97 *thru* 103 *of* *text document* 1}

*get* selection

--> {*characters* 53 *thru* 58 *of* *text document* 1, *characters* 63 
*thru* 68 *of* *text document* 1, *characters* 77 *thru* 82 *of* *text 
document* 1, *characters* 97 *thru* 102 *of* *text document* 1}

*end tell*

Result:

{*characters* 53 *thru* 58 *of* *text document* 1 *of* *application* 
"BBEdit", *characters* 63 *thru* 68 *of* *text document* 1 *of* 
*application* "BBEdit", *characters* 77 *thru* 82 *of* *text document* 1 
*of* *application* "BBEdit", *characters* 97 *thru* 102 *of* *text document* 
1 *of* *application* "BBEdit"}


On Monday, November 8, 2021 at 10:40:41 AM UTC+1 listmei...@gmail.com wrote:

> On Nov 08, 2021, at 00:14, Christopher Waterman  
> wrote:
>
> If I select every occurrence of "whatsit" through which ever means.
>
> ...
>
>
> Then run this AppleScript.
>
> AppleScript:
> tell window 1 of application "BBEdit"
> set stuff to get selection
> end tell
>
> *It returns a list like this.*
>
> --
>
> Hey Christopher,
>
> I don't see how you're getting a list of selected items.
>
> If I use find with show matches it doesn't work.
>
> If I use LiveSearch it doesn't work.
>
> So how exactly are you doing your selection?
>
>
> --
> Best Regards,
> Chris
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from 

Re: Find and Replace pattern that includes a variable string of text

2021-11-07 Thread jj
Hi Ralph,

Find:

(?s)XX(.+?)XX

Replace:

Y\1Y

Some explanation:

(?s) means allow the dot (which is the regular expression wildcard 
character) to match at new lines.
(.+?) means capture one or more characters non-greedily.
\1 is the result of that capture.

For anything touching regular expression patterns you should check the 
excellent BBEdit's menu Help >  BBEdit Help > Grep Reference.

HTH,

Jean Jourdain


On Sunday, November 7, 2021 at 4:18:07 PM UTC+1 ralph.w...@gmail.com wrote:

> Greetings all.  First time post.  
>
> I need to find and replace a consistent block of HTML that wraps around a 
> variable string of text, like this:
>
> XX
> adiuhkjashfutrhat
> XX
>
> and
>
> XX
> hjsutqpds
> XX
>
> etc.
>
> I need to replace XX with Y
>
> resulting in this 
>
> YY
> adiuhkjashfutrhat
> YY
>
> and
>
> YY
> hjsutqpds
> YY
>
>
> Is there a GREP term or switch that will grab a string of VARIABLE text 
> and carry it over to a replace across dozens of instances?
>
> Thanks all.  
>
> Hawk in Macon
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/407878b5-6d33-465b-b511-b4c4c9d040afn%40googlegroups.com.


Re: Find and Replace multiple queries at once

2021-11-05 Thread jj
Hi Pu Koh,

You could use BBEdit's Text > Canonize ... command.
Check "Canonize Using Grep Patterns" in the manual page 140.

With this sample transformation file (Note that find and replace 
expressions are separated by a tab):

# -*- x-bbedit-canon-case-sensitive: 1; x-bbedit-canon-match-words: 0; 
x-bbedit-canon-grep: 1; -*-

(foo)   f0zz\1
(bar|baz)   buzz
0   i

This text:

foobar
foobaz


Is canonized to:

fizzfoobuzz
fizzfoobuzz

HTH,

Jean Jourdain

On Friday, November 5, 2021 at 3:12:12 PM UTC+1 Bruce Van Allen wrote:

> Pu Koh wrote on 2021-11-05 4:00 AM:
> > Is there a function to run multiple find and replace patterns instead of 
> > doing it one at a time?
> > 
>
> Look into BBEdit's Text Factories.
>
> For more advice from this group, post an example of what you want to do, 
> with before and after samples.
>
>
> -- 
> - Bruce
>
> _bruce__van_allen__santa_cruz__ca_
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/b79c2041-b114-4efb-8cdd-95eb711a2b17n%40googlegroups.com.


Re: Remove line returns from within a paragraph but not between paragraphs

2021-11-04 Thread jj
Text > *Remove Line Breaks* is indeed a very useful command. Thanks Jeffrey 
for pointing to it.

But *Remove Line Breaks* doesn't make a distinction between left aligned 
text and indented text as the proposed regular expression find/replace does.

In most cases, you want indented text to be left untouched.

Try both solutions on this snippet of text and look at the resulting Code 
example section :

--
This is some long wrapped text line, 
that is followed by some indented section.

Code example:

A = "a"; // A Comment.
B = "b";

This is another wrapped paragraph with more text, 
blablabla, blablabla, blablabla ...
--

Jean
On Wednesday, November 3, 2021 at 6:19:21 PM UTC+1 jajls wrote:

> On 2021 Nov 2, at 23:04, Gavin Brooks  wrote:
>
>
> I have a lot of text that has been copied from a PDF, that I need to make 
> into text files for research purposes. When the text copied over, there was 
> a hard line return at the end of every sentences, and a blank space between 
> paragraphs. I need to the lines within the paragraph joined but the 
> paragraphs to remain separate and am looking for a regex to do that:
>
>
>
> I am surprised to see so much discussion of Find & Replace options, but no 
> one has mentioned that there is a built-in command that does exactly what 
> you ask:
>
> Text > Remove Line Breaks
>
> It works perfectly on your example text.
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/d012fba4-68b4-458c-83db-031df4d2b467n%40googlegroups.com.


Re: Remove line returns from within a paragraph but not between paragraphs

2021-11-03 Thread jj
Hi Gavin,

You could use a capture instead of a positive lookahead assertion and skip 
the trailing whitespaces.

Find: (\S)\h*\R(\S)

Replace: \1 \2

HTH,

Jean Jourdain

On Wednesday, November 3, 2021 at 11:02:07 AM UTC+1 gavin...@gmail.com 
wrote:

> I have a lot of text that has been copied from a PDF, that I need to make 
> into text files for research purposes. When the text copied over, there was 
> a hard line return at the end of every sentences, and a blank space between 
> paragraphs. I need to the lines within the paragraph joined but the 
> paragraphs to remain separate and am looking for a regex to do that:
>
> *For example, the text looks like this:*
>
> *This is the 1st paragraph. *
> *With a few lines that*
> *need connected.*
>
> *This is another paragraph with*
> *a blank line between*
> *it and the previous paragraph.*
>
> *I want it to look like this:*
>
> *This is the 1st paragraph. With a few lines that need connected.*
>
> *This is another paragraph with a blank line between it and the previous 
> paragraph.*
>
> *The best that I have been able to come up with is this:*
>
> ([^\r\n])\R(?=[^\r\n])
>
> *But that will also remove the last character of each line, so I get this:*
>
> *This is the 1st paragraph With a few lines tha need connected.*
>
> *This is another paragraph wit a blank line betwee it and the previous 
> paragraph.*
>
> Any suggestions about how to rewrite the above so that it does not remove 
> the final character?
>
> Gavin
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/f4e4195b-9cbc-41f7-b0e9-c8b64a88dcefn%40googlegroups.com.


Re: AppleScript -1728 error with replace selection

2021-10-24 Thread jj
Hi Sonic,

If not otherwise specified a property is relative to the current "Tell" 
object.
So line 34, selection is relative to the current "Tell" object, in this 
case text document 1.
This triggers the error because text documents don't have a selection 
property. 
You can reproduce it with:

tell application "BBEdit"
selection of text document 1
end tell

Result:
error "BBEdit got an error: An attempt was made to resolve an Apple 
Event reference to a non-existent object (macOS error code: -1728)." number 
-1728 from selection of text document 1

To access the selection of a text document ask for the selection of its 
window because windows do have a selection property.

tell application "BBEdit"
selection of window of text document 1
end tell

Result:
insertion point before character 3158 of text document 1 of 
application "BBEdit"

HTH

Jean Jourdain

On Sunday, October 24, 2021 at 6:55:06 AM UTC+2 sonic...@gmail.com wrote:

> This is actually a 2 part question. Before getting to the question to 
> which the Subject line refers, i have a Big Picture question about whether 
> perhaps my entire approach is off base.
>
> *Big Picture*
> I have an HTML fragment file, consisting of all the chapter titles of my 
> current story (being converted from TextEdit RTF to HTML). Most of the 
> time, the chapter titles are plain text. Once in awhile, they contain 
> markup, usually  open and close tags, but could be all kinds of 
> possible basic HTML markup.
>
> I’ve made up a demo file, attached. I’ll paste in 2 example lines here, to 
> explain what i’m trying to do.
> *** File excerpt, Before *
> […]
> #BARRIER#Markup In The 
> Chapter Title!?
> […]
> Wild!">#BARRIER#We Could Really 
> Go Wild!
> ***
> I want to preserve whatever markup exists as it is, to the right of my 
> delimiter #BARRIER#. To the left, in the actual title="", each  
> should be replaced with * and each  with **, and any other tags 
> should be removed.
>
> *** File excerpt, After *
> […]
> #BARRIER#Markup In The Chapter 
> Title!?
> […]
> #BARRIER#We Could 
> Really Go Wild!
> ***
> I tried to form some basic *replace* statements that would take care of 
> this all at once, but couldn’t get anything to work. So i set up a loop, 
> for *find* etc. to iterate through one line at a time.
>
> *-1728 error issue*
> My test script is attached as test #2 script, and pasted here:
> ***
>
> *set* currchap *to* 1 -- Number of the current chapter in the loop
>
>
> *tell* *application* "BBEdit"
>
> *tell* *text document* 1
>
> *set* totalchaps *to* *count* *of* *lines*
>
> *select* *insertion point* *before* *line* 1
>
> *repeat* *with* currchap *from* 1 *to* totalchaps
>
> *find* "(?<=title=\")(.+)(?=\">#BARRIER#)" options {search mode:*grep*} 
> *with* selecting match
>
> *set* curr_chapter_title *to* *grep substitution* of "\\1" *as* *text*
>
> *log* curr_chapter_title --for testing only
>
> *if* curr_chapter_title *contains* " chapter title, and we need to process it for the title tags
>
> -- Most likely case is . There can be  and  both, so we 
> handle them separately:
>
> *if* curr_chapter_title *contains* "" *then*
>
> *replace* "" using "*" searchingString curr_chapter_title options 
> {search mode:*grep*}
>
> *set* curr_chapter_title *to* result
>
> *log* "In the  branch" --for testing
>
> *log* curr_chapter_title --for testing only
>
> *end* *if*
>
> -- Note that  is an extremely unlikely use case, since at least 
> for HTML  is represented as Bold by default.
>
> *if* curr_chapter_title *contains* "" *then*
>
> *replace* "" using "**" searchingString curr_chapter_title 
> options {search mode:*grep*}
>
> *set* curr_chapter_title *to* result
>
> *log* "In the  branch" --for testing
>
> *log* curr_chapter_title --for testing only
>
> *end* *if*
>
> -- Eliminate any remaining tags. There isn’t going to be an  or  
> or similar, so if there is anything else, there will be a closing tag:
>
> *if* curr_chapter_title *contains* "
> *replace* "" using "" searchingString curr_chapter_title options 
> {search mode:*grep*}
>
> *set* curr_chapter_title *to* result
>
> *log* "In the <[anything]> branch" --for testing
>
> *log* curr_chapter_title --for testing only
>
> *end* *if*
>
> -- At this point the chapter title has been changed. Now we replace it.
>
> *replace* selection using curr_chapter_title
>
> *end* *if*
>
> *log* curr_chapter_title --for testing only
>
> *end* *repeat*
>
> *end* *tell*
>
> *end* *tell*
> ***
> This script seems to work all the way up to the last *replace* command:
> *replace* selection using curr_chapter_title
>
> Nothing gets replaced and it errors out.
>
> The ending part of the Replies in Script Editor looks like this:
>
> *replace* selection *of* *text document* 1 using "My Swell Test Story 
> chapter 3: *Markup 

Re: script for url to set ina message

2021-10-11 Thread jj
Hi Wim,

Not all applications respond to the same set of commands, elements, 
properties, enumerations, etc.

To view an application's Terminology use Script Editor > File > Open 
Dictionary... or drop the icon of the application upon the Script Editor 
icon.

Check this link on how to get the frontmost tab’s url and title of various 
browsers:

https://gist.github.com/vitorgalvao/5392178

HTH

Jean Jourdain


On Monday, October 11, 2021 at 3:23:54 PM UTC+2 w...@wimjongman.nl wrote:

> I have a question
>
> I have a script
>
> tell application "Safari"
> activate
> set myURL to URL of document 1
> set myName to name of document 1
> end tell
> set the clipboard to "Voor meer zie  target='_blank'>" & myName & "
>
> "
> activate me
> display dialog "In the clipboard: " & return & return & (the clipboard) 
> buttons "OK" default button "OK" with icon 1
>
> But when I wanted it for an other application as Brave Browser it don’t 
> work.
> Why not? Is it only in for Safari?
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/c7771e9e-b656-4566-8d93-0eaf41e9d011n%40googlegroups.com.


Re: Syntax for file filter in AppleScript?

2021-10-09 Thread jj
Hi Sonic,

As far as I know there is no way to call filters by name or to create 
filters with AppleScript.
Nonetheless, you can record them and use them in your scripts.

 1. In BBEdit, open the "Multi-File Search" window.
 
 2. Configure the search options you want –– File and Folders filters 
included.
 
 3. Use a word that WILL NOT match for the Find: and Replace: fields. (This 
is just a precaution to avoid accidentally replacing anything.)
 
find: ___THIS__WILL__N_E_V_E_R__BE__FOUND___
replace: ___THIS__WILL__N_E_V_E_R__BE__FOUND___

 4. Launch Script Editor, open a new script and click the "Record a Script" 
button.
 
 5. Go back to BBEdit and click on "Replace All" in the "Multi-File Search" 
window.
 
 6. In Script Editor pause the recording.
 
 7. Script Editor should have recorded the command. 
 
tell application "BBEdit"
activate
replace "___THIS__WILL__N_E_V_E_R__BE__FOUND___" using 
"___THIS__WILL__N_E_V_E_R__BE__FOUND___" saving no searching in {file 
"macosx:Users:jj:Documents:Notebook:"} options {search mode:grep, 
filter:{ID:"0DD90624-6CEA-4757-BCD1-A28CCA6DB640", filter_mode:or_mode, 
filter_terms:{{operand:".applescript", field:«constant FnSf», 
operator:op_is_equal}}}, showing results:true} with skip shielded folders, 
search invisible folders and search git_ignored files without text files 
only
end tell

 8. The Filter is in the options. You can use it in your AppleScript script.
 
filter:{ID:"0DD90624-6CEA-4757-BCD1-A28CCA6DB640", filter_mode:or_mode, 
filter_terms:{{operand:".applescript", field:«constant FnSf», 
operator:op_is_equal}}}
 
An *easier option* is to create a Text Factory that includes your Filters 
and call it from AppleScript like so.

tell application "BBEdit"
set vFactoryFile to POSIX file "/path/to/my/replace.textfactory"
apply text factory (vFactoryFile as alias) to (first text of first 
document of first window) saving no
end tell

Note that, as your BBEdit copy is lagging behind a few versions, some of 
this might not work as described.

HTH

Jean Jourdain

On Saturday, October 9, 2021 at 7:07:07 AM UTC+2 sonic...@gmail.com wrote:

> I’m finding the documentation on using the *filter* option for *replace* in 
> an AppleScript less than helpful: i don’t understand the syntax.
>
> Without that option, this *replace* command works perfectly in the 
> overall script:
>
> *replace* (("TOCCHAP" & currchap *as* *text*) & ">") using navlinkholder 
> searching 
> in story_directory options {showing results:*false*} saving *yes*
>
>
> The moment i add the clause *filter* "Exclude index.html" so it becomes 
> this:
>
> *replace* (("TOCCHAP" & currchap *as* *text*) & ">") using navlinkholder 
> searching 
> in story_directory options {showing results:*false*} *filter* "Exclude 
> index.html" saving *yes*
>
> and try to run the script, it throws the following error:
>
> *error* "BBEdit got an error: Could not make some data into the desired 
> type (MacOS Error code: -1700)" number -1700 to *record*
>
>
> There is an existing file filter i made via the multiple file Find 
> interface named:
>
> Exclude index.html
>
> with settings:
>
> Any File name root is not index
>
>
> Seems obvious that my clause for *filter* is all wrong, but the 
> documentation isn’t making it clear and searches on this group haven’t 
> yielded anything.
>
>
> What is the proper syntax when one wants to use the BBEdit *filter* noun 
> in AppleScript?
>
>
> Thanks in advance as always—the help has been stellar so far!
>
> (BBEdit 11.6.8, macOS 10.12.6, AppleScript 2.5, Script Editor 2.9, if any 
> of these matter)
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/8e25f08e-abe1-471d-9a52-c1c54c22aa50n%40googlegroups.com.


Re: Trying to improve the flake8 parser in bbresults

2021-10-08 Thread jj
Hi Johan,

You could try this:

flake8 foobar.py | sed -E 's/([FEW][0-9]+)/\1 \1:/g' | bbresults --pattern 
flake8

Piping through sed will repeat the 'type' twice so it appears at the start 
of the message.

HTH

Jean Jourdain
On Thursday, October 7, 2021 at 10:14:54 PM UTC+2 Johan Larsson wrote:

> I have just discovered the utility bbresults thanks to Patrick at Bare 
> Bones. As the manual page suggests, using it as processor of flake8 output 
> is really useful. One little drawback of the current built-in parser is 
> that the actual ID of an error or warning is consumed by the built-in 
> flake8 regular expression. So why do I see this as a drawback? Depending on 
> your coding style, preferences and/or the problem the code is trying to 
> solve, you may want to prohibit flake8 from pointing out certain errors or 
> violations.
>
> [image: Bild 2021-10-03 kl. 21.19.jpg]
>
> So I tried to improve the built-in regular expression as documented in the 
> man page.
>
> Not being an regex expert myself, I failed to include the warning or error 
> ID in the type group and somehow tack it on later for the msg part… Here is 
> my go at it, which only slightly improves the situation by including the 
> numerical part of the ID in the msg.
>
> '(?P.+?):(?P\d+):(?P\d+):\s+*(?P[EWF](?=\d+))*
> (?P.*)$'
>
> [image: Bild 2021-10-03 kl. 21.32.jpg]
>
> It’s far from ideal, but at least you know that if a violation is an 
> Error, you stick an ’E’ in front of the numerical ID to get the complete 
> code, ’W’ for a warning, and most likely an ’F’ for a note.
>
> Another option is of course to fall back to using the default parser in 
> bbresults, but the resulting output is a bit bleak as all entries are now 
> notes:
>
> [image: Bild 2021-10-03 kl. 21.39.jpg]
>
> Anyone out there with a better idea?
>
> Best regards,
> Johan
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/486c4baa-3b5f-4b67-8da3-346c67cc5632n%40googlegroups.com.


Re: Confused by differences between AppleScripted Replace and manual BBEdit Replace All

2021-10-07 Thread jj
Sonic,

You don't need to use grep substitutions in replacement expressions.

set StoryTitle to "Example Story"
set ConcatStoryTitle to "ExampleStory"
tell application "BBEdit"
tell text document 1
set vRegex to "(\\d\\d?)(.+?)"
set vReplacement to "\\2"
replace vRegex using vReplacement searching in it options {search 
mode:grep, wrap around:true}
end tell
end tell

HTH

Jean Jourdain

On Friday, October 8, 2021 at 6:40:37 AM UTC+2 sonic...@gmail.com wrote:

> Forgot to mention: if the following block is inserted in place of the 
> *replace*, it works:
>
> *find* "(\\d\\d?)(.+?)" options {search mode:*grep*, wrap around:
> *true*} *with* selecting match
>
> *set* chapnumtest *to* *grep substitution* of ("\\1" *as* *text*)
>
> *set* chaptitletest *to* *grep substitution* of ("\\2" *as* *text*)
>
> *log* chapnumtest
>
> *log* chaptitletest
>
>
> So this tells me that my Grep string is valid (which i know from it 
> working with the manual not scripted Replace All), making it all the more 
> puzzling to me why it fails in a scripted *replace* (all).
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/7dc1f278-caa0-440a-87f8-60844a7982den%40googlegroups.com.


Re: Make new HTML document from template in AppleScript: How?

2021-10-05 Thread jj
desses Get-Together.[…long paragraph text here…]
>
>
> There are about 34 steps in Step 3), covering all sorts of special CSS 
> formatting not shown in my brief example. I’ve already automated what i can 
> with Text Factories. A number of things have to be done manually.
>
> When i’m done, there’s only one  in the entire TE HTML document, which 
> is the story title. Each chapter starts with  and runs until the next 
> opening —and Chris will be familiar with this from a question i asked 
> here several weeks ago.
>
>
> Steps 4-8 i’ve been doing manually/partially automated. They’re what i’m 
> trying to more fully automate now, as most of it is repetitive work with 
> predictable, repeatable actions. Here’s how i do it manually:
>
>
> Somewhere between Steps 3 & 4: Find All chapter headings 
> [content], Extract to new document. Do some pre-processing for 
> their eventual use on the TOC page and to get a story total chapter count 
> from the line count. (This part is already automated.)
>
>
> Step 4: New HTML document in BBEdit, selecting my individual story chapter 
> template and entering the story title in the dialog. Using Includes, BBEdit 
> fills in the current year (for copyright) and the story title in 3 
> locations.
>
> I create a new folder in Finder for the new story (at a predictable 
> location), using the story name adjusted to be URI-friendly (remove spaces 
> and disallowed characters), sometimes shortened. (I’ve already successfully 
> automated this part of the process [in this paragraph] in AppleScript.) I 
> save the new HTML chapter document with the same name as the enclosing 
> folder, other than C1.html appended at the end.
>
> Step 5: I select some placeholder text in the just-saved document (which 
> really ought to be just one Include-style placeholder word in the 
> template). Switch back to the source TE HTML document. Select all the first 
> chapter text (working great, Chris!), copy. Switch back to the new chapter 
> document, paste and save.
>
> Remaining in the new chapter HTML document: Fill in the current chapter 
> number in one place, and the previous and upcoming chapter numbers (current 
> - 1 and current +1) in 2 places, for navigation. For the first chapter, 
> remove the 2 Previous chapter navigation links. For the last chapter remove 
> the 2 Next chapter navigation links.
>
>
> Step 6: Repeat all the above in Steps 4 & 5.
>
>
> Step 7: Open New HTML document with template for story home/main/TOC (one 
> entity—can’t decide what to call it) page. Finish formatting the extracted 
> chapters document into list item entries, copy/paste into placeholder area 
> of HTML list in this new document.
>
> Manually update information that cannot be automated (e.g. exciting story 
> synopsis that so far to this point is only in my head).
>
> Do some more find/replace (which can be automated).
>
> Manual work inserting a picture relevant to the story (because manual 
> adjustments for visual aesthetics are needed).
>
>
> Step 8: Do a bunch of multi-file Find/Replace in the individual chapter 
> and TOC files to complete navigation links throughout. (This is partly 
> automated and i look forward to making it fully so.)
>
>
> ***
>
> That’s how i’ve been doing things manually/semi-automated. It’s clear to 
> me that re-sequencing the steps is in some cases necessary for automation 
> and in many other cases is more efficient. For example things can easily be 
> re-jiggered to first complete all the automated parts of Steps 7 & 8, 
> leaving all the manual stuff for me to do at one time at the end.
>
>
> *My Question*, related to Jean’s suggestion to use AppleScripts called 
> from BBEdit templates
>
> Is there any point in doing that, with my initial conditions and this sort 
> of workflow? How would that even work? To me, my mind jumps to doing as 
> much as possible with a couple of AppleScripts (more than one because of 
> some essential manual work that cannot be done at the start or end of 
> automated processing), having those call the templates or otherwise plant 
> template content into newly-created HTML documents.
>
> Is my current approach to automation wrong-headed/inefficient? If so, what 
> would be a more optimized approach?
>
>
> I’ve read the AppleScript Language Guide all the way through. Problem is, 
> until i tried to look up the *use* control statement, i didn’t realize 
> there was anything newer than the 2008 version for 10.5 Leopard. I was 
> looking for PDFs, because i get nervous with Apple-provided documentation 
> online, since it sometimes vanishes when Apple decides no one needs it any 
> more.
>
> Chris: where does that im

Re: Make new HTML document from template in AppleScript: How?

2021-10-05 Thread jj
Using AppleScript to create HTML templates is an option and Christopher's 
example is excellent in that regard.

BBEdit also offers some powerful tools to create/use customizable HTML 
templates with AppleScript placeholders.

Check the BBEdit manual for:

  • Chapter 11: BBEdit HTML Tools, Templates, p. 312
  • Appendix C: Placeholders and Include Files, p. 413 
  • Appendix C: Including AppleScripts, Including Unix Scripts, p. 421
  
Similar placeholder techniques can be used to create HTML Clippings, see 
the manual:

  • Chapter 12: Clipping Substitution Placeholders, p. 321
  
HTH

Jean Jourdain

On Tuesday, October 5, 2021 at 3:33:05 AM UTC+2 listmei...@gmail.com wrote:

> On Oct 04, 2021, at 18:30, Sonic Purity  wrote:
>
> I cannot figure out how to use AppleScript to create a new HTML document 
> from an existing template file, as i easily do manually via ^⌘N then select 
> my template then type in the title in the Title field and tap Create.
>
> --
>
> Hey Sonic,
>
> That's easy enough if you already know how, but not so much if you don't.
>
> Recording is relatively useless – *except* for discovering the syntax for 
> some things that are really difficult to suss out.  A recorded script 
> very often takes a lot of editing to convert from a very verbose and 
> literal recording of actions to something that rationally makes sense to 
> user, computer, and task.
>
> Here's a sample template.  Note the underlined bold tags – these are 
> placeholders you can tab to in the open document.
>
> --
>
> 
> 
> 
> *<#TITLE#>*
> 
> 
> 
> *<#HTML_BODY#>*
> 
> 
>
> --
>
> You *can* use an AppleScript dialog to enter the title, but placeholders 
> are easier.
>
> This script uses the template-path defined with *property*
> * templateFilePath*.
>
> It also contains code to demonstrate the use of an embedded template 
> (commented-out).
>
> --
> Best Regards,
> Chris
>
> --
>
> 
> # Auth: Christopher Stone
> # dCre: 2021/10/04 20:07
> # dMod: 2021/10/04 20:07 
> # Appl: BBEdit
> # Task: Create a New HTML Document Using a Template File.
> # Libs: None
> # Osax: None
> # Tags: @Applescript, @Script, @ASObjC, @BBEdit, @Create, @HTML, 
> @Document, @Template
> 
> *use* AppleScript version "2.4" --» Yosemite or later
> *use* *framework* "Foundation"
> *use* *scripting additions*
> 
> *property* templateFilePath : "~/Documents/BBEdit 
> Documents/Templates/HTML_Template_01.txt"
> *property* defaultWindowBounds : {202, 45, 1238, 900} --» {X1, Y1, X2, 
> Y2} Upper-Left, Lower-Right
> 
>
> *set* templateFilePath *to* ((*current application's* NSString's 
> stringWithString:templateFilePath)'s stringByExpandingTildeInPath) *as* 
> *text*
> *set* templateText *to* *read* templateFilePath as «*class* utf8»
>
> *tell* *application* "BBEdit"
> # Create from a template FILE.
> *set* newDoc *to* *make* new *document* with properties {*text*
> :templateText}
>
> 
> # Create using embedded template TEXT in handler getTemplateText().
> # set newDoc to make new document with properties {text:my 
> getTemplateText()}
>
> 
> *tell* newDoc
> *if* *its* source language ≠ "HTML" *then* *set* *its* source 
> language *to* "HTML"
>
> 
> *tell* *its* *window*
> *if* *its* bounds ≠ defaultWindowBounds *then*
> *set* *its* bounds *to* defaultWindowBounds
> *end* *if*
> *end* *tell*
>
> 
> *end* *tell*
>
> 
> *end* *tell*
>
> 
> # Template Text
> 
> *on* getTemplateText()
> *return* *text* 2 *thru* -1 *of* "
> 
> 
> 
> <#TITLE#>
> 
> 
> 
> <#HTML_BODY#>
> 
> 
> "
> *end* getTemplateText
> 
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/dac3fbba-a8aa-4bbc-b3ff-39a9a34ad90dn%40googlegroups.com.


Re: HTML syntax checking warnings

2021-09-28 Thread jj
Hi Alain,

Those warnings are probably reporting that your document has unclosed 
"" tags (missing "").
You might try to have Tidy add the missing "" for you with: 

menu Markup > Tidy > Clean Document

After running the command and *before saving the document*, you can check 
the performed changes with:

menu Search > Find Differences… > Compare Against Disk File

and eventually revert undesired changes.

HTH

Jean Jourdain


On Tuesday, September 28, 2021 at 2:14:46 PM UTC+2 Greg Raven wrote:

> At the top of the HTML Syntax Errors window, you can uncheck the display 
> of errors and/or warnings and/or notes.
>
> On Monday, September 27, 2021 at 5:36:47 AM UTC-7 Alain C wrote:
>
>>
>> I get hundreds of useless warnings :
>> Element “” implicitly closed here
>> In the past I was able to get rid of that but don't remember how to 
>> configure BBedit
>> Can you help? Thanks.
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/498f6230-7c8d-41ff-8f04-2475c8c147c9n%40googlegroups.com.


Re: Add text to beginning and end of file, using a Textfactory?

2021-09-20 Thread jj

Hi Adam,

Building on Rich's answer, you could use the Canonize functionality here. 

(Quoted from the User Manual)
Canonize
This command allows you to perform batch search and replace operations 
which are governed by a pre-defined file. The transformation file is itself 
a list of paired search and replace strings or grep patterns, one pair per 
line. Each search string (or pattern) is separated from its replace string 
(or pattern) by a literal tab, so if you want your searches or replacements 
to match or insert tabs, you must use the special character “\t” within the 
corresponding strings.

1. Create a foobar.txt file with the following content (with tab 
separators):

# -*- x-bbedit-canon-grep: 1; -*-
\A  foo\n
\Z  \nbar
 
2. Use menu Text > Canonize... on your front document using the foobar.txt 
file.

\A is a regular expression for beginning of document.
\Z is a regular expression for end of document.
Applying Canonize with the foobar.txt file adds "foo" on a new line at the 
beginning of the document
and a new line with "bar" at the end of the document.

You should be able to create a text factory on this bases.

HTH

Jean Jourdain
On Monday, September 20, 2021 at 9:26:24 PM UTC+2 sie...@barebones.com 
wrote:

> On 20 Sep 2021, at 14:16, Adam Potthast wrote:
>
> > I'm looking for a textfactory action like "Prefix/Suffix Lines", but I 
> > want
> > to automatically add a string to the beginning and end of each file 
> > (not
> > each line). I figured finding this would be easy, but so far it has 
> > escaped
> > me.
>
> Using Grep, "\A" matches the beginning of the file; and "\z" matches the 
> end of the file.
>
> So, you could do two searches:
>
> \A replace with foo\n
>
> and
>
> \z replace with bar\n
>
> which I think will do what you need.
>
> R.
>
> -- 
> Rich Siegel Bare Bones Software, Inc.
>  
>
> Someday I'll look back on all this and laugh... until they sedate me.
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/01af2a11-cf4c-4350-b860-e66820a4d65cn%40googlegroups.com.


Re: Can anyone help with Script that formats and replaces JSON?

2021-09-17 Thread jj
Pourquoi faire simple quand on peur faire compliqué? 


Revisiting this thread.
Provided jq in in your PATH, my convoluted applescript script could be 
replaced by this simple text filter:

#!/bin/sh
jq '.'

Zen and the Art of BBEdit Script Maintenance.

Regards,

Jean Jourdain

On Friday, September 17, 2021 at 8:26:44 PM UTC+2 Jagrut Sharma wrote:

> Thank you. This was helpful.
> --
> Jagrut
>
> On Friday, January 31, 2020 at 8:33:39 AM UTC-8 Ken Corey wrote:
>
>> That's top notch.  I had one small thing where I needed to protect the 
>> contents of the string to get it to work:
>>
>> *tell* *application* "BBEdit"
>>
>> *set* the_selection *to* (selection *of* *front* *window* *as* *string*)
>>
>> *if* (the_selection) *is* "" *then*
>>
>> *set* the_selection *to* *line* (*get* startLine *of* selection) *of* 
>> *front* *window* *as* *string*
>>
>> *set* the_formatted *to* *do shell script* "echo '" & the_selection & "' 
>> | /usr/local/bin/jq ."
>>
>> *set* (*line* (*get* startLine *of* selection) *of* *front* *window*) 
>> *to* the_formatted
>>
>> *else*
>>
>> *set* the_formatted *to* *do shell script* "echo '" & the_selection & "' 
>> | /usr/local/bin/jq ."
>>
>> *set* (selection *of* *front* *window*) *to* the_formatted
>>
>> *end* *if*
>>
>> *end* *tell*
>>
>>
>> Thank you so much!
>>
>>
>> *-Ken*
>>
>> On Wednesday, 29 January 2020 19:14:29 UTC, GP wrote:
>>>
>>>
>>>
>>> On Wednesday, January 29, 2020 at 5:46:09 AM UTC-8, Ken Corey wrote:

 Hi All,

 I have a script, shown below, that allows me to put the cursor on a 
 single line of json and call my script.  A terminal window is opened, and 
 the formatted json is shown.  I then can copy it out and paste it back 
 into 
 the document.

 It works, but it's still a bit of a bother.

 I'd like the json line in BBEdit to be replaced with the formatted 
 json.  No terminal window needed.


>>> Something like:
>>>
>>> set the_formatted to do shell script "echo  & the_selection &  | jq ."
>>>
>>> will eliminate the need to use the Terminal application.
>>>
>>> Something like the following quick and dirty hack will probably work:
>>>
>>> tell application "BBEdit" 
>>> set the_selection to (selection of front window as string)
>>> if (the_selection) is "" then
>>> set the_selection to line (get startLine of selection) of front window 
>>> as string
>>> set the_formatted to do shell script "echo  & the_selection &  | jq ."
>>> set (line (get startLine of selection) of front window) to the_formatted
>>> else
>>> set the_formatted to do shell script "echo  & the_selection &  | jq ."
>>> set (selection of front window) to the_formatted
>>> end if
>>> end tell
>>>
>>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/6883f84b-71a0-496e-a3e0-3d0a33dc5633n%40googlegroups.com.


Re: Using Black as text filter

2021-09-05 Thread jj
Hi Maxime,

Passing the --quiet flag seems to do the trick.

#!/bin/bash

black -q -

HTH

Jean Jourdain
On Sunday, September 5, 2021 at 1:25:20 AM UTC+2 m...@maximepigeon.com 
wrote:

> For reference, I ended up using Black's (private) method format_str() 
> like so:
>
> #!/usr/bin/env python3
>
> import sys
> from black import format_str
> from black.mode import Mode
>
> stdin = sys.stdin.read()
> stdout = format_str(stdin, mode=Mode())
>
> print(stdout, end="")
>
> Still, it would be nice to know what's wrong with the previous code.
>
> On Saturday, September 4, 2021 at 6:02:36 PM UTC-4 Maxime Pigeon wrote:
>
>> Hi,
>>
>> I'm trying to create a very simple text filter that uses Black to format 
>> Python code. According to their documentation 
>> ,
>>  
>> Black supports formatting code via stdin, with the result being printed to 
>> stdout. So my text filter is simply:
>>
>> #!/bin/bash
>>
>> black -
>>
>> Script output says that the reformat was successful, yet my file doesn't 
>> change. Anyone has experience with using Black in BBEdit?
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/9b8c08be-3b7e-4872-819c-e64127ac7980n%40googlegroups.com.


Re: script/text filter advice

2021-08-30 Thread jj
Hi Tim,

BBEdit offers plenty of options to manipulate text:

  • Scripting with Script Editor or Script Debugger using BBEdit's rich 
vocabulary of objects and commands: 
  ◦ AppleScript, AppleScriptObjc, JavaScript
  • Any executable that can read BBEdit's environment variables: 
  ◦ Interpreted languages: python, perl, javascript, ruby, php, etc;
  ◦ Shell scripts and command line utilities;
  ◦ Custom compiled executables.

Which is better depends on the task at hand and your coding preferences.

Here is a sample shell script that reads the environment variables BBEdit's 
sets up:

#!/usr/bin/env sh

# Name of the document's current language (not set if language is 
"none")
echo BB_DOC_LANGUAGE $BB_DOC_LANGUAGE ;

# Emacs mode of the document's current language
echo BB_DOC_MODE $BB_DOC_MODE ;

# name of the document
echo BB_DOC_NAME $BB_DOC_NAME ;

# path of the document (not set if doc is unsaved)
echo BB_DOC_PATH "\"$BB_DOC_PATH\"" ;

# (zero-based) end of the selection range (not set if not text document)
echo BB_DOC_SELEND $BB_DOC_SELEND ;

# (one-based) de-tabbed column number of BB_DOC_SELEND
echo BB_DOC_SELEND_COLUMN $BB_DOC_SELEND_COLUMN ;

# (one-based) line number of BB_DOC_SELEND
echo BB_DOC_SELEND_LINE $BB_DOC_SELEND_LINE ;

# (zero-based) start of the selection range (not set if not text 
document)
echo BB_DOC_SELSTART $BB_DOC_SELSTART ;

# (one-based) de-tabbed column number of BB_DOC_SELSTART
echo BB_DOC_SELSTART_COLUMN $BB_DOC_SELSTART_COLUMN ;

# (one-based) line number of BB_DOC_SELSTART
echo BB_DOC_SELSTART_LINE $BB_DOC_SELSTART_LINE;

# length of the selection
SEL_LENGTH=`expr $BB_DOC_SELEND - $BB_DOC_SELSTART` ;
echo SEL_LENGTH $SEL_LENGTH ;

Scripts should be placed in ~/Library/Application Support/BBEdit/Scripts to 
appear on BBEdit's Script menu.

HTH,

Jean Jourdain

On Monday, August 30, 2021 at 4:14:56 AM UTC+2 Tim Gray wrote:

> Is AppleScript the best/most powerful way to script text manipulation 
> based on where the cursor currently is? I know Text Filters can be very 
> useful, but only seem to operate on selected text (or the whole document). 
> But I'm looking to modify the current line if nothing is selected or modify 
> the selected lines if multiples are selected, even if they are only 
> partially so. I'm assuming that AppleScript is the only tool available for 
> stuff like this in BBEdit.
>
> Thanks,
> Tim
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/c2eb4de0-e53e-4a60-9e79-dd78b4b94554n%40googlegroups.com.


Re: LSP configuring

2021-08-27 Thread jj
Hi Edzard,

As far as I know, the green dot in the language preferences means that 
BBEdit found an executable file with the name/path given in the "Command:" 
field of the Server pane. 
(As documented in 
https://www.barebones.com/support/bbedit/lsp-notes.html#placement).

That doesn't imply the give executable is functional or even suitable.

Concerning the CSS LSP,  the vscode-css-languageserver-bin package creates 
a symlink named "css-languageserver" and BBEdit uses that as a default.

For whatever reason this symlink appears to use a relative path to the 
linked file and doesn't work.

% ls -al `which css-languageserver`    
lrwxr-xr-x  1 jj  admin  66 Aug 18 21:17 
/usr/local/bin/css-languageserver -> 
../lib/node_modules/vscode-css-languageserver-bin/cssServerMain.js

Try recreating this symlink with an absolute path (.

% rm -i /usr/local/bin/css-languageserver
% ln -fs 
/vscode-css-languageserver-bin/cssServerMain.js
 
/usr/local/bin/css-languageserver

HTH

Jean Jourdain

On Friday, August 27, 2021 at 2:43:53 PM UTC+2 ran...@gmail.com wrote:

> Greetings,
>
> HTML LSP works fine. CSS does not seem to work. Never see the green dot. 
> See brew config below.
>
> % npm list -g --depth=0
>
> /usr/local/lib
>
> ├── em...@2.3.4
>
> ├── n...@7.20.1
>
> ├── vscode-css-lan...@1.4.0
>
> └── vscode-html-lan...@1.4.0
> Anny suggestions?
>
> Edz..
>
> On Tuesday, 17 August 2021 at 02:20:03 UTC-3 Jan Erik Moström wrote:
>
>> On 16 Aug 2021, at 16:19, Rich Siegel wrote: 
>>
>> > However, I recommend that you install clangd newer than the one 
>> > bundled with Xcode. clangd 12.0.1 (as installed by "brew install llvm" 
>> > and then symlinked into BBEdit's "Language Servers" support folder) 
>> > doesn't seem to have any trouble finding the standard headers. 
>>
>> Thanks, I'll do this. 
>>
>> = jem 
>>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/e6beab5a-3042-4168-a1e7-8e751c06579cn%40googlegroups.com.


Re: Is BBLMRunColors only a coded language module feature.

2021-08-26 Thread jj
Christopher,

For what I know Function Patterns use named subpatterns in order to capture 
function names and ranges for the navigation bar Functions menu and for the 
code folding.

It is not clear to me what will be the use of keyword subpattern captures.

If you don't find an answer to your question in the documentation, you 
should send an mail to the BBEdit support team (supp...@barebones.com) with 
a clear description of your question and what you intend to do, including 
examples, expected results, etc.

Codeless Language Modules documentation is available here:
https://www.barebones.com/support/develop/clm.html
https://www.barebones.com/support/technotes/language-module-changes.html

Best regards,

Jean 


On Thursday, August 26, 2021 at 8:47:40 AM UTC+2 Christopher Waterman wrote:

> Jean
>
> Again thanks for the help with BBLMRunColors. That really got me off of 
> the right foot.
> I’ve discover how you can map them to each other and to builtin RunKinds. 
> Pretty neat.
>
> I have a question regarding BBLMKeywordPatterns. Do you know if you can 
> make it match a named sub-pattern for coloring? 
> Similar to the way Function Pattern works. Maybe there is a magic name or 
> something.  
>
> Thanks,
> — Chris(topher)?
>
>
>
> On Aug 24, 2021, at 1:43 AM, jj  wrote:
>
>
> Hi Christopher,
>
> Here is a minimal Codeless Language Module for an hypothetical 
> "Christopher" language that demonstrates the use of color runs.
> Save it as Christopher.plist in ~/Library/Application 
> Support/BBEdit/Language Modules.
>
> ...
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/770e89c3-91bc-44b6-8b83-021f92b9e388n%40googlegroups.com.


Re: grep 2 text strings and extract them to the SAME line of output?

2021-08-25 Thread jj
Find:


]+?(?:NAME="([^"]+)"[^>]+LIKES="([^"]+)"|LIKES="([^"]+)"[^>]+NAME="([^"]+)"|(?:NAME|LIKES)="([^"]+)")[^>]*>

Replace:

\1 \2 \4 \3 \5

Test data :








Extract:

Fluffy bones   
  Abu Banana 
Fluffy
Banana
Peter
Carrots

In case you will want to remove the leading spaces.

Find:

^\s+

Replace:



If it gets more complicated than that maybe you should go for more advanced 
XML parsing tools.
Regular expressions are not the best fit for those cases.

HTH

Jean Jourdain

On Wednesday, August 25, 2021 at 9:48:50 PM UTC+2 BBLuv wrote:

> Appreciated Jean! It works as if miraculous. If you would accept a further 
> challenge: how can the expression also find instances when only one of the 
> attributes is present? bonus challenge: and if the attributes are not in 
> that order?
> Great big thanks
>
> On Wednesday, August 25, 2021 at 4:53:49 PM UTC+3 jj wrote:
>
>>
>> Hi BBLuv,
>>
>> Find: 
>>
>> ]+NAME="([^"]*)"[^>]+LIKES="([^"]*)"[^>]*>
>>
>> Replace:
>>
>> \1 -- \2
>>
>> and use the Extract button of the find window.
>>
>> HTH
>>
>> Jean Jourdain
>>
>> On Wednesday, August 25, 2021 at 2:12:48 PM UTC+2 BBLuv wrote:
>>
>>> Hi - non technical user here, proud to have figured out part of my goal.
>>>
>>> I have multiple XML files that I am trying to scan through to pluck out 
>>> instances of tag attributes. The XML looks like this, and I want to extract 
>>> the NAME and LIKES  attributes across the files. 
>>>
>>> 
>>>
>>> Using grep + extract I am able to produce this:
>>>
>>> search = (?<=NAME=").*?(?=")|(?<=LIKES=").*?(?=")
>>> output = 
>>> Fluffy
>>> bones
>>> Tiger
>>> chewtoys
>>> Rusty
>>> mailmen
>>> 
>>> I would love output that includes my own text:
>>> Fluffy -- bones
>>> Tiger -- chewtoys
>>> Rusty -- mailmen
>>>
>>> or at least has the output values in one line per XML tag
>>> Fluffy bones
>>> Tiger chewtoys
>>> Rusty mailmen
>>>
>>> I learned the pipe character lets me make multiple extractions but I am 
>>> not able to control the output.
>>>
>>> Can you help?
>>>
>>> Thanking you...
>>>
>>>
>>>
>>>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "supp...@barebones.com" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/bf59b3f0-e76f-49b4-9001-f8bf8480e1bdn%40googlegroups.com.


  1   2   >