Show More
@@ -0,0 +1,227 b'' | |||
|
1 | MIME_TO_EXT = { | |
|
2 | 'application/javascript': ['*.js'], | |
|
3 | 'text/javascript': ['*.js'], | |
|
4 | 'application/json': ['*.json'], | |
|
5 | 'application/postscript': ['*.ps', '*.eps'], | |
|
6 | 'application/x-actionscript': ['*.as'], | |
|
7 | 'application/x-actionscript3': ['*.as'], | |
|
8 | 'application/x-awk': ['*.awk'], | |
|
9 | 'application/x-befunge': ['*.befunge'], | |
|
10 | 'application/x-brainfuck': ['*.bf', '*.b'], | |
|
11 | 'application/x-cheetah': ['*.tmpl', '*.spt'], | |
|
12 | 'application/x-coldfusion': ['*.cfm', '*.cfml', '*.cfc'], | |
|
13 | 'application/x-csh': ['*.tcsh', '*.csh'], | |
|
14 | 'application/x-dos-batch': ['*.bat', '*.cmd'], | |
|
15 | 'application/x-ecl': ['*.ecl'], | |
|
16 | 'application/x-evoque': ['*.evoque'], | |
|
17 | 'application/x-fantom': ['*.fan'], | |
|
18 | 'application/x-genshi': ['*.kid'], | |
|
19 | 'application/x-gettext': ['*.pot', '*.po'], | |
|
20 | 'application/x-jsp': ['*.jsp'], | |
|
21 | 'application/x-mako': ['*.mao'], | |
|
22 | 'application/x-mason': ['*.m', '*.mhtml', '*.mc', '*.mi', 'autohandler', 'dhandler'], | |
|
23 | 'application/x-myghty': ['*.myt', 'autodelegate'], | |
|
24 | 'application/x-php': ['*.phtml'], | |
|
25 | 'application/x-pypylog': ['*.pypylog'], | |
|
26 | 'application/x-qml': ['*.qml'], | |
|
27 | 'application/x-sh': ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '.bashrc', 'bashrc', '.bash_*', 'bash_*'], | |
|
28 | 'application/x-sh-session': ['*.shell-session'], | |
|
29 | 'application/x-shell-session': ['*.sh-session'], | |
|
30 | 'application/x-smarty': ['*.tpl'], | |
|
31 | 'application/x-ssp': ['*.ssp'], | |
|
32 | 'application/x-troff': ['*.[1234567]', '*.man'], | |
|
33 | 'application/x-urbiscript': ['*.u'], | |
|
34 | 'application/xml+evoque': ['*.xml'], | |
|
35 | 'application/xml-dtd': ['*.dtd'], | |
|
36 | 'application/xsl+xml': ['*.xsl', '*.xslt', '*.xpl'], | |
|
37 | 'text/S-plus': ['*.S', '*.R', '.Rhistory', '.Rprofile'], | |
|
38 | 'text/coffeescript': ['*.coffee'], | |
|
39 | 'text/css': ['*.css'], | |
|
40 | 'text/haxe': ['*.hx'], | |
|
41 | 'text/html': ['*.html', '*.htm', '*.xhtml', '*.xslt'], | |
|
42 | 'text/html+evoque': ['*.html'], | |
|
43 | 'text/html+ruby': ['*.rhtml'], | |
|
44 | 'text/idl': ['*.pro'], | |
|
45 | 'text/livescript': ['*.ls'], | |
|
46 | 'text/matlab': ['*.m'], | |
|
47 | 'text/octave': ['*.m'], | |
|
48 | 'text/plain': ['*.txt'], | |
|
49 | 'text/scilab': ['*.sci', '*.sce', '*.tst'], | |
|
50 | 'text/smali': ['*.smali'], | |
|
51 | 'text/x-abap': ['*.abap'], | |
|
52 | 'text/x-ada': ['*.adb', '*.ads', '*.ada'], | |
|
53 | 'text/x-apacheconf': ['.htaccess', 'apache.conf', 'apache2.conf'], | |
|
54 | 'text/x-aspectj': ['*.aj'], | |
|
55 | 'text/x-asymptote': ['*.asy'], | |
|
56 | 'text/x-autohotkey': ['*.ahk', '*.ahkl'], | |
|
57 | 'text/x-autoit': ['*.au3'], | |
|
58 | 'text/x-bmx': ['*.bmx'], | |
|
59 | 'text/x-boo': ['*.boo'], | |
|
60 | 'text/x-c++hdr': ['*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx', '*.C', '*.H', '*.cp','*.CPP'], | |
|
61 | 'text/x-c-objdump': ['*.c-objdump'], | |
|
62 | 'text/x-ceylon': ['*.ceylon'], | |
|
63 | 'text/x-chdr': ['*.c', '*.h', '*.idc'], | |
|
64 | 'text/x-clojure': ['*.clj'], | |
|
65 | 'text/x-cmake': ['*.cmake', 'CMakeLists.txt'], | |
|
66 | 'text/x-cobol': ['*.cob', '*.COB', '*.cpy', '*.CPY'], | |
|
67 | 'text/x-common-lisp': ['*.cl', '*.lisp', '*.el'], | |
|
68 | 'text/x-coq': ['*.v'], | |
|
69 | 'text/x-cpp-objdump': ['*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump'], | |
|
70 | 'text/x-crocsrc': ['*.croc'], | |
|
71 | 'text/x-csharp': ['*.cs'], | |
|
72 | 'text/x-cuda': ['*.cu', '*.cuh'], | |
|
73 | 'text/x-cython': ['*.pyx', '*.pxd', '*.pxi'], | |
|
74 | 'text/x-d-objdump': ['*.d-objdump'], | |
|
75 | 'text/x-dart': ['*.dart'], | |
|
76 | 'text/x-dg': ['*.dg'], | |
|
77 | 'text/x-diff': ['*.diff', '*.patch'], | |
|
78 | 'text/x-dsrc': ['*.d', '*.di'], | |
|
79 | 'text/x-duel': ['*.duel', '*.jbst'], | |
|
80 | 'text/x-dylan': ['*.dylan', '*.dyl', '*.intr'], | |
|
81 | 'text/x-dylan-console': ['*.dylan-console'], | |
|
82 | 'text/x-dylan-lid': ['*.lid', '*.hdp'], | |
|
83 | 'text/x-echdr': ['*.ec', '*.eh'], | |
|
84 | 'text/x-elixir': ['*.ex', '*.exs'], | |
|
85 | 'text/x-erl-shellsession': ['*.erl-sh'], | |
|
86 | 'text/x-erlang': ['*.erl', '*.hrl', '*.es', '*.escript'], | |
|
87 | 'text/x-factor': ['*.factor'], | |
|
88 | 'text/x-fancysrc': ['*.fy', '*.fancypack'], | |
|
89 | 'text/x-felix': ['*.flx', '*.flxh'], | |
|
90 | 'text/x-fortran': ['*.f', '*.f90', '*.F', '*.F90'], | |
|
91 | 'text/x-fsharp': ['*.fs', '*.fsi'], | |
|
92 | 'text/x-gas': ['*.s', '*.S'], | |
|
93 | 'text/x-gherkin': ['*.feature'], | |
|
94 | 'text/x-glslsrc': ['*.vert', '*.frag', '*.geo'], | |
|
95 | 'text/x-gnuplot': ['*.plot', '*.plt'], | |
|
96 | 'text/x-gooddata-cl': ['*.gdc'], | |
|
97 | 'text/x-gooddata-maql': ['*.maql'], | |
|
98 | 'text/x-gosrc': ['*.go'], | |
|
99 | 'text/x-gosu': ['*.gs', '*.gsx', '*.gsp', '*.vark'], | |
|
100 | 'text/x-gosu-template': ['*.gst'], | |
|
101 | 'text/x-groovy': ['*.groovy'], | |
|
102 | 'text/x-haml': ['*.haml'], | |
|
103 | 'text/x-haskell': ['*.hs'], | |
|
104 | 'text/x-hybris': ['*.hy', '*.hyb'], | |
|
105 | 'text/x-ini': ['*.ini', '*.cfg'], | |
|
106 | 'text/x-iokesrc': ['*.ik'], | |
|
107 | 'text/x-iosrc': ['*.io'], | |
|
108 | 'text/x-irclog': ['*.weechatlog'], | |
|
109 | 'text/x-jade': ['*.jade'], | |
|
110 | 'text/x-java': ['*.java'], | |
|
111 | 'text/x-java-properties': ['*.properties'], | |
|
112 | 'text/x-julia': ['*.jl'], | |
|
113 | 'text/x-kconfig': ['Kconfig', '*Config.in*', 'external.in*', 'standard-modules.in'], | |
|
114 | 'text/x-koka': ['*.kk', '*.kki'], | |
|
115 | 'text/x-kotlin': ['*.kt'], | |
|
116 | 'text/x-lasso': ['*.lasso', '*.lasso[89]'], | |
|
117 | 'text/x-literate-haskell': ['*.lhs'], | |
|
118 | 'text/x-llvm': ['*.ll'], | |
|
119 | 'text/x-logos': ['*.x', '*.xi', '*.xm', '*.xmi'], | |
|
120 | 'text/x-logtalk': ['*.lgt'], | |
|
121 | 'text/x-lua': ['*.lua', '*.wlua'], | |
|
122 | 'text/x-makefile': ['*.mak', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile'], | |
|
123 | 'text/x-minidsrc': ['*.md'], | |
|
124 | 'text/x-markdown': ['*.md'], | |
|
125 | 'text/x-modelica': ['*.mo'], | |
|
126 | 'text/x-modula2': ['*.def', '*.mod'], | |
|
127 | 'text/x-monkey': ['*.monkey'], | |
|
128 | 'text/x-moocode': ['*.moo'], | |
|
129 | 'text/x-moonscript': ['*.moon'], | |
|
130 | 'text/x-nasm': ['*.asm', '*.ASM'], | |
|
131 | 'text/x-nemerle': ['*.n'], | |
|
132 | 'text/x-newlisp': ['*.lsp', '*.nl'], | |
|
133 | 'text/x-newspeak': ['*.ns2'], | |
|
134 | 'text/x-nimrod': ['*.nim', '*.nimrod'], | |
|
135 | 'text/x-nsis': ['*.nsi', '*.nsh'], | |
|
136 | 'text/x-objdump': ['*.objdump'], | |
|
137 | 'text/x-objective-c': ['*.m', '*.h'], | |
|
138 | 'text/x-objective-c++': ['*.mm', '*.hh'], | |
|
139 | 'text/x-objective-j': ['*.j'], | |
|
140 | 'text/x-ocaml': ['*.ml', '*.mli', '*.mll', '*.mly'], | |
|
141 | 'text/x-ooc': ['*.ooc'], | |
|
142 | 'text/x-opa': ['*.opa'], | |
|
143 | 'text/x-openedge': ['*.p', '*.cls'], | |
|
144 | 'text/x-pascal': ['*.pas'], | |
|
145 | 'text/x-perl': ['*.pl', '*.pm'], | |
|
146 | 'text/x-php': ['*.php', '*.php[345]', '*.inc'], | |
|
147 | 'text/x-povray': ['*.pov', '*.inc'], | |
|
148 | 'text/x-powershell': ['*.ps1'], | |
|
149 | 'text/x-prolog': ['*.prolog', '*.pro', '*.pl'], | |
|
150 | 'text/x-python': ['*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript', '*.tac', '*.sage'], | |
|
151 | 'text/x-python-traceback': ['*.pytb'], | |
|
152 | 'text/x-python3-traceback': ['*.py3tb'], | |
|
153 | 'text/x-r-doc': ['*.Rd'], | |
|
154 | 'text/x-racket': ['*.rkt', '*.rktl'], | |
|
155 | 'text/x-rebol': ['*.r', '*.r3'], | |
|
156 | 'text/x-robotframework': ['*.txt', '*.robot'], | |
|
157 | 'text/x-rpm-spec': ['*.spec'], | |
|
158 | 'text/x-rst': ['*.rst', '*.rest'], | |
|
159 | 'text/x-ruby': ['*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx', '*.duby'], | |
|
160 | 'text/x-rustsrc': ['*.rs', '*.rc'], | |
|
161 | 'text/x-sass': ['*.sass'], | |
|
162 | 'text/x-scala': ['*.scala'], | |
|
163 | 'text/x-scaml': ['*.scaml'], | |
|
164 | 'text/x-scheme': ['*.scm', '*.ss'], | |
|
165 | 'text/x-scss': ['*.scss'], | |
|
166 | 'text/x-smalltalk': ['*.st'], | |
|
167 | 'text/x-snobol': ['*.snobol'], | |
|
168 | 'text/x-sourcepawn': ['*.sp'], | |
|
169 | 'text/x-sql': ['*.sql'], | |
|
170 | 'text/x-sqlite3-console': ['*.sqlite3-console'], | |
|
171 | 'text/x-squidconf': ['squid.conf'], | |
|
172 | 'text/x-standardml': ['*.sml', '*.sig', '*.fun'], | |
|
173 | 'text/x-systemverilog': ['*.sv', '*.svh'], | |
|
174 | 'text/x-tcl': ['*.tcl'], | |
|
175 | 'text/x-tea': ['*.tea'], | |
|
176 | 'text/x-tex': ['*.tex', '*.aux', '*.toc'], | |
|
177 | 'text/x-typescript': ['*.ts'], | |
|
178 | 'text/x-vala': ['*.vala', '*.vapi'], | |
|
179 | 'text/x-vbnet': ['*.vb', '*.bas'], | |
|
180 | 'text/x-verilog': ['*.v'], | |
|
181 | 'text/x-vhdl': ['*.vhdl', '*.vhd'], | |
|
182 | 'text/x-vim': ['*.vim', '.vimrc', '.exrc', '.gvimrc', '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc'], | |
|
183 | 'text/x-windows-registry': ['*.reg'], | |
|
184 | 'text/x-xtend': ['*.xtend'], | |
|
185 | 'text/x-yaml': ['*.yaml', '*.yml'], | |
|
186 | 'text/xml': ['*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl'], | |
|
187 | 'text/xquery': ['*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'], | |
|
188 | 'text/apl': [], | |
|
189 | 'text/x-asterisk': [], | |
|
190 | 'text/x-csrc': [], | |
|
191 | 'text/x-c++src': ['*.cpp'], | |
|
192 | 'text/x-coffeescript': ['*.coffee'], | |
|
193 | 'text/x-d': ["*.d"], | |
|
194 | 'text/x-ecl': ['*.ecl'], | |
|
195 | 'text/x-go': ['*.go'], | |
|
196 | 'text/x-haxe': ['*.hx'], | |
|
197 | 'application/x-aspx': ['*.aspx'], | |
|
198 | 'application/x-ejs': [], | |
|
199 | 'message/http': [], | |
|
200 | 'application/x-json': ['*.json'], | |
|
201 | 'application/typescript': ['*.ts'], | |
|
202 | 'jinja2': ['.jinja2'], | |
|
203 | 'text/x-less': ['*.less'], | |
|
204 | 'text/x-livescript': ['*.ls'], | |
|
205 | 'text/mirc': [], | |
|
206 | 'text/n-triples': [], | |
|
207 | 'application/x-httpd-php': ['*.php'], | |
|
208 | 'text/x-pig': [], | |
|
209 | 'text/x-properties': ['*.properties'], | |
|
210 | 'text/x-rsrc': [], | |
|
211 | 'text/x-sh': ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', '.bashrc', 'bashrc', '.bash_*', 'bash_*'], | |
|
212 | 'application/sieve': [], | |
|
213 | 'text/x-stsrc': ['*.rs', '*.rc'], | |
|
214 | 'text/x-smarty': ['*.tpl'], | |
|
215 | 'application/x-sparql-query': [], | |
|
216 | 'text/x-mariadb': ['*.sql'], | |
|
217 | 'text/x-stex': [], | |
|
218 | 'text/x-latex': ["*.ltx"], | |
|
219 | 'text/x-tiddlywiki': [], | |
|
220 | 'text/tiki': [], | |
|
221 | 'text/x-vb': ['*.vb'], | |
|
222 | 'text/vbscript': ['*.vb'], | |
|
223 | 'text/velocity': [], | |
|
224 | 'application/xml': ['*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl'], | |
|
225 | 'application/xquery': ['*.xqy', '*.xquery', '*.xq', '*.xql', '*.xqm'], | |
|
226 | 'text/x-z80': [], | |
|
227 | } |
@@ -1,98 +1,99 b'' | |||
|
1 | 1 | ## -*- coding: utf-8 -*- |
|
2 | 2 | <%inherit file="/base/base.html"/> |
|
3 | 3 | |
|
4 | 4 | <%def name="title()"> |
|
5 | 5 | ${_('New gist')} · ${c.rhodecode_name} |
|
6 | 6 | </%def> |
|
7 | 7 | |
|
8 | 8 | <%def name="js_extra()"> |
|
9 | 9 | <script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script> |
|
10 | 10 | <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script> |
|
11 | 11 | <script type="text/javascript" src="${h.url('/js/mode/meta.js')}"></script> |
|
12 | <script type="text/javascript" src="${h.url('/js/mode/meta_ext.js')}"></script> | |
|
12 | 13 | </%def> |
|
13 | 14 | <%def name="css_extra()"> |
|
14 | 15 | <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/> |
|
15 | 16 | </%def> |
|
16 | 17 | |
|
17 | 18 | <%def name="breadcrumbs_links()"> |
|
18 | 19 | ${_('New gist')} |
|
19 | 20 | </%def> |
|
20 | 21 | |
|
21 | 22 | <%def name="page_nav()"> |
|
22 | 23 | ${self.menu('gists')} |
|
23 | 24 | </%def> |
|
24 | 25 | |
|
25 | 26 | <%def name="main()"> |
|
26 | 27 | <div class="box"> |
|
27 | 28 | <!-- box / title --> |
|
28 | 29 | <div class="title"> |
|
29 | 30 | ${self.breadcrumbs()} |
|
30 | 31 | </div> |
|
31 | 32 | |
|
32 | 33 | <div class="table"> |
|
33 | 34 | <div id="files_data"> |
|
34 | 35 | ${h.form(h.url('gists'), method='post',id='eform')} |
|
35 | 36 | <div> |
|
36 | 37 | <div class="gravatar"> |
|
37 | 38 | <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.rhodecode_user.full_contact),32)}"/> |
|
38 | 39 | </div> |
|
39 | 40 | <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea> |
|
40 | 41 | <div style="padding:0px 0px 0px 42px"> |
|
41 | 42 | <label for='lifetime'>${_('Gist lifetime')}</label> |
|
42 | 43 | ${h.select('lifetime', '', c.lifetime_options)} |
|
43 | 44 | </div> |
|
44 | 45 | </div> |
|
45 | 46 | <div id="body" class="codeblock"> |
|
46 | 47 | <div style="padding: 10px 10px 10px 26px;color:#666666"> |
|
47 | 48 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> |
|
48 | 49 | ${h.text('filename', size=30, placeholder='gistfile1.txt')} |
|
49 | 50 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> |
|
50 | 51 | ${h.select('mimetype','plain',[('plain',_('plain'))])} |
|
51 | 52 | </div> |
|
52 | 53 | <div id="editor_container"> |
|
53 | 54 | <pre id="editor_pre"></pre> |
|
54 | 55 | <textarea id="editor" name="content" style="display:none"></textarea> |
|
55 | 56 | </div> |
|
56 | 57 | </div> |
|
57 | 58 | <div style="padding-top: 5px"> |
|
58 | 59 | ${h.submit('private',_('Create private gist'),class_="ui-btn yellow")} |
|
59 | 60 | ${h.submit('public',_('Create public gist'),class_="ui-btn")} |
|
60 | 61 | ${h.reset('reset',_('Reset'),class_="ui-btn")} |
|
61 | 62 | </div> |
|
62 | 63 | ${h.end_form()} |
|
63 | 64 | <script type="text/javascript"> |
|
64 | 65 | var myCodeMirror = initCodeMirror('editor', ''); |
|
65 | 66 | CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}"; |
|
66 | 67 | |
|
67 | 68 | //inject new modes |
|
68 | 69 | var modes_select = YUD.get('mimetype'); |
|
69 | 70 | for(var i=0;i<CodeMirror.modeInfo.length;i++){ |
|
70 | 71 | var m = CodeMirror.modeInfo[i]; |
|
71 | 72 | var opt = new Option(m.name, m.mime); |
|
72 | 73 | YUD.setAttribute(opt, 'mode', m.mode) |
|
73 | 74 | modes_select.options[i+1] = opt; |
|
74 | 75 | } |
|
75 | 76 | YUE.on(modes_select, 'change', function(e){ |
|
76 | 77 | var selected = e.currentTarget; |
|
77 | 78 | var node = selected.options[selected.selectedIndex]; |
|
78 | 79 | var mimetype = node.value; |
|
79 | 80 | var new_mode = YUD.getAttribute(node, 'mode') |
|
80 | 81 | setCodeMirrorMode(myCodeMirror, new_mode); |
|
81 | 82 | |
|
82 | 83 | var proposed_mimetypes = MIME_TO_EXT[mimetype] || []; |
|
83 | 84 | if(proposed_mimetypes.length < 1){ |
|
84 | 85 | //fallback to text/plain |
|
85 | 86 | proposed_mimetypes = ['.txt'] |
|
86 | 87 | } |
|
87 | 88 | var mt = proposed_mimetypes[0]; |
|
88 | 89 | if(mt[0] == '*'){ |
|
89 | 90 | mt = mt.substr(1) |
|
90 | 91 | } |
|
91 | 92 | YUD.get('filename').value = 'filename1' + mt; |
|
92 | 93 | }) |
|
93 | 94 | </script> |
|
94 | 95 | </div> |
|
95 | 96 | </div> |
|
96 | 97 | |
|
97 | 98 | </div> |
|
98 | 99 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now