Skip to content

Commit

Permalink
Support including textile escape sequences inside link title attribute
Browse files Browse the repository at this point in the history
Closes #223
  • Loading branch information
gocom committed Jan 2, 2024
1 parent b184743 commit 31e0df6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.textile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Here's a summary of changes in each release. The list doesn't include some small
h2. Version 4.1.0 - upcoming

* Support @:@ and @!@ characters in CSS class names (closes "#224":https://github.com/textile/php-textile/issues/224).
* Support including textile escape sequences inside link title attribute (closes "#223":https://github.com/textile/php-textile/issues/223).

h2. "Version 4.0.0 - 2022/12/03":https://github.com/textile/php-textile/releases/tag/v4.0.0

Expand Down
5 changes: 4 additions & 1 deletion src/Netcarver/Textile/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* Additions and fixes Copyright (c) 2010-17 Netcarver https://github.com/netcarver
* Additions and fixes Copyright (c) 2011 Jeff Soo http://ipsedixit.net/
* Additions and fixes Copyright (c) 2012 Robert Wetzlmayr http://wetzlmayr.com/
* Additions and fixes Copyright (c) 2012-19 Jukka Svahn http://rahforum.biz/
* Additions and fixes Copyright (c) 2012-24 Jukka Svahn https://rahforum.biz/
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -1981,6 +1981,9 @@ public function parse($text)
$text = $this->retrieveTags($text);
$text = $this->retrieveURLs($text);

// Replace shelved instances that were inside tag and link attributes.
$text = $this->retrieve($text);

$text = str_replace($this->getLineBreak(), $this->getLineBreak()."\n", $text);

return $text;
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/issue-223.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Support including escape sequences in titles:
input: |
"lorem(dolor ==@== sit)":#ipsum
expect: |
<p><a href="#ipsum" title="dolor @ sit">lorem</a></p>

0 comments on commit 31e0df6

Please sign in to comment.