Revision: 1491
Author: sebastien.lelong
Date: Sat Nov 21 11:57:44 2009
Log: fix: remove path parts when deeper than one
http://code.google.com/p/jallib/source/detail?r=1491
Modified:
/trunk/tools/japp/htmlizer.py
=======================================
--- /trunk/tools/japp/htmlizer.py Sun Nov 1 05:53:39 2009
+++ /trunk/tools/japp/htmlizer.py Sat Nov 21 11:57:44 2009
@@ -71,7 +71,7 @@
origsrc = img['src']
imgfn = os.path.basename(origsrc)
img['src'] = DRUPAL_IMG_PATH_PREFIX + imgfn
- # is it enclosed by a <A> element ? (clickable ?)
+ # is it enclosed by a <A> element ? (clickable ?)
if img.parent.name == "a" and img.parent.get("href") == origsrc:
img.parent['href'] = img['src']
enclosingas.append(img.parent)
@@ -86,7 +86,7 @@
as_ = body.findAll("a")
for a in as_:
# if <a> element encloses images (makes image clickable) skip it,
- # path was adjusted step before
+ # path was adjusted step before
if a in enclosingas:
continue
try:
@@ -101,6 +101,8 @@
# if we get here, url is a local file
# remove html suffix, as we'll remove it in drupal
path = pat.sub("",path)
+ # also remove prefix, just keep last part of URL correspoding to
XML file
+ path = path.split("/")[-1]
# add prefix for Drupal's content
path = DRUPAL_CONTENT_PREFIX + path
@@ -119,7 +121,7 @@
title = basen
else:
# there should be only one element, but anyway remove first one
- # only keep text content, not potential inner elements
+ # only keep text content, not potential inner elements
title = h1s[0].findAll(text=True)[0]
h1s[0].replaceWith("")
--
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at http://groups.google.com/group/jallib?hl=.