External Programs and Filters: Difference between revisions

From Bluefish Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 76: Line 76:


|}
|}
== Predefined external commands ==
{| style="border-spacing:0;"
| 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'''
|-
| 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.
|-
| 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 -remote 'openURL(%p)'<nowiki>||</nowiki> 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;"|
|-
| 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.
|-
| 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;"|
|-
| 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 =
= External filters =
The external commands can be reached through ''Tools → Filters''.
The external commands can be reached through ''Tools → Filters''.
Line 145: Line 191:


|}
|}
== Predefined external filters ==
{| style="border-spacing:0;"
| 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'''
|-
| 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.
|-
| 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.
|-
| 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;"|
|-
| 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: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.
|-
| 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.
|-
| 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)
|-
| 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.
|-
| 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;"|
|-
| 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.
|-
| 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
| 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|
| 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.
|-
| 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.
|}
= Output box =
= Output box =
The external commands can be reached through ''Tools → Outputbox''.
The external commands can be reached through ''Tools → Outputbox''.
Line 218: Line 340:


|}
|}
== Predefined output parsers ==
{| style="border-spacing:0;"
| 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'''
|-
| 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.
|-
| 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;"|
|-
| 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;"|
|-
| 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.
|-
| 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;"|
|-
| 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.
|-
| 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.
|-
| 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
| 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'|
| 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.
|-
| 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;"|
|-
| 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;"|
|}





Revision as of 16:59, 5 September 2015


 

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

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:


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

Name Command Description
chmod a+x chmod a+x %f File f will be executable for all users on Unix-like system.
Firefox firefox -remote 'openURL(%p)'|| 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

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:


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 external filters

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

The external commands can be reached through Tools → Outputbox.

Customising output box

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

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'|