piko-fast-lib 0.0.1

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.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/piko-fast-lib.gemspec +11 -0
  3. data/redcarpet-3.6.1/CHANGELOG.md +487 -0
  4. data/redcarpet-3.6.1/CONTRIBUTING.md +33 -0
  5. data/redcarpet-3.6.1/COPYING +20 -0
  6. data/redcarpet-3.6.1/Gemfile +9 -0
  7. data/redcarpet-3.6.1/README.markdown +405 -0
  8. data/redcarpet-3.6.1/Rakefile +60 -0
  9. data/redcarpet-3.6.1/bin/redcarpet +7 -0
  10. data/redcarpet-3.6.1/ext/redcarpet/autolink.c +308 -0
  11. data/redcarpet-3.6.1/ext/redcarpet/autolink.h +55 -0
  12. data/redcarpet-3.6.1/ext/redcarpet/buffer.c +203 -0
  13. data/redcarpet-3.6.1/ext/redcarpet/buffer.h +88 -0
  14. data/redcarpet-3.6.1/ext/redcarpet/extconf.rb +6 -0
  15. data/redcarpet-3.6.1/ext/redcarpet/houdini.h +51 -0
  16. data/redcarpet-3.6.1/ext/redcarpet/houdini_href_e.c +124 -0
  17. data/redcarpet-3.6.1/ext/redcarpet/houdini_html_e.c +104 -0
  18. data/redcarpet-3.6.1/ext/redcarpet/html.c +869 -0
  19. data/redcarpet-3.6.1/ext/redcarpet/html.h +83 -0
  20. data/redcarpet-3.6.1/ext/redcarpet/html_block_names.txt +44 -0
  21. data/redcarpet-3.6.1/ext/redcarpet/html_blocks.h +222 -0
  22. data/redcarpet-3.6.1/ext/redcarpet/html_smartypants.c +472 -0
  23. data/redcarpet-3.6.1/ext/redcarpet/markdown.c +2946 -0
  24. data/redcarpet-3.6.1/ext/redcarpet/markdown.h +143 -0
  25. data/redcarpet-3.6.1/ext/redcarpet/rc_markdown.c +194 -0
  26. data/redcarpet-3.6.1/ext/redcarpet/rc_render.c +601 -0
  27. data/redcarpet-3.6.1/ext/redcarpet/redcarpet.h +54 -0
  28. data/redcarpet-3.6.1/ext/redcarpet/stack.c +84 -0
  29. data/redcarpet-3.6.1/ext/redcarpet/stack.h +48 -0
  30. data/redcarpet-3.6.1/lib/redcarpet/cli.rb +86 -0
  31. data/redcarpet-3.6.1/lib/redcarpet/compat.rb +71 -0
  32. data/redcarpet-3.6.1/lib/redcarpet/render_man.rb +65 -0
  33. data/redcarpet-3.6.1/lib/redcarpet/render_strip.rb +60 -0
  34. data/redcarpet-3.6.1/lib/redcarpet.rb +92 -0
  35. data/redcarpet-3.6.1/redcarpet.gemspec +59 -0
  36. metadata +74 -0
@@ -0,0 +1,405 @@
1
+ Redcarpet is written with sugar, spice and everything nice
2
+ ============================================================
3
+
4
+ [![Build status](https://github.com/vmg/redcarpet/actions/workflows/test.yml/badge.svg)](https://github.com/vmg/redcarpet/actions/workflows/test.yml)
5
+ [![Help Contribute to Open Source](https://www.codetriage.com/vmg/redcarpet/badges/users.svg)](https://www.codetriage.com/vmg/redcarpet)
6
+ [![Gem Version](https://badge.fury.io/rb/redcarpet.svg)](https://badge.fury.io/rb/redcarpet)
7
+
8
+ Redcarpet is a Ruby library for Markdown processing that smells like
9
+ butterflies and popcorn.
10
+
11
+ This library is written by people
12
+ ---------------------------------
13
+
14
+ Redcarpet was written by [Vicent Martí](https://github.com/vmg). It is maintained by
15
+ [Robin Dupret](https://github.com/robin850) and [Matt Rogers](https://github.com/mattr-).
16
+
17
+ Redcarpet would not be possible without the [Sundown](https://www.github.com/vmg/sundown)
18
+ library and its authors (Natacha Porté, Vicent Martí, and its many awesome contributors).
19
+
20
+ You can totally install it as a Gem
21
+ -----------------------------------
22
+
23
+ Redcarpet is readily available as a Ruby gem. It will build some native
24
+ extensions, but the parser is standalone and requires no installed libraries.
25
+ Starting with Redcarpet 3.0, the minimum required Ruby version is 1.9.2 (or Rubinius in 1.9 mode).
26
+
27
+ $ [sudo] gem install redcarpet
28
+
29
+ If you need to use it with Ruby 1.8.7, you will have to stick with 2.3.0:
30
+
31
+ $ [sudo] gem install redcarpet -v 2.3.0
32
+
33
+ The Redcarpet source is available at GitHub:
34
+
35
+ $ git clone git://github.com/vmg/redcarpet.git
36
+
37
+
38
+ And it's like *really* simple to use
39
+ ------------------------------------
40
+
41
+ The core of the Redcarpet library is the `Redcarpet::Markdown` class. Each
42
+ instance of the class is attached to a `Renderer` object; the Markdown class
43
+ performs parsing of a document and uses the attached renderer to generate
44
+ output.
45
+
46
+ The `Redcarpet::Markdown` object is encouraged to be instantiated once with the
47
+ required settings, and reused between parses.
48
+
49
+ ~~~~ ruby
50
+ # Initializes a Markdown parser
51
+ markdown = Redcarpet::Markdown.new(renderer, extensions = {})
52
+ ~~~~
53
+
54
+ Here, the `renderer` variable refers to a renderer object, inheriting
55
+ from `Redcarpet::Render::Base`. If the given object has not been
56
+ instantiated, the library will do it with default arguments.
57
+
58
+ Rendering with the `Markdown` object is done through `Markdown#render`.
59
+ Unlike in the RedCloth API, the text to render is passed as an argument
60
+ and not stored inside the `Markdown` instance, to encourage reusability.
61
+ Example:
62
+
63
+ ~~~~ ruby
64
+ markdown.render("This is *bongos*, indeed.")
65
+ # => "<p>This is <em>bongos</em>, indeed.</p>"
66
+ ~~~~
67
+
68
+ You can also specify a hash containing the Markdown extensions which the
69
+ parser will identify. The following extensions are accepted:
70
+
71
+ * `:no_intra_emphasis`: do not parse emphasis inside of words.
72
+ Strings such as `foo_bar_baz` will not generate `<em>` tags.
73
+
74
+ * `:tables`: parse tables, PHP-Markdown style.
75
+
76
+ * `:fenced_code_blocks`: parse fenced code blocks, PHP-Markdown
77
+ style. Blocks delimited with 3 or more `~` or backticks will be considered
78
+ as code, without the need to be indented. An optional language name may
79
+ be added at the end of the opening fence for the code block.
80
+
81
+ * `:autolink`: parse links even when they are not enclosed in `<>`
82
+ characters. Autolinks for the http, https and ftp protocols will be
83
+ automatically detected. Email addresses and http links without protocol,
84
+ but starting with `www` are also handled.
85
+
86
+ * `:disable_indented_code_blocks`: do not parse usual markdown
87
+ code blocks. Markdown converts text with four spaces at
88
+ the front of each line to code blocks. This option
89
+ prevents it from doing so. Recommended to use
90
+ with `fenced_code_blocks: true`.
91
+
92
+ * `:strikethrough`: parse strikethrough, PHP-Markdown style.
93
+ Two `~` characters mark the start of a strikethrough,
94
+ e.g. `this is ~~good~~ bad`.
95
+
96
+ * `:lax_spacing`: HTML blocks do not require to be surrounded by an
97
+ empty line as in the Markdown standard.
98
+
99
+ * `:space_after_headers`: A space is always required between the hash
100
+ at the beginning of a header and its name, e.g. `#this is my header`
101
+ would not be a valid header.
102
+
103
+ * `:superscript`: parse superscripts after the `^` character; contiguous superscripts
104
+ are nested together, and complex values can be enclosed in parenthesis, e.g.
105
+ `this is the 2^(nd) time`.
106
+
107
+ * `:underline`: parse underscored emphasis as underlines.
108
+ `This is _underlined_ but this is still *italic*`.
109
+
110
+ * `:highlight`: parse highlights.
111
+ `This is ==highlighted==`. It looks like this: `<mark>highlighted</mark>`
112
+
113
+ * `:quote`: parse quotes.
114
+ `This is a "quote"`. It looks like this: `<q>quote</q>`
115
+
116
+ * `:footnotes`: parse footnotes, PHP-Markdown style. A footnote works very much
117
+ like a reference-style link: it consists of a marker next to the text (e.g.
118
+ `This is a sentence.[^1]`) and a footnote definition on its own line anywhere
119
+ within the document (e.g. `[^1]: This is a footnote.`).
120
+
121
+ Example:
122
+
123
+ ~~~~ ruby
124
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
125
+ ~~~~
126
+
127
+ Darling, I packed you a couple renderers for lunch
128
+ --------------------------------------------------
129
+
130
+ Redcarpet comes with two built-in renderers, `Redcarpet::Render::HTML` and
131
+ `Redcarpet::Render::XHTML`, which output HTML and XHTML, respectively. These
132
+ renderers are actually implemented in C and hence offer brilliant
133
+ performance — several degrees of magnitude faster than other Ruby Markdown
134
+ solutions.
135
+
136
+ All the rendering flags that previously applied only to HTML output have
137
+ now been moved to the `Redcarpet::Render::HTML` class, and may be enabled when
138
+ instantiating the renderer:
139
+
140
+ ~~~~ ruby
141
+ Redcarpet::Render::HTML.new(render_options = {})
142
+ ~~~~
143
+
144
+ Initializes an HTML renderer. The following flags are available:
145
+
146
+ * `:filter_html`: do not allow any user-inputted HTML in the output.
147
+
148
+ * `:no_images`: do not generate any `<img>` tags.
149
+
150
+ * `:no_links`: do not generate any `<a>` tags.
151
+
152
+ * `:no_styles`: do not generate any `<style>` tags.
153
+
154
+ * `:escape_html`: escape any HTML tags. This option has precedence over
155
+ `:no_styles`, `:no_links`, `:no_images` and `:filter_html` which means
156
+ that any existing tag will be escaped instead of being removed.
157
+
158
+ * `:safe_links_only`: only generate links for protocols which are considered
159
+ safe.
160
+
161
+ * `:with_toc_data`: add HTML anchors to each header in the output HTML,
162
+ to allow linking to each section.
163
+
164
+ * `:hard_wrap`: insert HTML `<br>` tags inside paragraphs where the original
165
+ Markdown document had newlines (by default, Markdown ignores these newlines).
166
+
167
+ * `:xhtml`: output XHTML-conformant tags. This option is always enabled in the
168
+ `Render::XHTML` renderer.
169
+
170
+ * `:prettify`: add prettyprint classes to `<code>` tags for google-code-prettify.
171
+
172
+ * `:link_attributes`: hash of extra attributes to add to links.
173
+
174
+ Example:
175
+
176
+ ~~~~ ruby
177
+ renderer = Redcarpet::Render::HTML.new(no_links: true, hard_wrap: true)
178
+ ~~~~
179
+
180
+
181
+ The `HTML` renderer has an alternate version, `Redcarpet::Render::HTML_TOC`,
182
+ which will output a table of contents in HTML based on the headers of the
183
+ Markdown document.
184
+
185
+ When instantiating this render object, you can optionally pass a `nesting_level`
186
+ option which takes an integer or a range and allows you to make it render only
187
+ headers at certain levels.
188
+
189
+ Redcarpet also includes a plaintext renderer, `Redcarpet::Render::StripDown`, that
190
+ strips out all the formatting:
191
+
192
+ ~~~~ ruby
193
+ require 'redcarpet'
194
+ require 'redcarpet/render_strip'
195
+
196
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::StripDown)
197
+
198
+ markdown.render("**This** _is_ an [example](http://example.org/).")
199
+ # => "This is an example (http://example.org/)."
200
+ ~~~~
201
+
202
+
203
+ And you can even cook your own
204
+ ------------------------------
205
+
206
+ Custom renderers are created by inheriting from an existing renderer. The
207
+ built-in renderers, `HTML` and `XHTML` may be extended as such:
208
+
209
+ ~~~~ ruby
210
+ # Create a custom renderer that sets a custom class for block-quotes.
211
+ class CustomRender < Redcarpet::Render::HTML
212
+ def block_quote(quote)
213
+ %(<blockquote class="my-custom-class">#{quote}</blockquote>)
214
+ end
215
+ end
216
+
217
+ markdown = Redcarpet::Markdown.new(CustomRender, fenced_code_blocks: true)
218
+ ~~~~
219
+
220
+ But new renderers can also be created from scratch by extending the abstract
221
+ base class `Redcarpet::Render::Base` (see `lib/redcarpet/render_man.rb` for
222
+ an example implementation of a Manpage renderer):
223
+
224
+ ~~~~ ruby
225
+ class ManPage < Redcarpet::Render::Base
226
+ # you get the drill -- keep going from here
227
+ end
228
+ ~~~~
229
+
230
+ The following instance methods may be implemented by the renderer:
231
+
232
+ ### Block-level calls
233
+
234
+ If the return value of the method is `nil`, the block will be skipped.
235
+ Therefore, make sure that your renderer has at least a `paragraph` method
236
+ implemented. If the method for a document element is not implemented, the
237
+ block will be skipped.
238
+
239
+ Example:
240
+
241
+ ~~~~ ruby
242
+ class RenderWithoutCode < Redcarpet::Render::HTML
243
+ def block_code(code, language)
244
+ nil
245
+ end
246
+ end
247
+ ~~~~
248
+
249
+ * block_code(code, language)
250
+ * block_quote(quote)
251
+ * block_html(raw_html)
252
+ * footnotes(content)
253
+ * footnote_def(content, number)
254
+ * header(text, header_level)
255
+ * hrule()
256
+ * list(contents, list_type)
257
+ * list_item(text, list_type)
258
+ * paragraph(text)
259
+ * table(header, body)
260
+ * table_row(content)
261
+ * table_cell(content, alignment, header)
262
+
263
+ ### Span-level calls
264
+
265
+ A return value of `nil` will not output any data. If the method for
266
+ a document element is not implemented, the contents of the span will
267
+ be copied verbatim:
268
+
269
+ * autolink(link, link_type)
270
+ * codespan(code)
271
+ * double_emphasis(text)
272
+ * emphasis(text)
273
+ * image(link, title, alt_text)
274
+ * linebreak()
275
+ * link(link, title, content)
276
+ * raw_html(raw_html)
277
+ * triple_emphasis(text)
278
+ * strikethrough(text)
279
+ * superscript(text)
280
+ * underline(text)
281
+ * highlight(text)
282
+ * quote(text)
283
+ * footnote_ref(number)
284
+
285
+ **Note**: When overriding a renderer's method, be sure to return a HTML
286
+ element with a level that matches the level of that method (e.g. return a
287
+ block element when overriding a block-level callback). Otherwise, the output
288
+ may be unexpected.
289
+
290
+ ### Low level rendering
291
+
292
+ * entity(text)
293
+ * normal_text(text)
294
+
295
+ ### Header of the document
296
+
297
+ Rendered before any another elements:
298
+
299
+ * doc_header()
300
+
301
+ ### Footer of the document
302
+
303
+ Rendered after all the other elements:
304
+
305
+ * doc_footer()
306
+
307
+ ### Pre/post-process
308
+
309
+ Special callback: preprocess or postprocess the whole document before
310
+ or after the rendering process begins:
311
+
312
+ * preprocess(full_document)
313
+ * postprocess(full_document)
314
+
315
+ You can look at
316
+ ["How to extend the Redcarpet 2 Markdown library?"](https://web.archive.org/web/20170505231254/http://dev.af83.com/2012/02/27/howto-extend-the-redcarpet2-markdown-lib.html)
317
+ for some more explanations.
318
+
319
+ Also, now our Pants are much smarter
320
+ ------------------------------------
321
+
322
+ Redcarpet 2 comes with a standalone [SmartyPants](
323
+ http://daringfireball.net/projects/smartypants/) implementation. It is fully
324
+ compliant with the original implementation. It is the fastest SmartyPants
325
+ parser there is, with a difference of several orders of magnitude.
326
+
327
+ The SmartyPants parser can be found in `Redcarpet::Render::SmartyPants`. It has
328
+ been implemented as a module, so it can be used standalone or as a mixin.
329
+
330
+ When mixed with a Renderer class, it will override the `postprocess` method
331
+ to perform SmartyPants replacements once the rendering is complete.
332
+
333
+ ~~~~ ruby
334
+ # Mixin
335
+ class HTMLWithPants < Redcarpet::Render::HTML
336
+ include Redcarpet::Render::SmartyPants
337
+ end
338
+
339
+ # Standalone
340
+ Redcarpet::Render::SmartyPants.render("<p>Oh SmartyPants, you're so crazy...</p>")
341
+ ~~~~
342
+
343
+ SmartyPants works on top of already-rendered HTML, and will ignore replacements
344
+ inside the content of HTML tags and inside specific HTML blocks (`pre`, `code`,
345
+ `var`, `samp`, `kbd`, `math`, `script`, `style`).
346
+
347
+ What? You really want to mix Markdown renderers?
348
+ ------------------------------------------------
349
+
350
+ Redcarpet used to be a drop-in replacement for Redcloth. This is no longer the
351
+ case since version 2 -- it now has its own API, but retains the old name. Yes,
352
+ that does mean that Redcarpet is not backwards-compatible with the 1.X
353
+ versions.
354
+
355
+ Each renderer has its own API and its own set of extensions: you should choose one
356
+ (it doesn't have to be Redcarpet, though that would be great!), write your
357
+ software accordingly, and force your users to install it. That's the
358
+ only way to have reliable and predictable Markdown output on your program.
359
+
360
+ Markdown is already ill-specified enough; if you create software that is
361
+ renderer-independent, the results will be completely unreliable!
362
+
363
+ Still, if major forces (let's say, tornadoes or other natural disasters) force you
364
+ to keep a Markdown-compatibility layer, Redcarpet also supports this:
365
+
366
+ ~~~~ ruby
367
+ require 'redcarpet/compat'
368
+ ~~~~
369
+
370
+ Requiring the compatibility library will declare a `Markdown` class with the
371
+ classical RedCloth API, e.g.
372
+
373
+ ~~~~ ruby
374
+ Markdown.new('this is my text').to_html
375
+ ~~~~
376
+
377
+ This class renders 100% standards compliant Markdown with 0 extensions. Nada.
378
+ Don't even try to enable extensions with a compatibility layer, because
379
+ that's a maintenance nightmare and won't work.
380
+
381
+ On a related topic: if your Markdown gem has a `lib/markdown.rb` file that
382
+ monkeypatches the Markdown class, you're a terrible human being. Just saying.
383
+
384
+ Boring legal stuff
385
+ ------------------
386
+
387
+ Copyright (c) 2011-2016, Vicent Martí
388
+
389
+ Permission is hereby granted, free of charge, to any person obtaining a copy
390
+ of this software and associated documentation files (the "Software"), to deal
391
+ in the Software without restriction, including without limitation the rights
392
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
393
+ copies of the Software, and to permit persons to whom the Software is
394
+ furnished to do so, subject to the following conditions:
395
+
396
+ The above copyright notice and this permission notice shall be included in
397
+ all copies or substantial portions of the Software.
398
+
399
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
400
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
401
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
402
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
403
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
404
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
405
+ THE SOFTWARE.
@@ -0,0 +1,60 @@
1
+ require 'date'
2
+ require 'rake/clean'
3
+ require 'rake/extensiontask'
4
+ require 'digest/md5'
5
+
6
+ task :default => [:test]
7
+
8
+ # Gem Spec
9
+ gem_spec = Gem::Specification.load('redcarpet.gemspec')
10
+
11
+ # Ruby Extension
12
+ Rake::ExtensionTask.new('redcarpet', gem_spec)
13
+
14
+ # Packaging
15
+ require 'bundler/gem_tasks'
16
+
17
+ # Testing
18
+ require 'rake/testtask'
19
+
20
+ Rake::TestTask.new('test:unit') do |t|
21
+ t.libs << 'lib'
22
+ t.libs << 'test'
23
+ t.pattern = 'test/*_test.rb'
24
+ t.verbose = true
25
+ t.warning = false
26
+ end
27
+
28
+ task 'test:unit' => :compile
29
+
30
+ desc 'Run conformance tests (MARKDOWN_TEST_VER=1.0.3)'
31
+ task 'test:conformance' => :compile do |t|
32
+ script = "#{pwd}/bin/redcarpet"
33
+ version = ENV['MARKDOWN_TEST_VER'] || '1.0.3'
34
+ lib_dir = "#{pwd}/lib"
35
+
36
+ chdir("test/MarkdownTest_#{version}") do
37
+ sh "RUBYLIB=#{lib_dir} ./MarkdownTest.pl --script='#{script}' --tidy"
38
+ end
39
+ end
40
+
41
+ desc 'Run version 1.0 conformance suite'
42
+ task 'test:conformance:1.0' => :compile do |t|
43
+ ENV['MARKDOWN_TEST_VER'] = '1.0'
44
+ Rake::Task['test:conformance'].invoke
45
+ end
46
+
47
+ desc 'Run 1.0.3 conformance suite'
48
+ task 'test:conformance:1.0.3' => :compile do |t|
49
+ ENV['MARKDOWN_TEST_VER'] = '1.0.3'
50
+ Rake::Task['test:conformance'].invoke
51
+ end
52
+
53
+ desc 'Run unit and conformance tests'
54
+ task :test => %w[test:unit test:conformance]
55
+
56
+ desc 'Run benchmarks'
57
+ task :benchmark => :compile do |t|
58
+ $:.unshift 'lib'
59
+ load 'test/benchmark.rb'
60
+ end
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+ lib_path = File.expand_path('../../lib', __FILE__)
3
+ $:.unshift(lib_path)
4
+
5
+ require 'redcarpet/cli'
6
+
7
+ Redcarpet::CLI.process(ARGV)