Ok, been tweaking the HTML exporter a little bit more.  A patch is
attached, which includes the (really small) patch I submitted yesterday.

Let's see, what did I do:

        o       Made the xhtml standards compliant (thanks to validator.w3.org)
        o       Made the xhtml display spaces correctly

I know, simple stuff, but you gotta start with something, right?

As a quick question: when a user hits enter/return twice, creating a
blank line, why isn't that interpreted as a line feed instead of an
empty paragraph?

Take care,

        John
Index: abi/src/wp/impexp/xp/ie_exp_HTML.cpp
===================================================================
RCS file: /cvsroot/abi/src/wp/impexp/xp/ie_exp_HTML.cpp,v
retrieving revision 1.31
diff -u -r1.31 ie_exp_HTML.cpp
--- abi/src/wp/impexp/xp/ie_exp_HTML.cpp        2000/12/19 01:35:12     1.31
+++ abi/src/wp/impexp/xp/ie_exp_HTML.cpp        2001/01/11 20:01:39
@@ -136,7 +136,7 @@
        UT_Bool                         m_bInSection;
        UT_Bool                         m_bInBlock;
        UT_Bool                         m_bInSpan;
-        UT_Bool m_bWasSpace;
+       UT_Bool                         m_bNextIsSpace;
        const PP_AttrProp*      m_pAP_Span;
 
        // Need to look up proper type, and place to stick #defines...
@@ -167,7 +167,7 @@
                if(m_iBlockType == BT_NORMAL)
                m_pie->write("</p>\n");
 
-       else if(m_iBlockType == BT_HEADING1)
+               else if(m_iBlockType == BT_HEADING1)
                m_pie->write("</h1>\n");
 
         else if(m_iBlockType == BT_HEADING2)
@@ -179,7 +179,7 @@
         else if(m_iBlockType == BT_BLOCKTEXT)
                m_pie->write("</blockquote>\n");
 
-       else if(m_iBlockType == BT_PLAINTEXT)
+               else if(m_iBlockType == BT_PLAINTEXT)
                m_pie->write("</pre>\n");
 
         // Add "catchall" for now
@@ -283,9 +283,9 @@
                        m_iBlockType != BT_PLAINTEXT && m_iBlockType != BT_BLOCKTEXT 
&& (pAP->getProperty((XML_Char*)"text-align", szValue))
                        )
                {
-                       m_pie->write(" align=\"");
+                       m_pie->write(" style=\"text-align: ");
                        m_pie->write((char*)szValue);
-                       m_pie->write("\"");
+                       m_pie->write(";\"");
                }
        }
        else 
@@ -577,7 +577,7 @@
                        {
                          if (!span)
                                    {
-                                       m_pie->write("<span style=\"color: ");  
+                                       m_pie->write("<span style=\"color: #"); 
                                        char szColor[16];
                                        _convertColor(szColor,(char*)pszColor);
                                        m_pie->write(szColor);
@@ -586,7 +586,7 @@
                                    }
                                  else 
                                    {
-                                       m_pie->write(" color: ");       
+                                       m_pie->write("; color: #");     
                                        char szColor[16];
                                        _convertColor(szColor,(char*)pszColor);
                                        m_pie->write(szColor);
@@ -741,6 +741,16 @@
                        m_pie->write(buf,(pBuf-buf));
                        pBuf = buf;
                }
+               pData++;
+               if (*pData == ' ' || *pData == '\t')
+               {
+                       m_bNextIsSpace = UT_TRUE;
+               }
+               else
+               {
+                       m_bNextIsSpace = UT_FALSE;
+               }
+               pData--;
                switch (*pData)
                {
                case '<':
@@ -783,7 +793,7 @@
                  // try to honor multiple spaces
                  // tabs get treated as a single space
                  //
-                 if(m_bWasSpace)
+                 if(m_bNextIsSpace)
                    {
                      *pBuf++ = '&';
                      *pBuf++ = 'n';
@@ -796,7 +806,6 @@
                  else
                    {
                      // just tack on a single space to the textrun
-                     m_bWasSpace = UT_TRUE;
                      *pBuf++ = ' ';
                      pData++;
                    }
@@ -829,7 +838,7 @@
        m_bInSection = UT_FALSE;
        m_bInBlock = UT_FALSE;
        m_bInSpan = UT_FALSE;
-       m_bWasSpace = UT_FALSE;
+       m_bNextIsSpace = UT_FALSE;
        
        m_pie->write("<!-- 
================================================================================  
-->\n");
        m_pie->write("<!-- This HTML file was created by AbiWord.                      
                      -->\n");

Reply via email to