From 761ab13d84c0ea48d701ae7c030092c49bdf0ff4 Mon Sep 17 00:00:00 2001 From: grahams Date: Sun, 8 Feb 2009 02:31:02 +0800 Subject: [PATCH] now replace lj comm as well as lj-cut tags Signed-off-by: Greg Hewgill --- convertdump.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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(): -- 2.39.5