lib/hyla/commands/generate.rb in hyla-1.0.7 vs lib/hyla/commands/generate.rb in hyla-1.0.8

- old
+ new

@@ -347,13 +347,10 @@ end # Copy YAML Config file FileUtils.cp_r [Configuration::configs, Configuration::YAML_CONFIG_FILE_NAME] * '/', @out_dir - # Copy styles - # FileUtils.cp_r Configuration::styles, @out_dir - # # Move to the directory as we will # create content relative to this directory # Dir.chdir @out_dir @@ -381,11 +378,11 @@ # Increase counter. We will use it later to add the summary @counter+=1 # - # Add the summary.adoc file + # Create the summary.adoc file and add it to the index # if @counter > 1 self.generate_summary_page() end @@ -400,12 +397,12 @@ Hyla.logger2.info '>> Directory created : ' + new_dir + ' <<' Dir.chdir(new_dir) # Add image, audio, video directory - # self.create_asset_directory(['image', 'audio', 'video']) - self.create_asset_directory(['image']) + # self.create_asset_directory(['images', 'audio', 'video']) + self.create_asset_directory(['images']) # # Create an index file # It is used to include files belonging to a module and will be used for SlideShow # The file created contains a title (= Dir Name) and header with attributes @@ -441,34 +438,37 @@ # @index += 1 file_index = sprintf('%02d', @index) f_name = 'm' + @module_key + 'p' + file_index + '_cover' + Configuration::ADOC_EXT Hyla.logger2.debug '>> Directory name : ' + dir_name.to_s.gsub('_', ' ') - rep_txt = Configuration::COVER_TXT.gsub(/xxx\.png/, dir_name + '.png') - Hyla.logger2.debug "Replaced by : " + rep_txt + # rep_txt = Configuration::COVER_TXT.gsub(/xxx\.png/, dir_name + '.png') + # Hyla.logger2.debug "Replaced by : " + rep_txt cover_f = File.new(f_name, 'w') - cover_f.puts rep_txt + cover_f.puts Configuration::COVER_TXT cover_f.close # + # WE DON'T HAVE TO GENERATE AN IMAGE AS THE IMAGE IS CREATED BY REVEALJS + # # Use the filename & generate the cover image # - out_dir = 'image' - file_name = dir_name + '.html' - image_name = dir_name + '.png' - course_name = @project_name - module_name= dir_name - bg_image_path = image_path - Hyla.logger2.debug '>> Out Directory : ' + out_dir.to_s - Hyla.logger2.debug '>> Image name : ' + image_name.to_s - Hyla.logger2.debug '>> Course Name : ' + course_name.to_s - Hyla.logger2.debug '>> Module Name : ' + module_name.to_s - Hyla.logger2.debug '>> Bg Image : ' + bg_image_path.to_s - - self.cover_img(out_dir, file_name, image_name, course_name, module_name, bg_image_path, tool = nil) - + # out_dir = 'images' + # file_name = dir_name + '.html' + # image_name = dir_name + '.png' + # course_name = @project_name + # module_name= dir_name + # bg_image_path = image_path + # Hyla.logger2.debug '>> Out Directory : ' + out_dir.to_s + # Hyla.logger2.debug '>> Image name : ' + image_name.to_s + # Hyla.logger2.debug '>> Course Name : ' + course_name.to_s + # Hyla.logger2.debug '>> Module Name : ' + module_name.to_s + # Hyla.logger2.debug '>> Bg Image : ' + bg_image_path.to_s + # + # self.cover_img(out_dir, file_name, image_name, course_name, module_name, bg_image_path, tool = nil) # + + # # Include cover file to index # @index_file.puts Configuration::INCLUDE_PREFIX + f_name + Configuration::INCLUDE_SUFFIX @index_file.puts "\n" @@ -476,22 +476,21 @@ # Add the objectives.adoc file # @index += 1 file_index = sprintf('%02d', @index) f_name = 'm' + @module_key + 'p' + file_index + '_objectives' - - rep_txt = Configuration::OBJECTIVES_TXT.gsub(/xxx\.mp3/, f_name + '.mp3') - f_name = f_name + Configuration::ADOC_EXT + + # rep_txt = Configuration::OBJECTIVES_TXT.gsub(/xxx\.mp3/, f_name + '.mp3') objectives_f = File.new(f_name, 'w') objectives_f.puts Configuration::HEADER_TXT - objectives_f.puts rep_txt + objectives_f.puts Configuration::OBJECTIVES_TXT objectives_f.close # - # Include cover file to index + # Include objectives file to index # @index_file.puts Configuration::INCLUDE_PREFIX + f_name + Configuration::INCLUDE_SUFFIX @index_file.puts "\n" # @@ -526,12 +525,12 @@ if !@previous_f.nil? # # Add Footer_text to the file created # - rep_txt = Configuration::FOOTER_TXT.gsub(/xxx\.mp3/, @previous_f.to_s + '.mp3') - @previous_f.puts rep_txt + # rep_txt = Configuration::FOOTER_TXT.gsub(/xxx\.mp3/, @previous_f.to_s + '.mp3') + @previous_f.puts Configuration::FOOTER_TXT @previous_f.close end # # Replace special characters from the title before to generate the file name @@ -545,21 +544,19 @@ # Example : m01p01_mytitle.adoc, m01p02_anothertitle.adoc # @index += 1 file_index = sprintf('%02d', @index) f_name = 'm' + @module_key + 'p' + file_index + '_' + f_name - - rep_txt = Configuration::AUDIO_TXT.gsub(/xxx\.mp3/, f_name + '.mp3') - f_asciidoc_name = f_name + Configuration::ADOC_EXT + # rep_txt = Configuration::AUDIO_TXT.gsub(/xxx\.mp3/, f_name + '.mp3') + # # Create File and add configuration HEADER_TXT # @new_f = File.new(f_asciidoc_name, 'w') @new_f.puts Configuration::HEADER_TXT - @new_f.puts "\n" Hyla.logger2.info ' # File created : ' + f_asciidoc_name.to_s @previous_f = @new_f @@ -573,18 +570,18 @@ # if !@new_f.nil? and !line.start_with?(Configuration::SKIP_CHARACTERS) # # Add audio text after the name of the title # - # ifdef::audioscript[] + # ifdef::showscript[] # audio::audio/m01p03_why_use_messaging[] - # endif::[] + # endif::showscript[] # if line.start_with?('==') @new_f.puts line @new_f.puts "\n" - @new_f.puts rep_txt + # @new_f.puts rep_txt else @new_f.puts line end end @@ -626,18 +623,23 @@ def self.generate_summary_page() @index += 1 file_index = sprintf('%02d', @index) f_name = 'm' + @module_key + 'p' + file_index + '_summary' - - rep_txt = Configuration::SUMMARY_TXT.gsub(/xxx\.mp3/, f_name + '.mp3') - f_name = f_name + Configuration::ADOC_EXT + # rep_txt = Configuration::SUMMARY_TXT.gsub(/xxx\.mp3/, f_name + '.mp3') + summary_f = File.new(f_name, 'w') summary_f.puts Configuration::HEADER_TXT - summary_f.puts rep_txt + summary_f.puts Configuration::SUMMARY_TXT summary_f.close + + # + # Include summary file to index + # + @index_file.puts Configuration::INCLUDE_PREFIX + f_name + Configuration::INCLUDE_SUFFIX + @index_file.puts "\n" end def self.html_to_pdf(file_name, source, destination, footer_text, header_html_path, cover_path) @cover_path = cover_path