Brion VIBBER has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/85687


Change subject: bug 54473: doc fixes for HtmlFormatter
......................................................................

bug 54473: doc fixes for HtmlFormatter

Change-Id: I96d76eb2d372fb3997c432196e7c4cc4e2984bfb
---
M includes/HtmlFormatter.php
1 file changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/87/85687/1

diff --git a/includes/HtmlFormatter.php b/includes/HtmlFormatter.php
index 5f97140..99426ec 100644
--- a/includes/HtmlFormatter.php
+++ b/includes/HtmlFormatter.php
@@ -65,7 +65,11 @@
                if ( !$this->doc ) {
                        $html = mb_convert_encoding( $this->html, 
'HTML-ENTITIES', 'UTF-8' );
 
+                       // Workaround for bug that caused spaces before 
references
+                       // to disappear during processing:
                        // https://bugzilla.wikimedia.org/show_bug.cgi?id=53086
+                       //
+                       // Please replace with a better fix if one can be found.
                        $html = str_replace( ' <', '&#32;<', $html );
 
                        libxml_use_internal_errors( true );
@@ -87,7 +91,14 @@
        }
 
        /**
-        * Adds one or more selector of content to remove
+        * Adds one or more selector of content to remove. A subset of CSS 
selector
+        * syntax is supported:
+        *
+        *   <tag>
+        *   <tag>.class
+        *   .<class>
+        *   #<id>
+        *
         * @param Array|string $selectors: Selector(s) of stuff to remove
         */
        public function remove( $selectors ) {
@@ -97,6 +108,10 @@
        /**
         * Adds one or more element name to the list to flatten (remove tag, 
but not its content)
         * Can accept undelimited regexes
+        *
+        * Note this interface may fail in surprising unexpected ways due to 
usage of regexes,
+        * so should not be relied on for HTML markup security measures.
+        *
         * @param Array|string $elements: Name(s) of tag(s) to flatten
         */
        public function flatten( $elements ) {
@@ -256,6 +271,11 @@
                        $html = $this->html;
                }
                if ( wfIsWindows() ) {
+                       // Appears to be cleanup for CRLF misprocessing of 
unknown origin
+                       // when running server on Windows platform.
+                       //
+                       // If this error continues in the future, please track 
it down in the
+                       // XML code paths if possible and fix there.
                        $html = str_replace( '&#13;', '', $html );
                }
                $html = preg_replace( '/<!--.*?-->|^.*?<body>|<\/body>.*$/s', 
'', $html );

-- 
To view, visit https://gerrit.wikimedia.org/r/85687
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I96d76eb2d372fb3997c432196e7c4cc4e2984bfb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brion VIBBER <br...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to