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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc3c627266b1e9187280a19b95fd613e73f08acc
4
- data.tar.gz: 9c72b430526090a8c73866c6fef996b7e9b2e003
3
+ metadata.gz: 82904ac8341a7933e443e28906539c0e6f70e4da
4
+ data.tar.gz: 3d68be7fa246b1de11e4fee95750293e8bc0dfc8
5
5
  SHA512:
6
- metadata.gz: e01fbb81395367d36f4217fa7221841e1881f6bedca4d0ebb9c3ebec09e3aa0687ea2f366bf5011ef429669fe72206abdcfdcea281f2101455d3a46fcd107a97
7
- data.tar.gz: e471af6747143523d2c94fd5de271d981f16f4011dd1faff736b2028e8e6625414a3f43edfabfd88efa754b901cf68b47fb7321ca77238d83c39998b6d47bd47
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
- - > maybe adjust ```render_content``` with additional parameter, like simple_form does
11
- - > defaults: :table_settings => will be stored somewhere as a block
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? sinatra?
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?
@@ -1,3 +1,3 @@
1
1
  module ClientPages
2
- VERSION = '0.0.1.alpha'
2
+ VERSION = '0.0.2.alpha'
3
3
  end
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.1.alpha
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-02-28 00:00:00.000000000 Z
11
+ date: 2014-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet