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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acf56fc15ae33e9d3655a56db908f383f5ab116d
4
- data.tar.gz: 7588923c7e66cabd2e9ade0cfb9b588ddef879bb
3
+ metadata.gz: d8fa893fc79f322dc2d90b0c6e1b89728ab768e4
4
+ data.tar.gz: 8a6207d9066183b84b6d21d763d7ff8b10b135fe
5
5
  SHA512:
6
- metadata.gz: 5a79a7d3b203eadfe090e21f81b38a038b5e26d0b3aa7bdc947ac56b6bff7eba70ab7989ab2af2397d467c0ab9d881f5b4cdec740830a79b3691930fc6f6d2b5
7
- data.tar.gz: a7e09f9abc89787cdd28adc66991665d7212bcb13b6d69c2af22b17fcb0ea8e6ad759f2bbeb6638cdf76ee15624c46432f3821ea302248dd0641bef5ff121dd4
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
- print 'setenv HTTP_PROXY http://proxy.kwansei.ac.jp:8080'
32
- print 'setenv HTTP_PROXY http://proxy.ksc.kwansei.ac.jp:8080'
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!=1 then
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
@@ -1,3 +1,3 @@
1
1
  module Hiki2latex
2
- VERSION = "0.9.7"
2
+ VERSION = "0.9.8"
3
3
  end
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 listings_str
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
- puts HikiDoc.to_latex(File.read(file),{:listings=>@listings})
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
- puts HikiDoc.to_latex(File.read(file),{:level=>@level,:listings=>@listings})
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 listings_str
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.7
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-16 00:00:00.000000000 Z
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler