Filters: Auto non-breaking space filter

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.
13 sites
4 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.


Screenshot #0
Screenshot #1


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

Comments RSS

Show comments
  • Picture of Plugins bot
    Sun, Jun 28, 2015, 2:06 PM
  • Picture of David Mudrák
    Fri, Jul 3, 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!

  • Picture of Mike Carrington
    Wed, Jul 8, 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, Jul 9, 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.
  • Picture of Zdenek Pucholt
    Tue, Apr 7, 2020, 1:32 PM
    It works even in newer versions of MDL, like 3.8.2+. Perfect ;)
Please login to post comments