hikiutils 0.2.3.2 → 0.2.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hikiutils_bob/.gitignore +1 -0
- data/hikiutils_bob/Rakefile +267 -0
- data/hikiutils_bob/figs/hikiutils_bob.001.jpeg +0 -0
- data/hikiutils_bob/figs/hikiutils_bob.002.jpeg +0 -0
- data/hikiutils_bob/figs/hikiutils_bob.003.jpeg +0 -0
- data/hikiutils_bob/hiki_help.yml +53 -0
- data/hikiutils_bob/hikiutils_bob/hikiutils_bob.001.jpeg +0 -0
- data/hikiutils_bob/hikiutils_bob/hikiutils_bob.002.jpeg +0 -0
- data/hikiutils_bob/hikiutils_bob/hikiutils_bob.003.jpeg +0 -0
- data/hikiutils_bob/hikiutils_bob.hiki +8 -0
- data/hikiutils_bob/hikiutils_bob.key +0 -0
- data/hikiutils_bob/latex_all.hiki +153 -0
- data/hikiutils_bob/latex_dir/head.tex +8 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob +243 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.001.bb +5 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.001.jpeg +0 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.002.bb +5 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.002.jpeg +0 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.003.bb +5 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.003.jpeg +0 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.aux +3 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.dvi +0 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.log +261 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.tex +54 -0
- data/hikiutils_bob/latex_dir/hikiutils_bob.toc +22 -0
- data/hikiutils_bob/latex_dir/latex_all.aux +31 -0
- data/hikiutils_bob/latex_dir/latex_all.tex +164 -0
- data/hikiutils_bob/latex_dir/pre.tex +36 -0
- data/hikiutils_bob/latex_dir/sync.aux +41 -0
- data/hikiutils_bob/latex_dir/sync.log +183 -0
- data/hikiutils_bob/latex_dir/sync.pdf +0 -0
- data/hikiutils_bob/latex_dir/sync.synctex.gz +0 -0
- data/hikiutils_bob/latex_dir/sync.tex +200 -0
- data/hikiutils_bob/latex_dir/to_latex.tex +44 -0
- data/hikiutils_bob/private_dir.graffle +1195 -0
- data/hikiutils_bob/sync.hiki +170 -0
- data/hikiutils_yamane/Rakefile +210 -9
- data/hikiutils_yamane/hiki_help.yml +53 -66
- data/hikiutils_yamane/latex_dir/command_table.aux +4 -0
- data/hikiutils_yamane/latex_dir/command_table.log +152 -0
- data/hikiutils_yamane/latex_dir/command_table.pdf +0 -0
- data/hikiutils_yamane/latex_dir/command_table.synctex.gz +0 -0
- data/hikiutils_yamane/latex_dir/command_table.tex +29 -0
- data/hikiutils_yamane/latex_dir/head.tex +8 -0
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.aux +1 -0
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.log +170 -0
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.pdf +0 -0
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.synctex.gz +0 -0
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.tex +48 -0
- data/hikiutils_yamane/latex_dir/hikiutils_yamane.toc +0 -0
- data/hikiutils_yamane/latex_dir/pre.tex +36 -0
- data/lib/hikiutils/version.rb +1 -1
- data/lib/hikiutils.rb +13 -8
- data/lib/templates/Rakefile_hiki_sync +146 -14
- data/lib/templates/head.tex +8 -0
- data/lib/templates/pre.tex +36 -0
- metadata +53 -2
@@ -1,5 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
require 'systemu'
|
3
|
+
require 'tempfile'
|
3
4
|
# -*- coding: utf-8 -*-
|
4
5
|
begin
|
5
6
|
target_dir = File.readlines('./.hikirc')[0].chomp
|
@@ -7,14 +8,125 @@ rescue => e
|
|
7
8
|
puts e
|
8
9
|
exit
|
9
10
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
dirnames=Dir.pwd.split('/')
|
12
|
+
basename = (dirnames[-1]=='hikis')? dirnames[-2] : dirnames[-1]
|
13
|
+
$latex_dir= 'latex_dir'
|
13
14
|
|
14
15
|
task :default do
|
15
16
|
system 'rake -T'
|
16
17
|
end
|
17
18
|
|
19
|
+
desc "latex conversion FILE1"
|
20
|
+
task :latex => [:latex_base] do
|
21
|
+
exit
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "latex conversion FILE1 with wrap format"
|
25
|
+
task :latex_wrap => [:latex_base, :change_wrap] do
|
26
|
+
exit
|
27
|
+
end
|
28
|
+
|
29
|
+
desc "latex conversion whole hiki files in the current dir."
|
30
|
+
task :latex_all do
|
31
|
+
p entries=Dir.entries('.')
|
32
|
+
main_file=""
|
33
|
+
entries.each{|file|
|
34
|
+
next unless file.include?('.hiki')
|
35
|
+
next if file.include?('.hikirc')
|
36
|
+
f_name =File.basename(file,'.hiki')
|
37
|
+
if f_name==basename
|
38
|
+
option="--listings --head latex_dir/head.tex -p "
|
39
|
+
main_file=f_name
|
40
|
+
else
|
41
|
+
option="-l 2 --listings -b "
|
42
|
+
end
|
43
|
+
convert_to_latex(file, option)
|
44
|
+
}
|
45
|
+
cont=""
|
46
|
+
File.readlines(File.join($latex_dir,"#{main_file}.tex")).each{|line|
|
47
|
+
if line.match(/\\section{(.+)}/)
|
48
|
+
if m=line.match(/\\section{\\verb\|(.+)\|}/)
|
49
|
+
p m
|
50
|
+
p reg_exp = Regexp.new("#{basename}_(.+)")
|
51
|
+
p m_t=m[1].match(reg_exp)[1]
|
52
|
+
line = "\\include{#{m_t}}\n"
|
53
|
+
else
|
54
|
+
line = ""
|
55
|
+
end
|
56
|
+
end
|
57
|
+
cont << line
|
58
|
+
}
|
59
|
+
File.open(File.join($latex_dir,"#{main_file}.tex"),'w'){|file| file.print cont}
|
60
|
+
system "open latex_dir/#{main_file}.tex"
|
61
|
+
exit
|
62
|
+
end
|
63
|
+
|
64
|
+
desc "change latex figures to wrap format"
|
65
|
+
task :change_wrap do
|
66
|
+
lines = File.readlines($save_name)
|
67
|
+
|
68
|
+
cont = ""
|
69
|
+
lines.each{|line|
|
70
|
+
if line.include?('\begin{figure}[htbp]\begin{center}')
|
71
|
+
p line
|
72
|
+
cont << '\begin{wrapfigure}{r}{8cm}'+"\n"
|
73
|
+
cont << '\vspace{-2\baselineskip}'+"\n"
|
74
|
+
cont << '\begin{center}'+"\n"
|
75
|
+
elsif line.include?('\label{default}\end{center}\end{figure}')
|
76
|
+
p line
|
77
|
+
cont << '\end{center}'+"\n"
|
78
|
+
cont << '\vspace{2\baselineskip}'+"\n"
|
79
|
+
cont << '\end{wrapfigure}'+"\n"
|
80
|
+
else
|
81
|
+
cont << line
|
82
|
+
end
|
83
|
+
}
|
84
|
+
File.open($save_name,'w'){|file| file.print cont }
|
85
|
+
|
86
|
+
system("open #{$save_name}")
|
87
|
+
exit
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
desc "latex conversion FILE1(hiki) to FILE2(latex)"
|
92
|
+
task :latex_base do
|
93
|
+
Dir.mkdir($latex_dir) unless Dir.exist?($latex_dir)
|
94
|
+
convert_to_latex(ARGV[1])
|
95
|
+
system("open #{$save_name}")
|
96
|
+
end
|
97
|
+
|
98
|
+
def convert_to_latex(file_name, option=nil)
|
99
|
+
p file_name = file_name.include?('.hiki')? file_name : file_name+'.hiki'
|
100
|
+
p tex_name = File.basename(file_name,'.hiki')+'.tex'
|
101
|
+
p $save_name = ARGV[2] || File.join($latex_dir,tex_name)
|
102
|
+
pre_name = File.join($latex_dir,'pre.tex')
|
103
|
+
p pre_command = File.exist?(pre_name) ? '--pre '+pre_name : nil
|
104
|
+
lines = File.readlines(file_name)
|
105
|
+
cont = ""
|
106
|
+
lines.each{|line|
|
107
|
+
if m=line.match(/\{\{attach_view\((.*),(.*)\)\}\}/)
|
108
|
+
p line="\{\{attach_view\(#{m[1]}\)\}\}\n"
|
109
|
+
end
|
110
|
+
cont << line
|
111
|
+
}
|
112
|
+
tf1,tf2='tmp1.txt','tmp2.txt'
|
113
|
+
File.open(tf1,'w'){|file| file.print cont}
|
114
|
+
system "hiki2latex #{pre_command} #{option} #{tf1} > #{tf2}"
|
115
|
+
lines = File.readlines(tf2)
|
116
|
+
system "rm #{tf1} #{tf2}"
|
117
|
+
|
118
|
+
cont = ""
|
119
|
+
lines.each{|line|
|
120
|
+
if m=line.match(/\\includegraphics\[width=6cm\]\{(.+)\}/)
|
121
|
+
p line="\\includegraphics\[width=6cm,bb=0 0 442 500\]\{../figs/#{m[1]}\}\n"
|
122
|
+
cont << line
|
123
|
+
else
|
124
|
+
cont << line
|
125
|
+
end
|
126
|
+
}
|
127
|
+
File.open($save_name,'w'){|file| file.print cont }
|
128
|
+
end
|
129
|
+
|
18
130
|
desc "increment fig NUBERS in FILE"
|
19
131
|
task :increment do
|
20
132
|
number=ARGV[1]
|
@@ -35,6 +147,27 @@ task :increment do
|
|
35
147
|
exit
|
36
148
|
end
|
37
149
|
|
150
|
+
desc "numbering figs from the NUBER in FILE"
|
151
|
+
task :number do
|
152
|
+
number=ARGV[1].to_i
|
153
|
+
file = ARGV[2]
|
154
|
+
dir = ARGV[3] || nil
|
155
|
+
lines = File.readlines(file)
|
156
|
+
cont = ""
|
157
|
+
lines.each{|line|
|
158
|
+
if m=line.match(/\{\{attach_view\((\w+|_).(\d+).jpeg,(\w+)\)\}\}/)
|
159
|
+
new_num=sprintf("%03d",number)
|
160
|
+
line="\{\{attach_view\(#{m[1]}.#{new_num}.jpeg,#{m[3]}\)\}\}\n"
|
161
|
+
cont << line
|
162
|
+
number += 1
|
163
|
+
else
|
164
|
+
cont << line
|
165
|
+
end
|
166
|
+
}
|
167
|
+
print cont
|
168
|
+
exit
|
169
|
+
end
|
170
|
+
|
38
171
|
desc "convert fig size SCALE TARGET_DIR"
|
39
172
|
task :convert do
|
40
173
|
scale = ARGV[1]
|
@@ -106,30 +239,29 @@ end
|
|
106
239
|
desc "check previou and current sync"
|
107
240
|
task :check_previous do
|
108
241
|
current={}
|
242
|
+
print "current hiki dir\n"
|
109
243
|
status, stdout, stderr = systemu("hiki -l #{basename}*")
|
110
244
|
stdout.split("\n")[3..-1].each{|line|
|
111
|
-
p
|
245
|
+
p line
|
246
|
+
file= line.split(/\s+/)[-1]
|
112
247
|
current[file]=line
|
113
248
|
}
|
114
249
|
previous={}
|
250
|
+
print "previous sync\n"
|
115
251
|
File.readlines('.hikirc')[1..-1].each{|line|
|
116
|
-
p
|
252
|
+
p line.chomp
|
253
|
+
file= line.split(/\s+/)[-1]
|
117
254
|
previous[file]=line.chomp
|
118
255
|
}
|
119
|
-
|
256
|
+
changed = []
|
120
257
|
current.each_pair{|key,val|
|
121
|
-
if !previous.include?(key)
|
122
|
-
added[key]=val
|
123
|
-
elsif previous[key]!=val
|
258
|
+
if !previous.include?(key) or previous[key]!=val
|
124
259
|
changed << val+"\n"
|
125
|
-
else
|
126
|
-
|
127
260
|
end
|
128
261
|
}
|
129
|
-
if changed.size != 0
|
262
|
+
if changed.size != 0
|
130
263
|
print("hiki dirで変更が発生しています.\n")
|
131
|
-
changed.each{|line| print line+"\n"}
|
132
|
-
added.each{|line| print line+"\n"}
|
264
|
+
changed.each{|line| print line+"\n"}
|
133
265
|
exit
|
134
266
|
end
|
135
267
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
\documentclass[10pt,a4j]{article}
|
2
|
+
|
3
|
+
\def\Vec#1{\mbox{\boldmath $#1$}}
|
4
|
+
\usepackage[dvipdfmx]{graphicx}
|
5
|
+
|
6
|
+
\setlength{\textheight}{275mm}
|
7
|
+
\headheight 5mm
|
8
|
+
\topmargin -20mm
|
9
|
+
\textwidth 160mm
|
10
|
+
\textheight 250mm
|
11
|
+
\oddsidemargin -0mm
|
12
|
+
\evensidemargin -5mm
|
13
|
+
|
14
|
+
\pagestyle{empty}
|
15
|
+
\makeatletter
|
16
|
+
\def\@maketitle{%
|
17
|
+
\newpage\null
|
18
|
+
\vskip 2em%
|
19
|
+
\begin{center}%
|
20
|
+
\let\footnote\thanks
|
21
|
+
{\large\bf \@title \par}%
|
22
|
+
\vskip 1.5em%
|
23
|
+
{\large\bf \@author \par}%
|
24
|
+
\vskip 1.5em%
|
25
|
+
{\small \@date}%
|
26
|
+
\end{center}%
|
27
|
+
}
|
28
|
+
\makeatother
|
29
|
+
|
30
|
+
%\documentclass[10pt, a4j]{article}
|
31
|
+
%%\usepackage{citesort}
|
32
|
+
\usepackage{amssymb}
|
33
|
+
\usepackage[dvipdfmx]{graphicx}% 図を入れるときに使用
|
34
|
+
\usepackage{wrapfig}% 図の周りに本文を流し込みたいときに使用
|
35
|
+
\usepackage{subfigure}
|
36
|
+
\usepackage{here}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hikiutils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.3.
|
4
|
+
version: 0.2.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shigeto R. Nishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -282,11 +282,60 @@ files:
|
|
282
282
|
- hikiutils.wiki/README.md
|
283
283
|
- hikiutils.wiki/README_ja.md
|
284
284
|
- hikiutils.wiki/yamane.md
|
285
|
+
- hikiutils_bob/.gitignore
|
286
|
+
- hikiutils_bob/Rakefile
|
287
|
+
- hikiutils_bob/figs/hikiutils_bob.001.jpeg
|
288
|
+
- hikiutils_bob/figs/hikiutils_bob.002.jpeg
|
289
|
+
- hikiutils_bob/figs/hikiutils_bob.003.jpeg
|
290
|
+
- hikiutils_bob/hiki_help.yml
|
291
|
+
- hikiutils_bob/hikiutils_bob.hiki
|
292
|
+
- hikiutils_bob/hikiutils_bob.key
|
293
|
+
- hikiutils_bob/hikiutils_bob/hikiutils_bob.001.jpeg
|
294
|
+
- hikiutils_bob/hikiutils_bob/hikiutils_bob.002.jpeg
|
295
|
+
- hikiutils_bob/hikiutils_bob/hikiutils_bob.003.jpeg
|
296
|
+
- hikiutils_bob/latex_all.hiki
|
297
|
+
- hikiutils_bob/latex_dir/head.tex
|
298
|
+
- hikiutils_bob/latex_dir/hikiutils_bob
|
299
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.001.bb
|
300
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.001.jpeg
|
301
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.002.bb
|
302
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.002.jpeg
|
303
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.003.bb
|
304
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.003.jpeg
|
305
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.aux
|
306
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.dvi
|
307
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.log
|
308
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.tex
|
309
|
+
- hikiutils_bob/latex_dir/hikiutils_bob.toc
|
310
|
+
- hikiutils_bob/latex_dir/latex_all.aux
|
311
|
+
- hikiutils_bob/latex_dir/latex_all.tex
|
312
|
+
- hikiutils_bob/latex_dir/pre.tex
|
313
|
+
- hikiutils_bob/latex_dir/sync.aux
|
314
|
+
- hikiutils_bob/latex_dir/sync.log
|
315
|
+
- hikiutils_bob/latex_dir/sync.pdf
|
316
|
+
- hikiutils_bob/latex_dir/sync.synctex.gz
|
317
|
+
- hikiutils_bob/latex_dir/sync.tex
|
318
|
+
- hikiutils_bob/latex_dir/to_latex.tex
|
319
|
+
- hikiutils_bob/private_dir.graffle
|
320
|
+
- hikiutils_bob/sync.hiki
|
285
321
|
- hikiutils_yamane/.gitignore
|
286
322
|
- hikiutils_yamane/Rakefile
|
287
323
|
- hikiutils_yamane/command_table.hiki
|
288
324
|
- hikiutils_yamane/hiki_help.yml
|
289
325
|
- hikiutils_yamane/hikiutils_yamane.hiki
|
326
|
+
- hikiutils_yamane/latex_dir/command_table.aux
|
327
|
+
- hikiutils_yamane/latex_dir/command_table.log
|
328
|
+
- hikiutils_yamane/latex_dir/command_table.pdf
|
329
|
+
- hikiutils_yamane/latex_dir/command_table.synctex.gz
|
330
|
+
- hikiutils_yamane/latex_dir/command_table.tex
|
331
|
+
- hikiutils_yamane/latex_dir/head.tex
|
332
|
+
- hikiutils_yamane/latex_dir/hikiutils_yamane.aux
|
333
|
+
- hikiutils_yamane/latex_dir/hikiutils_yamane.log
|
334
|
+
- hikiutils_yamane/latex_dir/hikiutils_yamane.pdf
|
335
|
+
- hikiutils_yamane/latex_dir/hikiutils_yamane.synctex.gz
|
336
|
+
- hikiutils_yamane/latex_dir/hikiutils_yamane.tex
|
337
|
+
- hikiutils_yamane/latex_dir/hikiutils_yamane.toc
|
338
|
+
- hikiutils_yamane/latex_dir/pre.tex
|
290
339
|
- lib/hikiutils.rb
|
291
340
|
- lib/hikiutils/#tmarshal.rb#
|
292
341
|
- lib/hikiutils/infodb.rb
|
@@ -294,7 +343,9 @@ files:
|
|
294
343
|
- lib/hikiutils/version.rb
|
295
344
|
- lib/hikiutils_thor.rb
|
296
345
|
- lib/templates/Rakefile_hiki_sync
|
346
|
+
- lib/templates/head.tex
|
297
347
|
- lib/templates/hiki_help.yml
|
348
|
+
- lib/templates/pre.tex
|
298
349
|
homepage: http://github.org/daddygongon/hikiutils
|
299
350
|
licenses:
|
300
351
|
- MIT
|