Changes between Version 19 and Version 20 of AddHeadersPlugin
- Timestamp:
- May 10, 2015, 7:27:11 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
AddHeadersPlugin
v19 v20 1 1 [[PageOutline(2-5,Contents,pullout)]] 2 = Add HTML Headers to Trac Pages in a simple way = 3 4 == Description == 5 6 This plug-in allows Trac server admins to add `script`, `link` and (with Trac 0.12) also `meta` headers into all trac pages without having to create a Chrome template file. 2 3 = Add HTML Headers to Trac Pages in a simple way 4 5 == Description 6 7 This plugin allows Trac server admins to add `script`, `link` and (with Trac 0.12) also `meta` headers into all Trac pages without having to create a Chrome template file. 7 8 This allows the easy usage of own !JavaScript and CSS files. Also all other kinds of `link` headers can be added. 8 9 9 == Installation == 10 Install as normal and enable this plug-in by adding the following into the config file (normally '`conf/trac.ini`'): 11 {{{ 12 #!ini 10 == Bugs/Feature Requests 11 12 Existing bugs and feature requests for AddHeadersPlugin are 13 [report:9?COMPONENT=AddHeadersPlugin here]. 14 15 If you have any issues, create a 16 [http://trac-hacks.org/newticket?component=AddHeadersPlugin&owner=martin_s new ticket]. 17 18 [[TicketQuery(component=AddHeadersPlugin&group=type,format=progress)]] 19 20 == Download 21 22 Download the zipped source from [download:addheadersplugin here]. 23 24 == Source 25 26 You can check out AddHeadersPlugin from [http://trac-hacks.org/svn/addheadersplugin here] using Subversion, or [source:addheadersplugin browse the source] with Trac. 27 28 == Installation 29 30 Install as normal and enable this plugin by adding the following into your `trac.ini` file, normally found at `../conf/trac.ini`: 31 {{{#!ini 13 32 [components] 14 33 tracaddheaders.* = enabled 15 34 }}} 16 35 17 == Usage == 18 The plugin is controlled over settings the Trac config file (normally '`conf/trac.ini`'). 19 All settings must be put in the section `[addheaders]`. 20 21 === Settings === 22 `default_base = `''<path relative to base URL>'' (default: '`site/`'):: This is used as default base of the files relative to the base URL (which is e.g. `http://trac.example.org/project1/`). Please note that URL paths not local file paths are used. The default is `site/` which is the relative URL for the `htdocs` directory in your `$TRAC_PROJECT_DIR`. 23 24 `default_script_base = `''<path relative to base URL>'' (default: `default_base`):: To provide an different default path for scripts. 25 26 `default_style_base = `''<path relative to base URL>'' (default: `default_base`):: To provide an different default path for style files. 27 28 `default_meta_lang = `''default language>'' (default: None):: Default language for meta tags (i.e. `lang` and `xml:lang` attributes) 36 == Usage 37 38 The plugin is controlled through settings in the TracIni file. All settings must be put in the section `[addheaders]`. 39 40 === Settings 41 42 `default_base = `''<path relative to base URL>'' (default: '`site/`'):: This is used as default base of the files relative to the base URL, which is eg `http://trac.example.org/project1/`. Note that URL paths, not local file paths are used. The default is `site/` which is the relative URL for the `htdocs` directory in your `$TRAC_PROJECT_DIR`. 43 44 `default_script_base = `''<path relative to base URL>'' (default: `default_base`):: To provide a different default path for scripts. 45 46 `default_style_base = `''<path relative to base URL>'' (default: `default_base`):: To provide a different default path for style files. 47 48 `default_meta_lang = `''default language>'' (default: None):: Default language for meta tags, ie `lang` and `xml:lang` attributes. 29 49 30 50 `add_scripts = `''<name1>''`,`''<name2>''`,``...`:: Will add `script` tags for all given names. The mime-type and filename can be defined by: … … 45 65 * ''<name>''`.class = `''<(CSS?) class of link>'' 46 66 47 `add_meta = `''<name1>''`,`''<name2>''`,``...`:: Will add [http://en.wikipedia.org/wiki/Meta_element `meta` tags] for all given names. There exists no default setting.[[BR]]67 `add_meta = `''<name1>''`,`''<name2>''`,``...`:: Will add [http://en.wikipedia.org/wiki/Meta_element `meta` tags] for all given names. There is no default setting.[[BR]] 48 68 [[BR]]One and only one of the following settings must be given: 49 69 * ''<name>''`.http_equiv = `''<equivalent HTTP header>'' … … 57 77 See also the [#Examples example] below. 58 78 59 == Bugs/Feature Requests == 60 61 Existing bugs and feature requests for AddHeadersPlugin are 62 [report:9?COMPONENT=AddHeadersPlugin here]. 63 64 If you have any issues, create a 65 [http://trac-hacks.org/newticket?component=AddHeadersPlugin&owner=martin_s new ticket]. 66 67 == Download == 68 69 Download the zipped source from [download:addheadersplugin here]. 70 71 == Source == 72 73 You can check out AddHeadersPlugin from [http://trac-hacks.org/svn/addheadersplugin here] using Subversion, or [source:addheadersplugin browse the source] with Trac. 74 75 == Examples == 76 === Multi-Style === 77 The following example shows how to add files for a multi-style implementation, i.e. the user can select between different graphics styles: 79 == Examples 80 81 === Multi-Style 82 83 The following example shows how to add files for a multi-style implementation, ie the user can select between different graphics styles: 78 84 The !JavaScript file is located at `$TRAC_PROJECT_DIR/htdocs/js/multistyle.js` and all CSS files are located at `$TRAC_PROJECT_DIR/htdocs/css/`. 79 A general style file '`common.css`' is included which holds all common style definition. The default style is in '`default.css`' and the alternative styles in '`theme1.css`' and '`theme2.css`'.85 A general style file `common.css` is included which holds all common style definition. The default style is in `default.css` and the alternative styles in `theme1.css` and `theme2.css`. 80 86 Please note that general CSS files are added using `add_styles` while the others using `add_links`. This has HTML and Trac API related reasons. 81 87 82 {{{ 83 #!ini 88 {{{#!ini 84 89 # in trac.ini 85 90 [addheaders] … … 113 118 }}} 114 119 115 This will result in the following added headers (not necessary in that order):120 This will result in the following added headers, not necessary in that order: 116 121 {{{ 117 122 <link title="default" type="text/css" href="/chrome/site/style.css" rel="stylesheet" /> … … 122 127 }}} 123 128 124 === Adding custom !JavaScript and CSS === 125 126 The following example shows how to add some custom !JavaScript and CSS files. Here they all start with a common prefix. The JS files (abc_one.js,abc_two.js,abc_tree.js) are positioned in the `$TRAC_PROJECT_DIR/htdocs/js/` and the CSS files (style_print.css,style_screen.css) `$TRAC_PROJECT_DIR/htdocs/css/` directory. 127 128 {{{ 129 #!ini 129 === Adding custom !JavaScript and CSS 130 131 The following example shows how to add some custom !JavaScript and CSS files. Here they all start with a common prefix. The JS files (abc_one.js, abc_two.js, abc_tree.js) are positioned in the `$TRAC_PROJECT_DIR/htdocs/js/` and the CSS files (style_print.css, style_screen.css) `$TRAC_PROJECT_DIR/htdocs/css/` directory. 132 133 {{{#!ini 130 134 # in trac.ini 131 135 [addheaders] … … 139 143 or, even shorter: 140 144 141 {{{ 142 #!ini 145 {{{#!ini 143 146 # in trac.ini 144 147 [addheaders] … … 150 153 }}} 151 154 152 === Weird filenames ===155 === Unusual filenames 153 156 154 157 While the names given by `add_scripts` or `add_styles` is used to build the default filename, it becomes just an arbitrary string when the real filename is set explicitly using ''<name>''`.filename`. 155 This can be used when the real filename is quit weird, e.g. has commas included or is very long. Make sure to use an UTF-8 capable editor when adding non-ASCII letters. 156 {{{ 157 #!ini 158 This can be used when the real filename is unusual, eg has commas included or is very long. Make sure to use an UTF-8 capable editor when adding non-ASCII letters. 159 {{{#!ini 158 160 # in trac.ini 159 161 [addheaders] … … 169 171 }}} 170 172 171 === General `link` tag ===173 === General `link` tag 172 174 173 175 The `link` tags are used to define ''relations'' between the page and other pages, e.g. 'My startpage is at ..., the next page is at ...'. Trac itself adds a couple of link tags for `help`, `up`, `prev`, etc. for some pages. 174 176 175 The following example would add a linked copyright notice (written plain text) and a shortcut icon to every Trac page. Please note that the information is not displayed by default to the user in any way and most browsers are ignoring link tags which aren't used for style sheets an shortcut icons. 176 177 {{{ 178 #!ini 177 The following example would add a linked copyright notice (written in plain text) and a shortcut icon to every Trac page. Note that the information is not displayed by default to the user in any way and most browsers are ignoring link tags which aren't used for style sheets or shortcut icons. 178 179 {{{#!ini 179 180 # in trac.ini 180 181 [addheaders] … … 197 198 }}} 198 199 199 == Recent Changes ==200 == Recent Changes 200 201 201 202 [[ChangeLog(addheadersplugin, 3)]] 202 203 203 == Author/Contributors ==204 == Author/Contributors 204 205 205 206 '''Author:''' [wiki:martin_s] [[BR]] 206 '''Maintainer:''' [ wiki:martin_s] [[BR]]207 '''Maintainer:''' [[Maintainer]] [[BR]] 207 208 '''Contributors:'''