Page MenuHomePhabricator

D8954.id21246.diff
No OneTemporary

D8954.id21246.diff

diff --git a/src/markup/engine/PhutilRemarkupEngine.php b/src/markup/engine/PhutilRemarkupEngine.php
--- a/src/markup/engine/PhutilRemarkupEngine.php
+++ b/src/markup/engine/PhutilRemarkupEngine.php
@@ -5,7 +5,7 @@
const MODE_DEFAULT = 0;
const MODE_TEXT = 1;
- const MAX_CHILD_DEPTH = 8;
+ const MAX_CHILD_DEPTH = 32;
private $blockRules = array();
private $config = array();
diff --git a/src/markup/engine/__tests__/remarkup/quotes.txt b/src/markup/engine/__tests__/remarkup/quotes.txt
--- a/src/markup/engine/__tests__/remarkup/quotes.txt
+++ b/src/markup/engine/__tests__/remarkup/quotes.txt
@@ -2,8 +2,9 @@
> I am utterly disgusted with the quality
> of your inflight food service.
~~~~~~~~~~
-<blockquote><p>Dear Sir,<br />I am utterly disgusted with the quality<br />of your inflight food service.</p></blockquote>
+<blockquote><p>Dear Sir,
+ I am utterly disgusted with the quality
+ of your inflight food service.</p></blockquote>
~~~~~~~~~~
-> Dear Sir,
-> I am utterly disgusted with the quality
-> of your inflight food service.
+> Dear Sir, I am utterly disgusted with the quality of your inflight food service.
+
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineBlockRule.php
@@ -89,7 +89,7 @@
}
public function extractChildText($text) {
- throw new Exception(pht('Not implemnted!'));
+ throw new Exception(pht('Not implemented!'));
}
protected function renderRemarkupTable(array $out_rows) {
diff --git a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupQuotesBlockRule.php b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupQuotesBlockRule.php
--- a/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupQuotesBlockRule.php
+++ b/src/markup/engine/remarkup/blockrule/PhutilRemarkupEngineRemarkupQuotesBlockRule.php
@@ -1,44 +1,43 @@
<?php
-/**
- * @group markup
- */
final class PhutilRemarkupEngineRemarkupQuotesBlockRule
extends PhutilRemarkupEngineBlockRule {
public function getMatchingLineCount(array $lines, $cursor) {
- $num_lines = 0;
+ $pos = $cursor;
- if (preg_match("/^>/", $lines[$cursor])) {
- $num_lines++;
- $cursor++;
+ if (preg_match('/^>/', $lines[$pos])) {
+ do {
+ ++$pos;
+ } while (isset($lines[$pos]) && preg_match('/^>/', $lines[$pos]));
+ }
+
+ return ($pos - $cursor);
+ }
- while (isset($lines[$cursor])) {
- if (strlen(trim($lines[$cursor]))) {
- $num_lines++;
- $cursor++;
- continue;
- }
+ public function supportsChildBlocks() {
+ return true;
+ }
- break;
- }
+ public function extractChildText($text) {
+ $text = phutil_split_lines($text, true);
+ foreach ($text as $key => $line) {
+ $text[$key] = substr($line, 1);
}
- return $num_lines;
+ return array('', implode('', $text));
}
public function markupText($text, $children) {
- $lines = array();
- foreach (explode("\n", $text) as $line) {
- $lines[] = $this->applyRules(preg_replace('/^>\s*/', '', $line));
- }
-
if ($this->getEngine()->isTextMode()) {
+ $lines = phutil_split_lines($children);
return '> '.implode("\n> ", $lines);
}
- return hsprintf(
- '<blockquote><p>%s</p></blockquote>',
- phutil_implode_html(phutil_tag('br'), $lines));
+ return phutil_tag(
+ 'blockquote',
+ array(),
+ $children);
}
+
}

File Metadata

Mime Type
text/plain
Expires
Fri, Oct 18, 12:28 AM (4 w, 2 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6724114
Default Alt Text
D8954.id21246.diff (3 KB)

Event Timeline