hiki2latex 0.9.7 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/lib/hiki2latex/hiki2latex.rb +2 -1
- data/lib/hiki2latex/version.rb +1 -1
- data/lib/hiki2latex.rb +42 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8fa893fc79f322dc2d90b0c6e1b89728ab768e4
|
4
|
+
data.tar.gz: 8a6207d9066183b84b6d21d763d7ff8b10b135fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4133ba81a07dd5d763e41980ef30ed4d959742325d6a2ab507f1143db6a2be11ab195b5632a76f0dabb34e2ad3bf6ca041a11095774b32dd15301805031425c7
|
7
|
+
data.tar.gz: 5fb830ec754c8d28116c83054d92bf86c3d7d4867ed516f4192148c4ea275e14d6a92c0c2c2560b017af99453fb8fb4dd3ea84a587cf4c442ccb76d40c4b2d3c
|
data/Rakefile
CHANGED
@@ -28,7 +28,7 @@ task :update do
|
|
28
28
|
system 'git commit'
|
29
29
|
system 'git push -u origin master'
|
30
30
|
print 'in kwansei.ac.jp, you need setenv for proxy.'
|
31
|
-
|
32
|
-
|
31
|
+
puts 'setenv HTTP_PROXY http://proxy.kwansei.ac.jp:8080'
|
32
|
+
puts 'setenv HTTP_PROXY http://proxy.ksc.kwansei.ac.jp:8080'
|
33
33
|
system 'bundle exec rake release'
|
34
34
|
end
|
@@ -50,7 +50,7 @@ class LatexOutput
|
|
50
50
|
def headline(level, title)
|
51
51
|
title = escape_snake_names(title)
|
52
52
|
tmp=title.split(/:/)
|
53
|
-
if tmp.size
|
53
|
+
if tmp.size==2 then
|
54
54
|
case tmp[0]
|
55
55
|
when 'title','author','date','abstract'
|
56
56
|
@head << "\\#{tmp[0]}\{#{tmp[1]}\}\n"
|
@@ -62,6 +62,7 @@ class LatexOutput
|
|
62
62
|
@f << "\\section*\{#{tmp[1]}\}\n"
|
63
63
|
else
|
64
64
|
@f << "\\#{tmp[0]}\{#{tmp[1]}\}\n"
|
65
|
+
# @f << "#{title}\n"
|
65
66
|
end
|
66
67
|
return
|
67
68
|
end
|
data/lib/hiki2latex/version.rb
CHANGED
data/lib/hiki2latex.rb
CHANGED
@@ -41,7 +41,7 @@ module Hiki2latex
|
|
41
41
|
|
42
42
|
def plain_doc(file)
|
43
43
|
if @listings==true then
|
44
|
-
puts
|
44
|
+
puts listings_preamble
|
45
45
|
elsif @pre==nil then
|
46
46
|
puts "\\documentclass[12pt,a4paper]{jsarticle}"
|
47
47
|
puts "\\usepackage[dvipdfmx]{graphicx}"
|
@@ -50,16 +50,46 @@ module Hiki2latex
|
|
50
50
|
end
|
51
51
|
puts "\\begin{document}"
|
52
52
|
puts File.read(@head) if @head!=nil
|
53
|
-
|
53
|
+
plain_tex = HikiDoc.to_latex(File.read(file),{:listings=>@listings})
|
54
|
+
puts mod_abstract(plain_tex)
|
54
55
|
puts File.read(@post) if @post!=nil
|
55
56
|
puts "\\end{document}"
|
56
57
|
end
|
57
58
|
|
58
59
|
def bare_doc(file)
|
59
|
-
|
60
|
+
bare_doc = HikiDoc.to_latex(File.read(file),{:level=>@level,:listings=>@listings})
|
61
|
+
puts kill_head_tableofcontents(bare_doc)
|
60
62
|
end
|
61
63
|
|
62
|
-
def
|
64
|
+
def kill_head_tableofcontents(text)
|
65
|
+
text.gsub!(/^\\tableofcontents/,'')
|
66
|
+
end
|
67
|
+
|
68
|
+
def mod_abstract(text)
|
69
|
+
abstract = []
|
70
|
+
content = ""
|
71
|
+
section = []
|
72
|
+
text.split("\n").each do |line|
|
73
|
+
case line
|
74
|
+
when /\\section(.+)/
|
75
|
+
section.push $1
|
76
|
+
end
|
77
|
+
|
78
|
+
case section[-1]
|
79
|
+
when /.+abstract.+/
|
80
|
+
abstract << line+"\n"
|
81
|
+
else
|
82
|
+
content << line+"\n"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
abstract.delete_at(0)
|
86
|
+
content.gsub!(/\\tableofcontents/){|text|
|
87
|
+
tt="\n\\abstract\{\n#{abstract.join}\}\n\\tableofcontents"
|
88
|
+
}
|
89
|
+
return content
|
90
|
+
end
|
91
|
+
|
92
|
+
def listings_preamble
|
63
93
|
str = <<"EOS"
|
64
94
|
\\documentclass[12pt,a4paper]{jsarticle}
|
65
95
|
\\usepackage[dvipdfmx]{graphicx}
|
@@ -91,6 +121,14 @@ module Hiki2latex
|
|
91
121
|
language={ruby},
|
92
122
|
numbers=left,
|
93
123
|
}
|
124
|
+
\\lstdefinestyle{customTex}{
|
125
|
+
language={tex},
|
126
|
+
numbers=none,
|
127
|
+
}
|
128
|
+
\\lstdefinestyle{customJava}{
|
129
|
+
language={java},
|
130
|
+
numbers=left,
|
131
|
+
}
|
94
132
|
EOS
|
95
133
|
end
|
96
134
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiki2latex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.8
|
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: 2016-02-
|
11
|
+
date: 2016-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|