snipper 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ body {
2
+ background-color:#eeeeee;
3
+ font-family:Arial, Helvetica, sans-serif;
4
+ font-color:#222222;
5
+ }
6
+
7
+ .code {
8
+ background-color:#2b2b2b;
9
+ }
10
+
11
+ .linenos {
12
+ background-color:#2b2b2b;
13
+ padding-right: 10px;
14
+ text-align: right;
15
+ color: #f8f8f2;
16
+ width: 30px;
17
+ }
18
+
19
+ pre { background-color:#2b2b2b; }
20
+
21
+ .highlighttable {
22
+ background-color: #2b2b2b; width:100%;
23
+ -moz-border-radius: 5px;
24
+ -webkit-border-radius:5px;
25
+ border-radius: 5px;
26
+ }
27
+
28
+ .content { width: 100%;}
29
+
30
+ .highlight { background-color: #0C1000; color: red }
31
+
32
+ .button-link {
33
+ padding: 2px 10px;
34
+ background: #4479BA;
35
+ color: #FFF;
36
+ -webkit-border-radius: 4px;
37
+ -moz-border-radius: 4px;
38
+ border-radius: 4px;
39
+ border: solid 1px #20538D;
40
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
41
+ -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
42
+ -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
43
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
44
+ -webkit-transition-duration: 0.2s;
45
+ -moz-transition-duration: 0.2s;
46
+ transition-duration: 0.2s;
47
+ -webkit-user-select:none;
48
+ -moz-user-select:none;
49
+ -ms-user-select:none;
50
+ user-select:none;
51
+ }
52
+
53
+ .button-link:hover {
54
+ background: #356094;
55
+ border: solid 1px #2A4E77;
56
+ text-decoration: none;
57
+ }
58
+
59
+ .button-link:active {
60
+ -webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
61
+ -moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
62
+ box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
63
+ background: #2E5481;
64
+ border: solid 1px #203E5F;
65
+ }
66
+
67
+ .right { float: right; margin-top: 3px; margin-right: 3px; margin-bottom:15px; }
68
+
69
+ .left { float: left; margin-top: 3px; margin-left: 3px; margin-bottom:15px; }
70
+
71
+
@@ -0,0 +1,70 @@
1
+ body {
2
+ background-color:#cccccc;
3
+ font-family:Arial, Helvetica, sans-serif;
4
+ font-color:#222222;
5
+ }
6
+
7
+ .code {
8
+ background-color:#eeeeee;
9
+ }
10
+
11
+ .linenos {
12
+ background-color:#eeeeee;
13
+ padding-right: 10px;
14
+ text-align: right;
15
+ color: DarkGray;
16
+ width: 30px;
17
+ }
18
+
19
+ pre { background-color:#eeeeee; }
20
+
21
+ .highlighttable {
22
+ background-color: #eeeeee; width:100%;
23
+ -moz-border-radius: 5px;
24
+ -webkit-border-radius:5px;
25
+ border-radius: 5px;
26
+ }
27
+
28
+ .content { width: 100%;}
29
+
30
+ .highlight { background-color: #0C1000; color: red }
31
+
32
+ .button-link {
33
+ padding: 2px 10px;
34
+ background: #4479BA;
35
+ color: #FFF;
36
+ -webkit-border-radius: 4px;
37
+ -moz-border-radius: 4px;
38
+ border-radius: 4px;
39
+ border: solid 1px #20538D;
40
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
41
+ -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
42
+ -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
43
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);
44
+ -webkit-transition-duration: 0.2s;
45
+ -moz-transition-duration: 0.2s;
46
+ transition-duration: 0.2s;
47
+ -webkit-user-select:none;
48
+ -moz-user-select:none;
49
+ -ms-user-select:none;
50
+ user-select:none;
51
+ }
52
+
53
+ .button-link:hover {
54
+ background: #356094;
55
+ border: solid 1px #2A4E77;
56
+ text-decoration: none;
57
+ }
58
+
59
+ .button-link:active {
60
+ -webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
61
+ -moz-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
62
+ box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);
63
+ background: #2E5481;
64
+ border: solid 1px #203E5F;
65
+ }
66
+
67
+ .right { float: right; margin-top: 3px; margin-right: 3px; margin-bottom:15px; }
68
+
69
+ .left { float: left; margin-top: 3px; margin-left: 3px; margin-bottom:15px; }
70
+
@@ -12,6 +12,8 @@ class Snipper
12
12
  def save
13
13
  theme = Config[:theme] || "default"
14
14
 
15
+ basecss = Config[:dark_theme] ? 'darkbg' : 'lightbg'
16
+
15
17
  raise "Please set the :public_target_dir setting" unless Config[:public_target_dir]
16
18
 
17
19
  path = @snippet.snippet_html_path
@@ -19,27 +21,21 @@ class Snipper
19
21
  FileUtils.mkdir_p(path)
20
22
 
21
23
  File.open(File.join(path, "index.html"), "w") do |html|
24
+ html.puts "<!DOCTYPE html>"
25
+ html.puts "<html>"
22
26
  html.puts "<head>"
23
- html.puts "<link rel='stylesheet' type='text/css' href='../css/#{theme}.css' media='all' />"
24
- html.puts "<style type='text/css'>"
25
- html.puts ".highlighttable { background-color: #253B76; width: 100%;}"
26
- html.puts ".content { width: 100%;}"
27
- html.puts ".linenos { text-align: right; color: white; width: 30px; }"
28
-
29
- if Config[:dark_theme]
30
- html.puts ".highlight { background-color: #0C1000; color: white }"
31
- else
32
- html.puts ".highlight { background-color: white; color: black }"
33
- end
34
-
35
- html.puts "</style>"
27
+ html.puts ' <meta charset="UTF-8">'
28
+ html.puts " <title>Snippets</title>"
29
+ html.puts " <link rel='stylesheet' type='text/css' href='../css/#{theme}.css' media='all' />"
30
+ html.puts " <link rel='stylesheet' type='text/css' href='../css/#{basecss}.css' media='all' />"
36
31
  html.puts "</head>"
32
+
37
33
  html.puts "<body>"
38
34
 
39
- html.puts "<table class='content'>"
40
- html.puts "<tr><td>"
41
35
 
42
36
  @snippet.each_file do |file, text, headers|
37
+ html.puts " <table class='content'>"
38
+ html.puts " <tr><td>"
43
39
  File.open(File.join(path, "#{File.basename(file)}.raw"), "w") do |f|
44
40
  f.puts text
45
41
  end
@@ -58,17 +54,25 @@ class Snipper
58
54
 
59
55
  raise "Unknown syntax #{syntax}" unless self.class.list_langs.include?(syntax)
60
56
 
57
+ html.puts
61
58
 
62
- html.puts "<H2>%s</H2>" % [ headers["description"] ] if headers["description"]
59
+ html.puts " <h3>%s</h3>" % [ headers["description"] ] if headers["description"]
63
60
  html.puts Pygments.highlight(text, :lexer => syntax, :options => {:linenos => "table", :style => theme})
64
- html.puts "syntax: %s download: <a href='%s.raw'>raw</a>" % [ syntax, File.basename(file) ]
65
- html.puts "<br /><br />"
61
+
62
+ html.puts " </td></tr>"
63
+ html.puts " </table>"
64
+
65
+ html.puts " <div class='left'>"
66
+ html.puts " <a class='button-link' href='%s.raw'>raw</a> download - Syntax : %s " % [ File.basename(file), syntax ]
67
+ html.puts " </div>"
66
68
  end
67
69
 
68
- html.puts "</td></tr>"
69
- html.puts "<tr align='right'><td><a href='%s'>Snipper</a></td></tr>" % [ "http://github.com/ripienaar/snipper" ]
70
- html.puts "</table>"
70
+ html.puts " <div class='right'>"
71
+ html.puts " <a class='button-link' href='%s'>Snipper</a>" % [ "http://github.com/ripienaar/snipper" ]
72
+ html.puts " </div>"
73
+
71
74
  html.puts "</body>"
75
+ html.puts "</html>"
72
76
  end
73
77
  end
74
78
  end
@@ -1,3 +1,3 @@
1
1
  class Snipper
2
- VERSION="0.0.5"
2
+ VERSION="0.0.6"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snipper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - R.I.Pienaar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-31 00:00:00 +01:00
18
+ date: 2012-11-06 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -90,6 +90,8 @@ files:
90
90
  - lib/snipper/version.rb
91
91
  - lib/snipper/util.rb
92
92
  - lib/snipper.rb
93
+ - css/lightbg.css
94
+ - css/darkbg.css
93
95
  has_rdoc: true
94
96
  homepage: http://devco.net/
95
97
  licenses: []