diff options
author | Ferry Huberts <ferry.huberts@pelagic.nl> | 2011-03-23 19:57:44 (JST) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2011-03-26 19:03:42 (JST) |
commit | b2cf630a4b423bbda6507b7f658042563e76b36e (patch) | |
tree | 53d073b899308bda7416bafbf77e64616bf9f459 /cgitrc.5.txt | |
parent | 14f28923a2ed31fba9bf7042e8e2dff21717c333 (diff) | |
download | cgit-b2cf630a4b423bbda6507b7f658042563e76b36e.zip cgit-b2cf630a4b423bbda6507b7f658042563e76b36e.tar.gz |
filters: document environment variables in filter scripts
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgitrc.5.txt')
-rw-r--r-- | cgitrc.5.txt | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/cgitrc.5.txt b/cgitrc.5.txt index c3698a6..60539d7 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt | |||
@@ -31,7 +31,7 @@ about-filter:: | |||
31 | about pages (both top-level and for each repository). The command will | 31 | about pages (both top-level and for each repository). The command will |
32 | get the content of the about-file on its STDIN, and the STDOUT from the | 32 | get the content of the about-file on its STDIN, and the STDOUT from the |
33 | command will be included verbatim on the about page. Default value: | 33 | command will be included verbatim on the about page. Default value: |
34 | none. | 34 | none. See also: "FILTER API". |
35 | 35 | ||
36 | agefile:: | 36 | agefile:: |
37 | Specifies a path, relative to each repository path, which can be used | 37 | Specifies a path, relative to each repository path, which can be used |
@@ -81,6 +81,7 @@ commit-filter:: | |||
81 | The command will get the message on its STDIN, and the STDOUT from the | 81 | The command will get the message on its STDIN, and the STDOUT from the |
82 | command will be included verbatim as the commit message, i.e. this can | 82 | command will be included verbatim as the commit message, i.e. this can |
83 | be used to implement bugtracker integration. Default value: none. | 83 | be used to implement bugtracker integration. Default value: none. |
84 | See also: "FILTER API". | ||
84 | 85 | ||
85 | css:: | 86 | css:: |
86 | Url which specifies the css document to include in all cgit pages. | 87 | Url which specifies the css document to include in all cgit pages. |
@@ -316,7 +317,7 @@ source-filter:: | |||
316 | and the name of the blob as its only command line argument. The STDOUT | 317 | and the name of the blob as its only command line argument. The STDOUT |
317 | from the command will be included verbatim as the blob contents, i.e. | 318 | from the command will be included verbatim as the blob contents, i.e. |
318 | this can be used to implement e.g. syntax highlighting. Default value: | 319 | this can be used to implement e.g. syntax highlighting. Default value: |
319 | none. | 320 | none. See also: "FILTER API". |
320 | 321 | ||
321 | summary-branches:: | 322 | summary-branches:: |
322 | Specifies the number of branches to display in the repository "summary" | 323 | Specifies the number of branches to display in the repository "summary" |
@@ -349,7 +350,7 @@ REPOSITORY SETTINGS | |||
349 | ------------------- | 350 | ------------------- |
350 | repo.about-filter:: | 351 | repo.about-filter:: |
351 | Override the default about-filter. Default value: none. See also: | 352 | Override the default about-filter. Default value: none. See also: |
352 | "enable-filter-overrides". | 353 | "enable-filter-overrides". See also: "FILTER API". |
353 | 354 | ||
354 | repo.clone-url:: | 355 | repo.clone-url:: |
355 | A list of space-separated urls which can be used to clone this repo. | 356 | A list of space-separated urls which can be used to clone this repo. |
@@ -357,7 +358,7 @@ repo.clone-url:: | |||
357 | 358 | ||
358 | repo.commit-filter:: | 359 | repo.commit-filter:: |
359 | Override the default commit-filter. Default value: none. See also: | 360 | Override the default commit-filter. Default value: none. See also: |
360 | "enable-filter-overrides". | 361 | "enable-filter-overrides". See also: "FILTER API". |
361 | 362 | ||
362 | repo.defbranch:: | 363 | repo.defbranch:: |
363 | The name of the default branch for this repository. If no such branch | 364 | The name of the default branch for this repository. If no such branch |
@@ -428,7 +429,7 @@ repo.section:: | |||
428 | 429 | ||
429 | repo.source-filter:: | 430 | repo.source-filter:: |
430 | Override the default source-filter. Default value: none. See also: | 431 | Override the default source-filter. Default value: none. See also: |
431 | "enable-filter-overrides". | 432 | "enable-filter-overrides". See also: "FILTER API". |
432 | 433 | ||
433 | repo.url:: | 434 | repo.url:: |
434 | The relative url used to access the repository. This must be the first | 435 | The relative url used to access the repository. This must be the first |
@@ -448,6 +449,42 @@ Note: the "repo." prefix is dropped from the option names in repo-specific | |||
448 | config files, e.g. "repo.desc" becomes "desc". | 449 | config files, e.g. "repo.desc" becomes "desc". |
449 | 450 | ||
450 | 451 | ||
452 | FILTER API | ||
453 | ---------- | ||
454 | - about filter:: | ||
455 | This filter is given no arguments. | ||
456 | The about text that is to be filtered is available on standard input and the | ||
457 | filtered text is expected on standard output. | ||
458 | - commit filter:: | ||
459 | This filter is given no arguments. | ||
460 | The commit message text that is to be filtered is available on standard input | ||
461 | and the filtered text is expected on standard output. | ||
462 | - source filter:: | ||
463 | This filter is given a single parameter: the filename of the source file to | ||
464 | filter. The filter can use the filename to determine (for example) the syntax | ||
465 | highlighting mode. | ||
466 | The contents of the source file that is to be filtered is available on | ||
467 | standard input and the filtered contents is expected on standard output. | ||
468 | |||
469 | Also, all filters are handed the following environment variables: | ||
470 | - CGIT_REPO_URL ( = repo.url setting ) | ||
471 | - CGIT_REPO_NAME ( = repo.name setting ) | ||
472 | - CGIT_REPO_PATH ( = repo.path setting ) | ||
473 | - CGIT_REPO_OWNER ( = repo.owner setting ) | ||
474 | - CGIT_REPO_DEFBRANCH ( = repo.defbranch setting ) | ||
475 | - CGIT_REPO_SECTION ( = section setting ) | ||
476 | - CGIT_REPO_CLONE_URL ( = repo.clone-url setting ) | ||
477 | |||
478 | If a setting is not defined for a repository and the corresponding global | ||
479 | setting is also not defined (if applicable), then the corresponding | ||
480 | environment variable will be an empty string. | ||
481 | |||
482 | Note that under normal circumstance all these environment variables are | ||
483 | defined. If however the total size of the defined settings exceed the | ||
484 | allocated buffer within cgit then only the environment variables that fit | ||
485 | in the allocated buffer are handed to the filter. | ||
486 | |||
487 | |||
451 | EXAMPLE CGITRC FILE | 488 | EXAMPLE CGITRC FILE |
452 | ------------------- | 489 | ------------------- |
453 | 490 | ||