| 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 | The glossary file |
|---|
| 57 | ----------------- |
|---|
| 58 | |
|---|
| 59 | The glossary file contains all project common words. The idea |
|---|
| 60 | is to collect all words and unify terms, in order to avoid |
|---|
| 61 | speaking about the same thing, using two different words. |
|---|
| 62 | |
|---|
| 63 | The glossary is a text file. Each line is composed of a word |
|---|
| 64 | a `:` character, and a short definition:: |
|---|
| 65 | |
|---|
| 66 | glossary: A file that contains definitions |
|---|
| 67 | doctest: A document with runnable examples |
|---|
| 68 | |
|---|
| 69 | The recipe folder |
|---|
| 70 | ----------------- |
|---|
| 71 | |
|---|
| 72 | The recipe folder contains reSTructuredText files. They can |
|---|
| 73 | use an extended tag to mark words that are in the glossary:: |
|---|
| 74 | |
|---|
| 75 | My super restfile |
|---|
| 76 | ----------------- |
|---|
| 77 | |
|---|
| 78 | is about {{doctest}} |
|---|
| 79 | |
|---|
| 80 | This allows PyCommunity to generate links and hints in the tutorials |
|---|
| 81 | when it founds such tags. |
|---|
| 82 | |
|---|
| 83 | The filename without it suffix, is the id of the recipe. |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | The Tutorial folder |
|---|
| 87 | ------------------- |
|---|
| 88 | |
|---|
| 89 | The tutorial folder contains reSTructuredText files. They can |
|---|
| 90 | use an extended tag to mark words that are in the glossary, like |
|---|
| 91 | recipes. |
|---|
| 92 | |
|---|
| 93 | It can also link to a recipe, by using a recipe prefix and a tag |
|---|
| 94 | like glossary:: |
|---|
| 95 | |
|---|
| 96 | look at {{recipe:recipe_1}} for details |
|---|
| 97 | |
|---|
| 98 | `PyCommunity` will replace it with the recipe title and a link to the |
|---|
| 99 | recipe. |
|---|
| 100 | |
|---|
| 101 | The filename without it suffix, is the id of the tutorial. |
|---|
| 102 | |
|---|
| 103 | The code packages |
|---|
| 104 | ----------------- |
|---|
| 105 | |
|---|
| 106 | `PyCommunity` lists all packages, and scans each one of them, to look |
|---|
| 107 | for all files with the `.txt` extension. `README.txt` is mandatory. |
|---|
| 108 | The files can also use glossary, recipe and tutorial tags:: |
|---|
| 109 | |
|---|
| 110 | look at {{tutorial:tutorial_1}} for details |
|---|
| 111 | |
|---|
| 112 | Website Layout |
|---|
| 113 | ============== |
|---|
| 114 | |
|---|
| 115 | `PyCommunity` generates a web structure that looks like this:: |
|---|
| 116 | |
|---|
| 117 | index.html == main README |
|---|
| 118 | glossary.html |
|---|
| 119 | packages |
|---|
| 120 | index.html (packages list + package.txt content) |
|---|
| 121 | package1 |
|---|
| 122 | index.html (==README.txt) |
|---|
| 123 | epydoc (epydoc) |
|---|
| 124 | module1.html |
|---|
| 125 | tutorials.html (tutorials list) |
|---|
| 126 | tutorials |
|---|
| 127 | tutorial1.html |
|---|
| 128 | cookbook.html (recipe lists) |
|---|
| 129 | cookbook |
|---|
| 130 | recipe1.html |
|---|
| 131 | |
|---|
| 132 | Configuration |
|---|
| 133 | ============= |
|---|
| 134 | |
|---|
| 135 | `PyCommunity` uses `pycommunity.conf` file to know where to get |
|---|
| 136 | its data. Each type of document described in the previous section |
|---|
| 137 | can be located in several places. Target is the folder |
|---|
| 138 | where the website will be generated. |
|---|
| 139 | |
|---|
| 140 | Example:: |
|---|
| 141 | |
|---|
| 142 | [packages] |
|---|
| 143 | Package1 = /home/repository/project/src/package1 |
|---|
| 144 | Package2 = /home/repository/project/src/package2 |
|---|
| 145 | |
|---|
| 146 | [templates] |
|---|
| 147 | index=templates/index.pt |
|---|
| 148 | tutorial=templates/tutorial.pt |
|---|
| 149 | recipe=templates/recipe.pt |
|---|
| 150 | glossary=templates/glossary.pt |
|---|
| 151 | recipelist=templates/recipelist.pt |
|---|
| 152 | tutoriallist=templates/tutoriallist.pt |
|---|
| 153 | packageindex=templates/packageindex.pt |
|---|
| 154 | packagedoc=templates/packagedoc.pt |
|---|
| 155 | packagestats=templates/packagestats.pt |
|---|
| 156 | packagesindex=templates/packagesindex.pt |
|---|
| 157 | css=templates/pycommunity.css |
|---|
| 158 | |
|---|
| 159 | [options] |
|---|
| 160 | projectname=PyCommunity |
|---|
| 161 | media=templates/media |
|---|
| 162 | glossary=/home/repository/project/doc/glossary.txt |
|---|
| 163 | index=/home/repository/project/doc/README.txt |
|---|
| 164 | packages=/home/repository/project/doc/packages.txt |
|---|
| 165 | |
|---|
| 166 | [recipes] |
|---|
| 167 | recipes = /home/repository/project/doc/recipes |
|---|
| 168 | more_recipes = /home/repository/project/doc/recipes2 |
|---|
| 169 | |
|---|
| 170 | [tutorials] |
|---|
| 171 | tutos = /home/repository/project/doc/tutorials |
|---|
| 172 | |
|---|
| 173 | [target] |
|---|
| 174 | target1=/home/www |
|---|
| 175 | |
|---|
| 176 | Usage |
|---|
| 177 | ===== |
|---|
| 178 | |
|---|
| 179 | `PyCommunity` is launched directly, with an optional parameter |
|---|
| 180 | that points to the configuration file. It tries to find it in the |
|---|
| 181 | current directory if none is provided. A log file is aslo filled, |
|---|
| 182 | describing all tasks ran by the tool. |
|---|
| 183 | |
|---|