OctopressのGist表示の調整 とかで以前Gistがおかしかったのを直しましたが、 またおかしくなってることに気づいたので直すことに。
Gistの調整
最近はGistから引くよりも直接書くほうが多くて昔のもそんなに見直してなかったので 気付かなかったんですが、結構前にまたGitHub側のコードが変わって表示が おかしくなっていた様です。
Gistに関する一番新しいPull RequestがOctopressに6月にありました。
Fix Gist embedded code layout by yous · Pull Request #1584 · imathis/octopress
取り敢えず、デフォルトのままの状態からはこの通りに直せば上手く行きます。
このブログで使ってるものはOctopressのGist表示の調整 の所ですでに少し変更してあるので、 ここから変更するには以下の様な変更です。
1 2 3 4 5 6 7 8 9 10 11 |
|
この変更はこのブログのテーマで使ってる octograyにも反映してあります。
取り敢えずこれで上手く行ったのでコレを書いた時点では綺麗になってます。
下はテスト様の最近のGist。
" This is old settings, new one is following url: | |
" https://gist.github.com/rcmdnk/6f9c3c0f8043391317e1a9cc3e0cafcb | |
"Settings | |
"set nohud | |
"set autohidecursor | |
"set noinsertmappings | |
set smoothscroll | |
set autoupdategist | |
set noautofocus | |
let scrolltep = 30 | |
let fullpagescrollpercent = 100 | |
" let blacklists = ["https://mail.google.com/*"] | |
let blacklists = [] | |
let mapleader = "," | |
"let locale = "jp" | |
let hintcharacters = "hjklasdfgyuiopqwertnmzxcvb" | |
let barposition = "bottom" | |
" qmarks | |
" google mail/task/calendar | |
let qmark m = ["https://mail.google.com"] | |
let qmark t = ["https://mail.google.com/tasks/canvas"] | |
let qmark c = ["https://www.google.com/calendar"] | |
" google translator en/ja/language tool | |
let qmark e = ["javascript:var%20t=((window.getSelection&&window.getSelection())%7C%7C(document.getSelection&&document.getSelection())%7C%7C(document.selection&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset%7C%7Cdocument.characterSet);if(t!='')%7Blocation.href='http://translate.google.com/translate_t?text='+t+'&hl=ja&langpair=auto%7Cen&tbb=1&ie='+e;%7Delse%7Blocation.href='http://translate.google.com/translate?u='+escape(location.href)+'&hl=ja&langpair=auto%7Cen&tbb=1&ie='+e;%7D;"] | |
let qmark j = ["javascript:var%20t=((window.getSelection&&window.getSelection())%7C%7C(document.getSelection&&document.getSelection())%7C%7C(document.selection&&document.selection.createRange&&document.selection.createRange().text));var%20e=(document.charset%7C%7Cdocument.characterSet);if(t!='')%7Blocation.href='http://translate.google.com/?text='+t+'&hl=ja&langpair=auto%7Cja&tbb=1&ie='+e;%7Delse%7Blocation.href='http://translate.google.com/translate?u='+encodeURIComponent(location.href)+'&hl=ja&langpair=auto%7Cja&tbb=1&ie='+e;%7D;"] | |
let qmark l = ["http://www.google.com/language_tools"] | |
" Feedly/Pocket/GitHub | |
let qmark f = ["http://cloud.feedly.com/#latest"] | |
let qmark p = ["http://getpocket.com/a/queue/"] | |
let qmark g = ["http://github.com/rcmdnk"] | |
" Move | |
map <C-h> scrollLeft | |
map <C-j> scrollDown | |
map <C-k> scrollUp | |
map <C-l> scrollRight | |
map <C-u> scrollPageUp | |
map <C-d> scrollPageDown | |
map <C-b> scrollFullPageUp | |
map <C-f> scrollFullPageDown | |
" Navigation | |
map d closeTab | |
map u lastClosedTab | |
map <C-p> previousTab | |
map <C-n> nextTab | |
map <C-i> goForward | |
map <C-o> goBack | |
map R reloadTabUncached | |
" Yank current url | |
map y yankDocumentUrl | |
" Yank current selected word and search it | |
map <C-g> :execute vlhyP<CR> | |
" Open command line with ; | |
map ; : | |
" Disable all mappings in Text boxes | |
iunmapAll | |
" pocket, maybe need to get own bookmarklet from https://getpocket.com/add/?ep=1 | |
map <Leader>p :script<Space>javascript:(function()%7Bvar e%3Dfunction(t,n,r,i,s)%7Bvar o%3D%5B5578755,3226513,3196261,1447352,5754625,1900724,9534081,1439849,9043574,4416713%5D%3Bvar i%3Di%7C%7C0,u%3D0,n%3Dn%7C%7C%5B%5D,r%3Dr%7C%7C0,s%3Ds%7C%7C0%3Bvar a%3D%7B%27a%27:97,%27b%27:98,%27c%27:99,%27d%27:100,%27e%27:101,%27f%27:102,%27g%27:103,%27h%27:104,%27i%27:105,%27j%27:106,%27k%27:107,%27l%27:108,%27m%27:109,%27n%27:110,%27o%27:111,%27p%27:112,%27q%27:113,%27r%27:114,%27s%27:115,%27t%27:116,%27u%27:117,%27v%27:118,%27w%27:119,%27x%27:120,%27y%27:121,%27z%27:122,%27A%27:65,%27B%27:66,%27C%27:67,%27D%27:68,%27E%27:69,%27F%27:70,%27G%27:71,%27H%27:72,%27I%27:73,%27J%27:74,%27K%27:75,%27L%27:76,%27M%27:77,%27N%27:78,%27O%27:79,%27P%27:80,%27Q%27:81,%27R%27:82,%27S%27:83,%27T%27:84,%27U%27:85,%27V%27:86,%27W%27:87,%27X%27:88,%27Y%27:89,%27Z%27:90,%270%27:48,%271%27:49,%272%27:50,%273%27:51,%274%27:52,%275%27:53,%276%27:54,%277%27:55,%278%27:56,%279%27:57,%27%5C/%27:47,%27:%27:58,%27%3F%27:63,%27%3D%27:61,%27-%27:45,%27_%27:95,%27%26%27:38,%27%24%27:36,%27!%27:33,%27.%27:46%7D%3Bif(!s%7C%7Cs%3D%3D0)%7Bt%3Do%5B0%5D%2Bt%7Dfor(var f%3D0%3Bf<t.length%3Bf%2B%2B)%7Bvar l%3Dfunction(e,t)%7Breturn a%5Be%5Bt%5D%5D%3Fa%5Be%5Bt%5D%5D:e.charCodeAt(t)%7D(t,f)%3Bif(!l*1)l%3D3%3Bvar c%3Dl*(o%5Bi%5D%2Bl*o%5Bu%25o.length%5D)%3Bn%5Br%5D%3D(n%5Br%5D%3Fn%5Br%5D%2Bc:c)%2Bs%2Bu%3Bvar p%3Dc%25(50*1)%3Bif(n%5Bp%5D)%7Bvar d%3Dn%5Br%5D%3Bn%5Br%5D%3Dn%5Bp%5D%3Bn%5Bp%5D%3Dd%7Du%2B%3Dc%3Br%3Dr%3D%3D50%3F0:r%2B1%3Bi%3Di%3D%3Do.length-1%3F0:i%2B1%7Dif(s%3D%3D237)%7Bvar v%3D%27%27%3Bfor(var f%3D0%3Bf<n.length%3Bf%2B%2B)%7Bv%2B%3DString.fromCharCode(n%5Bf%5D%25(25*1)%2B97)%7Do%3Dfunction()%7B%7D%3Breturn v%2B%279954c60b5a%27%7Delse%7Breturn e(u%2B%27%27,n,r,i,s%2B1)%7D%7D%3Bvar t%3Ddocument,n%3Dt.location.href,r%3Dt.title%3Bvar i%3De(n)%3Bvar s%3Dt.createElement(%27script%27)%3Bs.type%3D%27text/javascript%27%3Bs.src%3D%27https://getpocket.com/b/r4.js%3Fh%3D%27%2Bi%2B%27%26u%3D%27%2BencodeURIComponent(n)%2B%27%26t%3D%27%2BencodeURIComponent(r)%3Be%3Di%3Dfunction()%7B%7D%3Bvar o%3Dt.getElementsByTagName(%27head%27)%5B0%5D%7C%7Ct.documentElement%3Bo.appendChild(s)%7D)()<CR> | |
" copy current url and title in MarkDown style | |
copyTitleUrl -> {{ | |
const t = document.title; | |
const l = location.href; | |
let ret = '['+t+']('+l+')'; | |
if(l.includes("rcmdnk.com") || l.includes("octopress.dev") || l.includes("octopress.test") || l.includes("en.dev") || l.includes("en.test")){ | |
l = l.replace(/https?:\/\/(rcmdnk.com|octopress.dev|en.dev)/,''); | |
ret = '{% post_card ' + l + ' ' + t + ' %}'; | |
} | |
Clipboard.copy(ret); | |
Status.setMessage(ret, 2); | |
}} | |
map <Leader>i :call copyTitleUrl<CR> |
OctopressのGistの表示
Octopressでは現在3.0とかに向けて準備を進めてるとかだと思いますが、 GistについてはGitHubが提供するブロックに依存せずに表示できるようなのを 開発してる、的なことを言ってたりもします。
なので、以前おかしくなった際にもそのままに放置されてたままでした。
とかを見ると、コードの色の違いもあるように、 Octopressのデフォルトとは違うコードを使っています。
以前問題が起きた後にはこのページの表示は暫く後にきちんと直っていました。 なので6月に指摘された問題以降はここの変更も行われてない様です。 (ということはつまりまだこのページのコードもまだGitHubのブロックを使ってる、ということ。)
結構頻繁に変わるのでGistとかを多用してると結構嫌な感じです。
ちょっと探したら、
OctopressのGist Tagプラグインを改造してみた - じゅんいち☆かとうの技術日誌http://j5ik2o.me/blog/2013/05/10/gist-tag/
こちらで公開されてる物が良さげ。 コード自体Gistから引用してるものですが、今もきちんと崩れずに 表示されるので上手く動いてるのかな、と。 (ブログ自体の最後の更新が2014年2月17日なので特別後から調整を行ったわけでも なさ気ですし。。。)
Octopressの本体の方にもこういったPull Requestはあった気がしますが、 新しいバージョンとかがまだ時間がかかって先の話、となりそうなら そのうちGistの部分は変更しようかな、とも。
今あらためて見てみると、
こちらが元々のOctopressのレポジトリでまだ更新がありますが、 octopressというユーザーで
こちらでも更新を行っていて、どうやら3.0になる時はこちらになるっぽいです。 しかも今までみたいにレポジトリをCloneしてきて、と言う感じではなくて gemでインストールするものになるようですね。
Gistも
こちらで作られてるものをgemでインストールする、と言った感じ。
まだ試すには早い感じかもしれませんが、そのうち見てみたいところです。