diff --git a/scholar2xbundle.py b/scholar2xbundle.py
index d154a9b..0c21ae9 100644
--- a/scholar2xbundle.py
+++ b/scholar2xbundle.py
@@ -112,7 +112,25 @@ def add_pdf_link_to_vert(self, pdffn, text, vert):
html = etree.XML('%s' % (newpath, dn))
print " html link: %s = %s" % (dn, newpath)
vert.append(html)
-
+
+ def add_py_link_to_vert(self, pyfn, text, vert):
+ '''
+ Add with link to PY file to vertical
+ '''
+ newpath = self.fix_static('../' + pyfn)
+ dn = text.strip()
+ html = etree.XML('%s' % (newpath, dn))
+ print " html link: %s = %s" % (dn, newpath)
+ vert.append(html)
+ def add_txt_link_to_vert(self, txtfn, text, vert):
+ '''
+ Add with link to txt file to vertical
+ '''
+ newpath = self.fix_static('../' + txtfn)
+ dn = text.strip()
+ html = etree.XML('%s' % (newpath, dn))
+ print " html link: %s = %s" % (dn, newpath)
+ vert.append(html)
def add_contents_to_vert(self, vxml, vert):
'''
@@ -134,6 +152,12 @@ def add_contents_to_vert(self, vxml, vert):
if vfn.endswith('.pdf'):
self.add_pdf_link_to_vert(vfn, vxml.text, vert)
return
+ if vfn.endswith('.py'):
+ self.add_py_link_to_vert(vfn, vxml.text, vert)
+ return
+ if vfn.endswith('.txt'):
+ self.add_txt_link_to_vert(vfn, vxml.text, vert)
+ return
# process html file
try:
@@ -142,7 +166,7 @@ def add_contents_to_vert(self, vxml, vert):
except Exception as err:
print " ERROR reading %s: %s" % (fn, err)
return
- nav = vcontents.find('.//div[@id="parent-fieldname-text"]') # v.find('.//p[@class="sc_nav"]')
+ nav = vcontents.find('.//div[@id="course_inner_section"]')
html = etree.SubElement(vert,'html')
html.set('display_name',vert.get('display_name','Page'))
for p in nav:
diff --git a/xbundle.py b/xbundle.py
index bcbbb54..3d146a7 100755
--- a/xbundle.py
+++ b/xbundle.py
@@ -407,6 +407,8 @@ def write_xml(x):
elem.attrib.pop('url_name')
if 'url_name_orig' in elem.attrib and self.keep_urls:
elem.attrib.pop('url_name_orig')
+ if un.__len__() > 182:
+ un = un[:182-un.__len__()]
edir = self.mkdir(self.dir / x.tag)
open(edir/un + '.xml','w').write(self.pp_xml(x))
return un