Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

education.03.site.html 9.6KB

pirms 5 gadiem
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. iframe
  23. {
  24. width: 720px;
  25. height: 720px;
  26. }
  27. html
  28. {
  29. font-family: sans-serif;
  30. }
  31. body
  32. {
  33. line-height: 1.5em;
  34. }
  35. body
  36. {
  37. background: #FAFAFA;
  38. }
  39. table
  40. {
  41. border-collapse: collapse;
  42. width: 100%;
  43. }
  44. table, th, td
  45. {
  46. border: 1px solid #aaa;
  47. padding: 0.5em;
  48. margin-top: 0.5em;
  49. margin-bottom: 0.5em;
  50. }
  51. code, pre
  52. {
  53. font-family: monospace, serif;
  54. font-size: 1em;
  55. color: #7f0a0c;
  56. background: #f5f5f5;
  57. white-space: pre-wrap;
  58. }
  59. .contents
  60. {
  61. background: #FFFFFF;
  62. width: 720px;
  63. padding: 1em;
  64. margin-top: 2em;
  65. margin-bottom: 2em;
  66. border: 1px solid #E0E0E0;
  67. text-align: left;
  68. color: #444;
  69. }
  70. </style>
  71. <title>
  72. PSKOV - Opensource Game Studio static site generator
  73. </title>
  74. </head>
  75. <body>
  76. <div id="header">
  77. <strong id="title">PSKOV</strong>
  78. <a href="index.html">Tool</a>
  79. <a href="education.html">Education</a>
  80. </div>
  81. <center><h1>
  82. Education: 03. Site
  83. </h1></center>
  84. <center><div class="contents">
  85. <table>
  86. <thead>
  87. <tr>
  88. <th>&lt; Back</th>
  89. <th>Index</th>
  90. <th>Next &gt;</th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. <tr>
  95. <td><a href="education.02.deps.html">02. Dependencies</a></td>
  96. <td><a href="education.html">Education</a></td>
  97. <td><a href="education.04.lang.html">04. Language</a></td>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <p></div><div class="contents"></p>
  102. <p>In this document we create a simple static web site with two pages.</p>
  103. <p>Estimated completion time: ? minutes.</p>
  104. <p><strong>Table of contents</strong></p>
  105. <ul>
  106. <li><a href="#inspiration">01. Inspiration</a></li>
  107. <li><a href="#cfg">02. Investigate <code>cfg</code> file</a></li>
  108. <li><a href="#item">03. Investigate <code>item.template</code> file</a></li>
  109. <li><a href="#md">04. Investigate <code>index.md</code> and <code>cv.md</code> files</a></li>
  110. <li><a href="#lfsa">05. Launch LFSA</a></li>
  111. <li><a href="#gen">06. Generate the site</a></li>
  112. </ul>
  113. <p><a name="inspiration"/></p>
  114. <h2 id="01inspiration">01. Inspiration</h2>
  115. <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>
  116. <p>You set on to create the following pages:</p>
  117. <ul>
  118. <li>About me</li>
  119. <li>Curriculum vitae (CV)</li>
  120. </ul>
  121. <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>
  122. <ul>
  123. <li>cfg</li>
  124. <li>item.template</li>
  125. <li>index.md</li>
  126. <li>cv.md</li>
  127. </ul>
  128. <p>Let's look at their contents closer.</p>
  129. <p><a name="cfg"/></p>
  130. <h2 id="02investigatecfgfile">02. Investigate <code>cfg</code> file</h2>
  131. <p><code>cfg</code> file has the following contents:</p>
  132. <pre><code>input = .
  133. item = item.template
  134. </code></pre>
  135. <p><code>cfg</code> is an <a href="https://en.wikipedia.org/wiki/INI_file">INI file</a> with the following keys specified:</p>
  136. <table>
  137. <thead>
  138. <tr>
  139. <th>Key</th>
  140. <th>Description</th>
  141. </tr>
  142. </thead>
  143. <tbody>
  144. <tr>
  145. <td><code>input</code></td>
  146. <td>Points to a directory where <code>item</code>'s file is located</td>
  147. </tr>
  148. <tr>
  149. <td><code>item</code></td>
  150. <td>Points to an HTML template file that will be used to generate HTML files out of Markdown ones</td>
  151. </tr>
  152. </tbody>
  153. </table>
  154. <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>
  155. <p><a name="item"/></p>
  156. <h2 id="03investigateitemtemplatefile">03. Investigate <code>item.template</code> file</h2>
  157. <p><code>item.template</code> file has the following contents:</p>
  158. <pre><code>&lt;!DOCTYPE html&gt;
  159. &lt;html&gt;
  160. &lt;meta charset="utf-8"&gt;
  161. &lt;head&gt;
  162. &lt;style&gt;
  163. - - - - Style was collapsed for brevity - - - -
  164. &lt;/style&gt;
  165. &lt;title&gt;Serov&lt;/title&gt;
  166. &lt;/head&gt;
  167. &lt;body&gt;
  168. &lt;div id="header"&gt;
  169. &lt;strong&gt;Serov&lt;/strong&gt;
  170. &lt;a href="index.html"&gt;About me&lt;/a&gt;
  171. &lt;a href="cv.html"&gt;CV&lt;/a&gt;
  172. &lt;/div&gt;
  173. &lt;center&gt;
  174. &lt;h1&gt;PSKOV_ITEM_TITLE&lt;/h1&gt;
  175. &lt;div class="contents"&gt;
  176. PSKOV_ITEM_CONTENTS
  177. &lt;/div&gt;
  178. &lt;/center&gt;
  179. &lt;/body&gt;
  180. &lt;/html&gt;
  181. </code></pre>
  182. <p><strong>Note</strong>: style was collapsed for brevity.</p>
  183. <p>As you can see, <code>item.template</code> is an average HTML file with two constants specified:</p>
  184. <table>
  185. <thead>
  186. <tr>
  187. <th>PSKOV constant</th>
  188. <th>Description</th>
  189. </tr>
  190. </thead>
  191. <tbody>
  192. <tr>
  193. <td><code>PSKOV_ITEM_TITLE</code></td>
  194. <td>Provides title from <code>Title:</code> part of page's header section</td>
  195. </tr>
  196. <tr>
  197. <td><code>PSKOV_ITEM_CONTENTS</code></td>
  198. <td>Provides HTML contents generated out of Markdown contents</td>
  199. </tr>
  200. </tbody>
  201. </table>
  202. <p><strong>Notes</strong>:</p>
  203. <ul>
  204. <li>other <strong>PSKOV</strong> constants are described later</li>
  205. <li>page's header section is described below</li>
  206. </ul>
  207. <p><a name="md"/></p>
  208. <h2 id="04investigateindexmdandcvmdfiles">04. Investigate <code>index.md</code> and <code>cv.md</code> files</h2>
  209. <p><code>index.md</code> file has the following contents:</p>
  210. <pre><code> Title: About me
  211. Slug: index
  212. Hi, my name is Valentin Serov. Here's my self-portrait:
  213. ![Valentin Serov self-portrait][serov-portrait]
  214. - - - - Contents were collapsed for brevity - - - -
  215. Have a look at my [CV][cv] now.
  216. [serov]: https://en.wikipedia.org/wiki/Valentin_Serov
  217. [revolution]: https://en.wikipedia.org/wiki/Russian_Revolution
  218. [serov-portrait]: myself.jpg
  219. [serov-work]: mywork.jpg
  220. [girl-with-peaches]: https://en.wikipedia.org/wiki/Girl_with_Peaches
  221. [pskov]: http://opengamestudio.org/pskov
  222. [cv]: cv.html
  223. </code></pre>
  224. <p><code>index.md</code> starts with a so-called header section:</p>
  225. <table>
  226. <thead>
  227. <tr>
  228. <th>Header constant</th>
  229. <th>Description</th>
  230. </tr>
  231. </thead>
  232. <tbody>
  233. <tr>
  234. <td><code>Title:</code></td>
  235. <td>Provides value for <code>PSKOV_ITEM_TITLE</code> constant when generating HTML out of Markdown</td>
  236. </tr>
  237. <tr>
  238. <td><code>Slug:</code></td>
  239. <td>Tells <strong>PSKOV</strong> that this particular Markdown file should be saved under <code>&lt;slug&gt;.html</code> filename</td>
  240. </tr>
  241. </tbody>
  242. </table>
  243. <p>The rest of <code>index.md</code> contents is what any Markdown file looks like.</p>
  244. <p><strong>Note</strong>: <code>cv</code> page is referenced as <code>cv.html</code>, not <code>cv.md</code></p>
  245. <p><code>cv.md</code> file has the following contents:</p>
  246. <pre><code> Title: Curriculum vitae
  247. Slug: cv
  248. 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!
  249. | Key | Value |
  250. |---|---|
  251. | Name | Valentin Serov |
  252. | Age | 46 |
  253. | Marital status | Married |
  254. | Country | Russian Empire |
  255. | Alma mater | Imperial Academy of Arts |
  256. | Education | * Member Academy of Arts (1898) &lt;br&gt; * Full Member Academy of Arts (1903) |
  257. </code></pre>
  258. <p>As you can see, there's nothing new in <code>cv.md</code> except for a Markdown table.</p>
  259. <p><a name="lfsa"/></p>
  260. <h2 id="05launchlfsa">05. Launch LFSA</h2>
  261. <p>Launch LFSA so that it points to directory with the files we just observed:</p>
  262. <pre><code>$ /path/to/local-file-system-access.py /path/to/dir/01.TwoPages
  263. </code></pre>
  264. <p>You should see output similar to this:</p>
  265. <pre><code>DIR: '/Users/kornerr/p/site-pskov-sample/01.TwoPages'
  266. PORT: '8000'
  267. </code></pre>
  268. <p><a name="gen"/></p>
  269. <h2 id="06generatethesite">06. Generate the site</h2>
  270. <p>Now it's finally time to generate your personal web site:</p>
  271. <ul>
  272. <li>Go to <a href="http://opengamestudio.org/pskov">Tool</a> page</li>
  273. <li>Make sure<ul>
  274. <li><code>Path:</code> points to the same directory you specified before</li>
  275. <li><code>Input directory:</code> and <code>Item template:</code> have values from <code>cfg</code></li></ul></li>
  276. <li>Press <code>Generate</code> button to generate HTML files right where Markdown ones reside</li>
  277. <li>Open generated <code>index.html</code> from the site's directory</li>
  278. <li>You should see your web site running locally</li>
  279. </ul>
  280. <p>Take time to observe your new shiny personal web site consisting of two pages.</p>
  281. <p></div><div class="contents"></p>
  282. <table>
  283. <thead>
  284. <tr>
  285. <th>&lt; Back</th>
  286. <th>Index</th>
  287. <th>Next &gt;</th>
  288. </tr>
  289. </thead>
  290. <tbody>
  291. <tr>
  292. <td><a href="education.02.deps.html">02. Dependencies</a></td>
  293. <td><a href="education.html">Education</a></td>
  294. <td><a href="education.04.lang.html">04. Language</a></td>
  295. </tr>
  296. </tbody>
  297. </table>
  298. </div></center>
  299. <script type="text/javascript">
  300. </script>
  301. </body>
  302. </html>