[logaling-commit] logaling/logaling-command [master] use 'search' instead of 'xpath'

Back to archive index

null+****@clear***** null+****@clear*****
Fri Apr 27 17:37:32 JST 2012


SUZUKI Miho	2012-04-27 17:37:32 +0900 (Fri, 27 Apr 2012)

  New Revision: e67b70d64aab7e23a159fba318b8f2e2d6d2f4f4

  Merged dc203a9: Merge pull request #58 from logaling/import-tmx

  Log:
    use 'search' instead of 'xpath'

  Modified files:
    lib/logaling/external_glossaries/tmx.rb

  Modified: lib/logaling/external_glossaries/tmx.rb (+2 -3)
===================================================================
--- lib/logaling/external_glossaries/tmx.rb    2012-04-27 16:41:37 +0900 (e31c48f)
+++ lib/logaling/external_glossaries/tmx.rb    2012-04-27 17:37:32 +0900 (333dbcf)
@@ -25,8 +25,7 @@ module Logaling
     private
     def convert_to_csv(csv, glossary_info)
       doc = ::Nokogiri::XML(open(glossary_info[:url], "r"))
-      tu_nodes = doc.xpath('//tu')
-      tu_nodes.each do |tu|
+      doc.search('//tu').each do |tu|
         original = ""
         translation = ""
         note = []
@@ -47,7 +46,7 @@ module Logaling
             end
           end
         end
-        csv << [original, translation, note.join(" | ")]
+        csv << [original, translation, note.join(" | ")] if original && translation
       end
     end
   end




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