Page MenuHomePhabricator

D10913.diff
No OneTemporary

D10913.diff

diff --git a/src/markup/engine/__tests__/remarkup/list-checkboxes.txt b/src/markup/engine/__tests__/remarkup/list-checkboxes.txt
--- a/src/markup/engine/__tests__/remarkup/list-checkboxes.txt
+++ b/src/markup/engine/__tests__/remarkup/list-checkboxes.txt
@@ -8,6 +8,8 @@
[ ] C
[ ] D
+[1] footnote
+
~~~~~~~~~~
<ul class="remarkup-list remarkup-list-with-checkmarks">
<li class="remarkup-list-item remarkup-unchecked-item"><input type="checkbox" disabled="disabled" /> a</li>
@@ -23,6 +25,8 @@
<li class="remarkup-list-item remarkup-unchecked-item"><input type="checkbox" disabled="disabled" /> D</li>
</ul></li>
</ul>
+
+<p>[1] footnote</p>
~~~~~~~~~~
[ ] a
[ ] b
@@ -33,3 +37,5 @@
[X] B
[ ] C
[ ] D
+
+[1] footnote
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupListBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupListBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupListBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupListBlockRule.php
@@ -81,8 +81,8 @@
* the stack.
*/
const MAXIMUM_LIST_NESTING_DEPTH = 12;
- const START_BLOCK_PATTERN = '@^\s*(?:[-*#]+|([1-9][0-9]*)[.)]|\[.?\])\s+@';
- const CONT_BLOCK_PATTERN = '@^\s*(?:[-*#]+|[0-9]+[.)]|\[.?\])\s+@';
+ const START_BLOCK_PATTERN = '@^\s*(?:[-*#]+|([1-9][0-9]*)[.)]|\[\D?\])\s+@';
+ const CONT_BLOCK_PATTERN = '@^\s*(?:[-*#]+|[0-9]+[.)]|\[\D?\])\s+@';
const STRIP_BLOCK_PATTERN = '@^\s*(?:[-*#]+|[0-9]+[.)])\s*@';
public function markupText($text, $children) {
@@ -234,10 +234,11 @@
$text = preg_replace(self::STRIP_BLOCK_PATTERN, '', $item);
// Look for "[]", "[ ]", "[*]", "[x]", etc., which we render as a
- // checkbox.
+ // checkbox. We don't render [1], [2], etc., as checkboxes, as these
+ // are often used as footnotes.
$mark = null;
$matches = null;
- if (preg_match('/^\s*\[(.?)\]\s*/', $text, $matches)) {
+ if (preg_match('/^\s*\[(\D?)\]\s*/', $text, $matches)) {
if (strlen(trim($matches[1]))) {
$mark = true;
} else {

File Metadata

Mime Type
text/plain
Expires
Thu, Mar 5, 6:41 PM (3 d, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8708400
Default Alt Text
D10913.diff (2 KB)

Event Timeline