From: grahams Date: Sat, 7 Feb 2009 18:31:02 +0000 (+0800) Subject: now replace lj comm as well as lj-cut tags X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=oss%2Fljdump.git;a=commitdiff_plain;h=761ab13d84c0ea48d701ae7c030092c49bdf0ff4 now replace lj comm as well as lj-cut tags Signed-off-by: Greg Hewgill --- diff --git a/convertdump.py b/convertdump.py index 937403b..c99fff9 100755 --- a/convertdump.py +++ b/convertdump.py @@ -176,10 +176,28 @@ def addCommentsForId(outDoc, entry, username, id): appendTextNode(outDoc, outComment, "parent_itemid", parentId) def replaceLJTags(entry): - # regex to replace tags - fixedUserTags = re.sub("", "\\1", entry) + rv = entry - return fixedUserTags + # replace lj user tags + userRE = re.compile('', re.IGNORECASE) + rv = re.sub(userRE, '\\1', rv) + + # replace lj comm tags + commRE = re.compile('', re.IGNORECASE) + rv = re.sub(commRE, '\\1', rv) + + # replace lj-cut tags + namedCutRE = re.compile('', + re.IGNORECASE|re.DOTALL) + rv = re.sub(namedCutRE, '', rv) + + cutRE = re.compile('', re.IGNORECASE) + rv = re.sub(cutRE, '', rv) + + cutRE = re.compile('', re.IGNORECASE) + rv = re.sub(cutRE, '', rv) + + return rv def usage():