User:Msh210/vector.js: difference between revisions

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Content deleted Content added
m +snap
m um, hello?
Line 115: Line 115:
txt=txt.replace(/\{\{sic\.([\|\}])/g, "{"+"{SIC$1");
txt=txt.replace(/\{\{sic\.([\|\}])/g, "{"+"{SIC$1");
txt=txt.replace(/\{\{sic([\|\}])/g, "{"+"{SIC$1");
txt=txt.replace(/\{\{sic([\|\}])/g, "{"+"{SIC$1");
txt=txt.replace(/\{\{pf\}\})/g, "{"+"{pf.}}");
txt=txt.replace(/\{\{pf\}\}/g, "{"+"{pf.}}");
//the next two lines have to be after the "alt spell" snap above
//the next two lines have to be after the "alt spell" snap above
txt=txt.replace(/\n\#\ \{\{obsolete\}\}\ \{\{alternative spelling of\|/g, "\n# {"+"{obsolete spelling of|");
txt=txt.replace(/\n\#\ \{\{obsolete\}\}\ \{\{alternative spelling of\|/g, "\n# {"+"{obsolete spelling of|");

Revision as of 20:35, 14 September 2010

//importScript('Transwiki:Gadget-HotCat.js');
importScript('User:Lupin/autoedit.js', 'en.wikipedia.org','46637295');//needed for other things
importScript('User:Msh210/sandboxlink.js');//adds sandboxlink
importScript('User:Msh210/hyphenate.js');//hyphenates English nouns with spaces; requires autoedit.js
importScript('User:TheDaveRoss/CIDR.js');//CIDR, UI@special:contributions
importScript('User:Msh210/watchlist.js');//adds unwatch link to watchlist and recentchanges
importScript('User:Msh210/blocklinks.js');//adds link to user's logs from Special:Block/Username
importScript('MediaWiki:SectionWatchLinks.js');//adds link to watch transcluded section's source page
importScript('User:Superm401/Compare_link.js','en.wikipedia.org','363925947');//linkifies compare versions
importScript('User:Conrad.Irwin/creation.js');//automates inflected-form creation; requires autoedit.js
importScript('User:Connel_MacKenzie/patrolled.js');//patrolling enhancements
importScript('User:Conrad.Irwin/isblocked.js');//nice display if user's blocked
importScript('User:Visviva/pretext.js');//needed to use Visviva's 'add' links
document.cookie="WiktNearbyPagesLangHeadings=true";//restricts nearbypages to header not navbar
importScript('User:Hippietrail/nearbypages.js');//previous and next entries
importScript('User:Conrad.Irwin/beerArchiver.js');//archives the BP
importScript('User:Ruakh/WiktEtylAlwaysLink.js');//link etyl's langnames
//importScript('User:Conrad.Irwin/edittools.js');//custom edittools section
// start stuff copied from [[User:Connel_MacKenzie/clock.js]] and modified
function makeTime()
{
  var timeGMT = new Date();
  var time = timeGMT.toUTCString();
  var li = document.createElement( 'li' );
  li.id = 't-time';
  li.appendChild( document.createTextNode( time ) );
  var ul=document.getElementById('t-upload');
  ul.parentNode.insertBefore(li,ul);
}
addOnloadHook( makeTime );
// end stuff from User:Connel_MacKenzie/clock.js
/* begin stuff copied from [[User:Connel MacKenzie/reformat.js]] and amended */
function minorFormat() {
  txt = txt.replace(/\=\= /g, "==");
  txt = txt.replace(/ \=\=/g, "==");
  txt=txt.replace(/\n\=(\=*)([A-ȳ\ ]*)(\=*)\<\!/g, "\n=$1$2$3\n<!");
  txt = txt.replace(/\{\{-en-\}\}/g, "==English==");
  txt = txt.replace(/\{\{msg:/gi, "{{");
  txt = txt.replace(/===\n\'\'\'(.*)\'\'\'\n#/gi, "===\n'''$1'''\n\n#");
  txt = txt.replace(/===\n\{\{(.*)\}\}\n#/gi, "===\n{{$1}}\n\n#");
  txt = txt.replace(/\[\[category:/gi, "[[Category:");
  txt = txt.replace(/\[\[wikipedia:en:/gi, "[[w:"); //ancient syntax
  txt = txt.replace(/\[\[en:/g, "[[w:"); //ancient syntax
  txt = txt.replace(/\(\'\'mass noun\'\'\)/gi, "{"+"{uncountable}}");
  txt = txt.replace(/ ''m''/g, " {"+"{m}}");
  txt = txt.replace(/''m'' /g, "{"+"{m}} ");
  txt = txt.replace(/ ''f''/g, " {"+"{f}}");
  txt = txt.replace(/''f'' /g, "{"+"{f}} ");
  txt = txt.replace(/ ''n''/g, " {"+"{n}}");
  txt = txt.replace(/''n'' /g, "{"+"{n}} ");
  txt = txt.replace(/ ''c''/g, " {"+"{c}}");
  txt = txt.replace(/''c'' /g, "{"+"{c}} ");
  txt = txt.replace(/ ''pl''/g, " {"+"{p}}");
  txt = txt.replace(/''pl'' /g, "{"+"{p}} ");
  txt = txt.replace(/ ''s''/g, " {"+"{s}}");
  txt = txt.replace(/''s'' /g, "{"+"{s}} ");
  txt = txt.replace(/''m, f''/g, "{"+"{m\|f}}");
  txt = txt.replace(/\{\{mf\}\}/g, "{"+"{m\|f}}");
  txt = txt.replace(/''m pl''/g, "{"+"{m\|p}}");
  txt = txt.replace(/''f pl''/g, "{"+"{f\|p}}");
  txt = txt.replace(/''m plural''/g, "{"+"{m\|p}}");
  txt = txt.replace(/''f plural''/g, "{"+"{f\|p}}");
  txt = txt.replace(/\(plural \[/gi, "(''plural:'' [");
 txt=txt.replace(/\<br\>/gi, "<br />");
 txt=txt.replace(/\<br\/\>/gi, "<br />");
 txt = txt.replace(/\*(\ *)'''([1-9][0-9][0-9]*)'''\:/g, "* '''$2''',");
 txt = txt.replace(/\*(\ *)'''([1-9][0-9][0-9]*)\:'''/g, "* '''$2''',");
 txt=txt.replace(/\{\{ca\.([\|\}])/g, "{"+"{circa$1");//snap redirect
 txt=txt.replace(/\{\{circa\|([A-Ea-e\.\,\ \-0-9]*)\}\}\,/g, "{"+"{circa|$1}}");//template adds a comma
 txt=txt.replace(/\{\{ante\|([A-Ea-e\.\,\ \-0-9]*)\}\}\,/g, "{"+"{ante|$1}}");//ditto
 txt=txt.replace(/\{\{sense\|([a-zA-Z0-9 \-]*)\}\}\,/g, "{"+"{sense|$1}}");//ditto
 txt=txt.replace(/\{\{ante\}\} ([0-9]*)\,/g, "{"+"{ante|$1}}");
 txt=txt.replace(/\{\{circa\}\} ([0-9]*)\,/g, "{"+"{circa|$1}}");
 txt=txt.replace(/\#(\ *)\'\'\'circa ([0-9]*)\'\'\'\,/g, "# {"+"{circa|$2}}");
 txt=txt.replace(/\#(\ *)\'\'\'circa ([0-9]*)\,\'\'\'/g, "# {"+"{circa|$2}}");
 txt=txt.replace(/\#(\ *)\'\'\'c\. ([0-9]*)\'\'\'\,/g, "# {"+"{circa|$2}}");
 txt=txt.replace(/\#(\ *)\'\'\'c\. ([0-9]*)\,\'\'\'/g, "# {"+"{circa|$2}}");
 txt=txt.replace(/\#(\ *)\'\'\'ca\. ([0-9]*)\'\'\'\,/g, "# {"+"{circa|$2}}");
 txt=txt.replace(/\#(\ *)\'\'\'ca\. ([0-9]*)\,\'\'\'/g, "# {"+"{circa|$2}}");
 txt=txt.replace(/\ (\ *)/g, " ");
 txt=txt.replace(/s====\n\#/g, "s====\n*");
 txt=txt.replace(/lso===(=*)\n\#/g, "lso===$1\n*");
 txt=txt.replace(/inks===\n\#/g, "inks===\n*");
 txt=txt.replace(/eferences===\n\#/g, "eferences===\n*");
 txt=txt.replace(/\n([\*\#\:\;]+)(\ *)([\'\{\[a-zA-Z])/g, "\n$1 $3");//Thanks, Conrad.Irwin.
 txt=txt.replace(/\{\{PL\:/g, "{"+"{template:PL:");//necessary so the link will work
 txt=txt.replace(/\n\{\{pedialite([\}\|])/g, "\n* {"+"{pedialite$1");//I saw Rukhabot do this, so stole it.
 txt=txt.replace(/\n\{\{template\:PL\:/g, "\n* {"+"{template:PL:");//as previous
 txt=txt.replace(/\n\{\{pedia([\}\|])/g, "\n* {"+"{pedia$1");
 txt=txt.replace(/\n\{\{versity([\}\|])/g, "\n* {"+"{versity$1");
 txt=txt.replace(/\{\{form\ of\|([a-zA-Z\ \-\,\'\[\]\(\)\"\/]*)\ of\|/g, "{"+"{form of|$1|");//template adds "of"
 txt=txt.replace(/\[http\:\/\/en\.wikipedia\.org\/wiki\/([a-zA-Z0-9\_\-\:\'\(\)\"\/]*)\ ([a-zA-Z0-9\_\-\:\'\(\)\"\/\ ]*)\]/g, "[[w:$1|$2]]");
//snap redirects:
 txt=txt.replace(/\{\{qual([\}\|])/g, "{"+"{qualifier$1");
 txt=txt.replace(/\{\{en\-adjective([\}\|])/g, "{"+"{en-adj$1");
 txt=txt.replace(/\{\{en\-adverb([\}\|])/g, "{"+"{en-adv$1");
 txt=txt.replace(/\{\{en\-particle([\}\|])/g, "{"+"{en-part$1");
 txt=txt.replace(/\{\{en\-preposition([\}\|])/g, "{"+"{en-prep$1");
 txt=txt.replace(/\{\{en\-pronoun([\}\|])/g, "{"+"{en-pron$1");
 txt=txt.replace(/\{\{en\-interjection([\|\}])/g, "{"+"{en-intj$1");
 txt=txt.replace(/\{\{en\-adj\-more([\}\|])/g, "{"+"{en-adj$1");
 txt=txt.replace(/\{\{en\-proper\-noun([\}\|])/g, "{"+"{en-proper noun$1");
 txt=txt.replace(/\{\{substub([\}\|])/g, "{"+"{sectstub$1");
 txt=txt.replace(/\{\{alt spell\|/g, "{"+"{alternative spelling of|");
 txt=txt.replace(/\{\{alternate spelling of\|/g, "{"+"{alternative spelling of|");
 txt=txt.replace(/\{\{PL\:pedia([\}\|])/g, "{"+"{pedia$1");
 txt=txt.replace(/\{\{Wikipedia-inline([\}\|])/g, "{"+"{pedia$1");
 txt=txt.replace(/\{\{trans\-middle([\}\|])/g, "{"+"{trans-mid$1");
 txt=txt.replace(/\{\{trans\-bot([\}\|])/g, "{"+"{trans-bottom$1");
 txt=txt.replace(/\{\{Wikipedia([\|\}])/g, "{"+"{wikipedia$1");
 txt=txt.replace(/\{\{See([\|\}])/g, "{"+"{also$1");
 txt=txt.replace(/\{\{Flowbreak([\|\}])/g, "{"+"{flowbreak$1");
 txt=txt.replace(/\{\{non gloss definition([\|\}])/g, "{"+"{non-gloss definition$1");
 txt=txt.replace(/\{\{eye dialect([\|\}])/g, "{"+"{eye dialect of$1");
 txt=txt.replace(/\{\{sic\.([\|\}])/g, "{"+"{SIC$1");
 txt=txt.replace(/\{\{sic([\|\}])/g, "{"+"{SIC$1");
 txt=txt.replace(/\{\{pf\}\}/g, "{"+"{pf.}}");
//the next two lines have to be after the "alt spell" snap above
 txt=txt.replace(/\n\#\ \{\{obsolete\}\}\ \{\{alternative spelling of\|/g, "\n# {"+"{obsolete spelling of|");
 txt=txt.replace(/\n\#\ \{\{archaic\}\}\ \{\{alternative spelling of\|/g, "\n# {"+"{archaic spelling of|");
//In snapping context redirects, I only include those
//where the intent of whoever tagged the sense is, imo, clear.
//Thus, for example, I'm not snapping football -> soccer,
//since someone might have added football incorrectly
//with American football in mind.
//There are others I've omitted, too, for various reasons.
 txt=txt.replace(/([\|\{])([aA])lggeom([\}\|])/g, "$1algebraic geometry$3");
 txt=txt.replace(/([\|\{])Acting([\}\|])/g, "$1acting$2");
 txt=txt.replace(/([\|\{])adslang([\}\|])/g, "$1ad slang$2");
 txt=txt.replace(/([\|\{])Algebra([\}\|])/g, "$1algebra$2");
 txt=txt.replace(/([\|\{])analyticgeom([\}\|])/g, "$1analytic geometry$2");
 txt=txt.replace(/([\|\{])Anatomy([\}\|])/g, "$1anatomy$2");
 txt=txt.replace(/([\|\{])Archaic([\}\|])/g, "$1archaic$2");
 txt=txt.replace(/([\|\{])Architecture([\}\|])/g, "$1architecture$2");
 txt=txt.replace(/([\|\{])arithmetics([\}\|])/g, "$1arithmetic$2");
 txt=txt.replace(/([\|\{])Astronomy([\}\|])/g, "$1astronomy$2");
 txt=txt.replace(/([\|\{])autoracing([\}\|])/g, "$1auto racing$2");
 txt=txt.replace(/([\|\{])Baseball([\}\|])/g, "$1baseball$2");
 txt=txt.replace(/([\|\{])Basketball([\}\|])/g, "$1basketball$2");
 txt=txt.replace(/([\|\{])Bingo([\}\|])/g, "$1bingo$2");
 txt=txt.replace(/([\|\{])Biochemistry([\}\|])/g, "$1biochemistry$2");
 txt=txt.replace(/([\|\{])Biology([\}\|])/g, "$1biology$2");
 txt=txt.replace(/([\|\{])Botany([\}\|])/g, "$1botany$2");
 txt=txt.replace(/([\|\{])Bridge([\}\|])/g, "$1bridge$2");
 txt=txt.replace(/([\|\{])Business([\}\|])/g, "$1business$2");
 txt=txt.replace(/([\|\{])buzzwords([\}\|])/g, "$1buzzword$2");
 txt=txt.replace(/([\|\{])Calculus([\}\|])/g, "$1calculus$2");
 txt=txt.replace(/([\|\{])carbohydrate([\}\|])/g, "$1carbohydrates$2");
 txt=txt.replace(/([\|\{])Card games([\}\|])/g, "$1card games$2");
 txt=txt.replace(/([\|\{])chem([\}\|])/g, "$1chemistry$2");
 txt=txt.replace(/([\|\{])chemical compound([\}\|])/g, "$1inorganic compound$2");
 txt=txt.replace(/([\|\{])chemical\|\_\|compound([\}\|])/g, "$1inorganic compound$2");
 txt=txt.replace(/([\|\{])chemical element([\}\|])/g, "$1element$2");
 txt=txt.replace(/([\|\{])chemical\|\_\|element([\}\|])/g, "$1element$2");
 txt=txt.replace(/([\|\{])Chemistry([\}\|])/g, "$1chemistry$2");
 txt=txt.replace(/([\|\{])christianity([\}\|])/g, "$1Christianity$2");
 txt=txt.replace(/([\|\{])classical physics([\}\|])/g, "$1classical mechanics$2");
 txt=txt.replace(/([\|\{])Climbing([\}\|])/g, "$1climbing$2");
 txt=txt.replace(/([\|\{])cockney([\}\|])/g, "$1Cockney$2");
 txt=txt.replace(/([\|\{])CockneyRS([\}\|])/g, "$1Cockney rhyming slang$2");
 txt=txt.replace(/([\|\{])collоquial([\}\|])/g, "$1colloquial$2");//not Latin1
 txt=txt.replace(/([\|\{])Colloquial([\}\|])/g, "$1colloquial$2");
 txt=txt.replace(/([\|\{])Combinatorics([\}\|])/g, "$1combinatorics$2");
 txt=txt.replace(/([\|\{])commonwealth([\}\|])/g, "$1Commonwealth$2");
 txt=txt.replace(/([\|\{])Communication([\}\|])/g, "$1communication$2");
 txt=txt.replace(/([\|\{])communications([\}\|])/g, "$1communication$2");
 txt=txt.replace(/([\|\{])Communication([\}\|])/g, "$1communication$2");
 txt=txt.replace(/([\|\{])([Cc])omplang([\}\|])/g, "$1programming$3");
 txt=txt.replace(/([\|\{])complex([\}\|])/g, "$1complex analysis$2");
 txt=txt.replace(/([\|\{])([Cc])omptheory([\}\|])/g, "$1computing theory$3");
 txt=txt.replace(/([\|\{])computer([\}\|])/g, "$1computing$2");
 txt=txt.replace(/([\|\{])computer language([\}\|])/g, "$1programming$2");
 txt=txt.replace(/([\|\{])computer programming([\}\|])/g, "$1programming$2");
 txt=txt.replace(/([\|\{])computers([\}\|])/g, "$1computing$2");
 txt=txt.replace(/([\|\{])Computing([\}\|])/g, "$1computing$2");
 txt=txt.replace(/([\|\{])Copyright([\}\|])/g, "$1copyright$2");
 txt=txt.replace(/([\|\{])Countable([\}\|])/g, "$1countable$2");
 txt=txt.replace(/([\|\{])Cricket([\}\|])/g, "$1cricket$2");
 txt=txt.replace(/([\|\{])crypto([\}\|])/g, "$1cryptography$2");
 txt=txt.replace(/([\|\{])CW([\}\|])/g, "$1Commonwealth$2");
 txt=txt.replace(/([\|\{])Databases([\}\|])/g, "$1databases$2");
 txt=txt.replace(/([\|\{])Drama([\}\|])/g, "$1drama$2");
 txt=txt.replace(/([\|\{])Electronics([\}\|])/g, "$1electronics$2");
 txt=txt.replace(/([\|\{])Entomology([\}\|])/g, "$1entomology$2");
 txt=txt.replace(/([\|\{])euphemistic([\}\|])/g, "$1euphemism$2");
 txt=txt.replace(/([\|\{])farming([\}\|])/g, "$1agriculture$2");
 txt=txt.replace(/([\|\{])([fF])b([\}\|])/g, "$1American football$3");
 txt=txt.replace(/([\|\{])figurative([\}\|])/g, "$1figuratively$2");
 txt=txt.replace(/([\|\{])([fF])ilm([\}\|])/g, "$1filmology$3");
 txt=txt.replace(/([\|\{])Filmology([\}\|])/g, "$1filmology$2");
 txt=txt.replace(/([\|\{])Finance([\}\|])/g, "$1finance$2");
 txt=txt.replace(/([\|\{])Forestry([\}\|])/g, "$1forestry$2");
 txt=txt.replace(/([\|\{])gametheory([\}\|])/g, "$1game theory$2");
 txt=txt.replace(/([\|\{])Geography([\}\|])/g, "$1geography$2");
 txt=txt.replace(/([\|\{])Geology([\}\|])/g, "$1geology$2");
 txt=txt.replace(/([\|\{])Geometry([\}\|])/g, "$1geometry$2");
 txt=txt.replace(/([\|\{])geordie([\}\|])/g, "$1Geordie$2");
 txt=txt.replace(/([\|\{])Grammar([\}\|])/g, "$1grammar$2");
 txt=txt.replace(/([\|\{])graphical user interfaces([\}\|])/g, "$1graphical user interface$2");
 txt=txt.replace(/([\|\{])([gG])raphtheory([\}\|])/g, "$1graph theory$3");
 txt=txt.replace(/([\|\{])greek mythology([\}\|])/g, "$1Greek mythology$2");
 txt=txt.replace(/([\|\{])([gG])reek\|\_\|mythology([\}\|])/g, "$1Greek mythology$3");
 txt=txt.replace(/([\|\{])computer\|\_\|programming([\}\|])/g, "$1programming$2");
 txt=txt.replace(/([\|\{])greekmyth([\}\|])/g, "$1Greek mythology$2");
 txt=txt.replace(/([\|\{])([gG])rouptheory([\}\|])/g, "$1group theory$3");
 txt=txt.replace(/([\|\{])GUI([\}\|])/g, "$1graphical user interface$2");
 txt=txt.replace(/([\|\{])([hH])amradio([\}\|])/g, "$1ham radio$3");
 txt=txt.replace(/([\|\{])History([\}\|])/g, "$1history$2");
 txt=txt.replace(/([\|\{])hoops([\}\|])/g, "$1basketball$2");
 txt=txt.replace(/([\|\{])([iI])cehockey([\}\|])/g, "$1ice hockey$3");
 txt=txt.replace(/([\|\{])([iI])diom([\}\|])/g, "$1idiomatic$3");
 txt=txt.replace(/([\|\{])Impersonal([\}\|])/g, "$1impersonal$2");
 txt=txt.replace(/([\|\{])indef([\}\|])/g, "$1indefinite$2");
 txt=txt.replace(/([\|\{])informally([\}\|])/g, "$1informal$2");
 txt=txt.replace(/([\|\{])internet([\}\|])/g, "$1Internet$2");
 txt=txt.replace(/([\|\{])internetslang([\}\|])/g, "$1internet slang$2");
 txt=txt.replace(/([\|\{])landform([\}\|])/g, "$1landforms$2");
 txt=txt.replace(/([\|\{])Law([\}\|])/g, "$1legal$2");
 txt=txt.replace(/([\|\{])legalese([\}\|])/g, "$1legal$2");
 txt=txt.replace(/([\|\{])Lexicography([\}\|])/g, "$1lexicography$2");
 txt=txt.replace(/([\|\{])([lL])inearalg([\}\|])/g, "$1linear algebra$3");
 txt=txt.replace(/([\|\{])Linux([\}\|])/g, "$1linux$2");
 txt=txt.replace(/([\|\{])literal([\}\|])/g, "$1literally$2");
 txt=txt.replace(/([\|\{])Liverpool([\}\|])/g, "$1Liverpudlian$2");
 txt=txt.replace(/([\|\{])Logic([\}\|])/g, "$1logic$2");
 txt=txt.replace(/([\|\{])Management([\}\|])/g, "$1management$2");
 txt=txt.replace(/([\|\{])([mM])ath([\}\|])/g, "$1mathematics$3");
 txt=txt.replace(/([\|\{])maths([\}\|])/g, "$1mathematics$2");
 txt=txt.replace(/([\|\{])Mathematics([\}\|])/g, "$1mathematics$2");
 txt=txt.replace(/([\|\{])medical([\}\|])/g, "$1medicine$2");
 txt=txt.replace(/([\|\{])Medicine([\}\|])/g, "$1medicine$2");
 txt=txt.replace(/([\|\{])Microelectronics([\}\|])/g, "$1microelectronics$2");
 txt=txt.replace(/([\|\{])Military([\}\|])/g, "$1military$2");
 txt=txt.replace(/([\|\{])military rank([\}\|])/g, "$1military ranks$2");
 txt=txt.replace(/([\|\{])Mining([\}\|])/g, "$1mining$2");
 txt=txt.replace(/([\|\{])motor sport([\}\|])/g, "$1motor racing$2");
 txt=txt.replace(/([\|\{])mountaineering([\}\|])/g, "$1climbing$2");
 txt=txt.replace(/([\|\{])Music([\}\|])/g, "$1music$2");
 txt=txt.replace(/([\|\{])musical instrument([\}\|])/g, "$1musical instruments$2");
 txt=txt.replace(/([\|\{])musici([\}\|])/g, "$1musical instruments$2");
 txt=txt.replace(/([\|\{])Mythology([\}\|])/g, "$1mythology$2");
 txt=txt.replace(/([\|\{])([nN])anotech([\}\|])/g, "$1nanotechnology$3");
 txt=txt.replace(/([\|\{])Nautical([\}\|])/g, "$1nautical$2");
 txt=txt.replace(/([\|\{])neologistic([\}\|])/g, "$1neologism$2");
 txt=txt.replace(/([\|\{])Newtonian physics([\}\|])/g, "$1classical mechanics$2");
 txt=txt.replace(/([\|\{])non\-standard([\}\|])/g, "$1nonstandard$2");
 txt=txt.replace(/([\|\{])norse mythology([\}\|])/g, "$1Norse mythology$2");
 txt=txt.replace(/([\|\{])([Nn])orse\|\_\|mythology([\}\|])/g, "$1Norse mythology$3");
 txt=txt.replace(/([\|\{])notcomparable([\}\|])/g, "$1not comparable$2");
 txt=txt.replace(/([\|\{])numbertheory([\}\|])/g, "$1number theory$2");
 txt=txt.replace(/([\|\{])Obsolete([\}\|])/g, "$1obsolete$2");
 txt=txt.replace(/([\|\{])onomat([\}\|])/g, "$1onomatopoeia$2");
 txt=txt.replace(/([\|\{])Onomatopoeia([\}\|])/g, "$1onomatopoeia$2");
 txt=txt.replace(/([\|\{])Optics([\}\|])/g, "$1optics$2");
 txt=txt.replace(/([\|\{])organic compound([\}\|])/g, "$1organic compounds$2");
 txt=txt.replace(/([\|\{])Paganism([\}\|])/g, "$1paganism$2");
 txt=txt.replace(/([\|\{])pejoratives([\}\|])/g, "$1pejorative$2");
 txt=txt.replace(/([\|\{])Pharmacology([\}\|])/g, "$1pharmacology$2");
 txt=txt.replace(/([\|\{])Philosophy([\}\|])/g, "$1philosophy$2");
 txt=txt.replace(/([\|\{])Physics([\}\|])/g, "$1physics$2");
 txt=txt.replace(/([\|\{])Physiology([\}\|])/g, "$1physiology$2");
 txt=txt.replace(/([\|\{])planetary science([\}\|])/g, "$1planetology$2");
 txt=txt.replace(/([\|\{])planetary\|\_\|science([\}\|])/g, "$1planetology$2");
 txt=txt.replace(/([\|\{])pluralia tantum([\}\|])/g, "$1plurale tantum$2");
 txt=txt.replace(/([\|\{])Poker([\}\|])/g, "$1poker$2");
 txt=txt.replace(/([\|\{])Pseudoscience([\}\|])/g, "$1pseudoscience$2");
 txt=txt.replace(/([\|\{])Psychiatry([\}\|])/g, "$1psychiatry$2");
 txt=txt.replace(/([\|\{])Rail transport([\}\|])/g, "$1rail transport$2");
 txt=txt.replace(/([\|\{])railroading([\}\|])/g, "$1rail transport$2");
 txt=txt.replace(/([\|\{])Rare([\}\|])/g, "$1rare$2");
 txt=txt.replace(/([\|\{])Rasta([\}\|])/g, "$1rasta$2");
 txt=txt.replace(/([\|\{])Rhetoric([\}\|])/g, "$1rhetoric$2");
 txt=txt.replace(/([\|\{])Rugby([\}\|])/g, "$1rugby$2");
 txt=txt.replace(/([\|\{])([sS])cifi([\}\|])/g, "$1science fiction$3");
 txt=txt.replace(/([\|\{])science\|\_\|fiction([\}\|])/g, "$1science fiction$2");
 txt=txt.replace(/([\|\{])rail\|\_\|transport([\}\|])/g, "$1rail transport$2");
 txt=txt.replace(/([\|\{])scrapbooking([\}\|])/g, "$1scrapbooks$2");
 txt=txt.replace(/([\|\{])set\-phrase([\}\|])/g, "$1set phrase$2");
 txt=txt.replace(/([\|\{])settheory([\}\|])/g, "$1set theory$2");
 txt=txt.replace(/([\|\{])Slang([\}\|])/g, "$1slang$2");
 txt=txt.replace(/([\|\{])anatomy\|\_\|slang([\}\|])/g, "$1slang anatomy$2");
 txt=txt.replace(/([\|\{])anatomy\|slang([\}\|])/g, "$1slang anatomy$2");
 txt=txt.replace(/([\|\{])([sS])ofteng([\}\|])/g, "$1software engineering$3");
 txt=txt.replace(/([\|\{])([sS])oundeng([\}\|])/g, "$1sound engineering$3");
 txt=txt.replace(/([\|\{])Software([\}\|])/g, "$1software$2");
 txt=txt.replace(/([\|\{])spelunking([\}\|])/g, "$1caving$2");
 txt=txt.replace(/([\|\{])Sports([\}\|])/g, "$1sports$2");
 txt=txt.replace(/([\|\{])Taxonomy([\}\|])/g, "$1taxonomy$2");
 txt=txt.replace(/([\|\{])Tennis([\}\|])/g, "$1tennis$2");
 txt=txt.replace(/([\|\{])text messages([\}\|])/g, "$1text messaging$2");
 txt=txt.replace(/([\|\{])text[\-\ \_]msg([\}\|])/g, "$1text messaging$2");
 txt=txt.replace(/([\|\{])Theology([\}\|])/g, "$1theology$2");
 txt=txt.replace(/([\|\{])Topology([\}\|])/g, "$1topology$2");
 txt=txt.replace(/([\|\{])Transitive([\}\|])/g, "$1transitive$2");
 txt=txt.replace(/([\|\{])transportation([\}\|])/g, "$1transport$2");
 txt=txt.replace(/([\|\{])Typography([\}\|])/g, "$1typography$2");
 txt=txt.replace(/([\|\{])U\.S\.([\}\|])/g, "$1US$2");
 txt=txt.replace(/([\|\{])uncomparable([\}\|])/g, "$1not comparable$2");
 txt=txt.replace(/([\|\{])Uncountable([\}\|])/g, "$1uncountable$2");
 txt=txt.replace(/([\|\{])USA([\}\|])/g, "$1US$2");
 txt=txt.replace(/([\|\{])wjargon([\}\|])/g, "$1Wiktionary and WMF jargon$2");
 txt=txt.replace(/([\|\{])Zoology([\}\|])/g, "$1zoology$2");
 txt=txt.replace(/([\|\{])Zoölogy([\}\|])/g, "$1zoology$2");
 txt=txt.replace(/\{\{see also\|/g, "{"+"{also|");
}
 
// get all the {-header-} templates replaced
function headLevel() {
  txt = txt.replace(/===English===\n/gi, "==English==\n");
  txt = txt.replace(/==English==\n=/gi, "==English==\n\n=");
//  txt = txt.replace(/==English==\n\{/gi, "==English==\n\n\{");
  txt = txt.replace(/\{\{-noun-\}\}/g, "===Noun===");
  txt = txt.replace(/\{\{-verb-\}\}/g, "===Verb===");
  txt = txt.replace(/\{\{-etym-\}\}/g, "===Etymology===");
  txt = txt.replace(/\{\{-adj-\}\}/g, "===Adjective===");
  txt = txt.replace(/\{\{-syn-\}\}/g, "===Synonyms===");
  txt = txt.replace(/\{\{trans\}\}/g, "Translations");
  txt = txt.replace(/\n\'\'\'adjective\'\'\'\n/gi, "\n===Adjective===\n");
  txt = txt.replace(/\n\'\'\'adverb\'\'\'\n/gi, "\n===Adverb===\n");
  txt = txt.replace(/\n\'\'\'noun\'\'\'\n/gi, "\n===Noun===\n");
  txt = txt.replace(/\n\'\'\'verb\'\'\'\n/gi, "\n===Verb===\n");
  txt = txt.replace(/\n\'\'\'translation\'\'\'\n/gi, "\n===Translations===\n");
  txt = txt.replace(/\n\'\'\'translations\'\'\'\n/gi, "\n===Translations===\n");
  txt = txt.replace(/\*\[\[IPA\]\]: \/\/\n\*\[\[SAMPA\]\]: \/\/\n/gi, "{"+"{rfp}}\n");
  txt = txt.replace(/==adjective==/gi, "==Adjective==");
  txt = txt.replace(/==adjective form==/gi, "==Adjective==");
  txt = txt.replace(/==adjective phrase==/gi, "==Adjective==");
  txt = txt.replace(/==adjectivial phrase==/gi, "==Adjective==");
  txt = txt.replace(/==\[\[adjective\]\]==/gi, "==Adjective==");
  txt = txt.replace(/==adverb==/gi, "==Adverb==");
  txt = txt.replace(/==adverbs==/gi, "==Adverb==");
  txt = txt.replace(/==adverb phrase==/gi, "==Adverb==");
  txt = txt.replace(/==adverbal phrase==/gi, "==Adverb==");
  txt = txt.replace(/==adverbial phrase==/gi, "==Adverb==");
  txt = txt.replace(/==adverbial participle==/gi, "==Adverb==");
  txt = txt.replace(/==\[\[adverb\]\]==/gi, "==Adverb==");
  txt = txt.replace(/==antonym==/gi, "==Antonyms==");
  txt = txt.replace(/==antonyms==/gi, "==Antonyms==");
  txt = txt.replace(/==\[\[antonyms\]\]==/gi, "==Antonyms==");
  txt = txt.replace(/==article==/gi, "==Article==");
  txt = txt.replace(/==definite article==/gi, "==Article==");
  txt = txt.replace(/==cardinal number==/gi, "==Cardinal number==");
  txt = txt.replace(/==conjunction==/gi, "==Conjunction==");
  txt = txt.replace(/==derived expresson==/gi, "==Derived terms==");
  txt = txt.replace(/==derived expression==/gi, "==Derived terms==");
  txt = txt.replace(/==\[\[derived expression\]\]==/gi, "==Derived terms==");
  txt = txt.replace(/==derived expressions==/gi, "==Derived terms==");
  txt = txt.replace(/==\[\[derived expressions\]\]==/gi, "==Derived terms==");
  txt = txt.replace(/==derived term==/gi, "==Derived terms==");
  txt = txt.replace(/==\[\[derived term\]\]==/gi, "==Derived terms==");
  txt = txt.replace(/==derived terms==/gi, "==Derived terms==");
  txt = txt.replace(/==\[\[derived terms\]\]==/gi, "==Derived terms==");
  txt = txt.replace(/==derived word==/gi, "==Derived terms==");
  txt = txt.replace(/==\[\[derived word\]\]==/gi, "==Derived terms==");
  txt = txt.replace(/==derived words==/gi, "==Derived terms==");
  txt = txt.replace(/==\[\[derived words\]\]==/gi, "==Derived terms==");
  txt = txt.replace(/==derivation==/gi, "==Etymology==");
  txt = txt.replace(/==etymology==/gi, "==Etymology==");
  txt = txt.replace(/==\[\[etymology\]\]==/gi, "==Etymology==");
  txt = txt.replace(/==External link==/gi, "==External links==");
  txt = txt.replace(/==External links==/gi, "==External links==");
  txt = txt.replace(/==letter==\n/gi, "===Letter===\n");
  txt = txt.replace(/==noun==/gi, "==Noun==");
  txt = txt.replace(/==compound noun==/gi, "==Noun==");
  txt = txt.replace(/==\[\[noun\]\]==/gi, "==Noun==");
  txt = txt.replace(/==noun form==/gi, "==Noun==");
  txt = txt.replace(/==\[\[noun form\]\]==/gi, "==Noun==");
  txt = txt.replace(/==noun phrase==/gi, "==Noun==");
  txt = txt.replace(/==\[\[noun phrase\]\]==/gi, "==Noun==");
  txt = txt.replace(/==(\[*)nominal phrase(\]*)==/gi, "==Noun==");
  txt = txt.replace(/==phrase==/gi, "==Phrase==");
  txt = txt.replace(/==\[\[phrase\]\]==/gi, "==Phrase==");
  //txt = txt.replace(/==verbal phrase==/gi, "==Phrase==");
  //txt = txt.replace(/==\[\[verbal phrase\]\]==/gi, "==Phrase==");
  txt = txt.replace(/==pronunciation==/gi, "==Pronunciation==");
  txt = txt.replace(/==\[\[pronunciation\]\]==/gi, "==Pronunciation==");
  txt = txt.replace(/==proper name==/gi, "==Proper noun==");
  txt = txt.replace(/==\[\[proper name\]\]==/gi, "==Proper noun==");
  txt = txt.replace(/==proper noun==/gi, "==Proper noun==");
  txt = txt.replace(/==\[\[proper noun\]\]==/gi, "==Proper noun==");
  txt = txt.replace(/==pronoun==/gi, "==Pronoun==");
  txt = txt.replace(/==\[\[pronoun\]\]==/gi, "==Pronoun==");
  txt = txt.replace(/==quotation==/gi, "==Quotations==");
  txt = txt.replace(/==\[\[quotation\]\]==/gi, "==Quotations==");
  txt = txt.replace(/==quotations==/gi, "==Quotations==");
  txt = txt.replace(/==\[\[quotations\]\]==/gi, "==Quotations==");
  txt = txt.replace(/==citation==/gi, "==Quotations==");
  txt = txt.replace(/==\[\[citation\]\]==/gi, "==Quotations==");
  txt = txt.replace(/==citations==/gi, "==Quotations==");
  txt = txt.replace(/==\[\[citations\]\]==/gi, "==Quotations==");
  txt = txt.replace(/==related words==/gi, "==Related terms==");
  txt = txt.replace(/==\[\[related words\]\]==/gi, "==Related terms==");
  txt = txt.replace(/==related term==/gi, "==Related terms==");
  txt = txt.replace(/==\[\[related term\]\]==/gi, "==Related terms==");
  txt = txt.replace(/==related terms==/gi, "==Related terms==");
  txt = txt.replace(/==\[\[related terms\]\]==/gi, "==Related terms==");
  //txt = txt.replace(/==compare with==/gi, "==See also==");
  txt = txt.replace(/==see also==/gi, "==See also==");
  txt = txt.replace(/==\[\[see also\]\]==/gi, "==See also==");
  txt = txt.replace(/==symbol==/gi, "==Symbol==");
  txt = txt.replace(/==\[\[symbol\]\]==/gi, "==Symbol==");
  txt = txt.replace(/==symbols==/gi, "==Symbol==");
  txt = txt.replace(/==\[\[symbols\]\]==/gi, "==Symbol==");
  txt = txt.replace(/==synonyms==/gi, "==Synonyms==");
  txt = txt.replace(/==\[\[synonyms\]\]==/gi, "==Synonyms==");
  txt = txt.replace(/==synonym==/gi, "==Synonyms==");
  txt = txt.replace(/==\[\[synonym\]\]==/gi, "==Synonyms==");
  txt = txt.replace(/==translation==/gi, "==Translations==");
  txt = txt.replace(/==\[\[translation\]\]==/gi, "==Translations==");
  txt = txt.replace(/==translations==/gi, "==Translations==");
  txt = txt.replace(/==\[\[translations\]\]==/gi, "==Translations==");
  txt = txt.replace(/==\[\[Translation\]\]s==/gi, "==Translations==");
  txt = txt.replace(/==phrase==/gi, "==Phrase==");
  txt = txt.replace(/==\[\[usage note\]\]==/gi, "==Usage notes==");
  txt = txt.replace(/==usage==/gi, "==Usage notes==");
  txt = txt.replace(/==\[\[usage\]\]==/gi, "==Usage notes==");
  txt = txt.replace(/==\[\[usage notes\]\]==/gi, "==Usage notes==");
  txt = txt.replace(/==usages==/gi, "==Usage notes==");
  txt = txt.replace(/==\[\[usages\]\]==/gi, "==Usage notes==");
  txt = txt.replace(/==usage note==/gi, "==Usage notes==");
  txt = txt.replace(/==usage notes==/gi, "==Usage notes==");
  txt = txt.replace(/==verb==/gi, "==Verb==");
  txt = txt.replace(/==\[\[verb\]\]==/gi, "==Verb==");
   txt = txt.replace(/==forms and variants==/gi, "==Alternative forms==");
   txt = txt.replace(/==other form==/gi, "==Alternative forms==");
   txt = txt.replace(/==other forms==/gi, "==Alternative forms==");
   txt = txt.replace(/==variant form==/gi, "==Alternative forms==");
   txt = txt.replace(/==variant forms==/gi, "==Alternative forms==");
   txt = txt.replace(/==alternate form==/gi, "==Alternative forms==");
   txt = txt.replace(/==alternate forms==/gi, "==Alternative forms==");
   txt = txt.replace(/==alternative form==/gi, "==Alternative forms==");
   txt = txt.replace(/==alternative forms==/gi, "==Alternative forms==");
   txt = txt.replace(/==alternate spelling==/gi, "==Alternative forms==");
   txt = txt.replace(/==alternate spellings==/gi, "==Alternative forms==");
   txt = txt.replace(/==alternative spelling==/gi, "==Alternative forms==");
   txt = txt.replace(/==other spellings==/gi, "==Alternative forms==");
   txt = txt.replace(/==spelling variant==/gi, "==Alternative forms==");
   txt = txt.replace(/==spelling variants==/gi, "==Alternative forms==");
   txt = txt.replace(/==spelling variation==/gi, "==Alternative forms==");
   txt = txt.replace(/==spelling variations==/gi, "==Alternative forms==");
   txt = txt.replace(/==spellings==/gi, "==Alternative forms==");
   txt = txt.replace(/==variant spelling==/gi, "==Alternative forms==");
   txt = txt.replace(/==variant spellings==/gi, "==Alternative forms==");
//   txt = txt.replace(/==typographic variants==/gi, "==Alternative forms==");
   txt = txt.replace(/==variant spelling==/gi, "==Alternative forms==");
   txt = txt.replace(/==variant spellings==/gi, "==Alternative forms==");
   txt=txt.replace(/==Alternative spellings==/gi, "==Alternative forms==");
   txt = txt.replace(/==references==/gi, "==References==");
   txt = txt.replace(/==reference==/gi, "==References==");
   txt = txt.replace(/==refrences==/gi, "==References==");
  //then correct levels
  txt = txt.replace(/==Adjective==\n/gi, "===Adjective===\n");
  txt = txt.replace(/==Adverb==\n/gi, "===Adverb===\n");
  txt = txt.replace(/==Derived terms==\n/gi, "===Derived terms===\n");
  txt = txt.replace(/==Etymology==\n/gi, "===Etymology===\n");
  txt = txt.replace(/==External links==\n/gi, "===External links===\n");
  txt = txt.replace(/==Noun==\n/gi, "===Noun===\n");
  txt = txt.replace(/==phrase==\n/gi, "===Phrase===\n");
  txt = txt.replace(/==Pronunciation==\n/gi, "===Pronunciation===\n");
  txt = txt.replace(/==See also==\n/gi, "===See also===\n");
  txt = txt.replace(/==Related terms==\n/gi, "===Related terms===\n");
  txt = txt.replace(/==References==\n/gi, "===References===\n");
  txt = txt.replace(/==Symbol==\n/gi, "===Symbol===\n");
  txt = txt.replace(/==Symbols==\n/gi, "===Symbol===\n");
  txt = txt.replace(/==Synonyms==\n/gi, "===Synonyms===\n");
  txt = txt.replace(/==Translation==\n/gi, "====Translations====\n");
  txt = txt.replace(/==Translations==\n/gi, "====Translations====\n");
  txt = txt.replace(/==Usage notes==\n/gi, "===Usage notes===\n");
  txt = txt.replace(/==Verb==\n/gi, "===Verb===\n");
  txt = txt.replace(/==Alternative forms==\n/g, "===Alternative forms===\n");
  txt = txt.replace(/===Alternative forms===\n\[/g, "===Alternative forms===\n* [");
}

function langHdrs() {
  txt=txt.replace(/\n==(=*)([a-z])/gi, "\n==$1$2".toUpperCase() );
}

function langSubsts() {
  txt=txt.replace(/([=\ \*\:])\{\{([a-z]{2,3})\}\}/g, "$1{{subst"+":#if:{{subst"+":isValidPageName|{{"+"$2|l=}}}}|{{subst"+":$2}}|{{"+"$2}}}}");
}

function wiktClickMyDiff() {
    window.status = "[Show changes] has now been clicked.";
    document.editform.wpDiff.click();
}

function superAutoFormat() {
  // get page title
  pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue;
  //if (pagetitle.search(/Editing /) != 0) return;
    switch(wgAction){case 'submit': case 'edit': break; default: return};
 
  // is this in the main namespace?  If not, stop.
  if (wgNamespaceNumber) return;

  // If editing a section, skip all of everything.
  if (pagetitle.search(/\(section\)/) != -1) return;
 
  txt = " " + document.editform.wpTextbox1.value;
  txt = txt.substr (1, txt.length-1);
  oldtxt = txt;
  if (txt.length < 2) txt = " " + txt;
 
  //safety valves
  if (txt.search(/^#redirect \[/i) != -1) return;
 
    minorFormat(); //minor format problems that must be dealt with first
    langHdrs();    //swap out {-en-} and such
    headLevel();   //correct known 3rd level heading level problems
    langHdrs();    //correct known language heading level problems
    langSubsts();  //subst: all the language templates
 
 if (txt == " ") txt = "";
 
 document.editform.wpTextbox1.value = txt;

  if (txt != oldtxt) {
    window.status = "...clicking the [Show changes] button...";
    setTimeout( "wiktClickMyDiff();", 2000 );
  }
}
 
addOnloadHook( superAutoFormat );
/* end stuff copied from User:Connel MacKenzie/reformat.js */