From 6a480cf759f56ace74d50e80b166233be0cd1aa2 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Tue, 5 Aug 2014 17:15:21 -0500 Subject: [PATCH] yaml: Correctly parse Crowdin-created YAML Crowdin recreates YAML files with indent specifications which Spyc does not currently handle: body: |2 body contents written here with 2 leading spaces This is part of the Yaml spec after 1.0 backportme --- include/Spyc.php | 9 ++++++--- scp/css/scp.css | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/Spyc.php b/include/Spyc.php index 17d67db3e..1c0fc31a8 100644 --- a/include/Spyc.php +++ b/include/Spyc.php @@ -863,9 +863,12 @@ class Spyc { } function startsLiteralBlock ($line) { - $lastChar = substr (trim($line), -1); - if ($lastChar != '>' && $lastChar != '|') return false; - if ($lastChar == '|') return $lastChar; + $matches = array(); + if (!preg_match('`(>|\|)[\d+-]?$`', $line, $matches)) + return false; + + $lastChar = $matches[1]; + // HTML tags should not be counted as literal blocks. if (preg_match ('#<.*?>$#', $line)) return false; return $lastChar; diff --git a/scp/css/scp.css b/scp/css/scp.css index f52ab06aa..d608875c2 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1340,7 +1340,7 @@ time { overflow-y: auto; } -.dialog .popup-loading { +.dialog #popup-loading { position:absolute; text-align:center; background:rgba(255,255,255,0.8); -- GitLab