From: nangxiang Date: Sat, 23 Jul 2011 03:06:18 +0000 (+0900) Subject: Revised bd2tex with processing volumes and parts X-Git-Url: http://git.osdn.net/view?p=dianzhuhui%2Fscript.git;a=commitdiff_plain;h=d0c90a777571d85b4cbbd2cd3d3a8a83aabbac46 Revised bd2tex with processing volumes and parts --- diff --git a/bd2tex.rb b/bd2tex.rb index 893899d..2d641f3 100644 --- a/bd2tex.rb +++ b/bd2tex.rb @@ -48,16 +48,17 @@ class TexConverter end def parse_wordnum(doc) if doc.has_key?('part') then - push_wordnum(doc['part']) + push_wordnum('part', doc) elsif doc.has_key?('volume') - push_wordnum(doc['volume']) + push_wordnum('volume', doc) end end - def push_wordnum(lines) + def push_wordnum(type, doc) + lines = doc[type] if lines then - @wordlist.push(['wordnum', lines]) + @wordlist.push([type, lines]) else - @wordlist.push(['wordnum', []]) + @wordlist.push([type, []]) end end end diff --git a/bd2tex.rtex b/bd2tex.rtex index 0f824c8..8e8d145 100644 --- a/bd2tex.rtex +++ b/bd2tex.rtex @@ -25,8 +25,12 @@ <% @wordlist.each do |word| %> <% (char, content) = word %>% - <% if char != 'wordnum' then %> - {\HUGE\ebas <%= char %>}(<%= char %>) + <% if char == 'part' then %> + \hspace{4em} + <% elsif char == 'volume' then %> + \hspace{2em} + <% else %> + {\Huge\ebas <%= char %>}(<%= char %>) <% end %>% <% if content then %>% <% content.each do |line| %>%