[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdewebdev/quanta
From:       Andras Mantia <amantia () kde ! org>
Date:       2004-03-12 9:16:09
Message-ID: 20040312091609.475EE99A2 () office ! kde ! org
[Download RAW message or body]

CVS commit by amantia: 

Don't crash when a unexpected </tr> is found in the table.
Michal, this needs a better handling. It seems that we really need a method which \
                validates the complete table:
- finds unexpected tags
- finds missing tags or so
- in case of stopping tags (eg. <td><td>), adds the closing tags to the right place \
(creates <td></td><td>), but marks them that they were added here and were not in the \
                original table, so they should not put be back
- finds missing closing tags (this is what we already do)
...and so.
We need to do this based on the parsing tree, as that one follows the rules of the \
DTD.

In case of a correctable error, offer the chance to correct the table or let the user \
correct it.

BTW, the commit fixes an error discovered due to a bug report. [#77225]

CCMAIL: mrudolf@kdewebdev.org
CCMAIL: 77225-done@bugs.kde.org


  M +2 -2      quanta.kdevelop   1.141
  M +3 -2      components/tableeditor/tableeditor.ui.h   1.44
  M +1 -1      parsers/node.cpp   1.46
  M +26 -1     parsers/parser.cpp   1.195
  M +5 -2      parsers/saparser.cpp   1.29
  M +4 -0      src/document.cpp   1.266


--- kdewebdev/quanta/quanta.kdevelop  #1.140:1.141
@@ -236,8 +236,8 @@
   <kdevfilecreate>
     <filetypes>
-      <type icon="source_cpp" ext="cpp" name="C++ source" create="template" >
+      <type icon="source_cpp" ext="cpp" create="template" name="C++ source" >
         <descr>A new empty C++ file.</descr>
       </type>
-      <type icon="source_h" ext="h" name="C/C++ header" create="template" >
+      <type icon="source_h" ext="h" create="template" name="C/C++ header" >
         <descr>A new empty header file for C or C++.</descr>
       </type>

--- kdewebdev/quanta/components/tableeditor/tableeditor.ui.h  #1.43:1.44
@@ -345,5 +345,4 @@ bool TableEditor::setTableArea( int bLin
         m_tbody->parse("<tbody>", m_write);
       }
-      tableRowTags.clear();
       nRow++;
       m_rowSpin->setValue(nRow);
@@ -370,5 +369,7 @@ bool TableEditor::setTableArea( int bLin
           tableRowTags.append(tableNode);
         }
+        if (!tableRowTags.isEmpty())
         m_tableTags->append(tableRowTags);
+        tableRowTags.clear();
       }
     }

--- kdewebdev/quanta/parsers/parser.cpp  #1.194:1.195
@@ -109,4 +109,5 @@ Node *Parser::parseArea(int startLine, i
       parentNode = currentNode->parent;
   Tag *tag = 0L;
+  QTag *qTag = 0L;
   textLine.append(write->text(startLine, startCol, startLine, \
write->editIf->lineLength(startLine)));  if (line == endLine)
@@ -281,4 +282,5 @@ Node *Parser::parseArea(int startLine, i
         }
   
+        qTag = 0L; 
         goUp = ( parentNode &&
                 ( (tag->type == Tag::XmlTagEnd && \
QuantaCommon::closesTag(parentNode->tag, tag) @@ -288,5 +290,5 @@ Node \
*Parser::parseArea(int startLine, i  if (parentNode && !goUp)
         {
-          QTag *qTag = QuantaCommon::tagFromDTD(m_dtd, parentNode->tag->name);
+          qTag = QuantaCommon::tagFromDTD(m_dtd, parentNode->tag->name);
           if ( qTag )
           {
@@ -325,5 +327,28 @@ Node *Parser::parseArea(int startLine, i
               parentNode = parentNode->parent;
             }
+          } else
+          if (qTag && tag->type != Tag::XmlTagEnd)
+          {
+            Node *n = parentNode;
+            QString searchFor = (m_dtd->caseSensitive)?tag->name:tag->name.upper();
+            while (qTag && n)
+            {
+              qTag = QuantaCommon::tagFromDTD(m_dtd, n->tag->name);
+              if ( qTag )
+              {
+                if ( qTag->stoppingTags.contains(searchFor) )
+                {
+                  n->tag->closingMissing = true; //parent is single...
+                  if (n->parent)
+                    parentNode = n;
+                  n = n->parent;
+                } else
+                {
+                  break;
+                }
           }
+            }
+          }
+          
           node = new Node(parentNode->parent);
           nodeNum++;

--- kdewebdev/quanta/parsers/saparser.cpp  #1.28:1.29
@@ -584,6 +584,9 @@ Node* SAParser::parseArea(const AreaStru
   if (s_parentNode && !areaStartString.isEmpty())
   {
-    s_dtd = DTDs::ref()->find(s_parentNode->tag->dtd->specialAreaNames[areaStartString]);
                
-    s_areaEndString = s_parentNode->tag->dtd->specialAreas[areaStartString];
+    const DTDStruct *parentDTD = m_dtd;
+    if (s_parentNode->parent)
+      parentDTD = s_parentNode->parent->tag->dtd;
+    s_dtd = DTDs::ref()->find(parentDTD->specialAreaNames[areaStartString]);
+    s_areaEndString = parentDTD->specialAreas[areaStartString];
     s_searchForAreaEnd = true;
   }

--- kdewebdev/quanta/src/document.cpp  #1.265:1.266
@@ -139,5 +139,9 @@ Document::Document(KTextEditor::Document
 Document::~Document()
 {
+#if KDE_VERSION < KDE_MAKE_VERSION(3, 1, 90)
+ m_doc->closeURL(); //TODO: Workaround for a Kate bug. Remove when KDE < 3.2.0 \
support is dropped. +#else 
  m_doc->closeURL(false); //TODO: Workaround for a Kate bug. Remove when KDE < 3.2.0 \
support is dropped. +#endif 
  delete m_view;
  delete m_doc;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic