nano-pure-box 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.
- checksums.yaml +7 -0
- data/nano-pure-box.gemspec +12 -0
- data/redcarpet-3.6.1/CHANGELOG.md +487 -0
- data/redcarpet-3.6.1/CONTRIBUTING.md +33 -0
- data/redcarpet-3.6.1/COPYING +20 -0
- data/redcarpet-3.6.1/Gemfile +9 -0
- data/redcarpet-3.6.1/README.markdown +405 -0
- data/redcarpet-3.6.1/Rakefile +60 -0
- data/redcarpet-3.6.1/bin/redcarpet +7 -0
- data/redcarpet-3.6.1/ext/redcarpet/autolink.c +308 -0
- data/redcarpet-3.6.1/ext/redcarpet/autolink.h +55 -0
- data/redcarpet-3.6.1/ext/redcarpet/buffer.c +203 -0
- data/redcarpet-3.6.1/ext/redcarpet/buffer.h +88 -0
- data/redcarpet-3.6.1/ext/redcarpet/extconf.rb +6 -0
- data/redcarpet-3.6.1/ext/redcarpet/houdini.h +51 -0
- data/redcarpet-3.6.1/ext/redcarpet/houdini_href_e.c +124 -0
- data/redcarpet-3.6.1/ext/redcarpet/houdini_html_e.c +104 -0
- data/redcarpet-3.6.1/ext/redcarpet/html.c +869 -0
- data/redcarpet-3.6.1/ext/redcarpet/html.h +83 -0
- data/redcarpet-3.6.1/ext/redcarpet/html_block_names.txt +44 -0
- data/redcarpet-3.6.1/ext/redcarpet/html_blocks.h +222 -0
- data/redcarpet-3.6.1/ext/redcarpet/html_smartypants.c +472 -0
- data/redcarpet-3.6.1/ext/redcarpet/markdown.c +2946 -0
- data/redcarpet-3.6.1/ext/redcarpet/markdown.h +143 -0
- data/redcarpet-3.6.1/ext/redcarpet/rc_markdown.c +194 -0
- data/redcarpet-3.6.1/ext/redcarpet/rc_render.c +601 -0
- data/redcarpet-3.6.1/ext/redcarpet/redcarpet.h +54 -0
- data/redcarpet-3.6.1/ext/redcarpet/stack.c +84 -0
- data/redcarpet-3.6.1/ext/redcarpet/stack.h +48 -0
- data/redcarpet-3.6.1/lib/redcarpet/cli.rb +86 -0
- data/redcarpet-3.6.1/lib/redcarpet/compat.rb +71 -0
- data/redcarpet-3.6.1/lib/redcarpet/render_man.rb +65 -0
- data/redcarpet-3.6.1/lib/redcarpet/render_strip.rb +60 -0
- data/redcarpet-3.6.1/lib/redcarpet.rb +92 -0
- data/redcarpet-3.6.1/redcarpet.gemspec +59 -0
- metadata +75 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015, Vicent Marti
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
* THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
#include "stack.h"
|
|
24
|
+
#include <string.h>
|
|
25
|
+
|
|
26
|
+
int
|
|
27
|
+
redcarpet_stack_grow(struct stack *st, size_t new_size)
|
|
28
|
+
{
|
|
29
|
+
void **new_st;
|
|
30
|
+
|
|
31
|
+
if (st->asize >= new_size)
|
|
32
|
+
return 0;
|
|
33
|
+
|
|
34
|
+
new_st = realloc(st->item, new_size * sizeof(void *));
|
|
35
|
+
if (new_st == NULL)
|
|
36
|
+
return -1;
|
|
37
|
+
|
|
38
|
+
memset(new_st + st->asize, 0x0,
|
|
39
|
+
(new_size - st->asize) * sizeof(void *));
|
|
40
|
+
|
|
41
|
+
st->item = new_st;
|
|
42
|
+
st->asize = new_size;
|
|
43
|
+
|
|
44
|
+
if (st->size > new_size)
|
|
45
|
+
st->size = new_size;
|
|
46
|
+
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
void
|
|
51
|
+
redcarpet_stack_free(struct stack *st)
|
|
52
|
+
{
|
|
53
|
+
if (!st)
|
|
54
|
+
return;
|
|
55
|
+
|
|
56
|
+
free(st->item);
|
|
57
|
+
|
|
58
|
+
st->item = NULL;
|
|
59
|
+
st->size = 0;
|
|
60
|
+
st->asize = 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
int
|
|
64
|
+
redcarpet_stack_init(struct stack *st, size_t initial_size)
|
|
65
|
+
{
|
|
66
|
+
st->item = NULL;
|
|
67
|
+
st->size = 0;
|
|
68
|
+
st->asize = 0;
|
|
69
|
+
|
|
70
|
+
if (!initial_size)
|
|
71
|
+
initial_size = 8;
|
|
72
|
+
|
|
73
|
+
return redcarpet_stack_grow(st, initial_size);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
int
|
|
77
|
+
redcarpet_stack_push(struct stack *st, void *item)
|
|
78
|
+
{
|
|
79
|
+
if (redcarpet_stack_grow(st, st->size * 2) < 0)
|
|
80
|
+
return -1;
|
|
81
|
+
|
|
82
|
+
st->item[st->size++] = item;
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2015, Vicent Marti
|
|
3
|
+
*
|
|
4
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
* in the Software without restriction, including without limitation the rights
|
|
7
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
* furnished to do so, subject to the following conditions:
|
|
10
|
+
*
|
|
11
|
+
* The above copyright notice and this permission notice shall be included in
|
|
12
|
+
* all copies or substantial portions of the Software.
|
|
13
|
+
*
|
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
20
|
+
* THE SOFTWARE.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
#ifndef STACK_H__
|
|
24
|
+
#define STACK_H__
|
|
25
|
+
|
|
26
|
+
#include <stdlib.h>
|
|
27
|
+
|
|
28
|
+
#ifdef __cplusplus
|
|
29
|
+
extern "C" {
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
struct stack {
|
|
33
|
+
void **item;
|
|
34
|
+
size_t size;
|
|
35
|
+
size_t asize;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
void redcarpet_stack_free(struct stack *);
|
|
39
|
+
int redcarpet_stack_grow(struct stack *, size_t);
|
|
40
|
+
int redcarpet_stack_init(struct stack *, size_t);
|
|
41
|
+
|
|
42
|
+
int redcarpet_stack_push(struct stack *, void *);
|
|
43
|
+
|
|
44
|
+
#ifdef __cplusplus
|
|
45
|
+
}
|
|
46
|
+
#endif
|
|
47
|
+
|
|
48
|
+
#endif
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require 'redcarpet'
|
|
2
|
+
require 'optparse'
|
|
3
|
+
|
|
4
|
+
module Redcarpet
|
|
5
|
+
# This class aims at easing the creation of custom
|
|
6
|
+
# binary for your needs. For example, you can add new
|
|
7
|
+
# options or change the existing ones. The parsing
|
|
8
|
+
# is handled by Ruby's OptionParser. For instance:
|
|
9
|
+
#
|
|
10
|
+
# class Custom::CLI < Redcarpet::CLI
|
|
11
|
+
# def self.options_parser
|
|
12
|
+
# super.tap do |opts|
|
|
13
|
+
# opts.on("--rainbow") do
|
|
14
|
+
# @@options[:rainbow] = true
|
|
15
|
+
# end
|
|
16
|
+
# end
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# def self.render_object
|
|
20
|
+
# @@options[:rainbow] ? RainbowRender : super
|
|
21
|
+
# end
|
|
22
|
+
# end
|
|
23
|
+
class CLI
|
|
24
|
+
def self.options_parser
|
|
25
|
+
@@options = {
|
|
26
|
+
render_extensions: {},
|
|
27
|
+
parse_extensions: {},
|
|
28
|
+
smarty_pants: false
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
OptionParser.new do |opts|
|
|
32
|
+
opts.banner = "Usage: redcarpet [--parse <extension>...] " \
|
|
33
|
+
"[--render <extension>...] [--smarty] <file>..."
|
|
34
|
+
|
|
35
|
+
opts.on("--parse EXTENSION", "Enable a parsing extension") do |ext|
|
|
36
|
+
ext = ext.gsub('-', '_').to_sym
|
|
37
|
+
@@options[:parse_extensions][ext] = true
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
opts.on("--render EXTENSION", "Enable a rendering extension") do |ext|
|
|
41
|
+
ext = ext.gsub('-', '_').to_sym
|
|
42
|
+
@@options[:render_extensions][ext] = true
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
opts.on("--smarty", "Enable Smarty Pants") do
|
|
46
|
+
@@options[:smarty_pants] = true
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
opts.on_tail("-v", "--version", "Display the current version") do
|
|
50
|
+
STDOUT.puts "Redcarpet #{Redcarpet::VERSION}"
|
|
51
|
+
exit
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
opts.on_tail("-h", "--help", "Display this help message") do
|
|
55
|
+
puts opts
|
|
56
|
+
exit
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def self.process(args)
|
|
62
|
+
self.legacy_parse!(args)
|
|
63
|
+
self.options_parser.parse!(args)
|
|
64
|
+
STDOUT.write parser_object.render(ARGF.read)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def self.render_object
|
|
68
|
+
@@options[:smarty_pants] ? Render::SmartyHTML : Render::HTML
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def self.parser_object
|
|
72
|
+
renderer = render_object.new(@@options[:render_extensions])
|
|
73
|
+
Redcarpet::Markdown.new(renderer, @@options[:parse_extensions])
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def self.legacy_parse!(args) # :nodoc:
|
|
77
|
+
# Workaround for backward compatibility as OptionParser
|
|
78
|
+
# doesn't support the --flag-OPTION syntax.
|
|
79
|
+
args.select {|a| a =~ /--(parse|render)-/ }.each do |arg|
|
|
80
|
+
args.delete(arg)
|
|
81
|
+
arg = arg.partition(/\b-/)
|
|
82
|
+
args.push(arg.first, arg.last)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Creates an instance of Redcarpet with the RedCloth API.
|
|
2
|
+
class RedcarpetCompat
|
|
3
|
+
attr_accessor :text
|
|
4
|
+
|
|
5
|
+
def initialize(text, *exts)
|
|
6
|
+
exts_hash, render_hash = *parse_extensions_and_renderer_options(exts)
|
|
7
|
+
@text = text
|
|
8
|
+
renderer = Redcarpet::Render::HTML.new(render_hash)
|
|
9
|
+
@markdown = Redcarpet::Markdown.new(renderer, exts_hash)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def to_html(*_dummy)
|
|
13
|
+
@markdown.render(text)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
EXTENSION_MAP = {
|
|
19
|
+
# old name => new name
|
|
20
|
+
:autolink => :autolink,
|
|
21
|
+
:fenced_code => :fenced_code_blocks,
|
|
22
|
+
:filter_html => :filter_html,
|
|
23
|
+
:hard_wrap => :hard_wrap,
|
|
24
|
+
:prettify => :prettify,
|
|
25
|
+
:lax_htmlblock => :lax_spacing,
|
|
26
|
+
:no_image => :no_images,
|
|
27
|
+
:no_intraemphasis => :no_intra_emphasis,
|
|
28
|
+
:no_links => :no_links,
|
|
29
|
+
:filter_styles => :no_styles,
|
|
30
|
+
:safelink => :safe_links_only,
|
|
31
|
+
:space_header => :space_after_headers,
|
|
32
|
+
:strikethrough => :strikethrough,
|
|
33
|
+
:tables => :tables,
|
|
34
|
+
:generate_toc => :with_toc_data,
|
|
35
|
+
:xhtml => :xhtml,
|
|
36
|
+
|
|
37
|
+
# old names with no new mapping
|
|
38
|
+
:gh_blockcode => nil,
|
|
39
|
+
:no_tables => nil,
|
|
40
|
+
:smart => nil,
|
|
41
|
+
:strict => nil
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
RENDERER_OPTIONS = [:filter_html, :no_images, :no_links, :no_styles,
|
|
45
|
+
:safe_links_only, :with_toc_data, :hard_wrap, :prettify, :xhtml]
|
|
46
|
+
|
|
47
|
+
def rename_extensions(exts)
|
|
48
|
+
exts.map do |old_name|
|
|
49
|
+
if new_name = EXTENSION_MAP[old_name]
|
|
50
|
+
new_name
|
|
51
|
+
else
|
|
52
|
+
old_name
|
|
53
|
+
end
|
|
54
|
+
end.compact
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Returns two hashes, the extensions and renderer options
|
|
58
|
+
# given the extension list
|
|
59
|
+
def parse_extensions_and_renderer_options(exts)
|
|
60
|
+
exts = rename_extensions(exts)
|
|
61
|
+
exts.partition {|ext| !RENDERER_OPTIONS.include?(ext) }.
|
|
62
|
+
map {|list| list_to_truthy_hash(list) }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Turns a list of symbols into a hash of <tt>symbol => true</tt>.
|
|
66
|
+
def list_to_truthy_hash(list)
|
|
67
|
+
list.inject({}) {|h, k| h[k] = true; h }
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
Markdown = RedcarpetCompat unless defined? Markdown
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
module Redcarpet
|
|
2
|
+
module Render
|
|
3
|
+
class ManPage < Base
|
|
4
|
+
|
|
5
|
+
def normal_text(text)
|
|
6
|
+
text.gsub('-', '\\-').strip
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def block_code(code, language)
|
|
10
|
+
"\n.nf\n#{normal_text(code)}\n.fi\n"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def codespan(code)
|
|
14
|
+
block_code(code, nil)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def header(title, level)
|
|
18
|
+
case level
|
|
19
|
+
when 1
|
|
20
|
+
"\n.TH #{title}\n"
|
|
21
|
+
|
|
22
|
+
when 2
|
|
23
|
+
"\n.SH #{title}\n"
|
|
24
|
+
|
|
25
|
+
when 3
|
|
26
|
+
"\n.SS #{title}\n"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def double_emphasis(text)
|
|
31
|
+
"\\fB#{text}\\fP"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def emphasis(text)
|
|
35
|
+
"\\fI#{text}\\fP"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def linebreak
|
|
39
|
+
"\n.LP\n"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def paragraph(text)
|
|
43
|
+
"\n.TP\n#{text}\n"
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def list(content, list_type)
|
|
47
|
+
case list_type
|
|
48
|
+
when :ordered
|
|
49
|
+
"\n\n.nr step 0 1\n#{content}\n"
|
|
50
|
+
when :unordered
|
|
51
|
+
"\n.\n#{content}\n"
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def list_item(content, list_type)
|
|
56
|
+
case list_type
|
|
57
|
+
when :ordered
|
|
58
|
+
".IP \\n+[step]\n#{content.strip}\n"
|
|
59
|
+
when :unordered
|
|
60
|
+
".IP \\[bu] 2 \n#{content.strip}\n"
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
module Redcarpet
|
|
2
|
+
module Render
|
|
3
|
+
# Markdown-stripping renderer. Turns Markdown into plaintext
|
|
4
|
+
# Thanks to @toupeira (Markus Koller)
|
|
5
|
+
class StripDown < Base
|
|
6
|
+
# Methods where the first argument is the text content
|
|
7
|
+
[
|
|
8
|
+
# block-level calls
|
|
9
|
+
:block_code, :block_quote,
|
|
10
|
+
:block_html, :list, :list_item,
|
|
11
|
+
|
|
12
|
+
# span-level calls
|
|
13
|
+
:autolink, :codespan, :double_emphasis,
|
|
14
|
+
:emphasis, :underline, :raw_html,
|
|
15
|
+
:triple_emphasis, :strikethrough,
|
|
16
|
+
:superscript, :highlight, :quote,
|
|
17
|
+
|
|
18
|
+
# footnotes
|
|
19
|
+
:footnotes, :footnote_def, :footnote_ref,
|
|
20
|
+
|
|
21
|
+
# low level rendering
|
|
22
|
+
:entity, :normal_text
|
|
23
|
+
].each do |method|
|
|
24
|
+
define_method method do |*args|
|
|
25
|
+
args.first
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Other methods where we don't return only a specific argument
|
|
30
|
+
def link(link, title, content)
|
|
31
|
+
"#{content} (#{link})"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def image(link, title, content)
|
|
35
|
+
content &&= content + " "
|
|
36
|
+
"#{content}#{link}"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def paragraph(text)
|
|
40
|
+
text + "\n"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def header(text, header_level)
|
|
44
|
+
text + "\n"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def table(header, body)
|
|
48
|
+
"#{header}#{body}"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def table_row(content)
|
|
52
|
+
content + "\n"
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def table_cell(content, alignment)
|
|
56
|
+
content + "\t"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
require 'redcarpet.so'
|
|
2
|
+
require 'redcarpet/compat'
|
|
3
|
+
|
|
4
|
+
module Redcarpet
|
|
5
|
+
VERSION = '3.6.1'
|
|
6
|
+
|
|
7
|
+
class Markdown
|
|
8
|
+
attr_reader :renderer
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
module Render
|
|
12
|
+
|
|
13
|
+
# XHTML Renderer
|
|
14
|
+
class XHTML < HTML
|
|
15
|
+
def initialize(extensions = {})
|
|
16
|
+
super(extensions.merge(xhtml: true))
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# HTML + SmartyPants renderer
|
|
21
|
+
class SmartyHTML < HTML
|
|
22
|
+
include SmartyPants
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# A renderer object you can use to deal with users' input. It
|
|
26
|
+
# enables +escape_html+ and +safe_links_only+ by default.
|
|
27
|
+
#
|
|
28
|
+
# The +block_code+ callback is also overriden not to include
|
|
29
|
+
# the lang's class as the user can basically specify anything
|
|
30
|
+
# with the vanilla one.
|
|
31
|
+
class Safe < HTML
|
|
32
|
+
def initialize(extensions = {})
|
|
33
|
+
super({
|
|
34
|
+
escape_html: true,
|
|
35
|
+
safe_links_only: true
|
|
36
|
+
}.merge(extensions))
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def block_code(code, lang)
|
|
40
|
+
"<pre>" \
|
|
41
|
+
"<code>#{html_escape(code)}</code>" \
|
|
42
|
+
"</pre>"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
# TODO: This is far from ideal to have such method as we
|
|
48
|
+
# are duplicating existing code from Houdini. This method
|
|
49
|
+
# should be defined at the C level.
|
|
50
|
+
def html_escape(string)
|
|
51
|
+
string.gsub(/['&\"<>\/]/, {
|
|
52
|
+
'&' => '&',
|
|
53
|
+
'<' => '<',
|
|
54
|
+
'>' => '>',
|
|
55
|
+
'"' => '"',
|
|
56
|
+
"'" => ''',
|
|
57
|
+
"/" => '/',
|
|
58
|
+
})
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# SmartyPants Mixin module
|
|
63
|
+
#
|
|
64
|
+
# Implements SmartyPants.postprocess, which
|
|
65
|
+
# performs smartypants replacements on the HTML file,
|
|
66
|
+
# once it has been fully rendered.
|
|
67
|
+
#
|
|
68
|
+
# To add SmartyPants postprocessing to your custom
|
|
69
|
+
# renderers, just mixin the module `include SmartyPants`
|
|
70
|
+
#
|
|
71
|
+
# You can also use this as a standalone SmartyPants
|
|
72
|
+
# implementation.
|
|
73
|
+
#
|
|
74
|
+
# Example:
|
|
75
|
+
#
|
|
76
|
+
# # Mixin
|
|
77
|
+
# class CoolRenderer < HTML
|
|
78
|
+
# include SmartyPants
|
|
79
|
+
# # more code here
|
|
80
|
+
# end
|
|
81
|
+
#
|
|
82
|
+
# # Standalone
|
|
83
|
+
# Redcarpet::Render::SmartyPants.render("you're")
|
|
84
|
+
#
|
|
85
|
+
module SmartyPants
|
|
86
|
+
extend self
|
|
87
|
+
def self.render(text)
|
|
88
|
+
postprocess text
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Gem::Specification.new do |s|
|
|
3
|
+
s.name = 'redcarpet'
|
|
4
|
+
s.version = '3.6.1'
|
|
5
|
+
s.summary = "Markdown that smells nice"
|
|
6
|
+
s.description = 'A fast, safe and extensible Markdown to (X)HTML parser'
|
|
7
|
+
s.date = '2025-02-25'
|
|
8
|
+
s.email = 'vicent@github.com'
|
|
9
|
+
s.homepage = 'https://github.com/vmg/redcarpet'
|
|
10
|
+
s.authors = ["Natacha Porté", "Vicent Martí"]
|
|
11
|
+
s.license = 'MIT'
|
|
12
|
+
s.required_ruby_version = '>= 1.9.2'
|
|
13
|
+
# = MANIFEST =
|
|
14
|
+
s.files = %w[
|
|
15
|
+
CHANGELOG.md
|
|
16
|
+
CONTRIBUTING.md
|
|
17
|
+
COPYING
|
|
18
|
+
Gemfile
|
|
19
|
+
README.markdown
|
|
20
|
+
Rakefile
|
|
21
|
+
bin/redcarpet
|
|
22
|
+
ext/redcarpet/autolink.c
|
|
23
|
+
ext/redcarpet/autolink.h
|
|
24
|
+
ext/redcarpet/buffer.c
|
|
25
|
+
ext/redcarpet/buffer.h
|
|
26
|
+
ext/redcarpet/extconf.rb
|
|
27
|
+
ext/redcarpet/houdini.h
|
|
28
|
+
ext/redcarpet/houdini_href_e.c
|
|
29
|
+
ext/redcarpet/houdini_html_e.c
|
|
30
|
+
ext/redcarpet/html.c
|
|
31
|
+
ext/redcarpet/html.h
|
|
32
|
+
ext/redcarpet/html_block_names.txt
|
|
33
|
+
ext/redcarpet/html_blocks.h
|
|
34
|
+
ext/redcarpet/html_smartypants.c
|
|
35
|
+
ext/redcarpet/markdown.c
|
|
36
|
+
ext/redcarpet/markdown.h
|
|
37
|
+
ext/redcarpet/rc_markdown.c
|
|
38
|
+
ext/redcarpet/rc_render.c
|
|
39
|
+
ext/redcarpet/redcarpet.h
|
|
40
|
+
ext/redcarpet/stack.c
|
|
41
|
+
ext/redcarpet/stack.h
|
|
42
|
+
lib/redcarpet.rb
|
|
43
|
+
lib/redcarpet/cli.rb
|
|
44
|
+
lib/redcarpet/compat.rb
|
|
45
|
+
lib/redcarpet/render_man.rb
|
|
46
|
+
lib/redcarpet/render_strip.rb
|
|
47
|
+
redcarpet.gemspec
|
|
48
|
+
]
|
|
49
|
+
# = MANIFEST =
|
|
50
|
+
s.test_files = s.files.grep(%r{^test/})
|
|
51
|
+
s.extra_rdoc_files = ["COPYING"]
|
|
52
|
+
s.extensions = ["ext/redcarpet/extconf.rb"]
|
|
53
|
+
s.executables = ["redcarpet"]
|
|
54
|
+
s.require_paths = ["lib"]
|
|
55
|
+
|
|
56
|
+
s.add_development_dependency "rake", "~> 13"
|
|
57
|
+
s.add_development_dependency "rake-compiler", "~> 1.1"
|
|
58
|
+
s.add_development_dependency "test-unit", "~> 3.5"
|
|
59
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: nano-pure-box
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Andrey78
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 2026-07-05 00:00:00.000000000 Z
|
|
11
|
+
dependencies: []
|
|
12
|
+
description: University research based on redcarpet
|
|
13
|
+
email:
|
|
14
|
+
- cakoc614@gmail.com
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- nano-pure-box.gemspec
|
|
20
|
+
- redcarpet-3.6.1/CHANGELOG.md
|
|
21
|
+
- redcarpet-3.6.1/CONTRIBUTING.md
|
|
22
|
+
- redcarpet-3.6.1/COPYING
|
|
23
|
+
- redcarpet-3.6.1/Gemfile
|
|
24
|
+
- redcarpet-3.6.1/README.markdown
|
|
25
|
+
- redcarpet-3.6.1/Rakefile
|
|
26
|
+
- redcarpet-3.6.1/bin/redcarpet
|
|
27
|
+
- redcarpet-3.6.1/ext/redcarpet/autolink.c
|
|
28
|
+
- redcarpet-3.6.1/ext/redcarpet/autolink.h
|
|
29
|
+
- redcarpet-3.6.1/ext/redcarpet/buffer.c
|
|
30
|
+
- redcarpet-3.6.1/ext/redcarpet/buffer.h
|
|
31
|
+
- redcarpet-3.6.1/ext/redcarpet/extconf.rb
|
|
32
|
+
- redcarpet-3.6.1/ext/redcarpet/houdini.h
|
|
33
|
+
- redcarpet-3.6.1/ext/redcarpet/houdini_href_e.c
|
|
34
|
+
- redcarpet-3.6.1/ext/redcarpet/houdini_html_e.c
|
|
35
|
+
- redcarpet-3.6.1/ext/redcarpet/html.c
|
|
36
|
+
- redcarpet-3.6.1/ext/redcarpet/html.h
|
|
37
|
+
- redcarpet-3.6.1/ext/redcarpet/html_block_names.txt
|
|
38
|
+
- redcarpet-3.6.1/ext/redcarpet/html_blocks.h
|
|
39
|
+
- redcarpet-3.6.1/ext/redcarpet/html_smartypants.c
|
|
40
|
+
- redcarpet-3.6.1/ext/redcarpet/markdown.c
|
|
41
|
+
- redcarpet-3.6.1/ext/redcarpet/markdown.h
|
|
42
|
+
- redcarpet-3.6.1/ext/redcarpet/rc_markdown.c
|
|
43
|
+
- redcarpet-3.6.1/ext/redcarpet/rc_render.c
|
|
44
|
+
- redcarpet-3.6.1/ext/redcarpet/redcarpet.h
|
|
45
|
+
- redcarpet-3.6.1/ext/redcarpet/stack.c
|
|
46
|
+
- redcarpet-3.6.1/ext/redcarpet/stack.h
|
|
47
|
+
- redcarpet-3.6.1/lib/redcarpet.rb
|
|
48
|
+
- redcarpet-3.6.1/lib/redcarpet/cli.rb
|
|
49
|
+
- redcarpet-3.6.1/lib/redcarpet/compat.rb
|
|
50
|
+
- redcarpet-3.6.1/lib/redcarpet/render_man.rb
|
|
51
|
+
- redcarpet-3.6.1/lib/redcarpet/render_strip.rb
|
|
52
|
+
- redcarpet-3.6.1/redcarpet.gemspec
|
|
53
|
+
homepage: https://rubygems.org/profiles/Andrey78
|
|
54
|
+
licenses:
|
|
55
|
+
- MIT
|
|
56
|
+
metadata:
|
|
57
|
+
source_code_uri: https://github.com/Andrey78/nano-pure-box
|
|
58
|
+
rdoc_options: []
|
|
59
|
+
require_paths:
|
|
60
|
+
- lib
|
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
|
+
requirements:
|
|
63
|
+
- - ">="
|
|
64
|
+
- !ruby/object:Gem::Version
|
|
65
|
+
version: '0'
|
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: '0'
|
|
71
|
+
requirements: []
|
|
72
|
+
rubygems_version: 3.6.2
|
|
73
|
+
specification_version: 4
|
|
74
|
+
summary: Research test
|
|
75
|
+
test_files: []
|