| 1 |
# SOME DESCRIPTIVE TITLE. |
| 2 |
# Copyright (C) 2010–2024 |
| 3 |
# This file is distributed under the same license as the PELICAN package. |
| 4 |
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024. |
| 5 |
# |
| 6 |
msgid "" |
| 7 |
msgstr "" |
| 8 |
"Project-Id-Version: PELICAN 4\n" |
| 9 |
"Report-Msgid-Bugs-To: \n" |
| 10 |
"POT-Creation-Date: 2024-06-24 19:06+0800\n" |
| 11 |
"PO-Revision-Date: 2024-06-27 19:00+0800\n" |
| 12 |
"Last-Translator: GeorgeHu <[email protected]>\n" |
| 13 |
"Language: zh_CN\n" |
| 14 |
"Language-Team: \n" |
| 15 |
"Plural-Forms: nplurals=1; plural=0;\n" |
| 16 |
"MIME-Version: 1.0\n" |
| 17 |
"Content-Type: text/plain; charset=utf-8\n" |
| 18 |
"Content-Transfer-Encoding: 8bit\n" |
| 19 |
"Generated-By: Babel 2.15.0\n" |
| 20 |
|
| 21 |
#: ../../report.rst:2 bc25575efa494c7b9455e02eb5c514ab |
| 22 |
msgid "Some history about Pelican" |
| 23 |
msgstr "Pelican的一些历史" |
| 24 |
|
| 25 |
#: ../../report.rst:6 959bbe068d2e4fd19e48be22706070d2 |
| 26 |
msgid "" |
| 27 |
"This page comes from a report the original author (Alexis Métaireau) " |
| 28 |
"wrote right after writing Pelican, in December 2010. The information may " |
| 29 |
"not be up-to-date." |
| 30 |
msgstr "" |
| 31 |
"此页面来自原作者 Alexis Métaireau 在2010年12月完成Pelican后作的一篇报告,因此" |
| 32 |
"其中涉及的具体内容可能和最新的Pelican有些出入。" |
| 33 |
|
| 34 |
#: ../../report.rst:10 598beb4776eb4a7bb1c928979752b1f1 |
| 35 |
msgid "" |
| 36 |
"Pelican is a simple static blog generator. It parses markup files " |
| 37 |
"(Markdown or reStructuredText for now) and generates an HTML folder with " |
| 38 |
"all the files in it. I've chosen to use Python to implement Pelican " |
| 39 |
"because it seemed to be simple and to fit to my needs. I did not wanted " |
| 40 |
"to define a class for each thing, but still wanted to keep my things " |
| 41 |
"loosely coupled. It turns out that it was exactly what I wanted. From " |
| 42 |
"time to time, thanks to the feedback of some users, it took me a very few" |
| 43 |
" time to provide fixes on it. So far, I've re-factored the Pelican code " |
| 44 |
"by two times; each time took less than 30 minutes." |
| 45 |
msgstr "" |
| 46 |
"Pelican是一个简单的静态博客生成器。它解析标记文件(目前主要是Markdown和" |
| 47 |
"reStructuredText),并生成一个文件夹,其中包含了对应于标记文件的HTML。由于Python" |
| 48 |
"很简单并且符合需求,我选择使用Python来实现Pelican。我不想为每个东西定义一个类," |
| 49 |
"但同时又想要各部件之间低耦合。事实证明,这正是我想要的。在发展过程中,多亏了用户" |
| 50 |
"给的反馈,我花了些时间修复了一些问题。到目前为止,我已经将Pelican的代码重构了两次," |
| 51 |
"每次重构都不会超过30分钟。" |
| 52 |
|
| 53 |
#: ../../report.rst:21 1709ab99c3144cb692afd1d1bc388921 |
| 54 |
msgid "Use case" |
| 55 |
msgstr "使用场景" |
| 56 |
|
| 57 |
#: ../../report.rst:23 119f315a8e6c409d98783a636ac2147c |
| 58 |
msgid "" |
| 59 |
"I was previously using WordPress, a solution you can host on a web server" |
| 60 |
" to manage your blog. Most of the time, I prefer using markup languages " |
| 61 |
"such as Markdown or reStructuredText to type my articles. To do so, I use" |
| 62 |
" vim. I think it is important to let the people choose the tool they want" |
| 63 |
" to write the articles. In my opinion, a blog manager should just allow " |
| 64 |
"you to take any kind of input and transform it to a weblog. That's what " |
| 65 |
"Pelican does. You can write your articles using the tool you want, and " |
| 66 |
"the markup language you want, and then generate a static HTML weblog." |
| 67 |
msgstr "" |
| 68 |
"我之前使用的是WordPress,你可以将它部署在Web服务器上来管理博客。大多数时候," |
| 69 |
"我更喜欢使用Markdown或reStructuredText等标记语言来撰写文章。为此,我一般用vim" |
| 70 |
"来写这些文章。我认为让大家自行选择用于写文章的工具是很重要的。在我看来,博客管理器" |
| 71 |
"应该能够接受任何类型的输入并将其转换为博客站。Pelican就采取这一思想。您可以选择自己" |
| 72 |
"喜欢的工具以及标记语言来撰写文章,然后生成静态的HTML博客站。" |
| 73 |
|
| 74 |
#: ../../report.rst:34 1a087a07690c4c35873a7f4ce18ba52b |
| 75 |
msgid "" |
| 76 |
"To be flexible enough, Pelican has template support, so you can easily " |
| 77 |
"write your own themes if you want to." |
| 78 |
msgstr "" |
| 79 |
"为了足够的灵活性,Pelican中支持使用模板,这样你就可以编写自己的主题了。" |
| 80 |
|
| 81 |
#: ../../report.rst:38 fca5a0962a0d4c27aa163f2aec94b1cf |
| 82 |
msgid "Design process" |
| 83 |
msgstr "设计过程" |
| 84 |
|
| 85 |
#: ../../report.rst:40 073dd0b024fa4701acc0078b84c45648 |
| 86 |
msgid "" |
| 87 |
"Pelican came from a need I have. I started by creating a single file " |
| 88 |
"application, and I have make it grow to support what it does by now. To " |
| 89 |
"start, I wrote a piece of documentation about what I wanted to do. Then, " |
| 90 |
"I created the content I wanted to parse (the reStructuredText files) and " |
| 91 |
"started experimenting with the code. Pelican was 200 lines long and " |
| 92 |
"contained almost ten functions and one class when it was first usable." |
| 93 |
msgstr "" |
| 94 |
"Pelican来源于我的需求。从单文件应用程序出发,不断成长为现在功能丰富的应用。首先,我" |
| 95 |
"写了一份需求文档;然后创建了我想要解析的内容(reStructuredText文件),并开始" |
| 96 |
"实验性的编写代码。Pelican的第一个能够使用的版本包含了200行代码、10个函数以及1个类。" |
| 97 |
|
| 98 |
#: ../../report.rst:47 f407fc9ad9434f1082014eeca8c4cc89 |
| 99 |
msgid "" |
| 100 |
"I have been facing different problems all over the time and wanted to add" |
| 101 |
" features to Pelican while using it. The first change I have done was to " |
| 102 |
"add the support of a settings file. It is possible to pass the options to" |
| 103 |
" the command line, but can be tedious if there is a lot of them. In the " |
| 104 |
"same way, I have added the support of different things over time: Atom " |
| 105 |
"feeds, multiple themes, multiple markup support, etc. At some point, it " |
| 106 |
"appears that the \"only one file\" mantra was not good enough for " |
| 107 |
"Pelican, so I decided to rework a bit all that, and split this in " |
| 108 |
"multiple different files." |
| 109 |
msgstr "" |
| 110 |
"我不断遇到各种问题,在使用过程中还想要往Pelican中添加功能。在对代码的第一次修改中," |
| 111 |
"添加了对配置文件的支持。虽然可以在命令行中往里传入选项,但当配置项多起来后,就会变得" |
| 112 |
"异常冗长。同样地,Pelican支持了越来越多的功能:Atom订阅源、多主体支持、多标记语言" |
| 113 |
"支持等等。在某一时刻,单文件应用已经不适合Pelican了,因此我决定多做些工作,将应用分离" |
| 114 |
"到多个文件中。" |
| 115 |
|
| 116 |
#: ../../report.rst:56 57b3d1ba492646e28e20396b78df8ea0 |
| 117 |
msgid "I’ve separated the logic in different classes and concepts:" |
| 118 |
msgstr "我将系统整体逻辑分为如下几个类和概念:" |
| 119 |
|
| 120 |
#: ../../report.rst:58 2d4090dba6674569a7e1088919185aa5 |
| 121 |
msgid "" |
| 122 |
"*writers* are responsible of all the writing process of the files. They " |
| 123 |
"are responsible of writing .html files, RSS feeds and so on. Since those " |
| 124 |
"operations are commonly used, the object is created once, and then passed" |
| 125 |
" to the generators." |
| 126 |
msgstr "" |
| 127 |
"**Writers** 负责文件的写入工作,即负责完成 html、RSS订阅源等文件的写入。因为这些" |
| 128 |
"操作都是比较常用的,这个类只会被创建一次,然后再传给Generators。" |
| 129 |
|
| 130 |
#: ../../report.rst:63 a4cff6dceb8f430791edaeb3b2280924 |
| 131 |
msgid "" |
| 132 |
"*readers* are used to read from various formats (Markdown and " |
| 133 |
"reStructuredText for now, but the system is extensible). Given a file, " |
| 134 |
"they return metadata (author, tags, category, etc) and content (HTML " |
| 135 |
"formatted)." |
| 136 |
msgstr "" |
| 137 |
"**Readers** 用于读取不同格式的文件(目前支持Markdown、reStructuredText," |
| 138 |
"但可以继续扩展)。向 **Readers** 输入一个文件,它会返回文档的元数据(作者、标签、" |
| 139 |
"分类等等)与HTML格式的文档正文内容。" |
| 140 |
|
| 141 |
#: ../../report.rst:67 6ed9719c06c2477ea05ea30e4806ad14 |
| 142 |
msgid "" |
| 143 |
"*generators* generate the different outputs. For instance, Pelican comes " |
| 144 |
"with an ArticlesGenerator and PagesGenerator, into others. Given a " |
| 145 |
"configuration, they can do whatever you want them to do. Most of the time" |
| 146 |
" it's generating files from inputs (user inputs and files)." |
| 147 |
msgstr "" |
| 148 |
"**Generators** 用以生成不同的输出,Pelican自带了 ``ArticlesGenerator`` 和 " |
| 149 |
"``PageGenerator`` 。给定一套配置信息, **Generators** 可以做几乎任何事。" |
| 150 |
"但大多数情况下,它的工作就是从输入生成文件。" |
| 151 |
|
| 152 |
#: ../../report.rst:72 cb5129c105b04d788a908f580a83e7e1 |
| 153 |
msgid "" |
| 154 |
"I also deal with contents objects. They can be ``Articles``, ``Pages``, " |
| 155 |
"``Quotes``, or whatever you want. They are defined in the ``contents.py``" |
| 156 |
" module and represent some content to be used by the program." |
| 157 |
msgstr "" |
| 158 |
"同样,还要处理正文对象。正文对象可以是 ``Articles`` 、 ``Pages`` 、 ``Quotes`` " |
| 159 |
"或者其他你想要的类型。这些对象在 ``contents.py`` 模块中完成定义,同时代表了应用中" |
| 160 |
"使用到的内容。" |
| 161 |
|
| 162 |
#: ../../report.rst:77 4123da2b628448359aa9ed20b2ca87d2 |
| 163 |
msgid "In more detail" |
| 164 |
msgstr "更细节的内容" |
| 165 |
|
| 166 |
#: ../../report.rst:79 8482492940524edf8244fc220553cd3c |
| 167 |
msgid "Here is an overview of the classes involved in Pelican." |
| 168 |
msgstr "以下是Pelican中涉及的类的概述。" |
| 169 |
|
| 170 |
#: ../../report.rst:83 a8a39a1ccc154604b8bb000dff44982d |
| 171 |
msgid "" |
| 172 |
"The interface does not really exist, and I have added it only to clarify " |
| 173 |
"the whole picture. I do use duck typing and not interfaces." |
| 174 |
msgstr "" |
| 175 |
"上图中的接口事实上并不存在,我是为了整张图的完整性才加上去的。在实际实现中,使用了" |
| 176 |
"鸭子类型而不是接口。" |
| 177 |
|
| 178 |
#: ../../report.rst:86 889dfae0dc4242f0b21ce831c7172001 |
| 179 |
msgid "Internally, the following process is followed:" |
| 180 |
msgstr "应用内部按以下流程进行处理:" |
| 181 |
|
| 182 |
#: ../../report.rst:88 fc5cbf8ca65c456c90c56c00cf5ab93f |
| 183 |
msgid "" |
| 184 |
"First of all, the command line is parsed, and some content from the user " |
| 185 |
"is used to initialize the different generator objects." |
| 186 |
msgstr "" |
| 187 |
"首先,解析命令行,并根据用户给入的一些内容来初始化不同的generator对象。" |
| 188 |
|
| 189 |
#: ../../report.rst:91 5d0c1dc643364248820fad76c204f663 |
| 190 |
msgid "" |
| 191 |
"A ``context`` is created. It contains the settings from the command line " |
| 192 |
"and a settings file if provided." |
| 193 |
msgstr "" |
| 194 |
"创建一个 ``context`` ,其中包含了来自命令行和文件的配置信息。" |
| 195 |
|
| 196 |
#: ../../report.rst:93 36725875f2c14e0bb8fc60b16afa1367 |
| 197 |
msgid "" |
| 198 |
"The ``generate_context`` method of each generator is called, updating the" |
| 199 |
" context." |
| 200 |
msgstr "" |
| 201 |
"调用各generator对象的 ``generate_context`` 方法来更新 ``context`` 。" |
| 202 |
|
| 203 |
#: ../../report.rst:95 d50a4b2e38884eb38f1b66fdf7fb1eda |
| 204 |
msgid "" |
| 205 |
"The writer is created and given to the ``generate_output`` method of each" |
| 206 |
" generator." |
| 207 |
msgstr "" |
| 208 |
"创建 **Writers** 并将其给入generator的 ``generate_output`` 方法。" |
| 209 |
|
| 210 |
#: ../../report.rst:98 da8d9096940044f2849112fb5efcb4cb |
| 211 |
msgid "" |
| 212 |
"I make two calls because it is important that when the output is " |
| 213 |
"generated by the generators, the context will not change. In other words," |
| 214 |
" the first method ``generate_context`` should modify the context, whereas" |
| 215 |
" the second ``generate_output`` method should not." |
| 216 |
msgstr "" |
| 217 |
"由于当generator生成输出时并不会改变上下文,我进行了两次调用。换句话说,第一个方法 " |
| 218 |
"``generate_context`` 会修改上下文,而第二个方法 ``generate_output`` 不会。" |
| 219 |
|
| 220 |
#: ../../report.rst:103 a6350edba931463fb92ae51dd9bc253a |
| 221 |
msgid "" |
| 222 |
"Then, it is up to the generators to do what the want, in the " |
| 223 |
"``generate_context`` and ``generate_content`` method. Taking the " |
| 224 |
"``ArticlesGenerator`` class will help to understand some others concepts." |
| 225 |
" Here is what happens when calling the ``generate_context`` method:" |
| 226 |
msgstr "" |
| 227 |
"然后,事情就取决于各generator在 ``generate_context`` 和 ``generate_content`` " |
| 228 |
"中做的操作了。拿 ``ArticlesGenerator`` 举例可以帮助理解其他的一些概念。下面是调用 " |
| 229 |
"``generate_context`` 方法后会发生的事情:" |
| 230 |
|
| 231 |
#: ../../report.rst:108 4b99ddf2cf344d0b8fbd080c15adfb64 |
| 232 |
msgid "" |
| 233 |
"Read the folder “path”, looking for restructured text files, load each of" |
| 234 |
" them, and construct a content object (``Article``) with it. To do so, " |
| 235 |
"use ``Reader`` objects." |
| 236 |
msgstr "" |
| 237 |
"读取文件夹路径,查找并加载每个restructured文件,并为每个文件构建一个正文内容对象( " |
| 238 |
"``Article`` )。此工作是由 ``Reader`` 对象完成的。" |
| 239 |
|
| 240 |
#: ../../report.rst:111 176a7a5896904f2e9929623ef652660b |
| 241 |
msgid "Update the ``context`` with all those articles." |
| 242 |
msgstr "根据所有的文章更新 ``context`` 。" |
| 243 |
|
| 244 |
#: ../../report.rst:113 bb88942c85004c4c9e0b55a72076b18f |
| 245 |
msgid "" |
| 246 |
"Then, the ``generate_content`` method uses the ``context`` and the " |
| 247 |
"``writer`` to generate the wanted output." |
| 248 |
msgstr "" |
| 249 |
"然后, ``generate_content`` 方法使用 ``context`` 和 ``writer`` 来生成想要的输出。" |