Created
December 6, 2010 15:30
-
-
Save mathfur/730434 to your computer and use it in GitHub Desktop.
haddockのリファレンスページから「解説」と「ソース」を取り出してページ末尾にテーブルとして追加するスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// chromeのcontent_scriptとして使う | |
// メインとなるテーブル | |
var table = $("<table/>"); | |
table.attr("border","2"); | |
$("div.top > div.doc").each(function(i,doc){ | |
// 挿入するテーブルのセル内データ | |
var description = $(doc).find("p").html(); // 各関数の解説部分 | |
var src = $(doc).find("pre").html(); // 各関数のサンプルソース | |
// 挿入するセル | |
var tr = $("<tr/>"); | |
var td1 = $("<td/>"); | |
var td2 = $("<td/>"); | |
td1.html( $("<p/>").html(description) ); | |
td1.appendTo(tr); | |
td2.html( $("<pre/>").html(src) ); | |
td2.appendTo(tr); | |
tr.appendTo(table); | |
}); | |
// テーブルとして末尾に追加する | |
table.appendTo($("body")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment