[cfe-dev] Adding title in HTML report

Jean-Daniel Dupas devlists at shadowlab.org
Fri Jul 4 02:14:28 PDT 2008


Hello,

I'm think it may be convenient to update the HTMLRewriter to support a  
<title> in the header.

When I read a static report result page, I have to scroll to the top  
of the page to find the file name. If we put the filename into the  
html title field, the browser will display it in the window title.

So I think we can update the HTMLRewriter,  
AddHeaderFooterInternalBuiltinCSS method to accept an optional title  
string.

void html::AddHeaderFooterInternalBuiltinCSS(Rewriter& R, unsigned  
FileID, const char *title = NULL)

But after, what is the recommanded way to compose the header.

will something like this be fine (using a ostringstream) ? I also  
attach a patch that implements this change.

------------------------------------------------
   std::ostringstream os;
   os << "<!doctype html>\n" // Use HTML 5 doctype
         "<html>\n<head>\n";

   if (title)
     os << "<title>" << html::EscapeText(title) << "</title>\n";

   os << "<style type=\"text/css\">\n"
   .....
   "</style>\n</head>\n<body>";

   // Generate header
   R.InsertStrBefore(StartLoc, os.str());
------------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: html_title.diff
Type: application/octet-stream
Size: 3774 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080704/07a54700/attachment.obj>
-------------- next part --------------




-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2427 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080704/07a54700/attachment.bin>


More information about the cfe-dev mailing list