lbt 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c9da52e531926f42a9bb93585b0d04ff1a74f2de4db2f816793cdfa0812de12d
4
- data.tar.gz: 67fe9f7f808e207a832dad8c6561eef93cd46110be4d92123884845cee2772e1
3
+ metadata.gz: a9cf39baff107d837fdd02c88764d3b161b9569cc3298b479917d44b371a3e63
4
+ data.tar.gz: 754274ca6ee26d3bccfe6b3f1c87621c73ef52bbf37190fc67b9d1cda430b931
5
5
  SHA512:
6
- metadata.gz: 7b35e5b8d74c99d3e13d202e476a3b38a56b57bf3cd33836c3be01e8cff37380f4ddd2eabe06bf51eb31e551fd9c1efc352d847ebc037eb6213945cd69e4bb04
7
- data.tar.gz: f07ce4110e54c2a5fb2490a35a8af103e508db5469cd616225ec53e82f7d38103682b9294726be0220346c7e336d92391426ed8450a1bbd21e7b0ba6c588a4e2
6
+ metadata.gz: 34a14917dc084b5185f7b688d089aed5dd3ac9e28b8805d132ebc61884e7c6739448f49ea482c77eb144502b9bc5f6cb7e0d3b2116939e667afca9dc9d8ca924
7
+ data.tar.gz: 7afad25c64d3bdd470c61015b090db21aebb527c1b1ffd3fb827a29f1b2642dea937ccf935b66c78de1101dd137af03f284f93f41e366beb613156e989f2a884
data/README.md CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  # LaTeX Build Tools
4
4
 
5
- LaTeX Build Tools is a tool to maintain big LaTeX source files.
6
- This version is different from the old versions as follows.
5
+ LaTeX Build Tools is a tool to manage big LaTeX source files.
6
+ This version is different from the old versions.
7
7
 
8
8
  - Use `lbt` command to run every sub commands.
9
- - It is provided as a gem.
9
+ - It is provided as a gem, which is a Ruby library program.
10
10
 
11
11
  The old versions, the one with rake and the other of bash scripts, are moved to the other branches, `rake_version` and `bash` respectively.
12
12
 
13
- LaTeX Build Tools supports `lualatex` engine only.
13
+ LaTeX Build Tools supports LuaLaTeX engine only.
14
14
  If you want to use another engine, you need to modify `lib/lbt/build.rb` and `lib/lbt/part_typeset.rb`.
15
15
 
16
16
  ## Prerequisite
@@ -37,11 +37,11 @@ If you want to install it from the source code, do the following.
37
37
  2. Unzip the downloaded Zip file, then a new directory `LaTeX-BuildTools-master` will be created.
38
38
  3. Type `gem build lbt` under the directory, then the gem file `lbt-X.X.X.gem` is created.
39
39
  The number `X.X.X` is the version number like `0.5.2`.
40
- 1. Type `gem install lbt-X.X.X.gem`.
40
+ 1. Type `gem install lbt-X.X.X.gem`, where `X.X.X` is the version number.
41
41
 
42
42
  ## Document
43
43
 
44
- See [Tutorial](Tutorial.md).
44
+ See [Tutorial.en](https://toshiocp.github.io/LaTeX-BuildTools/Tutorial_en_md.html).
45
45
 
46
46
  ## License
47
47
 
@@ -51,16 +51,16 @@ GPL. See [License.md](License.md).
51
51
 
52
52
  # LaTeX Build Tools
53
53
 
54
- LaTeX Build Toolsは大きなLaTeXソースファイルを管理するためのツールである。
55
- 現在の版は次の2点が旧版と異なっている。
54
+ LaTeX Build Toolsは大きなLaTeXソースファイルを管理するためのツールです。
55
+ 現在の版は次の2点が旧版と異なっています。
56
56
 
57
57
  - lbtというコマンドからすべてを起動
58
- - gemとして提供される
58
+ - gem(Rubyのライブラリ・プログラム)として提供される
59
59
 
60
- 旧版の、rakeを用いる版とbashスクリプト版は、それぞれ`rake_version`ブランチと`bash`ブランチに移動した。
60
+ 旧版の、rakeを用いる版とbashスクリプト版は、それぞれ`rake_version`ブランチと`bash`ブランチに移動しました。
61
61
 
62
- LaTeX Build ToolsがサポートするLaTeXエンジンはlualatexである。
63
- その他のエンジンを使いたい場合は`lib/lbt/build.rb`と`lib/lbt/part_typeset.rb`の修正が必要である。
62
+ LaTeX Build ToolsがサポートするLaTeXエンジンはLuaLaTeXです。
63
+ その他のエンジンを使いたい場合は`lib/lbt/build.rb`と`lib/lbt/part_typeset.rb`の修正が必要です。
64
64
 
65
65
  ## 動作条件
66
66
 
@@ -86,11 +86,11 @@ $ gem install lbt
86
86
  2. ZIPファイルを解凍すると`LaTeX-BuildTools-master`というディレクトリが作られる
87
87
  3. 端末をそのディレクトリに移動して`gem build lbt`とタイプすると、`lbt-X.X.X.gem`というGemファイルが作られる。
88
88
  この中の`X.X.X`はバージョン番号で、例えば`0.5.2`などのようなものである
89
- 4. `gem install lbt-X.X.X.gem`とタイプしてインストールする
89
+ 4. `gem install lbt-X.X.X.gem`とタイプしてインストールする(`X.X.X`はバージョン番号)
90
90
 
91
91
  ## ドキュメント
92
92
 
93
- [チュートリアル](Tutorial.ja.md)を参照してほしい。
93
+ 使い方の説明は[Tutorial.ja](https://toshiocp.github.io/LaTeX-BuildTools/Tutorial_ja_md.html)を参照してほしい。
94
94
 
95
95
  ## ライセンス
96
96
 
data/Tutorial.en.md CHANGED
@@ -131,4 +131,30 @@ If you want to renamed these (sec1.md, sec1.5.md and sec2.md) into consecutive n
131
131
 
132
132
  ```
133
133
  $ lbt renum
134
- ```
134
+ ```
135
+
136
+ # Pandoc and Top-Level-Division option
137
+
138
+ Lbt uses Pandoc to convert Markdown to LaTeX.
139
+ The default behavior of Pandoc is from the ATX-heading `#` to `\section`.
140
+ See `--top-level-division` option in the Pandoc document.
141
+
142
+ You can change it by modifying `.config` file in your LaTeX-file directory.
143
+ For example, the following makes the conversion from `#` to `\chapter`.
144
+
145
+ ```
146
+ $ cat .config
147
+ build_dir = _build
148
+ top-level-division = chapter
149
+ ```
150
+
151
+ The format is `top-level-division = (part, chapter or section)`.
152
+
153
+ The table shows the commonly used top-level-division.
154
+
155
+ |documentclass|top level division|
156
+ |:-----|:-----|
157
+ |book|chapter or part|
158
+ |report|chapter|
159
+ |article|section|
160
+ |beamer|section|
data/Tutorial.ja.md CHANGED
@@ -126,3 +126,30 @@ renumサブコマンドを実行することでリナンバーできます。
126
126
  ```
127
127
  $ lbt renum
128
128
  ```
129
+
130
+ # Pandoc と Top-Level-Division オプション
131
+
132
+ LbtはPandocを用いてMarkdownをLaTeXに変換しています。
133
+ デフォルトでは、PandocはATX見出しの`#`を`\section`に変換します。
134
+ 詳しくはPandocのドキュメントの`--top-level-division`を参照してください。
135
+
136
+ これを、LaTeXファイルのディレクトリにある`.config`ファイルを書き換えることで変更できます。
137
+ 例えば、下記のようにすると、`#`が`\chapter`に対応するようになります。
138
+
139
+ ```
140
+ $ cat .config
141
+ build_dir = _build
142
+ top-level-division = chapter
143
+ ```
144
+
145
+ 書き方の書式は`top-level-division = (part, chapter or section)`です。
146
+
147
+ 下記の表は一般的に良く用いられるtop-level-divisionです。
148
+
149
+ |documentclass|top level division|
150
+ |:-----|:-----|
151
+ |book|chapter or part|
152
+ |report|chapter|
153
+ |article|section|
154
+ |beamer|section|
155
+
data/lib/lbt/build.rb CHANGED
@@ -3,8 +3,8 @@ require_relative 'utils.rb'
3
3
  module Lbt
4
4
  # Typeset LaTeX source files into a PDF file.
5
5
  def build
6
- m = File.read(".config").match(/^build_dir = (.*)$/)
7
- build_dir = m[1] ? m[1] : "_build"
6
+ m = get_config[:'build_dir']
7
+ build_dir = m ? m : "_build"
8
8
  raise "main.tex not exist." unless File.exist?('main.tex')
9
9
  mkdir build_dir unless Dir.exist?(build_dir)
10
10
 
@@ -16,8 +16,8 @@ module Lbt
16
16
  return unless File.file? file
17
17
  end
18
18
 
19
- m = File.read(".config").match(/^build_dir = (.*)$/)
20
- build_dir = m[1] ? m[1] : "_build"
19
+ m = get_config[:'build_dir']
20
+ build_dir = m ? m : "_build"
21
21
  raise "main.tex not exist." unless File.exist?('main.tex')
22
22
  mkdir build_dir unless Dir.exist?(build_dir)
23
23
 
data/lib/lbt/utils.rb CHANGED
@@ -105,9 +105,17 @@ If the files are as above, the PCS instance keeps the six filenames whch are sor
105
105
  end
106
106
  end
107
107
 
108
+ # Convert '.config' file into a Hash
109
+ def get_config
110
+ return {} unless File.exist?(".config")
111
+ File.read(".config").split(/\n/).map{|s| s.split('=')}.map{|key, val| [key.strip.to_sym, val.strip]}.to_h
112
+ end
113
+
108
114
  # Return a hash (key: extension, value: Proc object) of converters.
109
115
  def get_converters
110
- converters = {'.md': lambda {|src, dst| system("pandoc -o #{dst} #{src}")} }
116
+ tld = get_config[:'top-level-division']
117
+ tld = tld ? tld : "default"
118
+ converters = {'.md': lambda {|src, dst| system("pandoc --top-level-division=#{tld} -o #{dst} #{src}")} }
111
119
  if File.file?("converters.rb")
112
120
  c = eval(File.read("converters.rb"))
113
121
  c.each {|key, val| converters[key] = val} if c.is_a?(Hash)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lbt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toshio Sekiya
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-19 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Lbt is a build tool for LaTeX. It is useful for big documents.
14
14
  email: lxboyjp@gmail.com
@@ -35,7 +35,8 @@ files:
35
35
  homepage: https://github.com/ToshioCP/LaTeX-BuildTools
36
36
  licenses:
37
37
  - GPL-3.0
38
- metadata: {}
38
+ metadata:
39
+ documentation_uri: https://toshiocp.github.io/LaTeX-BuildTools/
39
40
  post_install_message:
40
41
  rdoc_options: []
41
42
  require_paths:
@@ -51,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
52
  - !ruby/object:Gem::Version
52
53
  version: '0'
53
54
  requirements: []
54
- rubygems_version: 3.4.10
55
+ rubygems_version: 3.4.21
55
56
  signing_key:
56
57
  specification_version: 4
57
58
  summary: LaTeX Build Tools