Skip to content

Conversation

@kaffa
Copy link
Owner

@kaffa kaffa commented Jan 5, 2020

The function "replaceLinks" doesn't works if one link follows another without a white space between them, this always happens in Asia Languages, like Chinese.

So, added a char '[' to fix this.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Security fix

Description

`<?php
require '../../vendor/autoload.php';
$parser = new \Netcarver\Textile\Parser();

echo $parser->parse('
Line1. ["a1":link1] ["a2":link2]
Line2. ["a1":link1]["a2":link2]

[link1]https://alternativeto.cn
[link2]https://alternativeto.cn
');`

The function 'replaceLinks' works fine at Line1, but is breaks at line 2, because the regex matches in greedy mode. The next stop char '[' can fix this.

Checklist

  • I documented my additions and changes using PHPdoc.
  • I wrote fixtures to cover my additions.
  • $ composer update
  • $ composer test
  • $ composer cs

The function "replaceLinks" doesn't works if one link follows another without a whitespace, this always happens in Chinese Language.
Add a char '[' to fix this.
@kaffa kaffa merged commit 5178351 into master Jan 5, 2020
@kaffa kaffa changed the title Fix texttile link issue in Asia Languages. Fix textile link issue in Asia Languages. Jan 5, 2020
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.

2 participants