MS Wordã§æ¸ãããå稿ãããã¹ããã¡ã¤ã«ã§Git管çãã
MS Wordã§æ¸ãããå稿ãé»åæ¸ç±åããä½æ¥ãè¡ã£ãã®ã§ãããå人çã«ã¯ä½¿ãæ £ããRe:VIEWã§ç®¡çããããã®ã§ãã
ããã§ãMS Wordãããã¹ããã¡ã¤ã«åãã¦Re:VIEWãã¡ã¤ã«ã«æ¸ãæãããã¨ã«ãã¾ããã
docx2txtã使ã£ã¦MS Wordããã¬ã¼ã³ããã¹ãã«å¤æãã
ã¯ã¼ããã¡ã¤ã«ã®ããã¹ããã³ãããã¦ããã¹ããã¡ã¤ã«ã«ç½®ãæããã®ã¯æµç³ã«é¢åã§ããããã¥ã¼ãã³ã¨ã©ã¼ãçºçãããã§ãã
ããã§ãä½ãè¯ãæ¹æ³ã¯ãªããã¨æã£ã¦ãããããã«Googleã§ãdocx2txtãã¨æ¤ç´¢ãã¦ã¿ãã¨ãã¾ã£ããåãååã®ã½ããã¦ã§ã¢ãçºè¦ãããã¨ãã§ãã¾ããã
ãã¼ã¸ã¯ããã¬ããã§ããããã¼ã«èªä½ã¯ã¡ã³ããã³ã¹ãããã¦ããããã§ããããå°å ¥ãããã¨ã«ãã¾ããã
ãªãã¸ããªä½æ
ã¾ãã¯ãªãã¸ããªã®ä½æã§ããã¨ããããã次ã®ãããªãã¡ã¤ã«é ç½®ããã¾ããã
. âââ Rakefile âââ script â  âââ docx2txt.pl â  âââ docx2txt.sh âââ src âââ Chapter1.docx âââ Chapter2.docx
ããã¦ãRakefileã«ã¯æ¬¡ã®ãããªã¹ã¯ãªãããæ¸ãã¾ããã
require 'rake' desc 'convert ./src/*.docx to ./src/*.txt' task :docx2txt do Dir.glob('./src/*.docx') do |docx| txt = File.basename(docx).sub(/\.docx$/, '.txt') if File.exist?("./src/#{txt}") puts "#{txt} exist." sh "rm ./src/#{txt}" end sh "./script/docx2txt.sh #{docx}" end end
ããã¹ããã¡ã¤ã«ã¸ã®å¤æ
ãã¡ã¤ã«ã®é
ç½®ãçµã£ãããrake docx2txt
ã³ãã³ããå®è¡ã
$ rake docx2txt ./script/docx2txt.sh ./src/Chapter1.docx Text extracted from <./src/Chapter1.docx> is available in <./src/Chapter1.txt>. ./script/docx2txt.sh ./src/Chapter2.docx Text extracted from <./src/Chapter2.docx> is available in <./src/Chapter2.txt>.
ããã¨ã
. âââ Rakefile âââ script â  âââ docx2txt.pl â  âââ docx2txt.sh âââ src âââ Chapter1.docx âââ Chapter1.txt âââ Chapter2.docx âââ Chapter2.txt
ãããªæãã§ç¡äºã«ããã¹ããã¡ã¤ã«ãä½æããã¾ããã
ã¨ããããããããã³ããããã¦ããã°ãä»å¾ããã¯ã¼ããã¡ã¤ã«ãæ´æ°ããã¦ããå·®åã確èªãããã¨ãå¯è½ã«ãªãã¾ããã
ãªããdocx2txtèªä½ã¯ãã¡ã¤ã«ãä¸æ¸ãããªãããã«ä½ããã¦ãã¾ãããGitã§ç®¡çãã¦ããã°ãä¸æ¸ãä¸çãªã®ã§ãRakeã®ä¸ã§ãã¡ã¤ã«ã®åå¨ã確èªããåé¤ããããã«ãã¾ããã
ã¾ã¨ã
MS Wordãã³ãã¼ãã¦è²¼ãä»ããã¨ãè¨å·æåãã¡ãã£ã¨ã¢ã¬ãªæãã ã£ãã®ã§ãããdocx2txtã使ã£ã¦å¤æããã¨ãããæãã«å¤æãã¦ãããã®ã§ãç·¨éä½æ¥ãã¨ã¦ã楽ã«è¡ããã¨ãã§ãã¾ããã
ä½æ¥ãçµã£ã¦ããããã®è¨äºãæ¸ãã«ããã£ã¦èª¿ã¹ã¦ã¿ãã¨ãdocx2txtã使ã£ã¦git diffã§ç´æ¥å·®åã表示ããã¨ããæ¹æ³ãç´¹ä»ãã¦ããè¨äºãè¦ã¤ããããã¦ã人ã«ãã£ã¦ã¯ããã ãã§ååå¬ãããã¨æãã¾ãã
ããæ¹ã¯ä»ã«ãè²ã ã¨ãããã¨æãã¾ãããä»åç§ãå®éã«å©ç¨ããæ¹æ³ãç´¹ä»ãã¦ã¿ã¾ããã
追è¨
d:id:zariganitosh ããã«ã³ã¡ã³ãã§ã ããã¹ãã§ãªããã¡ã¤ã«ã®diffï¼å·®åï¼ãã¨ãæ¹æ³ - ã¶ãªã¬ããè¦ã¦ãã...ãã¨ããè¨äºãç´¹ä»ãã¦ããã ãã¾ãããï¼ã³ã¡ã³ã㧠ããã¾ããããªã³ã¯å
ã®æ¹æ³ã¨åãã§ãããæªæ¿èªã¨ãã¦ããã¦ãã ããã
ã¨ããã ããã®ã§ãããæè§ãªã®ã§ãã¡ãã§ãç´¹ä»ããã¦ããã ãã¾ããï¼
ä¸ã§ãªã³ã¯ããè¨äºã¨æ ¹æ¬çãªææ³ã¯åãã§ãããWord以å¤ã®ãã¤ããªãã¡ã¤ã«ãGitã§å·®åã確èªããæ¹æ³ãç´¹ä»ããã¦ãã¾ãã