programming.en.yhtml2
author Volker Birk <vb@pep-project.org>
Thu, 08 Apr 2021 21:11:30 +0200
changeset 77 5b23278ed81f
parent 0 76005e62091d
permissions -rw-r--r--
updating documentation
0
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     1
include homepage.en.yhtml2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     3
page "Using YML 2" {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     4
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     5
        YML 2 is a smart ¬http://en.wikipedia.org/wiki/Template_processor template language¬ and
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     6
        ¬http://en.wikipedia.org/wiki/Domain-specific_language DSL concept¬. This guide will give
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     7
        you a feeling, for what it's worth.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     8
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
     9
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    10
    h2 id=wiki > Creating a Wiki like language for writing documentation
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    11
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    12
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    13
        Let's say, we want to define a small Wiki system, which should be translated from a Wiki
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    14
        like language into HTML. This guide is written in one using YML 2. I call it ƒYHTML. You can
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    15
        view the ¬homepage.en.yhtml2 source code of what you're reading now¬. It's about writing
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    16
        web pages like that:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    17
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    18
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    19
    Code {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    20
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    21
        page "Hello, world" {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    22
            p   ¬features#blockquote >>¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    23
                Hello, world! I can link here, say:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    24
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    25
        >         
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    26
        ] ¬http://en.wikipedia.org to Wikipedia¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    27
        > \n
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    28
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    29
                ¬features#blockquote >>¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    30
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    31
            p   ¬features#blockquote >>¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    32
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    33
        >         
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    34
        ] This is ƒemphasized. And this is «code».
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    35
        > \n
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    36
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    37
                ¬features#blockquote >>¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    38
        }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    39
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    40
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    41
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    42
        Prerequisite: knowing how ¬http://en.wikipedia.org/wiki/Html#Markup HTML¬ works.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    43
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    44
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    45
    h2 id=how > How does that work?
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    46
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    47
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    48
        YML 2 is a template language. That means, you can define ¬http://en.wikipedia.org/wiki/Recursion recursive¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    49
        templates of what's to be generated. This is ¬homepage.en.yhtml2 the code¬; just click on underlined things
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    50
        to get an explanation:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    51
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    52
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    53
    Code {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    54
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    55
        ¬features#quotethrough <¬?xml version="1.0" encoding="UTF-8"?¬features#quotethrough >¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    56
        ¬features#quotethrough <¬!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    57
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"¬features#quotethrough >¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    58
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    59
        ¬features#decl decl¬ pageContent ¬features#alias alias¬ body ¬features#defaultbody {¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    60
            a name¬features#named =¬"top";
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    61
            ¬features#including include¬ ¬heading.en.yhtml2 heading.en.yhtml2¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    62
            div id¬features#named =¬"entries"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    63
                ¬features#contentfc content¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    64
        ¬features#defaultbody }¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    65
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    66
        ¬features#decl decl¬ page(¬features#pointer *title¬, lang¬features#defaultattr =¬"en", xml:lang¬features#defaultattr =¬"en", xmlns¬features#defaultattr =¬"http://www.w3.org/1999/xhtml")
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    67
            ¬features#alias alias¬ html ¬features#defaultbody {¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    68
            head ¬features#subtree {¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    69
                title ¬features#pointer *title¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    70
                meta http-equiv¬features#named =¬"Content-Type", content¬features#named =¬"text/html;charset=UTF-8";
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    71
                link rel¬features#named =¬"stylesheet", type¬features#named =¬"text/css", href¬features#named =¬"format.css";
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    72
            ¬features#subtree }¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    73
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    74
            pageContent
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    75
                ¬features#contentfc content¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    76
        ¬features#defaultbody }¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    77
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    78
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    79
        br; > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    80
        ] <a href="http://docs.python.org/library/re.html">"¬\s*(.*?)\s+(.*?)\s*¬"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    81
        >  ¬features#userop as¬ a href¬features#named =¬"%1" ¬features#quote >¬ %2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    82
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    83
        br; > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    84
        ] <a href="http://docs.python.org/library/re.html">"«(.*?)»"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    85
        >  ¬features#userop as¬ code ¬features#quote >¬ %1
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    86
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    87
        br; > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    88
        ] <a href="http://docs.python.org/library/re.html">"ƒ(\S+)"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    89
        >  ¬features#userop as¬ em ¬features#quote >¬ %1
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    90
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    91
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    92
    h2 id=details > Details, please!
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    93
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    94
    h3 > Starting with XHTML headers
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    95
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    96
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    97
        Because HTML headers are boring and annoying, I'm copying them from document to document. And at last,
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    98
        they ended here ;-) If you already have things in angle brackets, you can just add them to your YML 2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
    99
        document “as is”, because everything which starts with an opening angle bracket will be a “give through”
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   100
        for the YML 2 toolchain. So our first two lines are:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   101
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   102
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   103
    Code 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   104
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   105
        ¬features#quotethrough <¬?xml version="1.0" encoding="UTF-8"?¬features#quotethrough >¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   106
        ¬features#quotethrough <¬!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   107
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"¬features#quotethrough >¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   108
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   109
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   110
    h3 > Defining the document structure
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   111
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   112
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   113
        A Webpage usually has a structure: it has a specific title and content. Beside that, technical things
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   114
        have to be encoded. A Webpage in XHTML is XML text, setting xmlns to the right name space. That's how we
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   115
        do that in YML 2:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   116
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   117
    
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   118
    Code 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   119
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   120
        ¬features#decl decl¬ page(¬features#pointer *title¬, lang¬features#defaultattr =¬"en", xml:lang¬features#defaultattr =¬"en", xmlns¬features#defaultattr =¬"http://www.w3.org/1999/xhtml")
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   121
            ¬features#alias alias¬ html ¬features#defaultbody {¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   122
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   123
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   124
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   125
        First we ¬features#decl declare¬ the «page» function. It's ¬features#alias aliased to¬ «html», so it will
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   126
        generate a «html» tag, not a «page» tag.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   127
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   128
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   129
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   130
        The first parameter, «*title», is a placeholder for the title of the document. The content of what we give
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   131
        here later will be repeated at any place we're putting «*title» into our template. This technique is called
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   132
        ¬features#pointer Pointers¬.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   133
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   134
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   135
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   136
        The two other attributes have ¬features#defaultattr Default Values¬, so they're generated each time the
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   137
        «page» function will be called.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   138
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   139
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   140
    h3 > The Document content
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   141
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   142
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   143
        The document content is what is in the «{ ... }» block:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   144
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   145
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   146
    Code
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   147
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   148
        ¬features#defaultbody {¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   149
            head ¬features#subtree {¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   150
                title ¬features#pointer *title¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   151
                meta http-equiv¬features#named =¬"Content-Type", content¬features#named =¬"text/html;charset=UTF-8";
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   152
                link rel¬features#named =¬"stylesheet", type¬features#named =¬"text/css", href¬features#named =¬"format.css";
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   153
            ¬features#subtree }¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   154
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   155
            pageContent
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   156
                ¬features#contentfc content¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   157
        ¬features#defaultbody }¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   158
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   159
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   160
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   161
        This reflects, that each HTML document has a «head» and a «body» section. Of course, we insert the «*title»
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   162
        pointer value in the «title» tag. Then some meta data and a link to a nice
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   163
        ¬http://en.wikipedia.org/wiki/Cascading_Style_Sheets CSS¬ ;-)
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   164
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   165
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   166
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   167
        For the «body» section, we have a little helper function, «pageContent». The function named «content» is
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   168
        a ¬features#contentfc placeholder¬, where the content of the page will be placed, when our «page» function
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   169
        will be called.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   170
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   171
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   172
    h3 > Generating the «body» with the «pageContent» function
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   173
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   174
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   175
        The «pageContent» function is used for generating the «body» with standard elements; therefore, it's
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   176
        ¬features#alias aliased¬ to «body»:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   177
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   178
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   179
    Code
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   180
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   181
        ¬features#decl decl¬ pageContent ¬features#alias alias¬ body ¬features#defaultbody {¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   182
            a name¬features#named =¬"top";
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   183
            ¬features#including include¬ ¬heading.en.yhtml2 heading.en.yhtml2¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   184
            div id¬features#named =¬"entries"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   185
                ¬features#contentfc content¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   186
        ¬features#defaultbody }¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   187
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   188
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   189
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   190
        It first sets an HTML anchor, so links can reference the top of the page:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   191
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   192
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   193
    Code | a name¬features#named =¬"top";
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   194
       
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   195
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   196
        Then a file with heading and navigation (the menu to the right on the page here) is being
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   197
        ¬features#including included¬:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   198
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   199
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   200
    Code | ¬features#including include¬ ¬heading.en.yhtml2 heading.en.yhtml2¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   201
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   202
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   203
        At last, the page content is being put in, surrounded by a «div» named «entries», so it can be referenced
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   204
        later, too:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   205
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   206
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   207
    Code    ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   208
            div id¬features#named =¬"entries"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   209
                ¬features#contentfc content¬;
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   210
            ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   211
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   212
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   213
        If you'll have a look on the included ¬heading.en.yhtml2 heading.en.yhtml2¬ file, then you'll see the 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   214
        the static head and navigation sections hard coded. With the ¬format.css CSS file¬ everything is brought
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   215
        to the right place.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   216
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   217
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   218
    h3 > Defining some operators for the Wiki like language
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   219
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   220
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   221
        The trick with a Wiki like language is, that one can write plain text, and adding structural things
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   222
        to it, like links i.e.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   223
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   224
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   225
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   226
        So we need language constructs, which let us structure. In YML 2 these are called
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   227
        ¬features#userop User defined in-text Operators¬:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   228
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   229
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   230
    Code {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   231
        > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   232
        ] <a href="http://docs.python.org/library/re.html">"¬\s*(.*?)\s+(.*?)\s*¬"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   233
        >  ¬features#userop as¬ a href¬features#named =¬"%1" ¬features#quote >¬ %2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   234
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   235
        br; > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   236
        ] <a href="http://docs.python.org/library/re.html">"«(.*?)»"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   237
        >  ¬features#userop as¬ code ¬features#quote >¬ %1
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   238
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   239
        br; > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   240
        ] <a href="http://docs.python.org/library/re.html">"ƒ(\S+)"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   241
        >  ¬features#userop as¬ em ¬features#quote >¬ %1
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   242
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   243
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   244
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   245
        They look somewhat disturbing, if you're not familiar with
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   246
        ¬http://en.wikipedia.org/wiki/Regular_expression Regex¬, so I will explain.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   247
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   248
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   249
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   250
        First we define a link:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   251
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   252
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   253
    Code {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   254
        > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   255
        ] <a href="http://docs.python.org/library/re.html">"¬\s*(.*?)\s+(.*?)\s*¬"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   256
        >  ¬features#userop as¬ a href¬features#named =¬"%1" ¬features#quote >¬ %2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   257
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   258
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   259
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   260
        The keyword «define operator» starts the definition. Then there is the Regex:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   261
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   262
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   263
    Code | "¬\s*(.*?)\s+(.*?)\s*¬"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   264
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   265
    p {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   266
        "I decided I want to have the special character " "¬" " surrounding each link like this: "
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   267
        code ] ¬http://en.wikipedia.org go to Wikipedia¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   268
        ". This is just like what ¬http://www.mediawiki.org MediaWiki¬ does with brackets; here the "
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   269
        "same would read: «[http://en.wikipedia.org go to Wikipedia]»."
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   270
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   271
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   272
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   273
        I like using such special characters. This is because I'm using a
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   274
        ¬http://www.apple.com/mac/ Mac¬ and ¬http://en.wikipedia.org/wiki/GNU/Linux GNU/Linux¬.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   275
        If you're using ¬http://www.microsoft.com/windows/ Windows¬, I really can recommend
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   276
        ¬http://www.autohotkey.com/docs/Hotkeys.htm AutoHotkey¬. It's a great piece of software to expand the
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   277
        keyboard capabilities of Windows (and much more).
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   278
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   279
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   280
    p {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   281
        > How does this Regex stuff work? It's a ¬http://en.wikipedia.org/wiki/Pattern_matching pattern matching¬ language consuming characters with each 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   282
        > command. Well, we want to have the following: The first thing between the 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   283
        ] ¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   284
        >  markers shell be the link target URL. All other things shell be the name of the link shown. 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   285
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   286
        For that case, we're first consuming whitespace with «\s*» – the «\s» means “an arbitrary whitespace
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   287
        character” (like blank, newline, etc.). The asterisk «*» means “some of them or none”, so this
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   288
        consumes all whitespace which is there (and gives no error if there is none).
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   289
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   290
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   291
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   292
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   293
        Second, we open a group with parentheses «( )» This first group we can later reference as «%1»
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   294
        when substituting.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   295
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   296
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   297
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   298
        Inside this group, we're telling that we want anything in it, no matter what it is. For this case,
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   299
        we're using a dot «.» which means “any character”, followed by asterisk questionmark «*?», which is 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   300
        the code for “consume as much as you can, but only up to the next code in the Regex”. The total
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   301
        «(.*?)» consumes the target URL (without checking it).
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   302
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   303
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   304
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   305
        Then we're consuming some whitespace again, this time with «\s+». Using a plus «+» instead of an 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   306
        asterisk «*» or asterisk questionmark «*?» means: there has to be at least one whitespace character.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   307
        And we want whitespace between the URL and the name, right? ;-)
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   308
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   309
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   310
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   311
        Now we're consuming the second group. We're consuming whatever is there – it's the name of the
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   312
        link. We're using another «(.*?)» group for it. It will be group 2, and we can reference it with
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   313
        this in the substitution: «%2».
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   314
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   315
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   316
    p {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   317
        > At last we're consuming redundant whitespace with «\s*», and our Regex is closed by another 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   318
        ] ¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   319
        >  character. And that makes the total Regex:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   320
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   321
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   322
    Code ] "¬\s*(.*?)\s+(.*?)\s*¬"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   323
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   324
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   325
        So what can we do with it? What we want are «<a href="..." />» tags. And that means, we want to
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   326
        call a function like this: «a href="..." > ...»
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   327
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   328
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   329
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   330
        As «href» we want to have the result of group 1,
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   331
        because this is the link target. After the ¬features#quote Quote operator¬ «>» we want to have
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   332
        what is the name of the link, that is the result of group 2. That we can write literally:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   333
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   334
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   335
    Code | a href="%1" > %2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   336
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   337
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   338
        Our first User defined in-text Operator is ready :-)
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   339
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   340
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   341
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   342
        Maybe you would prefer using brackets. So just do it ;-) Change the Regex to this, and you
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   343
        can use brackets for links like in MediaWiki; we have to escape the brackets «[ ]» with a
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   344
        backslash «\\», because brackets are also codes in Regex, and we don't want the code, we really
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   345
        want brackets:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   346
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   347
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   348
    Code | "\[\s*(.*?)\s+(.*?)\s*\]"
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   349
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   350
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   351
        The other two operators should now be easy to understand:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   352
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   353
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   354
    Code {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   355
        > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   356
        ] <a href="http://docs.python.org/library/re.html">"«(.*?)»"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   357
        >  ¬features#userop as¬ code ¬features#quote >¬ %1
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   358
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   359
        br; > ¬features#userop define operator¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   360
        ] <a href="http://docs.python.org/library/re.html">"ƒ(\S+)"</a>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   361
        >  ¬features#userop as¬ em ¬features#quote >¬ %1
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   362
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   363
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   364
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   365
        A tip: the code with an upper case letter S «\S» means, that only non-whitespace characters shell
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   366
        be consumed.
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   367
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   368
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   369
    h2 id=using > Using it
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   370
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   371
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   372
        How to write a new web page with our templates? Here's a ¬hello.en.yhtml2 hello world¬. We can use
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   373
        ¬features#blockquote Block Quotes¬ for entering text, and our new self defined operators:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   374
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   375
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   376
    Code {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   377
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   378
        ¬features#including include¬ homepage.en.yhtml2
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   379
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   380
        page "Hello, world" {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   381
            p   ¬features#blockquote >>¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   382
                Hello, world! I can link here, say:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   383
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   384
        >         
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   385
        ] ¬http://en.wikipedia.org to Wikipedia¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   386
        > \n
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   387
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   388
                ¬features#blockquote >>¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   389
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   390
            p   ¬features#blockquote >>¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   391
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   392
        >         
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   393
        ] This is ƒemphasized. And this is «code».
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   394
        > \n
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   395
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   396
                ¬features#blockquote >>¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   397
        }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   398
        ||
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   399
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   400
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   401
    p   >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   402
        The result you can ¬hello see here¬:
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   403
        >>
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   404
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   405
    iframe src="hello", width="100%", height=300 > ¬hello see here¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   406
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   407
    div id=bottom {
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   408
        > ¬index << back to Introduction¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   409
        > ¬#top ^Top^¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   410
        > ¬features >> The Features¬ 
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   411
        > ¬programming.en.yhtml2 (source)¬
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   412
    }
76005e62091d initial commit
Volker Birk <vb@pep-project.org>
parents:
diff changeset
   413
}