Hanging Conjunctions Filter Guide
Problem/Motivation
Dangling conjunctions, also known as orphans, are a typographical error in the Polish language. They are single-letter words left at the end of a line. This rule applies to, for example, conjunctions and prepositions.
Functionality
This module provides a text filter that moves dangling conjunctions from the end of each line. It contains its own set of words specific for Polish typography. It automatically adds a non-breaking space to the text where necessary.
This module skip ignore tags (a|script|style|code|pre
) and add a non-breaking space to the text where necessary. No attributes are processed.
Configuration
- Go to 'Text formats and editors' on the page '/admin/config/content/formats'.
- Add a new text format or edit an existing one.
- In the chosen text format, select the 'Hanging Conjunctions Filter' option.
- Change its order on the list. It should be after other filters that need to be processed before.
- Click on the 'Save configuration' button.
Notice: The Hanging Conjunctions Filter should be triggered after the 'Correct faulty and chopped off HTML' or 'No Non-breaking Space Filter' if they are selected.
API and extending a module
By default this filter is only for Polish language. Allows to add terms for any languages.
/**
* Add terms for any languages.
*
* @param array $terms
* An associated array of key langcode and array of terms.
*/
function hook_hanging_conjunction_filter_terms_alter(array &$terms) {
// Add an additional terms for the Polish language.
array_push($terms['pl'], 'xyz');
// Add terms for the Czech language.
$terms['cs'] = [
'[a-z]',
];
}
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion