Jump to content

Recommended Posts

Posted

Hi everyone,
we’d like to share a small but handy module we developed at frameless Media: TextformatterSmartQuotes.


🧠 The Problem

While working on a client project, we needed to replace straight quotes ("...") with typographic quotes (like „...“) — but only in the visible text content, not inside HTML tags or attributes.

Using the TextformatterFindReplace module, a case like this:

<strong style="font-size: 18px;">Improved "well-being"</strong>

would turn into:

<strong style=„font-size: 18px;“>Improved „well-being“</strong>

which breaks the HTML.

We tried solving it with regular expressions, but none proved reliable enough. Every approach either failed to match all valid cases or accidentally modified tag attributes. That’s when we decided to build a dedicated solution.


Our Solution

TextformatterSmartQuotes is a Textformatter that replaces quotes only in visible text, leaving HTML markup untouched.
It supports the following quote styles:

  • German: „…“
  • English: “…”
  • French: « … »

The quote style can be selected in the module’s settings.


📦 Installation

  1. Place the module in /site/modules/TextformatterSmartQuotes/.
  2. Install it via the Modules admin interface.
  3. Assign it to any text/textarea/CKEditor field under “Text formatters”.
  4. Configure your preferred quote style if needed.

This module helped us avoid fragile regex workarounds and keeps content formatting clean and reliable. Feel free to use, improve, or contribute to it.
You can download it on GitHub or via the Modules Directory

We’re happy to hear your feedback!
Cheers, Mike 

 

  • Like 9

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...