1

I am stunned by the typogrify extension for craft. https://github.com/nystudio107/craft-typogrify

Alas, the functionalities that are most relevant to me are not kicking in (anymore). As Andrew says on https://nystudio107.com/docs/typogrify/#troubleshooting

If it doesn't look like Typogrify is doing anything to the HTML you're passing it, it is probably malformed HTML (syntax errors, missing closing tags, etc.). Fix your HTML, and Typogrify will prettify it!

Well, in my case it's not, I'm outputting a text-only-field in a completely empty page.

{{ entry.lead|typogrify|smartypants }}

Most things are working: for example (c) is replaced by ©, and I can switch it on or off with "set_smart_marks" => true,

But I can't get the Hyphenation to work:

// enables hyphenation of text
"set_hyphenation" => true,

// defines hyphenation language for text
"set_hyphenation_language" => "de-CH",

At one point, the content was full of ­s which seemed to come from Typogrify. Not anymore. Why could that be?

I don't understand where typogrify gets the hyphenation rules from: maybe it requires additional php libraries that are missing?

Also, I wonder how – when it works – to switch the hyphenation language in a multilingual site?


[SOLVED:]

Quotes to guillemets

I wanted to convert all kinds of accidental double quotes into swiss style «Guillemets» (like the french, but there's no space).

I tried:

// curl quotemarks
"set_smart_quotes" => true,

// Primary quotemarks style
// allowed values for $style
"doubleGuillemetsFrench" => "« foo »",
"set_smart_quotes_primary" => Quote_Style::DOUBLE_GUILLEMETS_FRENCH,

The reason it wouldn't work were surplus spaces in twig:

{{ entry.lead | typogrify | smartypants }}

instead of

{{ entry.lead|typogrify|smartypants }}
4
  • I'm on it... ...
    – Urs
    Commented Apr 18, 2020 at 20:23
  • I thought maybe there was a difference between my local environment and the web server. But it's behaving completely the same on local as on remote.
    – Urs
    Commented Apr 18, 2020 at 20:31
  • Can you add your solution as an official answer instead of editing the question to add it?
    – Brad Bell
    Commented Apr 20, 2020 at 5:02
  • Right; I should have made 2 questions. I hope I get the first part solved and then I‘ll add it to the solution...
    – Urs
    Commented Apr 20, 2020 at 11:31

1 Answer 1

1

Try adding/changing the hyphenation settings in the config file? e.g.

// establishes minimum length of a word that may be hyphenated
"set_min_length_hyphenation" => 5,

// establishes minimum character requirement before a hyphenation point
"set_min_before_hyphenation" => 3,

// establishes minimum character requirement after a hyphenation point
"set_min_after_hyphenation" => 2,

I ran into a similar problem. There were defaults set, but to get it to work, I had to explicitly add them to my file.

2
  • I have that in already...
    – Urs
    Commented May 1, 2020 at 18:05
  • what language are you using it with? And can you explain me how it works in the first place? I mean, is this relying on some PHP modules with hyphenation rules, or how does it do the trick? Also, is it better than browser-side hyphenation – which is superbad for German..
    – Urs
    Commented May 1, 2020 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.