Skip to content

Commit

Permalink
Add new rules for typo
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdesign committed Dec 23, 2021
1 parent 9c47fbd commit f02e208
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions packages/lib_jusebcck/src/Utils/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function table($html, $class, $clean = 1)
*
* @since 1.0
*/
public static function typo($html, $type = 1)
public static function typo($html, int $type = 1)
{
$html = self::clean($html);

Expand All @@ -55,18 +55,34 @@ public static function typo($html, $type = 1)
$typograf->setup([
'Text.paragraphs' => 'off',
'Text.breakline' => 'off',
'Text.no_repeat_words' => 'off',
'OptAlign.all' => 'off',
'OptAlign.layout' => 'off',
'Nobr.super_nbsp' => 'off',
'Nobr.spaces_nobr_in_surname_abbr' => 'off',
'Nobr.nbsp_in_the_end' => 'off',
'Nobr.phone_builder' => 'off',
'Nobr.phone_builder_v2' => 'off',
'Nobr.ip_address' => 'off',
'Nobr.dots_for_surname_abbr' => 'off',
'Nobr.nbsp_celcius' => 'off',
'Nobr.hyphen_nowrap_in_small_words' => 'off',
'Abbr.nobr_abbreviation' => 'off',
'Nobr.hyphen_nowrap' => 'off',
'Punctmark.fix_pmarks' => 'off',
'Punctmark.fix_excl_quest_marks' => 'off',
'Punctmark.dot_on_end' => 'off',
'Space.bracket_fix' => 'off',
'Abbr.nobr_vtch_itd_itp' => 'off',
'Abbr.nobr_sm_im' => 'off',
'Abbr.nobr_acronym' => 'off',
'Etc.unicode_convert' => 'off',
'Etc.split_number_to_triads' => 'off'
'Abbr.nobr_locations' => 'off',
'Abbr.nobr_abbreviation' => 'off',
'Abbr.ps_pps' => 'off',
'Abbr.nbsp_org_abbr' => 'off',
'Abbr.nobr_gost' => 'off',
'Abbr.nobr_before_unit_volt' => 'off',
'Abbr.nbsp_before_unit' => 'off',
'Etc.unicode_convert' => 'off'
]);

$result = $typograf->apply();
Expand Down Expand Up @@ -107,12 +123,7 @@ public static function breakdown($html, $count = 100)
$intro = $matches[ 0 ];
}

$full = str_replace([
strip_tags($intro),
$intro
], '', $html);

$full = str_replace('</p>', '', $full);
$full = str_replace([ strip_tags($intro), $intro, '</p>' ], '', $html);

return (object) [
'intro' => $intro,
Expand Down

0 comments on commit f02e208

Please sign in to comment.