diff options
author | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-07-22 16:18:00 +0100 |
---|---|---|
committer | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-07-22 16:18:00 +0100 |
commit | 57ede091c42878f11b33a2c77aa73a71bd4723dd (patch) | |
tree | 7ce10a69ac98b29265124361f290088a44cb70aa /utils.py | |
parent | e5033c7b69a2210087c502b54c5fd07d57c5a0d2 (diff) | |
download | troggle-57ede091c42878f11b33a2c77aa73a71bd4723dd.tar.gz troggle-57ede091c42878f11b33a2c77aa73a71bd4723dd.tar.bz2 troggle-57ede091c42878f11b33a2c77aa73a71bd4723dd.zip |
[svn] Various bug fixes, using more raw_id fields in admin so it loads faster. I had to put onLoad="contentHeight();" back into the base template. This is a bad solution, I would rather use Martin's, but it wasn't working.
Diffstat (limited to 'utils.py')
-rw-r--r-- | utils.py | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -102,7 +102,7 @@ def href_to_wikilinks(matchobj): if res:
return r'[[cavedescription:'+res[0].short_name+'|'+res[0].long_name+']]'
else:
- return matchobj
+ return matchobj.group()
#except:
#print 'fail'
@@ -115,13 +115,15 @@ re_subs = [(re.compile(r"\<b[^>]*\>(.*?)\</b\>", re.DOTALL), r"'''\1'''"), (re.compile(r"\<h4[^>]*\>(.*?)\</h4\>", re.DOTALL), r"====\1===="),
(re.compile(r"\<h5[^>]*\>(.*?)\</h5\>", re.DOTALL), r"=====\1====="),
(re.compile(r"\<h6[^>]*\>(.*?)\</h6\>", re.DOTALL), r"======\1======"),
+ (re.compile(r'(<a href="?(?P<target>.*)"?>)?<img class="?(?P<class>\w*)"? src="?t/?(?P<source>[\w/\.]*)"?(?P<rest>></img>|\s/>(</a>)?)', re.DOTALL),r'[[display:\g<class> photo:\g<source>]]'), #
(re.compile(r"\<a\s+id=['\"]([^'\"]*)['\"]\s*\>(.*?)\</a\>", re.DOTALL), r"[[subcave:\1|\2]]"), #assumes that all links with id attributes are subcaves. Not great.
#interpage link needed
- (re.compile(r"\<a\s+href=['\"]#([^'\"]*)['\"]\s*\>(.*?)\</a\>", re.DOTALL), r"[[cavedescription:\1|\2]]"), #assumes that all links with target ids are subcaves. Not great.
+ (re.compile(r"\<a\s+href=['\"]#([^'\"]*)['\"]\s*\>(.*?)\</a\>", re.DOTALL), r"[[cavedescription:\1|\2]]"), #assumes that all links with target ids are cave descriptions. Not great.
(re.compile(r"\[\<a\s+href=['\"][^'\"]*['\"]\s+id=['\"][^'\"]*['\"]\s*\>([^\s]*).*?\</a\>\]", re.DOTALL), r"[[qm:\1]]"),
-
-# BUGGED!
-# (re.compile(r'<a\shref="?(?P<target>.*)"?>(?P<text>.*)</a>'),href_to_wikilinks)
+
+ #BUGGED!
+ (re.compile(r'<a\shref="?(?P<target>.*)"?>(?P<text>.*)</a>'),href_to_wikilinks),
+
]
|