|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401 |
- <!DOCTYPE html>
- <html>
- <meta charset="utf-8">
- <head>
- <style>
- #header
- {
- background: #856d51;
- padding: 0.7em;
- text-align: left;
- }
-
- #header a
- {
- color: white;
- text-decoration: none;
- padding: 0.5em 1em 0.5em 1em;
- }
- #title
- {
- color: #433729;
- }
- html
- {
- font-family: sans-serif;
- }
- body
- {
- line-height: 1.5em;
- }
- body
- {
- background: #FAFAFA;
- }
- table
- {
- border-collapse: collapse;
- width: 100%;
- }
-
- table, th, td
- {
- border: 1px solid #aaa;
- padding: 0.5em;
- margin-top: 0.5em;
- margin-bottom: 0.5em;
- }
- code, pre
- {
- font-family: monospace, serif;
- font-size: 1em;
- color: #7f0a0c;
- background: #f5f5f5;
- white-space: pre-wrap;
- }
- video
- {
- width: 100%;
- }
- .contents
- {
- background: #FFFFFF;
- width: 720px;
- padding: 1em;
- margin-top: 2em;
- margin-bottom: 2em;
- border: 1px solid #E0E0E0;
- text-align: left;
- color: #444;
- }
- #footer
- {
- text-align: center;
- }
- #lang
- {
- float: right;
- }
- </style>
- <title>
- PSKOV
- </title>
- </head>
- <body>
- <div id="header">
- <strong id="title">PSKOV</strong>
- <a href="pskov_1.0.0.html">Tool</a>
- <a href="education.html">Education</a>
- <div id="lang">
- <a href="../en/education.03.site.html">EN</a>
- <a href="../ru/education.03.site.html">RU</a>
- </div>
- </div>
- <center><h1>
- Education: 03. Site
- </h1></center>
- <center><div class="contents">
- <table>
- <thead>
- <tr>
- <th>< Back</th>
- <th>Index</th>
- <th>Next ></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a href="education.02.deps.html">02. Dependencies</a></td>
- <td><a href="education.html">Education</a></td>
- <td><a href="education.04.lang.html">04. Language</a></td>
- </tr>
- </tbody>
- </table>
- <p></div><div class="contents"></p>
- <p>In this document we create a simple static web site with two pages.</p>
- <p>Estimated completion time: 10 minutes.</p>
- <p><strong>Table of contents</strong></p>
- <ul>
- <li><a href="#inspiration">01. Inspiration</a></li>
- <li><a href="#cfg">02. Investigate <code>pskov.cfg</code> file</a></li>
- <li><a href="#item">03. Investigate <code>item.template</code> file</a></li>
- <li><a href="#md">04. Investigate <code>about.md</code> and <code>cv.md</code> files</a></li>
- <li><a href="#lfsa">05. Launch LFSA</a></li>
- <li><a href="#gen">06. Generate the site</a></li>
- <li><a href="#observe">07. Observe the site</a></li>
- <li><a href="#summary">08. Summary</a></li>
- </ul>
- <p><a name="inspiration"/></p>
- <h2 id="01inspiration">01. Inspiration</h2>
- <p>Suppose you are a great Russian painter named Valentin Serov. Everytime anyone wants to know about you they refer to <a href="https://en.wikipedia.org/wiki/Valentin_Serov">Wikipedia</a>. You wake up earlier today with a distinct desire to have your very own personal web site.</p>
- <p>You set on to create the following pages:</p>
- <ul>
- <li>About me</li>
- <li>Curriculum vitae (CV)</li>
- </ul>
- <p>Some time later you have the following files in your <a href="https://github.com/OGStudio/site-pskov-sample/tree/master/01.TwoPages">site directory</a>:</p>
- <ul>
- <li>pskov.cfg</li>
- <li>item.template</li>
- <li>about.md</li>
- <li>cv.md</li>
- </ul>
- <p>Let's look at their contents closer.</p>
- <p><a name="cfg"/></p>
- <h2 id="02investigatepskovcfgfile">02. Investigate <code>pskov.cfg</code> file</h2>
- <p><code>pskov.cfg</code> file has the following contents:</p>
- <pre><code>input = .
- item = item.template
- </code></pre>
- <p><code>pskov.cfg</code> is an <a href="https://en.wikipedia.org/wiki/INI_file">INI file</a> with the following keys specified:</p>
- <table>
- <thead>
- <tr>
- <th>Key</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>input</code></td>
- <td>Points to a directory where <code>item</code>'s file is located</td>
- </tr>
- <tr>
- <td><code>item</code></td>
- <td>Points to an HTML template file that is used to generate HTML files out of Markdown ones</td>
- </tr>
- </tbody>
- </table>
- <p>In our case, <code>item.template</code> file is located alongside <code>pskov.cfg</code>, so we use <code>.</code> to denote current directory.</p>
- <p><a name="item"/></p>
- <h2 id="03investigateitemtemplatefile">03. Investigate <code>item.template</code> file</h2>
- <p><code>item.template</code> file has the following contents:</p>
- <pre><code><!DOCTYPE html>
- <html>
- <meta charset="utf-8">
- <head>
- <style>
- - - - - Collapsed for brevity - - - -
- </style>
- <title>Serov</title>
- </head>
- <body>
- <div id="header">
- <strong>Serov</strong>
- <a href="about.html">About me</a>
- <a href="cv.html">CV</a>
- </div>
- <center>
- <h1>PSKOV_ITEM_TITLE</h1>
- <div class="contents">
- PSKOV_ITEM_CONTENTS
- </div>
- <div id="footer">
- This sample web site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>.
- </div>
- </center>
- </body>
- </html>
- </code></pre>
- <p><strong>Note</strong>: style was collapsed for brevity.</p>
- <p>As you can see, <code>item.template</code> is an average HTML file with two <strong>PSKOV</strong> constants specified:</p>
- <table>
- <thead>
- <tr>
- <th>PSKOV constant</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>PSKOV_ITEM_TITLE</code></td>
- <td>Value of <code>Title</code> key of the page's Markdown file</td>
- </tr>
- <tr>
- <td><code>PSKOV_ITEM_CONTENTS</code></td>
- <td>Provides HTML contents generated out of Markdown contents</td>
- </tr>
- </tbody>
- </table>
- <p><strong>Notes</strong>:</p>
- <ul>
- <li>other <strong>PSKOV</strong> constants are described later</li>
- <li>page's Markdown file is described below</li>
- </ul>
- <p><a name="md"/></p>
- <h2 id="04investigateaboutmdandcvmdfiles">04. Investigate <code>about.md</code> and <code>cv.md</code> files</h2>
- <p><code>about.md</code> file has the following contents:</p>
- <pre><code> Title: About me
- Slug: about
-
- Hi, my name is Valentin Serov. Here's my self-portrait:
-
- ![Valentin Serov self-portrait][serov-portrait]
-
- - - - - Collapsed for brevity - - - -
-
- Have a look at my [CV][cv] now.
-
- [serov]: https://en.wikipedia.org/wiki/Valentin_Serov
- [revolution]: https://en.wikipedia.org/wiki/Russian_Revolution
- [serov-portrait]: myself.jpg
- [serov-work]: mywork.jpg
- [girl-with-peaches]: https://en.wikipedia.org/wiki/Girl_with_Peaches
- [pskov]: http://opengamestudio.org/pskov
- [cv]: cv.html
- </code></pre>
- <p><code>about.md</code> starts with a so-called header section:</p>
- <table>
- <thead>
- <tr>
- <th>Header key</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>Title</code></td>
- <td>Provides value for <code>PSKOV_ITEM_TITLE</code> constant when generating HTML out of Markdown</td>
- </tr>
- <tr>
- <td><code>Slug</code></td>
- <td>Tells <strong>PSKOV</strong> that particular Markdown file should be saved under <code><slug>.html</code> filename</td>
- </tr>
- </tbody>
- </table>
- <p>The rest of <code>about.md</code> contents is what any Markdown file looks like.</p>
- <p><strong>Note</strong>: <code>cv</code> page is referenced as <code>cv.html</code>, not <code>cv.md</code></p>
- <p><code>cv.md</code> file has the following contents:</p>
- <pre><code> Title: Curriculum vitae
- Slug: cv
-
- Here's my CV in case my paintings still interest you. I took a bit of a modern IT approach to structure my CV as key-value pairs of a dictionary (map), enjoy!
-
- | Key | Value |
- |---|---|
- | Name | Valentin Serov |
- | Age | 46 |
- | Marital status | Married |
- | Country | Russian Empire |
- | Alma mater | Imperial Academy of Arts |
- | Education | * Member Academy of Arts (1898) <br> * Full Member Academy of Arts (1903) |
- </code></pre>
- <p>As you can see, there's nothing new in <code>cv.md</code> except for a Markdown table.</p>
- <p><a name="lfsa"/></p>
- <h2 id="05launchlfsa">05. Launch LFSA</h2>
- <video controls poster="../vid/education.03.site.launch-lfsa.w2k.poster.png">
- <source src="../vid/education.03.site.launch-lfsa.w2k.mp4" type ="video/mp4">
- <source src="../vid/education.03.site.launch-lfsa.w2k.webm" type ="video/webm">
- ERROR Your browser does not support HTML5 video
- </video>
- <p>Launch <a href="http://opengamestudio.org/lfsa">LFSA</a> so that it points to directory with the files we just observed:</p>
- <pre><code>$ /path/to/lfsa_1.0.0.py /path/to/dir/01.TwoPages
- </code></pre>
- <p>You should see output similar to this:</p>
- <pre><code>DIR: '/Users/kornerr/p/site-pskov-sample/01.TwoPages'
- PORT: '8000'
- </code></pre>
- <p><a name="gen"/></p>
- <h2 id="06generatethesite">06. Generate the site</h2>
- <video controls poster="../vid/education.03.site.gen.w2k.poster.png">
- <source src="../vid/education.03.site.gen.w2k.mp4" type ="video/mp4">
- <source src="../vid/education.03.site.gen.w2k.webm" type ="video/webm">
- ERROR Your browser does not support HTML5 video
- </video>
- <p>Go to <a href="http://opengamestudio.org/pskov">Tool</a> page and press <code>Generate</code> button to generate HTML files right where Markdown ones reside.</p>
- <p><a name="observe"/></p>
- <h2 id="07observethesite">07. Observe the site</h2>
- <video controls poster="../vid/education.03.site.observe.w2k.poster.png">
- <source src="../vid/education.03.site.observe.w2k.mp4" type ="video/mp4">
- <source src="../vid/education.03.site.observe.w2k.webm" type ="video/webm">
- ERROR Your browser does not support HTML5 video
- </video>
- <p>Observe generated web site locally by opening <code>about.html</code> and switching between pages.</p>
- <p><a name="summary"/></p>
- <h2 id="08summary">08. Summary</h2>
- <p>You have successfully generated a web site with two pages. <a href="http://opengamestudio.org/pskov/sample/01.TwoPages/about.html">Check out the result</a>.</p>
- <p>Introduced <strong>PSKOV</strong> constants include:</p>
- <table>
- <thead>
- <tr>
- <th>PSKOV constant</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>PSKOV_ITEM_TITLE</code></td>
- <td>Value of <code>Title</code> key of the page's Markdown file</td>
- </tr>
- <tr>
- <td><code>PSKOV_ITEM_CONTENTS</code></td>
- <td>Provides HTML contents generated out of Markdown contents</td>
- </tr>
- </tbody>
- </table>
- <p>Introduced configuration keys include:</p>
- <table>
- <thead>
- <tr>
- <th>Key</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>input</code></td>
- <td>Points to a directory where <code>item</code>'s file is located</td>
- </tr>
- <tr>
- <td><code>item</code></td>
- <td>Points to an HTML template file that is used to generate HTML files out of Markdown ones</td>
- </tr>
- </tbody>
- </table>
- <p>Introduced header keys include:</p>
- <table>
- <thead>
- <tr>
- <th>Header key</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><code>Title</code></td>
- <td>Provides value for <code>PSKOV_ITEM_TITLE</code> constant when generating HTML out of Markdown</td>
- </tr>
- <tr>
- <td><code>Slug</code></td>
- <td>Tells <strong>PSKOV</strong> that particular Markdown file should be saved under <code><slug>.html</code> filename</td>
- </tr>
- </tbody>
- </table>
- <p></div><div class="contents"></p>
- <table>
- <thead>
- <tr>
- <th>< Back</th>
- <th>Index</th>
- <th>Next ></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td><a href="education.02.deps.html">02. Dependencies</a></td>
- <td><a href="education.html">Education</a></td>
- <td><a href="education.04.lang.html">04. Language</a></td>
- </tr>
- </tbody>
- </table>
- </div></center>
- <div id="footer">
- The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
- from <a href="http://github.com/ogstudio/site-pskov">this source code</a>.
- The site is hosted by <a href="https://pages.github.com">GitHub Pages</a>.
- </div>
- <script type="text/javascript">
- </script>
- </body>
- </html>
-
|