about summary refs log tree commit diff stats
path: root/html/000organization.cc.html
Commit message (Collapse)AuthorAgeFilesLines
* 4539Kartik Agaram2018-09-071-4/+4
|
* 4447Kartik Agaram2018-07-271-7/+6
|
* 4239Kartik Agaram2018-05-081-4/+4
|
* 4199Kartik K. Agaram2018-01-251-3/+3
|
* 4161Kartik K. Agaram2017-12-151-5/+5
|
* 4061Kartik K. Agaram2017-10-131-4/+4
|
* 4010Kartik K. Agaram2017-10-041-15/+15
|
* 3971Kartik K. Agaram2017-08-191-7/+3
|
* 3764 - better colors for cross-linksKartik K. Agaram2017-03-081-4/+5
|
* 3716Kartik K. Agaram2016-12-261-0/+2
| | | | Make hyperlinks less salient in the rendered html since there's so many of them.
* 3713 - cross-link calls with definitions in htmlKartik K. Agaram2016-12-261-4/+4
|
* 3710Kartik K. Agaram2016-12-261-140/+140
| | | | | Turns out we don't need to explicitly add anchors for each line. Vim's TOhtml has magic for that out of the box.
* 3709 - line numbers in htmlKartik K. Agaram2016-12-261-142/+166
| | | | | | Each line number also gets an anchor name, but I'm not hyperlinking them for now because I don't want to encourage bookmarking these links just yet. They aren't permalinks because every revision may change what's at any given line number.
* 3558Kartik K. Agaram2016-10-221-4/+4
|
* 3544Kartik K. Agaram2016-10-221-1/+1
|
* 3543Kartik K. Agaram2016-10-221-1/+1
|
* 3416Kartik K. Agaram2016-09-251-1/+1
|
* 3315Kartik K. Agaram2016-09-101-1/+14
|
* 3102Kartik K. Agaram2016-07-051-1/+1
|
* 2996Kartik K. Agaram2016-05-211-2/+2
|
* 2812Kartik K. Agaram2016-03-271-8/+17
|
* 2744Kartik K. Agaram2016-03-091-4/+4
| | | | Tweak colors and font-sizes in generated html.
* 2743Kartik K. Agaram2016-03-091-19/+11
| | | | | Looks like "TOhtml | <other command>" doesn't work on Mac OS X for some reason..
* 2611Kartik K. Agaram2015-11-291-0/+1
|
* 2062Kartik K. Agaram2015-08-231-5/+4
|
* 1949Kartik K. Agaram2015-08-061-5/+6
|
* 1885Kartik K. Agaram2015-07-291-6/+5
|
* 1853Kartik K. Agaram2015-07-251-5/+6
|
* 1631 - update html versionsKartik K. Agaram2015-06-231-4/+4
| | | | | | Html is a little more readable thanks to feedback from J David Eisenberg (https://news.ycombinator.com/item?id=9766330), in particular the suggestion to use https://addons.mozilla.org/En-us/firefox/addon/wcag-contrast-checker.
* 1556Kartik K. Agaram2015-06-121-1/+1
|
* 1549Kartik K. Agaram2015-06-091-2/+2
|
* 1517Kartik K. Agaram2015-05-301-4/+4
|
* 1461 - descriptions/table of contents for the layersKartik K. Agaram2015-05-261-1/+1
|
* 1459Kartik K. Agaram2015-05-251-1/+1
|
* 1376 - update github docsKartik K. Agaram2015-05-141-10/+15
|
* 1291Kartik K. Agaram2015-05-061-1/+1
|
* 1279 - colorized rendering of the source filesKartik K. Agaram2015-05-061-0/+156
lt;hut@lavabit.com> 2010-09-23 10:58:48 +0200 committer hut <hut@lavabit.com> 2010-09-23 10:58:48 +0200 defaults.apps: Use mimeopen if installed and apps.py fails' href='/akspecs/ranger/commit/ranger/defaults/apps.py?h=v1.9.0b1&id=44a31d6cbaa1031f4a9cef1e2b7778733082bd3d'>44a31d6c ^
4e0ca535 ^
44a31d6c ^
a44749f6 ^
23236d0c ^
e70f8c83 ^
23236d0c ^
b828e4ac ^
cc952d63 ^
d46a05a8 ^
1b0786f2 ^



d46a05a8 ^
1b0786f2 ^

bd0ede8d ^
1b0786f2 ^


d46a05a8 ^
845bd407 ^




d46a05a8 ^
23236d0c ^

b828e4ac ^
cc952d63 ^
23236d0c ^
d46a05a8 ^
23236d0c ^

b828e4ac ^
cc952d63 ^
23236d0c ^
b828e4ac ^
871c502d ^
cc952d63 ^
b828e4ac ^
23236d0c ^
2776bea0 ^





710b0bb7 ^

f173cf99 ^
23236d0c ^
f173cf99 ^


b828e4ac ^

f173cf99 ^
710b0bb7 ^
f173cf99 ^


1ae56f49 ^
b828e4ac ^

23236d0c ^
710b0bb7 ^
f173cf99 ^



10693407 ^



b828e4ac ^

f173cf99 ^
d46a05a8 ^
23236d0c ^


b828e4ac ^

ea87d005 ^
710b0bb7 ^
0dc57267 ^

b828e4ac ^
0dc57267 ^
d46a05a8 ^
845bd407 ^

b828e4ac ^
845bd407 ^
b828e4ac ^
845bd407 ^
b828e4ac ^
ea87d005 ^
d46a05a8 ^
845bd407 ^





b828e4ac ^
ea87d005 ^
710b0bb7 ^
845bd407 ^

b828e4ac ^
a7772cc6 ^
b828e4ac ^
748d0a6a ^
6eb85224 ^


b828e4ac ^
6eb85224 ^


b828e4ac ^
a5e1ccdd ^
710b0bb7 ^
a5e1ccdd ^

710b0bb7 ^
a5e1ccdd ^

b828e4ac ^

710b0bb7 ^




a5e1ccdd ^
710b0bb7 ^
a5e1ccdd ^
710b0bb7 ^

a5e1ccdd ^


748d0a6a ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227














                                                                       



                                                                    
 
             
                             
                                                      
 
                                       


                                                               
 


                                                                    
 
                                           
                                                    
                                                                                   

                                                               
                                                    
                                                               
                                                                   



                                                                                              
                                                
                                                              
                                                                
                                                              


                                                                                          
 

                                                                   
                                                                    

                               
                                                                       


                                      
                                              

                                                                                       
 
                           



                                                                                     
 
                                                                              
                                                       
 

                                                                               
                                                 
 
 
                                                                           
                                                                 
                               
                                      
 
                                



                                                             
                     

                                                             
                                                         


                                                              
 




                                               
                              

                                 
                                                  
 
                                 
                                                                            

                                                                                            
                                   
 
                                 
                                                                 
 
                     
                                           
 





                                                

                                                                               
                                         
                              


                                                                            

                                                              
 
                               


                                                                                 
                                                                                       

                                                                           
 
                                



                                                                                       



                                                                            

                                                                  
 
                              


                                      

                                                           
 
                                       

                                     
                                                 
 
                           

                               
                                     
                               
                                                
                               
                                              
 
                           





                                                                         
                                                       
 
                                 

                               
                                         
                               
                                                         
 


                                  
                                            


                                                         
                                                     
 
 

                                                       
 

                                 

                                




                                                                               
 
                                                                          
                                                                 

                                                              


                                                                     



                                           
# Copyright (C) 2009, 2010  Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

"""
This is the default ranger configuration file for filetype detection
and application handling.
"""

import ranger
from ranger.api.apps import *
from ranger.ext.get_executables import get_executables

class CustomApplications(Applications):
	def app_default(self, c):
		"""How to determine the default application?"""
		f = c.file

		if f.basename.lower() == 'makefile' and c.mode == 1:
			made = self.either(c, 'make')
			if made: return made

		if f.extension is not None:
			if f.extension in ('pdf', ):
				return self.either(c, 'evince', 'zathura', 'apvlv')
			if f.extension == 'djvu':
				return self.either(c, 'evince')
			if f.extension in ('xml', ):
				return self.either(c, 'editor')
			if f.extension in ('html', 'htm', 'xhtml'):
				return self.either(c, 'firefox', 'opera', 'jumanji',
						'luakit', 'elinks', 'lynx')
			if f.extension == 'swf':
				return self.either(c, 'firefox', 'opera', 'jumanji', 'luakit')
			if f.extension == 'nes':
				return self.either(c, 'fceux')
			if f.extension in ('swc', 'smc', 'sfc'):
				return self.either(c, 'zsnes')
			if f.extension in ('odt', 'ods', 'odp', 'odf', 'odg',
					'doc', 'xls'):
				return self.either(c, 'libreoffice', 'soffice', 'ooffice')

		if f.mimetype is not None:
			if INTERPRETED_LANGUAGES.match(f.mimetype):
				return self.either(c, 'edit_or_run')

		if f.container:
			return self.either(c, 'aunpack', 'file_roller')

		if f.video or f.audio:
			if f.video:
				c.flags += 'd'
			return self.either(c, 'mplayer2', 'mplayer', 'smplayer', 'vlc',
					'totem')

		if f.image:
			if c.mode in (11, 12, 13, 14):
				return self.either(c, 'set_bg_with_feh')
			else:
				return self.either(c, 'sxiv', 'feh', 'eog', 'mirage')

		if f.document or f.filetype.startswith('text') or f.size == 0:
			return self.either(c, 'editor')

		# You can put this at the top of the function and mimeopen will
		# always be used for every file.
		return self.either(c, 'mimeopen')


	# ----------------------------------------- application definitions
	# Note: Trivial application definitions are at the bottom
	def app_pager(self, c):
		return 'less', '-R', c

	def app_editor(self, c):
		try:
			default_editor = os.environ['EDITOR']
		except KeyError:
			pass
		else:
			parts = default_editor.split()
			exe_name = os.path.basename(parts[0])
			if exe_name in get_executables():
				return tuple(parts) + tuple(c)

		return self.either(c, 'vim', 'emacs', 'nano')

	def app_edit_or_run(self, c):
		if c.mode is 1:
			return self.app_self(c)
		return self.app_editor(c)

	@depends_on('mplayer')
	def app_mplayer(self, c):
		if c.mode is 1:
			return 'mplayer', '-fs', c

		elif c.mode is 2:
			args = "mplayer -fs -sid 0 -vfm ffmpeg -lavdopts " \
					"lowres=1:fast:skiploopfilter=all:threads=8".split()
			args.extend(c)
			return args

		elif c.mode is 3:
			return 'mplayer', '-mixer', 'software', c

		else:
			return 'mplayer', c

	@depends_on('mplayer2')
	def app_mplayer2(self, c):
		args = list(self.app_mplayer(c))
		args[0] += '2'
		return args

	# A dependence on "X" means: this programs requires a running X server!
	@depends_on('feh', 'X')
	def app_set_bg_with_feh(self, c):
		c.flags += 'd'
		arg = {11: '--bg-scale', 12: '--bg-tile', 13: '--bg-center',
				14: '--bg-fill'}
		if c.mode in arg:
			return 'feh', arg[c.mode], c.file.path
		return 'feh', arg[11], c.file.path

	@depends_on('feh', 'X')
	def app_feh(self, c):
		c.flags += 'd'
		if c.mode is 0 and len(c.files) is 1: # view all files in the cwd
			images = [f.basename for f in self.fm.env.cwd.files if f.image]
			return 'feh', '--start-at', c.file.basename, images
		return 'feh', c

	@depends_on('sxiv', 'X')
	def app_sxiv(self, c):
		c.flags = 'd' + c.flags
		if len(c.files) is 1:
			images = [f.basename for f in self.fm.env.cwd.files if f.image]
			try:
				position = images.index(c.file.basename) + 1
			except:
				return None
			return 'sxiv', '-n', str(position), images
		return 'sxiv', c

	@depends_on('aunpack')
	def app_aunpack(self, c):
		if c.mode is 0:
			c.flags += 'p'
			return 'aunpack', '-l', c.file.path
		return 'aunpack', c.file.path

	@depends_on('file-roller', 'X')
	def app_file_roller(self, c):
		c.flags += 'd'
		return 'file-roller', c.file.path

	@depends_on('make')
	def app_make(self, c):
		if c.mode is 0:
			return "make"
		if c.mode is 1:
			return "make", "install"
		if c.mode is 2:
			return "make", "clear"

	@depends_on('java')
	def app_java(self, c):
		def strip_extensions(file):
			if '.' in file.basename:
				return file.path[:file.path.index('.')]
			return file.path
		files_without_extensions = map(strip_extensions, c.files)
		return "java", files_without_extensions

	@depends_on('totem', 'X')
	def app_totem(self, c):
		if c.mode is 0:
			return "totem", c
		if c.mode is 1:
			return "totem", "--fullscreen", c

	@depends_on('mimeopen')
	def app_mimeopen(self, c):
		if c.mode is 0:
			return "mimeopen", c
		if c.mode is 1: 
			# Will ask user to select program
			# aka "Open with..."
			return "mimeopen", "--ask", c


# Often a programs invocation is trivial.  For example:
#    vim test.py readme.txt [...]
#
# This could be implemented like:
#    @depends_on("vim")
#    def app_vim(self, context):
#        return "vim", context
#
# But this is redundant and ranger does this automatically.  However, sometimes
# you want to change some properties like flags or dependencies.  Add programs
# that should only run in X this way here:
CustomApplications.generic('fceux', 'wine', 'zsnes', deps=['X'])

# Add those which should only run in X AND should be detached/forked here:
CustomApplications.generic('opera', 'firefox', 'apvlv', 'evince',
		'zathura', 'gimp', 'mirage', 'eog', 'jumanji',
			flags='d', deps=['X'])

# What filetypes are recognized as scripts for interpreted languages?
# This regular expression is used in app_default()
INTERPRETED_LANGUAGES = re.compile(r'''
	^(text|application)/x-(
		haskell|perl|python|ruby|sh
	)$''', re.VERBOSE)