X-Git-Url: https://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=convertdump.py;h=0f59e8282d6dc9e2e9fa481a1312201b6468c2bf;hb=HEAD;hp=c99fff9b7d8d33bf311056c5ee7419ba660eb313;hpb=761ab13d84c0ea48d701ae7c030092c49bdf0ff4;p=oss%2Fljdump.git diff --git a/convertdump.py b/convertdump.py index c99fff9..0f59e82 100755 --- a/convertdump.py +++ b/convertdump.py @@ -175,28 +175,38 @@ def addCommentsForId(outDoc, entry, username, id): if(parentId != ""): appendTextNode(outDoc, outComment, "parent_itemid", parentId) + +# regular expressions used in replaceLJTags() +# (global for later reuse - suggestion by jparise) + +userRE = re.compile('', re.IGNORECASE) +commRE = re.compile('', re.IGNORECASE) +namedCutRE = re.compile('', + re.IGNORECASE|re.DOTALL) +cutRE = re.compile('', re.IGNORECASE) +cutRE = re.compile('', re.IGNORECASE) +embedRE = re.compile('', re.IGNORECASE) + def replaceLJTags(entry): rv = entry # replace lj user tags - userRE = re.compile('', re.IGNORECASE) - rv = re.sub(userRE, '\\1', rv) + 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) + # replace lj-embed tags + # this doesn't actually work. LJ doesn't include the embedded content + # when ljdump calls 'getevents', but instead includes an lj-embed tag + # with an id and nothing else. + #rv = re.sub(embedRE, '', rv) + return rv