From f96dfc41efceeee37df54c51154f76061a9d52f8 Mon Sep 17 00:00:00 2001
From: Axel Naumann <Axel.Naumann@cern.ch>
Date: Thu, 19 Feb 2009 16:51:35 +0000
Subject: [PATCH] When converting sources with line numbers (i.e. code) we
 cannot interpret directives as it would close any open <pre> which is fatal.
 To better control what's happening inside convert's pre it is now contained
 in a div; both sue the new class listing. Fixes display of the tutuorials.

git-svn-id: http://root.cern.ch/svn/root/trunk@27531 27541ba8-7e3a-0410-8455-c3a389f83636
---
 html/inc/TDocParser.h   | 1 +
 html/src/TDocOutput.cxx | 4 ++--
 html/src/TDocParser.cxx | 7 +++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/html/inc/TDocParser.h b/html/inc/TDocParser.h
index ec77d14b947..64b2478717f 100644
--- a/html/inc/TDocParser.h
+++ b/html/inc/TDocParser.h
@@ -123,6 +123,7 @@ protected:
    TString        fClassDescrTag;   // tag for finding the class description
    TString        fSourceInfoTags[kNumSourceInfos]; // tags for source info elements (copyright, last changed, author)
    TList          fDirectiveHandlers;// handler for doc directives (TDocDirective objects)
+   Bool_t         fAllowDirectives;  // whether directives are to be interpreted
    std::set<UInt_t> fExtraLinesWithAnchor; // lines that need an additional anchor
    TString        fSourceInfo[kNumSourceInfos];// author, last changed, ...
    TList          fMethods[3];      // methods as TMethodWrapper objects (by access)
diff --git a/html/src/TDocOutput.cxx b/html/src/TDocOutput.cxx
index 168392c0e09..a1a3d9ebc08 100644
--- a/html/src/TDocOutput.cxx
+++ b/html/src/TDocOutput.cxx
@@ -511,12 +511,12 @@ void TDocOutput::Convert(std::istream& in, const char* infilename,
       }
       out << "<table><tr><td style=\"vertical-align:top;padding-right:2em;\">" << endl;
    }
-   out << "<pre class=\"code\">" << endl;
+   out << "<div class=\"listing\"><pre class=\"listing\">" << endl;
 
    TDocParser parser(*this);
    parser.Convert(out, in, relpath, (includeOutput) /* determines whether it's code or not */);
 
-   out << "</pre>" << endl;
+   out << "</pre></div>" << endl;
    out << "<div id=\"linenums\">";
    for (Long_t i = 0; i < parser.GetLineNumber(); ++i)
       out << "<div class=\"ln\">&nbsp;<span class=\"ln\">" << i + 1 << "</span></div>";
diff --git a/html/src/TDocParser.cxx b/html/src/TDocParser.cxx
index b3eab357068..0353b1a7196 100644
--- a/html/src/TDocParser.cxx
+++ b/html/src/TDocParser.cxx
@@ -134,7 +134,7 @@ TDocParser::TDocParser(TClassDocOutput& docOutput, TClass* cl):
    fCurrentClass(cl), fRecentClass(0), fCurrentModule(0),
    fDirectiveCount(0), fLineNumber(0), fDocContext(kIgnore), 
    fCheckForMethod(kFALSE), fClassDocState(kClassDoc_Uninitialized), 
-   fCommentAtBOL(kFALSE)
+   fCommentAtBOL(kFALSE), fAllowDirectives(kTRUE)
 {
    // Constructor called for parsing class sources
 
@@ -170,7 +170,7 @@ TDocParser::TDocParser(TDocOutput& docOutput):
    fCurrentClass(0), fRecentClass(0), fDirectiveCount(0),
    fLineNumber(0), fDocContext(kIgnore), 
    fCheckForMethod(kFALSE), fClassDocState(kClassDoc_Uninitialized),
-   fCommentAtBOL(kFALSE)
+   fCommentAtBOL(kFALSE), fAllowDirectives(kFALSE)
 {
    // constructor called for parsing text files with Convert()
    InitKeywords();
@@ -1195,6 +1195,9 @@ TClass* TDocParser::IsDirective(const TString& line, Ssiz_t pos,
    // from TDocHandler, and calling it TDocTagDirective for "BEGIN_TAG",
    // "END_TAG" blocks.
 
+   if (!fAllowDirectives)
+      return 0;
+
    // '"' serves as escape char
    if (pos > 0 &&  line[pos - 1] == '"')
       return 0;
-- 
GitLab