Auto non-breaking space filter

Filters ::: filter_vowels
Maintained by Kamil ŁuczakKamil Łuczak
Auto change spaces after chosen one-letter conjunctions and prepositions or words into non-breaking space -   You can specify single characters and words after wchich space will be changed into non-breaking space.
Latest release:
14 sites
2 downloads
5 fans
Current versions available: 1
One-letter conjunctions and prepositions (a, i, u, w, etc.) may remain at the end of the line in continuous text, while in book titles and their chapters they should be moved to the next line.

This principle is generally known. If a one-letter conjunction or preposition (i.e. so-called orphan, pendant, or hanging conjunction), type a, i, u, w, etc., appears at the end of a line. - It is better to move it to the next line. Leaving such words at the end of the line is not a mistake, but in practice it has been accepted to always move them, not only in the titles. It simply looks more aesthetic.

This filter changes all spaces between selected single character (like `a i o u w z`) to an ` `
It is specially non-estetic on Polish sites.

So paragraph like this:

> The quick brown fox jumps over a
> lazy dog.

Will be displayed as:

> The quick brown fox jumps over
> a lazy dog.

You can also enable function that changes spaces after or/and before selected words into hard spaces.

Screenshots

Screenshot #0
Screenshot #1

Contributors

Kamil Łuczak
Kamil Łuczak (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • Plugins bot
    Sun, 28 June 2015, 2:06 PM
  • David Mudrák
    Fri, 3 July 2015, 1:43 PM

    Thanks Kamil for sharing this filter with the Moodle community. I was able to check the basic functionality and do a quick code review. It seems the current version would also process text inside the value of attributes - such as <img src="..." alt="Bolek i Lolek"> - and also, as you mention in a todo comment in the code, in javascript and other places. I am sure you will want to address this is a future update of the filter. Also, let me recommend to add unit tests your filter. You will find them really useful during further development.

    I am going to approve the plugin now. You are cleared to land, welcome to the Plugins directory!

  • Mike Carrington
    Wed, 8 July 2015, 10:24 PM
    Hi Kamil, I just wanted to ask if the filter allows you to add non-breaking spaces BEFORE certain words? I use a lot of numerical data with units (eg 1.34 kJ/mol) and it looks terrible when the units are on the next line. I tend to leave out the space, but that doesn't look right either.
  • Kamil Łuczak
    Thu, 9 July 2015, 3:52 PM
    Hi Mike, im working on next version with fixed some bugs mentioned by David. I will add feature You requested with non-breaking spaces before selected words.
    I will try to share the new version before end of weekend.
  • Zdenek Pucholt
    Tue, 7 Apr 2020, 1:32 PM
    It works even in newer versions of MDL, like 3.8.2+. Perfect ;)
  • Максим Білецький
    Fri, 12 Aug 2022, 8:55 PM
    Dzień dobry, panie Kamilu!
    Proszę pana wziąć pod uwagę, że Pana filtr w Moodle 4.0.2 + PHP 7.4 generuje wiele ekzemplarow błędu, podobnego do

    "PHP Deprecated: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in /.../filter/vowels/filter.php on line 108"

    Jeśli pan może to naprawić, będe wdzięczny o nową wersję wtyczki.
Please login to post comments