Commits

Luke Plant committed 71a8a39

Misc fixes for migration

Comments (0)

Files changed (1)

                               , P.slug = ""
                               , P.post_raw = ""
                               , P.post_formatted = ""
-                              , P.summary_raw = row !! 4
-                              , P.summary_formatted = row !! 4
+                              , P.summary_raw = fixCodes $ row !! 4
+                              , P.summary_formatted = fixCodes $ row !! 4
                               , P.format = Formats.Rawhtml
                               , P.timestamp = read (row !! 2)
                               , P.comments_open = True
                                        , P.post_formatted = P.summary_formatted p
                                        }
                                 else p
-          -- Fix dodgy stuff, and reinterpret as UTF8
-          fixCodes txt = UTF8.toString $ regexReplace (LB.pack "
") (LB.pack "\n") (LB.pack txt)
+
+ -- Fix dodgy stuff, and reinterpret as UTF8
+fixCodes txt = UTF8.toString $ regexReplace (LB.pack "
") (LB.pack "\n") (LB.pack txt)
 
 readPostCategories = makeItems "postcategories.txt" mkPostCategory
     where mkPostCategory row = (read (row !! 0),
                                      , Cm.hidden = False
                                      , Cm.response = ""
                                      }
-          fixCodes txt = UTF8.toString $ LB.pack txt
 -- Writing
 
 writeItems cn writer items = mapM (writer cn) items
     renderToFile Settings.redirect_file_output tpl ctx
 
 -- Misc fixes
--- Titles of all article have HTML in them, which is difficult to fix
+-- Titles of all posts in category 'articles' have HTML in them, which is difficult to fix
 -- up.  They are only announcements, so we just delete.
 articlePosts = "select posts.id FROM posts INNER JOIN post_categories ON posts.id = post_categories.post_id INNER JOIN categories ON post_categories.category_id = categories.id WHERE categories.slug = 'articles';"
 deletePost = "DELETE FROM posts WHERE id = ?;";