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
  • 7 months later...
Posted

Update: Custom Option – v 1.1.0

A while back, a kind soul forked this module to add Polish quotation marks. Small plot twist: Polish primary quotes are typographically identical to German ones („...“) – so the fork mostly added the word "Polish" to the dropdown. Hats off to the spirit, though. 🇵🇱🇩🇪

image.thumb.png.6a419729a42381abda6e9ca795ed8ac0.png

Taking the hint, we've now added a Custom option: pick it in the module config and you get two extra text fields where you define your own opening and closing characters. No more forking required when none of the presets fit — Polish, Klingon, or otherwise. 😉

Cheers, Mike

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...