External Programs and Filters: Difference between revisions

From Bluefish Wiki
Jump to navigation Jump to search
m (moved Man 2 ch07s08 to External Programs and Filters: Title updated (BV))
 
(8 intermediate revisions by 2 users not shown)
Line 2: Line 2:
|lang=en
|lang=en
|rev=2.0.0
|rev=2.0.0
|st=d
|st=u
|Title=8. External programs, filters
|Title=8. External programs, filters
|prev=Man 2 ch07s07
|prev=Snippets plugin
|Subtitle=Chapter VII. More than a Text Editor
|Subtitle=Chapter VII. More than a Text Editor
|next=Man 2 ch08
|next=Modifying shortcut keys
}}
}}


note for editor:  
{{toc}}
 
External programmes can be called from within Bluefish. The currently opened file can be given as a parameter. External programmes are divided into three parts:
 
# '''external commands: '''With an external command you can just open a file in an other programme, e.g. a browser. If that programme changed the file, Bluefish will warn you some moments later.
# '''external filters:''' In contrast to external commands, external filters give a return value.
# '''output box:''' Programmes in that category opens also the output box at the bottom of Bluefish.
 
By default, for all three are already defined commands.
 
{{note|text='''Note''': The external programmes are not necessarily installed on your computer, so you may have to install them at first. Bluefish will give you a warning if that programme is not installed.}}
 
= External commands =
External commands are mostly browsers. The external commands can be reached through ''Tools → Commands''. With the ''Preview in Browser ''button on the toolbar you can open the default browser, which is also an external programme.
 
== Customising external commands ==
For customising external commands you have to open the ''Preferences'' dialog either through ''Edit → Preferences'' or the ''Preferences'' button on the toolbar. Select ''External commands'' in the left panel.
 
There are four columns for editing external commands:
 
* '''Enabled:''' If this is checked, you are able to reach that command through ''Tools → Commands''.
* '''Label:''' The name of the command in menu.
* '''Command:''' Here is the command.
* '''Default browser:''' The checked programme can accessed through the ''Preview in Browser'' button at the toolbar.
 
These are the options for external commands:
 
 
{| style="border-spacing:0;width: 75%"
| colspan="2"  style="border:0.05pt solid #000000;padding:0.097cm;"| '''Input options'''
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| start with a | to send the input to the standard input
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %f
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| local file name (available for local files)
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %i
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| temporary file name for input, equals %f if the document is not modified and local
 
|-
| colspan="2"  style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''Other options'''
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %a
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| additional arguments that will be asked when this filter is activated
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %c
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| local directory of file (available for local files)
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %n
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| file name without path (available for all titled files)
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %u
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| URL (available for all titled files)
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %p
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| preview URL if basedir and preview dir are set in project settings, else identical to %u
 
|}
 
== Predefined external commands ==
 
{| style="border-spacing:0;width: 75%"
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''Name'''
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''Command'''
| style="border:0.05pt solid #000000;padding:0.097cm;"| '''Description'''


new images for man 2 are
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| chmod a+x
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| chmod a+x %f
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| File f will be executable for all users on Unix-like system.


File:Man2 preferences commands.png
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Firefox
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| firefox 'firefox '%p'&
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


File:Man2 preferences filters.png
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Chromium
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| chromium-browser '%p'&
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| The open source base for the Chrome browser.


File:Man2 preferences parsers.png
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Opera
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| opera -remote 'openURL(%p)' <nowiki>||</nowiki> opera '%p'&
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


{{toc}}
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Konqueror
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| konqueror '%p'&
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Browser for the KDE desktop environment
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Links2
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| links2 -g '%p'&
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| A text based browser
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Epiphany
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| epiphany-browser -n '%p'&
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Browser created by the GNOME project
 
|}
 
 
= External filters =
The external commands can be reached through ''Tools → Filters''.
 
== Customising external filters ==
For customising external commands you have to open the ''Preferences'' dialog either through ''Edit → Preferences'' or the ''Preferences'' button on the toolbar. Select ''External filters'' in the left panel.
 
There are three columns for editing external filters:
 
* '''Enabled:''' If this is checked, you are able to reach that filter through ''Tools → Filters''.
* '''Label:''' The name of the filter in menu.
* '''Command''': Here is the filter itself.
 
These are the options for external filters:
 
 
{| style="border-spacing:0;width: 75%"
| colspan="2"  style="border:0.05pt solid #000000;padding:0.097cm;"| '''Input options'''
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| start with a | to send the input to the standard input
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %f
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| local file name (requires local file, cannot operate on selection)
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %i
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| temporary file name for input
 
|-
| colspan="2"  style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''Output options'''
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| end with a | to read the output from the standard output
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %o
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| temporary file name
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %t
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| temporary file name for both input and output (for in-place-editing filters, cannot operate on selection)
 
|-
| colspan="2"  style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''Other options'''
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %a
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| additional arguments that will be asked when this filter is activated
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %c
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| local directory of file (requires local file)
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %n
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| file name without path (available for all titled files)
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %u
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| URL (available for all titled files)
 
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %p
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| preview URL if basedir and preview dir are set in project settings, else identical to %u
 
|}
=== Using a Python programme as an external filter ===
For this example we'll use a simplified programme to create a filename out of a short chunk of text like a title or a headline. Due to we'll have an input as well an output as pipes, we need the following basic structure:
 
<pre>import sys
a = sys.stdin.read()
 
sys.stdout.write(a)</pre>
 
Within that basic structure we include the replacements for our task:
<pre>import sys
filename = sys.stdin.read()
 
filename = filename.replace(" ", "-").lower()
filename = filename.replace("/", "-")
#Further replacements for e. g. 'ä'
 
sys.stdout.write(filename)</pre>


The External menu provides a quick access to external default or user-added programs and text filters. It is divided into three parts by default (see [[Man 2 ch08| Chapter VIII, Customising Bluefish]] for layout change):
Save this script at a suitable place and open ''Preferences'' and select ''External filters'' in the left panel to add the script to the filters list. Give the entry a suitable name like toFileName and as command
<pre>|python3 /path/to/scripts/toFileName.py|</pre>


* The Outputbox submenu for text filters. Its name is derived from the output box shown at the bottom of the document window, where you can see the output of the process, when activating it.
== Predefined external filters ==
* The Commands submenu for external programs.
* All other items are browsers. They are launched as subprocesses, hence you need to detach them to avoid freezing bluefish until the external program quits.


{| style="border-spacing:0;width: 75%"
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''Name'''
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''Command'''
| style="border:0.05pt solid #000000;padding:0.097cm;"| '''Description'''


{{note|text=Typically all programs and filters apply to the current document. Nevertheless it is possible to invoke a program without applying it to the current document. On the contrary, it is not possible to apply text filters to anything but the current document.}}
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Sort
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |sort|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| ''sort'' is a sorting program for Unix-like systems.


[[File:Man2_external_menu.png|none|frame|Bluefish External Menu]]
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Sort/Uniq
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |sort|uniq|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| ''uniq'' removes duplicates after the input is sorted by ''sort''. It is also a program for Unix-like systems included in mysys.


Customization of the External menu is performed in different parts of the Edit Preferences dialog:
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Reverse lines
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |tac|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


* Items in the Outputbox submenu in the Output parsers tab.
|-
* Items in the Commands submenu in the Utilities and filters part at the bottom of the External programs tab.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Dos2unix
* Top level items in the Browsers part at the top of the External programs tab.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |dos2unix|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Converts DOS line breaks to Unix line breaks. It is also a program for Unix-like systems included in mysys.


== 8.1. Customizing browsers ==
|-
The Browsers panel in Preferences shows the items in the same order as in the External menu:
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Tidy HTML
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |tidy -utf8|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Improves the HTML with tidy program.


[[File:Man2_preferences_browsers_panel.png|none|frame|The Browsers Panel in Preferences]]
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Tidy convert in XHTML
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |tidy -utf8 -i -w 80 -c -q -asxhtml|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Converts HTML to XHTML with tidy.


|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Tidy HTML (perltidy)
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |perltidy -b|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| (strawberry)


{{note|text=The first line in the panel will be the browser selected when clicking on the View in browser button in the main tool bar.}}
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Strip empty lines
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |egrep -v '^[ ]*$'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Deleting empty lines using regular expressions with egrep.


If you want to change the order of the browsers, apply the following steps:
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Render HTML in Text
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| lynx -force_html -dump %i |
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


'''Procedure&nbsp;VII.4.&nbsp;Changing the order of browsers items'''
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| PHP Beautifier
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |php_beautifier -t|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Improves PHP code with indentation of one tab.


# Click on the Preferences... icon in the main tool bar to access the Edit preferences panel.
|-
# Click on the External programs tab to display the Browsers panel.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Javascript Minify with jsmin
# Click near the left border of the browser's line you want to move. The whole browser's line will be highlighted: <br/> [[File:Man2_order_browsers_select.png|none|frame|Selecting the Browser's Line to be Moved]]
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |/usr/share/bluefish/jsmin.py|
# While maintaining the click, drag the selected line over another line, until you reach the place you want, so that the selected line covers entirely the latter one. The cursor will change its appearance and the dragged line will be shown as a framed line: <br/> [[File:Man2_order_browsers_drag.png|none|frame|Dragging the Browser's Line]]
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Minifies Javascript code with a Python script, which is provided by bluefish.


|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| CSS Minify with cssmin
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |/usr/share/bluefish/cssmin.py|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Minifies CSS code with a Python script, which is provided by bluefish.


{{note|text=To drag a line to the end of the list, drag it until a thin line appears below the last item: }}
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| CSS tidy
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |csstidy --preserve_css=true -|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Optimises CSS code.


[[File:Man2_order_browsers_drag_bottom.png|none|frame|Dragging the Browser's Line to the Bottom]]
|}




{{tip|text=If you change your mind, drag the line over its original place and release the mouse button. There will be no change.}}
= Output box =
The external commands can be reached through ''Tools → Outputbox''.


# Release the mouse button to drop the line at the desired place.
== Customising output box ==
# Click on the Apply button to save the change if you plan to make further changes in the panel, otherwise click on the OK button to save the change and close the Edit preferences panel.
For customising external commands you have to open the ''Preferences'' dialog either through ''Edit → Preferences'' or the ''Preferences'' button on the toolbar. Select ''Output parsers'' in the left panel.


If you want to customize one of the browsers supplied by default, use the following procedure:
There are seven columns for editing external filters:


'''Procedure&nbsp;VII.5.&nbsp;Customizing an existent browser'''
* '''Enabled:''' If this is checked, you are able to reach that command through ''Tools → Filters''.
* '''Name:''' The name of the command in menu.
* '''Pattern''': Here is a regexp pattern send with the command.
* '''File #'''
* '''Line #'''
* '''Output #'''
* '''Command: '''Here is the command.


# Click on the Preferences... icon in the main tool bar to access the Edit preferences panel.
These are the options for the output box:
# Click on the External programs tab to display the Browsers panel.
# Click on the Command region of the browser's line you want to change. The line will be hightlighted.
# Double-click on the same location to allow editing. The line will be framed.
# Make the desired change
# Click on the OK button to save and close the panel.


To add a new browser, proceed as follows:


'''Procedure&nbsp;VII.6.&nbsp;Adding a new browser'''
{| style="border-spacing:0;width: 75%"
| colspan="2"  style="border:0.05pt solid #000000;padding:0.097cm;"| '''Input options'''


# Click on the Preferences... icon in the main tool bar to access the Edit preferences panel.
|-
# Click on the External programs tab to display the Browsers panel.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |
# Click on the Add button. A new line will be shown, with an Untitled label.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| start with a | to send the input to the standard input
# Double-click on the label to allow editing, and enter the string you want to appear in the External menu.
# Double-click in the Command zone and enter the command followed by the & sign to detach it from the main bluefish process, for example:<br/> <tt>'''amaya %s &'''</tt>
# Click on the OK button to save and close the panel.


To delete a browser, just click on the Delete button.
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %f
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| local file name (requires local file, cannot operate on selection)


Though nothing impedes you to put any command (not necessary a browser) in the panel for quick access, you may want to avoid to put it at the top range, since it will be somewhat strange to click on View in browser to launch '''abs''' for example.
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %i
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| temporary file name for input


== 8.2. Customizing Commands menu ==
|-
To add items to the External → Commands submenu, you use the External programs tab of the Edit Preferences panel:  
| colspan="2"  style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''Output options'''


[[File:Man2_preferences_utilities_panel.png|none|frame|Utilities and Filters Panel in Preferences]]
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| end with a | to read the output from the standard output


You add, modify, delete, move commands or text filters the same way as described in [[Man 2 ch07s08#Section 8.1, “Customizing browsers”|Section 8.1, “Customizing browsers”]].
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %o
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| temporary file name


Bluefish will apply the supplied command on the current document, while representing the document as it is before the command is applied by <tt>%s</tt> and the document after the command has been applied by <tt>%f</tt>. Usage of the <tt>%i</tt> parameter is not implemented yet. You should embed those parameters into simple quotes to prevent special characters to be interpreted by the shell.
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %t
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| temporary file name for both input and output (for in-place-editing "filters, cannot operate on selection)


Usage of the parameters depends on the command:
|-
| colspan="2"  style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| '''Other options'''


* If the command does not operate on the file, as '''xterm''', you just supply it as you would in an xterm, detaching it to avoid bluefish freezing with:<br/> <tt>'''xterm &'''</tt>
|-
* If the command does operate on the file, but not on the file's contents, as '''chmod''', you supply it as you would in an xterm, using <tt>%s</tt> as a reference to the current document: <br/> <tt>'''chmod +x '%s''''</tt>
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %a
* If the command operates on the standard input device by default, as '''tidy''', you will have to redirect the document's contents, i.e. <tt>%s</tt>, with '''cat''' for example, to the standard output device, pipe the result so that it will be used as standard input device for the command, then redirect the result of the command to the document, i.e. <tt>%f</tt>, as in:<br/> <tt>'''cat '%s' | tidy 'someoptions' > '%f''''</tt>
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| additional arguments that will be asked when this filter is activated
* If the command operates on file's contents, as '''sed''', you should use input, i.e. <tt>%s</tt> and output, i.e. <tt>%f</tt> redirection to feed the command with the right parameters, as in:<br/> <tt>'''<nowiki>sed -e 'somesedcommand' < '%s' > '%f'</nowiki>'''</tt>


As those parameters are used internally to create temporary files, you cannot use them to modify the name of the final document for example. But you can redirect the standard output to a named file, if you do not want to override the current document, as in:
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %c
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| local directory of file (requires local file)


<tt>'''<nowiki>sed -e 'somesedcommand' < '%s' 1 > 'namedfile'</nowiki>'''</tt>
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %n
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| file name without path (available for all titled files)


Here is an example to get rid of hard-coded <tt>/usr</tt> in a source file:
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %u
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| URL (available for all titled files)


'''Procedure&nbsp;VII.7.&nbsp;Adding a Commands menu item'''
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| %p
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| preview URL if basedir and preview dir are set in project settings, else identical to %u


# Click on the Preferences... icon in the main tool bar to access the Edit preferences panel.
|}
# Click on the External programs tab to display the Utilities and filters panel.
# Click on the Add button. A new line will be shown, with an Untitled label.
# Double-click on the label to allow editing, and enter the string you want to appear in the External menu.
# Double-click in the Command zone and enter:<br/> <tt>'''<nowiki>sed -e 's|\/usr|${PREFIX}|g' < '%s' > '%f'</nowiki>'''</tt>.


== Predefined output parsers ==


{{note|text=We need to escape the slash in <tt>/usr</tt> with a backslash to avoid interpretation by the shell.}}
{| style="border-spacing:0;width: 75%"
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''Name'''
| style="border-top:0.05pt solid #000000;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| '''Command'''
| style="border:0.05pt solid #000000;padding:0.097cm;"| '''Description'''


# Click on the OK button to save and close the panel.
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| make
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |cd %c && make|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Runs the make build tool.


== 8.3. Customizing Ouputbox menu ==
|-
Items within the External → Outputbox submenu allow for programs to give feedback by opening an output box at the bottom of Bluefish's main window.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| weblint HTML-Check
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |weblint '%f'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


Here is an example showing the output box after using the External → Outputbox → tidy HTML validator item on an html file with an on purpose error:  
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| tidy HTML-Check
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |tidy -qe '%i'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


[[File:Man2_external_outputbox_example.png|none|frame|The tidy Output Box]]
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| javac
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |javac '%f'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Compiles Java code. A JDK has to be installed.


The contents of the resulting output box are based upon scanning the output of the supplied command, as it appears in an xterm, with a given regular expression and filling in the various fields of the output box with the desired parts of that regular expression. The Output parsers tab of the Edit preferences panel provides you with a model to do that:  
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| xmllint XML-Check
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |xmllint --noout --valid '%f'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


[[File:Man2_external_outputbox_preferences.png|none|frame|The Output Parsers Tab in Preferences Panel]]
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| PHP
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |php '%f'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Runs a PHP script.


The Outputbox panel comprises 7 fields:
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| PHP syntax check
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |php -l -q -f '%f'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Cecks syntax and runs the PHP script.


* The Name field, a character string which will appear as the item in the Outputbox menu.
|-
* The Pattern field, a Perl regular expression which describes the command output, so that some of its parts could be used in the following fields.<br/> Let's use an example: say you have a ruby script named foo.rb with the following line in it: <br/>  put Hello Word<br/> When executing '''ruby -d foo.rb''' in an xterm, the output is: <br/>  Exception `NoMethodError' at foo.rb:1 - undefined method `put' for main:Object<br/>  foo.rb:1: undefined method `put' for main:Object (NoMethodError)<br/> The second line can be parsed with the following Perl regular expression: <br/>  <nowiki>([a-zA-Z0-9/_.-]+):([0-9]+):(.*)</nowiki><br/> The first part embedded into parentheses will match the script name, i.e. foo.rb; the second part will match the line, i.e. 1: the third part will match the remaining. See [[Man 2 ch06s05#5.3. Find and Replace Using Regular Expressions|Section 5.3, “Find and Replace Using Regular Expressions”]] for some explanation on using regular expressions within bluefish.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| Perl syntax check
* The File # field, a part number matching the filename in the Perl regular expression given in the Pattern field. Note that the first part is numbered 1, the second 2, etc. If you do not want that the part be shown, put -1 in it.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |perl -c '%f'|
* The Line #, a part number matching the line number in the regular expression, here it will be 2, as same rules apply as in the Filename # field.
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"| Checks only the syntax of the Perl script.
* The Output # field, a part number matching the desired part in the regular expression, typically the remaining of the line, here it will be the third and last part. Again, same rules apply as in the Filename # field.
* The Command field, the command to execute on the current document, internally named %s. Here it will be: <tt>'''ruby -d '%s''''</tt>. Notice that you should embed the reference to the current document, if any, within parentheses to avoid interpretation at run time.
* The Show all output check box, which can be checked to show all output not matching the Perl regular expression. Here it is not needed, since the regular expression matches all output.


You add, modify, delete, move output boxes the same way as described in [[#8.1. Customizing browsers|Section 8.1, “Customizing browsers”]].
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| PHP Codesniffer
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |phpcs --report=emacs '%f'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


'''Procedure&nbsp;VII.8.&nbsp;Adding an Outputbox menu item'''
|-
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| pylint
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:none;padding:0.097cm;"| |pylint '%f'|
| style="border-top:none;border-bottom:0.05pt solid #000000;border-left:0.05pt solid #000000;border-right:0.05pt solid #000000;padding:0.097cm;"|


# Execute the desired command in an xterm with some error either in the command or in the file which it is applied on, in order to know how the errors are outputting.
|}
# Build a Perl regular expression based on the output, so that the filename, the line number and the error message be retrieved.
# Click on the Preferences... icon in the main tool bar to access the Edit preferences panel.
# Click on the Output parsers tab to display the Outputbox panel.
# Click on the Add button. A new line will be shown, with an Untitled label.
# Click "Add" to add a new item.
# Double-click on the Name field to give the command a name.
# Double-click on the Pattern field and fill it in with the Perl regular expression you have built previously.
# Double-click on the File # field and give the number for the subpattern matching the filename (-1 for none).
# Double-click on the Line # field and give the number for the subpattern matching the line number (-1 for none).
# Double-click on the Output # field and give the number for the subpattern matching the actual error message (-1 for none).
# Double-click on the Command field and enter the command to execute in the form '''command options '%s'''', %s being the current filename.
# Toggle the "Show all output" check box to show output NOT matching the regular expression, if needed.


{{note|text=Of course, it is also possible to add these items by editing the file named ~/.bluefish/rcfile_v2 found in the user's home directory. The fields are delimited by colons and correspond to those found in the GUI.}}




{{Man2bottom
{{Man2bottom
|prev=Man 2 ch07s07
|prev=Snippets plugin
|up=Man 2 ch07
|up=Indenting
|next=Man 2 ch08
|next=Modifying shortcut keys
|prevname= 7.&nbsp;Snippets plugin
|prevname= 7.&nbsp;Snippets plugin
|nextname= Chapter&nbsp;VIII.&nbsp;Customising Bluefish
|nextname= Chapter&nbsp;VIII.&nbsp;Customising Bluefish
}}
}}

Latest revision as of 07:37, 9 April 2021


 

External programmes can be called from within Bluefish. The currently opened file can be given as a parameter. External programmes are divided into three parts:

  1. external commands: With an external command you can just open a file in an other programme, e.g. a browser. If that programme changed the file, Bluefish will warn you some moments later.
  2. external filters: In contrast to external commands, external filters give a return value.
  3. output box: Programmes in that category opens also the output box at the bottom of Bluefish.

By default, for all three are already defined commands.

Man2 note.gif Note: The external programmes are not necessarily installed on your computer, so you may have to install them at first. Bluefish will give you a warning if that programme is not installed.

External commands[edit]

External commands are mostly browsers. The external commands can be reached through Tools → Commands. With the Preview in Browser button on the toolbar you can open the default browser, which is also an external programme.

Customising external commands[edit]

For customising external commands you have to open the Preferences dialog either through Edit → Preferences or the Preferences button on the toolbar. Select External commands in the left panel.

There are four columns for editing external commands:

  • Enabled: If this is checked, you are able to reach that command through Tools → Commands.
  • Label: The name of the command in menu.
  • Command: Here is the command.
  • Default browser: The checked programme can accessed through the Preview in Browser button at the toolbar.

These are the options for external commands:


Input options
| start with a | to send the input to the standard input
%f local file name (available for local files)
%i temporary file name for input, equals %f if the document is not modified and local
Other options
%a additional arguments that will be asked when this filter is activated
%c local directory of file (available for local files)
%n file name without path (available for all titled files)
%u URL (available for all titled files)
%p preview URL if basedir and preview dir are set in project settings, else identical to %u

Predefined external commands[edit]

Name Command Description
chmod a+x chmod a+x %f File f will be executable for all users on Unix-like system.
Firefox firefox 'firefox '%p'&
Chromium chromium-browser '%p'& The open source base for the Chrome browser.
Opera opera -remote 'openURL(%p)' || opera '%p'&
Konqueror konqueror '%p'& Browser for the KDE desktop environment
Links2 links2 -g '%p'& A text based browser
Epiphany epiphany-browser -n '%p'& Browser created by the GNOME project


External filters[edit]

The external commands can be reached through Tools → Filters.

Customising external filters[edit]

For customising external commands you have to open the Preferences dialog either through Edit → Preferences or the Preferences button on the toolbar. Select External filters in the left panel.

There are three columns for editing external filters:

  • Enabled: If this is checked, you are able to reach that filter through Tools → Filters.
  • Label: The name of the filter in menu.
  • Command: Here is the filter itself.

These are the options for external filters:


Input options
| start with a | to send the input to the standard input
%f local file name (requires local file, cannot operate on selection)
%i temporary file name for input
Output options
| end with a | to read the output from the standard output
%o temporary file name
%t temporary file name for both input and output (for in-place-editing filters, cannot operate on selection)
Other options
%a additional arguments that will be asked when this filter is activated
%c local directory of file (requires local file)
%n file name without path (available for all titled files)
%u URL (available for all titled files)
%p preview URL if basedir and preview dir are set in project settings, else identical to %u

Using a Python programme as an external filter[edit]

For this example we'll use a simplified programme to create a filename out of a short chunk of text like a title or a headline. Due to we'll have an input as well an output as pipes, we need the following basic structure:

import sys
a = sys.stdin.read()

sys.stdout.write(a)

Within that basic structure we include the replacements for our task:

import sys
filename = sys.stdin.read()

filename = filename.replace(" ", "-").lower()
filename = filename.replace("/", "-")
#Further replacements for e. g. 'ä'

sys.stdout.write(filename)

Save this script at a suitable place and open Preferences and select External filters in the left panel to add the script to the filters list. Give the entry a suitable name like toFileName and as command

|python3 /path/to/scripts/toFileName.py|

Predefined external filters[edit]

Name Command Description
Sort |sort| sort is a sorting program for Unix-like systems.
Sort/Uniq |sort|uniq| uniq removes duplicates after the input is sorted by sort. It is also a program for Unix-like systems included in mysys.
Reverse lines |tac|
Dos2unix |dos2unix| Converts DOS line breaks to Unix line breaks. It is also a program for Unix-like systems included in mysys.
Tidy HTML |tidy -utf8| Improves the HTML with tidy program.
Tidy convert in XHTML |tidy -utf8 -i -w 80 -c -q -asxhtml| Converts HTML to XHTML with tidy.
Tidy HTML (perltidy) |perltidy -b| (strawberry)
Strip empty lines |egrep -v '^[ ]*$'| Deleting empty lines using regular expressions with egrep.
Render HTML in Text lynx -force_html -dump %i |
PHP Beautifier |php_beautifier -t| Improves PHP code with indentation of one tab.
Javascript Minify with jsmin |/usr/share/bluefish/jsmin.py| Minifies Javascript code with a Python script, which is provided by bluefish.
CSS Minify with cssmin |/usr/share/bluefish/cssmin.py| Minifies CSS code with a Python script, which is provided by bluefish.
CSS tidy |csstidy --preserve_css=true -| Optimises CSS code.


Output box[edit]

The external commands can be reached through Tools → Outputbox.

Customising output box[edit]

For customising external commands you have to open the Preferences dialog either through Edit → Preferences or the Preferences button on the toolbar. Select Output parsers in the left panel.

There are seven columns for editing external filters:

  • Enabled: If this is checked, you are able to reach that command through Tools → Filters.
  • Name: The name of the command in menu.
  • Pattern: Here is a regexp pattern send with the command.
  • File #
  • Line #
  • Output #
  • Command: Here is the command.

These are the options for the output box:


Input options
| start with a | to send the input to the standard input
%f local file name (requires local file, cannot operate on selection)
%i temporary file name for input
Output options
| end with a | to read the output from the standard output
%o temporary file name
%t temporary file name for both input and output (for in-place-editing "filters, cannot operate on selection)
Other options
%a additional arguments that will be asked when this filter is activated
%c local directory of file (requires local file)
%n file name without path (available for all titled files)
%u URL (available for all titled files)
%p preview URL if basedir and preview dir are set in project settings, else identical to %u

Predefined output parsers[edit]

Name Command Description
make |cd %c && make| Runs the make build tool.
weblint HTML-Check |weblint '%f'|
tidy HTML-Check |tidy -qe '%i'|
javac |javac '%f'| Compiles Java code. A JDK has to be installed.
xmllint XML-Check |xmllint --noout --valid '%f'|
PHP |php '%f'| Runs a PHP script.
PHP syntax check |php -l -q -f '%f'| Cecks syntax and runs the PHP script.
Perl syntax check |perl -c '%f'| Checks only the syntax of the Perl script.
PHP Codesniffer |phpcs --report=emacs '%f'|
pylint |pylint '%f'|