rich_text_renderer 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/rich_text_renderer/version.rb +1 -1
- metadata +6 -167
- data/.gitignore +0 -7
- data/.rspec +0 -1
- data/.rubocop.yml +0 -27
- data/.rubocop_todo.yml +0 -35
- data/.travis.yml +0 -13
- data/.yardopts +0 -4
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -110
- data/Guardfile +0 -24
- data/Rakefile +0 -33
- data/coverage/.last_run.json +0 -5
- data/coverage/.resultset.json +0 -1372
- data/coverage/.resultset.json.lock +0 -0
- data/coverage/assets/0.10.2/application.css +0 -799
- data/coverage/assets/0.10.2/application.js +0 -1707
- data/coverage/assets/0.10.2/colorbox/border.png +0 -0
- data/coverage/assets/0.10.2/colorbox/controls.png +0 -0
- data/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
- data/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
- data/coverage/assets/0.10.2/favicon_green.png +0 -0
- data/coverage/assets/0.10.2/favicon_red.png +0 -0
- data/coverage/assets/0.10.2/favicon_yellow.png +0 -0
- data/coverage/assets/0.10.2/loading.gif +0 -0
- data/coverage/assets/0.10.2/magnify.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/coverage/index.html +0 -9146
- data/doc/RichTextRenderer/BaseBlockRenderer.html +0 -242
- data/doc/RichTextRenderer/BaseInlineRenderer.html +0 -242
- data/doc/RichTextRenderer/BaseNodeRenderer.html +0 -300
- data/doc/RichTextRenderer/BlockQuoteRenderer.html +0 -169
- data/doc/RichTextRenderer/BoldRenderer.html +0 -169
- data/doc/RichTextRenderer/CodeRenderer.html +0 -169
- data/doc/RichTextRenderer/DocumentRenderer.html +0 -242
- data/doc/RichTextRenderer/EntryBlockRenderer.html +0 -239
- data/doc/RichTextRenderer/HeadingFiveRenderer.html +0 -169
- data/doc/RichTextRenderer/HeadingFourRenderer.html +0 -169
- data/doc/RichTextRenderer/HeadingOneRenderer.html +0 -169
- data/doc/RichTextRenderer/HeadingSixRenderer.html +0 -169
- data/doc/RichTextRenderer/HeadingThreeRenderer.html +0 -169
- data/doc/RichTextRenderer/HeadingTwoRenderer.html +0 -169
- data/doc/RichTextRenderer/HrRenderer.html +0 -238
- data/doc/RichTextRenderer/HyperlinkRenderer.html +0 -246
- data/doc/RichTextRenderer/ItalicRenderer.html +0 -169
- data/doc/RichTextRenderer/ListItemRenderer.html +0 -169
- data/doc/RichTextRenderer/NullRenderer.html +0 -238
- data/doc/RichTextRenderer/OrderedListRenderer.html +0 -169
- data/doc/RichTextRenderer/ParagraphRenderer.html +0 -169
- data/doc/RichTextRenderer/Renderer.html +0 -349
- data/doc/RichTextRenderer/TextRenderer.html +0 -254
- data/doc/RichTextRenderer/UnderlineRenderer.html +0 -169
- data/doc/RichTextRenderer/UnorderedListRenderer.html +0 -169
- data/doc/RichTextRenderer.html +0 -155
- data/doc/StructuredTextRenderer/BaseBlockRenderer.html +0 -242
- data/doc/StructuredTextRenderer/BaseInlineRenderer.html +0 -242
- data/doc/StructuredTextRenderer/BaseNodeRenderer.html +0 -300
- data/doc/StructuredTextRenderer/BoldRenderer.html +0 -169
- data/doc/StructuredTextRenderer/CodeRenderer.html +0 -169
- data/doc/StructuredTextRenderer/DocumentRenderer.html +0 -242
- data/doc/StructuredTextRenderer/EntryBlockRenderer.html +0 -239
- data/doc/StructuredTextRenderer/HeadingFiveRenderer.html +0 -169
- data/doc/StructuredTextRenderer/HeadingFourRenderer.html +0 -169
- data/doc/StructuredTextRenderer/HeadingOneRenderer.html +0 -169
- data/doc/StructuredTextRenderer/HeadingSixRenderer.html +0 -169
- data/doc/StructuredTextRenderer/HeadingThreeRenderer.html +0 -169
- data/doc/StructuredTextRenderer/HeadingTwoRenderer.html +0 -169
- data/doc/StructuredTextRenderer/HrRenderer.html +0 -238
- data/doc/StructuredTextRenderer/HyperlinkRenderer.html +0 -246
- data/doc/StructuredTextRenderer/ItalicRenderer.html +0 -169
- data/doc/StructuredTextRenderer/ListItemRenderer.html +0 -169
- data/doc/StructuredTextRenderer/NullRenderer.html +0 -238
- data/doc/StructuredTextRenderer/OrderedListRenderer.html +0 -169
- data/doc/StructuredTextRenderer/ParagraphRenderer.html +0 -169
- data/doc/StructuredTextRenderer/QuoteRenderer.html +0 -169
- data/doc/StructuredTextRenderer/Renderer.html +0 -349
- data/doc/StructuredTextRenderer/TextRenderer.html +0 -254
- data/doc/StructuredTextRenderer/UnderlineRenderer.html +0 -169
- data/doc/StructuredTextRenderer/UnorderedListRenderer.html +0 -169
- data/doc/StructuredTextRenderer.html +0 -155
- data/doc/_index.html +0 -387
- data/doc/class_list.html +0 -51
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -58
- data/doc/css/style.css +0 -496
- data/doc/file.CHANGELOG.html +0 -91
- data/doc/file.LICENSE.html +0 -70
- data/doc/file.README.html +0 -170
- data/doc/file_list.html +0 -66
- data/doc/frames.html +0 -17
- data/doc/index.html +0 -170
- data/doc/js/app.js +0 -292
- data/doc/js/full_list.js +0 -216
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -147
- data/doc/top-level-namespace.html +0 -110
- data/rich_text_renderer.gemspec +0 -30
- data/spec/lib/rich_text_renderer/block_renderers/asset_block_renderer_spec.rb +0 -101
- data/spec/lib/rich_text_renderer/block_renderers/asset_hyperlink_renderer_spec.rb +0 -32
- data/spec/lib/rich_text_renderer/block_renderers/base_block_renderer_spec.rb +0 -26
- data/spec/lib/rich_text_renderer/block_renderers/blockquote_renderer_spec.rb +0 -25
- data/spec/lib/rich_text_renderer/block_renderers/entry_block_renderer_spec.rb +0 -15
- data/spec/lib/rich_text_renderer/block_renderers/heading_five_renderer_spec.rb +0 -24
- data/spec/lib/rich_text_renderer/block_renderers/heading_four_renderer_spec.rb +0 -24
- data/spec/lib/rich_text_renderer/block_renderers/heading_one_renderer_spec.rb +0 -24
- data/spec/lib/rich_text_renderer/block_renderers/heading_six_renderer_spec.rb +0 -24
- data/spec/lib/rich_text_renderer/block_renderers/heading_three_renderer_spec.rb +0 -24
- data/spec/lib/rich_text_renderer/block_renderers/heading_two_renderer_spec.rb +0 -24
- data/spec/lib/rich_text_renderer/block_renderers/hr_renderer_spec.rb +0 -13
- data/spec/lib/rich_text_renderer/block_renderers/hyperlink_renderer_spec.rb +0 -24
- data/spec/lib/rich_text_renderer/block_renderers/list_item_renderer_spec.rb +0 -24
- data/spec/lib/rich_text_renderer/block_renderers/ordered_list_renderer_spec.rb +0 -56
- data/spec/lib/rich_text_renderer/block_renderers/paragraph_renderer_spec.rb +0 -30
- data/spec/lib/rich_text_renderer/block_renderers/unordered_list_renderer_spec.rb +0 -56
- data/spec/lib/rich_text_renderer/document_renderers/document_renderer_spec.rb +0 -42
- data/spec/lib/rich_text_renderer/null_renderer_spec.rb +0 -19
- data/spec/lib/rich_text_renderer/renderer_spec.rb +0 -308
- data/spec/lib/rich_text_renderer/text_renderers/base_inline_renderer_spec.rb +0 -11
- data/spec/lib/rich_text_renderer/text_renderers/bold_renderer_spec.rb +0 -11
- data/spec/lib/rich_text_renderer/text_renderers/code_renderer_spec.rb +0 -11
- data/spec/lib/rich_text_renderer/text_renderers/italic_renderer_spec.rb +0 -11
- data/spec/lib/rich_text_renderer/text_renderers/text_renderer_spec.rb +0 -65
- data/spec/lib/rich_text_renderer/text_renderers/underline_renderer_spec.rb +0 -11
- data/spec/spec_helper.rb +0 -105
data/doc/file.README.html
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
File: README
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.16
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "README";
|
19
|
-
relpath = '';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="_index.html">Index</a> »
|
40
|
-
<span class="title">File: README</span>
|
41
|
-
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<div id="search">
|
45
|
-
|
46
|
-
<a class="full_list_link" id="class_list_link"
|
47
|
-
href="class_list.html">
|
48
|
-
|
49
|
-
<svg width="24" height="24">
|
50
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
</svg>
|
54
|
-
</a>
|
55
|
-
|
56
|
-
</div>
|
57
|
-
<div class="clear"></div>
|
58
|
-
</div>
|
59
|
-
|
60
|
-
<div id="content"><div id='filecontents'>
|
61
|
-
<h1 id="label-Contentful+Rich+Text+Renderer">Contentful Rich Text Renderer</h1>
|
62
|
-
|
63
|
-
<p><a href="https://www.contentful.com">Contentful</a> provides a content
|
64
|
-
infrastructure for digital teams to power content in websites, apps, and
|
65
|
-
devices. Unlike a CMS, Contentful was built to integrate with the modern
|
66
|
-
software stack. It offers a central hub for structured content, powerful
|
67
|
-
management and delivery APIs, and a customizable web app that enable
|
68
|
-
developers and content creators to ship digital products faster.</p>
|
69
|
-
|
70
|
-
<p>This library provides rendering capabilities for the <code>RichText</code>
|
71
|
-
field type. It is recommended to be used alongside the <a
|
72
|
-
href="https://www.github.com/contentful/contentful.rb">Contentful Delivery
|
73
|
-
SDK</a>. By default this library will serialize <code>RichText</code>
|
74
|
-
fields into it's corresponding HTML representation. All behaviour can
|
75
|
-
be overridden to serialize to different formats.</p>
|
76
|
-
|
77
|
-
<h2 id="label-Installation">Installation</h2>
|
78
|
-
|
79
|
-
<p>Install Contentful Rich Text Renderer from RubyGems:</p>
|
80
|
-
|
81
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_rich_text_renderer'>rich_text_renderer</span>
|
82
|
-
</code></pre>
|
83
|
-
|
84
|
-
<h2 id="label-Usage">Usage</h2>
|
85
|
-
|
86
|
-
<p>Create a renderer:</p>
|
87
|
-
|
88
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rich_text_renderer</span><span class='tstring_end'>'</span></span>
|
89
|
-
|
90
|
-
<span class='id identifier rubyid_renderer'>renderer</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/Renderer.html" title="RichTextRenderer::Renderer (class)">Renderer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RichTextRenderer/Renderer.html#initialize-instance_method" title="RichTextRenderer::Renderer#initialize (method)">new</a></span></span>
|
91
|
-
</code></pre>
|
92
|
-
|
93
|
-
<p>Render your document:</p>
|
94
|
-
|
95
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_renderer'>renderer</span><span class='period'>.</span><span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_document'>document</span><span class='rparen'>)</span>
|
96
|
-
</code></pre>
|
97
|
-
|
98
|
-
<h2 id="label-Using+different+renderers">Using different renderers</h2>
|
99
|
-
|
100
|
-
<p>There are many cases in which HTML serialization is not what you want.
|
101
|
-
Therefore, all renderers are overridable when creating a
|
102
|
-
<code>RichTextRenderer</code>.</p>
|
103
|
-
|
104
|
-
<p>Also, if you're planning to embed entries within your rich text,
|
105
|
-
overriding the <code>'embedded-entry-block'</code> mapping is a
|
106
|
-
must, as by default it only does
|
107
|
-
<code><div>#{entry.to_s}</div></code>.</p>
|
108
|
-
|
109
|
-
<p>You can override the configuration like follows:</p>
|
110
|
-
|
111
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_renderer'>renderer</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/Renderer.html" title="RichTextRenderer::Renderer (class)">Renderer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RichTextRenderer/Renderer.html#initialize-instance_method" title="RichTextRenderer::Renderer#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
112
|
-
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>embedded-entry-block</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='const'>MyEntryBlockRenderer</span>
|
113
|
-
<span class='rparen'>)</span>
|
114
|
-
</code></pre>
|
115
|
-
|
116
|
-
<p>Where <code>MyEntryBlockRenderer</code> requires to have a
|
117
|
-
<code>#render(node)</code> method and needs to return a string.</p>
|
118
|
-
|
119
|
-
<p>An example entry renderer, assuming our entry has 2 fields called
|
120
|
-
<code>name</code> and <code>description</code> could be:</p>
|
121
|
-
|
122
|
-
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>MyEntryBlockRenderer</span> <span class='op'><</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/BaseNodeRenderer.html" title="RichTextRenderer::BaseNodeRenderer (class)">BaseNodeRenderer</a></span></span>
|
123
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_node'>node</span><span class='rparen'>)</span>
|
124
|
-
<span class='id identifier rubyid_entry'>entry</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
125
|
-
|
126
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'><div class='my-entry'><h3></span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'></h3><p><small></span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_description'>description</span><span class='embexpr_end'>}</span><span class='tstring_content'></p></small></div></span><span class='tstring_end'>"</span></span>
|
127
|
-
<span class='kw'>end</span>
|
128
|
-
<span class='kw'>end</span>
|
129
|
-
</code></pre>
|
130
|
-
|
131
|
-
<h2 id="label-Dealing+with+unknown+node+types">Dealing with unknown node types</h2>
|
132
|
-
|
133
|
-
<p>By default, this gem will treat all unknown node types as errors and will
|
134
|
-
raise an exception letting the user know which node mapping is missing. If
|
135
|
-
you wish to remove this behaviour then replace the <code>nil</code> key of
|
136
|
-
the mapping with a NullRenderer that returns an empty string, or something
|
137
|
-
similar.</p>
|
138
|
-
|
139
|
-
<p>An example would be like follows:</p>
|
140
|
-
|
141
|
-
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>SilentNullRenderer</span> <span class='op'><</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/BaseNodeRenderer.html" title="RichTextRenderer::BaseNodeRenderer (class)">BaseNodeRenderer</a></span></span>
|
142
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_node'>node</span><span class='rparen'>)</span>
|
143
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
144
|
-
<span class='kw'>end</span>
|
145
|
-
<span class='kw'>end</span>
|
146
|
-
|
147
|
-
<span class='id identifier rubyid_renderer'>renderer</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/Renderer.html" title="RichTextRenderer::Renderer (class)">Renderer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RichTextRenderer/Renderer.html#initialize-instance_method" title="RichTextRenderer::Renderer#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
148
|
-
<span class='kw'>nil</span> <span class='op'>=></span> <span class='const'>SilentNullRenderer</span>
|
149
|
-
<span class='rparen'>)</span>
|
150
|
-
</code></pre>
|
151
|
-
|
152
|
-
<h2 id="label-License">License</h2>
|
153
|
-
|
154
|
-
<p>Copyright © 2018 Contentful GmbH. See <a href="./LICENSE">LICENSE</a> for
|
155
|
-
further details.</p>
|
156
|
-
|
157
|
-
<h2 id="label-Contributing">Contributing</h2>
|
158
|
-
|
159
|
-
<p>Feel free to improve this tool by submitting a Pull Request.</p>
|
160
|
-
</div></div>
|
161
|
-
|
162
|
-
<div id="footer">
|
163
|
-
Generated on Mon Oct 15 14:58:22 2018 by
|
164
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
165
|
-
0.9.16 (ruby-2.5.1).
|
166
|
-
</div>
|
167
|
-
|
168
|
-
</div>
|
169
|
-
</body>
|
170
|
-
</html>
|
data/doc/file_list.html
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
-
<meta charset="utf-8" />
|
6
|
-
|
7
|
-
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
-
|
9
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
-
|
15
|
-
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
-
|
17
|
-
|
18
|
-
<title>File List</title>
|
19
|
-
<base id="base_target" target="_parent" />
|
20
|
-
</head>
|
21
|
-
<body>
|
22
|
-
<div id="content">
|
23
|
-
<div class="fixed_header">
|
24
|
-
<h1 id="full_list_header">File List</h1>
|
25
|
-
<div id="full_list_nav">
|
26
|
-
|
27
|
-
<span><a target="_self" href="class_list.html">
|
28
|
-
Classes
|
29
|
-
</a></span>
|
30
|
-
|
31
|
-
<span><a target="_self" href="method_list.html">
|
32
|
-
Methods
|
33
|
-
</a></span>
|
34
|
-
|
35
|
-
<span><a target="_self" href="file_list.html">
|
36
|
-
Files
|
37
|
-
</a></span>
|
38
|
-
|
39
|
-
</div>
|
40
|
-
|
41
|
-
<div id="search">Search: <input type="text" /></div>
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<ul id="full_list" class="file">
|
45
|
-
|
46
|
-
|
47
|
-
<li id="object_README" class="odd">
|
48
|
-
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
-
</li>
|
50
|
-
|
51
|
-
|
52
|
-
<li id="object_CHANGELOG" class="even">
|
53
|
-
<div class="item"><span class="object_link"><a href="file.CHANGELOG.html" title="CHANGELOG">CHANGELOG</a></span></div>
|
54
|
-
</li>
|
55
|
-
|
56
|
-
|
57
|
-
<li id="object_LICENSE" class="odd">
|
58
|
-
<div class="item"><span class="object_link"><a href="file.LICENSE.html" title="LICENSE">LICENSE</a></span></div>
|
59
|
-
</li>
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
</ul>
|
64
|
-
</div>
|
65
|
-
</body>
|
66
|
-
</html>
|
data/doc/frames.html
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<title>Documentation by YARD 0.9.16</title>
|
6
|
-
</head>
|
7
|
-
<script type="text/javascript" charset="utf-8">
|
8
|
-
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
|
-
var name = match ? match[1] : 'index.html';
|
10
|
-
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
11
|
-
window.top.location = name;
|
12
|
-
</script>
|
13
|
-
<noscript>
|
14
|
-
<h1>Oops!</h1>
|
15
|
-
<h2>YARD requires JavaScript!</h2>
|
16
|
-
</noscript>
|
17
|
-
</html>
|
data/doc/index.html
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
File: README
|
8
|
-
|
9
|
-
— Documentation by YARD 0.9.16
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
pathId = "README";
|
19
|
-
relpath = '';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="_index.html">Index</a> »
|
40
|
-
<span class="title">File: README</span>
|
41
|
-
|
42
|
-
</div>
|
43
|
-
|
44
|
-
<div id="search">
|
45
|
-
|
46
|
-
<a class="full_list_link" id="class_list_link"
|
47
|
-
href="class_list.html">
|
48
|
-
|
49
|
-
<svg width="24" height="24">
|
50
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
</svg>
|
54
|
-
</a>
|
55
|
-
|
56
|
-
</div>
|
57
|
-
<div class="clear"></div>
|
58
|
-
</div>
|
59
|
-
|
60
|
-
<div id="content"><div id='filecontents'>
|
61
|
-
<h1 id="label-Contentful+Rich+Text+Renderer">Contentful Rich Text Renderer</h1>
|
62
|
-
|
63
|
-
<p><a href="https://www.contentful.com">Contentful</a> provides a content
|
64
|
-
infrastructure for digital teams to power content in websites, apps, and
|
65
|
-
devices. Unlike a CMS, Contentful was built to integrate with the modern
|
66
|
-
software stack. It offers a central hub for structured content, powerful
|
67
|
-
management and delivery APIs, and a customizable web app that enable
|
68
|
-
developers and content creators to ship digital products faster.</p>
|
69
|
-
|
70
|
-
<p>This library provides rendering capabilities for the <code>RichText</code>
|
71
|
-
field type. It is recommended to be used alongside the <a
|
72
|
-
href="https://www.github.com/contentful/contentful.rb">Contentful Delivery
|
73
|
-
SDK</a>. By default this library will serialize <code>RichText</code>
|
74
|
-
fields into it's corresponding HTML representation. All behaviour can
|
75
|
-
be overridden to serialize to different formats.</p>
|
76
|
-
|
77
|
-
<h2 id="label-Installation">Installation</h2>
|
78
|
-
|
79
|
-
<p>Install Contentful Rich Text Renderer from RubyGems:</p>
|
80
|
-
|
81
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_rich_text_renderer'>rich_text_renderer</span>
|
82
|
-
</code></pre>
|
83
|
-
|
84
|
-
<h2 id="label-Usage">Usage</h2>
|
85
|
-
|
86
|
-
<p>Create a renderer:</p>
|
87
|
-
|
88
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rich_text_renderer</span><span class='tstring_end'>'</span></span>
|
89
|
-
|
90
|
-
<span class='id identifier rubyid_renderer'>renderer</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/Renderer.html" title="RichTextRenderer::Renderer (class)">Renderer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RichTextRenderer/Renderer.html#initialize-instance_method" title="RichTextRenderer::Renderer#initialize (method)">new</a></span></span>
|
91
|
-
</code></pre>
|
92
|
-
|
93
|
-
<p>Render your document:</p>
|
94
|
-
|
95
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_renderer'>renderer</span><span class='period'>.</span><span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_document'>document</span><span class='rparen'>)</span>
|
96
|
-
</code></pre>
|
97
|
-
|
98
|
-
<h2 id="label-Using+different+renderers">Using different renderers</h2>
|
99
|
-
|
100
|
-
<p>There are many cases in which HTML serialization is not what you want.
|
101
|
-
Therefore, all renderers are overridable when creating a
|
102
|
-
<code>RichTextRenderer</code>.</p>
|
103
|
-
|
104
|
-
<p>Also, if you're planning to embed entries within your rich text,
|
105
|
-
overriding the <code>'embedded-entry-block'</code> mapping is a
|
106
|
-
must, as by default it only does
|
107
|
-
<code><div>#{entry.to_s}</div></code>.</p>
|
108
|
-
|
109
|
-
<p>You can override the configuration like follows:</p>
|
110
|
-
|
111
|
-
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_renderer'>renderer</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/Renderer.html" title="RichTextRenderer::Renderer (class)">Renderer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RichTextRenderer/Renderer.html#initialize-instance_method" title="RichTextRenderer::Renderer#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
112
|
-
<span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>embedded-entry-block</span><span class='tstring_end'>'</span></span> <span class='op'>=></span> <span class='const'>MyEntryBlockRenderer</span>
|
113
|
-
<span class='rparen'>)</span>
|
114
|
-
</code></pre>
|
115
|
-
|
116
|
-
<p>Where <code>MyEntryBlockRenderer</code> requires to have a
|
117
|
-
<code>#render(node)</code> method and needs to return a string.</p>
|
118
|
-
|
119
|
-
<p>An example entry renderer, assuming our entry has 2 fields called
|
120
|
-
<code>name</code> and <code>description</code> could be:</p>
|
121
|
-
|
122
|
-
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>MyEntryBlockRenderer</span> <span class='op'><</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/BaseNodeRenderer.html" title="RichTextRenderer::BaseNodeRenderer (class)">BaseNodeRenderer</a></span></span>
|
123
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_node'>node</span><span class='rparen'>)</span>
|
124
|
-
<span class='id identifier rubyid_entry'>entry</span> <span class='op'>=</span> <span class='id identifier rubyid_node'>node</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>data</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
125
|
-
|
126
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'><div class='my-entry'><h3></span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='embexpr_end'>}</span><span class='tstring_content'></h3><p><small></span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_entry'>entry</span><span class='period'>.</span><span class='id identifier rubyid_description'>description</span><span class='embexpr_end'>}</span><span class='tstring_content'></p></small></div></span><span class='tstring_end'>"</span></span>
|
127
|
-
<span class='kw'>end</span>
|
128
|
-
<span class='kw'>end</span>
|
129
|
-
</code></pre>
|
130
|
-
|
131
|
-
<h2 id="label-Dealing+with+unknown+node+types">Dealing with unknown node types</h2>
|
132
|
-
|
133
|
-
<p>By default, this gem will treat all unknown node types as errors and will
|
134
|
-
raise an exception letting the user know which node mapping is missing. If
|
135
|
-
you wish to remove this behaviour then replace the <code>nil</code> key of
|
136
|
-
the mapping with a NullRenderer that returns an empty string, or something
|
137
|
-
similar.</p>
|
138
|
-
|
139
|
-
<p>An example would be like follows:</p>
|
140
|
-
|
141
|
-
<pre class="code ruby"><code class="ruby"><span class='kw'>class</span> <span class='const'>SilentNullRenderer</span> <span class='op'><</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/BaseNodeRenderer.html" title="RichTextRenderer::BaseNodeRenderer (class)">BaseNodeRenderer</a></span></span>
|
142
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_render'>render</span><span class='lparen'>(</span><span class='id identifier rubyid_node'>node</span><span class='rparen'>)</span>
|
143
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span>
|
144
|
-
<span class='kw'>end</span>
|
145
|
-
<span class='kw'>end</span>
|
146
|
-
|
147
|
-
<span class='id identifier rubyid_renderer'>renderer</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="RichTextRenderer.html" title="RichTextRenderer (module)">RichTextRenderer</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="RichTextRenderer/Renderer.html" title="RichTextRenderer::Renderer (class)">Renderer</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'><span class='object_link'><a href="RichTextRenderer/Renderer.html#initialize-instance_method" title="RichTextRenderer::Renderer#initialize (method)">new</a></span></span><span class='lparen'>(</span>
|
148
|
-
<span class='kw'>nil</span> <span class='op'>=></span> <span class='const'>SilentNullRenderer</span>
|
149
|
-
<span class='rparen'>)</span>
|
150
|
-
</code></pre>
|
151
|
-
|
152
|
-
<h2 id="label-License">License</h2>
|
153
|
-
|
154
|
-
<p>Copyright © 2018 Contentful GmbH. See <a href="./LICENSE">LICENSE</a> for
|
155
|
-
further details.</p>
|
156
|
-
|
157
|
-
<h2 id="label-Contributing">Contributing</h2>
|
158
|
-
|
159
|
-
<p>Feel free to improve this tool by submitting a Pull Request.</p>
|
160
|
-
</div></div>
|
161
|
-
|
162
|
-
<div id="footer">
|
163
|
-
Generated on Mon Oct 15 14:58:22 2018 by
|
164
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
165
|
-
0.9.16 (ruby-2.5.1).
|
166
|
-
</div>
|
167
|
-
|
168
|
-
</div>
|
169
|
-
</body>
|
170
|
-
</html>
|