Automatically hyphenates text
This is a jQuery plugin integrating
Hyphenator.js by Mathias Nater.
Hyphenator.js ...
- automatically hyphenates texts on websites
- runs on any modern browser that supports JavaScript and the soft hyphen ().
- automatically breaks URLs on any browser that supports the zero width space.
- runs on the client in order that the HTML source of the website may be served clean and svelte and that it can respond to text resizings by the user.
- follows the ideas of unobtrusive JavaScript.
- has a documented API and is highly configurable to meet your needs.
- supports a wide range of languages.
- relies on Franklin M. Liangs hyphenation algorithm (PDF) commonly known from LaTeX and OpenOffice.
- is free software licensed under LGPL v3 with additional permission to distribute non-source (e.g., minimized or compacted) forms of that code (see source code header for details).
Supported languages are:
- Armenian (Sahak Petrosyan)
- Belarusian (Olexandr Zhydenko)
- Catalan (Jordi Rosell)
- Church Slavonic (Aleksandr Andreev and Mike Kroutikov)
- Czech (Martin Hasoň)
- Danish (Henrik Ryom)
- Dutch (Remco Bloemen)
- English (US and GB)
- Esperanto (Sergio Pokrovskij)
- Estonian (Enn Saar and Peeter Marvet)
- Finnish (Olli Wilkman)
- French
- Georgian
- German
- Greek, monoton, polyton and ancient (Pablo Rodríguez)
- Hungarian (Péter Nagy)
- Irish (Kevin Scannell)
- Italian (Stefano Gorini)
- Latin (Pablo Rodríguez)
- Latvian (Kristaps Karlsons)
- Lithuanian (Rogutės Sparnuotos)
- Malayalam, Tamil, Hindi, Oriya, Kannda, Telugu, Bengali, Gujarati and Panjabi (Santhosh Thottingal)
- Norwegian (Erik Erik Seierstad)
- Polish (Kamil)
- Portuguese (Lailson Bandeira)
- Romanian (irragal)
- Russian (Dmitry Vedernikov)
- Serbian Latin script (Sonja Keljevic)
- Slovak (Zdenko Podobný)
- Slovenian (Mojca Miklavec)
- Spanish (Luis Pabón)
- Swedish (Andreas Johansson)
- Turkish (Andreas Lappe)
- Ukrainian (Alexey Grekov)
A custom jQuery adapter makes sure text loaded asynchronously is processed later on.
The default language is derived reading the language information of the html page as generated by your foswiki language settings.
Further more, specific parts of a page can be processed using different langugage patterns using an iso-639-1 language tag, e.g.
<div lang="en-gb">
This part is processed using the british hyphenation patterns.
</div>
For further information see
http://code.google.com/p/hyphenator/
Usage
To load the hyphenator into the current page use
%JQREQUIRE{"hyphenator"}%
Then add the
.hyphenate
class name to those html elements that contain text to be hyphenated.
Use
.donthyphenate
to exclude areas from being processed. The language used for processing the
text is extracted from the html language settings.
<div class="hyphenate" style="text-align:justify">
This text is processed by Hyphenator.js
<div class="donthyphenate">
This text is _excluded_ from hyphenation
</div>
</div>
This text is _not_ processed.
<div class="hyphenate">
This text is processed as well.
</div>
<div class="hyphenate" lang="de">
Dieser Text wird mit deutscher Silbentrennung verarbeitet.
</div>
Installation Instructions
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -> "Install, Update or Remove extensions" Tab. Click the "Search for Extensions" button.
Enter part of the extension name or description and press search. Select the desired extension(s) and click install. If an extension is already installed, it will
not show up in the
search results.
You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install
If you have any problems, or if the extension isn't available in
configure
, then you can still install manually from the command-line. See
https://foswiki.org/Support/ManuallyInstallingExtensions for more help.
Dependencies
Name | Version | Description |
---|
Foswiki::Plugins::JQueryPlugin | >=4.10 | Required. |
Copyright
Change History
17 Jul 2018: |
(5.00) updated to hyphenate 5.3.0 |
02 Sep 2016: |
(4.00) updated to hyphenate 5.1.0 |
28 Aug 2014: |
(3.02) use https by default talking to google |
15 Mar 2014: |
(3.01) fixed syntax error in contrib stub |
07 Nov 2013: |
(3.00) upgraded to Hyphenator-4.2.0 |
09 Aug 2011: |
(2.00) upgraded to Hyphenator-4.0.0 |
10 Jun 2011: |
(1.01) recognize language tags using underscores as well as hyphens |
06 Jun 2011: |
(1.0) initial release of foswiki plugin |