Benutzer:BLueFiSH.as/JS/markup.js

Dies ist eine alte Version dieser Seite, zuletzt bearbeitet am 25. Januar 2006 um 01:56 Uhr durch BLueFiSH.as (Diskussion | Beiträge) (noch son ding). Sie kann sich erheblich von der aktuellen Version unterscheiden.

Hinweis: Leere nach dem Veröffentlichen den Browser-Cache, um die Änderungen sehen zu können.

  • Firefox/Safari: Umschalttaste drücken und gleichzeitig Aktualisieren anklicken oder entweder Strg+F5 oder Strg+R (⌘+R auf dem Mac) drücken
  • Google Chrome: Umschalttaste+Strg+R (⌘+Umschalttaste+R auf dem Mac) drücken
  • Edge: Strg+F5 drücken oder Strg drücken und gleichzeitig Aktualisieren anklicken
 // <!-- DIESE ZEILE DIENT DER OPTIK - NICHT ENTFERNEN --> <pre>
 
 // führt allgemeine Ersetzungen und Rechtschreibänderungen durch
 
 // FUNKTION !!! NICHT !!! OHNE NACHKONTROLLE ÜBER "Änderungen zeigen" AUSFÜHREN !!!
 
 function ReplaceMarkup()
 { var tbvalue = document.editform.wpTextbox1.value;
 
  // vor und hinter dem Überschriftstext mit Leerzeichen auffüllen
  tbvalue = tbvalue.replace(/\n=====/g, "\n<h5>");    tbvalue = tbvalue.replace(/=====\n/g, "<sh5>\n");
  tbvalue = tbvalue.replace(/\n====/g, "\n<h4>");    tbvalue = tbvalue.replace(/====\n/g, "<sh4>\n");
  tbvalue = tbvalue.replace(/\n===/g, "\n<h3>");     tbvalue = tbvalue.replace(/===\n/g, "<sh3>\n");
  tbvalue = tbvalue.replace(/\n==/g, "\n<h2>");      tbvalue = tbvalue.replace(/==\n/g, "<sh2>\n");
  tbvalue = tbvalue.replace(/\n<h5>/g, "\n===== ");   tbvalue = tbvalue.replace(/<sh5>\n/g, " =====\n");
  tbvalue = tbvalue.replace(/\n<h4>/g, "\n==== ");   tbvalue = tbvalue.replace(/<sh4>\n/g, " ====\n");
  tbvalue = tbvalue.replace(/\n<h3>/g, "\n=== ");    tbvalue = tbvalue.replace(/<sh3>\n/g, " ===\n");
  tbvalue = tbvalue.replace(/\n<h2>/g, "\n== ");     tbvalue = tbvalue.replace(/<sh2>\n/g, " ==\n");
 
  // Leerzeichen vor und hinter doppelten Pipes, bessere Editierbarkeit in Tabellen
  tbvalue = tbvalue.replace(/\|\|thumb\|/g, "|thumb|"); // welche Idis machen sowas...
  tbvalue = tbvalue.replace(/\|\|/g, " || ");
 
  // immer Leerzeichen nach Sternchen
  tbvalue = tbvalue.replace(/\n\*/g, "\n* ");
  tbvalue = tbvalue.replace(/\*\*/g, "\n** ");
  tbvalue = tbvalue.replace(/\*\*\*/g, "\n*** ");
 
  // doppelte Anführungszeichen entfernen wegen Syntaxfehler bei style-Angaben
  tbvalue = tbvalue.replace(/\=\"\"/g, "doppeltmitgleichvorher");
  tbvalue = tbvalue.replace(/\"\"/g, "\"");
  tbvalue = tbvalue.replace(/doppeltmitgleichvorher/g, "=\"\"");
 
  // entfernen da unnötig
  tbvalue = tbvalue.replace(/style=\"\"/g, "");
  tbvalue = tbvalue.replace(/<\!-- GEOnet -->/g, "");
  tbvalue = tbvalue.replace(/\{\{Vorlage: /gi, "{{");
  tbvalue = tbvalue.replace(/\{\{Vorlage:/gi, "{{");
 
  // im Artikelraum (zumindest nicht in Städteartikeln) nicht zu verwendende <tt> und <code> entfernen
  tbvalue = tbvalue.replace(/<tt>/gi, "");   tbvalue = tbvalue.replace(/<\/tt>/gi, "");
  tbvalue = tbvalue.replace(/<code>/gi, "");   tbvalue = tbvalue.replace(/<\/code>/gi, "");
 
  // die verschiedensten Formen der Zeilenumbrüche durch korrekte ersetzen
  tbvalue = tbvalue.replace(/<BR>/g, "<br />");      tbvalue = tbvalue.replace(/<br>/g, "<br />");
  tbvalue = tbvalue.replace(/<\/br>/gi, "<br />");   tbvalue = tbvalue.replace(/<br\/>/gi, "<br />");
  tbvalue = tbvalue.replace(/<\/br >/gi, "<br />");
 
  // korrekte Groß-Schreibung, deutsche Namen für Namensräume
  tbvalue = tbvalue.replace(/\{\{koordinate/g, "{{Koordinate");
  tbvalue = tbvalue.replace(/\{\{Koordinate_Text/g, "{{Koordinate Text");
  tbvalue = tbvalue.replace(/\{\{Koordinate_Artikel/g, "{{Koordinate Artikel");
  tbvalue = tbvalue.replace(/\{\{Koordinate_Text_Artikel/g, "{{Koordinate Text Artikel");
  tbvalue = tbvalue.replace(/\[\[category:/gi, "[[Kategorie:");
  tbvalue = tbvalue.replace(/\[\[kategorie:/g, "[[Kategorie:");
  tbvalue = tbvalue.replace(/\[\[Kategorie: /g, "[[Kategorie:");
  tbvalue = tbvalue.replace(/\[\[Image:/gi, "[[Bild:");
  tbvalue = tbvalue.replace(/\[\[bild:/g, "[[Bild:");
  tbvalue = tbvalue.replace(/\[\[Bild: /g, "[[Bild:");
 
  // unnötiges rausschmeißen
  tbvalue = tbvalue.replace(/\|right\|thumb\|/g, "|thumb|");
  tbvalue = tbvalue.replace(/\|thumb\|right\|/g, "|thumb|");
 
  // festes Leerzeichen zwischen "z.B."
  // tbvalue = tbvalue.replace(/z\.B\./g, "z.&nbsp;B.");  tbvalue = tbvalue.replace(/z\. B\./g, "z.&nbsp;B.");
 
  // Tabulatoren im Quelltext in Leerzeichen verwandeln
  tbvalue = tbvalue.replace(/\t/g, " ");
 
  // mehrfache Leerzeichen auf einzelne reduzieren.
  tbvalue = tbvalue.replace(/     /g, " ");      tbvalue = tbvalue.replace(/    /g, " ");
  tbvalue = tbvalue.replace(/   /g, " ");        tbvalue = tbvalue.replace(/  /g, " ");
 
  // unnötige Fettschreibung in Überschriften entfernen
  tbvalue = tbvalue.replace(/== '''/g, "== ");   tbvalue = tbvalue.replace(/''' ==/g, " ==");
 
  // Doppelpunkte werden nicht in Überschriften verwendet
  tbvalue = tbvalue.replace(/: ==/g, " ==");     tbvalue = tbvalue.replace(/:==/g, " ==");
 
  // tbvalue = tbvalue.replace(/ \n/g, "\n");
 
  // Weblinks immer als Weblinks nicht als Externe Links, Links oder Webseiten
  tbvalue = tbvalue.replace(/== Externe Links ==/gi, "== Weblinks ==");
  tbvalue = tbvalue.replace(/== external links ==/gi, "== Weblinks ==");
  tbvalue = tbvalue.replace(/== Links ==/gi, "== Weblinks ==");
  tbvalue = tbvalue.replace(/== Webseiten ==/gi, "== Weblinks ==");
  tbvalue = tbvalue.replace(/== Websites ==/gi, "== Weblinks ==");
  tbvalue = tbvalue.replace(/== Weblink ==/gi, "== Weblinks ==");
 
  // Weblinks-Abschnitt immer auf H2-Überschrifts-Ebene
  tbvalue = tbvalue.replace(/=== Weblinks ===/g, "== Weblinks ==");
 
  // diverses
  tbvalue = tbvalue.replace(/\[\[ /g, "[[");    tbvalue = tbvalue.replace(/ \]\]/g, "]]");
  tbvalue = tbvalue.replace(/\( /g, "\(");    tbvalue = tbvalue.replace(/ \)/g, "\)");
  tbvalue = tbvalue.replace(/ \, /g, ", ");
  tbvalue = tbvalue.replace(/ \. /g, ". ");
  tbvalue = tbvalue.replace(/ \; /g, "; ");
  tbvalue = tbvalue.replace(/ \: /g, ": ");
  tbvalue = tbvalue.replace(/\&auml\;/g, "ä");
  tbvalue = tbvalue.replace(/\&ouml\;/g, "ö");
  tbvalue = tbvalue.replace(/\&uuml\;/g, "ü");
  tbvalue = tbvalue.replace(/\&dagger\;/g, "†");
  
 // TODO: alert() bei diversen Sachen, die von Hand korrigiert werden müssen.
 // TODO: alert() bei Koordinate mit 60er Sekunden! 
 // TODO: wenn nur Überschriften Ebene 3/Ebene 1 vorhanden, und keine Ebene 2, alle Ebenen eins rauf/runter setzen

  document.editform.wpTextbox1.value = tbvalue;
 }
 
 // </pre> <!-- DIESE ZEILE DIENT DER OPTIK - NICHT ENTFERNEN -->