Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

371 lignes
11KB

  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. .contents
  55. {
  56. background: #FFFFFF;
  57. width: 720px;
  58. padding: 1em;
  59. margin-top: 2em;
  60. margin-bottom: 2em;
  61. border: 1px solid #E0E0E0;
  62. text-align: left;
  63. color: #444;
  64. }
  65. </style>
  66. <title>
  67. pskov_1.0.0
  68. </title>
  69. </head>
  70. <body>
  71. <div id="header">
  72. <strong id="title">PSKOV</strong>
  73. <a href="pskov_1.0.0.html">Tool</a>
  74. <a href="education.html">Education</a>
  75. </div>
  76. <center><h1>
  77. Education: 03. Site
  78. </h1></center>
  79. <center><div class="contents">
  80. <table>
  81. <thead>
  82. <tr>
  83. <th>&lt; Back</th>
  84. <th>Index</th>
  85. <th>Next &gt;</th>
  86. </tr>
  87. </thead>
  88. <tbody>
  89. <tr>
  90. <td><a href="education.02.deps.html">02. Dependencies</a></td>
  91. <td><a href="education.html">Education</a></td>
  92. <td><a href="education.04.lang.html">04. Language</a></td>
  93. </tr>
  94. </tbody>
  95. </table>
  96. <p></div><div class="contents"></p>
  97. <p>In this document we create a simple static web site with two pages.</p>
  98. <p>Estimated completion time: 10 minutes.</p>
  99. <p><strong>Table of contents</strong></p>
  100. <ul>
  101. <li><a href="#inspiration">01. Inspiration</a></li>
  102. <li><a href="#cfg">02. Investigate <code>cfg</code> file</a></li>
  103. <li><a href="#item">03. Investigate <code>item.template</code> file</a></li>
  104. <li><a href="#md">04. Investigate <code>about.md</code> and <code>cv.md</code> files</a></li>
  105. <li><a href="#lfsa">05. Launch LFSA</a></li>
  106. <li><a href="#gen">06. Generate the site</a></li>
  107. <li><a href="#summary">07. Summary</a></li>
  108. </ul>
  109. <p><a name="inspiration"/></p>
  110. <h2 id="01inspiration">01. Inspiration</h2>
  111. <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>
  112. <p>You set on to create the following pages:</p>
  113. <ul>
  114. <li>About me</li>
  115. <li>Curriculum vitae (CV)</li>
  116. </ul>
  117. <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>
  118. <ul>
  119. <li>cfg</li>
  120. <li>item.template</li>
  121. <li>about.md</li>
  122. <li>cv.md</li>
  123. </ul>
  124. <p>Let's look at their contents closer.</p>
  125. <p><a name="cfg"/></p>
  126. <h2 id="02investigatecfgfile">02. Investigate <code>cfg</code> file</h2>
  127. <p><code>cfg</code> file has the following contents:</p>
  128. <pre><code>input = .
  129. item = item.template
  130. </code></pre>
  131. <p><code>cfg</code> is an <a href="https://en.wikipedia.org/wiki/INI_file">INI file</a> with the following keys specified:</p>
  132. <table>
  133. <thead>
  134. <tr>
  135. <th>Key</th>
  136. <th>Description</th>
  137. </tr>
  138. </thead>
  139. <tbody>
  140. <tr>
  141. <td><code>input</code></td>
  142. <td>Points to a directory where <code>item</code>'s file is located</td>
  143. </tr>
  144. <tr>
  145. <td><code>item</code></td>
  146. <td>Points to an HTML template file that is used to generate HTML files out of Markdown ones</td>
  147. </tr>
  148. </tbody>
  149. </table>
  150. <p>In our case, <code>item.template</code> file is located alongside <code>cfg</code>, so we use <code>.</code> to denote current directory.</p>
  151. <p><a name="item"/></p>
  152. <h2 id="03investigateitemtemplatefile">03. Investigate <code>item.template</code> file</h2>
  153. <p><code>item.template</code> file has the following contents:</p>
  154. <pre><code>&lt;!DOCTYPE html&gt;
  155. &lt;html&gt;
  156. &lt;meta charset="utf-8"&gt;
  157. &lt;head&gt;
  158. &lt;style&gt;
  159. - - - - Collapsed for brevity - - - -
  160. &lt;/style&gt;
  161. &lt;title&gt;Serov&lt;/title&gt;
  162. &lt;/head&gt;
  163. &lt;body&gt;
  164. &lt;div id="header"&gt;
  165. &lt;strong&gt;Serov&lt;/strong&gt;
  166. &lt;a href="about.html"&gt;About me&lt;/a&gt;
  167. &lt;a href="cv.html"&gt;CV&lt;/a&gt;
  168. &lt;/div&gt;
  169. &lt;center&gt;
  170. &lt;h1&gt;PSKOV_ITEM_TITLE&lt;/h1&gt;
  171. &lt;div class="contents"&gt;
  172. PSKOV_ITEM_CONTENTS
  173. &lt;/div&gt;
  174. &lt;div id="footer"&gt;
  175. This sample web site has been generated by &lt;a href="http://opengamestudio.org/pskov"&gt;PSKOV&lt;/a&gt;.
  176. &lt;/div&gt;
  177. &lt;/center&gt;
  178. &lt;/body&gt;
  179. &lt;/html&gt;
  180. </code></pre>
  181. <p><strong>Note</strong>: style was collapsed for brevity.</p>
  182. <p>As you can see, <code>item.template</code> is an average HTML file with two <strong>PSKOV</strong> constants specified:</p>
  183. <table>
  184. <thead>
  185. <tr>
  186. <th>PSKOV constant</th>
  187. <th>Description</th>
  188. </tr>
  189. </thead>
  190. <tbody>
  191. <tr>
  192. <td><code>PSKOV_ITEM_TITLE</code></td>
  193. <td>Provides title from <code>Title:</code> part of page's header section</td>
  194. </tr>
  195. <tr>
  196. <td><code>PSKOV_ITEM_CONTENTS</code></td>
  197. <td>Provides HTML contents generated out of Markdown contents</td>
  198. </tr>
  199. </tbody>
  200. </table>
  201. <p><strong>Notes</strong>:</p>
  202. <ul>
  203. <li>other <strong>PSKOV</strong> constants are described later</li>
  204. <li>page's header section is described below</li>
  205. </ul>
  206. <p><a name="md"/></p>
  207. <h2 id="04investigateaboutmdandcvmdfiles">04. Investigate <code>about.md</code> and <code>cv.md</code> files</h2>
  208. <p><code>about.md</code> file has the following contents:</p>
  209. <pre><code> Title: About me
  210. Slug: about
  211. Hi, my name is Valentin Serov. Here's my self-portrait:
  212. ![Valentin Serov self-portrait][serov-portrait]
  213. - - - - Collapsed for brevity - - - -
  214. Have a look at my [CV][cv] now.
  215. [serov]: https://en.wikipedia.org/wiki/Valentin_Serov
  216. [revolution]: https://en.wikipedia.org/wiki/Russian_Revolution
  217. [serov-portrait]: myself.jpg
  218. [serov-work]: mywork.jpg
  219. [girl-with-peaches]: https://en.wikipedia.org/wiki/Girl_with_Peaches
  220. [pskov]: http://opengamestudio.org/pskov
  221. [cv]: cv.html
  222. </code></pre>
  223. <p><code>about.md</code> starts with a so-called header section:</p>
  224. <table>
  225. <thead>
  226. <tr>
  227. <th>Header constant</th>
  228. <th>Description</th>
  229. </tr>
  230. </thead>
  231. <tbody>
  232. <tr>
  233. <td><code>Title:</code></td>
  234. <td>Provides value for <code>PSKOV_ITEM_TITLE</code> constant when generating HTML out of Markdown</td>
  235. </tr>
  236. <tr>
  237. <td><code>Slug:</code></td>
  238. <td>Tells <strong>PSKOV</strong> that particular Markdown file should be saved under <code>&lt;slug&gt;.html</code> filename</td>
  239. </tr>
  240. </tbody>
  241. </table>
  242. <p>The rest of <code>about.md</code> contents is what any Markdown file looks like.</p>
  243. <p><strong>Note</strong>: <code>cv</code> page is referenced as <code>cv.html</code>, not <code>cv.md</code></p>
  244. <p><code>cv.md</code> file has the following contents:</p>
  245. <pre><code> Title: Curriculum vitae
  246. Slug: cv
  247. 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!
  248. | Key | Value |
  249. |---|---|
  250. | Name | Valentin Serov |
  251. | Age | 46 |
  252. | Marital status | Married |
  253. | Country | Russian Empire |
  254. | Alma mater | Imperial Academy of Arts |
  255. | Education | * Member Academy of Arts (1898) &lt;br&gt; * Full Member Academy of Arts (1903) |
  256. </code></pre>
  257. <p>As you can see, there's nothing new in <code>cv.md</code> except for a Markdown table.</p>
  258. <p><a name="lfsa"/></p>
  259. <h2 id="05launchlfsa">05. Launch LFSA</h2>
  260. <p>Launch <a href="http://opengamestudio.org/lfsa">LFSA</a> so that it points to directory with the files we just observed:</p>
  261. <pre><code>$ /path/to/lfsa-201905.py /path/to/dir/01.TwoPages
  262. </code></pre>
  263. <p>You should see output similar to this:</p>
  264. <pre><code>DIR: '/Users/kornerr/p/site-pskov-sample/01.TwoPages'
  265. PORT: '8000'
  266. </code></pre>
  267. <p><a name="gen"/></p>
  268. <h2 id="06generatethesite">06. Generate the site</h2>
  269. <p>Now it's finally time to generate your personal web site:</p>
  270. <ul>
  271. <li>Go to <a href="http://opengamestudio.org/pskov">Tool</a> page</li>
  272. <li>Make sure<ul>
  273. <li><code>Path:</code> points to the same directory you specified before</li>
  274. <li><code>Input directory:</code> and <code>Item template:</code> have values from <code>cfg</code></li></ul></li>
  275. <li>Press <code>Generate</code> button to generate HTML files right where Markdown ones reside</li>
  276. <li>Open generated <code>about.html</code> from the site's directory</li>
  277. <li>You should see your web site running locally</li>
  278. </ul>
  279. <p><a name="summary"/></p>
  280. <h2 id="07summary">07. Summary</h2>
  281. <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>
  282. <p>Introduced PSKOV constants include:</p>
  283. <table>
  284. <thead>
  285. <tr>
  286. <th>PSKOV constant</th>
  287. <th>Description</th>
  288. </tr>
  289. </thead>
  290. <tbody>
  291. <tr>
  292. <td><code>PSKOV_ITEM_TITLE</code></td>
  293. <td>Provides title from <code>Title:</code> part of page's header section</td>
  294. </tr>
  295. <tr>
  296. <td><code>PSKOV_ITEM_CONTENTS</code></td>
  297. <td>Provides HTML contents generated out of Markdown contents</td>
  298. </tr>
  299. </tbody>
  300. </table>
  301. <p>Introduced configuration keys include:</p>
  302. <table>
  303. <thead>
  304. <tr>
  305. <th>Key</th>
  306. <th>Description</th>
  307. </tr>
  308. </thead>
  309. <tbody>
  310. <tr>
  311. <td><code>input</code></td>
  312. <td>Points to a directory where <code>item</code>'s file is located</td>
  313. </tr>
  314. <tr>
  315. <td><code>item</code></td>
  316. <td>Points to an HTML template file that is used to generate HTML files out of Markdown ones</td>
  317. </tr>
  318. </tbody>
  319. </table>
  320. <p>Introduced header constants include:</p>
  321. <table>
  322. <thead>
  323. <tr>
  324. <th>Header constant</th>
  325. <th>Description</th>
  326. </tr>
  327. </thead>
  328. <tbody>
  329. <tr>
  330. <td><code>Title:</code></td>
  331. <td>Provides value for <code>PSKOV_ITEM_TITLE</code> constant when generating HTML out of Markdown</td>
  332. </tr>
  333. <tr>
  334. <td><code>Slug:</code></td>
  335. <td>Tells <strong>PSKOV</strong> that particular Markdown file should be saved under <code>&lt;slug&gt;.html</code> filename</td>
  336. </tr>
  337. </tbody>
  338. </table>
  339. <p></div><div class="contents"></p>
  340. <table>
  341. <thead>
  342. <tr>
  343. <th>&lt; Back</th>
  344. <th>Index</th>
  345. <th>Next &gt;</th>
  346. </tr>
  347. </thead>
  348. <tbody>
  349. <tr>
  350. <td><a href="education.02.deps.html">02. Dependencies</a></td>
  351. <td><a href="education.html">Education</a></td>
  352. <td><a href="education.04.lang.html">04. Language</a></td>
  353. </tr>
  354. </tbody>
  355. </table>
  356. </div></center>
  357. <script type="text/javascript">
  358. </script>
  359. </body>
  360. </html>