| 1 | =========== |
|---|
| 2 | PyCommunity |
|---|
| 3 | =========== |
|---|
| 4 | |
|---|
| 5 | `PyCommunity` is a script that generates a static html website by browsing |
|---|
| 6 | a subversion repository, looking for reSTructuredText documents. |
|---|
| 7 | |
|---|
| 8 | The idea is to provide a way to automate a project website update everytime |
|---|
| 9 | developers change the documents founded throughout the subversion tree. |
|---|
| 10 | |
|---|
| 11 | Subversion Layout |
|---|
| 12 | ================= |
|---|
| 13 | |
|---|
| 14 | To work, `PyCommunity` browses : |
|---|
| 15 | |
|---|
| 16 | - a list of packages and extract their documents. |
|---|
| 17 | |
|---|
| 18 | - a directory that holds recipes, to build a cookbook |
|---|
| 19 | |
|---|
| 20 | - a directory that holds tutorials |
|---|
| 21 | |
|---|
| 22 | - a file that contains a glossary |
|---|
| 23 | |
|---|
| 24 | - a file, that is the main README |
|---|
| 25 | |
|---|
| 26 | - a file that is used as the content of the package list page |
|---|
| 27 | |
|---|
| 28 | A typical layout would be:: |
|---|
| 29 | |
|---|
| 30 | project |
|---|
| 31 | | |
|---|
| 32 | | |
|---|
| 33 | |-- src |
|---|
| 34 | | | |
|---|
| 35 | | |-- package1 |
|---|
| 36 | | | |
|---|
| 37 | | | |
|---|
| 38 | | module1.py |
|---|
| 39 | | |
|---|
| 40 | |-- doc |
|---|
| 41 | | | |
|---|
| 42 | | |--- packages.txt |
|---|
| 43 | | | |
|---|
| 44 | | |-- README.txt |
|---|
| 45 | | | |
|---|
| 46 | | |--- glossary.txt |
|---|
| 47 | | | |
|---|
| 48 | | |--- recipes |
|---|
| 49 | | | | |
|---|
| 50 | | | |-- recipe1.txt |
|---|
| 51 | | | |
|---|
| 52 | | |--- tutorials |
|---|
| 53 | | | | |
|---|
| 54 | | | |-- tutorial1.txt |
|---|
| 55 | |
|---|
| 56 | packages.txt |
|---|
| 57 | ------------ |
|---|
| 58 | |
|---|
| 59 | This file is used as a introduction text in the packages index page. |
|---|
| 60 | |
|---|
| 61 | README.txt |
|---|
| 62 | ---------- |
|---|
| 63 | |
|---|
| 64 | Used in the main page |
|---|
| 65 | |
|---|
| 66 | The glossary file |
|---|
| 67 | ----------------- |
|---|
| 68 | |
|---|
| 69 | The glossary file contains all project common words. The idea |
|---|
| 70 | is to collect all words and unify terms, in order to avoid |
|---|
| 71 | speaking about the same thing, using two different words. |
|---|
| 72 | |
|---|
| 73 | The glossary is a text file. Each line is composed of a word |
|---|
| 74 | a `:` character, and a short definition:: |
|---|
| 75 | |
|---|
| 76 | glossary: A file that contains definitions |
|---|
| 77 | doctest: A document with runnable examples |
|---|
| 78 | |
|---|
| 79 | The recipe folder |
|---|
| 80 | ----------------- |
|---|
| 81 | |
|---|
| 82 | The recipe folder contains reSTructuredText files. They can |
|---|
| 83 | use an extended tag to mark words that are in the glossary:: |
|---|
| 84 | |
|---|
| 85 | My super restfile |
|---|
| 86 | ----------------- |
|---|
| 87 | |
|---|
| 88 | is about {{doctest}} |
|---|
| 89 | |
|---|
| 90 | This allows PyCommunity to generate links and hints in the tutorials |
|---|
| 91 | when it founds such tags. |
|---|
| 92 | |
|---|
| 93 | The filename without it suffix, is the id of the recipe. |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | The Tutorial folder |
|---|
| 97 | ------------------- |
|---|
| 98 | |
|---|
| 99 | The tutorial folder contains reSTructuredText files. They can |
|---|
| 100 | use an extended tag to mark words that are in the glossary, like |
|---|
| 101 | recipes. |
|---|
| 102 | |
|---|
| 103 | It can also link to a recipe, by using a recipe prefix and a tag |
|---|
| 104 | like glossary:: |
|---|
| 105 | |
|---|
| 106 | look at {{recipe:recipe_1}} for details |
|---|
| 107 | |
|---|
| 108 | `PyCommunity` will replace it with the recipe title and a link to the |
|---|
| 109 | recipe. |
|---|
| 110 | |
|---|
| 111 | The filename without it suffix, is the id of the tutorial. |
|---|
| 112 | |
|---|
| 113 | The code packages |
|---|
| 114 | ----------------- |
|---|
| 115 | |
|---|
| 116 | `PyCommunity` lists all packages, and scans each one of them, to look |
|---|
| 117 | for all files with the `.txt` extension. `README.txt` is mandatory. |
|---|
| 118 | The files can also use glossary, recipe and tutorial tags:: |
|---|
| 119 | |
|---|
| 120 | look at {{tutorial:tutorial_1}} for details |
|---|
| 121 | |
|---|
| 122 | Website Layout |
|---|
| 123 | ============== |
|---|
| 124 | |
|---|
| 125 | `PyCommunity` generates a web structure that looks like this:: |
|---|
| 126 | |
|---|
| 127 | index.html == main README |
|---|
| 128 | glossary.html |
|---|
| 129 | packages |
|---|
| 130 | index.html (packages list + package.txt content) |
|---|
| 131 | package1 |
|---|
| 132 | index.html (==README.txt) |
|---|
| 133 | epydoc (epydoc) |
|---|
| 134 | module1.html |
|---|
| 135 | tutorials.html (tutorials list) |
|---|
| 136 | tutorials |
|---|
| 137 | tutorial1.html |
|---|
| 138 | cookbook.html (recipe lists) |
|---|
| 139 | cookbook |
|---|
| 140 | recipe1.html |
|---|
| 141 | |
|---|
| 142 | Configuration |
|---|
| 143 | ============= |
|---|
| 144 | |
|---|
| 145 | `PyCommunity` uses `pycommunity.conf` file to know where to get |
|---|
| 146 | its data. Each type of document described in the previous section |
|---|
| 147 | can be located in several places. Target is the folder |
|---|
| 148 | where the website will be generated. |
|---|
| 149 | |
|---|
| 150 | Example:: |
|---|
| 151 | |
|---|
| 152 | [packages] |
|---|
| 153 | Package1 = /home/repository/project/src/package1 |
|---|
| 154 | Package2 = /home/repository/project/src/package2 |
|---|
| 155 | |
|---|
| 156 | [templates] |
|---|
| 157 | index=templates/index.pt |
|---|
| 158 | tutorial=templates/tutorial.pt |
|---|
| 159 | recipe=templates/recipe.pt |
|---|
| 160 | glossary=templates/glossary.pt |
|---|
| 161 | recipelist=templates/recipelist.pt |
|---|
| 162 | tutoriallist=templates/tutoriallist.pt |
|---|
| 163 | packageindex=templates/packageindex.pt |
|---|
| 164 | packagedoc=templates/packagedoc.pt |
|---|
| 165 | packagestats=templates/packagestats.pt |
|---|
| 166 | packagesindex=templates/packagesindex.pt |
|---|
| 167 | css=templates/pycommunity.css |
|---|
| 168 | |
|---|
| 169 | [options] |
|---|
| 170 | projectname=PyCommunity |
|---|
| 171 | media=templates/media |
|---|
| 172 | glossary=/home/repository/project/doc/glossary.txt |
|---|
| 173 | index=/home/repository/project/doc/README.txt |
|---|
| 174 | packages=/home/repository/project/doc/packages.txt |
|---|
| 175 | |
|---|
| 176 | [recipes] |
|---|
| 177 | recipes = /home/repository/project/doc/recipes |
|---|
| 178 | more_recipes = /home/repository/project/doc/recipes2 |
|---|
| 179 | |
|---|
| 180 | [tutorials] |
|---|
| 181 | tutos = /home/repository/project/doc/tutorials |
|---|
| 182 | |
|---|
| 183 | [target] |
|---|
| 184 | target1=/home/www |
|---|
| 185 | |
|---|
| 186 | Usage |
|---|
| 187 | ===== |
|---|
| 188 | |
|---|
| 189 | `PyCommunity` is launched directly, with an optional parameter |
|---|
| 190 | that points to the configuration file. It tries to find it in the |
|---|
| 191 | current directory if none is provided. A log file is aslo filled, |
|---|
| 192 | describing all tasks ran by the tool. |
|---|
| 193 | |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | |
|---|