Break on newlines instead of showing \n.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 22 Jul 2009 17:16:24 +0000 (18:16 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 22 Jul 2009 17:16:24 +0000 (18:16 +0100)
apitrace.xsl
log.cpp

index 511e7df..698da08 100644 (file)
@@ -184,7 +184,9 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
        <xsl:template match="text()">
                <span class="lit">
-                       <xsl:value-of select="."/>
+                       <xsl:call-template name="break">
+                               <xsl:with-param name="text" select="."/>
+                       </xsl:call-template>
                </span>
        </xsl:template>
 
@@ -202,4 +204,20 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
                        </xsl:otherwise>
                </xsl:choose>
        </xsl:template>
+
+       <xsl:template name="break">
+               <xsl:param name="text" select="."/>
+               <xsl:choose>
+                       <xsl:when test="contains($text, '&#xa;')">
+                               <xsl:value-of select="substring-before($text, '&#xa;')"/>
+                               <br/>
+                               <xsl:call-template name="break">
+                                        <xsl:with-param name="text" select="substring-after($text, '&#xa;')"/>
+                               </xsl:call-template>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$text"/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </xsl:template>
 </xsl:transform>
diff --git a/log.cpp b/log.cpp
index ac1787b..97f2271 100644 (file)
--- a/log.cpp
+++ b/log.cpp
@@ -301,7 +301,7 @@ void DumpString(const char *str) {
         else if(c == '\r')
             Text("\\r");
         else if(c == '\n')
-            Text("\\n");
+            Text("&#10;");
         else {
             unsigned char octal0 = c & 0x7;
             unsigned char octal1 = (c >> 3) & 0x7;
@@ -333,7 +333,7 @@ void DumpWString(const wchar_t *str) {
         else if(c == '\r')
             Text("\\r");
         else if(c == '\n')
-            Text("\\n");
+            Text("&#10;");
         else {
             unsigned octal0 = c & 0x7;
             unsigned octal1 = (c >> 3) & 0x7;