Conversation
add 'G' option to Readme
|
You probably didn't notice that if you worked from the SmartyPantsTypographer class most of that work was already done. In that class those variable already exist: I admit the current way things are setup with the I think your 'G' option is a good idea. But:
|
Actually, I am quite confused why the file contains two full implementations of the same functionality. Many functions (like
Well, you're right. That list is ... extensive. In my case, I'm using SmartyPants as part of Grav CMS, serving a website in German language. $page->setRawContent(\Michelf\SmartyPants::defaultTransform(
$page->getRawContent(),
$config->get('options')
));So in order to get my German quotes, I edited the above class in SmartyPants.php |
|
The reason the two classes exist is that I wanted to preserve the original PHP SmartyPants as it was (similar to John Gruber's SmartyPants) and put everything new in a separate class. The Typographer version replaces many spaces with non-breaking spaces by default, and I didn't want to force that behaviour on existing users of SmartyPants. Similarly, the When it comes to configuring the quotes, I agree it'd make a bit more sense to put the configuration variables inside of the And also, if you want to remove the I'm not sure what would be the best way to get the quote configuration within Grav. But doing something like this would seem to make much sense: $parser = new \Michelf\SmartyPants($config->get('options'));
$parser->smart_doublequote_open = "„"; // get quote config from somewhere
$parser->smart_doublequote_close = "“"; // get quote config from somewhere
$page->setRawContent($parser->transform($page->getRawContent())); |
jnncks
left a comment
There was a problem hiding this comment.
As much as I'd appreciate support of German quotes out of the box, there are a few flaws with the characters you're using. The closing quote characters are not the correct ones, take a look at Wikipedia: https://en.wikipedia.org/wiki/Quotation_mark#German
Also, the apostrophe is unfortunately a separate character (basically a raised comma): https://de.wikipedia.org/wiki/Apostroph
The configuration option 'G' can be set to use „German“ quotes instead of "English" quotes.