You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

education.03.site.md 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. Title: Education: 03. Site
  2. Date: 2019-05-14 00:00
  3. Category: Page
  4. Slug: education.03.site
  5. Lang: en
  6. | < Back | Index | Next > |
  7. |---|---|---|
  8. | [02. Dependencies][prev] | [Education][index] | [04. Language][next] |
  9. </div><div class="contents">
  10. In this document we create a simple static web site with two pages.
  11. Estimated completion time: 10 minutes.
  12. **Table of contents**
  13. * [01. Inspiration](#inspiration)
  14. * [02. Investigate `cfg` file](#cfg)
  15. * [03. Investigate `item.template` file](#item)
  16. * [04. Investigate `about.md` and `cv.md` files](#md)
  17. * [05. Launch LFSA](#lfsa)
  18. * [06. Generate the site](#gen)
  19. * [07. Summary](#summary)
  20. <a name="inspiration"/>
  21. ## 01. Inspiration
  22. Suppose you are a great Russian painter named Valentin Serov. Everytime anyone wants to know about you they refer to [Wikipedia][serov]. You wake up earlier today with a distinct desire to have your very own personal web site.
  23. You set on to create the following pages:
  24. * About me
  25. * Curriculum vitae (CV)
  26. Some time later you have the following files in your [site directory][01-files]:
  27. * cfg
  28. * item.template
  29. * about.md
  30. * cv.md
  31. Let's look at their contents closer.
  32. <a name="cfg"/>
  33. ## 02. Investigate `cfg` file
  34. `cfg` file has the following contents:
  35. ```
  36. input = .
  37. item = item.template
  38. ```
  39. `cfg` is an [INI file][ini-file] with the following keys specified:
  40. | Key | Description |
  41. |---|---|
  42. | `input` | Points to a directory where `item`'s file is located |
  43. | `item` | Points to an HTML template file that is used to generate HTML files out of Markdown ones |
  44. In our case, `item.template` file is located alongside `cfg`, so we use `.` to denote current directory.
  45. <a name="item"/>
  46. ## 03. Investigate `item.template` file
  47. `item.template` file has the following contents:
  48. ```
  49. <!DOCTYPE html>
  50. <html>
  51. <meta charset="utf-8">
  52. <head>
  53. <style>
  54. - - - - Collapsed for brevity - - - -
  55. </style>
  56. <title>Serov</title>
  57. </head>
  58. <body>
  59. <div id="header">
  60. <strong>Serov</strong>
  61. <a href="about.html">About me</a>
  62. <a href="cv.html">CV</a>
  63. </div>
  64. <center>
  65. <h1>PSKOV_ITEM_TITLE</h1>
  66. <div class="contents">
  67. PSKOV_ITEM_CONTENTS
  68. </div>
  69. <div id="footer">
  70. This sample web site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>.
  71. </div>
  72. </center>
  73. </body>
  74. </html>
  75. ```
  76. **Note**: style was collapsed for brevity.
  77. As you can see, `item.template` is an average HTML file with two **PSKOV** constants specified:
  78. | PSKOV constant | Description |
  79. |---|---|
  80. | `PSKOV_ITEM_TITLE` | Provides title from `Title:` part of page's header section |
  81. | `PSKOV_ITEM_CONTENTS` | Provides HTML contents generated out of Markdown contents |
  82. **Notes**:
  83. * other **PSKOV** constants are described later
  84. * page's header section is described below
  85. <a name="md"/>
  86. ## 04. Investigate `about.md` and `cv.md` files
  87. `about.md` file has the following contents:
  88. ```
  89. Title: About me
  90. Slug: about
  91. Hi, my name is Valentin Serov. Here's my self-portrait:
  92. ![Valentin Serov self-portrait][serov-portrait]
  93. - - - - Collapsed for brevity - - - -
  94. Have a look at my [CV][cv] now.
  95. [serov]: https://en.wikipedia.org/wiki/Valentin_Serov
  96. [revolution]: https://en.wikipedia.org/wiki/Russian_Revolution
  97. [serov-portrait]: myself.jpg
  98. [serov-work]: mywork.jpg
  99. [girl-with-peaches]: https://en.wikipedia.org/wiki/Girl_with_Peaches
  100. [pskov]: http://opengamestudio.org/pskov
  101. [cv]: cv.html
  102. ```
  103. `about.md` starts with a so-called header section:
  104. | Header constant | Description |
  105. |---|---|
  106. | `Title:` | Provides value for `PSKOV_ITEM_TITLE` constant when generating HTML out of Markdown |
  107. | `Slug:` | Tells **PSKOV** that particular Markdown file should be saved under `<slug>.html` filename |
  108. The rest of `about.md` contents is what any Markdown file looks like.
  109. **Note**: `cv` page is referenced as `cv.html`, not `cv.md`
  110. `cv.md` file has the following contents:
  111. ```
  112. Title: Curriculum vitae
  113. Slug: cv
  114. 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!
  115. | Key | Value |
  116. |---|---|
  117. | Name | Valentin Serov |
  118. | Age | 46 |
  119. | Marital status | Married |
  120. | Country | Russian Empire |
  121. | Alma mater | Imperial Academy of Arts |
  122. | Education | * Member Academy of Arts (1898) <br> * Full Member Academy of Arts (1903) |
  123. ```
  124. As you can see, there's nothing new in `cv.md` except for a Markdown table.
  125. <a name="lfsa"/>
  126. ## 05. Launch LFSA
  127. Launch [LFSA][lfsa] so that it points to directory with the files we just observed:
  128. ```
  129. $ /path/to/lfsa-201905.py /path/to/dir/01.TwoPages
  130. ```
  131. You should see output similar to this:
  132. ```
  133. DIR: '/Users/kornerr/p/site-pskov-sample/01.TwoPages'
  134. PORT: '8000'
  135. ```
  136. <a name="gen"/>
  137. ## 06. Generate the site
  138. Now it's finally time to generate your personal web site:
  139. * Go to [Tool][tool] page
  140. * Make sure
  141. * `Path:` points to the same directory you specified before
  142. * `Input directory:` and `Item template:` have values from `cfg`
  143. * Press `Generate` button to generate HTML files right where Markdown ones reside
  144. * Open generated `about.html` from the site's directory
  145. * You should see your web site running locally
  146. <a name="summary"/>
  147. ## 07. Summary
  148. You have successfully generated a web site with two pages. [Check out the result][01-sample].
  149. Introduced PSKOV constants include:
  150. | PSKOV constant | Description |
  151. |---|---|
  152. | `PSKOV_ITEM_TITLE` | Provides title from `Title:` part of page's header section |
  153. | `PSKOV_ITEM_CONTENTS` | Provides HTML contents generated out of Markdown contents |
  154. Introduced configuration keys include:
  155. | Key | Description |
  156. |---|---|
  157. | `input` | Points to a directory where `item`'s file is located |
  158. | `item` | Points to an HTML template file that is used to generate HTML files out of Markdown ones |
  159. Introduced header constants include:
  160. | Header constant | Description |
  161. |---|---|
  162. | `Title:` | Provides value for `PSKOV_ITEM_TITLE` constant when generating HTML out of Markdown |
  163. | `Slug:` | Tells **PSKOV** that particular Markdown file should be saved under `<slug>.html` filename |
  164. </div><div class="contents">
  165. | < Back | Index | Next > |
  166. |---|---|---|
  167. | [02. Dependencies][prev] | [Education][index] | [04. Language][next] |
  168. [index]: education.html
  169. [prev]: education.02.deps.html
  170. [next]: education.04.lang.html
  171. [01-files]: https://github.com/OGStudio/site-pskov-sample/tree/master/01.TwoPages
  172. [01-sample]: http://opengamestudio.org/pskov/sample/01.TwoPages/about.html
  173. [ini-file]: https://en.wikipedia.org/wiki/INI_file
  174. [serov]: https://en.wikipedia.org/wiki/Valentin_Serov
  175. [lfsa]: http://opengamestudio.org/lfsa
  176. [tool]: http://opengamestudio.org/pskov