hologram 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/CHANGELOG.md +37 -0
- data/README.md +243 -5
- data/hologram.gemspec +2 -0
- data/lib/hologram.rb +2 -0
- data/lib/hologram/block_code_renderer.rb +45 -0
- data/lib/hologram/code_example_renderer.rb +73 -0
- data/lib/hologram/code_example_renderer/example.rb +27 -0
- data/lib/hologram/code_example_renderer/factory.rb +60 -0
- data/lib/hologram/code_example_renderer/renderers/haml_renderer.rb +17 -0
- data/lib/hologram/code_example_renderer/renderers/html_renderer.rb +6 -0
- data/lib/hologram/code_example_renderer/renderers/js_renderer.rb +5 -0
- data/lib/hologram/code_example_renderer/renderers/jsx_renderer.rb +4 -0
- data/lib/hologram/code_example_renderer/renderers/react_renderer.rb +21 -0
- data/lib/hologram/code_example_renderer/renderers/slim_renderer.rb +16 -0
- data/lib/hologram/code_example_renderer/template.rb +33 -0
- data/lib/hologram/display_message.rb +13 -0
- data/lib/hologram/doc_block_collection.rb +5 -1
- data/lib/hologram/doc_builder.rb +58 -7
- data/lib/hologram/doc_parser.rb +20 -4
- data/lib/hologram/document_block.rb +22 -4
- data/lib/hologram/link_helper.rb +18 -0
- data/lib/hologram/markdown_renderer.rb +56 -35
- data/lib/hologram/version.rb +1 -1
- data/lib/template/code_example_templates/js_example_template.html.erb +7 -0
- data/lib/template/code_example_templates/jsx_example_template.html.erb +7 -0
- data/lib/template/code_example_templates/markup_example_template.html.erb +10 -0
- data/lib/template/code_example_templates/markup_table_template.html.erb +23 -0
- data/lib/template/hologram_config.yml +23 -0
- data/spec/block_code_renderer_spec.rb +279 -0
- data/spec/code_example_renderer/example_spec.rb +26 -0
- data/spec/code_example_renderer/factory_spec.rb +102 -0
- data/spec/code_example_renderer/template_spec.rb +50 -0
- data/spec/display_message_spec.rb +18 -0
- data/spec/doc_block_collection_spec.rb +26 -1
- data/spec/doc_builder_spec.rb +28 -5
- data/spec/doc_parser_spec.rb +67 -7
- data/spec/document_block_spec.rb +33 -2
- data/spec/fixtures/source/components/button/buttons.css +8 -6
- data/spec/fixtures/source/components/button/skin/buttonSkins.css +17 -0
- data/spec/fixtures/styleguide/base_css.html +176 -52
- data/spec/fixtures/styleguide/index.html +6 -14
- data/spec/link_helper_spec.rb +57 -0
- data/spec/markdown_renderer_spec.rb +82 -0
- metadata +75 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7506793859da81666c3cfce54518aa60404fd3b
|
4
|
+
data.tar.gz: ebd72609ca0a28fce80ac0384a0c812bb4977c85
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61dba38e58f9648f72018866b1c82f9569175abef77d2e4159db83adaf1bff1d093450096ea5215ab1df555d570fed4779ab4c319736bac218f6988cd8989361
|
7
|
+
data.tar.gz: aaea89e65dd705d79a57885a941d969eb4d278e81afc2e4a7be281a393d023fa86b66316b36bac96c3b33504b0230dcbd3b772d5323495111b35545cdbdecec8
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
#Changelog
|
2
2
|
|
3
|
+
##1.3.0 - 2015-01-15
|
4
|
+
|
5
|
+
Spencer Hurst, Beatrice Peng, and Geoff Pleiss
|
6
|
+
* Overhaul the code examples code to allow easier customization
|
7
|
+
|
8
|
+
Nicole Sullivan and Geoff Pleiss
|
9
|
+
* Add class styleguide to generated markdown documentation
|
10
|
+
* Add nav_level config and section navigation
|
11
|
+
* Tabular code examples (ie html_example_table, haml_example_table, etc)
|
12
|
+
|
13
|
+
Paul Meskers and Nicole Sullivan
|
14
|
+
* Add code example support for JSX
|
15
|
+
|
16
|
+
Geoff Pleiss
|
17
|
+
* Add config to exit on warnings
|
18
|
+
* Add internal reference links for linking to other sections within
|
19
|
+
hologram's generated documentation
|
20
|
+
|
21
|
+
Jonathan Dexter
|
22
|
+
* Fix document comment block regex to work with CR
|
23
|
+
|
24
|
+
Beatrice Peng
|
25
|
+
* Warn when multiple components have the same name
|
26
|
+
|
27
|
+
Chris Holmes
|
28
|
+
* Documentation updates
|
29
|
+
|
30
|
+
Antoine - a5e
|
31
|
+
* Escape title in documentation block
|
32
|
+
|
33
|
+
JD Cantrell
|
34
|
+
* Try .sass style comments when a .scss file has no doc blocks
|
35
|
+
* Remove all backtick commands with FileUtils call (better support on
|
36
|
+
non-linux/osx machines)
|
37
|
+
* Add code example support for slim
|
38
|
+
|
39
|
+
|
3
40
|
##1.2.0 - 2014-07-22
|
4
41
|
|
5
42
|
JD Cantrell
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Hologram
|
2
|
+
[](https://rubygems.org/gems/hologram)
|
2
3
|
[](https://travis-ci.org/trulia/hologram)
|
3
4
|
[](https://codeclimate.com/github/trulia/hologram)
|
5
|
+
[](https://gemnasium.com/trulia/hologram)
|
4
6
|
|
5
7
|
Hologram is a Ruby gem that parses comments in your CSS and helps you
|
6
8
|
turn them into a beautiful style guide.
|
@@ -36,8 +38,9 @@ If you don't use bundler you can run `gem install hologram`.
|
|
36
38
|
|
37
39
|
``` hologram init ```
|
38
40
|
|
39
|
-
This will create a `hologram_config.yml` file (more on this below),
|
40
|
-
|
41
|
+
This will create a `hologram_config.yml` file (more on this below),
|
42
|
+
starter `_header.html` and `_footer.html` files,
|
43
|
+
and starter templates for rendering code examples.
|
41
44
|
You can then tweak the config values and start documenting your css.
|
42
45
|
|
43
46
|
Add some documentation to one of your stylesheets:
|
@@ -113,10 +116,41 @@ Your config file needs to contain the following key/value pairs
|
|
113
116
|
**Nota Bene:** Filenames that begin with underscores will not be
|
114
117
|
copied into the destination folder.
|
115
118
|
|
119
|
+
* **code\_example\_templates**: (optional) Hologram uses the files in this folder to
|
120
|
+
format the code examples in the styleguide. The initializer generates 4 files:
|
121
|
+
|
122
|
+
* `markup_example_template.html.erb` - used for html, haml and slim examples
|
123
|
+
|
124
|
+
* `markup_table_template.html.erb` - used for multiple html, haml and slim
|
125
|
+
examples layed out in a table (see
|
126
|
+
[the tabular layout docs](#tabular-layout-for-component-documentation)
|
127
|
+
for more information)
|
128
|
+
|
129
|
+
* `js_example_template.html.erb` - used for js examples
|
130
|
+
|
131
|
+
* `jsx_example_template.html.erb` - used for jsx examples
|
132
|
+
|
133
|
+
The html in the files will be rendered for every code example in the
|
134
|
+
styleguide. The variable `rendered_example` represents the html
|
135
|
+
generated by the example, while the variable `code_example` represents the
|
136
|
+
formatted and escaped code behind the example.
|
137
|
+
|
138
|
+
See [the documentation on custom code renderers](#custom_code_example_renderers)
|
139
|
+
for more information,
|
140
|
+
|
141
|
+
**Nota Bene:** If template files are missing, or this folder does not exist,
|
142
|
+
hologram will use default templates.
|
143
|
+
|
144
|
+
* **code\_example\_renderers**: (optional) A folder that contains your custom
|
145
|
+
code renderers. For example, if you want to have `coffee_example`s in your
|
146
|
+
code, write a coffeescript renderer and place it in this folder. See
|
147
|
+
[#custom_code_example_renders](below) for more inforamtion on this.
|
148
|
+
|
116
149
|
* **custom_markdown**: (optional) this is the filename of a class that
|
117
150
|
extends RedCarpet::Render::HTML class. Use this for when you need
|
118
151
|
additional classes or html tags for different parts of the page. See
|
119
|
-
|
152
|
+
[example_markdown_renderer.rb.example]
|
153
|
+
(example_markdown_renderer.rb.example) for an example of what your
|
120
154
|
class can look like.
|
121
155
|
|
122
156
|
* **index**: (optional) this is a category (see **Documenting your
|
@@ -129,6 +163,16 @@ Your config file needs to contain the following key/value pairs
|
|
129
163
|
that they are included on your pages. A simple way to do this is to add
|
130
164
|
`<link>` and `<script src=>` tags to the `_header.html` file.
|
131
165
|
|
166
|
+
* **nav_level**: (optional) Sets the level of section navigation desired.
|
167
|
+
`section` sets it to show sub navigation in top level sections.
|
168
|
+
`all` sets it to show sub navigation for all sections. `all` can be a bit
|
169
|
+
much, you'll probably want `section`.
|
170
|
+
|
171
|
+
* **exit_on_warnings**: (optional) Hologram displays warnings when there
|
172
|
+
are issues with your docs (e.g. if a component's parent is not found,
|
173
|
+
if the _header.html and/or _footer.html files aren't found)
|
174
|
+
If you want Hologram to exit on these warnings, set the value to 'true'
|
175
|
+
(Default value is 'false')
|
132
176
|
|
133
177
|
##### Example config file
|
134
178
|
|
@@ -151,6 +195,17 @@ Your config file needs to contain the following key/value pairs
|
|
151
195
|
# You may put doc related assets here too: images, css, etc.
|
152
196
|
documentation_assets: ./doc_assets
|
153
197
|
|
198
|
+
# The folder that contains templates for rendering code examples.
|
199
|
+
# If you want to change the way code examples appear in the styleguide,
|
200
|
+
# modify the files in this folder
|
201
|
+
code_example_templates: ./code_example_templates
|
202
|
+
|
203
|
+
# The folder that contains custom code example renderers.
|
204
|
+
# If you want to create additional renderers that are not provided
|
205
|
+
# by Hologram (i.e. coffeescript renderer, jade renderer, etc)
|
206
|
+
# place them in this folder
|
207
|
+
code_example_renderers: ./code_example_renderers
|
208
|
+
|
154
209
|
# Any other asset folders that need to be copied to the destination
|
155
210
|
# folder. Typically this will include the css that you are trying to
|
156
211
|
# document. May also include additional folders as needed.
|
@@ -162,6 +217,17 @@ Your config file needs to contain the following key/value pairs
|
|
162
217
|
# folder instead of specifying this config.
|
163
218
|
index: basics
|
164
219
|
|
220
|
+
# To output navigation for top level sections, set the value to
|
221
|
+
# 'section'. To output navigation for sub-sections, set the value to `all`
|
222
|
+
nav_level: all
|
223
|
+
|
224
|
+
# Hologram displays warnings when there are issues with your docs
|
225
|
+
# (e.g. if a component's parent is not found, if the _header.html and/or
|
226
|
+
# _footer.html files aren't found)
|
227
|
+
# If you want Hologram to exit on these warnings, set the value to 'true'
|
228
|
+
# (Default value is 'false')
|
229
|
+
exit_on_warnings: false
|
230
|
+
|
165
231
|
### Documenting your styles and components
|
166
232
|
|
167
233
|
Hologram will scan for stylesheets (.css, .scss, .sass, .less, or .styl)
|
@@ -204,6 +270,55 @@ For components that require [javascript](https://www.destroyallsoftware.com/talk
|
|
204
270
|
you can use `js_example`. In addition to outputting the javascript in a
|
205
271
|
`<code>` block it will also wrap it in a `<script>` tag for execution.
|
206
272
|
|
273
|
+
Additionally, html elements that are generated via markdown will have a
|
274
|
+
class `styleguide` appended to them. You can use this to apply css to
|
275
|
+
the styleguide itself.
|
276
|
+
|
277
|
+
#### Tabular layout for component documentation
|
278
|
+
|
279
|
+
If you want the code snippet next to the rendered component, instead of below,
|
280
|
+
render your component horizontally by applying the `html_example_table` or
|
281
|
+
`haml_example_table` modifiers to the code block.
|
282
|
+
|
283
|
+
/*doc
|
284
|
+
---
|
285
|
+
title: Buttons
|
286
|
+
name: button
|
287
|
+
category: Base CSS
|
288
|
+
---
|
289
|
+
|
290
|
+
```html_example_table
|
291
|
+
<button class="btn btnDefault">Click</button>
|
292
|
+
|
293
|
+
<a class="btn btnDefault" href="trulia.com">Trulia!</a>
|
294
|
+
```
|
295
|
+
|
296
|
+
*/
|
297
|
+
|
298
|
+
**NB:** Components separated by a blank line will be rendered as separate table rows.
|
299
|
+
|
300
|
+
#### Referencing other components
|
301
|
+
|
302
|
+
For some components, you may want to reference the documentation of another component.
|
303
|
+
As an example, you may want your link components to link to the button documentation.
|
304
|
+
|
305
|
+
/*doc
|
306
|
+
---
|
307
|
+
title: Links
|
308
|
+
name: links
|
309
|
+
category: Other Category
|
310
|
+
---
|
311
|
+
|
312
|
+
...
|
313
|
+
|
314
|
+
You may want to use a button for a link.
|
315
|
+
See [the button documentation][button] for more info.
|
316
|
+
|
317
|
+
*/
|
318
|
+
|
319
|
+
You can use a reference link of the form `[link description][component_name]`
|
320
|
+
to link to any other component in the styleguide.
|
321
|
+
These links will even work if the referenced component belongs to a different category.
|
207
322
|
|
208
323
|
#### Document YAML section
|
209
324
|
|
@@ -257,10 +372,132 @@ css file that styles the "pygmentized" code examples. We use
|
|
257
372
|
blocks
|
258
373
|
[here](https://github.com/trulia/hologram-example/tree/gh-pages/hologram_assets/doc_assets/css).
|
259
374
|
|
375
|
+
### Custom Code Example Renderers
|
376
|
+
|
377
|
+
By default, hologram supports the following code example types:
|
378
|
+
|
379
|
+
- `html_example` and `html_example_table`
|
380
|
+
- `haml_example` and `haml_example_table`
|
381
|
+
- `slim_example` and `slim_example_table`
|
382
|
+
- `js_example`
|
383
|
+
- `jsx_example`
|
384
|
+
|
385
|
+
Let's say you want to include coffeescript examples in your styleguide.
|
386
|
+
You'll need to create a custom renderer for this.
|
387
|
+
|
388
|
+
First, if none of the included templates (`markup_example_template`, `js_example_template`, etc)
|
389
|
+
work for you, create new custom template files. In this example,
|
390
|
+
let's say you have
|
391
|
+
the templates `my_custom_coffee_example_template.html.erb` and
|
392
|
+
`my_custom_coffee_table_template.html.erb` in your `./code_example_templates` folder.
|
393
|
+
|
394
|
+
```erb
|
395
|
+
<!-- ./code_example_templates/my_custom_coffee_example_template.html.erb -->
|
396
|
+
|
397
|
+
<script><%= rendered_example %></script>
|
398
|
+
<div class="codeBlock coffeeExample">
|
399
|
+
<div class="highlight">
|
400
|
+
<pre><%= code_example %></pre>
|
401
|
+
</div>
|
402
|
+
</div>
|
403
|
+
```
|
404
|
+
|
405
|
+
```erb
|
406
|
+
<!-- ./code_example_templates/my_custom_coffee_table_template.html.erb -->
|
407
|
+
|
408
|
+
<div class="codeTable">
|
409
|
+
<table>
|
410
|
+
<tbody>
|
411
|
+
<% examples.each do |example| %>
|
412
|
+
<tr>
|
413
|
+
<td>
|
414
|
+
<script><%= example.rendered_example %></script>
|
415
|
+
<div class="codeBlock coffeeExample">
|
416
|
+
<div class="highlight">
|
417
|
+
<pre><%= example.code_example %></pre>
|
418
|
+
</div>
|
419
|
+
</div>
|
420
|
+
</td>
|
421
|
+
</tr>
|
422
|
+
<% end %>
|
423
|
+
</tbody>
|
424
|
+
</table>
|
425
|
+
</div>
|
426
|
+
```
|
427
|
+
|
428
|
+
Next, create a custom renderer for coffeescript in the file
|
429
|
+
`./code_example_renderers/coffee_renderer.rb`.
|
430
|
+
|
431
|
+
```ruby
|
432
|
+
# ./code_example_renderers/coffee_renderer.rb
|
433
|
+
|
434
|
+
require 'coffee-script'
|
435
|
+
|
436
|
+
Hologram::CodeExampleRenderer::Factory.define('coffee') do
|
437
|
+
example_template 'my_custom_coffee_example_template'
|
438
|
+
table_template 'my_custom_coffee_table_template'
|
439
|
+
|
440
|
+
lexer { Rouge::Lexer.find(:coffee) }
|
441
|
+
|
442
|
+
rendered_example do |code|
|
443
|
+
CoffeeScript.compile(code)
|
444
|
+
end
|
445
|
+
end
|
446
|
+
```
|
447
|
+
|
448
|
+
Now you should be able to render coffeescript examples in your styleguide.
|
449
|
+
You can render single coffeescript examples...
|
450
|
+
|
451
|
+
```coffee_example
|
452
|
+
$('#myDiv').click ->
|
453
|
+
alert 'Oh wow we are rendering coffee script'
|
454
|
+
```
|
455
|
+
|
456
|
+
Or you can render coffeescript tables...
|
457
|
+
|
458
|
+
```coffee_example_table
|
459
|
+
$('#myDiv').click ->
|
460
|
+
alert 'Oh wow we are rendering coffee script'
|
461
|
+
|
462
|
+
$('#myOtherDiv').click ->
|
463
|
+
console.log 'Yeah coffee script!'
|
464
|
+
|
465
|
+
$('#yetAnotherDiv').click ->
|
466
|
+
window.location =
|
467
|
+
```
|
468
|
+
|
469
|
+
Here's some details on the code example renderer factory:
|
470
|
+
|
471
|
+
* `Hologram::CodeExampleRenderer::Factory.define(example_type, &block)` -
|
472
|
+
this is how you declare a custom renderer. `example_type` is the name of the
|
473
|
+
renderer, and determines the example name. For example, if `example_type`
|
474
|
+
was "foobar", in your styleguide you can create `foobar_example`s and
|
475
|
+
`foobar_example_table`s
|
476
|
+
|
477
|
+
* `example_template` - the name of the template used to render the example,
|
478
|
+
minus the `.html.erb` extension (e.g. "markup_example_template"). It
|
479
|
+
should live in your **code\_example\_templates** folder
|
480
|
+
|
481
|
+
* `table_template` - (optional) the name of the template used to render examples in
|
482
|
+
tabular form, minus the extension (e.g. "markup_table_template").
|
483
|
+
|
484
|
+
* `lexer` - (optional) a Rogue Lexer that matches the syntax of your
|
485
|
+
example (i.e. `Rouge::Lexer.find(:haml)`, `Rouge::Lexer.find(:ruby)`).
|
486
|
+
Here's a [complete list of possible lexers](http://rouge.jayferd.us/demo).
|
487
|
+
If this argument is not provided, hologram will guess what the best
|
488
|
+
one is.
|
489
|
+
|
490
|
+
* `rendered_example` - (optional) this is the set of instructions to
|
491
|
+
"translate" your exaple so it can be rendered. I.e. for coffeescript
|
492
|
+
to be "rendered" in the browser, you need to transform it to
|
493
|
+
javascript (as can be seen in the block above).
|
494
|
+
For haml, you need to transform it to html.
|
495
|
+
If no block is provided, the code is rendered as is.
|
260
496
|
|
261
497
|
## Supported Preprocessors/File Types
|
262
498
|
|
263
499
|
The following preprocessors/file types are supported by Hologram:
|
500
|
+
|
264
501
|
- Sass (.scss, .sass)
|
265
502
|
- Less (.less)
|
266
503
|
- Stylus (.styl)
|
@@ -276,10 +513,11 @@ The following preprocessors/file types are supported by Hologram:
|
|
276
513
|
and rebuilds your style guide on the fly as you make changes.
|
277
514
|
- [Grunt Hologram](https://github.com/jchild3rs/grunt-hologram/) is a sweet
|
278
515
|
little grunt task that will generate your hologram style guide.
|
516
|
+
- [Hologram Plugin for Gulp](https://gist.github.com/jchild3rs/470be49a4bc4caf3ca8a) is a gulp task for hologram.
|
279
517
|
- [Classname Clicker](https://github.com/bigethan/hologram-addons/) is a handy
|
280
|
-
UI addition that gives the ability to see rules that apply to a classname by
|
518
|
+
UI addition that gives the ability to see rules that apply to a classname by
|
281
519
|
clicking on them within hologram.
|
282
|
-
- [Cortana](https://github.com/Yago/Cortana) is a theme for hologram. It also
|
520
|
+
- [Cortana](https://github.com/Yago/Cortana) is a theme for hologram. It also
|
283
521
|
includes a handy search feature.
|
284
522
|
|
285
523
|
## Contributing
|
data/hologram.gemspec
CHANGED
@@ -24,4 +24,6 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "rspec", "~> 2.14"
|
27
|
+
spec.add_development_dependency "haml"
|
28
|
+
spec.add_development_dependency "slim"
|
27
29
|
end
|
data/lib/hologram.rb
CHANGED
@@ -17,6 +17,7 @@ require 'hologram/display_message'
|
|
17
17
|
require 'hologram/errors'
|
18
18
|
require 'hologram/utils'
|
19
19
|
require 'hologram/markdown_renderer'
|
20
|
+
require 'hologram/code_example_renderer'
|
20
21
|
|
21
22
|
Encoding.default_internal = Encoding::UTF_8
|
22
23
|
Encoding.default_external = Encoding::UTF_8
|
@@ -26,6 +27,7 @@ module Hologram
|
|
26
27
|
INIT_TEMPLATE_FILES = [
|
27
28
|
INIT_TEMPLATE_PATH + '/hologram_config.yml',
|
28
29
|
INIT_TEMPLATE_PATH + '/doc_assets',
|
30
|
+
INIT_TEMPLATE_PATH + '/code_example_templates',
|
29
31
|
]
|
30
32
|
end
|
31
33
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
3
|
+
module Hologram
|
4
|
+
class BlockCodeRenderer
|
5
|
+
def initialize(code, markdown_language)
|
6
|
+
@code = code
|
7
|
+
@markdown_language = markdown_language
|
8
|
+
end
|
9
|
+
|
10
|
+
def render
|
11
|
+
if is_table? && table_template
|
12
|
+
examples = code.split("\n\n").map { |code_snippet| example_class.new(code_snippet) }
|
13
|
+
ERB.new(table_template).result(binding)
|
14
|
+
else
|
15
|
+
example = example_class.new(code)
|
16
|
+
ERB.new(example_template).result(example.get_binding)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
attr_reader :code, :markdown_language
|
23
|
+
|
24
|
+
def example_class
|
25
|
+
CodeExampleRenderer.example_class_for(example_type)
|
26
|
+
end
|
27
|
+
|
28
|
+
def example_template
|
29
|
+
CodeExampleRenderer.example_template_for(example_type)
|
30
|
+
end
|
31
|
+
|
32
|
+
def table_template
|
33
|
+
CodeExampleRenderer.table_template_for(example_type)
|
34
|
+
end
|
35
|
+
|
36
|
+
def example_type
|
37
|
+
match = /(\w+)_example/.match(markdown_language)
|
38
|
+
match ? match.captures.first : nil
|
39
|
+
end
|
40
|
+
|
41
|
+
def is_table?
|
42
|
+
markdown_language && markdown_language.include?('example_table')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|