Skip to content
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

Merged
merged 4 commits into from
Aug 22, 2017
Merged

Quick Fix Summary issues #1554

merged 4 commits into from
Aug 22, 2017

Conversation

ash0080
Copy link
Contributor

@ash0080 ash0080 commented Jul 4, 2017

  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;

2017-07-04 6 28 19

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;
Copy link
Contributor

@flaviocopes flaviocopes left a 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
@ash0080
Copy link
Contributor Author

ash0080 commented Jul 14, 2017

Sorry for my delay,
Compatible with the old version now

Copy link
Member

@rhukster rhukster left a 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.

$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())));

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.

Copy link
Contributor Author

@ash0080 ash0080 Aug 15, 2017

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

@rhukster rhukster merged commit 39af369 into getgrav:develop Aug 22, 2017
@rhukster
Copy link
Member

Thanks so much!

@ash0080
Copy link
Contributor Author

ash0080 commented Aug 23, 2017

Thank you all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants