From 0b3f7c25230f218fee0464169ad0a7b7ef3ddcab Mon Sep 17 00:00:00 2001 From: lagleki Date: Tue, 19 Nov 2019 19:55:35 +0300 Subject: [PATCH] apply #370 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` C coi vocative: greetings/hello. coi .djan. — Hello, John. coi .djan. — Hello, John. M mi pro-sumti: me/we the speaker(s)/author(s); identified by self-vocative. ``` --- scripts/generate_glossary.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/generate_glossary.rb b/scripts/generate_glossary.rb index 9dc60de80..7e9fabdbb 100755 --- a/scripts/generate_glossary.rb +++ b/scripts/generate_glossary.rb @@ -99,6 +99,7 @@ end definition=nil + examples=[] if opts[:testing] definition="placeholder definition" else @@ -131,14 +132,23 @@ definition=nil $stderr.puts %Q{NO JBOVLASTE DEFINITION FOR "#{word}" FOUND!} end + jbovlaste_tree.xpath(%Q{//valsi[@word="#{word}"]}).xpath(".//examples/example").each do |example| + source = Nokogiri::XML.parse(example.to_s).xpath("//source").text.strip + translation = Nokogiri::XML.parse(example.to_s).xpath(%Q{//target[@language="English"]/translation}).text.strip + examples.push("#{source} — #{translation}") + end + end + if examples.length() > 0 + examples = "\n #{examples.join("\n ")}" + else + examples="" end - if definition gfh.puts %Q{ #{word} - #{definition} + #{definition}#{examples} }