Help us understand the problem. What is going on with this article?

gistの貼り付けタグのScriptからHTMLにする。

More than 5 years have passed since last update.

Gistの貼り付けタグは で、 document.writeオン・パレードです。これでは、検索にインデックスに反映されないし、なによりdocument.writeは嫌過ぎるので、gistの貼り付けタグから、貼り付け用のHTMLタグを生成することにした。

gist2html.rb
!/usr/bin/env ruby
coding:utf-8

require 'openssl'
 require 'open-uri'
 require 'rubygems'
 require 'json'

if ARGV.size < 1 || ! (/([0-9]+)/ =~ ARGV[0])
 puts "Usage : Gist のIDを指定。"
 puts "以下のように指定"
 puts " #{FILE} https://gist.github.com/3033059 "
 puts " #{FILE} https://gist.github.com/3033059.js "
 puts " #{FILE} https://gist.github.com/3033059.json "
 puts " #{FILE} 3033059 "
 exit
 end

id = $1
 json = open("https://gist.github.com/#{id}.json").read
 data = JSON.load json
 puts '<link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"/>'
 puts data["div"]
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away