Skip to content

Commit

Permalink
some updates and fixes to Wikipedia pages, closes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
peterstadler committed Mar 7, 2017
1 parent 24bc303 commit 170c3d6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
6 changes: 3 additions & 3 deletions modules/img.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ declare %private function img:wikipedia-images($model as map(*), $lang as xs:str
let $wikiArticle :=
if($gnd) then wega-util:grabExternalResource('wikipedia', $gnd, config:get-doctype-by-id($model('docID')), $lang)
else ()
(: Look for images in wikipedia infobox (for organizations) and thumbnails :)
let $pics := $wikiArticle//xhtml:table[contains(@class,'toptextcells')] | $wikiArticle//xhtml:div[@class='thumbinner']
(: Look for images in wikipedia infobox (for organizations and english wikipedia) and thumbnails :)
let $pics := $wikiArticle//xhtml:table[contains(@class,'vcard')] | $wikiArticle//xhtml:table[contains(@class,'toptextcells')] | $wikiArticle//xhtml:div[@class='thumbinner']
let $errorLog := if(count($pics) = 0) then core:logToFile('info', 'img:wikipedia-images(): no images found for GND ' || $gnd) else ()
return
for $div in $pics
Expand All @@ -114,7 +114,7 @@ declare %private function img:wikipedia-images($model as map(*), $lang as xs:str
https://github.com/Toollabs/zoomviewer
:)
let $caption :=
if($div[self::xhtml:table]) then $div/xhtml:tr[.//xhtml:img]/preceding::xhtml:tr[1]
if($div[self::xhtml:table]) then ($div/xhtml:tr[.//xhtml:img]/preceding::xhtml:tr)[1]
else $div/xhtml:div[@class='thumbcaption']
return
if($thumbURI castable as xs:anyURI) then
Expand Down
2 changes: 1 addition & 1 deletion modules/wega-util.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import module namespace lang="http://xquery.weber-gesamtausgabe.de/modules/lang"
let $beaconMap := wega-util:beacon-map($gnd, $docType)
let $url := $beaconMap(map:keys($beaconMap)[contains(., 'Wikipedia-Personenartikel')][1])[1]
return
replace($url, 'dewiki', $lang || 'wiki')
replace($url, '/gnd/de/', '/gnd/' || $lang || '/')
case 'dnb' return concat('http://d-nb.info/gnd/', $gnd, '/about/rdf')
case 'viaf' return concat('http://viaf.org/viaf/', $gnd, '.rdf')
case 'deutsche-biographie' return 'https://www.deutsche-biographie.de/gnd' || $gnd || '.html'
Expand Down
14 changes: 10 additions & 4 deletions resources/less/gui.less
Original file line number Diff line number Diff line change
Expand Up @@ -344,23 +344,29 @@ div.table-wrapper {
}

/* settings for toc */
.secLevel1 {
/* second class (after the comma) is used on Wikipedia pages */
.secLevel1, .toclevel-1 {
padding-left:2em;
text-indent:-2em;
}
.secLevel2 {
.secLevel2, .toclevel-2 {
padding-left:3em;
text-indent:-2em;
}
.secLevel3 {
.secLevel3, .toclevel-3 {
padding-left:4em;
text-indent:-2em;
}
.secLevel4 {
.secLevel4, .toclevel-4 {
padding-left:5em;
text-indent:-2em;
}

/* Used on Wikipedia pages */
.tocnumber {
padding: 0 0.5em 0 0;
}

/* settings for guidelines*/
.customizations {
li {
Expand Down
11 changes: 9 additions & 2 deletions xsl/wikipedia.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@
<xsl:template match="br">
<xsl:element name="br"/>
</xsl:template>

<xsl:template match="*|@*" priority="0.1">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>

<xsl:template match="p" mode="appendix"/>
<xsl:template match="span[matches(@class, 'editsection')]"/>
<xsl:template match="span[matches(@class, 'ProofRead')]"/>
Expand All @@ -248,7 +255,7 @@
<xsl:template match="table[matches(@class, 'metadata')]" priority="1"/>
<xsl:template match="table[@id='Vorlage_Dieser_Artikel']" priority="1"/>
<xsl:template match="table[matches(@class, 'navbox')]" priority="1"/>
<xsl:template match="table[@class='infobox vcard']" priority="1"/>
<xsl:template match="table[contains(@class, 'vcard')]" priority="1"/>
<xsl:template match="table[@id='persondata']" priority="1"/>
<xsl:template match="table[@id='Vorlage_Weiterleitungshinweis']" priority="1"/>
<xsl:template match="span[matches(@class,'metadata')]" priority="1"/>
Expand All @@ -262,4 +269,4 @@
<xsl:template match="div[@id='contentSub']"/>
<xsl:template match="div[@id='NavContent']"/>
<xsl:template match="div[matches(@class, 'haudio')]" priority="1"/>
</xsl:stylesheet>
</xsl:stylesheet>

0 comments on commit 170c3d6

Please sign in to comment.