papercraft 2.14 → 2.15
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/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/lib/papercraft/compiler/tag_translator.rb +1 -1
- data/lib/papercraft/compiler.rb +1 -1
- data/lib/papercraft/version.rb +1 -1
- data/lib/papercraft.rb +16 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97d2e54989eea3ae631687adb3e484779d48d38d5251705e9fab7f8dd0e0b964
|
4
|
+
data.tar.gz: 02e161802820d2978e04033fa69a8d8850beeab7bc101a8020e7d4ba7262e204
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c293bb44d8e53aedb3b19fdc45ea61956ef97637ba387e78180bb854fc5c445502968a38739211ae951c3c00355a42259ee5b3a418994804723615c44be6430d
|
7
|
+
data.tar.gz: 514a56dc9cb1920209b08fa07a93a631c68352539f27d41be8a39038a65cb48af48bfda598c5091f00c17c50cb12a820bc5e9f6c65d2740323b2baf4761271cc
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -305,7 +305,7 @@ large_button = ->(title) { button(title, class: 'large') }
|
|
305
305
|
}.render #=> <button class="large">foo</button>
|
306
306
|
```
|
307
307
|
|
308
|
-
### `#html5` - emit an HTML5 document type declaration and html tag
|
308
|
+
### `#html`/`#html5` - emit an HTML5 document type declaration and html tag
|
309
309
|
|
310
310
|
```ruby
|
311
311
|
-> {
|
data/lib/papercraft/compiler.rb
CHANGED
@@ -310,7 +310,7 @@ module Papercraft
|
|
310
310
|
case node.tag
|
311
311
|
when :tag
|
312
312
|
args = node.call_node.arguments&.arguments
|
313
|
-
when :html5
|
313
|
+
when :html, :html5
|
314
314
|
emit_html(node.location, '<!DOCTYPE html><html>')
|
315
315
|
visit(node.block.body) if node.block
|
316
316
|
emit_html(node.block.closing_loc, '</html>')
|
data/lib/papercraft/version.rb
CHANGED
data/lib/papercraft.rb
CHANGED
@@ -94,13 +94,14 @@ module Papercraft
|
|
94
94
|
ArgumentError.new(message).tap { it.set_backtrace(backtrace) }
|
95
95
|
end
|
96
96
|
|
97
|
-
#
|
98
|
-
# default Kramdown options in order to change the rendering
|
97
|
+
# Returns a Kramdown doc for the given markdown. The `opts` argument will be
|
98
|
+
# merged with the default Kramdown options in order to change the rendering
|
99
|
+
# behaviour.
|
99
100
|
#
|
100
101
|
# @param markdown [String] Markdown
|
101
102
|
# @param opts [Hash] Kramdown option overrides
|
102
|
-
# @return [
|
103
|
-
def
|
103
|
+
# @return [Kramdown::Document] Kramdown document
|
104
|
+
def markdown_doc(markdown, **opts)
|
104
105
|
@markdown_deps_loaded ||= true.tap do
|
105
106
|
require 'kramdown'
|
106
107
|
require 'rouge'
|
@@ -108,7 +109,17 @@ module Papercraft
|
|
108
109
|
end
|
109
110
|
|
110
111
|
opts = default_kramdown_options.merge(opts)
|
111
|
-
Kramdown::Document.new(markdown, **opts)
|
112
|
+
Kramdown::Document.new(markdown, **opts)
|
113
|
+
end
|
114
|
+
|
115
|
+
# Renders Markdown into HTML. The `opts` argument will be merged with the
|
116
|
+
# default Kramdown options in order to change the rendering behaviour.
|
117
|
+
#
|
118
|
+
# @param markdown [String] Markdown
|
119
|
+
# @param opts [Hash] Kramdown option overrides
|
120
|
+
# @return [String] HTML
|
121
|
+
def markdown(markdown, **opts)
|
122
|
+
markdown_doc(markdown, **opts).to_html
|
112
123
|
end
|
113
124
|
|
114
125
|
# Returns the default Kramdown options used for rendering Markdown.
|