Decided to port my old blog over from NanoBlogger to WordPress. Hopefully, will be more active here with a variety of different topics.
As for how I converted my NanoBlogger site to WordPress; I wrote the following Tcl script to convert the articles from NB to an RSS file, which I later used a WordPress plugin to import. The WordPress plugin I used was Import XML and RSS feeds plugin.
And now, the Tcl code:
#!/bin/tclsh
##
# NanoBlogger to WordPress converter by StrikeLight, 2022
##
set title ""
set date ""
set body ""
set ndate ""
# file to save rss feed to
set outfile [open "myblog.rss" w]
set inbody 0
foreach file [glob ../data/*.txt] {
set infile [open $file r]
set data [read $infile]
close $infile
foreach line [split $data \n] {
if {[string match "TITLE: *" $line]} {
regexp {^TITLE: (.*)$} $line - title
} elseif {[string match "DATE: *" $line]} {
regexp {^DATE: (.*)$} $line - date
regsub -all {\[} $date {} date
regsub -all {\]} $date {} date
set ndate [clock format [clock scan $date] -format "%a, %d %b %Y %T EST"]
} elseif {[string match "BODY:*" $line]} {
set inbody 1
set body ""
} elseif {[string match "END-----*" $line]} {
# Write it all out
puts $outfile "<item>"
puts $outfile " <pubDate>$ndate</pubdate>"
puts $outfile " <title>$title</title>"
puts $outfile " <content:encoded>[join $body]</content>"
puts $outfile "</item>"
set date ""
set title ""
set body ""
set ndate ""
set inbody 0
} elseif {$inbody == 1} {
lappend body $line
# set body [join [lappend [split $body "\n"] $line]]
}
}
}
close $outfile
puts "Done."
