MediaWiki:Api-stylesheets/wiktNL.xsl

   ltr » Meer Fout:   © WikiWoordenboek. Vrijgegeven onder CC-BY-SA 3.0 

<xsl:variable name="pageName" select="concat('http://', $contentLang, '.wiktionary.org')"/>

<xsl:template match="/">

<html dir="{$dir}" lang="{$contentLang}" xml:lang="{$contentLang}"> <meta name="generator" content="Wiktionary Extract XSLT 1.04-NL"/> <base target='_blank' href="{$pageName}" /> Wiktionary extract .disambig-see-also, .disambig-see-also-2 {display:inline;} a.new {color: red;} <script type='text/javascript'> /*<![CDATA[*/ function setup { //Stuff to translate: var preferLang = {'nl': 'Nederlands', 'en': 'Engels', 'qqqAny': null}; //for now. var extractSeeAlso = /<table class=\"bandeau-voir\"[^>]*>[\s\S]*?([\s\S]*?[\s\S]*?)<\/td>[\s\S]*?<\/table>/; //Modified elsewhere! var see_also_process = function (sa) { return sa[1].replace(/<a[^>]*><img[^>]*\/><\/a>/, ''); } var missing = 'Could not retrieve definition of $1.'; //Stuff not to translate in general (setup).
 * 1) container {background-color:white; padding: 0.5em; border: solid black thin;}
 * 1) error {color: red;font-size:larger;}

var pageURL = '/wiki/' +location.search.match(/\&page\=([^&]*)/)[1]; var src = document.getElementById('src'); var display = document.getElementById('word-list'); var loc = location.search.match(/\&page\=([^&]*)/)[1]; var preferLangCode = location.search.match(/\&lang\=([^&]*)/); if (preferLangCode) { preferLangCode = preferLangCode[1]; } else {preferLangCode = 'qqqAny';} src.normalize; var html = src.firstChild.data; var def = html //may be redefined later.

//stuff you might need to translate, but hopefully won't var subSectRegex = new RegExp(' <span class="mw-headline" id="' + preferLang[preferLangCode] + '"[^>]*>[\\s\\S]*$'); //this is ugly var extractCurLangName = /<span class="mw-headline" id[^>]*>([\s\S]*?)<\/span>/; //first subexpression try { //this assumes attribute order doesn't change!!! html = html.replace(/ [\s\S]*?<\/div>/, ''); if (preferLangCode && preferLang[preferLangCode]) { try { //strip off all definitions before tagret lang. var subSect = html.match(subSectRegex)[0]; if (subSect.match(/<ol>[\s\S]*?<li>/)) { //if it has content def = subSect; }  } catch (e) { /*alert(e)*/} }  var lang = def.match(extractCurLangName)[1]; display.innerHTML = '(' + lang + ') ' + def.match(/<ol>[\s\S]*?<\/ol>/)[0].replace(/<dl>[\s\S]*?<\/dl>/g, ).replace(/<div[^>]*>[\s\S]*?<\/div>/g, ).replace(/<ul>[\s\S]*?<\/ul>/g, '').match(/<li>([\s\S]*?)<\/li>/)[1]; } catch (e) { //alert(e) //page does not exist, not well formed, these regexs suck, etc display.appendChild(document.createTextNode(missing.replace('$1', decodeURIComponent(loc)))); if (decodeURIComponent(loc).match(/[A-Z]/) && !location.search.match(/\&rd/)) { //make sure don't have loops, if first character is for example % encoded. //should probably decode it. location = location.href.replace(/(^[\s\S]*?\&page\=)[^&]*([\s\S]*$)/, '$1'+ loc.charAt(0).toLowerCase + loc.substring(1, loc.length) + '$2&rd'); } } var sa = html.match(extractSeeAlso); if(sa) { document.getElementById('see-also').innerHTML = ' (' + see_also_process(sa) + ')' ; } document.getElementsByTagName('base')[0].href += pageURL; //this doesn't do anything. document.getElementById('more-link').href= pageURL; }

/*]]>*/ <body onload='setup'> <xsl:apply-templates select='api/error'/> <a id='more-link'><xsl:value-of select="$more"/></a> <small id="copyright-notice"> <xsl:copy-of select="$copyright"/> <xsl:value-of select='api/parse/text'/>

</xsl:template> <xsl:template match='api/error'> <xsl:value-of select="$error"/> <xsl:value-of select='@info'/> </xsl:template>

</xsl:stylesheet>