rich_text_renderer 0.1.0 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/README.md +1 -1
  4. data/lib/rich_text_renderer/block_renderers/asset_block_renderer.rb +27 -0
  5. data/lib/rich_text_renderer/block_renderers/asset_hyperlink_renderer.rb +64 -0
  6. data/lib/rich_text_renderer/block_renderers/blockquote_renderer.rb +1 -1
  7. data/lib/rich_text_renderer/block_renderers/entry_block_renderer.rb +1 -1
  8. data/lib/rich_text_renderer/block_renderers.rb +2 -0
  9. data/lib/rich_text_renderer/renderer.rb +2 -0
  10. data/lib/rich_text_renderer/text_renderers/text_renderer.rb +2 -0
  11. data/lib/rich_text_renderer/version.rb +1 -1
  12. metadata +9 -165
  13. data/.gitignore +0 -7
  14. data/.rspec +0 -1
  15. data/.rubocop.yml +0 -27
  16. data/.rubocop_todo.yml +0 -35
  17. data/.travis.yml +0 -13
  18. data/.yardopts +0 -4
  19. data/Gemfile +0 -3
  20. data/Gemfile.lock +0 -110
  21. data/Guardfile +0 -24
  22. data/Rakefile +0 -33
  23. data/coverage/.last_run.json +0 -5
  24. data/coverage/.resultset.json +0 -1372
  25. data/coverage/.resultset.json.lock +0 -0
  26. data/coverage/assets/0.10.2/application.css +0 -799
  27. data/coverage/assets/0.10.2/application.js +0 -1707
  28. data/coverage/assets/0.10.2/colorbox/border.png +0 -0
  29. data/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  30. data/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  31. data/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  32. data/coverage/assets/0.10.2/favicon_green.png +0 -0
  33. data/coverage/assets/0.10.2/favicon_red.png +0 -0
  34. data/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  35. data/coverage/assets/0.10.2/loading.gif +0 -0
  36. data/coverage/assets/0.10.2/magnify.png +0 -0
  37. data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  38. data/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  39. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  40. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  41. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  42. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  43. data/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  44. data/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  45. data/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  46. data/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  47. data/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  48. data/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  49. data/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  50. data/coverage/index.html +0 -9146
  51. data/doc/RichTextRenderer/BaseBlockRenderer.html +0 -242
  52. data/doc/RichTextRenderer/BaseInlineRenderer.html +0 -242
  53. data/doc/RichTextRenderer/BaseNodeRenderer.html +0 -300
  54. data/doc/RichTextRenderer/BlockQuoteRenderer.html +0 -169
  55. data/doc/RichTextRenderer/BoldRenderer.html +0 -169
  56. data/doc/RichTextRenderer/CodeRenderer.html +0 -169
  57. data/doc/RichTextRenderer/DocumentRenderer.html +0 -242
  58. data/doc/RichTextRenderer/EntryBlockRenderer.html +0 -239
  59. data/doc/RichTextRenderer/HeadingFiveRenderer.html +0 -169
  60. data/doc/RichTextRenderer/HeadingFourRenderer.html +0 -169
  61. data/doc/RichTextRenderer/HeadingOneRenderer.html +0 -169
  62. data/doc/RichTextRenderer/HeadingSixRenderer.html +0 -169
  63. data/doc/RichTextRenderer/HeadingThreeRenderer.html +0 -169
  64. data/doc/RichTextRenderer/HeadingTwoRenderer.html +0 -169
  65. data/doc/RichTextRenderer/HrRenderer.html +0 -238
  66. data/doc/RichTextRenderer/HyperlinkRenderer.html +0 -246
  67. data/doc/RichTextRenderer/ItalicRenderer.html +0 -169
  68. data/doc/RichTextRenderer/ListItemRenderer.html +0 -169
  69. data/doc/RichTextRenderer/NullRenderer.html +0 -238
  70. data/doc/RichTextRenderer/OrderedListRenderer.html +0 -169
  71. data/doc/RichTextRenderer/ParagraphRenderer.html +0 -169
  72. data/doc/RichTextRenderer/Renderer.html +0 -349
  73. data/doc/RichTextRenderer/TextRenderer.html +0 -254
  74. data/doc/RichTextRenderer/UnderlineRenderer.html +0 -169
  75. data/doc/RichTextRenderer/UnorderedListRenderer.html +0 -169
  76. data/doc/RichTextRenderer.html +0 -155
  77. data/doc/StructuredTextRenderer/BaseBlockRenderer.html +0 -242
  78. data/doc/StructuredTextRenderer/BaseInlineRenderer.html +0 -242
  79. data/doc/StructuredTextRenderer/BaseNodeRenderer.html +0 -300
  80. data/doc/StructuredTextRenderer/BoldRenderer.html +0 -169
  81. data/doc/StructuredTextRenderer/CodeRenderer.html +0 -169
  82. data/doc/StructuredTextRenderer/DocumentRenderer.html +0 -242
  83. data/doc/StructuredTextRenderer/EntryBlockRenderer.html +0 -239
  84. data/doc/StructuredTextRenderer/HeadingFiveRenderer.html +0 -169
  85. data/doc/StructuredTextRenderer/HeadingFourRenderer.html +0 -169
  86. data/doc/StructuredTextRenderer/HeadingOneRenderer.html +0 -169
  87. data/doc/StructuredTextRenderer/HeadingSixRenderer.html +0 -169
  88. data/doc/StructuredTextRenderer/HeadingThreeRenderer.html +0 -169
  89. data/doc/StructuredTextRenderer/HeadingTwoRenderer.html +0 -169
  90. data/doc/StructuredTextRenderer/HrRenderer.html +0 -238
  91. data/doc/StructuredTextRenderer/HyperlinkRenderer.html +0 -246
  92. data/doc/StructuredTextRenderer/ItalicRenderer.html +0 -169
  93. data/doc/StructuredTextRenderer/ListItemRenderer.html +0 -169
  94. data/doc/StructuredTextRenderer/NullRenderer.html +0 -238
  95. data/doc/StructuredTextRenderer/OrderedListRenderer.html +0 -169
  96. data/doc/StructuredTextRenderer/ParagraphRenderer.html +0 -169
  97. data/doc/StructuredTextRenderer/QuoteRenderer.html +0 -169
  98. data/doc/StructuredTextRenderer/Renderer.html +0 -349
  99. data/doc/StructuredTextRenderer/TextRenderer.html +0 -254
  100. data/doc/StructuredTextRenderer/UnderlineRenderer.html +0 -169
  101. data/doc/StructuredTextRenderer/UnorderedListRenderer.html +0 -169
  102. data/doc/StructuredTextRenderer.html +0 -155
  103. data/doc/_index.html +0 -387
  104. data/doc/class_list.html +0 -51
  105. data/doc/css/common.css +0 -1
  106. data/doc/css/full_list.css +0 -58
  107. data/doc/css/style.css +0 -496
  108. data/doc/file.CHANGELOG.html +0 -91
  109. data/doc/file.LICENSE.html +0 -70
  110. data/doc/file.README.html +0 -170
  111. data/doc/file_list.html +0 -66
  112. data/doc/frames.html +0 -17
  113. data/doc/index.html +0 -170
  114. data/doc/js/app.js +0 -292
  115. data/doc/js/full_list.js +0 -216
  116. data/doc/js/jquery.js +0 -4
  117. data/doc/method_list.html +0 -147
  118. data/doc/top-level-namespace.html +0 -110
  119. data/rich_text_renderer.gemspec +0 -30
  120. data/spec/lib/rich_text_renderer/block_renderers/base_block_renderer_spec.rb +0 -26
  121. data/spec/lib/rich_text_renderer/block_renderers/blockquote_renderer_spec.rb +0 -25
  122. data/spec/lib/rich_text_renderer/block_renderers/entry_block_renderer_spec.rb +0 -15
  123. data/spec/lib/rich_text_renderer/block_renderers/heading_five_renderer_spec.rb +0 -24
  124. data/spec/lib/rich_text_renderer/block_renderers/heading_four_renderer_spec.rb +0 -24
  125. data/spec/lib/rich_text_renderer/block_renderers/heading_one_renderer_spec.rb +0 -24
  126. data/spec/lib/rich_text_renderer/block_renderers/heading_six_renderer_spec.rb +0 -24
  127. data/spec/lib/rich_text_renderer/block_renderers/heading_three_renderer_spec.rb +0 -24
  128. data/spec/lib/rich_text_renderer/block_renderers/heading_two_renderer_spec.rb +0 -24
  129. data/spec/lib/rich_text_renderer/block_renderers/hr_renderer_spec.rb +0 -13
  130. data/spec/lib/rich_text_renderer/block_renderers/hyperlink_renderer_spec.rb +0 -24
  131. data/spec/lib/rich_text_renderer/block_renderers/list_item_renderer_spec.rb +0 -24
  132. data/spec/lib/rich_text_renderer/block_renderers/ordered_list_renderer_spec.rb +0 -56
  133. data/spec/lib/rich_text_renderer/block_renderers/paragraph_renderer_spec.rb +0 -30
  134. data/spec/lib/rich_text_renderer/block_renderers/unordered_list_renderer_spec.rb +0 -56
  135. data/spec/lib/rich_text_renderer/document_renderers/document_renderer_spec.rb +0 -42
  136. data/spec/lib/rich_text_renderer/null_renderer_spec.rb +0 -19
  137. data/spec/lib/rich_text_renderer/renderer_spec.rb +0 -308
  138. data/spec/lib/rich_text_renderer/text_renderers/base_inline_renderer_spec.rb +0 -11
  139. data/spec/lib/rich_text_renderer/text_renderers/bold_renderer_spec.rb +0 -11
  140. data/spec/lib/rich_text_renderer/text_renderers/code_renderer_spec.rb +0 -11
  141. data/spec/lib/rich_text_renderer/text_renderers/italic_renderer_spec.rb +0 -11
  142. data/spec/lib/rich_text_renderer/text_renderers/text_renderer_spec.rb +0 -53
  143. data/spec/lib/rich_text_renderer/text_renderers/underline_renderer_spec.rb +0 -11
  144. data/spec/spec_helper.rb +0 -82
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
- &mdash; 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> &raquo;
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&#39;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'>&#39;</span><span class='tstring_content'>rich_text_renderer</span><span class='tstring_end'>&#39;</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&#39;re planning to embed entries within your rich text,
105
- overriding the <code>&#39;embedded-entry-block&#39;</code> mapping is a
106
- must, as by default it only does
107
- <code>&lt;div&gt;#{entry.to_s}&lt;/div&gt;</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'>&#39;</span><span class='tstring_content'>embedded-entry-block</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</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'>&lt;</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'>&#39;</span><span class='tstring_content'>data</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
125
-
126
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&lt;div class=&#39;my-entry&#39;&gt;&lt;h3&gt;</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'>&lt;/h3&gt;&lt;p&gt;&lt;small&gt;</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'>&lt;/p&gt;&lt;/small&gt;&lt;/div&gt;</span><span class='tstring_end'>&quot;</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'>&lt;</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'>&quot;</span><span class='tstring_end'>&quot;</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'>=&gt;</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
- &mdash; 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> &raquo;
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&#39;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'>&#39;</span><span class='tstring_content'>rich_text_renderer</span><span class='tstring_end'>&#39;</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&#39;re planning to embed entries within your rich text,
105
- overriding the <code>&#39;embedded-entry-block&#39;</code> mapping is a
106
- must, as by default it only does
107
- <code>&lt;div&gt;#{entry.to_s}&lt;/div&gt;</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'>&#39;</span><span class='tstring_content'>embedded-entry-block</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</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'>&lt;</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'>&#39;</span><span class='tstring_content'>data</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
125
-
126
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>&lt;div class=&#39;my-entry&#39;&gt;&lt;h3&gt;</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'>&lt;/h3&gt;&lt;p&gt;&lt;small&gt;</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'>&lt;/p&gt;&lt;/small&gt;&lt;/div&gt;</span><span class='tstring_end'>&quot;</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'>&lt;</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'>&quot;</span><span class='tstring_end'>&quot;</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'>=&gt;</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>