پرش به محتوا

مدیاویکی:ExtractFirst.xsl

از ویکی‌واژه

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method='html'/>
 
<xsl:variable name="dir">rtl</xsl:variable>
<xsl:variable name="more">» بیشتر</xsl:variable>
<xsl:variable name="error">خطا: </xsl:variable>
<xsl:variable name='audio'>تلفظ</xsl:variable>
<xsl:variable name='audio-separator'> • </xsl:variable>
<xsl:variable name="copyright"> © <a href="http://fa.wiktionary.org/wiki/">ویکی‌واژه</a>، تحت مجوز <a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license copyright">CC-BY-SA 3.0</a> منتشر می‌گردد.</xsl:variable>
<xsl:variable name="contentLang" select="'fa'"/> 
<xsl:variable name="pageName" select="concat('http://', $contentLang, '.wiktionary.org')"/>

<xsl:template match="/">
<html dir="{$dir}" lang="{$contentLang}" xml:lang="{$contentLang}">
<head>
<meta name="generator" content="Wiktionary Extract XSLT 1.10-FA"/>
<base target='_blank' href="{$pageName}" />

<title> Wiktionary extract</title>

<style>
#wordThisIsFor { font-weight:bold;}
a.wtif1  { color: black; text-decoration: none;}
a.wtif1:hover {text-decoration: underline;}
.disambig-see-also, .disambig-see-also-2 {display:inline;}
#container {background-color:white; padding: 0.5em; border: solid black thin;}
a.new {color: red;}
#error {color: red;font-size:larger;}
div.exit {float:right;font-weight:bold;font-family:sans-serif;border:outset;padding:0.1em}
div.exit a {color: black; text-decoration:none;}
</style>
<script type='text/javascript'>
/*<![CDATA[*/
function setup () {
//Stuff to translate:
var preferLang = {'fa': 'فارسی','en': 'انگلیسی', 'fr': 'فرانسوی', 'de': 'آلمانی', 'es': 'اسپانیایی', 'it': 'ایتالیایی', 'pt': 'پرتغالی', 'ja': 'ژاپنی', 'pl': 'لهستانی', 'ru': 'روسی', 'nl': 'هلندی', 'qqqAny': null}; //for now.

var extractSeeAlso = /

[\s\S]*?<\/div>/; //no subexpressions!
var see_also_process = function (sa) {return sa;}
var createLink = '» ایجاد سرواژه'; // text only.
var not_found = "معانی واژهٔ « $1 » به علت نگارش اشتباه، قابل دریافت نیستند! لطفاً علامت # را به ابتدای معانی بیافزائید.(در ویکی‌واژه)";
//END stuff to translate (there is one more translation block below)
//Stuff not to translate in general (setup).
var rd = location.search.match(/\&rd\=([^&]*)/); //is this from redirect. + converts to numeric.
rd = rd ? (+rd[1] + 1) : 1; //redirection level.
var showWord = 0; //default to not showing. 0 = none, 1 = bold, 2 = bold link.
var showWordRaw = location.search.match(/\&showWord\=([^&]*)/);
showWordRaw = showWordRaw ? showWordRaw[1] : 'none';
if (showWordRaw !== "none") {
 showWord++;
}
if (showWordRaw === "link") {
 showWord++;
}
var useAudio = 0;
if (location.search.match(/\&audio\=(?!none)/)) useAudio++;
if (location.search.match(/\&audio\=autoplay/)) useAudio++;
var closeLink = false;
if (location.search.match(/&exit\=(?!false)/)) closeLink = true;
var numbDfn = location.search.match(/\&count\=([^&]*)/); //count. + converts to numeric.
numbDfn = numbDfn ? (parseInt(numbDfn[1])) : 1; //default to 1
var pageURL = '/w/index.php?title=' + encodeURIComponent(decodeURIComponent(location.search.match(/\&page\=([^&]*)/)[1]));
var src = document.getElementById('src');
var display = document.getElementById('word-list');
var loc = location.search.match(/\&page\=([^&]*)/)[1]; //this is not escaped
var escWord = decodeURIComponent(loc).replace(/&/, '&').replace(/>/, '<').replace(/</, '>');
//note: wordEsc does not escape quotes. DO NOT PUT AS ATTRIBUTE VALUE
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('