-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Quick Fix Summary issues #1554
Quick Fix Summary issues #1554
Conversation
ash0080
commented
Jul 4, 2017
- Calculate the string size without any html tags, so now you can get exactly what you wanted length;
- Support utf8 2 character widths characters, like Chinese, Japanese;
- This is a quick dirty mod, some associated functions should be rethinked;
1. Calculate the string size without any html tags, so now you can get exactly what you wanted length; 2. Support utf8 2 character widths characters, like Chinese, Japanese; 3. This is a quick dirty mod, some associated functions should be rethinked;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick note: please try to adhere to the code formatting used in Grav - appropriate use of spaces (we follow http://www.php-fig.org/psr/psr-2/) - and do not commit commented lines of code (// return Truncator::truncateLetters($text, $length, $ellipsis);
)
Now, you can use page.summary(10) as normal, or page.summary(10, true) to ignore all html tags and medias
Sorry for my delay, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still going to fail our PHP formatting checks. This needs to be in PSR2 standards. That means spaces between operators and other formatting rules.
system/src/Grav/Common/Page/Page.php
Outdated
$filename = substr($this->name, 0, -(strlen($this->extension()))); | ||
$config = Grav::instance()['config']; | ||
$languages = $config->get('system.languages.supported', []); | ||
$filename = substr($this->name, 0, -(strlen($this->extension()))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why all the extra space? it was fine before. if you do not know exactly what psr2 is then read up on it http://www.php-fig.org/psr/psr-2/ to ease your work you can install some linters for php aswell as. https://github.com/squizlabs/PHP_CodeSniffer and https://phpmd.org/ are useful. If you are using phpstorm you can easily set up code style and lint automatically from Code->Reformat code. Then you do not have to guess what is wanted from you and let the tools point it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I use Reformat in PhpStorm with the exact PSR-1&PSR-2 style predefined,
but seems not same as original codes,
I will clean them manually for the next update
Thanks so much! |
Thank you all! |