client_pages 0.0.1.alpha → 0.0.2.alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -4
- data/lib/client_pages/version.rb +1 -1
- data/lib/client_pages.rb +10 -0
- data/spec/unit/client_pages_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82904ac8341a7933e443e28906539c0e6f70e4da
|
4
|
+
data.tar.gz: 3d68be7fa246b1de11e4fee95750293e8bc0dfc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c273aa8f22b87c4b49e91f69127955ebaa0f85bd5f00989ddb0e2df70e1b3a61222887e501da64174d0986f34aff7fbe2226a8860ceb28012843fb9f7e94c178
|
7
|
+
data.tar.gz: c9d878fa73bf1b6962d50edfbda5c34092c6cdb806e67af0f9ec1ab25dedced2319f0831755de10cacca9020bf67b6dfe6e6fd81afffd2ad6c1f79d588273415
|
data/README.md
CHANGED
@@ -2,13 +2,19 @@
|
|
2
2
|
|
3
3
|
##### Todo:
|
4
4
|
|
5
|
+
- extract single files and responsibilites
|
6
|
+
- set resonable defaults, like enable table, and auto link.
|
5
7
|
- fallback option? => error handling if no such file?
|
6
8
|
- yaml content?
|
7
9
|
- builder#wrap needs conditional and multi wrap + nested wrap
|
8
10
|
- builder methoden vereinheitlichen
|
11
|
+
- modify :tag, with: {}, if: {}|->|?
|
12
|
+
- wrap :tag, with: {}, if: {}|->|?
|
13
|
+
- replace :tag, with: {}, if: {}|->|?
|
14
|
+
- c.method &block
|
9
15
|
- builder defaults? (all :p will get class x)
|
10
|
-
-
|
11
|
-
-
|
16
|
+
- maybe adjust ```render_content``` with additional parameter, like simple_form does
|
17
|
+
- defaults: :table_settings => will be stored somewhere as a block
|
12
18
|
- test new configs! (.remote, .remote_content_path, .content_path, .caching, .fallback, .i18n)
|
13
19
|
- railtie
|
14
20
|
- i18n support content/de/something, content/en/something
|
@@ -20,6 +26,10 @@
|
|
20
26
|
- travis
|
21
27
|
- codeclimate
|
22
28
|
|
29
|
+
|
30
|
+
if defined?(Rails)
|
31
|
+
html_safe all the things
|
32
|
+
|
23
33
|
---
|
24
34
|
|
25
35
|
# Ideas/Notes:
|
@@ -83,12 +93,16 @@ rails project?
|
|
83
93
|
maybe you like to configure this to app/content or app/views/content
|
84
94
|
totaly up to you.
|
85
95
|
|
86
|
-
no framework? pure rack?
|
96
|
+
no framework? pure rack?
|
87
97
|
|
88
98
|
for convenience you can add ``` include ClientPages::MarkdownContent ``` to your application controller/view_helper/presenter/... or something which is responsible for building html
|
89
99
|
so that you can call ```render_content``` there.
|
90
100
|
|
91
|
-
or if you're riding the real blank slate, just call ```ClientPages::MarkdownContent.render_content``` directly.
|
101
|
+
or if you're riding the real blank slate, just call ```ClientPages::MarkdownContent.render_content``` directly. **WRONG!!!**
|
102
|
+
|
103
|
+
sinatra?
|
104
|
+
|
105
|
+
mini example
|
92
106
|
|
93
107
|
### renderer
|
94
108
|
if you call ```render_content``` without a block it just renders the markdown to html
|
@@ -97,6 +111,11 @@ no framework? pure rack? sinatra?
|
|
97
111
|
|
98
112
|
```render_content('posts/index')```
|
99
113
|
|
114
|
+
### known issues
|
115
|
+
|
116
|
+
```<% end.html_safe %>```
|
117
|
+
Oups? => http://bibwild.wordpress.com/2013/12/19/you-never-want-to-call-html_safe-in-a-rails-template/
|
118
|
+
|
100
119
|
### builder
|
101
120
|
- modify
|
102
121
|
- wrap
|
@@ -114,6 +133,29 @@ no framework? pure rack? sinatra?
|
|
114
133
|
- content_path
|
115
134
|
- if you go the full remote path without fallback, you might consider to turn on caching.
|
116
135
|
|
136
|
+
```
|
137
|
+
ClientPages.config do |c|
|
138
|
+
c.remote = true
|
139
|
+
c.remote_content_path = 'https://dl.dropboxusercontent.com/u/363312/rackedy_rack'
|
140
|
+
c.content_path = 'content'
|
141
|
+
c.caching = true
|
142
|
+
c.fallback = false
|
143
|
+
c.i18n = false
|
144
|
+
c.render_options = {
|
145
|
+
hard_wrap: true,
|
146
|
+
with_toc_data: false,
|
147
|
+
}
|
148
|
+
c.markdown_extensions = {
|
149
|
+
tables: true,
|
150
|
+
autolink: true,
|
151
|
+
lax_spacing: true,
|
152
|
+
space_after_headers: true,
|
153
|
+
underline: true,
|
154
|
+
no_intra_emphasis: true,
|
155
|
+
}
|
156
|
+
end
|
157
|
+
```
|
158
|
+
|
117
159
|
### i18n
|
118
160
|
per default client_pages looks in your content_path for /locale/...
|
119
161
|
- is the locale a config_setting?
|
data/lib/client_pages/version.rb
CHANGED
data/lib/client_pages.rb
CHANGED
@@ -28,6 +28,14 @@ module ClientPages
|
|
28
28
|
end
|
29
29
|
|
30
30
|
module MarkdownContent
|
31
|
+
class MarkdownContentRenderer
|
32
|
+
include ClientPages::MarkdownContent
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.render_content(file, options={})
|
36
|
+
MarkdownContentRenderer.new.render_content(file, options)
|
37
|
+
end
|
38
|
+
|
31
39
|
class Matcher
|
32
40
|
attr_accessor :tag, :line
|
33
41
|
|
@@ -134,6 +142,8 @@ module ClientPages
|
|
134
142
|
end
|
135
143
|
rescue OpenURI::HTTPError
|
136
144
|
"404: could not find '#{file}'"
|
145
|
+
rescue Errno::ENOENT => e
|
146
|
+
e.message
|
137
147
|
rescue SocketError
|
138
148
|
'Error: content_path not available'
|
139
149
|
end
|
@@ -2,6 +2,12 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module ClientPages
|
4
4
|
describe MarkdownContent do
|
5
|
+
context 'blank slate' do
|
6
|
+
before { ClientPages.config { |c| c.remote = false; c.content_path = 'foo' } }
|
7
|
+
it { expect(ClientPages::MarkdownContent.render_content('bar')).to eql("No such file or directory - foo/bar.md") }
|
8
|
+
it 'has more specs for non remote!'
|
9
|
+
end
|
10
|
+
|
5
11
|
describe 'Renderer' do
|
6
12
|
subject { Class.send(:include, ClientPages::MarkdownContent).new }
|
7
13
|
let(:markdown) { fixture('test_content') }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: client_pages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marco Schaden
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redcarpet
|