remi-syntax-on 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO +3 -1
- data/lib/syntax-on/browser.rb +14 -0
- data/lib/syntax-on.rb +1 -1
- metadata +1 -1
data/TODO
CHANGED
@@ -1,2 +1,4 @@
|
|
1
1
|
* add caching features, specifically for the browser ... it should only re-render files if their content has changed
|
2
|
-
* make the browser's file/directory browser pretty, not the Dir[] hack that it is now
|
2
|
+
* make the browser's file/directory browser pretty, not the Dir[] hack that it is now ... try basing it on Redmine or Trac's source browser interface ... I'd suggest using Redmine's and giving credit, where due, to jplang ... so long as the browser uses the GPL or AGPL, it's all good (Redmine is GPL'd) ... just don't use it in the 'library,' which I intend on LGPLing
|
3
|
+
* add Windows support, if gvim.exe is in the PATH - also, check the default path that GVim installs to in Windows.
|
4
|
+
* Update documentation with howto add your own themes, etc
|
data/lib/syntax-on/browser.rb
CHANGED
@@ -42,6 +42,18 @@ class SyntaxOn::Browser
|
|
42
42
|
'<ul>' + Dir['**/*'].map { |file_or_dir| %{<li><a href="/#{file_or_dir}">#{file_or_dir}</a></li>} }.join + '</ul>'
|
43
43
|
end
|
44
44
|
|
45
|
+
def line_number_switcher_link
|
46
|
+
<<HTML
|
47
|
+
<a href="#" onclick="javascript:for each(var span in document.getElementsByClassName('lnr')){ (span.style.display == 'none') ? span.style.display = 'inline' : span.style.display = 'none'; }">toggle line numbers</a>
|
48
|
+
HTML
|
49
|
+
end
|
50
|
+
|
51
|
+
def line_number_remover
|
52
|
+
<<HTML
|
53
|
+
<a href="#" onclick="javascript:var num_line_numbers = document.getElementsByClassName('lnr').length; for(var i=0; i<num_line_numbers; i++){ document.getElementsByTagName('pre')[0].removeChild( document.getElementsByClassName('lnr')[0] ); }">remove line numbers (for copying)</a>
|
54
|
+
HTML
|
55
|
+
end
|
56
|
+
|
45
57
|
def theme_selector
|
46
58
|
<<HTML
|
47
59
|
<select id="theme-selector" onchange="javascript:window.location = window.location.toString().replace(/\\?.*/,'') + '?theme=' + document.getElementById('theme-selector').value">
|
@@ -66,6 +78,8 @@ HTML
|
|
66
78
|
<body>
|
67
79
|
<h1>#{ @request.path_info }</h1>
|
68
80
|
#{ theme_selector }
|
81
|
+
#{ line_number_switcher_link }
|
82
|
+
#{ line_number_remover }
|
69
83
|
<hr />
|
70
84
|
<pre>
|
71
85
|
#{ code }
|
data/lib/syntax-on.rb
CHANGED
@@ -12,7 +12,7 @@ end
|
|
12
12
|
class SyntaxOn
|
13
13
|
|
14
14
|
VIM_BIN = 'vim'
|
15
|
-
VIM_OPTIONS = [ "syntax on" ]
|
15
|
+
VIM_OPTIONS = [ "syntax on", "let html_use_css = 1", 'let html_use_encoding = "utf8"', "let use_xhtml = 1" ]
|
16
16
|
VIM_RENDER = [ "exe 'normal zR'", "runtime\\! syntax/2html.vim", "wq", "q" ]
|
17
17
|
TEMP_DIRECTORY = '/tmp/syntax-on'
|
18
18
|
TEMP_FILENAME = lambda { Time.now.strftime '%Y-%d-%m_%Hh-%Mm-%Ss' }
|