monologue-markdown 0.3.0 → 1.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -7
- data/app/assets/javascripts/monologue-markdown/epiceditor_load.coffee.erb +18 -28
- data/app/models/monologue/posts_revision_decorator.rb +28 -0
- data/app/views/monologue-markdown/overrides/_is_markdown.html.erb +1 -1
- data/lib/monologue-markdown/engine.rb +1 -2
- data/lib/monologue-markdown/version.rb +1 -1
- metadata +58 -62
- checksums.yaml +0 -7
- data/app/assets/stylesheets/monologue-markdown/code-highlighting.css +0 -79
- data/app/models/monologue/post_decorator.rb +0 -26
- data/db/migrate/20130913004609_merge_markdown_revisions_into_posts.rb +0 -33
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# Monologue: markdown edition
|
2
2
|
|
3
3
|
This is a simple extension that will change [Monologue](https://github.com/jipiboily/monologue)'s default editor to EpicEditor which will let you use Markdown instead of a WYSIWYG edit.
|
4
4
|
|
5
|
-
IMPORTANT: this README is for Monologue 0.3.X.
|
6
|
-
|
7
5
|
## Install on a brand new Monologue installation
|
8
6
|
|
9
7
|
This is simple, you just have to add this file to your `Gemfile` after Monologue:
|
@@ -15,16 +13,14 @@ Then run this:
|
|
15
13
|
bundle exec rake monologue_markdown:install:migrations
|
16
14
|
bundle exec rake db:migrate
|
17
15
|
|
16
|
+
|
18
17
|
## Install on an already existing Monologue installation
|
19
18
|
|
20
19
|
You do the same as for a new Monologue installation, but, keep in mind that only new posts will have EpicEditor enabled. All the posts that existed before will still be using the WYSIWYG editor.
|
21
20
|
|
22
|
-
## For Code Highlighting
|
23
|
-
|
24
|
-
sudo easy_install Pygments
|
25
21
|
|
26
22
|
## Notes
|
27
23
|
|
28
24
|
There are [Deface](https://github.com/railsdog/deface/) overrides with this project. You might want to (read: "should") turn it off on production. If you do, you can add a Capistrano task to precompile them or precompile them locally.
|
29
25
|
|
30
|
-
[Read more about this here.](https://github.com/railsdog/deface/#production--precompiling)
|
26
|
+
[Read more about this here.](https://github.com/railsdog/deface/#production--precompiling)
|
@@ -1,11 +1,11 @@
|
|
1
1
|
class MonologueMarkdown
|
2
2
|
constructor: ->
|
3
|
-
@textarea = $("#
|
3
|
+
@textarea = $("#post_posts_revision_content")
|
4
4
|
@opts =
|
5
5
|
container: "epiceditor"
|
6
6
|
basePath: ""
|
7
|
-
clientSideStorage: false
|
8
7
|
clientSideStorage: true
|
8
|
+
localStorageName: "epiceditor"
|
9
9
|
parser: marked
|
10
10
|
file:
|
11
11
|
name: "epiceditor"
|
@@ -23,44 +23,34 @@ class MonologueMarkdown
|
|
23
23
|
fullscreen: 70
|
24
24
|
preview: 80
|
25
25
|
edit: 79
|
26
|
-
|
27
|
-
@initEpicEditor()
|
28
|
-
@bindEvents()
|
29
|
-
@removeDefaultEditor() # remove CKEDITOR right now if it is already loaded
|
30
|
-
|
31
|
-
initEpicEditor: ->
|
32
26
|
$(@textarea).after("<div id='epiceditor'></div>")
|
33
27
|
$(@textarea).hide()
|
34
|
-
|
35
|
-
@bindEpicEvents()
|
36
|
-
@editor.load()
|
28
|
+
that = @
|
37
29
|
|
38
|
-
|
39
|
-
@editor.on "load", (data) =>
|
40
|
-
@editor.importFile('epiceditor',$(@textarea).val())
|
30
|
+
editor = new EpicEditor(@opts)
|
41
31
|
|
42
|
-
|
43
|
-
|
32
|
+
editor.on "load", (data) ->
|
33
|
+
editor.importFile('epiceditor',$(that.textarea).val())
|
44
34
|
|
45
|
-
|
46
|
-
|
47
|
-
@editor.emit("update")
|
35
|
+
editor.on "update", (data) ->
|
36
|
+
that.update_content(data)
|
48
37
|
|
49
|
-
|
50
|
-
CKEDITOR.on 'instanceReady', =>
|
51
|
-
@removeDefaultEditor()
|
38
|
+
editor.load()
|
52
39
|
|
40
|
+
$("form").submit (e) ->
|
41
|
+
editor.emit("update")
|
53
42
|
update_content: (data) =>
|
43
|
+
# forcing unload of tinymce to make sure it doesn't add stuff in our neat content
|
44
|
+
@force_unload_tiny_mce()
|
54
45
|
# update content with our awesome markdown
|
55
46
|
@textarea.val data.content
|
56
47
|
|
57
|
-
|
48
|
+
force_unload_tiny_mce: =>
|
58
49
|
try
|
59
|
-
|
60
|
-
$(
|
61
|
-
catch
|
62
|
-
#
|
63
|
-
$('#cke_post_content').remove()
|
50
|
+
tinymce.get(0).remove()
|
51
|
+
$(".mceEditor").remove()
|
52
|
+
catch e
|
53
|
+
# well, it looks like TinyMCE wasn't load for some reason anyway
|
64
54
|
|
65
55
|
|
66
56
|
$(document).ready ->
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Monologue::PostsRevision.class_eval do
|
2
|
+
before_validation do
|
3
|
+
if self.post.nil? || self.post.posts_revision_id.nil?
|
4
|
+
self.is_markdown = true
|
5
|
+
else
|
6
|
+
self.is_markdown = self.post.active_revision.is_markdown
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def is_markdown?
|
11
|
+
self.is_markdown != false
|
12
|
+
end
|
13
|
+
|
14
|
+
def content
|
15
|
+
if self.is_markdown? && !in_admin?(caller)
|
16
|
+
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true, :space_after_headers => true)
|
17
|
+
return markdown.render(read_attribute(:content))
|
18
|
+
end
|
19
|
+
read_attribute(:content)
|
20
|
+
end
|
21
|
+
|
22
|
+
def in_admin? caller
|
23
|
+
caller.each do |c|
|
24
|
+
return true if c.include? "app/controllers/monologue/admin/posts_controller.rb"
|
25
|
+
end
|
26
|
+
return false
|
27
|
+
end
|
28
|
+
end
|
@@ -1 +1 @@
|
|
1
|
-
<div id="is_markdown" style="display:none"><%= @post.is_markdown?%></div>
|
1
|
+
<div id="is_markdown" style="display:none"><%= @post.active_revision.is_markdown?%></div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "deface"
|
2
|
-
require
|
2
|
+
require "redcarpet"
|
3
3
|
|
4
4
|
module MonologueMarkdown
|
5
5
|
class Engine < ::Rails::Engine
|
@@ -12,7 +12,6 @@ module MonologueMarkdown
|
|
12
12
|
|
13
13
|
initializer :assets do |config|
|
14
14
|
Rails.application.config.assets.precompile += %w( monologue-markdown/epiceditor/themes/base/epiceditor.css monologue-markdown/epiceditor/themes/editor/epic-dark.css monologue-markdown/epiceditor/themes/preview/github.css )
|
15
|
-
Rails.application.config.assets.precompile += %w( monologue-markdown/code-highlighting.css)
|
16
15
|
end
|
17
16
|
|
18
17
|
def self.activate
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monologue-markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0.beta1
|
5
|
+
prerelease: 6
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Jean-Philippe Boily
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2012-10-11 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,90 +30,71 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: monologue
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: deface
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
|
-
- -
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: 1.0.0.rc3
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 1.0.0.rc3
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: github-markdown
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
51
|
+
- - ! '>='
|
60
52
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.5.3
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: content-pipeline
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 0.2.0
|
53
|
+
version: '0'
|
76
54
|
type: :runtime
|
77
55
|
prerelease: false
|
78
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
79
58
|
requirements:
|
80
|
-
- -
|
59
|
+
- - ! '>='
|
81
60
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0
|
61
|
+
version: '0'
|
83
62
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
63
|
+
name: redcarpet
|
85
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
86
66
|
requirements:
|
87
|
-
- -
|
67
|
+
- - ! '>='
|
88
68
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
69
|
+
version: '0'
|
90
70
|
type: :runtime
|
91
71
|
prerelease: false
|
92
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
93
74
|
requirements:
|
94
|
-
- -
|
75
|
+
- - ! '>='
|
95
76
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0
|
77
|
+
version: '0'
|
97
78
|
- !ruby/object:Gem::Dependency
|
98
79
|
name: jquery-rails
|
99
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
100
82
|
requirements:
|
101
|
-
- - '>='
|
83
|
+
- - ! '>='
|
102
84
|
- !ruby/object:Gem::Version
|
103
85
|
version: '0'
|
104
86
|
type: :runtime
|
105
87
|
prerelease: false
|
106
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
107
90
|
requirements:
|
108
|
-
- - '>='
|
91
|
+
- - ! '>='
|
109
92
|
- !ruby/object:Gem::Version
|
110
93
|
version: '0'
|
111
94
|
- !ruby/object:Gem::Dependency
|
112
95
|
name: rspec-rails
|
113
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
114
98
|
requirements:
|
115
99
|
- - ~>
|
116
100
|
- !ruby/object:Gem::Version
|
@@ -118,6 +102,7 @@ dependencies:
|
|
118
102
|
type: :development
|
119
103
|
prerelease: false
|
120
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
121
106
|
requirements:
|
122
107
|
- - ~>
|
123
108
|
- !ruby/object:Gem::Version
|
@@ -125,6 +110,7 @@ dependencies:
|
|
125
110
|
- !ruby/object:Gem::Dependency
|
126
111
|
name: factory_girl_rails
|
127
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
128
114
|
requirements:
|
129
115
|
- - ~>
|
130
116
|
- !ruby/object:Gem::Version
|
@@ -132,6 +118,7 @@ dependencies:
|
|
132
118
|
type: :development
|
133
119
|
prerelease: false
|
134
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
135
122
|
requirements:
|
136
123
|
- - ~>
|
137
124
|
- !ruby/object:Gem::Version
|
@@ -139,71 +126,81 @@ dependencies:
|
|
139
126
|
- !ruby/object:Gem::Dependency
|
140
127
|
name: capybara
|
141
128
|
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
142
130
|
requirements:
|
143
|
-
- - '>='
|
131
|
+
- - ! '>='
|
144
132
|
- !ruby/object:Gem::Version
|
145
133
|
version: '0'
|
146
134
|
type: :development
|
147
135
|
prerelease: false
|
148
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
149
138
|
requirements:
|
150
|
-
- - '>='
|
139
|
+
- - ! '>='
|
151
140
|
- !ruby/object:Gem::Version
|
152
141
|
version: '0'
|
153
142
|
- !ruby/object:Gem::Dependency
|
154
143
|
name: shoulda
|
155
144
|
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
156
146
|
requirements:
|
157
|
-
- - '>='
|
147
|
+
- - ! '>='
|
158
148
|
- !ruby/object:Gem::Version
|
159
149
|
version: '0'
|
160
150
|
type: :development
|
161
151
|
prerelease: false
|
162
152
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
163
154
|
requirements:
|
164
|
-
- - '>='
|
155
|
+
- - ! '>='
|
165
156
|
- !ruby/object:Gem::Version
|
166
157
|
version: '0'
|
167
158
|
- !ruby/object:Gem::Dependency
|
168
159
|
name: guard-rspec
|
169
160
|
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
170
162
|
requirements:
|
171
|
-
- - '>='
|
163
|
+
- - ! '>='
|
172
164
|
- !ruby/object:Gem::Version
|
173
165
|
version: '0'
|
174
166
|
type: :development
|
175
167
|
prerelease: false
|
176
168
|
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
177
170
|
requirements:
|
178
|
-
- - '>='
|
171
|
+
- - ! '>='
|
179
172
|
- !ruby/object:Gem::Version
|
180
173
|
version: '0'
|
181
174
|
- !ruby/object:Gem::Dependency
|
182
175
|
name: database_cleaner
|
183
176
|
requirement: !ruby/object:Gem::Requirement
|
177
|
+
none: false
|
184
178
|
requirements:
|
185
|
-
- - '>='
|
179
|
+
- - ! '>='
|
186
180
|
- !ruby/object:Gem::Version
|
187
181
|
version: '0'
|
188
182
|
type: :development
|
189
183
|
prerelease: false
|
190
184
|
version_requirements: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
191
186
|
requirements:
|
192
|
-
- - '>='
|
187
|
+
- - ! '>='
|
193
188
|
- !ruby/object:Gem::Version
|
194
189
|
version: '0'
|
195
190
|
- !ruby/object:Gem::Dependency
|
196
191
|
name: mysql2
|
197
192
|
requirement: !ruby/object:Gem::Requirement
|
193
|
+
none: false
|
198
194
|
requirements:
|
199
|
-
- - '>='
|
195
|
+
- - ! '>='
|
200
196
|
- !ruby/object:Gem::Version
|
201
197
|
version: '0'
|
202
198
|
type: :development
|
203
199
|
prerelease: false
|
204
200
|
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
205
202
|
requirements:
|
206
|
-
- - '>='
|
203
|
+
- - ! '>='
|
207
204
|
- !ruby/object:Gem::Version
|
208
205
|
version: '0'
|
209
206
|
description: A small and simple efficient extension to Monologue that replace the
|
@@ -221,20 +218,18 @@ files:
|
|
221
218
|
- app/assets/javascripts/monologue-markdown/epiceditor/epiceditor.min.js.erb
|
222
219
|
- app/assets/javascripts/monologue-markdown/epiceditor_load.coffee.erb
|
223
220
|
- app/assets/stylesheets/monologue-markdown/application.css
|
224
|
-
- app/assets/stylesheets/monologue-markdown/code-highlighting.css
|
225
221
|
- app/assets/stylesheets/monologue-markdown/epiceditor/themes/base/epiceditor.css
|
226
222
|
- app/assets/stylesheets/monologue-markdown/epiceditor/themes/editor/epic-dark.css
|
227
223
|
- app/assets/stylesheets/monologue-markdown/epiceditor/themes/editor/epic-light.css
|
228
224
|
- app/assets/stylesheets/monologue-markdown/epiceditor/themes/preview/github.css
|
229
225
|
- app/assets/stylesheets/monologue-markdown/epiceditor/themes/preview/preview-dark.css
|
230
|
-
- app/models/monologue/
|
226
|
+
- app/models/monologue/posts_revision_decorator.rb
|
231
227
|
- app/overrides/insert_epiceditor_in_admin.rb
|
232
228
|
- app/overrides/insert_is_markdown_in_post_edit.rb
|
233
229
|
- app/views/monologue-markdown/overrides/_epiceditor.html.erb
|
234
230
|
- app/views/monologue-markdown/overrides/_is_markdown.html.erb
|
235
231
|
- config/routes.rb
|
236
232
|
- db/migrate/20120924111013_add_is_markown_to_posts_revision.rb
|
237
|
-
- db/migrate/20130913004609_merge_markdown_revisions_into_posts.rb
|
238
233
|
- lib/monologue-markdown/engine.rb
|
239
234
|
- lib/monologue-markdown/version.rb
|
240
235
|
- lib/monologue-markdown.rb
|
@@ -244,26 +239,27 @@ files:
|
|
244
239
|
- README.md
|
245
240
|
homepage: https://github.com/jipiboily/monologue-markdown
|
246
241
|
licenses: []
|
247
|
-
metadata: {}
|
248
242
|
post_install_message:
|
249
243
|
rdoc_options: []
|
250
244
|
require_paths:
|
251
245
|
- lib
|
252
246
|
required_ruby_version: !ruby/object:Gem::Requirement
|
247
|
+
none: false
|
253
248
|
requirements:
|
254
|
-
- - '>='
|
249
|
+
- - ! '>='
|
255
250
|
- !ruby/object:Gem::Version
|
256
251
|
version: '0'
|
257
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
|
+
none: false
|
258
254
|
requirements:
|
259
|
-
- - '
|
255
|
+
- - ! '>'
|
260
256
|
- !ruby/object:Gem::Version
|
261
|
-
version:
|
257
|
+
version: 1.3.1
|
262
258
|
requirements: []
|
263
259
|
rubyforge_project:
|
264
|
-
rubygems_version:
|
260
|
+
rubygems_version: 1.8.24
|
265
261
|
signing_key:
|
266
|
-
specification_version:
|
262
|
+
specification_version: 3
|
267
263
|
summary: A small and simple efficient extension to Monologue that replace the default
|
268
264
|
WYSIWYG editor with a Markdown editor.
|
269
265
|
test_files: []
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: e53e97358288c48efcebed3722d71bd7c456f572
|
4
|
-
data.tar.gz: 26d13e69f66658abed137f80bf404d60c1aa6e65
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 61045826a9579a516d167e3eaed373d2b8b2665d234ee8b6b6afc154bd8cae4f4d1ae92d9141b225669590f11f48b6e50517a01dc867609b7afbc737daf7de19
|
7
|
-
data.tar.gz: 2e6da97d49a11ef4e298d9f74a3b80a3d23633f76314b924b91305870f35d00d813c755c4206237b0475ed1ecb824cfaa3d83702b7eb5f3e99c9ee217d6505f9
|
@@ -1,79 +0,0 @@
|
|
1
|
-
|
2
|
-
code .hll { background-color: #ffffcc }
|
3
|
-
code .c { color: #408080; font-style: italic } /* Comment */
|
4
|
-
code .err { border: 1px solid #FF0000 } /* Error */
|
5
|
-
code .k { color: #008000; font-weight: bold } /* Keyword */
|
6
|
-
code .o { color: #666666 } /* Operator */
|
7
|
-
code .cm { color: #408080; font-style: italic } /* Comment.Multiline */
|
8
|
-
code .cp { color: #BC7A00 } /* Comment.Preproc */
|
9
|
-
code .c1 { color: #408080; font-style: italic } /* Comment.Single */
|
10
|
-
code .cs { color: #408080; font-style: italic } /* Comment.Special */
|
11
|
-
code .gd { color: #A00000 } /* Generic.Deleted */
|
12
|
-
code .ge { font-style: italic } /* Generic.Emph */
|
13
|
-
code .gr { color: #FF0000 } /* Generic.Error */
|
14
|
-
code .gh { color: #000080; font-weight: bold } /* Generic.Heading */
|
15
|
-
code .gi { color: #00A000 } /* Generic.Inserted */
|
16
|
-
code .go { color: #888888 } /* Generic.Output */
|
17
|
-
code .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
|
18
|
-
code .gs { font-weight: bold } /* Generic.Strong */
|
19
|
-
code .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
|
20
|
-
code .gt { color: #0044DD } /* Generic.Traceback */
|
21
|
-
code .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
|
22
|
-
code .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
|
23
|
-
code .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
|
24
|
-
code .kp { color: #008000 } /* Keyword.Pseudo */
|
25
|
-
code .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
|
26
|
-
code .kt { color: #B00040 } /* Keyword.Type */
|
27
|
-
code .m { color: #666666 } /* Literal.Number */
|
28
|
-
code .s { color: #BA2121 } /* Literal.String */
|
29
|
-
code .na { color: #7D9029 } /* Name.Attribute */
|
30
|
-
code .nb { color: #008000 } /* Name.Builtin */
|
31
|
-
code .nc { color: #0000FF; font-weight: bold } /* Name.Class */
|
32
|
-
code .no { color: #880000 } /* Name.Constant */
|
33
|
-
code .nd { color: #AA22FF } /* Name.Decorator */
|
34
|
-
code .ni { color: #999999; font-weight: bold } /* Name.Entity */
|
35
|
-
code .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
|
36
|
-
code .nf { color: #0000FF } /* Name.Function */
|
37
|
-
code .nl { color: #A0A000 } /* Name.Label */
|
38
|
-
code .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
|
39
|
-
code .nt { color: #008000; font-weight: bold } /* Name.Tag */
|
40
|
-
code .nv { color: #19177C } /* Name.Variable */
|
41
|
-
code .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
|
42
|
-
code .w { color: #bbbbbb } /* Text.Whitespace */
|
43
|
-
code .mf { color: #666666 } /* Literal.Number.Float */
|
44
|
-
code .mh { color: #666666 } /* Literal.Number.Hex */
|
45
|
-
code .mi { color: #666666 } /* Literal.Number.Integer */
|
46
|
-
code .mo { color: #666666 } /* Literal.Number.Oct */
|
47
|
-
code .sb { color: #BA2121 } /* Literal.String.Backtick */
|
48
|
-
code .sc { color: #BA2121 } /* Literal.String.Char */
|
49
|
-
code .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
|
50
|
-
code .s2 { color: #BA2121 } /* Literal.String.Double */
|
51
|
-
code .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
|
52
|
-
code .sh { color: #BA2121 } /* Literal.String.Heredoc */
|
53
|
-
code .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
|
54
|
-
code .sx { color: #008000 } /* Literal.String.Other */
|
55
|
-
code .sr { color: #BB6688 } /* Literal.String.Regex */
|
56
|
-
code .s1 { color: #BA2121 } /* Literal.String.Single */
|
57
|
-
code .ss { color: #19177C } /* Literal.String.Symbol */
|
58
|
-
code .bp { color: #008000 } /* Name.Builtin.Pseudo */
|
59
|
-
code .vc { color: #19177C } /* Name.Variable.Class */
|
60
|
-
code .vg { color: #19177C } /* Name.Variable.Global */
|
61
|
-
code .vi { color: #19177C } /* Name.Variable.Instance */
|
62
|
-
code .il { color: #666666 } /* Literal.Number.Integer.Long */
|
63
|
-
|
64
|
-
figure.code .gutter pre {
|
65
|
-
margin-right: 10px;
|
66
|
-
padding-right: 10px;
|
67
|
-
border-right: 1px solid #e5e5e5;
|
68
|
-
text-align: right;
|
69
|
-
}
|
70
|
-
|
71
|
-
figure.code {
|
72
|
-
margin: 5px;
|
73
|
-
padding: 5px;
|
74
|
-
white-space:nowrap;
|
75
|
-
border:1px solid #eaeaea;
|
76
|
-
background-color:#f8f8f8;
|
77
|
-
border-radius:3px;
|
78
|
-
overflow-x: scroll;
|
79
|
-
}
|
@@ -1,26 +0,0 @@
|
|
1
|
-
Monologue::Post.class_eval do
|
2
|
-
before_validation do
|
3
|
-
if self.new_record?
|
4
|
-
self.is_markdown = true
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def is_markdown?
|
9
|
-
self.is_markdown == true
|
10
|
-
end
|
11
|
-
|
12
|
-
def content
|
13
|
-
if self.is_markdown? && !in_admin?(caller)
|
14
|
-
pipeline = Content::Pipeline.new
|
15
|
-
return pipeline.filter(read_attribute(:content), markdown: { type: :gfm, safe: false })
|
16
|
-
end
|
17
|
-
read_attribute(:content)
|
18
|
-
end
|
19
|
-
|
20
|
-
def in_admin? caller
|
21
|
-
caller.each do |c|
|
22
|
-
return true if c.include? "app/controllers/monologue/admin/posts_controller.rb"
|
23
|
-
end
|
24
|
-
return false
|
25
|
-
end
|
26
|
-
end
|
@@ -1,33 +0,0 @@
|
|
1
|
-
class MergeMarkdownRevisionsIntoPosts < ActiveRecord::Migration
|
2
|
-
class Monologue::PostsRevision < ActiveRecord::Base
|
3
|
-
attr_accessible :title, :content, :url, :published_at, :post_id
|
4
|
-
end
|
5
|
-
|
6
|
-
class Monologue::Post < ActiveRecord::Base
|
7
|
-
end
|
8
|
-
|
9
|
-
def up
|
10
|
-
Monologue::PostsRevision.reset_column_information
|
11
|
-
Monologue::Post.reset_column_information
|
12
|
-
add_column :monologue_posts, :is_markdown, :boolean
|
13
|
-
|
14
|
-
Monologue::Post.reset_column_information
|
15
|
-
|
16
|
-
Monologue::Post.all.each do |post|
|
17
|
-
latest_revision = latest_revision_for(post)
|
18
|
-
post.is_markdown = latest_revision.is_markdown
|
19
|
-
post.save(validate: false)
|
20
|
-
end
|
21
|
-
|
22
|
-
remove_column :monologue_posts_revisions, :is_markdown
|
23
|
-
end
|
24
|
-
|
25
|
-
def down
|
26
|
-
raise ActiveRecord::IrreversibleMigration
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
def latest_revision_for(post)
|
31
|
-
Monologue::PostsRevision.where("post_id = ?", post.id).order("monologue_posts_revisions.updated_at DESC").limit(1).first
|
32
|
-
end
|
33
|
-
end
|