#2103 Ability to map extensions for syntax highlighting in config

This commit is contained in:
Unknwon committed 2015-12-17 22:31:34 -05:00
1 parent 33a99d587a
commit 1e7e092992
5 files changed
+50 -25

No files matched your search

+4
View File
@@ -338,6 +338,10 @@ pl-PL = pl
bg-BG = bg
it-IT = it
; Extension mapping to highlight class
; e.g. .toml=ini
[highlight.mapping]
[other]
SHOW_FOOTER_BRANDING = false
; Show version information about gogs and go in the footer
+2 -2
View File
@@ -284,7 +284,7 @@ func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _confAppIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x7a\x5d\x8f\xe3\x46\x76\xf6\x3d\x7f\x45\xb9\xfd\xfa\xf5\x4c\x20\xa9\x3f\xc6\x3d\x33\x6e\xbb\x13\xab\x25\xaa\x9b\x3b\xfa\x32\x29\xcd\x78\x3c\x68\x70\xd8\x64\x49\xa2\x9b\x22\x35\x2c\xb2\x7b\xda\xc8\xc5\x1a\xb9\x08\x90\xdb\x04\xc9\x4d\x10\x24\x17\x41\x80\xcd\x07\xb2\xc8\xcd\x6e\x82\x5c\x19\xb9\x1f\xff\x87\x85\x37\xf9\x17\x79\xce\xa9\xa2\x44\xf5\xb4\x1b\x59\x20\xd9\x35\xa6\xc9\x62\xd5\xa9\xaa\xf3\xf1\x9c\xe7\x54\xe9\x43\x31\xb4\x9f\xdb\xae\xe0\x7f\x06\xa3\xae\xd3\x7b\x29\x26\x67\x8e\x27\x7a\x4e\xdf\xb6\x3e\x14\xe3\xbe\xdd\xf6\x6c\x31\x68\x3f\xb3\x45\xe7\xac\x3d\x3c\xb5\x3d\x31\x1a\x8a\xce\xc8\x75\x6d\x6f\x3c\x1a\x76\x9d\xe1\xa9\xe8\x4c\xbd\xc9\x68\x80\xc6\x61\xcf\x39\xd5\x23\xad\xcf\x44\x7b\xb5\x12\x69\xb0\x94\xa2\x58\x04\x85\x50\x8b\xec\x5a\x89\x2c\x15\xf2\x4a\xe6\x37\x62\x15\xcc\xf1\x21\x2e\x12\x69\xb5\xc7\x63\x7f\xd8\x1e\xd8\xe2\x58\x9c\x66\x73\x75\x84\x7f\xc5\x69\x5c\x08\x4f\xe6\x57\x71\x28\x21\xa9\xb3\x08\x52\x74\x47\x5b\x3c\x13\x37\x59\x29\xf2\x32\x15\x49\x16\x06\x49\x72\x63\xb9\xd3\xa1\x3f\xf5\xb0\xfa\x63\x31\x8f\x0b\xf4\xb6\xe3\x62\x21\x73\xb1\x13\xc9\xab\x9d\x86\xd8\x59\xe5\x59\xb4\x23\x32\x34\x14\x52\x15\x68\x89\xe4\x2c\x28\x13\xc8\x52\xba\x0f\x4b\xc0\xd6\x69\x01\x78\xb7\xac\x57\xb9\x5c\x65\x2a\x2e\xb2\xfc\xe6\xdc\x72\x47\xa3\x89\x38\xb6\xbc\x8e\xeb\x8c\x27\xfe\xe4\xe5\x98\xba\x5d\x04\x6a\x81\x99\xba\x46\x52\x7b\xe8\x39\x22\x5c\x04\xb9\x92\x85\x45\x2f\x3e\x54\xe5\x7a\x36\x06\x0a\x74\xeb\x65\x79\x28\xcd\xbe\x53\x79\x2d\x36\xe2\x45\x91\x89\x0b\x29\x56\x79\x7c\x15\x14\xd2\xea\x8d\xdc\x8e\xed\x8f\x5d\xe7\x79\x7b\x42\xd3\xcc\x82\x44\xd1\xfe\x4f\x93\xec\x22\x48\xc4\x32\x78\x1b\x2f\xcb\xa5\x08\x73\x19\x14\x31\x54\x99\xc4\x4b\xe8\x24\x9b\xd5\x25\xae\xb0\xf5\x52\xc9\xbc\x21\x9a\xfb\x62\x29\x83\x54\x89\x34\xd3\x3d\xad\x41\xfb\x2b\xbf\xe3\xda\xed\x89\x33\x1a\xfa\x7d\x67\xe0\xd0\x02\x9b\xfb\x98\x61\x1c\x14\xe1\x42\x90\x82\xc4\x9b\x52\x96\x52\x24\x32\x9d\x17\x8b\x06\xe6\xbc\x64\xc5\x07\x4a\x24\x41\x0e\x23\xe0\x01\x73\xa9\xf8\x02\x96\x1b\x4f\xfb\x7d\xdf\xb5\xbf\x9c\xda\xde\xc4\xc7\xbf\x53\xdb\xef\xdb\xc3\xd3\xc9\x19\xc4\xee\xef\xe1\x7f\xd0\x65\x19\x9f\x43\xfe\xb0\x5c\x5e\x60\x61\xf5\xa5\xc6\x52\x69\xcf\x08\x72\xc9\xde\x21\x23\x11\xa7\xf0\x10\xa8\xea\xed\x2a\xc9\xd0\x4a\x4e\x62\xd9\x5f\x8d\xfb\x23\x17\x6a\x69\x9f\xc2\xd7\xfc\xe1\x74\x00\xe9\x07\x7b\x5b\x42\x63\xa5\xca\x9f\x16\xc7\x62\x1c\xcf\x9b\xde\x12\xb2\xbf\x2d\x64\xad\xde\x6c\x09\x65\xa9\x5b\x42\x82\xb0\x88\xaf\xe2\xe2\x46\xcc\xa4\x8c\xac\x9e\x6d\x77\x7d\x56\xe7\x68\x00\x35\x1a\x81\x87\xbc\xdf\x56\x10\x2d\xe3\x74\x7b\xd7\x64\x91\xfb\xd7\x47\x2e\xbc\xbd\xbc\xc3\xbd\xf7\x15\x77\xaf\x08\xd7\x1e\x8f\xee\x15\x91\x66\x05\x02\xea\x7e\x21\xc3\xd1\xc4\xe9\xdc\xd6\xf6\xe1\x96\x98\x2c\x9f\x07\x69\xfc\xad\xf6\xc1\xfb\x64\x8d\xdc\xd3\xf7\xd6\x63\xbd\x5a\x06\xf9\x65\x94\x5d\xb3\x86\xec\x34\x80\x23\x09\x84\x4e\x04\x1f\xc5\xb8\x0b\xf8\xf6\x25\x1c\xa0\x90\xa9\x82\x78\xcb\x1e\xb6\x4f\xfa\xb6\x8f\x70\xea\xc2\x63\x87\xb6\x7f\x02\xff\x7d\xb6\x8e\x0d\xeb\x15\x14\x8b\xc0\x3a\xb7\xc6\xee\x68\x32\xea\x8c\xfa\xf8\xb4\x28\x8a\x95\xd5\x1d\x0d\xda\xce\x10\x6f\x8c\x13\x8b\x4c\x15\x1c\xca\xfe\xd4\xa5\x2e\x1f\x3d\xa8\xfa\x3f\x54\x47\xbb\xbb\x1f\x3d\xd0\xdd\xf1\xf2\xd1\x83\xb3\xc9\x64\xec\x8f\x47\xee\xe4\xa1\xda\xb5\xf8\xa5\xdd\xed\x02\x5e\xac\xf5\x07\x08\x78\x44\xde\xfd\x99\xe8\x93\x70\xf1\xa0\x3b\xf8\xfa\xa1\x20\xc9\x33\xe0\x0c\x81\x98\xb8\xce\xf2\x4b\x32\xf9\x03\x55\x22\xb0\x10\x34\x9e\x77\x26\xca\x55\x84\x30\x7f\x08\x5f\x82\x15\x54\x9c\xce\xc5\xb5\xbc\x10\x4a\xe3\x5c\x0b\xe2\x9c\x54\x2c\xb1\x52\x11\x06\x0a\x66\x22\xa4\x8b\x32\xb2\x1a\x60\x03\xaa\x05\x58\x84\x1a\x09\x01\x70\x6b\x18\xbb\x0a\x92\x92\x07\xb7\x93\x02\xf6\x21\x40\x48\x93\x1b\x83\x94\x39\xcf\xab\x75\x04\x41\x91\x24\xd4\x23\x81\x24\x41\x11\x38\x63\x69\xb4\x2f\xfe\xd8\xb2\xfa\xa3\x4e\x1b\x21\xbd\x51\x14\xe9\x12\x0a\x5a\x2b\xf1\xb6\x7e\x00\x82\xb1\x62\x1b\xd2\x44\x33\x00\x53\x09\x5f\xb8\x5e\xc8\x94\xa7\x09\xae\x82\x38\xa1\xcf\x56\xd7\xf1\xd8\x92\xd4\x6d\x83\x6c\x2f\x16\x92\xc1\x1a\xf1\x21\x2e\xca\x38\x29\xe0\x3e\xb5\x15\x67\xb4\xe8\xa2\x65\x79\x93\xb6\x3b\xa1\xa1\x3e\xa2\xe4\x39\x63\xbd\x96\x40\x4d\xc6\x22\x07\x07\xb5\xc5\x74\xba\x43\x02\xdc\x94\xdc\xd1\x64\x80\x25\x36\x68\x8d\x7a\x3d\xf6\x22\x03\xf7\x5a\x48\xb5\x34\x77\x34\x9d\x20\x08\xfb\xa3\xd3\x3a\xf6\xca\x54\xe6\xb0\x9a\x50\x85\x5c\xa9\x23\xb4\xfc\x3f\xd1\xda\x9d\x93\x8d\x43\x99\x17\xa2\x19\x06\xc7\x45\x0e\xc4\x6c\x46\x65\xce\x21\x71\xfc\xf4\xc9\xe3\xbd\xc5\xde\x72\x4f\x89\x26\xa9\xec\x78\x79\x43\x7f\x5a\xf2\x6d\xb0\x5c\x25\xb2\x05\x7c\xb1\x3e\x83\x9c\x51\x2e\x66\x79\xb6\x14\x81\x68\xad\x66\x6f\xc5\x2c\x4e\x18\xf9\xb2\xbc\x80\xad\xf9\x0b\x19\xe9\x45\x9c\x46\x94\x39\x69\xb2\x78\x16\x87\x7a\x29\x84\x8e\x0f\xa2\x0c\x52\x48\xcb\xf0\xba\xb9\x2c\xc8\x3f\xf4\x78\x1e\x68\x92\x8a\xb8\x94\x37\x0f\xf5\xb2\xb3\x15\x82\x4a\x25\x62\x75\x19\xaa\xfd\x03\xd1\x84\x6e\x48\x2a\xcf\xde\xcc\xca\xc2\xbc\xc9\xa5\x68\xa6\x19\x86\xa9\xff\xd9\x28\xf4\xac\x06\xd1\x07\x45\x0f\x91\x54\x56\xc7\x86\xcd\x88\x0c\x40\x9b\x61\x89\x35\x2f\x77\Line truncated
var _confAppIni = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\xb4\x7a\x5b\x8f\xe3\x46\x76\xff\x3b\x3f\x45\xb9\xfd\xf7\xdf\x33\x81\xa4\xbe\x8c\x7b\x66\xdc\x76\x27\x56\x4b\x54\x37\x77\x74\x33\x29\xcd\x78\x3c\x68\x70\xd8\x64\x49\xa2\x9b\x22\x35\x2c\xb2\x7b\xda\xc8\xc3\x1a\x79\x08\x90\xd7\x04\xc9\x4b\x10\x24\x0f\x41\x80\xcd\x05\x59\xe4\x65\x37\x41\x9e\x8c\xbc\x8f\xbf\xc3\xc2\x9b\x7c\x8b\xfc\xce\xa9\xa2\x44\xf5\xb4\x1b\x59\x20\xd9\xcb\x34\x59\xac\x3a\x55\x75\x2e\xbf\xf3\x3b\x55\xfa\x50\x0c\xed\xe7\xb6\x2b\xf8\x9f\xc1\xa8\xeb\xf4\x5e\x8a\xc9\x99\xe3\x89\x9e\xd3\xb7\xad\x0f\xc5\xb8\x6f\xb7\x3d\x5b\x0c\xda\xcf\x6c\xd1\x39\x6b\x0f\x4f\x6d\x4f\x8c\x86\xa2\x33\x72\x5d\xdb\x1b\x8f\x86\x5d\x67\x78\x2a\x3a\x53\x6f\x32\x1a\xa0\x71\xd8\x73\x4e\xf5\x48\xeb\x33\xd1\x5e\xad\x44\x1a\x2c\xa5\x28\x16\x41\x21\xd4\x22\xbb\x56\x22\x4b\x85\xbc\x92\xf9\x8d\x58\x05\x73\x7c\x88\x8b\x44\x5a\xed\xf1\xd8\x1f\xb6\x07\xb6\x38\x16\xa7\xd9\x5c\x1d\xe1\x5f\x71\x1a\x17\xc2\x93\xf9\x55\x1c\x4a\x48\xea\x2c\x82\x14\xdd\xd1\x16\xcf\xc4\x4d\x56\x8a\xbc\x4c\x45\x92\x85\x41\x92\xdc\x58\xee\x74\xe8\x4f\x3d\xac\xfe\x58\xcc\xe3\x02\xbd\xed\xb8\x58\xc8\x5c\xec\x44\xf2\x6a\xa7\x21\x76\x56\x79\x16\xed\x88\x0c\x0d\x85\x54\x05\x5a\x22\x39\x0b\xca\x04\xb2\x94\xee\xc3\x12\xb0\x75\x5a\x00\xde\x2d\xeb\x55\x2e\x57\x99\x8a\x8b\x2c\xbf\x39\xb7\xdc\xd1\x68\x22\x8e\x2d\xaf\xe3\x3a\xe3\x89\x3f\x79\x39\xa6\x6e\x17\x81\x5a\x60\xa6\xae\x91\xd4\x1e\x7a\x8e\x08\x17\x41\xae\x64\x61\xd1\x8b\x0f\x55\xb9\x9e\x8d\x81\x02\xdd\x7a\x59\x1e\x4a\xb3\xef\x54\x5e\x8b\x8d\x78\x51\x64\xe2\x42\x8a\x55\x1e\x5f\x05\x85\xb4\x7a\x23\xb7\x63\xfb\x63\xd7\x79\xde\x9e\xd0\x34\xb3\x20\x51\xb4\xff\xd3\x24\xbb\x08\x12\xb1\x0c\xde\xc6\xcb\x72\x29\xc2\x5c\x06\x45\x0c\x55\x26\xf1\x12\x3a\xc9\x66\x75\x89\x2b\x6c\xbd\x54\x32\x6f\x88\xe6\xbe\x58\xca\x20\x55\x22\xcd\x74\x4f\x6b\xd0\xfe\xca\xef\xb8\x76\x7b\xe2\x8c\x86\x7e\xdf\x19\x38\xb4\xc0\xe6\x3e\x66\x18\x07\x45\xb8\x10\xa4\x20\xf1\xa6\x94\xa5\x14\x89\x4c\xe7\xc5\xa2\x81\x39\x2f\x59\xf1\x81\x12\x49\x90\xc3\x08\x78\xc0\x5c\x2a\xbe\x80\xe5\xc6\xd3\x7e\xdf\x77\xed\x2f\xa7\xb6\x37\xf1\xf1\xef\xd4\xf6\xfb\xf6\xf0\x74\x72\x06\xb1\xfb\x7b\xf8\x0f\x74\x59\xc6\xe7\x90\x3f\x2c\x97\x17\x58\x58\x7d\xa9\xb1\x54\xda\x33\x82\x5c\xb2\x77\xc8\x48\xc4\x29\x3c\x04\xaa\x7a\xbb\x4a\x32\xb4\x92\x93\x58\xf6\x57\xe3\xfe\xc8\x85\x5a\xda\xa7\xf0\x35\x7f\x38\x1d\x40\xfa\xc1\xde\x96\xd0\x58\xa9\xf2\xa7\xc5\xb1\x18\xc7\xf3\xa6\xb7\x84\xec\x6f\x0b\x59\xab\x37\x5b\x42\x59\xea\x96\x90\x20\x2c\xe2\xab\xb8\xb8\x11\x33\x29\x23\xab\x67\xdb\x5d\x9f\xd5\x39\x1a\x40\x8d\x46\xe0\x21\xef\xb7\x15\x44\xcb\x38\xdd\xde\x35\x59\xe4\xfe\xf5\x91\x0b\x6f\x2f\xef\x70\xef\x7d\xc5\xdd\x2b\xc2\xb5\xc7\xa3\x7b\x45\xa4\x59\x81\x80\xba\x5f\xc8\x70\x34\x71\x3a\xb7\xb5\x7d\xb8\x25\x26\xcb\xe7\x41\x1a\x7f\xab\x7d\xf0\x3e\x59\x23\xf7\xf4\xbd\xf5\x58\xaf\x96\x41\x7e\x19\x65\xd7\xac\x21\x3b\x0d\xe0\x48\x02\xa1\x13\xc1\x47\x31\xee\x02\xbe\x7d\x09\x07\x28\x64\xaa\x20\xde\xb2\x87\xed\x93\xbe\xed\x23\x9c\xba\xf0\xd8\xa1\xed\x9f\xc0\x7f\x9f\xad\x63\xc3\x7a\x05\xc5\x22\xb0\xce\xad\xb1\x3b\x9a\x8c\x3a\xa3\x3e\x3e\x2d\x8a\x62\x65\x75\x47\x83\xb6\x33\xc4\x1b\xe3\xc4\x22\x53\x05\x87\xb2\x3f\x75\xa9\xcb\x47\x0f\xaa\xfe\x0f\xd5\xd1\xee\xee\x47\x0f\x74\x77\xbc\x7c\xf4\xe0\x6c\x32\x19\xfb\xe3\x91\x3b\x79\xa8\x76\x2d\x7e\x69\x77\xbb\x80\x17\x6b\xfd\x01\x02\x1e\x91\x77\x7f\x26\xfa\x24\x5c\x3c\xe8\x0e\xbe\x7e\x28\x48\xf2\x0c\x38\x43\x20\x26\xae\xb3\xfc\x92\x4c\xfe\x40\x95\x08\x2c\x04\x8d\xe7\x9d\x89\x72\x15\x21\xcc\x1f\xc2\x97\x60\x05\x15\xa7\x73\x71\x2d\x2f\x84\xd2\x38\xd7\x82\x38\x27\x15\x4b\xac\x54\x84\x81\x82\x99\x08\xe9\xa2\x8c\xac\x06\xd8\x80\x6a\x01\x16\xa1\x46\x42\x00\xdc\x1a\xc6\xae\x82\xa4\xe4\xc1\xed\xa4\x80\x7d\x08\x10\xd2\xe4\xc6\x20\x65\xce\xf3\x6a\x1d\x41\x50\x24\x09\xf5\x48\x20\x49\x50\x04\xce\x58\x1a\xed\x8b\x3f\xb6\xac\xfe\xa8\xd3\x46\x48\x6f\x14\x45\xba\x84\x82\xd6\x4a\xbc\xad\x1f\x80\x60\xac\xd8\x86\x34\xd1\x0c\xc0\x54\xc2\x17\xae\x17\x32\xe5\x69\x82\xab\x20\x4e\xe8\xb3\xd5\x75\x3c\xb6\x24\x75\xdb\x20\xdb\x8b\x85\x64\xb0\x46\x7c\x88\x8b\x32\x4e\x0a\xb8\x4f\x6d\xc5\x19\x2d\xba\x68\x59\xde\xa4\xed\x4e\x68\xa8\x8f\x28\x79\xce\x58\xaf\x25\x50\x93\xb1\xc8\xc1\x41\x6d\x31\x9d\xee\x90\x00\x37\x25\x77\x34\x19\x60\x89\x0d\x5a\xa3\x5e\x8f\xbd\xc8\xc0\xbd\x16\x52\x2d\xcd\x1d\x4d\x27\x08\xc2\xfe\xe8\xb4\x8e\xbd\x32\x95\x39\xac\x26\x54\x21\x57\xea\x08\x2d\xff\x4f\xb4\x76\xe7\x64\xe3\x50\xe6\x85\x68\x86\xc1\x71\x91\x03\x31\x9b\x51\x99\x73\x48\x1c\x3f\x7d\xf2\x78\x6f\xb1\xb7\xdc\x53\xa2\x49\x2a\x3b\x5e\xde\xd0\x9f\x96\x7c\x1b\x2c\x57\x89\x6c\x01\x5f\xac\xcf\x20\x67\x94\x8b\x59\x9e\x2d\x45\x20\x5a\xab\xd9\x5b\x31\x8b\x13\x46\xbe\x2c\x2f\x60\x6b\xfe\x42\x46\x7a\x11\xa7\x11\x65\x4e\x9a\x2c\x9e\xc5\xa1\x5e\x0a\xa1\xe3\x83\x28\x83\x14\xd2\x32\xbc\x6e\x2e\x0b\xf2\x0f\x3d\x9e\x07\x9a\xa4\x22\x2e\xe5\xcd\x43\xbd\xec\x6c\x85\xa0\x52\x89\x58\x5d\x86\x6a\xff\x40\x34\xa1\x1b\x92\xca\xb3\x37\xb3\xb2\x30\x6f\x72\x29\x9a\x69\x86\x61\xea\x7f\x36\x0a\x3d\xab\x41\xf4\x41\xd1\x43\x24\x95\xd5\xb1\x61\x33\x22\x03\xd0\x66\x58\x62\xcd\xcb\x5d\Line truncated
func confAppIniBytes() ([]byte, error) {
return bindataRead(
@@ -299,7 +299,7 @@ func confAppIni() (*asset, error) {
return nil, err
}
info := bindataFileInfo{name: "conf/app.ini", size: 10084, mode: os.FileMode(420), modTime: time.Unix(1450226423, 0)}
info := bindataFileInfo{name: "conf/app.ini", size: 10161, mode: os.FileMode(420), modTime: time.Unix(1450409425, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
+23 -21
View File
@@ -43,11 +43,11 @@ const (
)
var (
// Build information.
// Build information
BuildTime string
BuildGitHash string
// App settings.
// App settings
AppVer string
AppName string
AppUrl string
@@ -55,7 +55,7 @@ var (
AppPath string
AppDataPath = "data"
// Server settings.
// Server settings
Protocol Scheme
Domain string
HttpAddr, HttpPort string
@@ -71,7 +71,7 @@ var (
EnableGzip bool
LandingPageUrl LandingPage
// Security settings.
// Security settings
InstallLock bool
SecretKey string
LogInRememberDays int
@@ -79,13 +79,13 @@ var (
CookieRememberName string
ReverseProxyAuthUser string
// Database settings.
// Database settings
UseSQLite3 bool
UseMySQL bool
UsePostgreSQL bool
UseTiDB bool
// Webhook settings.
// Webhook settings
Webhook struct {
QueueLength int
DeliverTimeout int
@@ -94,7 +94,7 @@ var (
PagingNum int
}
// Repository settings.
// Repository settings
Repository struct {
AnsiCharset string
ForcePrivate bool
@@ -104,7 +104,7 @@ var (
RepoRootPath string
ScriptType string
// UI settings.
// UI settings
ExplorePagingNum int
IssuePagingNum int
FeedMaxCommitNum int
@@ -113,47 +113,47 @@ var (
AdminNoticePagingNum int
AdminOrgPagingNum int
// Markdown sttings.
// Markdown sttings
Markdown struct {
EnableHardLineBreak bool
}
// Picture settings.
// Picture settings
PictureService string
AvatarUploadPath string
GravatarSource string
DisableGravatar bool
// Log settings.
// Log settings
LogRootPath string
LogModes []string
LogConfigs []string
// Attachment settings.
// Attachment settings
AttachmentPath string
AttachmentAllowedTypes string
AttachmentMaxSize int64
AttachmentMaxFiles int
AttachmentEnabled bool
// Time settings.
// Time settings
TimeFormat string
// Cache settings.
// Cache settings
CacheAdapter string
CacheInternal int
CacheConn string
// Session settings.
// Session settings
SessionConfig session.Options
// Git settings.
// Git settings
Git struct {
MaxGitDiffLines int
GcArgs []string `delim:" "`
}
// Cron tasks.
// Cron tasks
Cron struct {
UpdateMirror struct {
Enabled bool
@@ -174,17 +174,19 @@ var (
} `ini:"cron.check_repo_stats"`
}
// I18n settings.
// I18n settings
Langs, Names []string
dateLangs map[string]string
// Other settings.
// Highlight settings are loaded in modules/template/hightlight.go
// Other settings
ShowFooterBranding bool
ShowFooterVersion bool
// Global setting objects.
// Global setting objects
Cfg *ini.File
CustomPath string // Custom directory path.
CustomPath string // Custom directory path
CustomConf string
ProdMode bool
RunUser string
+19 -2
View File
@@ -7,6 +7,8 @@ package template
import (
"path"
"strings"
"github.com/gogits/gogs/modules/setting"
)
var (
@@ -16,13 +18,13 @@ var (
"copying": true,
}
// File names that are representing highlight class.
// File names that are representing highlight classes.
highlightFileNames = map[string]bool{
"dockerfile": true,
"makefile": true,
}
// Extensions that are same as highlight class.
// Extensions that are same as highlight classes.
highlightExts = map[string]bool{
".arm": true,
".as": true,
@@ -57,8 +59,18 @@ var (
".ts": true,
".vb": true,
}
// Extensions that are not same as highlight classes.
highlightMapping = map[string]string{}
)
func NewContext() {
keys := setting.Cfg.Section("highlight.mapping").Keys()
for i := range keys {
highlightMapping[keys[i].Name()] = keys[i].Value()
}
}
// FileNameToHighlightClass returns the best match for highlight class name
// based on the rule of highlight.js.
func FileNameToHighlightClass(fname string) string {
@@ -76,5 +88,10 @@ func FileNameToHighlightClass(fname string) string {
return ext[1:]
}
name, ok := highlightMapping[ext]
if ok {
return name
}
return ""
}
+2
View File
@@ -28,6 +28,7 @@ import (
"github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/modules/setting"
"github.com/gogits/gogs/modules/ssh"
"github.com/gogits/gogs/modules/template"
"github.com/gogits/gogs/modules/user"
)
@@ -55,6 +56,7 @@ func NewServices() {
// GlobalInit is for global configuration reload-able.
func GlobalInit() {
setting.NewContext()
template.NewContext()
log.Trace("Custom path: %s", setting.CustomPath)
log.Trace("Log path: %s", setting.LogRootPath)
models.LoadConfigs()