]> wagner.pp.ru Git - oss/ljdump.git/commitdiff
changed the way i replace the lj-user tags; lj usernames allow underscores,
authorSean Graham <github@sean-graham.com>
Fri, 13 Feb 2009 17:08:28 +0000 (01:08 +0800)
committerGreg Hewgill <greg@hewgill.com>
Mon, 4 May 2009 11:34:21 +0000 (19:34 +0800)
domains do not.  Rather that converting the underscores to hyphens, I used
the alternate URL scheme supported by LJ

disabled the lj-embed code until i can figure out how to make it actually
work

Signed-off-by: Greg Hewgill <greg@hewgill.com>
convertdump.py

index 9799cabf377208a01eb56600b261f118a703e818..4eb143d67b6fd0313b5e95ad0e2e045b64a2b2ed 100755 (executable)
@@ -199,7 +199,7 @@ def replaceLJTags(entry):
     embedRE = re.compile('<lj-embed id="[0-9]+">', re.IGNORECASE)
 
     # replace lj user tags
-    rv = re.sub(userRE, '<a href="http://\\1.livejournal.com/" class="lj-user">\\1</a>', rv) 
+    rv = re.sub(userRE, '<a href="http://www.livejournal.com/users/\\1" class="lj-user">\\1</a>', rv) 
 
     # replace lj comm tags
     rv = re.sub(commRE, '<a href="http://community.livejournal.com/\\1/" class="lj-comm">\\1</a>', rv) 
@@ -210,7 +210,10 @@ def replaceLJTags(entry):
     rv = re.sub(cutRE, '', rv)
 
     # replace lj-embed tags
-    rv = re.sub(embedRE, '', rv)
+    # 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