Skip to content

Instantly share code, notes, and snippets.

@af12066
Last active January 4, 2018 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save af12066/62be5414dab260b71a1749801f9f4e49 to your computer and use it in GitHub Desktop.
Save af12066/62be5414dab260b71a1749801f9f4e49 to your computer and use it in GitHub Desktop.
Markdown で論文を書く際に使用した config ファイルなど。textlint-prh 辞書と Pandoc の設定ファイルを収録。
figureTitle: "図"
tableTitle: "表"
listingTitle: "コード"
figPrefix: "図"
eqnPrefix: "式"
tblPrefix: "表"
lstPrefix: "コード"
#!/usr/bin/env python
# 二段組の原稿で表を挿入したいときにこのフィルタを使用する。
# cf. https://groups.google.com/d/msg/pandoc-discuss/RUC-tuu_qf0/h-H3RRVt1coJ
import pandocfilters as pf
def latex(s):
return pf.RawBlock('latex', s)
def inlatex(s):
return pf.RawInline('latex', s)
def tbl_caption(s):
return pf.Para([inlatex(r'\caption{')] + s + [inlatex('}')])
def tbl_alignment(s):
aligns = {
"AlignDefault": 'l',
"AlignLeft": 'l',
"AlignCenter": 'c',
"AlignRight": 'r',
}
return ''.join([aligns[e['t']] for e in s])
def tbl_headers(s):
result = s[0][0]['c'][:]
for i in range(1, len(s)):
result.append(inlatex(' & '))
result.extend(s[i][0]['c'])
result.append(inlatex(r' \\\midrule'))
return pf.Para(result)
def tbl_contents(s):
result = []
for row in s:
para = []
for col in row:
para.extend(col[0]['c'])
para.append(inlatex(' & '))
result.extend(para)
result[-1] = inlatex(r' \\' '\n')
return pf.Para(result)
def do_filter(k, v, f, m):
if k == "Table":
return [latex(r'\begin{table}[ht]' '\n' r'\centering' '\n'),
tbl_caption(v[0]),
latex(r'\begin{tabular}{@{}%s@{}}' % tbl_alignment(v[1]) +
('\n' r'\toprule')),
tbl_headers(v[3]),
tbl_contents(v[4]),
latex(r'\bottomrule' '\n' r'\end{tabular}'),
latex(r'\end{table}')]
if __name__ == "__main__":
pf.toJSONFilter(do_filter)
# 漢字とひらがなのどちらで書くべきか迷うワードを収録
version: 1
rules:
- expected: あらかじめ
pattern: 予め
prh: 漢字で書かず、ひらがなで書くと読みやすくなります
- expected: なぜ
pattern: 何故
prh: 漢字で書かず、ひらがなで書くと読みやすくなります
- expected: ゆえに
pattern: 故に
prh: 漢字で書かず、ひらがなで書くと読みやすくなります
- expected: すてき
pattern: 素敵
prh: 漢字で書かず、ひらがなで書くと読みやすくなります
- expected: やはり
pattern: 矢張り
prh: 漢字で書かず、ひらがなで書くと読みやすくなります
- expected: さすが
pattern: 流石
prh: 漢字で書かず、ひらがなで書くと読みやすくなります
- expected: うまく
pattern: 巧く
prh: 漢字で書かず、ひらがなで書くと読みやすくなります
- expected: かかわらず
pattern: /関わ?らず/
specs:
- from: 関わらず
to: かかわらず
- from: 関らず
to: かかわらず
prh: 漢字で書かず、ひらがなで書くと読みやすくなります
- expected: さまざま
pattern: 様々
- expected: 十分
pattern: 充分
- expected: $1とおり
patterns: /(思った|以下の)通り/
specs:
- from: (例)思った通り。
to: (例)思ったとおり。
- from: 以下の通りです。
to: 以下のとおりです。
- from: プリペット通り4番地
to: プリペット通り4番地
- expected: 基づ$1
pattern: /もとづ(く|き|い)/
specs:
- from: 文献にもとづいている
to: 文献に基づいている
- expected: $1とき
pattern: /(の)時(?!点|代|々|間|定数)/
specs:
- from: その時
to: そのとき
- from: その時点
to: その時点
- from: その時代
to: その時代
- from: その時定数
to: その時定数
- from: それまでの時間
to: それまでの時間
- from: 同時
to: 同時
- from: 実行時
to: 実行時
- from: 利用時
to: 利用時
- from: 開発時
to: 開発時
- from: 執筆時
to: 執筆時
- from: 時点
to: 時点
- from: 時代
to: 時代
- from: 時間
to: 時間
- expected: $1あとで
pattern: /(して|した|、)後で/
specs:
- from: して後で
to: してあとで
- expected: $1あとに
pattern: /(して|した|、)後に/
specs:
- from: した後に
to: したあとに
- expected: もしくは
patterns: 若しくは
# 表外音訓については http://www16.atpages.jp/kanjikentei/hyogaiyomi.html
- expected: かなし
pattern: 哀し
prh: 表外音訓
- expected: にくむ
pattern: 悪む
prh: 表外音訓
- expected: こく
pattern: 扱く
prh: 表外音訓
- expected: ゆだね
pattern: 委ね
prh: 表外音訓
- expected: なす
pattern: 為す
prh: 表外音訓
- expected: なる
pattern: 為る
prh: 表外音訓
- expected: よる
pattern: 依る
prh: 表外音訓
- expected: よっ
pattern: 依っ
prh: 表外音訓
- expected: より
pattern: 依り
prh: 表外音訓
- expected: ちなみ
pattern: 因み
prh: 表外音訓
- expected: ちなむ
pattern: 因む
prh: 表外音訓
- expected: ますます
pattern: 益々
prh: 表外音訓
- expected: こたえ
pattern: 応え
prh: 表外音訓
- expected: おぼえ
pattern: 憶え
prh: 表外音訓
- expected: ぬるい
pattern: 温い
prh: 表外音訓
- expected: ぬるめ
pattern: 温め
prh: 表外音訓
- expected: くらべ
pattern: 較べ
prh: 表外音訓
- expected: くくる
pattern: 括る
prh: 表外音訓
- expected: くくり
pattern: 括り
prh: 表外音訓
- expected: 箇所
patterns: 個所
prh: 表外音訓
- expected: 箇条書き
patterns: 個条書き
prh: 表外音訓
# 常用漢字外
- expected: あるいは
pattern: 或いは
prh: 常用漢字外
- expected: ほとんど
pattern: 殆ど
prh: 常用漢字外
- expected: ぜひ
pattern: 是非
prh: 常用漢字外
- expected: およぞ
pattern: 凡そ
prh: 常用漢字外
# 名詞の表記に関して収録
# 参考:
# - http://www.sic.shibaura-it.ac.jp/~kanzawa/cep/report_how_to.html
# - http://kikakurui.com/z8/Z8103-2000-01.html
# = https://github.com/azu/textlint-rule-web-plus-db/blob/master/dict/web%2Bdb_press.yml
version: 1
rules:
- expected: アーキテクチャ
pattern: /アーキテクチャー|アーキティクチャ/
- expected: アーチファクト
pattern: アーティファクト
- expected: アクセシビリティ
pattern: アクセシビリティー
- expected: 一次
pattern: 1次
- expected: インタフェース
pattern: /インターフェ(ー|イ)ス/
specs:
- from: インターフェース
to: インタフェース
- from : インターフェイス
to: インタフェース
- from: インタフェース
to: インタフェース
- expected: インバータ
pattern: インバーター
- expected: オドボール
pattern: オッドボール
- expected: カテゴリ
pattern: カテゴリー
- expected: 関数
pattern: 函数
- expected: キャラクタ
pattern: キャラクター
- expected: クラスタ
pattern: クラスター
- expected: 原波形
pattern: 生波形
- expected: 交差検証
pattern: 交差検定
- expected: コミュニケーション
pattern: /コミニュ?ケーション/
specs:
- from: コミニケーション
to: コミュニケーション
- from: コミニュケーション
to: コミュニケーション
- from: コミュニケーション
to: コミュニケーション
- expected: コントローラ
pattern: コントローラー
- expected: コンバータ
pattern: コンバーター
- expected: コンピュータ
pattern: コンピューター
- expected: サーバ
pattern: サーバー
- expected: サポートベクターマシン
pattern: /サポートベク(タ|トル)マシン/
specs:
- from: サポートベクタマシン
to: サポートベクターマシン
- from: サポートベクトルマシン
to: サポートベクターマシン
- from: サポートベクターマシン
to: サポートベクターマシン
- expected: 三次
pattern: 3次
- expected: ジェスチャ
pattern: ジェスチャー
- expected: シミュレーション
pattern: シュミレーション
- expected: シミュレータ
pattern: /シミュレーター|シュミレーター?/
specs:
- from: シミュレーター
to: シミュレータ
- from: シュミレータ
to: シミュレータ
- from: シュミレーター
to: シミュレータ
- from: シミュレータ
to: シミュレータ
- expected: スタンドアロン
pattern: スタンドアローン
- expected: 正弦波
pattern: サイン波
prh: サイン波でもよいですが、どちらかに統一してください。
- expected: セキュリティ
pattern: セキュリティー
- expected: センサ
pattern: センサー
- expected: ソフトウエア
pattern: ソフトウェア
- expected: チャネル
pattern: チャンネル
- expected: 提示
pattern: 呈示
- expected: ディジタル
pattern: デジタル
- expected: ティシュ
patterns:
- ティシュー
- ティッシュ
- expected: ディスプレイ
pattern: ディスプレー
- expected: テクスチャ
pattern: テクスチャー
- expected: トリガ
pattern: トリガー
- expected: 二次
pattern: 2次
- expected: ハードウエア
pattern: ハードウェア
- expected: バッファ
pattern: バッファー
- expected: パラメータ
pattern: /パラメタ|パラメーター/
- expected: ファジィ
pattern: ファジー
- expected: フィルタ
pattern: フィルター
- expected: フォルダ
pattern: フォルダー
- expected: ブラウザ
patterns:
- /Webブラウザー?|WEBブラウザー?/
- ブラウザー
- expected: プラットフォーム
pattern: プラットホーム
- expected: プリンタ
pattern: プリンター
- expected: プロッタ
pattern: プロッター
- expected: ヘッダ
pattern: ヘッダー
- expected: マーカ
pattern: マーカー
prh: マーカーでもよいですが、どちらかに統一してください。
- expected: メーカ
pattern: メーカー
prh: メーカーでもよいですが、どちらかに統一してください。
- expected: メディアン
pattern: /(メジ|ミディ)アン/
specs:
- from: メジアン
to: メディアン
- from: ミディアン
to: メディアン
- from: メディアン
to: メディアン
- expected: メモリ
pattern: メモリー
- expected: モータ
pattern: モーター
prh: モーターでもよいですが、どちらかに統一してください。
- expected: ユーザ
pattern: ユーザー
- expected: ユーザビリティ
pattern: ユーザビリティー
- expected: ライブラリ
pattern: ライブラリー
- expected: リアリティ
pattern: リアリティー
- expected: ルータ
pattern: ルーター
- expected: レコーダ
pattern: レコーダー
- expected: AD変換
pattern: A/D変換
- expected: Arduino
pattern: /arduino|[Aa]rudino|AR(DU|UD)INO/
specs:
- from: arduino
to: Arduino
- from: Arudino
to: Arduino
- from: arudino
to: Arduino
- from: ARDUINO
to: Arduino
- from: ARUDINO
to: Arduino
- from: Arduino
to: Arduino
- expected: BITalino
pattern: /[Bb]italino|BITALINO/
specs:
- from: Bitalino
to: BITalino
- from: bitalino
to: BITalino
- from: BITALINO
to: BITalino
- from: BITalino
to: BITalino
- expected: DA変換
pattern: D/A変換
- expected: ECHONET Lite
patterns:
- /[Ee]chonet [Ll]ite/
- /ECHO[Nn]et [Ll]ite/
specs:
- from: 電動車椅子の無線操作やEchonet Liteを介した家電操作
to: 電動車椅子の無線操作やECHONET Liteを介した家電操作
- expected: Facebook
patterns:
- facebook
- FACEBOOK
- FaceBook
- /フェ[イー]スブック/
specs:
- from: フェイスブック
to: Facebook
- from: フェースブック
to: Facebook
- expected: HTML5
pattern: HTML 5
- expected: HoloLens
patterns:
- ホロレンズ
- /[Hh]ololens/
- expected: IEEE $1$2
pattern: /\bIEEE(\S)(\d*\.?\d*)\b/
specs:
- from: IEEE802.11における標準化動向
to: IEEE 802.11における標準化動向
- from: IEEE1394はFireWireを標準化したものである
to: IEEE 1394はFireWireを標準化したものである
- from: IEEE Transaction
to: IEEE Transaction
- from: IEEETrans.
to: IEEETrans.
- expected: JavaScript
pattern: /\bJava Script\b|\bJavascript\b|\bjavascript\b/
- expected: Microsoft
patterns:
- マイクロソフト
- MicroSoft
- expected: Node.js
patterns:
- /[Nn]ode[Jj][Ss]/
- /[Nn]ode.J[Ss]/
specs:
- from: NodeJS
to: Node.js
- from: Node.JS
to: Node.js
- expected: OpenCV
patterns:
- /[Oo]pen[Cc]v/
- Open CV
- expected: Python
patterns:
- python
- PYTHON
- /[Pp]yhon/
- /[Pp][iy]son/
- expected: RFC $1
pattern: /RFC([0-9]*)/
specs:
- from: プライベートIPアドレスの範囲はRFC1918で規定されており
to: プライベートIPアドレスの範囲はRFC 1918で規定されており
- expected: TCP/IP
pattern: TCP / IP
specs:
- from: マスタリングTCP / IP入門編
to: マスタリングTCP/IP入門編
- expected: Twitter
patterns:
- ツイッター
- twitter
- TWITTER
- expected: Windows
patterns:
- /ウ[ィイ]ンドウズ/
- WINDOWS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment