Changeset View
Changeset View
Standalone View
Standalone View
src/parser/PhutilBugtraqParser.php
<?php | <?php | ||||
/** | /** | ||||
* Replaces ticket or issue IDs in a block of text with links. This mechanism | * Replaces ticket or issue IDs in a block of text with links. This mechanism | ||||
* is based on (and compatible with) the Bugtraq system in TortiseSVN. See | * is based on (and compatible with) the Bugtraq system in TortiseSVN. See | ||||
* | * | ||||
* http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-bugtracker.html | * http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-bugtracker.html | ||||
* | * | ||||
* For example, to link ticket IDs formatted like this: | * For example, to link ticket IDs formatted like this: | ||||
* | * | ||||
* Issues: 123, 345 | * Issues: 123, 345 | ||||
* | * | ||||
* ...you can use: | * ...you can use: | ||||
* | * | ||||
* $message = id(new PhutilBugtraqParser()) | * $message = (new PhutilBugtraqParser()) | ||||
* ->setBugtraqPattern('http://bugs.com/%BUGID%') | * ->setBugtraqPattern('http://bugs.com/%BUGID%') | ||||
* ->setBugtraqCaptureExpression('/[Ii]ssues?:?(\s*,?\s*#\d+)+/') | * ->setBugtraqCaptureExpression('/[Ii]ssues?:?(\s*,?\s*#\d+)+/') | ||||
* ->setBugtraqSelectExpression('/(\d+)/') | * ->setBugtraqSelectExpression('/(\d+)/') | ||||
* ->processCorpus($message); | * ->processCorpus($message); | ||||
* | * | ||||
* This will produce: | * This will produce: | ||||
* | * | ||||
* Issues: http://bugs.com/123, http://bugs.com/345 | * Issues: http://bugs.com/123, http://bugs.com/345 | ||||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0