Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add posts from 2005-2007 site #20

Closed
wants to merge 1 commit into from
Closed

Add posts from 2005-2007 site #20

wants to merge 1 commit into from

Conversation

coyotebush
Copy link
Member

I cobbled together this:

require 'mysql2'
require 'reverse_markdown'

client = Mysql2::Client.new(:host => "localhost", :username => "root",
                            :database => "cplug")
client.query("select * from news").each do |row|
  title = row["name"]
  slug = title.downcase.gsub(/\W+/, ' ').strip.tr(' ', '-')
  filename = "_posts/#{row["date"]}-#{slug}.md"
  body = ReverseMarkdown.convert row["description"]
  body.gsub! /\r\n?/, "\n"
  File.open(filename, "w") do |file|
    file.write <<-END.gsub(/^ {6}/, '')
      ---
      title: #{title}
      layout: post
      ---
      #{body}
    END
  end
end

There are some broken links (I think we have copies of some, but not all, of the PDFs and other files from this site) and formatting, but mostly it looks reasonable.

Fixes #14

@icco
Copy link
Member

icco commented Mar 18, 2016

If we still have the same old box, I verified all links worked in like 2010, so the files should be on disk and could be committed here. If not, internet archive?

@coyotebush
Copy link
Member Author

I have a local copy of the files that coexisted with Wordpress, and in #6 I committed those that were actually referenced in the Wordpress site. There are more, and it looks like the wayback machine can help with the gaps.

The wayback machine also reveals, unfortunately, that a bunch of previous posts were deleted from the database in early 2006. Not sure whether it's worth extracting those as well.

@icco
Copy link
Member

icco commented Mar 22, 2016

👍 👍

@steelcowboy steelcowboy closed this Aug 6, 2017
@steelcowboy steelcowboy deleted the ancient-posts branch August 6, 2017 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants