fabianmichael / kirby-typography

Typographic enhancements for your Kirby-driven website.
GNU General Public License v3.0
78 stars 4 forks source link

'typography.punctuation.spacing.french' doesn't work on « » #8

Closed fvsch closed 8 years ago

fvsch commented 8 years ago

Hi, it's me again. "Noooo, not them again." Sorry. :D

Okay, so this might be a problem upstream in php-Typography.

Provided the following input:

Les « courants de bord ouest » du Pacifique ?
Eh bien : ils sont "fabuleux".

and using the smartypants function or kirbytext method on this input, the result is:

 Les « courants de bord ouest » du Pacifique ?
Eh bien : ils sont « fabuleux ».

config is:

// config/config.php
c::set([
    'smartypants' => true,
    'typography' => true,
    'typography.style.punctuation.hanging' => false,
    'typography.style.quotes.initial' => false,
    'typography.hyphenation' => false,
]);

// languages/fr.php
l::set('typography.punctuation.spacing.french', true);
l::set('typography.quotes.primary', 'doubleGuillemetsFrench');
l::set('typography.quotes.secondary', 'doubleCurled');

Ideally, I would like the typography.punctuation.spacing.french setting to deal with « » quotes in the same way it deals with ?!:;, i.e. to transform «\s+ to «  and \s+» to  ». Since it's a setting for French, there should be no doubt whether » is a closing or opening quote (it's a closing quote).

Do you think that's a limitation of php-Typography that I should bring up with them?

fabianmichael commented 8 years ago

Bonjour encore! C'ést une problème de PHP-Typography … (okay, it has been a while since I’ve been talking or writing French … ;-) )

Basically, Kirby-Typography is a port of the wp-Typography, so you should open an issue in that repository in this case.

fabianmichael commented 8 years ago

But If you encounter any issues with my plugin, free to discuss them here :-)

mundschenk-at commented 8 years ago

So you would like to have Les « courants ... as the output? Generally, PHP_Typography tries not to interfere with any "smart quotes" that are already present in the text, on the assumption that if they are there, the content writer intended them exactly like this.

fabianmichael commented 8 years ago

Makes sense, I agree here with @mundschenk-at on this. Otherwise, you could end with a lot of unexpected behaviour. Think, it should stay like that.

@fvsch If this is really an issue, you should be able to fix it with a kirbytext::$post filter.

fvsch commented 8 years ago

If this is really an issue, you should be able to fix it with a kirbytext::$post filter.

Yes, it's a real issue we have on a project with 80 articles or pages being copied over from simple Word documents. Quotation marks in those documents are always « quoted text », as is the default for Word set up with French settings.

I have no problem with writing a fix on our side (already did this in the project), but I do believe it should be a part of PHP_Typography, so I've argued my point over there. :)

mundschenk-at commented 8 years ago

I've just added a branch that includes a fix for this issue.