octopress-code-highlighter 3.1.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/octopress-code-highlighter.rb +6 -16
- data/lib/octopress-code-highlighter/renderer.rb +6 -1
- data/lib/octopress-code-highlighter/version.rb +1 -1
- data/octopress-code-highlighter.gemspec +0 -1
- metadata +2 -19
- data/assets/stylesheets/_code-style.scss +0 -103
- data/assets/stylesheets/_solarized.scss +0 -58
- data/assets/stylesheets/code.scss +0 -156
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d735422e3324ead88b068fe845d4709639937a8d
|
4
|
+
data.tar.gz: b2a2478389f20fdf6dcb7a124f6654617588940e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8580566712e1acd5d3500ca9def1b1042c402947048509d2ed5c28388006246ffd88ba5ce5b04a400035295fb4e4f0025805157d54d3cf73e6eacad6ea6f150
|
7
|
+
data.tar.gz: 2252aaa56e019095cfb53f255521c18041cf51d280f05bcfbc49fa19ce8f2602589900bd7509d51ae000425ab57c941f426c64bf8e25a5248a15f840035b238b
|
data/CHANGELOG.md
CHANGED
@@ -3,7 +3,12 @@ require 'fileutils'
|
|
3
3
|
require 'digest/md5'
|
4
4
|
|
5
5
|
require 'colorator'
|
6
|
-
|
6
|
+
|
7
|
+
begin require 'octopress'
|
8
|
+
rescue LoadError; end
|
9
|
+
|
10
|
+
begin require 'octopress-ink'
|
11
|
+
rescue LoadError; end
|
7
12
|
|
8
13
|
module Octopress
|
9
14
|
module CodeHighlighter
|
@@ -47,18 +52,3 @@ module Octopress
|
|
47
52
|
end
|
48
53
|
end
|
49
54
|
|
50
|
-
class CodeHighlighter < Octopress::Ink::Plugin
|
51
|
-
def initialize(name, type)
|
52
|
-
@assets_path = File.expand_path(File.join(File.dirname(__FILE__), '../assets'))
|
53
|
-
@version = Octopress::CodeHighlighter::VERSION
|
54
|
-
@description = "For beautiful code snippets."
|
55
|
-
super
|
56
|
-
end
|
57
|
-
|
58
|
-
def add_assets
|
59
|
-
add_sass 'code.scss'
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
Octopress::Ink.register_plugin(CodeHighlighter, 'octopress-code-highlighter', 'plugin')
|
64
|
-
|
@@ -7,7 +7,12 @@ module Octopress
|
|
7
7
|
@code = code
|
8
8
|
@options = options.delete_if { |k,v| v.nil? }
|
9
9
|
@options = DEFAULTS.merge(@options)
|
10
|
-
|
10
|
+
if defined? Octopress.config
|
11
|
+
@aliases = Octopress.config['code_aliases']
|
12
|
+
elsif defined? Ink
|
13
|
+
@aliases = Ink.config['code_aliases']
|
14
|
+
end
|
15
|
+
@aliases ||= stringify_keys(@options[:aliases] || {})
|
11
16
|
@lang = @options[:lang]
|
12
17
|
@options[:title] ||= ' ' if @options[:url]
|
13
18
|
@renderer = select_renderer
|
@@ -14,7 +14,6 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.license = "MIT"
|
15
15
|
|
16
16
|
gem.add_runtime_dependency 'colorator', '~> 0.1.0'
|
17
|
-
gem.add_runtime_dependency 'octopress-ink', '>= 1.0.0.alpha.33'
|
18
17
|
|
19
18
|
gem.add_development_dependency 'pry-debugger'
|
20
19
|
gem.add_development_dependency 'rake'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-code-highlighter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorator
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.1.0
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: octopress-ink
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.0.alpha.33
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - '>='
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0.0.alpha.33
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: pry-debugger
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,9 +95,6 @@ files:
|
|
109
95
|
- LICENSE.txt
|
110
96
|
- README.md
|
111
97
|
- Rakefile
|
112
|
-
- assets/stylesheets/_code-style.scss
|
113
|
-
- assets/stylesheets/_solarized.scss
|
114
|
-
- assets/stylesheets/code.scss
|
115
98
|
- lib/octopress-code-highlighter.rb
|
116
99
|
- lib/octopress-code-highlighter/cache.rb
|
117
100
|
- lib/octopress-code-highlighter/options_parser.rb
|
@@ -1,103 +0,0 @@
|
|
1
|
-
%octopress-diff-bg {
|
2
|
-
content: "";
|
3
|
-
position: absolute;
|
4
|
-
z-index: -1;
|
5
|
-
left: 0; right: 0; top: 0; bottom: 0;
|
6
|
-
}
|
7
|
-
|
8
|
-
@mixin octopress-diff-bg($bg) {
|
9
|
-
&:after {
|
10
|
-
background: $bg;
|
11
|
-
@extend %octopress-diff-bg;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
15
|
-
.code-highlight {
|
16
|
-
border: 1px solid $code-highlight-border;
|
17
|
-
background: $pre-bg;
|
18
|
-
color: $base1;
|
19
|
-
span { color: $base1; }
|
20
|
-
span { font-style: normal; font-weight: normal; }
|
21
|
-
|
22
|
-
.c { color: $base01; font-style: italic; } /* Comment */
|
23
|
-
.cm { color: $base01; font-style: italic; } /* Comment.Multiline */
|
24
|
-
.cp { color: $base01; font-style: italic; } /* Comment.Preproc */
|
25
|
-
.c1 { color: $base01; font-style: italic; } /* Comment.Single */
|
26
|
-
.cs { /* Comment.Special */
|
27
|
-
color: $base01;
|
28
|
-
font-weight: bold;
|
29
|
-
font-style: italic; }
|
30
|
-
.err { color: $solar-red; background: none; } /* Error */
|
31
|
-
.k { color: $solar-orange; } /* Keyword */
|
32
|
-
.o { color: $base1; font-weight: bold; } /* Operator */
|
33
|
-
.p { color: $base1; } /* Operator */
|
34
|
-
.ow { color: $solar-cyan; font-weight: bold; } /* Operator.Word */
|
35
|
-
.gd {
|
36
|
-
color: $base1; /* Generic.Deleted */
|
37
|
-
@include octopress-diff-bg(mix($solar-red, $base03, 25%));
|
38
|
-
}
|
39
|
-
.gd .x { /* Generic.Deleted.Specific */
|
40
|
-
color: $base1;
|
41
|
-
@include octopress-diff-bg(mix($solar-red, $base03, 35%));
|
42
|
-
}
|
43
|
-
.ge { /* Generic.Emph */
|
44
|
-
color: $base1;
|
45
|
-
font-style: italic; }
|
46
|
-
//.gr { color: #aa0000 } /* Generic.Error */
|
47
|
-
.gh { color: $base01; } /* Generic.Heading */
|
48
|
-
.gi { /* Generic.Inserted */
|
49
|
-
color: $base1;
|
50
|
-
@include octopress-diff-bg(mix($solar-green, $base03, 20%));
|
51
|
-
}
|
52
|
-
.gi .x { /* Generic.Inserted.Specific */
|
53
|
-
color: $base1;
|
54
|
-
@include octopress-diff-bg(mix($solar-green, $base03, 40%));
|
55
|
-
}
|
56
|
-
//.go { color: #888888 } /* Generic.Output */
|
57
|
-
//.gp { color: #555555 } /* Generic.Prompt */
|
58
|
-
.gs { color: $base1; font-weight: bold; } /* Generic.Strong */
|
59
|
-
.gu { color: $solar-violet; } /* Generic.Subheading */
|
60
|
-
//.gt { color: #aa0000 } /* Generic.Traceback */
|
61
|
-
.kc { color: $solar-green; font-weight: bold; } /* Keyword.Constant */
|
62
|
-
.kd { color: $solar-blue; } /* Keyword.Declaration */
|
63
|
-
.kp { color: $solar-orange; font-weight: bold; } /* Keyword.Pseudo */
|
64
|
-
.kr { color: $solar-magenta; font-weight: bold; } /* Keyword.Reserved */
|
65
|
-
.kt { color: $solar-cyan; } /* Keyword.Type */
|
66
|
-
.n { color: $solar-blue; }
|
67
|
-
.na { color: $solar-blue; } /* Name.Attribute */
|
68
|
-
.nb { color: $solar-green; } /* Name.Builtin */
|
69
|
-
.nc { color: $solar-magenta;} /* Name.Class */
|
70
|
-
.no { color: $solar-yellow; } /* Name.Constant */
|
71
|
-
//.ni { color: #800080 } /* Name.Entity */
|
72
|
-
.nl { color: $solar-green; }
|
73
|
-
.ne { color: $solar-blue; font-weight: bold; } /* Name.Exception */
|
74
|
-
.nf { color: $solar-blue; font-weight: bold; } /* Name.Function */
|
75
|
-
.nn { color: $solar-yellow; } /* Name.Namespace */
|
76
|
-
.nt { color: $solar-blue; font-weight: bold; } /* Name.Tag */
|
77
|
-
.nx { color: $solar-yellow; }
|
78
|
-
//.bp { color: #999999 } /* Name.Builtin.Pseudo */
|
79
|
-
//.vc { color: #008080 } /* Name.Variable.Class */
|
80
|
-
.vg { color: $solar-blue; } /* Name.Variable.Global */
|
81
|
-
.vi { color: $solar-blue; } /* Name.Variable.Instance */
|
82
|
-
.nv { color: $solar-blue; } /* Name.Variable */
|
83
|
-
//.w { color: #bbbbbb } /* Text.Whitespace */
|
84
|
-
.mf { color: $solar-cyan; } /* Literal.Number.Float */
|
85
|
-
.m { color: $solar-cyan; } /* Literal.Number */
|
86
|
-
.mh { color: $solar-cyan; } /* Literal.Number.Hex */
|
87
|
-
.mi { color: $solar-cyan; } /* Literal.Number.Integer */
|
88
|
-
//.mo { color: #009999 } /* Literal.Number.Oct */
|
89
|
-
.s { color: $solar-cyan; } /* Literal.String */
|
90
|
-
//.sb { color: #d14 } /* Literal.String.Backtick */
|
91
|
-
//.sc { color: #d14 } /* Literal.String.Char */
|
92
|
-
.sd { color: $solar-cyan; } /* Literal.String.Doc */
|
93
|
-
.s2 { color: $solar-cyan; } /* Literal.String.Double */
|
94
|
-
.se { color: $solar-red; } /* Literal.String.Escape */
|
95
|
-
//.sh { color: #d14 } /* Literal.String.Heredoc */
|
96
|
-
.si { color: $solar-blue; } /* Literal.String.Interpol */
|
97
|
-
//.sx { color: #d14 } /* Literal.String.Other */
|
98
|
-
.sr { color: $solar-cyan; } /* Literal.String.Regex */
|
99
|
-
.s1 { color: $solar-cyan; } /* Literal.String.Single */
|
100
|
-
//.ss { color: #990073 } /* Literal.String.Symbol */
|
101
|
-
//.il { color: #009999 } /* Literal.Number.Integer.Long */
|
102
|
-
}
|
103
|
-
|
@@ -1,58 +0,0 @@
|
|
1
|
-
$base03: #002b36 !default; //darkest blue
|
2
|
-
$base02: #073642 !default; //dark blue
|
3
|
-
$base01: #586e75 !default; //darkest gray
|
4
|
-
$base00: #657b83 !default; //dark gray
|
5
|
-
$base0: #839496 !default; //medium gray
|
6
|
-
$base1: #93a1a1 !default; //medium light gray
|
7
|
-
$base2: #f2f2f2 !default; //very light gray
|
8
|
-
$base3: #ffffff !default; //white
|
9
|
-
$solar-yellow: #b58900 !default;
|
10
|
-
$solar-orange: #cb4b16 !default;
|
11
|
-
$solar-red: #dc322f !default;
|
12
|
-
$solar-magenta: #d33682 !default;
|
13
|
-
$solar-violet: #6c71c4 !default;
|
14
|
-
$solar-blue: #268bd2 !default;
|
15
|
-
$solar-cyan: #2aa198 !default;
|
16
|
-
$solar-green: #859900 !default;
|
17
|
-
|
18
|
-
$marker: rgba(#00baff, .5) !default;
|
19
|
-
$marker-bg: rgba($marker, .13) !default;
|
20
|
-
$marker-border: rgba($marker, .13) !default;
|
21
|
-
$marker-border-left: $marker !default;
|
22
|
-
|
23
|
-
$solarized: light;// !default;
|
24
|
-
|
25
|
-
$solar-scroll-bg: rgba(#fff, .15);
|
26
|
-
$solar-scroll-thumb: rgba(#fff, .2);
|
27
|
-
|
28
|
-
@if $solarized == light {
|
29
|
-
|
30
|
-
$_base03: $base03 !global;
|
31
|
-
$_base02: $base02 !global;
|
32
|
-
$_base01: $base01 !global;
|
33
|
-
$_base00: $base00 !global;
|
34
|
-
$_base0: $base0 !global;
|
35
|
-
$_base1: $base1 !global;
|
36
|
-
$_base2: $base2 !global;
|
37
|
-
$_base3: $base3 !global;
|
38
|
-
|
39
|
-
$base03: $_base3 !global;
|
40
|
-
$base02: $_base2 !global;
|
41
|
-
$base01: $_base1 !global;
|
42
|
-
$base00: $_base0 !global;
|
43
|
-
$base0: $_base00 !global;
|
44
|
-
$base1: $_base01 !global;
|
45
|
-
$base2: $_base02 !global;
|
46
|
-
$base3: $_base03 !global;
|
47
|
-
|
48
|
-
$solar-scroll-bg: rgba(#000, .15) !global;
|
49
|
-
$solar-scroll-thumb: rgba(#000, .15) !global;
|
50
|
-
|
51
|
-
$marker-bg: rgba($marker, .05) !global;
|
52
|
-
}
|
53
|
-
|
54
|
-
$pre-bg: $base03 !default;
|
55
|
-
$pre-border: darken($base02, 5) !default;
|
56
|
-
$pre-color: $base1 !default;
|
57
|
-
$code-highlight-border: $pre-border;
|
58
|
-
|
@@ -1,156 +0,0 @@
|
|
1
|
-
@import 'solarized';
|
2
|
-
@import 'code-style';
|
3
|
-
|
4
|
-
.code-highlight-figure {
|
5
|
-
font-size: 13px;
|
6
|
-
* { box-sizing: border-box; }
|
7
|
-
}
|
8
|
-
|
9
|
-
.code-highlight-pre {
|
10
|
-
background: darken($base03, 1);
|
11
|
-
width: 100%;
|
12
|
-
margin-bottom: 0;
|
13
|
-
display: table;
|
14
|
-
}
|
15
|
-
|
16
|
-
$pre-line-padding: .8em;
|
17
|
-
|
18
|
-
.code-highlight-row {
|
19
|
-
display: table-row;
|
20
|
-
width: 100%;
|
21
|
-
}
|
22
|
-
|
23
|
-
.code-highlight-row {
|
24
|
-
&:before, .code-highlight-line {
|
25
|
-
padding: {left: $pre-line-padding + .8; right: $pre-line-padding + .8 }
|
26
|
-
}
|
27
|
-
&:first-child {
|
28
|
-
&:before, .code-highlight-line { padding-top: $pre-line-padding; }
|
29
|
-
}
|
30
|
-
&:last-child {
|
31
|
-
&:before, .code-highlight-line { padding-bottom: $pre-line-padding; }
|
32
|
-
}
|
33
|
-
&.numbered {
|
34
|
-
&:before, .code-highlight-line {
|
35
|
-
padding: {left: $pre-line-padding; right: $pre-line-padding }
|
36
|
-
}
|
37
|
-
&:before {
|
38
|
-
display: table-cell;
|
39
|
-
content: attr(data-line);
|
40
|
-
min-width: 1.2em;
|
41
|
-
color: $base01;
|
42
|
-
text-align: right;
|
43
|
-
line-height: 1.45em;
|
44
|
-
@if $solarized == light {
|
45
|
-
background: lighten($base03, 1);
|
46
|
-
border-right: 1px solid darken($base02, 2);
|
47
|
-
text-shadow: lighten($base02, 2) 0 -1px;
|
48
|
-
} @else {
|
49
|
-
background: $base02;
|
50
|
-
border-right: 1px solid darken($base03, 2);
|
51
|
-
box-shadow: lighten($base02, 2) -1px 0 inset;
|
52
|
-
text-shadow: darken($base02, 10) 0 -1px;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
.code-highlight-line {
|
59
|
-
display: table-cell;
|
60
|
-
width: 100%;
|
61
|
-
position: relative;
|
62
|
-
z-index: 1;
|
63
|
-
}
|
64
|
-
|
65
|
-
.marked-line {
|
66
|
-
position: relative;
|
67
|
-
&.unnumbered {
|
68
|
-
}
|
69
|
-
.code-highlight-line {
|
70
|
-
&:before {
|
71
|
-
content: "";
|
72
|
-
position: absolute;
|
73
|
-
background: $marker-bg;
|
74
|
-
left: 0; top: 0; bottom: 0; right: 0;
|
75
|
-
border-right: 1px solid $marker-border;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
&.unnumbered .code-highlight-line:before {
|
79
|
-
border-left: 3px solid $marker-border-left;
|
80
|
-
}
|
81
|
-
&.numbered:before {
|
82
|
-
background: $marker-bg;
|
83
|
-
border-left: 3px solid $marker-border-left;
|
84
|
-
border-right-color: darken($marker-bg, 20);
|
85
|
-
}
|
86
|
-
}
|
87
|
-
|
88
|
-
.start-marked-line {
|
89
|
-
&:before, .code-highlight-line:before {
|
90
|
-
border-top: 1px solid $marker-border;
|
91
|
-
}
|
92
|
-
}
|
93
|
-
.end-marked-line {
|
94
|
-
&:before, .code-highlight-line:before {
|
95
|
-
border-bottom: 1px solid $marker-border;
|
96
|
-
}
|
97
|
-
}
|
98
|
-
|
99
|
-
.code-highlight {
|
100
|
-
overflow: scroll;
|
101
|
-
overflow-y: hidden;
|
102
|
-
overflow-x: auto;
|
103
|
-
line-height: 1.45em;
|
104
|
-
}
|
105
|
-
|
106
|
-
.code-highlight-table {
|
107
|
-
margin-bottom: 0;
|
108
|
-
background: $base03;
|
109
|
-
pre {
|
110
|
-
padding: .8em;
|
111
|
-
background: none;
|
112
|
-
border-radius: 0;
|
113
|
-
border: none;
|
114
|
-
margin-bottom: 0;
|
115
|
-
}
|
116
|
-
}
|
117
|
-
|
118
|
-
.code-highlight-figure {
|
119
|
-
margin: {left: 0; right: 0;}
|
120
|
-
background: none;
|
121
|
-
padding: 0;
|
122
|
-
border: 0;
|
123
|
-
pre { margin-bottom: 0; }
|
124
|
-
}
|
125
|
-
|
126
|
-
.code-highlight-caption {
|
127
|
-
position: relative;
|
128
|
-
text-align: center;
|
129
|
-
line-height: 2em;
|
130
|
-
text-shadow: #fff 0 1px 0;
|
131
|
-
color: #474747;
|
132
|
-
font-weight: normal;
|
133
|
-
margin-bottom: 0;
|
134
|
-
background-color: #ccc;
|
135
|
-
background-image: linear-gradient(#ffffff, #f0f0f0 6%, #e5e5e5 90%, #e5e5e5);
|
136
|
-
border-top-left-radius: 5px;
|
137
|
-
border-top-right-radius: 5px;
|
138
|
-
font-family: "Helvetica Neue", Arial, "Lucida Grande", "Lucida Sans Unicode", Lucida, sans-serif;
|
139
|
-
border: 1px solid #cbcbcb;
|
140
|
-
+ .code-highlight { border-top: 0; }
|
141
|
-
}
|
142
|
-
|
143
|
-
.code-highlight-caption-link {
|
144
|
-
position: absolute; right: .8em;
|
145
|
-
color: #666;
|
146
|
-
z-index: 1;
|
147
|
-
text-shadow: #cbcccc 0 1px 0;
|
148
|
-
padding-left: 3em;
|
149
|
-
}
|
150
|
-
|
151
|
-
pre {
|
152
|
-
margin-top: 0;
|
153
|
-
font-size: 13px;
|
154
|
-
font-family: Menlo, Monaco, 'Andale Mono', 'lucida console', 'Courier New', monospace;
|
155
|
-
}
|
156
|
-
|