[sword-svn] r3690 - trunk/src/modules/filters

refdoc at crosswire.org refdoc at crosswire.org
Sun Feb 2 02:40:55 MST 2020


Author: refdoc
Date: 2020-02-02 02:40:55 -0700 (Sun, 02 Feb 2020)
New Revision: 3690

Modified:
   trunk/src/modules/filters/teixhtml.cpp
Log:
This fixes API-221
Addition of numbered and bulleted lists in TEI XHTML filter


Modified: trunk/src/modules/filters/teixhtml.cpp
===================================================================
--- trunk/src/modules/filters/teixhtml.cpp	2020-02-01 01:36:20 UTC (rev 3689)
+++ trunk/src/modules/filters/teixhtml.cpp	2020-02-02 09:40:55 UTC (rev 3690)
@@ -350,10 +350,53 @@
 				buf += "</td>";
 			}
 		}
+		// <list> <item>
+		else if (!strcmp(tag.getName(), "list")) {
+			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+
+				SWBuf rend = tag.getAttribute("rend");
+				
+				u->lastHi = rend;
+				if (rend == "numbered") {
+					buf += "<ol>\n";
+					}
+				else if (rend == "bulletted") {
+					buf += "<ul>\n";
+				}
+				else {
+					buf += "<span type=\"list\" x-rend=\""; 
+					buf += rend.c_str(); 
+					buf += "\">";
+				}
+			}
+			else if (tag.isEndTag()) {
+				SWBuf rend = u->lastHi;
+				if (rend == "numbered") {
+					buf += "</ol>\n>";
+				}
+				else if (rend == "bulleted") {
+					buf += "</ul>\n";
+				
+				}
+				else {
+					buf += "</span>\n";
+				}
+				u->supressAdjacentWhitespace = true;
+			}
+		}
+		else if (!strcmp(tag.getName(), "item")) {
+			if ((!tag.isEndTag()) && (!tag.isEmpty())) {
+				buf += "<li>";
+			}
+			else if (tag.isEndTag()) {
+				buf += "</li>\n";
+			}
+		}
 		else {
 			return false;  // we still didn't handle token
 		}
 
+
 	}
 	return true;
 }




More information about the sword-cvs mailing list