Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

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