ব্যবহারকারী:Mahir256/cleanup.js

উইকিসংকলন থেকে
টীকা: সংরক্ষণ করার পর, পরিবর্তনসমূহ তৎক্ষণাৎ নাও দেখাতে পারে। আপনার ব্রাউজারের ক্যাশ কিভাবে এড়াবেন তা জানতে এখানে ক্লিক করুন।
  • ফায়ারফক্স / সাফারি: Shift ধরে রাখা অবস্থায়পুনঃলোড করুন-এ ক্লিক করুন, অথবা Ctrl-F5 বা Ctrl-R (ম্যাক-এ ⌘-R) চাপুন
  • গুগল ক্রোম: Ctrl-Shift-R (ম্যাক-এ ⌘-Shift-R) চাপুন
  • ইন্টারনেট এক্সপ্লোরার: Ctrl ধরে রাখা অবস্থায় Refresh-এ ক্লিক করুন, অথবা Ctrl-F5 চাপুন
  • অপেরা: মেনু → ব্যবস্থাপনাসমূহ-এ যান (ম্যাকে অপেরা → পছন্দসমূহ) এবং এরপর গোপনীয়তা ও সুরক্ষা → ব্রাউজিং-এর তথ্য পরিষ্কার করুন → ক্যাশে করা ছবি ও ফাইলগুলি

অন্যান্য ব্রাউজার সম্পর্কে বিশদ নির্দেশাবলীর জন্য, উইকিপিডিয়া:আপনার ক্যাশে বাইপাস করুন দেখুন।

mw.loader.load('//tools-static.wmflabs.org/meta/scripts/i18n/bn.js');
$.ajax('//tools-static.wmflabs.org/meta/scripts/pathoschild.templatescript.js', { dataType:'script', cache:true }).then(function() {
	pathoschild.TemplateScript.add([
		{
			name: 'clean up',
			script: function(editor) {
				editor
				// remove trailing whitespace at the end of each line
				.replace(/ \n/g, '\n')
				// Digitized by Google (kill)
				.replace(/Digitized[\s\n]+by[^\n]+\n(Google)?/, '')
				// remove trailing spaces at the end of each line
				.replace(/ +\n/g, '\n')
				// remove trailing whitespace preceding a hard line break
				.replace(/ +<br *\/?>/g, '<br />')
				// remove trailing whitespace at the end of page text
				.replace(/\s+$/g, '')
				// remove trailing spaces at the end of refs
				.replace(/ +<\/ref>/g, '</ref>')
				// remove trailing spaces at the end of template calls
				.replace(/ +}}/g, '}}')
				// join words that are hyphenated across a line break
				// (but leave "|-" table syntax alone)
				.replace(/([^\|])-\n/g, '$1')
				// remove unwanted spaces around punctuation marks
				.replace(/ ([);:\।?!,])/g, '$1')
				// remove unwanted spaces around ॥
				.replace(/ ([॥])/g, '$1')
				// – to —
				.replace(/–/g, '—')
				// ।। to ॥
				.replace(/।।/g, '॥')
				// fix nukta
				.replace(/য়/g, '\u09DF')
				.replace(/ড়/g, '\u09DC')
				.replace(/ঢ়/g, '\u09DD')
				// fix assamese ra
				.replace(/ৰ/g, 'র')
				.replace(/াে/g, 'ো')
				// remove unwanted spaces around Bengali diactics marks
				.replace(/ ([া ি ী ু ূ ৃ ে ৈ ো ৌ])/g, '$1')
				// remove unwanted spaces around Bengali ঁা diactics marks
				.replace(/ ঁা/g, '$1')
				// replace র্তা with তাঁ at the beginning of words like তাঁর তাঁহার etc 
				.replace(/ র্তা/g, ' তাঁ')
				.replace(/ র্যা/g, ' যাঁ')
				// replace তঁা with তাঁ at the beginning of words like তাঁর তাঁহার etc 
				.replace(/ তঁা/g, ' তাঁ')
				// fix issues with aa
				.replace(/\u09DF৷/g, '\u09DFা')
				.replace(/অা/g, 'আ')
				// convert double-hyphen to mdash (avoiding breaking HTML comment syntax)
				.replace(/([^\!])--([^>])/g, '$1—$2')
				// fix candrabindu placement
				.replace(/(ঁ)([া ি ী ু ূ ৃ ে ৈ ো ৌ])/g, '$2$1')
				// remove trailing whitespace at the end of input
				.replace(/\s+$/g, '');
				// stuff to do only if the page doesn't contain a <poem> tag:
				if (editor.get().indexOf("<poem>") != -1) {
					editor
					// remove single line breaks; preserve multiple.
					.replace(/([^>\n])\n([^<\n])/g, '$1 $2')
					// collapse sequences of spaces into a single space
					.replace(/  +/g, ' ');
				}
			}
		}
	]);
});