Просмотр исходного кода

verify Allow apostrophes for now

This is a touchy subject, but there are so many frameworks
that use third-party libraries for escaping html entities
and not all of them agree on apostrophes. To ease the
transition, I am going to simply allow apostrophes FOR NOW.

I may (read: likely will) make escaping apostrophes in the
fortunes test mandatory in the future.
Mike Smith 11 лет назад
Родитель
Сommit
4f3ae97a01

+ 1 - 1
php-phalcon-micro/views/layouts/bench.volt

@@ -1 +1 @@
-<!DOCTYPE html><html><head><title>Fortunes</title><meta charset="utf-8"></head><body>{{ content() }}</body></html>
+<!DOCTYPE html><html><head><title>Fortunes</title></head><body>{{ content() }}</body></html>

+ 4 - 1
toolset/benchmark/fortune_html_parser.py

@@ -70,7 +70,10 @@ class FortuneHTMLParser(HTMLParser):
   # are also the "<title>" and "</title>" tags.
   def handle_data (self, data):
     if data.strip() != '':
-      self.body.append("{d}".format(d=data))
+      # TODO: decide whether this is worth it or not...
+      # not all frameworks/libs agree on escaping
+      # apostrophes, so let's just allow them for now.
+      self.body.append("{d}".format(d=data.replace('\'','&apos;')))
 
   # This is called every time a tag is closed. We append
   # each one wrapped in "</" and ">".