I am not quite sure what you are having problems with, but I think you
want to 'remind' trac you have python code for syntax highlighting:
{{{
#!python

  (your script here)
}}}

 - Aaron

On Mon, July 24, 2006 10:37, Viktor Errath wrote:
>
> Hello List
>
> We've got a little problem with our trac.
>
> If we use the ".. code-block:: python" within a Restructured wiki site
> then we discover a little problem that I couldn't solve until now.
>
> Fact ist that if we use this line in our rst-wiki more then once in a
> "wiki-file" then it happens that the following python-code is neither
> highlighted nor shown at all?
>
> I know that my english is very bad I can understand if noone of you has
> understood my problem. Therefore here are two links to show you the
> problem.
>
> The first link works:
> http://gelb.bcom.at/trac/misc/wiki/asdf
>
> The second link doesn't work:
> Only the first "code-block:: python" is shown. All further ones are
> "shown" a a line that contains "none":
> http://gelb.bcom.at/trac/misc/wiki/TutorialsPython/PythonUmlauteUnicodeEncodings
>
> Sorry for the (extremely) long email.
>
> If you have any hints for me I would be happy.
> Many thanks in advance.
>
>
>
>
>
> The source of the two site follows:
>
> The content of the first wiki-link makes no sence. It it just a test-wiki.
> Here is the (first part of the) "source" of this site:
>
> {{{
> #!rst
>
> ############################################
> Von Python, Umlauten, Unicode und Encodings
> ############################################
>
> .. code-block:: TracNav
>
>     Hauptnavigation
>
> Immer wieder tauchen Fragen zu Umlauten und Unicode auf. Mit dieser ding
> findet man heraus, wenn man in einer ommandozeilen-Konsole (Shell)
> den Befehl ``/usr/bin/locale`` eingibt:
>
> .. code-block:: python
>
>   de_DE       -->  # -*- coding: iso-8859-1 -*-
>   [EMAIL PROTECTED]  -->  # -*- coding: iso-8859-15 -*-
>   for item in asdf:
>      a = asdf.split()
>
>   de_AT.utf8  -->  # -*- coding: utf-8 -*-
>
> Ab dem Moment, in dem das Encoding definiert wurde, können auch Umlaute
> und andere Sonderzeichen, die vom definierten Encoding abgedeckt werden,
> als String und in den Kommentaren Verwendung finden.
>
> .. code-block:: python
>
>   de_DE       -->  # -*- coding: iso-8859-1 -*-
>   [EMAIL PROTECTED]  -->  # -*- coding: iso-8859-15 -*-
>   for item in asdf:
>      a = asdf.split()
>
>   de_AT.utf8  -->  # -*- coding: utf-8 -*-
>
> Inline  `python:s = "Hallo Welt" # OK`:code-block:
>
> .. code-block:: python
>
>   for item in asdf:
>      a = asdf.split()
>
>   de_AT.utf8  -->  # -*- coding: utf-8 -*-
> }}}
>
>
>
>
>
>
>
>
>
>
>
>
> Here is the beginning of the source of the second wiki-link:
>
>
>
>
>
> {{{
> #!rst
>
> ############################################
> Von Python, Umlauten, Unicode und Encodings
> ############################################
>
> .. code-block:: TracNav
>
>     Hauptnavigation
>
> Immer wieder tauchen Fragen zu Umlauten und Unicode auf. Mit dieser
> Anleitung versuche ich dieses Thema so einfach wie möglich
> zu erklären. Dabei geht es mir nicht um die korrekte Darstellung
> von dem was wirklich im Hintergrund passiert.
>
>
> ----------------------
> Umlaute im Python-Code
> ----------------------
>
> Python verwendet *zwei verschiedene* Objekttypen zum Speichern von
> Text. --> `str` und `unicode`.
>
> Wenn man Python keine besonderen Anweisungen gibt, dann wird Text,
> den man einfach nur in Anführungszeichen schreibt, als Objekt vom
> Typ `str` abgespeichert (``s = "Hallo Welt"``).
> Dieser Typ kann normalerweise nur mit den Zeichen etwas anfangen,
> die auch im amerikanischen Englisch Gebrauch finden.
> Da es in der englischen Sprache keine Umlaute wie Ö oder Ä gibt,
> können diese, ohne besondere Vorkehrungen, nicht in ein Objekt
> vom Typ `str` geschrieben werden.
>
> Um trotzdem Umlaute verwenden zu können, hat man etwas eingeführt,
> das Python anzeigt in welchem Encoding das Python-Modul geschrieben
> wurde. Mit Hilfe einer sogenannen *Magic-Line* zeigt man Python
> das Encoding des Python-Modules.
>
> So könnte eine solche Magic-Line aussehen.:
>
> .. code-block:: python
>
>   # -*- coding: iso-8859-1 -*-
>
> Diese Magic-Line muss als erste oder zweite Zeile im Modul stehen.
> Wichtig dabei ist allerdings, dass in dieser Magic-Line auch wirklich
> das Encoding angegeben wird, in dem die Datei abgespeichert wird.
> Es funktioniert nicht, wenn man dem Python-Interpreter mit
> ``# -*- coding: utf-8 -*-`` signalisiert, dass die Datei im
> UTF-8-Encoding abgespeichert wurde, wenn in Wirklichkeit die Datei
> als ISO-8895-1-Datei abgespeichert wird.
>
> Viele einfache Editoren lassen einem keine Wahl -- besonders unter
> Windows ist das gerne der Fall. Wenn in einem deutschsprachigen
> Windows im Editor keine Auswahl getroffen werden kann, dann ist
> man mit der Magic-Line ``# -*- coding: iso-8859-1 -*-`` nicht
> schlecht bedient.
>
> Unter Linux können viele Editoren mit verschiedenen Encodings
> umgehen. Wenn man keine Auswahl trifft, dann wird die Datei im
> Standard-Encoding abgespeichert. Dieses Standard-Encoding findet
> man heraus, wenn man in einer Kommandozeilen-Konsole (Shell)
> den Befehl ``/usr/bin/locale`` eingibt::
>
>   de_DE       -->  # -*- coding: iso-8859-1 -*-
>   [EMAIL PROTECTED]  -->  # -*- coding: iso-8859-15 -*-
>   de_DE.utf8  -->  # -*- coding: utf-8 -*-
>
>   de_AT       -->  # -*- coding: iso-8859-1 -*-
>   [EMAIL PROTECTED]  -->  # -*- coding: iso-8859-15 -*-
>   de_AT.utf8  -->  # -*- coding: utf-8 -*-
>
> Ab dem Moment, in dem das Encoding definiert wurde, können auch
> Umlaute und andere Sonderzeichen, die vom definierten Encoding
> abgedeckt werden, als String und in den Kommentaren Verwendung
> finden.
>
> Vor der Definition des Encodings hätte Python eine Warnung angezeigt
> wenn man einen String mit Umlauten eingegeben hätte:
>
> .. code-block:: python
>
>   s = "Hallo Welt" # OK
>   s = "Hallo Österreich" # Fehler/Warnung
>
> Nach der Definition des Encodings:
>
> .. code-block:: python
>
>   s = "Hallo Welt" # OK
>   s = "Hallo Österreich" # OK
>
> ----------------------------------------------
> Umwandeln zwischen den verschiedenen Encodings
> ----------------------------------------------
>
> Python verwendet als **Basis Unicode**! So kurz dieser Satz auch ist,
> so wichtig ist er. Möchte man einen Text von einem Encoding
> in ein anderes Umwandeln, dann geschieht das in *zwei Schritten*.
>
> ::
>
>   iso-8859-1  -->  Unicode  -->  utf-8
>   utf-8       -->  Unicode  -->  iso-8859-1
>   ...
>
> Die Umwandlung nach Unicode wird von ``decode()`` und die Umwandlung
> ...[skip]
> }}}
>
>
>
>
>
>
> Mit freundlichen Grueßen | best regards
> Viktor ERRATH
> Technischer Leiter
>
> --
> mailto:[EMAIL PROTECTED]
> Tel.: +43 1 470 71 33 - 46 Fax: +43 1 470 71 33 - 77
> bcom Marketing, Communication & IT-Solutions GmbH
> Thimiggasse 50, A-1180 Wien, Austria / Europe
>
> http://sw3.at | www.bcom.at > Introducing the New Software-Standard
> --------------------------------------------------------------------------------------
>
>
> _______________________________________________
> Trac mailing list
> [email protected]
> http://lists.edgewall.com/mailman/listinfo/trac
>
>


-- 
Sent using a web interface, so I am sending this instead of working.

_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to