ã¯ã¦ãªã§ Blog ãæ¸ãããã«ãã¦ããéåã«ãªããã§ãããããããéãè °ããããBlogsync 㨠textlint ã§åºæ¬çãªææ¸æ§æãã§ããä»çµã¿ãç«ã¡ä¸ãã¦ã¿ã¾ããã
$ make draft
ããã¨ã¨ã³ããªãä¸æ¸ãã§ããããã«ãªãã
$ make lint
ããã¨ææ¸æ§æãè¡ããã¦ã
$ make release
ããã¨ãBlog ãæ稿ãããããã«ãªã£ã¦ãã¾ãã
- Blogsync
- è稿ãæ¸ã
- ææ¸ãæ ¡æ£ãã
- ã¨ã³ããªæ稿
- ææ¸æ ¡æ£ãéç¨ãã¯ããã¦ã®ææ³
Blogsync
ææ¸æ ¡æ£ããããã«ã¯ãã¨ã³ããªã®å 容ããã¼ã«ã«ã«é ç½®ããå¿ è¦ãããã¾ããããã®ããã«ã¯ãã£ã±ã blogsync ã使ã£ã¦ãã¾ãã
v0.9.1 㧠omit_domain
ã®å¯¾å¿ãã¯ãã£ã¦ãããç¹ã«ãã£ã¬ã¯ããªããã£ãããã¾ããã
è稿ãæ¸ã
è稿ãæ¸ãã®ã¯ãblogsync post --draft
ã使ã£ã¦ãã¾ãã
ãã®ã³ãã³ãã¯æ¨æºå ¥åããããã°ã¨ã³ããªã®å 容ãåãåãããããã¯ã¦ãªããã°ã«ãä¸æ¸ããç¶æ ã§ä¿åããã¨ã¨ãã«ãã¼ã«ã«ã«ãé ç½®ãããã¨ãããã¨ããã¦ããã¾ãã ã¼ãã¯ã¨ã³ããªãããã«æ¸ãåºãæ¹ãªã®ã§ãMakefile ã«ä»¥ä¸ã®ã¿ã¼ã²ãããæå®ãã¦ãã¾ãã
draft: echo | blogsync post --draft kiririmode.hatenablog.jp 2>&1 \ | grep store \ | awk '{print $$3}' \ | xargs -L1 emacsclient
æåã®è¡ã§ç©ºã®ä¸æ¸ãã¨ã³ããªãã¯ã¦ãªããã°ã«ã¢ãããã¼ããã2ã»3 è¡ç®ã§ãã®ãã¼ã«ã«ä¸ã®ãã¡ã¤ã«ãã¹ãç¹å®ãã
ããã emacsclient
ã«éãè¾¼ãã¨ãããã¨ããã¦ãã¾ãã
ããã«ãããmake draft
ãå©ãã¨ä»¥ä¸ã®å
容㮠Emacs ãããã¡ãéããã¨ã³ããªä½æãéå§ã§ãã¾ãã
--- Title: â Date: 2018-08-20T10:16:54+09:00 URL: https://kiririmode.hatenablog.jp/entry/20180820/1534727814 EditURL: (snip) Draft: true ---
ææ¸ãæ ¡æ£ãã
ææ¸æ ¡æ£ã«ã¯ãtextlint ã使ã£ã¦ãã¾ãã
textlint ã®ä½ãè¯ããã¨ããã¨ãã¼ããã¯ã¦ãª Blog ãæ¸ããã©ã¼ãããã§ãã Markdown ãç´æ¥æ ¡æ£ã§ããã£ã¦ãã¨ã«ããã¾ãã ã©ãã AST ã«ãã¦è§£æãã¦ãããã£ã½ãã¦ã
[textlint-rule-preset-japanese](https://github.com/textlint-ja/textlint-rule-preset-japanese)
ã¨ãããã㪠Markdown ç¹æã®è¨è¿°ã«ç¹æ®µæå¥ãè¨ããªãã®ãè¯ãã§ãã
ç´°ããã«ã¼ã«ãåæ¨é¸æããã®ãã¡ãã£ã¨å¤§å¤ããªã¨æã£ãã®ã§ã
ã® 2 ã¤ãããªã»ããã¨ãã¦ä½¿ã£ã¦ãã¾ãã
ãããã以ä¸ã®ãã㪠.textlintrc
ã§æå®ããããã¸ã§ã¯ãã®ãã£ã¬ã¯ããªã«é
ç½®ã㦠textlint
ããã°ãææ¸æ ¡æ£ãã¦ããããããã«ãªãã¾ãã
{ "rules": { "preset-japanese": true, "preset-jtf-style": { "3.1.1.å ¨è§æåã¨åè§æåã®é": false, "4.3.1.丸ãã£ãï¼ï¼": false } } }
make lint
ãæã¤ã¨ã以ä¸ã®ããã«ææ¸æ ¡æ£ãã¯ãã¾ãã¾ãã
$ make lint find entry -newer blogged-time -name \*.md -print0 \ | xargs --no-run-if-empty -0 grep -L ignore-lint \ | xargs --no-run-if-empty npm run lint > hatenablog@1.0.0 lint /Users/kiririmode/hatenablog > textlint -f pretty-error "entry/20180819/1534634594.md" "entry/20180820/1534727814.md" preset-japanese/max-ten: ä¸ã¤ã®æã§"ã"ã3ã¤ä»¥ä¸ä½¿ç¨ãã¦ãã¾ã /Users/kiririmode/hatenablog/entry/20180820/1534727814.md:58:57 v 57. 58. æåã®è¡ã§ã空ã®ä¸æ¸ãã¨ã³ããªãã¯ã¦ãªããã°ã«ã¢ãããã¼ããã2ã3 è¡ç®ã§ãã®ãã¼ã«ã«ä¸ã®ãã¡ã¤ã«ãã¹ãç¹å®ãã 59. ããã `emacsclient` ã«éãè¾¼ããã¨ãããã¨ããã¦ãã¾ãã
Makefile ã®ã¿ã¼ã²ããã¯ããããªãããã«ãªã£ã¦ãã¾ãã
lint: find entry -newer blogged-time -name \*.md -print0 \ | xargs --no-run-if-empty -0 egrep -L '<[[:space:]]*ignore-lint[[:space:]]*>' \ | xargs --no-run-if-empty npm run lint
ã¾ããblogged-time
ã¨ãããã¡ã¤ã«ã® mtime ã¯ææ°ã® Blog æ稿æ¥æã«ãªã£ã¦ãã¾ãã
find
ã§ãã以éã«å¤æ´ or æ°è¦ä½æãããã¨ã³ããªãæ½åºãããã®ãªã㧠ignore-lint
ã¨ããã¡ãã»ã¼ã¸ãå«ã¾ãªãã¨ã³ããªã対象㫠lint ãããã¾ãã
ãã®ãããã¯ã以åã¨ã³ããªã«æ¸ãã¾ããã
ãã¨ã¯ãæå¥è¨ãããå 容ã«åããã¦ä¿®æ£ã£ã¦ãã£ããããã
ã¨ã³ããªæ稿
release: lint find entry -newer blogged-time -name \*.md -print0 \ | xargs --no-run-if-empty -0 -L 1 blogsync push touch -t $(shell date +%Y%m%d%H%M.%S) blogged-time
ã¨ã³ããªæ稿ã¯ãããªãããã§ãlint ããããã¨ã§ãæ稿ããå½¢ã«ãªã£ã¦ãã¾ãã
æåããããtouch
㧠blogged-time
ã® mtime ãå¤æ´ãã¾ãã
ææ¸æ ¡æ£ãéç¨ãã¯ããã¦ã®ææ³
èªåã®ææ¸ã®çã«æ示çã«æ°ä»ããã®ãããã大ããã£ãã§ãã ã¼ãã¯ã©ããä¸æãé·ããªããã¡ã§ãå¥ç¹ãå¤ç¨ããã¡ã ã£ãã®ã§ããã®ããããä¿®æ£ããªãã¨ã¨ã³ããªæ稿ãã§ããªããªãã¾ããã ãã¨ã¯ãåãå©è©ã 1 æã«è¤æ°ããã¨ããã±ã¢ã¬ã¹ãã¹ã«æ°ä»ããã®ãè¯ãã æ©æ¢°ã«ä»»ãããã¨ãã§ããã¨æ¥½ã§è¯ãã§ãã