Fix rowspan, colspan on TDs.

The export script was dropping them prior to this CL.

Bug: 1267385
Change-Id: Ida17e0b9a5d6c2aa98a2ad3eeae9d79f2f74635c
Reviewed-on: https://chromium-review.googlesource.com/c/website/+/3265747
Auto-Submit: Dirk Pranke <dpranke@google.com>
Reviewed-by: Gary Tong <gatong@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@google.com>
diff --git a/scripts/export.py b/scripts/export.py
index 93c775f..8fa6ab4 100755
--- a/scripts/export.py
+++ b/scripts/export.py
@@ -126,14 +126,12 @@
 
 
 def _find_entry_by_path(path, entries, parents):
-    seen = set()
     for entry in entries.values():
         if entry['kind'] not in ('webpage', 'listpage',
                                  'announcmentspage', 'filecabinet'):
             continue
         entry_path = _path(entry, entries, parents)
-        seen.add(entry_path)
-        if '/' + entry_path == path:
+        if entry_path == path:
             return entry
     return None
 
@@ -206,7 +204,6 @@
                 content = fp.read()
                 did_update = common.write_if_changed(path, content)
             except (HTTPError, URLError, TimeoutError) as e:
-                import pdb; pdb.set_trace()
                 err = 'Error: %s' % e
 
     elif entry['kind'] == 'comment':
diff --git a/scripts/html2markdown.py b/scripts/html2markdown.py
index 0ba8381..280223e 100644
--- a/scripts/html2markdown.py
+++ b/scripts/html2markdown.py
@@ -366,8 +366,14 @@
 
 
 class TD(Text):
-  def __init__(self):
-    super().__init__(indent='', prefix='<td>', suffix='</td>')
+  def __init__(self, rowspan, colspan):
+    prefix = '<td'
+    if rowspan and str(rowspan) != '1':
+        prefix += ' rowspan=%s' % rowspan
+    if colspan and str(colspan) != '1':
+        prefix += ' colspan=%s' % colspan
+    prefix += '>'
+    super().__init__(indent='', prefix=prefix, suffix='</td>')
 
 
 class Content(TextBlock):
@@ -1141,7 +1147,7 @@
     if self._IsWithinFragmentType(Table):
       self._AddHTMLBlock('</tr>')
 
-  def StartTD(self, cls):
+  def StartTD(self, cls, rowspan, colspan):
     if self._LastFragmentIs(Div, cls='two-column-container'):
       if cls and ('sites-tile-name-content-1' in cls or
                   'sites-tile-name-content-2' in cls):
@@ -1150,7 +1156,7 @@
       else:
         self._Push(Text())
     elif self._IsWithinFragmentType(Table):
-      self._Push(TD())
+      self._Push(TD(rowspan, colspan))
 
   def EndTD(self):
     if self._LastFragmentIs(Div, cls='column'):
@@ -1276,7 +1282,9 @@
     elif tag == 'tr':
       self._generator.StartTR()
     elif tag == 'td':
-      self._generator.StartTD(attrs.get((None, 'class')))
+      self._generator.StartTD(attrs.get((None, 'class')),
+                              attrs.get((None, 'rowspan')),
+                              attrs.get((None, 'colspan')))
     else:
       match = self._HEADER_TAG_RE.match(tag)
       if match: