Bug 49630

Summary: HTML Export: final <i> and <b> tags are not closed
Product: [Applications] kate Reporter: bernhardberger
Component: kwriteAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 4.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description bernhardberger 2002-10-24 16:16:59 UTC
Version:           4.0 (using KDE 3.0.4)
Compiler:          gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-112)
OS:          Linux (i686) release 2.4.18-3

I have found a bug in the export of sourcecode with syntaxhighlighting to HTML (menu File/Export/Html) in KWrite:

When the last word of your sourcecode is defined as bold or italic (f.ex. a keyword etc.), then the export forgets to close the <b> or <i> tag with an </b>, </i>, so the html code is not valid. 

Only the <span>-Tag will be closed, not <b> or <i>.
Comment 1 Hamish Rodda 2003-01-21 10:36:41 UTC
Subject: kdelibs/kate/part

CVS commit by rodda: 

Close final <b> and <i> tags on HTML Export.

Backport.

CCMAIL:49630-done@bugs.kde.org


  M +8 -1      katedocument.cpp   1.419


--- kdelibs/kate/part/katedocument.cpp  #1.418:1.419
@@ -4722,4 +4722,11 @@ bool KateDocument::exportDocumentToHTML(
     (*outputStream) << endl;
   }
+
+  // Be good citizens and close our tags
+  if (previousCharacterWasBold)
+    (*outputStream) << "</b>";
+  if (previousCharacterWasItalic)
+    (*outputStream) << "</i>";
+
   // HTML document end :
   (*outputStream) << "</span>";  // i'm guaranteed a span is started (i started one at the beginning of the output).