Class: Smartdict::Formats::Fb2Format
- Inherits:
-
AbstractFormat
- Object
- AbstractFormat
- Smartdict::Formats::Fb2Format
- Defined in:
- lib/smartdict/formats/fb2_format.rb
Instance Method Summary collapse
Methods inherited from AbstractFormat
format_list, format_translation, set_description
Instance Method Details
#format_list(translations) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/smartdict/formats/fb2_format.rb', line 7 def format_list(translations) xml = Builder::XmlMarkup.new(:indent => 2) xml.instruct! xml.FictionBook(:xmlns => "http://www.gribuser.ru/xml/fictionbook/2.0") do |book| book.description do |desc| desc.tag!("document-info") do |doc_info| doc_info.tag!("program-used", "Smartdict version #{Smartdict::VERSION}") end desc.tag!('title-info') do |title_info| title_info.tag!('book-title', "#{Time.now.strftime('%F')} - English words") title_info.genre 'sci_linguistic' title_info.annotation do |annotation| annotation.p "English words to learn" annotation.p "The content generate by program Smardict v#{Smartdict::VERSION}" end end end book.body do |body| body.title "TITLE" translations.each do |translation| body.section do |word_section| word_section.title {|title| title.p "#{translation.word} [#{translation.transcription}]"} translation.translated.each do |word_class, translations| word_section.subtitle word_class word_section.p translations.join("; ") word_section.tag!("empty-line") end end end end end end |