rails_markitup 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -11,6 +11,10 @@ Rails3.0.8+/Ruby1.8.7+
11
11
 
12
12
  ## Usage:
13
13
 
14
+ **you need install pygments**
15
+
16
+ easy_install pygments
17
+
14
18
  a. In Gemfile:
15
19
 
16
20
  gem "redcarpet"
@@ -27,6 +31,10 @@ c. In layout:
27
31
  = stylesheet_link_tag :markitup
28
32
  = javascript_include_tag :markitup
29
33
 
34
+ or you can use another highlight css:
35
+
36
+ = stylesheet_link_tag :markitup_shiny
37
+
30
38
  d. In your textarea , simple\_form\_for exapmle:
31
39
 
32
40
  = form.input :content, :as => :text, :input_html => {:id => 'markdown'}
@@ -41,3 +49,7 @@ f. In your show page:
41
49
 
42
50
  = markdown(@topic.content)
43
51
 
52
+ if you use shiny style
53
+
54
+ = markdown(@topic.content, 'shiny')
55
+
@@ -1,8 +1,10 @@
1
1
  module MarkitupHelper
2
- def markdown(text)
3
- options = [:hard_wrap, :filter_html, :autolink, :no_intraemphasis, :fenced_code, :gh_blockcode]
4
- syntax_highlighter(Redcarpet.new(text, *options).to_html).html_safe
5
- end
2
+
3
+ def markdown(text, style="bright")
4
+ options = [:hard_wrap, :filter_html, :autolink, :no_intraemphasis, :fenced_code, :gh_blockcode]
5
+ content_tag(:div, :class => "#{style}"){syntax_highlighter(Redcarpet.new(text, *options).to_html).html_safe}
6
+ end
7
+
6
8
 
7
9
  def syntax_highlighter(html)
8
10
  doc = Nokogiri::HTML(html)
@@ -18,10 +18,13 @@ module RailsMarkitup
18
18
  @images.each do |image|
19
19
  copy_file "#{image}", "public/stylesheets/markitup/image/#{image.split('/').last}"
20
20
  end
21
- copy_file "../media/javascripts/jquery.markitup.js", "public/javascripts/markitup/jquery.markitup.js"
22
- copy_file "../media/javascripts/sets/markdown/set.js", "public/javascripts/markitup/sets/markdown/set.js"
23
- copy_file "../media/stylesheets/sets/markdown/style.css", "public/stylesheets/markitup/sets/markdown/style.css"
24
- copy_file "../media/stylesheets/skins/markitup/style.css", "public/stylesheets/markitup/skins/markdown/style.css"
21
+ copy_file "../media/javascripts/jquery.markitup.js", "public/javascripts/markitup/jquery.markitup.js"
22
+ copy_file "../media/javascripts/sets/markdown/set.js", "public/javascripts/markitup/sets/markdown/set.js"
23
+ copy_file "../media/stylesheets/sets/markdown/style.css", "public/stylesheets/markitup/sets/markdown/style.css"
24
+ copy_file "../media/stylesheets/skins/markitup/style.css", "public/stylesheets/markitup/skins/markdown/style.css"
25
+ copy_file "../media/stylesheets/skins/markitup/bright.css", "public/stylesheets/markitup/skins/markdown/bright.css"
26
+ copy_file "../media/stylesheets/skins/markitup/pygments.css", "public/stylesheets/markitup/skins/markdown/pygments.css"
27
+ copy_file "../media/stylesheets/skins/markitup/shiny.css", "public/stylesheets/markitup/skins/markdown/shiny.css"
25
28
  end
26
29
  end
27
30
 
@@ -0,0 +1,69 @@
1
+ /* ================================= */
2
+ /* = Common Stuff for all Commands = */
3
+ /* ================================= */
4
+
5
+ .bright {
6
+ background: #FFF;
7
+ color: #000;
8
+ }
9
+ .bright a {
10
+ color: #0D2681;
11
+ }
12
+
13
+ .bright h1 {
14
+ text-shadow: #DDDDDD 3px 3px 5px;
15
+ color: #333;
16
+ }
17
+ .bright h2 {
18
+ color: #222;
19
+ text-shadow: #DDDDDD 3px 3px 5px;
20
+ }
21
+ .bright h3 {
22
+ color: #333;
23
+ text-shadow: #DDDDDD 3px 3px 5px;
24
+ }
25
+ .bright h4 {
26
+ color: #666;
27
+ }
28
+
29
+ .bright blockquote {
30
+ border-left: 4px solid #E6E5DD;
31
+ }
32
+ .bright code {
33
+ color: #1C360C;
34
+ }
35
+
36
+ .bright pre {
37
+ background-color: #f0f0f0;
38
+ border: 1px solid #cccbba;
39
+ }
40
+
41
+ .bright .pro_table {
42
+ border-top: 1px solid #919699;
43
+ border-left: 1px solid #919699;
44
+ }
45
+ .bright .pro_table th {
46
+ background: #E2E2E2;
47
+ border-bottom: 1px solid #919699;
48
+ border-right: 1px solid #919699;
49
+ }
50
+ .bright .pro_table td {
51
+ border-bottom: 1px solid #919699;
52
+ border-right: 1px solid #919699;
53
+ }
54
+ .bright .footnote {
55
+ color: #525151;
56
+ }
57
+ .bright .footnote:before {
58
+ color: #525151;
59
+ }
60
+ .bright .footnote:after {
61
+ color: #525151;
62
+ }
63
+ .bright div.footnotes {
64
+ background: #F0F0F0;
65
+ }
66
+
67
+ .bright .alternate {
68
+ background-color: #F0F0F0;
69
+ }
@@ -0,0 +1,61 @@
1
+ .hll { background-color: #ffffcc }
2
+ .c { color: #408080; font-style: italic } /* Comment */
3
+ .err { border: 1px solid #FF0000 } /* Error */
4
+ .k { color: #008000; font-weight: bold } /* Keyword */
5
+ .o { color: #666666 } /* Operator */
6
+ .cm { color: #408080; font-style: italic } /* Comment.Multiline */
7
+ .cp { color: #BC7A00 } /* Comment.Preproc */
8
+ .c1 { color: #408080; font-style: italic } /* Comment.Single */
9
+ .cs { color: #408080; font-style: italic } /* Comment.Special */
10
+ .gd { color: #A00000 } /* Generic.Deleted */
11
+ .ge { font-style: italic } /* Generic.Emph */
12
+ .gr { color: #FF0000 } /* Generic.Error */
13
+ .gh { color: #000080; font-weight: bold } /* Generic.Heading */
14
+ .gi { color: #00A000 } /* Generic.Inserted */
15
+ .go { color: #808080 } /* Generic.Output */
16
+ .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
17
+ .gs { font-weight: bold } /* Generic.Strong */
18
+ .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
19
+ .gt { color: #0040D0 } /* Generic.Traceback */
20
+ .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
21
+ .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
22
+ .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
23
+ .kp { color: #008000 } /* Keyword.Pseudo */
24
+ .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
25
+ .kt { color: #B00040 } /* Keyword.Type */
26
+ .m { color: #666666 } /* Literal.Number */
27
+ .s { color: #BA2121 } /* Literal.String */
28
+ .na { color: #7D9029 } /* Name.Attribute */
29
+ .nb { color: #008000 } /* Name.Builtin */
30
+ .nc { color: #0000FF; font-weight: bold } /* Name.Class */
31
+ .no { color: #880000 } /* Name.Constant */
32
+ .nd { color: #AA22FF } /* Name.Decorator */
33
+ .ni { color: #999999; font-weight: bold } /* Name.Entity */
34
+ .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
35
+ .nf { color: #0000FF } /* Name.Function */
36
+ .nl { color: #A0A000 } /* Name.Label */
37
+ .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
38
+ .nt { color: #008000; font-weight: bold } /* Name.Tag */
39
+ .nv { color: #19177C } /* Name.Variable */
40
+ .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
41
+ .w { color: #bbbbbb } /* Text.Whitespace */
42
+ .mf { color: #666666 } /* Literal.Number.Float */
43
+ .mh { color: #666666 } /* Literal.Number.Hex */
44
+ .mi { color: #666666 } /* Literal.Number.Integer */
45
+ .mo { color: #666666 } /* Literal.Number.Oct */
46
+ .sb { color: #BA2121 } /* Literal.String.Backtick */
47
+ .sc { color: #BA2121 } /* Literal.String.Char */
48
+ .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
49
+ .s2 { color: #BA2121 } /* Literal.String.Double */
50
+ .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
51
+ .sh { color: #BA2121 } /* Literal.String.Heredoc */
52
+ .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
53
+ .sx { color: #008000 } /* Literal.String.Other */
54
+ .sr { color: #BB6688 } /* Literal.String.Regex */
55
+ .s1 { color: #BA2121 } /* Literal.String.Single */
56
+ .ss { color: #19177C } /* Literal.String.Symbol */
57
+ .bp { color: #008000 } /* Name.Builtin.Pseudo */
58
+ .vc { color: #19177C } /* Name.Variable.Class */
59
+ .vg { color: #19177C } /* Name.Variable.Global */
60
+ .vi { color: #19177C } /* Name.Variable.Instance */
61
+ .il { color: #666666 } /* Literal.Number.Integer.Long */
@@ -0,0 +1,76 @@
1
+ /* =================== */
2
+ /* = General Styling = */
3
+ /* =================== */
4
+ .shiny {
5
+ background: #000;
6
+ color: #E6E2E8;
7
+ }
8
+ .shiny a {
9
+ color: #BBE;
10
+ }
11
+
12
+ .shiny h1 {
13
+ color: #FFF;
14
+ text-shadow: #808080 3px 3px 5px;
15
+ }
16
+
17
+ .shiny h2 {
18
+ text-shadow: #808080 3px 3px 5px;
19
+ }
20
+
21
+ .shiny h3 {
22
+ text-shadow: #808080 3px 3px 5px;
23
+ }
24
+
25
+ .shiny blockquote {
26
+ border-left: 4px solid #808080;
27
+ color: #FFF;
28
+ }
29
+
30
+ .shiny code {
31
+ color: #C1DE77;
32
+ }
33
+
34
+ .shiny pre {
35
+ color: #FFF;
36
+ background-color: #111;
37
+ border: 1px solid #555;
38
+ }
39
+
40
+
41
+ .shiny .pro_table {
42
+ border-top: 1px solid #616465;
43
+ border-left: 1px solid #616465;
44
+ }
45
+ .shiny .pro_table th {
46
+ background: #1C1C1C;
47
+ border-bottom: 1px solid #616465;
48
+ border-right: 1px solid #616465;
49
+ }
50
+ .shiny .pro_table td {
51
+ border-bottom: 1px solid #616465;
52
+ border-right: 1px solid #616465;
53
+ }
54
+ .shiny .footnote:before {
55
+ color: #888;
56
+ }
57
+ .shiny .footnote:after {
58
+ color: #888;
59
+ }
60
+
61
+ .shiny div.footnotes {
62
+ background: #111;
63
+ }
64
+
65
+
66
+ .shiny td, .dark th {
67
+ color: #EEE;
68
+ }
69
+
70
+ .shiny caption, .dark label {
71
+ color: #CCC;
72
+ }
73
+
74
+ .shiny .alternate {
75
+ background-color: #111;
76
+ }
@@ -14,7 +14,8 @@ module RailsMarkitup
14
14
  # =====================================
15
15
  config.before_initialize do
16
16
  config.action_view.javascript_expansions[:markitup] = %w(markitup/jquery.markitup.js markitup/sets/markdown/set.js)
17
- config.action_view.stylesheet_expansions[:markitup] = %w(markitup/sets/markdown/style.css markitup/skins/markdown/style.css)
17
+ config.action_view.stylesheet_expansions[:markitup] = %w(markitup/sets/markdown/style.css markitup/skins/markdown/style.css markitup/skins/markdown/bright.css markitup/skins/markdown/pygments.css)
18
+ config.action_view.stylesheet_expansions[:markitup_shiny] = %w(markitup/sets/markdown/style.css markitup/skins/markdown/style.css markitup/skins/markdown/shiny.css markitup/skins/markdown/pygments.css)
18
19
  end
19
20
 
20
21
  end
@@ -1,3 +1,3 @@
1
1
  module RailsMarkitup
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_markitup
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - AlexZhang
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-28 00:00:00 +08:00
18
+ date: 2011-06-30 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -24,7 +24,7 @@ dependencies:
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - "="
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  hash: 23
30
30
  segments:
@@ -153,6 +153,9 @@ files:
153
153
  - lib/generators/rails_markitup/media/javascripts/jquery.markitup.js
154
154
  - lib/generators/rails_markitup/media/javascripts/sets/markdown/set.js
155
155
  - lib/generators/rails_markitup/media/stylesheets/sets/markdown/style.css
156
+ - lib/generators/rails_markitup/media/stylesheets/skins/markitup/bright.css
157
+ - lib/generators/rails_markitup/media/stylesheets/skins/markitup/pygments.css
158
+ - lib/generators/rails_markitup/media/stylesheets/skins/markitup/shiny.css
156
159
  - lib/generators/rails_markitup/media/stylesheets/skins/markitup/style.css
157
160
  - lib/rails_markitup/engine.rb
158
161
  - lib/rails_markitup/version.rb