I'm searching for a way or module, which replaces wrong used glyphs with the correct ones (what Typography teaches). For those characters, that we can't access directly with standard keyboards. Examples:
(conditional on the language)
replace "..." with the ellipsis "…"
replace "-" with the dash "–" (where needed)
use the correct apostoph,
use the correct quotation marks,
and so on
So let's say, if the language is set to German and an user types:
"Lorem Ipsum"
it should automatically (after submitting) be replaced with
„Lorem Ipsum“
As far as I know the CMS "Textpattern" has this feature (I don't know if it's conditional on Textile or an independet implementation). A method, where the users would have to type "--" for a dash or something like that would be okay. But I'd prefer an automatic method, because many users don't know about typography.
Comments
Try
Try http://drupal.org/project/marksmarty
There is also http://drupal.org/project/typogrify but I don't see it updated for Drupal 6. There are however some D6 patches in its issues queue.
Before doing any of that make sure that your database has a consistent utf8 character set and collation throughout.
Try
Would I have to use this special syntax, so that the glyphs are replaced correctly, or can I use it with filtered HTML or BBCode or something else?
If I understand it right, typogrify is only the part of marksmarty, that I search (and markdown is the module, which provides the new syntax). That would be cool. But I'd have to wait for an official Drupal 6 release.
Do you know, how I can check this?
marksmarty works fine in
marksmarty works fine in D6... you can enable just the SmartyPants portion of it (the typographic features) and leave MarkDown off. Turn on the "Markdown with SmartyPants" filter in your Filtered HTML input format. Then click the Configure tab and expand the "Markdown with SmartyPants" fieldset. Set Enable MarkDown to No, and Enable SmartyPants to Yes.
On the other hand there are D6 patches waiting for review for Typogrify module. If you eventually change from MarkSmarty to Typogrify when it's updated, should be seamless.
-- David
absolutecross.com
[new guide/lesson in progress: Creating a CCK and Views powered Drupal site - feedback welcome]
-- David
davidnewkerk.com | absolutecross.com
View my Drupal lessons & guides
Obviously markdown and
Obviously markdown and smartypants are two separate functions of the first module, so you don't need to use the markdown markup, only smartypants' notation (http://daringfireball.net/projects/smartypants).
Typogrify works in a more automated way, without special notation. If you can't apply the submitted patches yourself then you must either read about it in the handbook or wait for a D6 release.
My last comment was because as long as you only have standard English characters some inconsistencies don't matter much, but as soon as you start introducing special Unicode characters you need to check your database with phpmyadmin and make sure that the charset/collation of all your database tables is "utf8_general_ci" everywhere (and not "latin1" or anything else).
Note that Typogrify:
Note that Typogrify: http://drupal.org/project/typogrify has been updated to Drupal 6, so I'd recommend using that, possibly in combination with Markdown
Wordfilter
I use worldfilter, and it does exactly this! Plus, you don't have to rely on special syntax, it just works. If you use a syntax which make special use of some of the strings (like the
pretag Mediawiki-style, which starts with a space), just disable the filtering for this special markup. Sadly, it is not possible to selectively disable filters.My settings (for French -- I used non-breaking space instead on thin space because the thin space is, sadly, breakable):
" !" to " !"
" :" to " :"
" ;" to " ;"
" ?" to " ?"
"« " to "« "
" »" to " »"
"'" to "’"
"..." to "…"
Do not check "Stand-alone" and do not forget the space before the character to be filtered or you would have nasty surprises. This is not code-proof, since a character string stating or ending with a space would be filtered in programming. Using regexp fixes the issue but is very ressources-consuming.
I also installed Typogrify and I did not notice any conflict between the two. They are complementary, but Typogrify is geared toward English language (for instance, curly quotes as opposed to French quotes)
How to add non-breaking spaces in wordfilter
Well, after searching around to fix this exact problem (my site is in french and I want the same words filtered — mainly to add non-breaking spaces instead of breaking spaces before punctuation, etc.), I found this post and it worked for me.
For anyone in the same situation, just be careful when entering the words to be filtered. For example, in the box to add words, if you want "!" replaced by " !" (with a non-breaking space), you have to make the non-breaking space by pressing left Alt key and press 0160 on the numpad — then release Alt.
Just to avoid confusion for beginners like me.
And thanks a lot for the information!
Talked too fast
Okay, seems I talked too fast. It doesn't exactly work correctly. Actually, it mostly works, but for certain symbols it either doesn't work or does something very strange.
For example, if I add a filter to change ";" into " ;", it does something quite strange.
Take the first sentence of last post on my website: "J'ai noté cela tout juste après avoir mis en ligne le texte sur Black Swan. Puis, j'ai fait autre chose, attendu. Je le publie maintenant — avec d'autres notes plus simples les unes que les autres." (in french, sorry.)
Then I add the filter ";| ;", and first sentence is now: "J' ;ai noté ; cela tout juste aprè ;s avoir mis en ligne le texte sur Black Swan. Puis, j' ;ai fait autre chose, attendu. Je le publie maintenant — ; avec d' ;autres notes plus simples les unes que les autres."
There are ";" symbols everywhere?! There isn't supposed to be anything filtered in this sentence... I don't understand at all why it does this, so for now I'll forget about this filter.
Lastly, filters "«|« " and "»| »" seem to have no effect on the text... It works in test mode though: "Your test word '«bleah»' was filtered to '« bleah »'" But not on the actual site.
If anyone has some clues about how to fix this, I would greatly appreciate it.
Thanks again!