Support » Plugin: wp-Typography » Feature request: space before punctuation for French

  • Resolved David Latapie



    I love your plugin, I installed it in all of my blog (granted, it sometimes mess up with computer code).

    I request the following feature:
    For French, add a narrow no-break space (U+202F) before an exclamation mark or a question mark. If there is already a space, replace it.
    Code-wise, I suggest this:
    – Delimiting the perimeter: a way to ensure the element is in French. Check that either “lang” or “xml:lang” is present/inherited and that the attribute is either “fr” ou starts with “fr-“.

    – Search-replace:
    [^\u202F]([!?]) => \u202F\1 (if there is no narrow no-break space, add it)
    [\u2009 ]\u202F([!?]) => \u202F\1 (if there is a regular or thin space before the narrow no-break, delete it)
    This could probably be optimized.

    This could later be extended to more rules. I will not list them all here, one thing at a time 🙂

    Thank you for taking time to consider it.

  • The topic ‘Feature request: space before punctuation for French’ is closed to new replies.