Skip to content

Commit

Permalink
Changes to the script to generate indentation and lien-breaks closer …
Browse files Browse the repository at this point in the history
…to document convention.
  • Loading branch information
Shervin Afshar committed Jul 23, 2017
1 parent be50af3 commit dc3573a
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions misc/scripts/generate-glossary.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,37 @@ StringWriter writer = new StringWriter()
MarkupBuilder markup = new MarkupBuilder(writer)
markup.setDoubleQuotes(true)

markup.section(class: 'appendix', id: "glossary") {
h2 'Glossary'
table(class: 'glossary') {
thead {
tr {
th ('Term')
th ('Arabic')
th ('Transliterated Arabic')
th ('Persian')
th ('Transliterated Persian')
th ('Definition')
}
}
tbody {
db.eachRow(selectQuery)
{ row ->
tr(id: "def_${row['TERMINOLOGY'].replaceAll(' ', '')}") {
td row['TERMINOLOGY']
td (lang: 'ar', dir:'rtl', row['ARABIC'])
td (lang: 'ar-Latn-t-ar-m0-alaloc-2012', row['ARABIC TRANSLITERATION'])
td (lang: 'fa', dir:'rtl', row['PERSIAN'] != null ? row['PERSIAN'] : '')
td (lang: 'fa-Latn-t-fa-m0-ungen-2012', row['PERSIAN TRANSLITERATION'] != null ? row['PERSIAN TRANSLITERATION'] : '')
td row['DEFINITION'] != null ? row['DEFINITION'] : ''
markup.html {
body {
section(class: 'appendix', id: "glossary") {
h2 'Glossary'
table(class: 'glossary') {
thead {
tr {
th ('Term')
th ('Arabic')
th ('Transliterated Arabic')
th ('Persian')
th ('Transliterated Persian')
th ('Definition')
}
}
tbody {
db.eachRow(selectQuery)
{ row ->
tr(id: "def_${row['TERMINOLOGY'].replaceAll(' ', '')}") {
td row['TERMINOLOGY']
td (lang: 'ar', dir:'rtl', row['ARABIC'])
td (lang: 'ar-Latn-t-ar-m0-alaloc-2012', row['ARABIC TRANSLITERATION'])
td (lang: 'fa', dir:'rtl', row['PERSIAN'] != null ? row['PERSIAN'] : '')
td (lang: 'fa-Latn-t-fa-m0-ungen-2012', row['PERSIAN TRANSLITERATION'] != null ? row['PERSIAN TRANSLITERATION'] : '')
td row['DEFINITION'] != null ? row['DEFINITION'] : ''
}
}
}
}
}
}
}
}

fOut.withWriter('UTF-8') { it.write(writer.toString())}
fOut.withWriter('UTF-8') { it.write(writer.toString().replace("\n", "\n\n"))}

0 comments on commit dc3573a

Please sign in to comment.