402 lines
12KB

  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <style>
  6. #header
  7. {
  8. background: #856d51;
  9. padding: 0.7em;
  10. text-align: left;
  11. }
  12. #header a
  13. {
  14. color: white;
  15. text-decoration: none;
  16. padding: 0.5em 1em 0.5em 1em;
  17. }
  18. #title
  19. {
  20. color: #433729;
  21. }
  22. html
  23. {
  24. font-family: sans-serif;
  25. }
  26. body
  27. {
  28. line-height: 1.5em;
  29. }
  30. body
  31. {
  32. background: #FAFAFA;
  33. }
  34. table
  35. {
  36. border-collapse: collapse;
  37. width: 100%;
  38. }
  39. table, th, td
  40. {
  41. border: 1px solid #aaa;
  42. padding: 0.5em;
  43. margin-top: 0.5em;
  44. margin-bottom: 0.5em;
  45. }
  46. code, pre
  47. {
  48. font-family: monospace, serif;
  49. font-size: 1em;
  50. color: #7f0a0c;
  51. background: #f5f5f5;
  52. white-space: pre-wrap;
  53. }
  54. video
  55. {
  56. width: 100%;
  57. }
  58. .contents
  59. {
  60. background: #FFFFFF;
  61. width: 720px;
  62. padding: 1em;
  63. margin-top: 2em;
  64. margin-bottom: 2em;
  65. border: 1px solid #E0E0E0;
  66. text-align: left;
  67. color: #444;
  68. }
  69. #footer
  70. {
  71. text-align: center;
  72. }
  73. #lang
  74. {
  75. float: right;
  76. }
  77. </style>
  78. <title>
  79. PSKOV
  80. </title>
  81. </head>
  82. <body>
  83. <div id="header">
  84. <strong id="title">PSKOV</strong>
  85. <a href="pskov_1.0.0.html">Tool</a>
  86. <a href="education.html">Education</a>
  87. <div id="lang">
  88. <a href="../en/education.03.site.html">EN</a>
  89. <a href="../ru/education.03.site.html">RU</a>
  90. </div>
  91. </div>
  92. <center><h1>
  93. Education: 03. Site
  94. </h1></center>
  95. <center><div class="contents">
  96. <table>
  97. <thead>
  98. <tr>
  99. <th>&lt; Back</th>
  100. <th>Index</th>
  101. <th>Next &gt;</th>
  102. </tr>
  103. </thead>
  104. <tbody>
  105. <tr>
  106. <td><a href="education.02.deps.html">02. Dependencies</a></td>
  107. <td><a href="education.html">Education</a></td>
  108. <td><a href="education.04.lang.html">04. Language</a></td>
  109. </tr>
  110. </tbody>
  111. </table>
  112. <p></div><div class="contents"></p>
  113. <p>In this document we create a simple static web site with two pages.</p>
  114. <p>Estimated completion time: 10 minutes.</p>
  115. <p><strong>Table of contents</strong></p>
  116. <ul>
  117. <li><a href="#inspiration">01. Inspiration</a></li>
  118. <li><a href="#cfg">02. Investigate <code>pskov.cfg</code> file</a></li>
  119. <li><a href="#item">03. Investigate <code>item.template</code> file</a></li>
  120. <li><a href="#md">04. Investigate <code>about.md</code> and <code>cv.md</code> files</a></li>
  121. <li><a href="#lfsa">05. Launch LFSA</a></li>
  122. <li><a href="#gen">06. Generate the site</a></li>
  123. <li><a href="#observe">07. Observe the site</a></li>
  124. <li><a href="#summary">08. Summary</a></li>
  125. </ul>
  126. <p><a name="inspiration"/></p>
  127. <h2 id="01inspiration">01. Inspiration</h2>
  128. <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>
  129. <p>You set on to create the following pages:</p>
  130. <ul>
  131. <li>About me</li>
  132. <li>Curriculum vitae (CV)</li>
  133. </ul>
  134. <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>
  135. <ul>
  136. <li>pskov.cfg</li>
  137. <li>item.template</li>
  138. <li>about.md</li>
  139. <li>cv.md</li>
  140. </ul>
  141. <p>Let's look at their contents closer.</p>
  142. <p><a name="cfg"/></p>
  143. <h2 id="02investigatepskovcfgfile">02. Investigate <code>pskov.cfg</code> file</h2>
  144. <p><code>pskov.cfg</code> file has the following contents:</p>
  145. <pre><code>input = .
  146. item = item.template
  147. </code></pre>
  148. <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>
  149. <table>
  150. <thead>
  151. <tr>
  152. <th>Key</th>
  153. <th>Description</th>
  154. </tr>
  155. </thead>
  156. <tbody>
  157. <tr>
  158. <td><code>input</code></td>
  159. <td>Points to a directory where <code>item</code>'s file is located</td>
  160. </tr>
  161. <tr>
  162. <td><code>item</code></td>
  163. <td>Points to an HTML template file that is used to generate HTML files out of Markdown ones</td>
  164. </tr>
  165. </tbody>
  166. </table>
  167. <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>
  168. <p><a name="item"/></p>
  169. <h2 id="03investigateitemtemplatefile">03. Investigate <code>item.template</code> file</h2>
  170. <p><code>item.template</code> file has the following contents:</p>
  171. <pre><code>&lt;!DOCTYPE html&gt;
  172. &lt;html&gt;
  173. &lt;meta charset="utf-8"&gt;
  174. &lt;head&gt;
  175. &lt;style&gt;
  176. - - - - Collapsed for brevity - - - -
  177. &lt;/style&gt;
  178. &lt;title&gt;Serov&lt;/title&gt;
  179. &lt;/head&gt;
  180. &lt;body&gt;
  181. &lt;div id="header"&gt;
  182. &lt;strong&gt;Serov&lt;/strong&gt;
  183. &lt;a href="about.html"&gt;About me&lt;/a&gt;
  184. &lt;a href="cv.html"&gt;CV&lt;/a&gt;
  185. &lt;/div&gt;
  186. &lt;center&gt;
  187. &lt;h1&gt;PSKOV_ITEM_TITLE&lt;/h1&gt;
  188. &lt;div class="contents"&gt;
  189. PSKOV_ITEM_CONTENTS
  190. &lt;/div&gt;
  191. &lt;div id="footer"&gt;
  192. This sample web site has been generated by &lt;a href="http://opengamestudio.org/pskov"&gt;PSKOV&lt;/a&gt;.
  193. &lt;/div&gt;
  194. &lt;/center&gt;
  195. &lt;/body&gt;
  196. &lt;/html&gt;
  197. </code></pre>
  198. <p><strong>Note</strong>: style was collapsed for brevity.</p>
  199. <p>As you can see, <code>item.template</code> is an average HTML file with two <strong>PSKOV</strong> constants specified:</p>
  200. <table>
  201. <thead>
  202. <tr>
  203. <th>PSKOV constant</th>
  204. <th>Description</th>
  205. </tr>
  206. </thead>
  207. <tbody>
  208. <tr>
  209. <td><code>PSKOV_ITEM_TITLE</code></td>
  210. <td>Value of <code>Title</code> key of the page's Markdown file</td>
  211. </tr>
  212. <tr>
  213. <td><code>PSKOV_ITEM_CONTENTS</code></td>
  214. <td>Provides HTML contents generated out of Markdown contents</td>
  215. </tr>
  216. </tbody>
  217. </table>
  218. <p><strong>Notes</strong>:</p>
  219. <ul>
  220. <li>other <strong>PSKOV</strong> constants are described later</li>
  221. <li>page's Markdown file is described below</li>
  222. </ul>
  223. <p><a name="md"/></p>
  224. <h2 id="04investigateaboutmdandcvmdfiles">04. Investigate <code>about.md</code> and <code>cv.md</code> files</h2>
  225. <p><code>about.md</code> file has the following contents:</p>
  226. <pre><code> Title: About me
  227. Slug: about
  228. Hi, my name is Valentin Serov. Here's my self-portrait:
  229. ![Valentin Serov self-portrait][serov-portrait]
  230. - - - - Collapsed for brevity - - - -
  231. Have a look at my [CV][cv] now.
  232. [serov]: https://en.wikipedia.org/wiki/Valentin_Serov
  233. [revolution]: https://en.wikipedia.org/wiki/Russian_Revolution
  234. [serov-portrait]: myself.jpg
  235. [serov-work]: mywork.jpg
  236. [girl-with-peaches]: https://en.wikipedia.org/wiki/Girl_with_Peaches
  237. [pskov]: http://opengamestudio.org/pskov
  238. [cv]: cv.html
  239. </code></pre>
  240. <p><code>about.md</code> starts with a so-called header section:</p>
  241. <table>
  242. <thead>
  243. <tr>
  244. <th>Header key</th>
  245. <th>Description</th>
  246. </tr>
  247. </thead>
  248. <tbody>
  249. <tr>
  250. <td><code>Title</code></td>
  251. <td>Provides value for <code>PSKOV_ITEM_TITLE</code> constant when generating HTML out of Markdown</td>
  252. </tr>
  253. <tr>
  254. <td><code>Slug</code></td>
  255. <td>Tells <strong>PSKOV</strong> that particular Markdown file should be saved under <code>&lt;slug&gt;.html</code> filename</td>
  256. </tr>
  257. </tbody>
  258. </table>
  259. <p>The rest of <code>about.md</code> contents is what any Markdown file looks like.</p>
  260. <p><strong>Note</strong>: <code>cv</code> page is referenced as <code>cv.html</code>, not <code>cv.md</code></p>
  261. <p><code>cv.md</code> file has the following contents:</p>
  262. <pre><code> Title: Curriculum vitae
  263. Slug: cv
  264. 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!
  265. | Key | Value |
  266. |---|---|
  267. | Name | Valentin Serov |
  268. | Age | 46 |
  269. | Marital status | Married |
  270. | Country | Russian Empire |
  271. | Alma mater | Imperial Academy of Arts |
  272. | Education | * Member Academy of Arts (1898) &lt;br&gt; * Full Member Academy of Arts (1903) |
  273. </code></pre>
  274. <p>As you can see, there's nothing new in <code>cv.md</code> except for a Markdown table.</p>
  275. <p><a name="lfsa"/></p>
  276. <h2 id="05launchlfsa">05. Launch LFSA</h2>
  277. <video controls poster="../vid/education.03.site.launch-lfsa.w2k.poster.png">
  278. <source src="../vid/education.03.site.launch-lfsa.w2k.mp4" type ="video/mp4">
  279. <source src="../vid/education.03.site.launch-lfsa.w2k.webm" type ="video/webm">
  280. ERROR Your browser does not support HTML5 video
  281. </video>
  282. <p>Launch <a href="http://opengamestudio.org/lfsa">LFSA</a> so that it points to directory with the files we just observed:</p>
  283. <pre><code>$ /path/to/lfsa_1.0.0.py /path/to/dir/01.TwoPages
  284. </code></pre>
  285. <p>You should see output similar to this:</p>
  286. <pre><code>DIR: '/Users/kornerr/p/site-pskov-sample/01.TwoPages'
  287. PORT: '8000'
  288. </code></pre>
  289. <p><a name="gen"/></p>
  290. <h2 id="06generatethesite">06. Generate the site</h2>
  291. <video controls poster="../vid/education.03.site.gen.w2k.poster.png">
  292. <source src="../vid/education.03.site.gen.w2k.mp4" type ="video/mp4">
  293. <source src="../vid/education.03.site.gen.w2k.webm" type ="video/webm">
  294. ERROR Your browser does not support HTML5 video
  295. </video>
  296. <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>
  297. <p><a name="observe"/></p>
  298. <h2 id="07observethesite">07. Observe the site</h2>
  299. <video controls poster="../vid/education.03.site.observe.w2k.poster.png">
  300. <source src="../vid/education.03.site.observe.w2k.mp4" type ="video/mp4">
  301. <source src="../vid/education.03.site.observe.w2k.webm" type ="video/webm">
  302. ERROR Your browser does not support HTML5 video
  303. </video>
  304. <p>Observe generated web site locally by opening <code>about.html</code> and switching between pages.</p>
  305. <p><a name="summary"/></p>
  306. <h2 id="08summary">08. Summary</h2>
  307. <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>
  308. <p>Introduced <strong>PSKOV</strong> constants include:</p>
  309. <table>
  310. <thead>
  311. <tr>
  312. <th>PSKOV constant</th>
  313. <th>Description</th>
  314. </tr>
  315. </thead>
  316. <tbody>
  317. <tr>
  318. <td><code>PSKOV_ITEM_TITLE</code></td>
  319. <td>Value of <code>Title</code> key of the page's Markdown file</td>
  320. </tr>
  321. <tr>
  322. <td><code>PSKOV_ITEM_CONTENTS</code></td>
  323. <td>Provides HTML contents generated out of Markdown contents</td>
  324. </tr>
  325. </tbody>
  326. </table>
  327. <p>Introduced configuration keys include:</p>
  328. <table>
  329. <thead>
  330. <tr>
  331. <th>Key</th>
  332. <th>Description</th>
  333. </tr>
  334. </thead>
  335. <tbody>
  336. <tr>
  337. <td><code>input</code></td>
  338. <td>Points to a directory where <code>item</code>'s file is located</td>
  339. </tr>
  340. <tr>
  341. <td><code>item</code></td>
  342. <td>Points to an HTML template file that is used to generate HTML files out of Markdown ones</td>
  343. </tr>
  344. </tbody>
  345. </table>
  346. <p>Introduced header keys include:</p>
  347. <table>
  348. <thead>
  349. <tr>
  350. <th>Header key</th>
  351. <th>Description</th>
  352. </tr>
  353. </thead>
  354. <tbody>
  355. <tr>
  356. <td><code>Title</code></td>
  357. <td>Provides value for <code>PSKOV_ITEM_TITLE</code> constant when generating HTML out of Markdown</td>
  358. </tr>
  359. <tr>
  360. <td><code>Slug</code></td>
  361. <td>Tells <strong>PSKOV</strong> that particular Markdown file should be saved under <code>&lt;slug&gt;.html</code> filename</td>
  362. </tr>
  363. </tbody>
  364. </table>
  365. <p></div><div class="contents"></p>
  366. <table>
  367. <thead>
  368. <tr>
  369. <th>&lt; Back</th>
  370. <th>Index</th>
  371. <th>Next &gt;</th>
  372. </tr>
  373. </thead>
  374. <tbody>
  375. <tr>
  376. <td><a href="education.02.deps.html">02. Dependencies</a></td>
  377. <td><a href="education.html">Education</a></td>
  378. <td><a href="education.04.lang.html">04. Language</a></td>
  379. </tr>
  380. </tbody>
  381. </table>
  382. </div></center>
  383. <div id="footer">
  384. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  385. from <a href="http://github.com/ogstudio/site-pskov">this source code</a>.
  386. The site is hosted by <a href="https://pages.github.com">GitHub Pages</a>.
  387. </div>
  388. <script type="text/javascript">
  389. </script>
  390. </body>
  391. </html>