TIP HyphenationPlugin is not installed on Foswiki.org.

HyphenationPlugin

Server-side hyphenation service

Description

This plugin implements hyphenation for various languages. While there are client side javascript implementations - such as HyphenatorContrib - this one here hyhpenates texts on the server side. So why implement yet another hyphenation solution? Here's why.

Hyphenator.js has recently been abandoned and succeeded by yet another javascript package hyphenopoly. Those javascript packages keep changing all too often which is a pity sometimes. The api difference between hyphenator.js and hyphenopoly are so broad that it would require a rewrite of HyphenatorContrib anyway, besides a name change of the package. So implementing another extension was inevitable anyway. HyphenatorContrib still is working just fine. Still, all client side solutions suffer from an initial flicker of the text being reformatted after hyphens have been inserted. A text being hyphenated on the backend can be cached if required and does not suffer from flickering html pages being reformatted. That might be the reason why google never really followed up on CSS Text Module Level 3 with regards to hyphenation. It simply does not provide a smooth user experience & rendering performance.

HyphenationPlugin is based on TeX::Hyphen which uses TeX hyphenation patterns available for various languages.

Usage

Text might be hyphenated using the %HYPHENATE makro.

Parameter Description Default
"...", text="..." text to be hyphenated  
lang="..." language of the text to be hyphenated CONTENT_LANGUAGE, current user's language or system default
hyphen="..." character string to be used as as separator of sylables; try hyphe="-" to make hyphenation more visible ­
minlength="..." minimum length of a string to be hyphenated 5

Alternatively, you might define a hyphenation area by surrounding text with an HTML element of class hyphenate:

<div class="hyphenate" lang="..." data-hyphen="..." data-min-length="...">
...
</div>

The optional lang and data-hyphen attributes work as described above. Note that <div class="hyphenate"> ...</div> does not apply any additional css properties by default, such as justifying the text. This is up to the Foswiki skin, or any other css class assigned to the div element.

Within a hyphenation area <pre> ...</pre> elements are not hyphenated. You might explicitly protect a part of the hyphenate area from being processed by adding a donthyphenate class to an element:

<div class="hyphenate">
...
<pre>some code</pre>
...
<h2 class="donthyphenate">Don't hyphenate this heading</h2>
...
</div>

So text in the ... areas is hyphenated but not the <pre> or <h2> element.

Examples

%HYPHENATE{"Strassenbahnschienenritzenreiniger" lang="de" hyphen="-"}%

%HYPHENATE{"Incomprehensibilities" lang="en" hyphen="-"}%

Going forward, our best-of-breed brand will deliver value to low hanging fruit. So we can hit the ground running, we will be dynamically calibrating every best practice in our space? You need to intelligently monetize your enterprises to increase your big data velocity. So we can hit the ground running, we will be dynamically calibrating every best practice in our space. You need to Our business traveller intelligently monetize your enterprises to increase your big data velocity. Reliably aligning strategically long-term propositions is crucial to our next-generation dot-bomb. Key players will take ownership of their paradigm shifts by iteratively revolutionizing actionable standpoints. So we can hit the ground running, we will be dynamically calibrating every best practice in our space?

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

NameVersionDescription
HTML::Parser>=3.72Required
TeX::Hyphen>=1.1Required

Change History

22 Jan 2024 hyphenate <p> elements as well, but not <style> and <script> elements
22 Oct 2020 initial release

PackageForm edit

Author Michael Daum
Version 1.10
Release 22 Jan 2024
Description Server-side hyphenation service
Copyright 2020-2024, Michael Daum, All Rights Reserved
License GPL (GNU General Public License)
Home http://foswiki.org/Extensions/HyphenationPlugin
Support http://foswiki.org/Support/HyphenationPlugin
Repository https://github.com/foswiki/HyphenationPlugin
ExtensionClassification Multilingual and Locality
ExtensionType PluginPackage
Compatibility
IncompatibleWith
ImageUrl
DemoUrl http://
SupportUrl HyphenationPlugin
ModificationPolicy CoordinateWithAuthor
I Attachment Action Size Date Who Comment
HyphenationPlugin.md5md5 HyphenationPlugin.md5 manage 174 bytes 22 Jan 2024 - 09:50 MichaelDaum  
HyphenationPlugin.sha1sha1 HyphenationPlugin.sha1 manage 198 bytes 22 Jan 2024 - 09:50 MichaelDaum  
HyphenationPlugin.tgztgz HyphenationPlugin.tgz manage 1 MB 22 Jan 2024 - 09:50 MichaelDaum  
HyphenationPlugin.zipzip HyphenationPlugin.zip manage 1 MB 22 Jan 2024 - 09:50 MichaelDaum  
HyphenationPlugin_installerEXT HyphenationPlugin_installer manage 12 K 22 Jan 2024 - 09:50 MichaelDaum  
Topic revision: r2 - 22 Jan 2024, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy