平衡点


2012/08/01

_ tDiary 復旧中です.

VPS を飛ばしてしまった & 設定のバックアップを取っていなかったので, ちまちまと復旧しています. tDiary 本体を弄った所も幾つかあったりしたので, それを思い出しながらです. 日記のデータが飛ばなかったのが救い, ですかねぇ...

_ MathJax 用の plugin を書いてみた.

数式表示. 以前は mimeTeX 使ったりしていたのですが最近はMathJax使うのが流行りらしいですね.

というわけで tDiary で MathJax を読み込むための plugin を書いてみたりしました.

# source: ruby
#-*- mode: ruby;  coding:utf-8; -*-
#
# load MathJax
#
# Copyright(C) 2012 Youhei SASAKI, All rights reserved.
# $Lastupdate: 2012/08/01 19:39:02$
#
# Author: Youhei SASAKI <uwabami@gfd-dennou.org>
# License: MIT(Expat)
#
# Code:
#
# Options:
mathjax_src = @options['mathjax_src'] || "http://cdn.mathjax.org/mathjax/latest/MathJax.js"
mathjax_config = @options['mathjax_config'] || "TeX-AMS_HTML"
mathjax_uri = "#{mathjax_src}?config=#{mathjax_config}"
x_mathjax_config = @options['x_mathjax_config'] ||
  %q{MathJax.Hub.Config({ tex2jax: { inlineMath: [['$','$']], displayMath: [['$$','$$']], processEscapes: true }});}
#
# Add Header
#
add_header_proc {
  head = ''
  head << %Q{\t<script type="text/x-mathjax-config">\n}
  head << %Q{\t  #{x_mathjax_config}\n}
  head << %Q{\t</script>\n}
  head << %Q{\t<script type="text/javascript" src="#{mathjax_uri}"></script>\n}
  head << %Q{\t<meta http-equiv="X-UA-Compatible" CONTENT="IE=EmulateIE7" />\n}
  head
}
# Add 'tex' notation
def tex(src)
  %Q{  <p>\$#{src}\$</p>\n<p> }
end

最後の部分は, これまでの日記データ内の TeX 記法部分を直すのが面倒だったので微妙にお茶を濁している所だったりして . というわけで数式のテストをしてみたり: ...良いみたいですね.


連絡先など
最近の日記
  • 2024/05/10
    • 1. 特定の文字列を含むRubyスクリプトをEmacsで開くと CPU100% で止まります
  • 2024/04/28
    • 1. CF-SR3 での生活環境構築 (できてない)
  • 2024/03/29
    • 1. Debian GNU/Linux on CF-SR3
  • 2024/03/25
    • 1. org-mode → beamer でのリスト記号の一時変更
  • 2024/03/22
    • 1. 静的htmlによるGit Repository Browser
一覧
2006|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|02|03|04|08|09|10|11|12|
2013|01|02|03|04|05|06|08|09|10|11|12|
2014|01|02|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|09|10|
2016|02|03|
2017|01|02|03|05|06|07|09|11|12|
2018|03|06|07|10|11|12|
2019|01|02|03|04|05|07|10|12|
2020|01|02|03|04|05|08|09|10|11|12|
2021|01|02|03|05|06|07|08|09|11|12|
2022|01|02|03|04|05|06|08|10|11|12|
2023|02|03|04|06|08|09|11|12|
2024|01|02|03|04|05|
Back to Top ▲