Update of /cvsroot/audacity/audacity-src/scripts/mw2html_audacity
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv20817

Modified Files:
        mw2html.py 
Log Message:
Fixed remotion of a hrefs to same url (that was causing the lost of the 
sidebar's logo).
Fixed url_to_filename usage of normalized urls (that was causing the 
wikipedia's logo problem).

Index: mw2html.py
===================================================================
RCS file: /cvsroot/audacity/audacity-src/scripts/mw2html_audacity/mw2html.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- mw2html.py  6 Jun 2009 12:31:23 -0000       1.6
+++ mw2html.py  7 Jun 2009 00:04:35 -0000       1.7
@@ -111,20 +111,20 @@
 def normalize_url(url):
 # url normalization - only for local comparison operations, use original url 
for online requests
   url = split_section(url)[0] 
-  nurl = url.lower()
+  url = url.lower()
   
-  if nurl.startswith('http://'):
-    nurl = nurl[len('http://'):]
-  if nurl.startswith('www.'):
-    nurl = nurl[len('www.'):]
+  if url.startswith('http://'):
+    url = url[len('http://'):]
+  if url.startswith('www.'):
+    url = url[len('www.'):]
   
-  nurl = nurl.strip('/')
+  url = url.strip('/')
   
-  nurl = 'http://' + nurl
+  url = 'http://' + url
   
-  urlparse.urljoin(config.rooturl, nurl)
+  urlparse.urljoin(config.rooturl, url)
   
-  return nurl
+  return url
 
 def find_tag_limits(doc, filter_string, end_tag, start_tag, start_point = 0):
 # find tag limits - start_string must be an unique identifier within doc
@@ -175,7 +175,6 @@
 def monobook_fix_html(doc, page_url):
   """
   Sets sidebar for Mediawiki 1.4beta6 Monobook HTML output.
-  Also returns new urls eventually found.
   """
   global sidebar_content, config
  
@@ -249,7 +248,7 @@
   User-customizable HTML transform.
 
   Given an HTML document (with URLs already rewritten), returns
-  modified HTML document and new urls from sidebar.
+  modified HTML document.
   """
   global config
   new_urls = []
@@ -593,7 +592,7 @@
     return url_filename_cache[nurl]
 
   #ParseResult(scheme='http', netloc='www.cwi.nl:80', 
path='/%7Eguido/Python.html', params='', query='', fragment='')
-  L = list(urlparse.urlparse(url))
+  L = list(urlparse.urlparse(nurl))
 
   L[2] = L[2].strip('/')
   lpath = L[2].split('/')
@@ -647,10 +646,10 @@
   ans = os.path.join(config.outdir, subfile)
 
   if config.flatten:
-    ans = flatten_filename(url, ans)
+    ans = flatten_filename(nurl, ans)
 
   if config.clean:
-    ans = clean_filename(url, ans)
+    ans = clean_filename(nurl, ans)
 
   if config.index != None:
     ans = move_to_index_if_needed(ans)
@@ -687,9 +686,10 @@
   Translate a full url to a filename (in URL format) relative to cururl.
   Relative url from curul to url.
   """
+
   cururl = split_section(cururl)[0]
   (url, section) = split_section(url)
-
+ 
   L1 = url_to_filename(url).replace(os.sep, '/').split('/')
   if L1 == '':
     return ''
@@ -700,7 +700,11 @@
     L1 = L1[1:]
     L2 = L2[1:]
 
-  return urllib.quote('../' * (len(L2) - 1) + '/'.join(L1)) + section
+  rel_url = urllib.quote('../' * (len(L2) - 1) + '/'.join(L1)) + section
+  if rel_url == '':
+    return '#'
+  else:
+    return rel_url
 
 def parse_css(doc, url):
   """


------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to