Using external WYSIWYG editor for HTML

42 views
Skip to first unread message

Lutz Pietschker

unread,
May 11, 2019, 2:52:00 PM5/11/19
to BBEdit Talk
I am in the process of replacing Dreamweaver for web site management - CS6 will die soon, and I will not go the CC path (Affinity products have repaced the rest of the Adobe Suite). I find that BBEdit does most of what I want splendidly (I did not expect anything else :-) … more about this below * if you are interested.

Call me a wimp, but I'd like to use a WYSIWYG editor for creating the content of the web pages (as opposed to the structure and control code for which I gratefully accept the BBEdit editor), so I'd like to have an "Open with …" command in the BBEdit project view to edit the HTML (and possible CSS) pages with BlueGriffon. The obvious workaround is to use the "Open in Finder" command after assigning the HTML and CSS file types to BlueGriffon. Is there another way?

Grateful for any ideas and opinions - Lutz


* If you are interested, here is how I will migrate: The thing that really made DW very useful for me was the complete site management, most of all the use of Templates and Components. DW templates define editable regions in document templates; you cannot change the content of non-editable parts of the doc inside DW, you need to change and re-apply the template to change them. Well, ecxcept the enforcement of not touching the "template" parts of the doc BBEdit can achieve the same, and in some ways even better, by turning the principle upside down: Everything is editable, but I will include the constant, "template" parts  as persistent includes and replace them with the "prescribed" content on upload (by project settings). That, plus variables/placeholders, plus "simple" includes, actually make BBEdit much more flexible than DW. So far it is just an idea, or let's say a plan, but I am certain it will work. The functionality of BBEdit in that respect is simply amazing (and I am not even talking about scripted includes … no limit except your imagination if you use these).

Bruce Van Allen

unread,
May 11, 2019, 4:12:24 PM5/11/19
to bbe...@googlegroups.com
Hi Lutz,

Try a simple shell script or Perl script that opens the html
file in BlueGriffin, saved to your BBEdit scripts folder, with
an assigned key combination.

Reply to this list if this would be foreign territory for you;
some experienced guides inhabit this space (but I didn't want to
presume you'd need that).

HTH


On 5/11/19 at 10:48 AM, yeo...@flyhi.de (Lutz Pietschker) wrote:

>I am in the process of replacing Dreamweaver for web site
>management - CS6 will die soon, and I will not go the CC path
>(Affinity products have repaced the rest of the Adobe Suite). I
>find that BBEdit does most of what I want splendidly (I did not
>expect anything else :-) … more about this below * if you are interested.
>
>Call me a wimp, but I'd like to use a WYSIWYG editor for
>creating the *content* of the web pages (as opposed to the
>structure and control code for which I gratefully accept the
>BBEdit editor), so I'd like to have an "Open with …" command
>in the BBEdit project view to edit the HTML (and possible CSS)
>pages with BlueGriffon. The obvious workaround is to use the
>"Open in Finder" command after assigning the HTML and CSS file
>types to BlueGriffon. Is there another way?
>
>Grateful for any ideas and opinions - Lutz
>
>
>* If you are interested, here is how I will migrate: The thing
>that really made DW very useful for me was the complete site
>management, most of all the use of Templates and Components. DW
>templates define editable regions in document templates; you
>*cannot* change the content of non-editable parts of the doc
>inside DW, you need to change and re-apply the template to
>change them. Well, ecxcept the enforcement of not touching the
>"template" parts of the doc BBEdit can achieve the same, and in
>some ways even better, by turning the principle upside down:
>Everything is editable, but I will include the constant,
>"template" parts as persistent includes and replace them with
>the "prescribed" content on upload (by project settings). That,
>plus variables/placeholders, plus "simple" includes, actually
>make BBEdit much more flexible than DW. So far it is just an
>idea, or let's say a plan, but I am certain it will work. The
>functionality of BBEdit in that respect is simply amazing (and
>I am not even talking about scripted includes … no limit
>except your imagination if you use these).
>
--

- Bruce

_bruce__van_allen__santa_cruz__ca_

Lutz Pietschker

unread,
May 12, 2019, 8:48:41 AM5/12/19
to BBEdit Talk
Hi Bruce, thanks for the hint. I have no idea how to get the path to the file except through AppleScript, so this is what I came up with:
tell application "BBEdit" to set theDoc to file of document 1
set thePOSIXPath to (the POSIX path of theDoc)
set theCommand to "open '" & thePOSIXPath & "' -a BlueGriffon"
do shell script theCommand

It is slow, but it works. Thanks again!
Lutz

Lutz Pietschker

unread,
May 12, 2019, 8:48:46 AM5/12/19
to BBEdit Talk
Hi Bruce

yep, that would be the way to go I believe – AppleScript would work as well, I think. Thanks for the proposal! Since I cannot select files in the project browser (without changing advanced settings) this would refer to/open the file that is currently "in front", i. e. visible in the editor window of the project panel, right? Good thing that this is exactly what I need :-)
A command line like "open /Users/lutz/Desktop/Dreamweaver\ alternatives/test/index.html -a BlueGriffon" works just fine.
My problem with the script is how to parametrize the command  – how do I get the path & file name of the frontmost file in BBEdit? I am a bit rusty on scripting right now. If someone has a solution out of hand I would be grateful, otherwise I'll ask the web.

Thanks again!
Lutz

Greg Raven

unread,
May 12, 2019, 8:48:51 AM5/12/19
to BBEdit Talk
FWIW, you can more than duplicate the functionality of Dreamweaver Library files with PHP or SHTML includes, assuming your web host supports PHP or SHTML. Most "normal" hosts do support PHP and SHTML pages, and some even support interpreting .html file as if they were .php or .shtml files, but some of the new "serverless" hosts (such as Netlify) do not. You might check with your web hosting service to see what they support, and then get the matching code to include in your .htaccess file to make the magic happen -- or just use files with .php or .shtml extensions.

Bruce Van Allen

unread,
May 12, 2019, 12:09:21 PM5/12/19
to bbe...@googlegroups.com
Hi Lutz,

Check the BBEdit manual (it's a PDF that downloads so you get
the latest), starting at page 337 "Filters and Scripts". That
section explains how BBEdit helps us by providing a set of
environment variables to scripts that are launched from within BBEdit.

Document State
For convenience, BBEdit sets some runtime environment
variables to provide information about the front document’s
state right before a Unix filter or script is run: ...

Among those environment variables are - yay! - BB_DOC_NAME and BB_DOC_PATH.

So here's a quick Perl script that you could start from. This
opens the front-most file in Safari - I don't have BlueGriffon.
I saved this as ~/Library/Application Support/BBEdit/Scripts/get_BBEdit_Doc_test.pl

#!/usr/bin/perl

use strict;
use warnings;

exec qx(open -a Safari $ENV{BB_DOC_PATH});


A shell script would also get those environment variables. So
you could put this in a file in the same BBEdit Scripts folder:

#!/bin/bash
open $BB_DOC_PATH -a BlueGriffon


Then just assign a keyboard combination to the script.
--

- Bruce

_bruce__van_allen__santa_cruz__ca_

Lutz Pietschker

unread,
May 12, 2019, 1:37:24 PM5/12/19
to BBEdit Talk
Great! The env variables were what I was missing. Thanks a million!
Reply all
Reply to author
Forward
0 new messages