Skip to content

Commit

Permalink
apply #370
Browse files Browse the repository at this point in the history
```
<glossdiv><title>C</title>

<glossentry xml:id="valsi-coi">
<glossterm>coi</glossterm>
<glossdef>
  <para>vocative: greetings/hello.</para>
  <para>coi .djan. — Hello, John.</para>
  <para>coi .djan. — Hello, John.</para>
</glossdef>
</glossentry>

</glossdiv>
<glossdiv><title>M</title>

<glossentry xml:id="valsi-mi">
<glossterm>mi</glossterm>
<glossdef>
  <para>pro-sumti: me/we the speaker(s)/author(s); identified by self-vocative.</para>
</glossdef>
</glossentry>

</glossdiv>
```
  • Loading branch information
lagleki committed Nov 22, 2019
1 parent e5e4da9 commit 0b3f7c2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/generate_glossary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
end

definition=nil
examples=[]
if opts[:testing]
definition="placeholder definition"
else
Expand Down Expand Up @@ -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("<para>#{source}#{translation}</para>")
end
end
if examples.length() > 0
examples = "\n #{examples.join("\n ")}"
else
examples=""
end

if definition
gfh.puts %Q{
<glossentry xml:id="valsi-#{slug}">
<glossterm>#{word}</glossterm>
<glossdef>
<para>#{definition}</para>
<para>#{definition}</para>#{examples}
</glossdef>
</glossentry>
}
Expand Down

0 comments on commit 0b3f7c2

Please sign in to comment.