Changes between Version 1 and Version 2 of building_the_docs
- Timestamp:
- 12/28/17 11:44:05 (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
building_the_docs
v1 v2 26 26 == Required softwares == 27 27 28 * CMake ( >= 2.8)28 * CMake (>= 2.8) 29 29 * git 30 30 * perl: 31 31 ** 1 hour tutorial: https://www.youtube.com/watch?v=WEghIXs8F6c 32 * sphinx ( >=1.1)32 * sphinx (>=1.1) 33 33 34 34 === Installing dependencies === 35 35 36 On <code>ubuntu 16.04</code>36 On {{{ubuntu 16.04}}} 37 37 38 38 <source lang="bash">sudo apt install cmake git … … 63 63 make html 64 64 </source> 65 And you're done ! You can go to <code>build/doc/_build/</code> and open <code>index.html</code>in a web browser.65 And you're done ! You can go to {{{build/doc/_build/}}} and open {{{index.html}}} in a web browser. 66 66 67 67 === Main workflow === 68 68 69 * make the build directory <code>mkdir build</code>70 * get into build/: <code>cd build/</code>69 * make the build directory {{{mkdir build}}} 70 * get into build/: {{{cd build/}}} 71 71 72 72 ==== Prepare the build with CMake ==== 73 73 74 With <code>cmake -D<build option>=ON ..</code>with the option in uppercase:75 76 <code>cmake -DSINGLEHTML=ON ..</code> 74 With {{{cmake -D<build option>=ON ..}}} with the option in uppercase: 75 76 {{{cmake -DSINGLEHTML=ON ..}}} 77 77 78 78 ==== Available options ==== … … 80 80 Available options can be see with the command: 81 81 82 <code>cmake -L ..</code> 82 {{{cmake -L ..}}} 83 83 84 84 ===== Building options ===== … … 98 98 As for now the supported languages are: 99 99 100 * "ca"101 * "de"102 * "es"103 * "fr"104 * "it"105 * "ja"106 * "ko"107 * "pl"108 * "ru"109 * "hu", "el", "id" and "zh"are not available yet (bug fixe in progress)110 111 By default, english will be always made. You can add languages easily with the flag <code>-D<Language code>=ON</code>100 * "ca" 101 * "de" 102 * "es" 103 * "fr" 104 * "it" 105 * "ja" 106 * "ko" 107 * "pl" 108 * "ru" 109 * "hu", "el", "id" and "zh" are not available yet (bug fixe in progress) 110 111 By default, english will be always made. You can add languages easily with the flag {{{-D<Language code>=ON}}} 112 112 113 113 For example, to get spanish: 114 114 115 <code>cmake -DHTML=ON -DES=ON</code> 116 117 To use a specific language, use the cmake flag <code>-D<language code in uppercase>=ON -D<another language code in uppercase>=ON</code>115 {{{cmake -DHTML=ON -DES=ON}}} 116 117 To use a specific language, use the cmake flag {{{-D<language code in uppercase>=ON -D<another language code in uppercase>=ON}}} 118 118 119 119 You can pass no language flag (building only english) or as many flag as there is supported languages (and built all of them). 120 120 121 To build all languages you can use the flag <code>-DALL_LANG=ON</code>122 123 The option ( <code>-DES=ON ...</code> or <code>-DALL_LANG=ON</code>) are kept in the <code>OSGeoLiveDoc_BUILD_LANGUAGES</code>variable, which is automatically filled by CMake.121 To build all languages you can use the flag {{{-DALL_LANG=ON}}} 122 123 The option ({{{-DES=ON ...}}} or {{{-DALL_LANG=ON}}}) are kept in the {{{OSGeoLiveDoc_BUILD_LANGUAGES}}} variable, which is automatically filled by CMake. 124 124 125 125 ==== make the build ==== 126 126 127 <code>make <option></code>with option in lowercase:128 129 <code>make singlehtml</code> 127 {{{make <option>}}} with option in lowercase: 128 129 {{{make singlehtml}}} 130 130 131 131 ==== about Sphinx ==== … … 133 133 Sphinx generates the po files used by transifex. 134 134 135 Sphinx needs locales, english is set by default. Other locales are generated from the languages in <code>OSGeoLiveDoc_SUPPORTED_LANGUAGES</code> variable in <code>CMakeLists.txt</code>. For more details, see above.135 Sphinx needs locales, english is set by default. Other locales are generated from the languages in {{{OSGeoLiveDoc_SUPPORTED_LANGUAGES}}} variable in {{{CMakeLists.txt}}}. For more details, see above. 136 136 137 137 == Projects management == 138 138 139 Projects are loaded from the <code>projects_info.csv</code>file. It is the main entry point.139 Projects are loaded from the {{{projects_info.csv}}} file. It is the main entry point. 140 140 141 141 <blockquote>Note: Actually, it is manually build from this file: https://docs.google.com/spreadsheets/d/1Dem6RYkokaX61N8VcomebtqZvcUP-OOt14jt6GPL2TY/edit#gid=2122109332 … … 145 145 Please indicate if there is a quickstart or not, an overview or not, an openHub account or not, the version, if it is an OSGeo project, or community or none of those. 146 146 147 Overviews will be generated with the data from <code>projects_info.csv</code>, and links to quickstarts will be added automaticly.147 Overviews will be generated with the data from {{{projects_info.csv}}}, and links to quickstarts will be added automaticly. 148 148 149 149 More information how CMake use this file are available above. … … 153 153 There is 2 versions: regular and verbose. 154 154 155 The first one can be called with this flag: <code>-DOSGeoLiveDoc_DEBUG=ON</code>156 157 For example: <code>cmake -DHTML=ON -DES=ON -DOSGeoLiveDoc_DEBUG=ON ..</code>158 159 The verbose debug is called with this flag: <code>-DOSGeoLiveDoc_VERBOSE_DEBUG=ON</code>160 161 For example: <code>cmake -DHTML=ON -DES=ON -DOSGeoLiveDoc_VERBOSE_DEBUG=ON ..</code>155 The first one can be called with this flag: {{{-DOSGeoLiveDoc_DEBUG=ON}}} 156 157 For example: {{{cmake -DHTML=ON -DES=ON -DOSGeoLiveDoc_DEBUG=ON ..}}} 158 159 The verbose debug is called with this flag: {{{-DOSGeoLiveDoc_VERBOSE_DEBUG=ON}}} 160 161 For example: {{{cmake -DHTML=ON -DES=ON -DOSGeoLiveDoc_VERBOSE_DEBUG=ON ..}}} 162 162 163 163 == Configuring CMake / Setting the build == 164 164 165 CMake is use to build the repository instead of simply make because it can be finely tuned. CMake configuration is done by the <code>CMakeLists.txt</code>. CMake says how the build is made from that file.165 CMake is use to build the repository instead of simply make because it can be finely tuned. CMake configuration is done by the {{{CMakeLists.txt}}}. CMake says how the build is made from that file. 166 166 167 167 This file allows to set a few things: … … 169 169 ==== Checking CMake version ==== 170 170 171 <code>cmake_minimum_required(VERSION 2.8 FATAL_ERROR)</code> 171 {{{cmake_minimum_required(VERSION 2.8 FATAL_ERROR)}}} 172 172 173 173 ==== Checking build folder ==== 174 174 175 The first thing that CMake does is to check if you are in the folder called <code>build</code>. If it is not the case, CMake will return an error.175 The first thing that CMake does is to check if you are in the folder called {{{build}}}. If it is not the case, CMake will return an error. 176 176 177 177 <pre class="{bash}">if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} ) 178 message(FATAL_ERROR "In-source builds not allowed.178 message(FATAL_ERROR "In-source builds not allowed. 179 179 Please make a new directory (called a build directory) and run CMake from there. 180 You may need to remove CMakeCache.txt. ")180 You may need to remove CMakeCache.txt." ) 181 181 endif()</pre> 182 182 ==== Changing the version number ==== 183 183 184 In <code>CMakeLists.txt</code>, you can change the OSGeo-Live version number with the following variables:184 In {{{CMakeLists.txt}}}, you can change the OSGeo-Live version number with the following variables: 185 185 186 186 <pre class="{bash}">## Major version 187 set(OSGeoLiveDoc_VERSION_MAJOR "12")187 set(OSGeoLiveDoc_VERSION_MAJOR "12") 188 188 189 189 ## minor version 190 set(OSGeoLiveDoc_VERSION_MINOR "0")190 set(OSGeoLiveDoc_VERSION_MINOR "0") 191 191 192 192 ## Patch number 193 set(OSGeoLiveDoc_VERSION_PATCH "0")193 set(OSGeoLiveDoc_VERSION_PATCH "0") 194 194 195 195 ## if it is a development version, a Release Candidate or a final release 196 set(OSGeoLiveDoc_VERSION_DEV "-dev")</pre>196 set(OSGeoLiveDoc_VERSION_DEV "-dev")</pre> 197 197 ==== Checking the sphinx version ==== 198 198 199 199 To build, you sphinx 1.1 and above: 200 200 201 <code>set(SPHINX_MINIMUM_VERSION "1.1")</code> 201 {{{set(SPHINX_MINIMUM_VERSION "1.1")}}} 202 202 203 203 If not a warning will be displayed. If you need a more recent version to build the doc, you can test it from here. … … 212 212 213 213 <source lang="bash">set(OSGeoLiveDoc_SUPPORTED_LANGUAGES "ca" "de" "es" "fr" "it" "ja" "ko" "pl" "ru")</source> 214 Then add a new <code>INSERT_INTO_MAP</code> command to add the language to the lang navigation bar (in <code>index.html</code>). For example:215 216 <code>INSERT_INTO_MAP("fr" "Français")</code> in the <code>CMakeLists.txt</code>.217 218 The line <code>set(OSGeoLiveDoc_ENGLISH "en")</code>is not supposed to change, it sets the default build in english.214 Then add a new {{{INSERT_INTO_MAP}}} command to add the language to the lang navigation bar (in {{{index.html}}}). For example: 215 216 {{{INSERT_INTO_MAP("fr" "Français")}}} in the {{{CMakeLists.txt}}}. 217 218 The line {{{set(OSGeoLiveDoc_ENGLISH "en")}}} is not supposed to change, it sets the default build in english. 219 219 220 220 === Projects management === 221 221 222 Projects are loaded from the <code>projects_info.csv</code>file. It is the main entry point.222 Projects are loaded from the {{{projects_info.csv}}} file. It is the main entry point. 223 223 224 224 <blockquote>Note: Actually, it is manually build from this file: https://docs.google.com/spreadsheets/d/1Dem6RYkokaX61N8VcomebtqZvcUP-OOt14jt6GPL2TY/edit#gid=2122109332 … … 228 228 Please indicate there is a quickstart or not, an overview or not, an openHub account or not, the version, if it is an OSGeo project, or community or none of those. 229 229 230 Overviews will be generated with the data from <code>projects_info.csv</code>, and links to quickstarts will be added automaticly.230 Overviews will be generated with the data from {{{projects_info.csv}}}, and links to quickstarts will be added automaticly. 231 231 232 232 == reading the file == 233 233 234 <code>file(STRINGS projects_info.csv OSGeoLiveDoc_PROJECTS_VERSIONS_FILE)</code>opens the csv file235 236 <code>set (OSGeoLiveDoc_PROJECTS_VERSIONS "")</code>is prepared to stock data from the file234 {{{file(STRINGS projects_info.csv OSGeoLiveDoc_PROJECTS_VERSIONS_FILE)}}} opens the csv file 235 236 {{{set (OSGeoLiveDoc_PROJECTS_VERSIONS "")}}} is prepared to stock data from the file 237 237 238 238 Data are extracted with a regular expression, which detect the column, but has to know the number of columns. Currently the file has 9 columns. … … 242 242 == Slicing the lines with a regex == 243 243 244 <code>set (OSGeoLiveDoc_CONFIGURATION_REGEXP "^(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)")</code> 245 246 So <code>(.*)\\|</code> has to be repeated 9 times. If a column is added in projects_info.csv, it is mandatory to add one more <code>(.*)\\|</code>in the regex to find the new column.247 248 Each column will extracted by group, for example, column 3 will be extracted as group "\3"; because it's a csv, it's kind of a 1 to 1 relationship between the group and the column.244 {{{set (OSGeoLiveDoc_CONFIGURATION_REGEXP "^(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|(.*)")}}} 245 246 So {{{(.*)\\|}}} has to be repeated 9 times. If a column is added in projects_info.csv, it is mandatory to add one more {{{(.*)\\|}}} in the regex to find the new column. 247 248 Each column will extracted by group, for example, column 3 will be extracted as group "\3"; because it's a csv, it's kind of a 1 to 1 relationship between the group and the column. 249 249 250 250 Quick explanation of the regex: 251 251 252 ^ <--- beginning of line (.'') <---- any character = "." any number of times = "''" grouped "(" ")" \| <--- code for vertical line "|"253 254 The for each line in the file, the ones starting with '''#''' are treated as comments. Comments will be ignored and the whole line replaced by a <code>#</code>.252 ^ <--- beginning of line (.'') <---- any character = "." any number of times = "''" grouped "(" ")" \| <--- code for vertical line "|" 253 254 The for each line in the file, the ones starting with '''#''' are treated as comments. Comments will be ignored and the whole line replaced by a {{{#}}}. 255 255 256 256 This part only use the 5 first column. … … 258 258 == Group use == 259 259 260 For example, group "\3", will get the project version, and will be cleaned with <code>STRIP</code>:261 262 <code>string(STRIP ${project_version} project_version)</code> will strip the blanks spaces at the beginning and the end of the string. So " 4.2.1 " will return "4.2.1" and "4.2.2 beta " -> "4.2.2 beta".260 For example, group "\3", will get the project version, and will be cleaned with {{{STRIP}}}: 261 262 {{{string(STRIP ${project_version} project_version)}}} will strip the blanks spaces at the beginning and the end of the string. So " 4.2.1 " will return "4.2.1" and "4.2.2 beta " -> "4.2.2 beta". 263 263 264 264 === Debugging === 265 265 266 This treatment can be seen with the <code>-DOSGeoLiveDoc_VERBOSE_DEBUG=ON</code>flag. It will show something like that:266 This treatment can be seen with the {{{-DOSGeoLiveDoc_VERBOSE_DEBUG=ON}}} flag. It will show something like that: 267 267 268 268 -- Y 52nSOS 4.4.0 want_quickstart:Y want_overview:Y -- Y 52nWPS 3.6.1 want_quickstart:Y want_overview:Y -- N 52nWSS retired want_quickstart:N want_overview:N -- 52nWSS is not for documentation -- N atlasstyler retired want_quickstart:N want_overview:N -- atlasstyler is not for documentation -- N cartaro retired want_quickstart:N want_overview:N -- cartaro is not for documentation … … 270 270 Active projects will get want_quickstart and want_overview set to Y; the retired projects will be set to N and won't be used for documentation. 271 271 272 This process is always done, but won't be print unless the <code>-DOSGeoLiveDoc_VERBOSE_DEBUG=ON</code>flag is used.272 This process is always done, but won't be print unless the {{{-DOSGeoLiveDoc_VERBOSE_DEBUG=ON}}} flag is used. 273 273 274 274 === Project version in conf.py === … … 276 276 For each line (so active and retired projects), a new python command will be generated for inserting in conf.py. 277 277 278 <code>.. |version-${project_name}| replace:: ${project_version}\n"</code> 279 280 For example, for the ''4.4.0'' release of the ''52nSOS'' project, the string will be <code>.. |version-52nSOS| replace:: 4.4.0</code>.278 {{{.. |version-${project_name}| replace:: ${project_version}\n"}}} 279 280 For example, for the ''4.4.0'' release of the ''52nSOS'' project, the string will be {{{.. |version-52nSOS| replace:: 4.4.0}}}. 281 281 282 282 === Selecting project who needs on overview and a quickstart building === … … 284 284 This code add the project name to lists for quickstart and overviews, if a Y is the columns/ groups 4 and 5. Some projects might have an overview but no quickstart, it is mostly libraries. 285 285 286 if ( "<math>{want_quickstart}" MATCHES "Y") list(APPEND OSGeoLiveDoc_QUICKSTART "</math>{project_name}") endif() if ("<math>{want_overview}" MATCHES "Y") list(APPEND OSGeoLiveDoc_OVERVIEW "</math>{project_name}") endif()286 if ("<math>{want_quickstart}" MATCHES "Y") list(APPEND OSGeoLiveDoc_QUICKSTART "</math>{project_name}") endif() if ("<math>{want_overview}" MATCHES "Y") list(APPEND OSGeoLiveDoc_OVERVIEW "</math>{project_name}") endif() 287 287 288 288 = Standards = … … 290 290 Standards are builded with this set of commandes: 291 291 292 set(OSGeoLiveDoc_STANDARDS "csw" "gml" "sld" "wcs" "wms" "fe" "kml" "sensorml" "sos" "wfs" "wps" ) # Other settings There is several files that is need for the build, they are copied with the command <code>configure_file()</code>292 set(OSGeoLiveDoc_STANDARDS "csw" "gml" "sld" "wcs" "wms" "fe" "kml" "sensorml" "sos" "wfs" "wps" ) # Other settings There is several files that is need for the build, they are copied with the command {{{configure_file()}}} 293 293 294 294 * settings.py … … 297 297 * translators.csv 298 298 299 For example, <code>configure_file("settings.py" "settings.py")</code>will copy ''settings.py'' and '''substitute''' the variables defined in the cmake. Which is very handy.299 For example, {{{configure_file("settings.py" "settings.py")}}} will copy ''settings.py'' and '''substitute''' the variables defined in the cmake. Which is very handy. 300 300 301 301 The csv files are copied but are not modified. They'll be loaded later in the html file with an another process. … … 303 303 = Setting building variables = 304 304 305 The line <code>add_subdirectory(doc)</code>will add the '''doc''' folder to the build and all the files in it will be set with the variables from cmake, by copying the CMakeLists.txt file in each folder and subfolder. Each copy305 The line {{{add_subdirectory(doc)}}} will add the '''doc''' folder to the build and all the files in it will be set with the variables from cmake, by copying the CMakeLists.txt file in each folder and subfolder. Each copy 306 306 307 307 = Comments in CMake = … … 313 313 = Included files and folder = 314 314 315 CMake will use the files and folders in the main folder (aka <code>OSGeoLive-doc</code>) but only the ones present in the variables <code>OSGeoLiveDoc_FILES</code> and <code>OSGeoLiveDoc_FOLDERS</code>.315 CMake will use the files and folders in the main folder (aka {{{OSGeoLive-doc}}}) but only the ones present in the variables {{{OSGeoLiveDoc_FILES}}} and {{{OSGeoLiveDoc_FOLDERS}}}. 316 316 317 317 In CMakeLists.txt they are set like that: … … 321 321 #--------------------- 322 322 set(OSGeoLiveDoc_FILES 323 # "disclaimer.rst"324 "translators.rst" 325 "osgeo_contact.rst" 326 "contributors.rst" 327 "index.rst" 328 "contact.rst" 329 # "metrics.rst"330 "sponsors.rst" 331 "welcome_message.txt" 332 "copyright.rst" 333 "download.rst" 334 "mac_installers.rst" 335 "presentation.rst" 336 "sponsors_osgeo.rst" 337 "prior_applications.rst" 338 "win_installers.rst" 323 #"disclaimer.rst" 324 "translators.rst" 325 "osgeo_contact.rst" 326 "contributors.rst" 327 "index.rst" 328 "contact.rst" 329 #"metrics.rst" 330 "sponsors.rst" 331 "welcome_message.txt" 332 "copyright.rst" 333 "download.rst" 334 "mac_installers.rst" 335 "presentation.rst" 336 "sponsors_osgeo.rst" 337 "prior_applications.rst" 338 "win_installers.rst" 339 339 ) 340 340 … … 344 344 #--------------------- 345 345 set(OSGeoLiveDoc_SUBDIRS 346 "WindowsInstallers" 347 "MacInstallers" 348 "presentation" 349 "quickstart" 350 "overview" 351 "standards" 346 "WindowsInstallers" 347 "MacInstallers" 348 "presentation" 349 "quickstart" 350 "overview" 351 "standards" 352 352 )</pre> 353 So commented out or deleted lines won't be taken in account, and won't be translated. If you comment "overview", the overviews won't be built.353 So commented out or deleted lines won't be taken in account, and won't be translated. If you comment "overview", the overviews won't be built. 354 354 355 355 = Directory processing = 356 356 357 This process is managed by the command <code>add_subdirectory()</code>which tell '''CMake''' to look for a ''CMakeLists.txt'' in the subdirectory and execute it.358 359 For example, the last line of the main ''CMakeLists.txt'' is <code>add_subdirectory(doc)</code> so '''CMake''' will look into doc/ and execute the ''CMakeLists.txt'' in it. Several variables will be initialized like <code>${OSGeoLiveDoc_SUBDIRS}</code>which contains the folders to look into.357 This process is managed by the command {{{add_subdirectory()}}} which tell '''CMake''' to look for a ''CMakeLists.txt'' in the subdirectory and execute it. 358 359 For example, the last line of the main ''CMakeLists.txt'' is {{{add_subdirectory(doc)}}} so '''CMake''' will look into doc/ and execute the ''CMakeLists.txt'' in it. Several variables will be initialized like {{{${OSGeoLiveDoc_SUBDIRS}}}} which contains the folders to look into. 360 360 361 361 Then the following loop will be looking in each named subfolder to execute its ''CMakeLists.txt'' 362 362 363 <code>{bash} foreach (dir ${OSGeoLiveDoc_SUBDIRS}) message(STATUS " Adding directory ${dir}") add_subdirectory(${dir}) endforeach()</code> 364 365 For example, the proccessed files for the Overview folder are extract from <code>${OSGeoLiveDoc_OVERVIEW})</code> built in the previous process (from <code>projects_info.csv</code>). Files not listed in <code>${OSGeoLiveDoc_OVERVIEW})</code>won't be processed.363 {{{{bash} foreach (dir ${OSGeoLiveDoc_SUBDIRS}) message(STATUS " Adding directory ${dir}") add_subdirectory(${dir}) endforeach()}}} 364 365 For example, the proccessed files for the Overview folder are extract from {{{${OSGeoLiveDoc_OVERVIEW})}}} built in the previous process (from {{{projects_info.csv}}}). Files not listed in {{{${OSGeoLiveDoc_OVERVIEW})}}} won't be processed. 366 366 367 367 == Local list == … … 375 375 == Quickstart and Overview folder == 376 376 377 The CMakeLists.txt here to copy all projects listed in <code>projetc_info.csv</code> and transmitted with the variables <code>${OSGeoLiveDoc_QUICKSTART}</code> and <code>${OSGeoLiveDoc_OVERVIEW}</code>.377 The CMakeLists.txt here to copy all projects listed in {{{projetc_info.csv}}} and transmitted with the variables {{{${OSGeoLiveDoc_QUICKSTART}}}} and {{{${OSGeoLiveDoc_OVERVIEW}}}}. 378 378 379 379 Local CMakeLists.txt will be initialized with those variables. … … 381 381 === Overview folder === 382 382 383 in Overview, there is no local files. The Overview webpage (listing all projects) is generated with perl from data extracted of <code>projects_info.csv</code>.383 in Overview, there is no local files. The Overview webpage (listing all projects) is generated with perl from data extracted of {{{projects_info.csv}}}. 384 384 385 385 == Standards == … … 389 389 == Main files == 390 390 391 Main files, present at the root of the project and website, are processed if listed in the variable <code>OSGeoLiveDoc_FILES</code>at the beginning of the ''CMakeLists.txt''. They can be added and commented out easily.391 Main files, present at the root of the project and website, are processed if listed in the variable {{{OSGeoLiveDoc_FILES}}} at the beginning of the ''CMakeLists.txt''. They can be added and commented out easily. 392 392 393 393 = Images = 394 394 395 The images folder is entirely copied to <code>build/doc/images</code>. All images are copied, even the one that are not used by the documentation any more. That need to be cleaned.395 The images folder is entirely copied to {{{build/doc/images}}}. All images are copied, even the one that are not used by the documentation any more. That need to be cleaned. 396 396 397 397 = Scripts = 398 398 399 Some files are build with perl scripts like <code>overview.html</code> or <code>metrics</code>. Those scripts will be detailed below.399 Some files are build with perl scripts like {{{overview.html}}} or {{{metrics}}}. Those scripts will be detailed below. 400 400 401 401 == overview.html == 402 402 403 [https://live.osgeo.org/en/overview/overview.html overview.html] is the overview of all projects, and is generated from data in <code>projects_info.csv</code>. So retired project wouldn't appear in it.403 [https://live.osgeo.org/en/overview/overview.html overview.html] is the overview of all projects, and is generated from data in {{{projects_info.csv}}}. So retired project wouldn't appear in it. 404 404 405 405 The script is there: https://github.com/cvvergara/OSGeoLive-doc/blob/cm_fix_header/doc/scripts/build_overview.pl … … 407 407 First three lines are testing the shell and args. 408 408 409 There is includes ( <code>pragmas</code>) from perl library used by the script in line 6 to 8.409 There is includes ({{{pragmas}}}) from perl library used by the script in line 6 to 8. 410 410 411 411 Then three specials variables are declared: - ''name (filename) - ''dir (get the directory of the perl script) - *prune (get the path to the perl script) 412 412 413 They are shortcuts for functions ( <code>*File::Find::name</code>is a function returning the filename).414 415 Those varaibles are loaded with informations from the CMake: * <code>$DEBUG = "@OSGeoLiveDoc_DEBUG@";</code> * <code>$version = "@OSGeoLiveDoc_VERSION@";</code> * <code>$projects_info_file = '@CMAKE_SOURCE_DIR@/projects_info.csv';</code> * <code>$output_file = '@CMAKE_BINARY_DIR@/doc/overview/overview.rst';</code>416 417 ==== See if the <code>projects_info.csv</code>file exist, if don't the script stop and throws an error: ====418 419 <code>die "ERROR: Failed to find: '$projects_info_file'\n" unless -f $projects_info_file;</code> 413 They are shortcuts for functions ({{{*File::Find::name}}} is a function returning the filename). 414 415 Those varaibles are loaded with informations from the CMake: * {{{$DEBUG = "@OSGeoLiveDoc_DEBUG@";}}} * {{{$version = "@OSGeoLiveDoc_VERSION@";}}} * {{{$projects_info_file = '@CMAKE_SOURCE_DIR@/projects_info.csv';}}} * {{{$output_file = '@CMAKE_BINARY_DIR@/doc/overview/overview.rst';}}} 416 417 ==== See if the {{{projects_info.csv}}} file exist, if don't the script stop and throws an error: ==== 418 419 {{{die "ERROR: Failed to find: '$projects_info_file'\n" unless -f $projects_info_file;}}} 420 420 421 421 === Get the configuration from projects_info.csv === 422 422 423 This line parse the projects_info file and stores it in <code>$configuration</code>. If the flag <code>-DOSGeoLiveDoc_DEBUG=ON</code>is used, then a comment line will be print.423 This line parse the projects_info file and stores it in {{{$configuration}}}. If the flag {{{-DOSGeoLiveDoc_DEBUG=ON}}} is used, then a comment line will be print. 424 424 425 425 <source lang="perl">my $configuration = read_and_parse_configuration($projects_info_file);</source> 426 426 ==== read_and_parse_configuration subroutine ==== 427 427 428 This subroutine takes a file in parameter. It is stored in $file with the keyword <code>shift</code>.428 This subroutine takes a file in parameter. It is stored in $file with the keyword {{{shift}}}. 429 429 430 430 Then an empty Hash called %hash is initialized. It will store hashes extracted during the process. … … 432 432 The script will try to open the file in parameter or die and throws an error. 433 433 434 Then a while loop reads the file line by line and exit when the file is empty (operation becomes <code>TRUE</code>). During the while loop several actions are made: - ignores the commented lines; - clean the line by removing spaces surplus; - ignores project who are not subject to documentation (no overview and / or no quickstart) - get lines in the right bucket (section) <code>$hash{$values[5]}</code>434 Then a while loop reads the file line by line and exit when the file is empty (operation becomes {{{TRUE}}}). During the while loop several actions are made: - ignores the commented lines; - clean the line by removing spaces surplus; - ignores project who are not subject to documentation (no overview and / or no quickstart) - get lines in the right bucket (section) {{{$hash{$values[5]}}}} 435 435 436 436 For example, with the following line: 437 437 438 <code>Y | 52nSOS | 4.4.0 | Y | Y | Web Services | | Sensor Observation Service | SensorObservationService</code> 438 {{{Y | 52nSOS | 4.4.0 | Y | Y | Web Services | | Sensor Observation Service | SensorObservationService}}} 439 439 440 440 The instructions will put the line in the bucket that has the name ''Web Services''. … … 442 442 At the end of the loop, the file is closed and the hash with the collected data is returned. 443 443 444 In the script, the hash will be store in <code>$configuration</code>.444 In the script, the hash will be store in {{{$configuration}}}. 445 445 446 446 === Building sections === 447 447 448 Sections are stored in <code>$sections</code>.449 450 For each defined sections, there will be a call for the section in <code>$configuration</code>. It use the subroutine <code>get_section</code>.451 452 The result will be append to <code>$sections</code>.448 Sections are stored in {{{$sections}}}. 449 450 For each defined sections, there will be a call for the section in {{{$configuration}}}. It use the subroutine {{{get_section}}}. 451 452 The result will be append to {{{$sections}}}. 453 453 454 454 ==== get_sections() ==== … … 456 456 This subroutine take two parameters: * the name of the section * the variable where the configuration is stored 457 457 458 <blockquote>Note: There is a lot of concatenation in this subroutine. It is short written with <code>.=</code>458 <blockquote>Note: There is a lot of concatenation in this subroutine. It is short written with {{{.=}}} 459 459 </blockquote> 460 get_sections() workflow: - prepare the section headers and toc tree - split values around the <code>|</code>and store it in an array (@values) - cleans the excess <code>|</code> and spaces in in each value - Test it ''overview'' is set to <code>Y</code> then handle the overview by adding it to the toctree and adding the bullet line - Test it ''quickstart'' is set to <code>Y</code>then handle the quickstart by adding it to the toctree and adding the bullet line between brackets - Write the comment / short description if provided.460 get_sections() workflow: - prepare the section headers and toc tree - split values around the {{{|}}}and store it in an array (@values) - cleans the excess {{{|}}} and spaces in in each value - Test it ''overview'' is set to {{{Y}}} then handle the overview by adding it to the toctree and adding the bullet line - Test it ''quickstart'' is set to {{{Y}}} then handle the quickstart by adding it to the toctree and adding the bullet line between brackets - Write the comment / short description if provided. 461 461 462 462 When all projects have been read, the toctree is added to the contents, then the bullets. The contents is returned. … … 464 464 === Writing the file === 465 465 466 When all the sections are build and added to <code>$sections</code>, the subroutine <code>write_script()</code>is called.467 468 It takes one parameter, <code>$sections</code>with all the sections, in the right order.466 When all the sections are build and added to {{{$sections}}}, the subroutine {{{write_script()}}} is called. 467 468 It takes one parameter, {{{$sections}}} with all the sections, in the right order. 469 469 470 470 # it tries to create the output file (or die if cannot) 471 471 # write out the header and the commands to clean up the old extension 472 # paste the content of <code>$sections</code> after the toc (<code>.. contents:\n :local:</code>) and before prior applications472 # paste the content of {{{$sections}}} after the toc ({{{.. contents:\n :local:}}}) and before prior applications 473 473 # close the file 474 474 475 475 == Script exit == 476 476 477 When the script is done, it exit returning <code>0</code>. It is a mandatory for perl.477 When the script is done, it exit returning {{{0}}}. It is a mandatory for perl. 478 478 479 479 = Metrics.pl = … … 481 481 === Variables === 482 482 483 The variables are loaded by CMake during the build from data in <code>CMakeLists.txt</code>.483 The variables are loaded by CMake during the build from data in {{{CMakeLists.txt}}}. 484 484 485 485 <source lang="perl">my $DEBUG = "@OSGeoLiveDoc_DEBUG@"; … … 501 501 To do that, we will use a one liner perl command to change from projects/gvsigFOOOOOOOOOOOO to projects/gvsig 502 502 503 the <code>/</code> is special in perl so, <code>\</code>is prepended in the command from projects/gvsigFOOOOOOOOOOOO to projects/gvsig503 the {{{/}}} is special in perl so, {{{\}}} is prepended in the command from projects/gvsigFOOOOOOOOOOOO to projects/gvsig 504 504 505 505 ==== THE command: ==== 506 506 507 507 <source lang="bash">perl -pi -e "s/projects\/gvsigFOOOOOOOOOOOO/projects\/gvsig/" $(git ls-files)</source> 508 * <code>git ls-files</code>: lists the files that git knows about509 * <code>perl</code> <--- use that510 * <code>-pi</code> <--- one liner511 * <code>-e</code> <-- do changes on the file and save them on the file512 * "s/projects/gvsigFOOOOOOOOOOOO/projects/gvsig/" <<<s/<from>/<to>/ substitute from to513 * <code>$(git ls-files)</code> <---- $(<command>)514 * <code>git ls-files</code> <--- generates filenames know to git508 * {{{git ls-files}}} : lists the files that git knows about 509 * {{{perl}}} <--- use that 510 * {{{-pi}}} <--- one liner 511 * {{{-e}}} <-- do changes on the file and save them on the file 512 * "s/projects/gvsigFOOOOOOOOOOOO/projects/gvsig/" <<< s/<from>/<to>/ substitute from to 513 * {{{$(git ls-files)}}} <---- $(<command>) 514 * {{{git ls-files}}} <--- generates filenames know to git 515 515 516 516 = Check and remove unused images = … … 526 526 = Theming = 527 527 528 Themes are stock in the <code>_theme</code>subdirectory, they are loaded by the line [https://github.com/cvvergara/OSGeoLive-doc/blob/cm_fix_header/doc/CMakeLists.txt#L79 L. 79 of CMakeLists.txt]528 Themes are stock in the {{{_theme}}} subdirectory, they are loaded by the line [https://github.com/cvvergara/OSGeoLive-doc/blob/cm_fix_header/doc/CMakeLists.txt#L79 L. 79 of CMakeLists.txt] 529 529 530 530 There is a small [https://github.com/cvvergara/OSGeoLive-doc/blob/cm_fix_header/doc/_themes/overview/CMakeLists.txt local CMakeLists.txt] for each theme. It is used to configure the language bar with the asked languages.