adding regex to reimport javascript escaped strings when importing html
authorCharles Holbrow <charlesholbrow@gmail.com>
Fri, 18 Jan 2013 23:57:19 +0000 (18:57 -0500)
committerCharles Holbrow <charlesholbrow@gmail.com>
Fri, 18 Jan 2013 23:57:19 +0000 (18:57 -0500)
bin/import_json/run.py

index de362f747083fd07e234ae05f14896915236b95e..7bb1e2628a38bafefef7e9f3b8a943cf7a70a818 100644 (file)
@@ -13,6 +13,7 @@ import os
 import shutil
 import datetime
 import taggit
+import re
 
 from os.path import join, exists, split, isdir
 
@@ -109,6 +110,10 @@ for note in note_dicts:
        try:
                n = Note(**note)
 
+               # fix the weird javascript issue
+               if n.html:
+                       n.html = re.sub(r'\\(.)', r'\1', n.html)
+
                # Add the tags, if any
                for t in tags: n.tags.add(t)