Syntax checking warnings

66 views
Skip to first unread message

@lbutlr

unread,
Jun 2, 2019, 1:15:46 PM6/2/19
to BBEdit Talk
Is it possible to have the syntax check (Markup => Check => Document Syntax) default to NOT showing warnings unless I click on the warnings check box? I only want to see actual error by default since in nearly all cases warnings are spurious “URL may need to be encoded” and I have to uncheck the 282 warnings to be able to find the one actual error.

Searching the prefs for “warn” and “syntax" showed no results.


--
G is for GEORGE smothered under a rug
H is for HECTOR done in by a thug


@lbutlr

unread,
Jun 6, 2019, 6:22:48 AM6/6/19
to BBEdit Talk
On Jun 2, 2019, at 11:15 AM, @lbutlr <kre...@kreme.com> wrote:
> Is it possible to have the syntax check (Markup => Check => Document Syntax) default to NOT showing warnings unless I click on the warnings check box? I only want to see actual error by default since in nearly all cases warnings are spurious “URL may need to be encoded” and I have to uncheck the 282 warnings to be able to find the one actual error.

(Or go turn off the check box every time, of course)

> Searching the prefs for “warn” and “syntax" showed no results.

I’ll take the overwhelming silence as a “no, you can’t do that”. Sigh.



--
And now, the rest of the story


Rich Siegel

unread,
Jun 6, 2019, 9:07:12 AM6/6/19
to bbe...@googlegroups.com
On 6/6/19 at 6:22 AM, kre...@kreme.com (@lbutlr) wrote:

>>Is it possible to have the syntax check (Markup => Check => Document
>>Syntax) default to NOT showing warnings unless I click on the
>>warnings check box? I only want to see actual error by default since
>>in nearly all cases warnings are spurious “URL may need to be
>>encoded” and I have to uncheck the 282 warnings to be able to find
>>the one actual error.
>
>(Or go turn off the check box every time, of course)
>
>>Searching the prefs for “warn” and “syntax" showed no results.
>
>I’ll take the overwhelming silence as a “no, you can’t do that”. Sigh.

You could fix the warnings. It'd be a tedious chore, but you
would only have to do it once.

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Donald Goyette

unread,
Jun 6, 2019, 9:15:54 AM6/6/19
to BBEdit Talk
Not a default, but you can turn off the warnings each time Check Syntax is run with some UI AppleScripting attached to the menu item. Something like

on menuselect(menuName, itemName)
     
-- returning false lets the menu command itself run
      return false
end menuselect

on postmenuselect(menuName, itemName)
      if
menuName = "Check" and itemName = "Document Syntax" then
            tell
application "System Events"
                  tell
process "BBEdit"
                        if
name of window 1 contains "HTML Syntax Error" then
                              tell
window 1
                                    set
warning_checkbox to (name of every checkbox whose name contains "Warning") as text
                                    if value of checkbox warning_checkbox is 1 then
                                         
click checkbox warning_checkbox
                                    end if
                             
end tell
                        end if
                  end tell
            end tell
      end if

end postmenuselect 

saved as Check•Document Syntax to the Menu Scripts folder of your BBEdit's application support folder should do the trick. The first time you run it you might get an error and have to grant BBEdit permission to control your computer.

Jan Erik Moström

unread,
Jun 6, 2019, 10:30:38 AM6/6/19
to bbe...@googlegroups.com
On 6 Jun 2019, at 15:07, Rich Siegel wrote:

> You could fix the warnings. It'd be a tedious chore, but you would
> only have to do it once.

I thought I would have an example where BBEdit would do the wrong thing
... then I tried (haven't used the HTML stuff in a while) and BBEdit, of
course, worked correctly.

Sorry I doubted :D

= jem

@lbutlr

unread,
Jun 6, 2019, 2:57:34 PM6/6/19
to BBEdit Talk
On Jun 6, 2019, at 8:30 AM, Jan Erik Moström <li...@mostrom.pp.se> wrote:
> On 6 Jun 2019, at 15:07, Rich Siegel wrote:
>> You could fix the warnings. It'd be a tedious chore, but you would only have to do it once.

I cannot fix the warnings because the URL is encoded properly according to the w3 validator.

It used to show up as an error, but Barebones was kind enough to make it a warning recently, which does make my life a lot easier.

Here is an example:

<a href="mailto:ad...@covisp.net?Subject=14-Apr-2019%2044j1rR1bC6zc3Mp&Body=Please%20recover%20this%20email...">44j1rR1bC6zc3Mp</a>

BBEdit: untitled text 2:18: Value of attribute “href” for element “<a>” may be invalid; special characters in URL paths should be entity encoded (“mailto:ad...@covisp.net?Subject=14-Apr-2019%2044hpMT20NYzc3RR&amp;Body=Please%20recover%20this%20email...”).

Validator.w3.org: "Document checking completed. No errors or warnings to show.”


--
The only way of discovering the limits of the possible is to venture a
little way past them into the impossible.


@lbutlr

unread,
Jun 6, 2019, 2:58:10 PM6/6/19
to BBEdit Talk
On Jun 6, 2019, at 7:11 AM, Donald Goyette <d...@eygo.net> wrote:
> on menuselect(menuName, itemName)
> -- returning false lets the menu command itself run
> return false
> end menuselect
> on postmenuselect(menuName, itemName)
> if menuName = "Check" and itemName = "Document Syntax" then
> tell application "System Events"
> tell process "BBEdit"
> if name of window 1 contains "HTML Syntax Error" then
> tell window 1
> set warning_checkbox to (name of every checkbox whose name contains "Warning") as text
> if value of checkbox warning_checkbox is 1 then
> click checkbox warning_checkbox
> end if
> end tell
> end if
> end tell
> end tell
> end if
> end postmenuselect

It looks like that should work, and there are no errors reported (once I figured out how to save it as an application), but the warning check box doesn’t get unchecked. (12.6.4).


--
"He is simply a shiver looking for a spine to run up." - Paul Keating


Rich Siegel

unread,
Jun 6, 2019, 3:00:57 PM6/6/19
to bbe...@googlegroups.com
On 6/6/19 at 2:57 PM, kre...@kreme.com (@lbutlr) wrote:

>>> You could fix the warnings. It'd be a tedious chore, but you would only have to do it once.
>
>I cannot fix the warnings because the URL is encoded properly
>according to the w3 validator.

You can still fix the warnings. :-) It's never wrong to
entity-encode ampersands in URLs.

@lbutlr

unread,
Jun 6, 2019, 4:41:04 PM6/6/19
to BBEdit Talk
On Jun 6, 2019, at 1:00 PM, Rich Siegel <sie...@barebones.com> wrote:
You can still fix the warnings. :-) It's never wrong to entity-encode ampersands in URLs.

You mean encode the encode &amp; ?



--
Rid yourself of doubt -- or should you? -George Carlin


@lbutlr

unread,
Jun 6, 2019, 4:42:05 PM6/6/19
to BBEdit Talk


> On Jun 6, 2019, at 2:07 PM, @lbutlr <kre...@kreme.com> wrote:
>
> On Jun 6, 2019, at 1:00 PM, Rich Siegel <sie...@barebones.com> wrote:
>> You can still fix the warnings. :-) It's never wrong to entity-encode ampersands in URLs.
>
> You mean encode the encode &amp; ?

Good lord, I kept looking at the wrong line. Argh!

<hangs head in shame>


--
"In order to avoid being called a flirt, she always yielded easily."
Charles, Count Talleyrand


Donald Goyette

unread,
Jun 7, 2019, 7:36:15 AM6/7/19
to BBEdit Talk
On Thu, Jun 6, 2019, at 2:58 PM, @lbutlr wrote:
> It looks like that should work, and there are no errors reported (once
> I figured out how to save it as an application), but the warning check
> box doesn’t get unchecked. (12.6.4).

I'm not sure scripts saved as applications can be used as BBEdit menu attachments. Does it work if you save the AppleScript in Script format from the Script Editor? The file name should be "Check•Document Syntax" with a ".scpt" extension and it would go in your BBEdit menu scripts folder (see Folders->Menu Scripts from the BBEdit menu for the location).

@lbutlr

unread,
Jun 7, 2019, 7:47:29 AM6/7/19
to BBEdit Talk
When I saved it as a script, I got an execution error, so I saved it as an application,.

I can’t check on it right now sine I’m hip-deep on Catalina spelunking.

Reply all
Reply to author
Forward
0 new messages