[logaling-commit] logaling/logaling-command [master] Add glossary when render formatted json or csv

Back to archive index

null+****@clear***** null+****@clear*****
Thu Jun 28 19:33:54 JST 2012


SUZUKI Miho	2012-06-28 19:33:54 +0900 (Thu, 28 Jun 2012)

  New Revision: 12144354bee4ef4af690a2c33cb3ad245e121015
  https://github.com/logaling/logaling-command/commit/12144354bee4ef4af690a2c33cb3ad245e121015

  Merged 0a620e0: Merge pull request #62 from logaling/add-glossary-to-json-and-csv-output

  Log:
    Add glossary when render formatted json or csv

  Modified files:
    lib/logaling/command/renderers.rb

  Modified: lib/logaling/command/renderers.rb (+16 -11)
===================================================================
--- lib/logaling/command/renderers.rb    2012-06-28 12:01:18 +0900 (9d1e6db)
+++ lib/logaling/command/renderers.rb    2012-06-28 19:33:54 +0900 (b13947b)
@@ -28,15 +28,7 @@ module Logaling::Command
       def render(output); end
 
       def glossary_name
-        if****@repos*****_counts > 1
-          if @term[:glossary_name] ==****@confi*****
-            @term[:glossary_name].foreground(:white).background(:green)
-          else
-            @term[:glossary_name]
-          end
-        else
-          ""
-        end
+        @term[:glossary_name]
       end
 
       def note
@@ -83,6 +75,18 @@ module Logaling::Command
         output.printf("  %-#{@max_str_size+10}s %s\n", source_term, format)
       end
 
+      def glossary_name
+        if****@repos*****_counts > 1
+          if @term[:glossary_name] ==****@confi*****
+            @term[:glossary_name].foreground(:white).background(:green)
+          else
+            @term[:glossary_name]
+          end
+        else
+          ""
+        end
+      end
+
       def note
         note_string = super
         "# #{note_string}" if note_string
@@ -92,7 +96,7 @@ module Logaling::Command
     class TermCsvRenderer < TermRenderer
       def render(output)
         items = [source_term, target_term, note,
-                 @config.source_language, @config.target_language]
+                 @config.source_language, @config.target_language, glossary_name]
         output.print(CSV.generate {|csv| csv << items})
       end
     end
@@ -111,7 +115,8 @@ module Logaling::Command
         record = {
           :source => source_term, :target => target_term, :note => note,
           :source_language => @config.source_language,
-          :target_language => @config.target_language
+          :target_language => @config.target_language,
+          :glossary => glossary_name
         }
         output.print JSON.pretty_generate(record)
         output.puts("\n]") if last_line?
-------------- next part --------------
An HTML attachment was scrubbed...
下载 



More information about the logaling-commit mailing list
Back to archive index