pseudohelp 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +27 -0
- data/app/assets/images/pseudohelp/corgi.jpg +0 -0
- data/app/assets/javascripts/pseudohelp/application.js +13 -0
- data/app/assets/javascripts/pseudohelp/pseudohelp.js +126 -0
- data/app/assets/stylesheets/pseudohelp/application.css +13 -0
- data/app/assets/stylesheets/pseudohelp/markup_languages.css +4 -0
- data/app/controllers/pseudohelp/application_controller.rb +4 -0
- data/app/controllers/pseudohelp/markup_languages_controller.rb +6 -0
- data/app/helpers/pseudohelp/application_helper.rb +4 -0
- data/app/views/layouts/pseudohelp/application.html.erb +14 -0
- data/app/views/pseudohelp/_help.html.erb +51 -0
- data/config/pseudohelp/bbcode.yml +49 -0
- data/config/pseudohelp/markdown.yml +100 -0
- data/config/pseudohelp/textile.yml +94 -0
- data/config/routes.rb +2 -0
- data/lib/pseudohelp.rb +11 -0
- data/lib/pseudohelp/bbcode.rb +19 -0
- data/lib/pseudohelp/configuration.rb +59 -0
- data/lib/pseudohelp/engine.rb +5 -0
- data/lib/pseudohelp/markdown.rb +22 -0
- data/lib/pseudohelp/textile.rb +17 -0
- data/lib/pseudohelp/version.rb +3 -0
- data/lib/tasks/pseudohelp_tasks.rake +4 -0
- metadata +147 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'Pseudohelp'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
Binary file
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// the compiled file.
|
9
|
+
//
|
10
|
+
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
+
// GO AFTER THE REQUIRES BELOW.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,126 @@
|
|
1
|
+
Pseudohelp = {
|
2
|
+
init: function(){
|
3
|
+
jQuery('.pseudo-container section > div:first').toggleClass('visible');
|
4
|
+
|
5
|
+
var type_links = jQuery('.pseudo-container header a');
|
6
|
+
type_links.click(function(e){
|
7
|
+
e.preventDefault();
|
8
|
+
|
9
|
+
type = jQuery(this).text();
|
10
|
+
jQuery('.pseudo-container section > div').removeClass('visible');
|
11
|
+
jQuery('.pseudo-container div.'+type).addClass('visible');
|
12
|
+
});
|
13
|
+
|
14
|
+
var tables = jQuery('.pseudo-container table');
|
15
|
+
jQuery('.pseudo-help-filter').keyup(function() {
|
16
|
+
jQuery.uiTableFilter( tables, this.value );
|
17
|
+
});
|
18
|
+
|
19
|
+
var links_to_help = jQuery('a[href="#pseudo-help"]')
|
20
|
+
links_to_help.click(function(e){
|
21
|
+
e.preventDefault();
|
22
|
+
|
23
|
+
Pseudohelp.toggle();
|
24
|
+
});
|
25
|
+
},
|
26
|
+
|
27
|
+
toggle: function(){
|
28
|
+
jQuery('html').toggleClass('pseudohelp-visible')
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
jQuery(function() {
|
33
|
+
Pseudohelp.init();
|
34
|
+
});
|
35
|
+
|
36
|
+
/*
|
37
|
+
* Copyright (c) 2008 Greg Weber greg at gregweber.info
|
38
|
+
* Dual licensed under the MIT and GPLv2 licenses just as jQuery is:
|
39
|
+
* http://jquery.org/license
|
40
|
+
*
|
41
|
+
* documentation at http://gregweber.info/projects/uitablefilter
|
42
|
+
*
|
43
|
+
* allows table rows to be filtered (made invisible)
|
44
|
+
* <code>
|
45
|
+
* t = $('table')
|
46
|
+
* $.uiTableFilter( t, phrase )
|
47
|
+
* </code>
|
48
|
+
* arguments:
|
49
|
+
* jQuery object containing table rows
|
50
|
+
* phrase to search for
|
51
|
+
* optional arguments:
|
52
|
+
* column to limit search too (the column title in the table header)
|
53
|
+
* ifHidden - callback to execute if one or more elements was hidden
|
54
|
+
*/
|
55
|
+
(function($) {
|
56
|
+
$.uiTableFilter = function(jq, phrase, column, ifHidden){
|
57
|
+
var new_hidden = false;
|
58
|
+
if( this.last_phrase === phrase ) return false;
|
59
|
+
|
60
|
+
var phrase_length = phrase.length;
|
61
|
+
var words = phrase.toLowerCase().split(" ");
|
62
|
+
|
63
|
+
// these function pointers may change
|
64
|
+
var matches = function(elem) { elem.show() }
|
65
|
+
var noMatch = function(elem) { elem.hide(); new_hidden = true }
|
66
|
+
var getText = function(elem) { return elem.text() }
|
67
|
+
|
68
|
+
if( column ) {
|
69
|
+
var index = null;
|
70
|
+
jq.find("thead > tr:last > th").each( function(i){
|
71
|
+
if( $.trim($(this).text()) == column ){
|
72
|
+
index = i; return false;
|
73
|
+
}
|
74
|
+
});
|
75
|
+
if( index == null ) throw("given column: " + column + " not found")
|
76
|
+
|
77
|
+
getText = function(elem){ return $(elem.find(
|
78
|
+
("td:eq(" + index + ")") )).text()
|
79
|
+
}
|
80
|
+
}
|
81
|
+
|
82
|
+
// if added one letter to last time,
|
83
|
+
// just check newest word and only need to hide
|
84
|
+
if( (words.size > 1) && (phrase.substr(0, phrase_length - 1) ===
|
85
|
+
this.last_phrase) ) {
|
86
|
+
|
87
|
+
if( phrase[-1] === " " )
|
88
|
+
{ this.last_phrase = phrase; return false; }
|
89
|
+
|
90
|
+
var words = words[-1]; // just search for the newest word
|
91
|
+
|
92
|
+
// only hide visible rows
|
93
|
+
matches = function(elem) {;}
|
94
|
+
var elems = jq.find("tbody:first > tr:visible")
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
new_hidden = true;
|
98
|
+
var elems = jq.find("tbody:first > tr")
|
99
|
+
}
|
100
|
+
|
101
|
+
elems.each(function(){
|
102
|
+
var elem = $(this);
|
103
|
+
$.uiTableFilter.has_words( getText(elem), words, false ) ?
|
104
|
+
matches(elem) : noMatch(elem);
|
105
|
+
});
|
106
|
+
|
107
|
+
last_phrase = phrase;
|
108
|
+
if( ifHidden && new_hidden ) ifHidden();
|
109
|
+
return jq;
|
110
|
+
};
|
111
|
+
|
112
|
+
// caching for speedup
|
113
|
+
$.uiTableFilter.last_phrase = ""
|
114
|
+
|
115
|
+
// not jQuery dependent
|
116
|
+
// "" [""] -> Boolean
|
117
|
+
// "" [""] Boolean -> Boolean
|
118
|
+
$.uiTableFilter.has_words = function( str, words, caseSensitive )
|
119
|
+
{
|
120
|
+
var text = caseSensitive ? str : str.toLowerCase();
|
121
|
+
for (var i=0; i < words.length; i++) {
|
122
|
+
if (text.indexOf(words[i]) === -1) return false;
|
123
|
+
}
|
124
|
+
return true;
|
125
|
+
}
|
126
|
+
}) (jQuery);
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Pseudohelp</title>
|
5
|
+
<%= stylesheet_link_tag "pseudohelp/application", :media => "all" %>
|
6
|
+
<%= javascript_include_tag "pseudohelp/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<div class="pseudo-backdrop" id="pseudo-backdrop"></div>
|
2
|
+
<div class="pseudo-container" id="pseudo-help">
|
3
|
+
<header>
|
4
|
+
<ul>
|
5
|
+
<li class="search">
|
6
|
+
<input class="pseudo-help-filter" value="" placeholder="search" />
|
7
|
+
</li>
|
8
|
+
<% Pseudohelp.configuration.formats.each do |format| %>
|
9
|
+
<li class="<%= format %>">
|
10
|
+
<a href="#<%= format %>"><%= format %></a>
|
11
|
+
</li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</header>
|
15
|
+
<section>
|
16
|
+
<% Pseudohelp.configuration.help.each do |documentation_type, sections| %>
|
17
|
+
<div class="<%= documentation_type %>">
|
18
|
+
<table>
|
19
|
+
<% if sections %>
|
20
|
+
<% sections.each do |section_header, input_output| %>
|
21
|
+
<tr>
|
22
|
+
<th colspan="2"><%= section_header %></th>
|
23
|
+
</tr>
|
24
|
+
<% input_output.each do |description, in_out| %>
|
25
|
+
<tr data-description="<%= description %>">
|
26
|
+
<td>
|
27
|
+
<code><%= in_out['input'] %></code>
|
28
|
+
</td>
|
29
|
+
<td>
|
30
|
+
<% if in_out.key? 'output' %>
|
31
|
+
<%= in_out['output'].html_safe %>
|
32
|
+
<% else %>
|
33
|
+
<%= Pseudohelp.compile(documentation_type, in_out['input']) %>
|
34
|
+
<% end %>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
<% end %>
|
38
|
+
<% end %>
|
39
|
+
<% end %>
|
40
|
+
</table>
|
41
|
+
</div>
|
42
|
+
<% end %>
|
43
|
+
</section>
|
44
|
+
<footer>
|
45
|
+
<p>
|
46
|
+
<a href="https://github.com/jayroh/pseudohelp" target="_blank">pseudohelp</a>
|
47
|
+
is a work in progress. fork and contribute on
|
48
|
+
<a href="https://github.com/jayroh/pseudohelp" target="_blank">github</a>.
|
49
|
+
</p>
|
50
|
+
</footer>
|
51
|
+
</div>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Paragraphs:
|
2
|
+
paragraphs:
|
3
|
+
input: |
|
4
|
+
Each line break
|
5
|
+
is replaced with an html break.
|
6
|
+
|
7
|
+
So there aren't real "paragraphs"
|
8
|
+
|
9
|
+
Quotes:
|
10
|
+
quote:
|
11
|
+
input: '[quote]Someone said this.[/quote]'
|
12
|
+
quote (named):
|
13
|
+
input: '[quote=John]John said this.[/quote]'
|
14
|
+
|
15
|
+
Links:
|
16
|
+
Link:
|
17
|
+
input: 'Link to [url=http://google.com]google[/url]'
|
18
|
+
|
19
|
+
Images:
|
20
|
+
Image:
|
21
|
+
input: 'Image [img]/assets/pseudohelp/corgi.jpg[/img]'
|
22
|
+
|
23
|
+
Text Formatting:
|
24
|
+
bold:
|
25
|
+
input: '[b]Bold[/b]'
|
26
|
+
italic:
|
27
|
+
input: '[i]Italic[/i]'
|
28
|
+
underline:
|
29
|
+
input: '[u]Underline[/u]'
|
30
|
+
strike-through:
|
31
|
+
input: '[s]strike through[/s]'
|
32
|
+
delete:
|
33
|
+
input: '[del]Delete[/del]'
|
34
|
+
insert:
|
35
|
+
input: '[ins]Insert[/ins]'
|
36
|
+
font size:
|
37
|
+
input: '[size=14]Large![/size]'
|
38
|
+
font color:
|
39
|
+
input: '[color=red]red red red[/color]'
|
40
|
+
|
41
|
+
Lists:
|
42
|
+
Unordered List:
|
43
|
+
input: |
|
44
|
+
[list] [*]Item 1 [*]Item 2 [/list]
|
45
|
+
|
46
|
+
For More Information:
|
47
|
+
Go To:
|
48
|
+
input: |
|
49
|
+
Further bbcode documentation can be found [url=http://en.wikipedia.org/wiki/BBCode]here[/url]
|
@@ -0,0 +1,100 @@
|
|
1
|
+
Headers and Paragraphs:
|
2
|
+
h1 h2 h5:
|
3
|
+
input: |
|
4
|
+
# Level 1 Header (H1)
|
5
|
+
## Level 2 Header (H2)
|
6
|
+
##### Level 5 Header (H5)
|
7
|
+
|
8
|
+
paragraphs:
|
9
|
+
input: |
|
10
|
+
One or more consecutive lines of text separated by one or more blank lines.
|
11
|
+
|
12
|
+
This is another paragraph.
|
13
|
+
|
14
|
+
line-breaks:
|
15
|
+
input: |
|
16
|
+
To create a line break
|
17
|
+
end a line in a
|
18
|
+
paragraph with two
|
19
|
+
or more spaces.
|
20
|
+
|
21
|
+
Lists:
|
22
|
+
unordered lists:
|
23
|
+
input: |
|
24
|
+
* Red
|
25
|
+
* Green
|
26
|
+
* Blue
|
27
|
+
ordered lists:
|
28
|
+
input: |
|
29
|
+
1. Bird
|
30
|
+
2. McHale
|
31
|
+
3. Parish
|
32
|
+
definition lists:
|
33
|
+
input: |
|
34
|
+
Term
|
35
|
+
: Definition
|
36
|
+
|
37
|
+
Emphasis:
|
38
|
+
Italics:
|
39
|
+
input: |
|
40
|
+
I am *emphasized*.
|
41
|
+
And _so am I_.
|
42
|
+
Bold:
|
43
|
+
input: |
|
44
|
+
I am **bold**.
|
45
|
+
And __so am I__.
|
46
|
+
|
47
|
+
Links:
|
48
|
+
Inline links:
|
49
|
+
input: 'This is [an example](http://example.com/ "Optional Title") link.'
|
50
|
+
Automatic links:
|
51
|
+
input: |
|
52
|
+
<http://example.com/>
|
53
|
+
<address@example.com>
|
54
|
+
|
55
|
+
Code:
|
56
|
+
Code block:
|
57
|
+
input: |
|
58
|
+
This is a normal paragraph.
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
@posts = Post.where(published: true)
|
62
|
+
```
|
63
|
+
Inline code:
|
64
|
+
input: 'Talking about `@some_inline = "code"` here.'
|
65
|
+
|
66
|
+
Tables:
|
67
|
+
Table:
|
68
|
+
input: |
|
69
|
+
| Header 1 | Header 2 |
|
70
|
+
| ----------- | ---------- |
|
71
|
+
| Row1 Cell1 | Row1 Cell2 |
|
72
|
+
| Row2 Cell1 | Row2 Cell2 |
|
73
|
+
|
74
|
+
Images:
|
75
|
+
Image:
|
76
|
+
input: |
|
77
|
+
![A corgi](/assets/pseudohelp/corgi.jpg "Awwwww")
|
78
|
+
|
79
|
+
Literal Characters:
|
80
|
+
Escape with a backslash:
|
81
|
+
input: |
|
82
|
+
\\
|
83
|
+
\`
|
84
|
+
\*
|
85
|
+
\_
|
86
|
+
\{\
|
87
|
+
\[\]
|
88
|
+
\(\)
|
89
|
+
\#
|
90
|
+
\+
|
91
|
+
\-
|
92
|
+
\.
|
93
|
+
\!
|
94
|
+
\:
|
95
|
+
\|
|
96
|
+
|
97
|
+
For More Information:
|
98
|
+
Go To:
|
99
|
+
input: |
|
100
|
+
Further markdown documentation can be found [here](http://daringfireball.net/projects/markdown/syntax)
|
@@ -0,0 +1,94 @@
|
|
1
|
+
Headers and Paragraphs:
|
2
|
+
h1 h2 h5:
|
3
|
+
input: |
|
4
|
+
h1. Level 1 Header (H1)
|
5
|
+
|
6
|
+
h2. Level 2 Header (H2)
|
7
|
+
|
8
|
+
h5. Level 5 Header (H5)
|
9
|
+
|
10
|
+
paragraphs:
|
11
|
+
input: |
|
12
|
+
One or more consecutive lines of text separated by one or more blank lines.
|
13
|
+
|
14
|
+
This is another paragraph.
|
15
|
+
|
16
|
+
line-breaks:
|
17
|
+
input: |
|
18
|
+
Line breaks are converted
|
19
|
+
to html breaks.
|
20
|
+
|
21
|
+
blockquotes:
|
22
|
+
input: |
|
23
|
+
They said:
|
24
|
+
|
25
|
+
bq. Something profound!
|
26
|
+
|
27
|
+
... and I was stunned.
|
28
|
+
|
29
|
+
extended quote:
|
30
|
+
input: |
|
31
|
+
bq.. Starting the quote
|
32
|
+
|
33
|
+
continuing the quote
|
34
|
+
|
35
|
+
p. New paragraph
|
36
|
+
|
37
|
+
Links:
|
38
|
+
Link:
|
39
|
+
input: |
|
40
|
+
For more "click here":http://textile.thresholdstate.com/
|
41
|
+
|
42
|
+
Emphasis:
|
43
|
+
Emphasis:
|
44
|
+
input: |
|
45
|
+
_emphasis_
|
46
|
+
Italics:
|
47
|
+
input: |
|
48
|
+
__italicized__
|
49
|
+
Strong:
|
50
|
+
input: |
|
51
|
+
*strong*
|
52
|
+
Bold:
|
53
|
+
input: |
|
54
|
+
**bold**
|
55
|
+
Citation:
|
56
|
+
input: |
|
57
|
+
??citation??
|
58
|
+
Deleted Text:
|
59
|
+
input: |
|
60
|
+
-deleted text-
|
61
|
+
Inserted Text:
|
62
|
+
input: |
|
63
|
+
+inserted text+
|
64
|
+
Superscript:
|
65
|
+
input: |
|
66
|
+
Some ^superscript^
|
67
|
+
Subscript:
|
68
|
+
input: |
|
69
|
+
Some ~subscript~
|
70
|
+
Code:
|
71
|
+
input: |
|
72
|
+
Inline code @var goes = 'here';@
|
73
|
+
|
74
|
+
Lists:
|
75
|
+
Unordered List:
|
76
|
+
input: |
|
77
|
+
* Item 1
|
78
|
+
* Item 2
|
79
|
+
* Item 3
|
80
|
+
Ordered List:
|
81
|
+
input: |
|
82
|
+
# One
|
83
|
+
# Two
|
84
|
+
# Three
|
85
|
+
|
86
|
+
Images:
|
87
|
+
Image:
|
88
|
+
input: |
|
89
|
+
!/assets/pseudohelp/corgi.jpg!
|
90
|
+
|
91
|
+
For More Information:
|
92
|
+
Go To:
|
93
|
+
input: |
|
94
|
+
Further textile documentation can be found "here":http://textile.thresholdstate.com/
|
data/config/routes.rb
ADDED
data/lib/pseudohelp.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'pseudohelp/engine'
|
2
|
+
require 'pseudohelp/configuration'
|
3
|
+
require 'pseudohelp/bbcode'
|
4
|
+
require 'pseudohelp/markdown'
|
5
|
+
require 'pseudohelp/textile'
|
6
|
+
|
7
|
+
module Pseudohelp
|
8
|
+
def self.compile(type, input)
|
9
|
+
"Pseudohelp::#{type.to_s.camelize}::Compiler".constantize.call(input)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Pseudohelp
|
2
|
+
class Bbcode
|
3
|
+
class << self
|
4
|
+
def documentation_hash
|
5
|
+
YAML.load_file(File.join(File.dirname(__FILE__),'../../config/pseudohelp/bbcode.yml'))
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Compiler
|
10
|
+
require 'bb-ruby'
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def call(text)
|
14
|
+
BBRuby.to_html(text).html_safe
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module Pseudohelp
|
2
|
+
class << self
|
3
|
+
attr_accessor :configuration
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.configure
|
7
|
+
self.configuration = Configuration.new
|
8
|
+
|
9
|
+
if block_given?
|
10
|
+
yield configuration
|
11
|
+
end
|
12
|
+
|
13
|
+
self.configuration
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.configuration
|
17
|
+
@configuration || self.configure
|
18
|
+
end
|
19
|
+
|
20
|
+
class Configuration
|
21
|
+
attr_accessor :compilers, :extra_help
|
22
|
+
|
23
|
+
def compilers=(new_compilers)
|
24
|
+
@new_compilers = new_compilers
|
25
|
+
end
|
26
|
+
|
27
|
+
def compilers
|
28
|
+
@compilers ||= default_compilers.merge(@new_compilers)
|
29
|
+
end
|
30
|
+
|
31
|
+
# * * *
|
32
|
+
|
33
|
+
def extra_help
|
34
|
+
@extra_help ||= {}
|
35
|
+
end
|
36
|
+
|
37
|
+
def formats
|
38
|
+
@formats ||= [:bbcode, :markdown, :textile]
|
39
|
+
end
|
40
|
+
|
41
|
+
def help
|
42
|
+
@help ||= {
|
43
|
+
bbcode: Pseudohelp::Bbcode.documentation_hash,
|
44
|
+
markdown: Pseudohelp::Markdown.documentation_hash,
|
45
|
+
textile: Pseudohelp::Textile.documentation_hash
|
46
|
+
}.deep_merge(extra_help) # .sort
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def default_compilers
|
52
|
+
{
|
53
|
+
bbcode: Pseudohelp::Bbcode::Compiler,
|
54
|
+
markdown: Pseudohelp::Markdown::Compiler,
|
55
|
+
textile: Pseudohelp::Textile::Compiler
|
56
|
+
}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Pseudohelp
|
2
|
+
class Markdown
|
3
|
+
class << self
|
4
|
+
def documentation_hash
|
5
|
+
YAML.load_file(File.join(File.dirname(__FILE__),'../../config/pseudohelp/markdown.yml'))
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Compiler
|
10
|
+
class << self
|
11
|
+
def call(text)
|
12
|
+
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, {
|
13
|
+
tables: true,
|
14
|
+
fenced_code_blocks: true,
|
15
|
+
strikethrough: true
|
16
|
+
})
|
17
|
+
markdown.render(text).html_safe
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Pseudohelp
|
2
|
+
class Textile
|
3
|
+
class << self
|
4
|
+
def documentation_hash
|
5
|
+
YAML.load_file(File.join(File.dirname(__FILE__),'../../config/pseudohelp/textile.yml'))
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Compiler
|
10
|
+
class << self
|
11
|
+
def call(text)
|
12
|
+
RedCloth.new(text).to_html.html_safe
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pseudohelp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Joel Oliveira
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2012-12-09 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rails
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ~>
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 15
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 2
|
32
|
+
- 0
|
33
|
+
version: 3.2.0
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: bb-ruby
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: redcarpet
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
type: :runtime
|
63
|
+
version_requirements: *id003
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: RedCloth
|
66
|
+
prerelease: false
|
67
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 3
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
version: "0"
|
76
|
+
type: :runtime
|
77
|
+
version_requirements: *id004
|
78
|
+
description: Provides a view partial to display documentation on the bbcode, markdown and textile flavors of text markup.
|
79
|
+
email:
|
80
|
+
- joel.oliveira@gmail.com
|
81
|
+
executables: []
|
82
|
+
|
83
|
+
extensions: []
|
84
|
+
|
85
|
+
extra_rdoc_files: []
|
86
|
+
|
87
|
+
files:
|
88
|
+
- app/controllers/pseudohelp/markup_languages_controller.rb
|
89
|
+
- app/controllers/pseudohelp/application_controller.rb
|
90
|
+
- app/helpers/pseudohelp/application_helper.rb
|
91
|
+
- app/assets/stylesheets/pseudohelp/application.css
|
92
|
+
- app/assets/stylesheets/pseudohelp/markup_languages.css
|
93
|
+
- app/assets/images/pseudohelp/corgi.jpg
|
94
|
+
- app/assets/javascripts/pseudohelp/pseudohelp.js
|
95
|
+
- app/assets/javascripts/pseudohelp/application.js
|
96
|
+
- app/views/layouts/pseudohelp/application.html.erb
|
97
|
+
- app/views/pseudohelp/_help.html.erb
|
98
|
+
- config/pseudohelp/markdown.yml
|
99
|
+
- config/pseudohelp/textile.yml
|
100
|
+
- config/pseudohelp/bbcode.yml
|
101
|
+
- config/routes.rb
|
102
|
+
- lib/pseudohelp.rb
|
103
|
+
- lib/tasks/pseudohelp_tasks.rake
|
104
|
+
- lib/pseudohelp/version.rb
|
105
|
+
- lib/pseudohelp/markdown.rb
|
106
|
+
- lib/pseudohelp/engine.rb
|
107
|
+
- lib/pseudohelp/bbcode.rb
|
108
|
+
- lib/pseudohelp/configuration.rb
|
109
|
+
- lib/pseudohelp/textile.rb
|
110
|
+
- MIT-LICENSE
|
111
|
+
- Rakefile
|
112
|
+
- README.rdoc
|
113
|
+
homepage: http://joeloliveira.com
|
114
|
+
licenses: []
|
115
|
+
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
hash: 3
|
127
|
+
segments:
|
128
|
+
- 0
|
129
|
+
version: "0"
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
hash: 3
|
136
|
+
segments:
|
137
|
+
- 0
|
138
|
+
version: "0"
|
139
|
+
requirements: []
|
140
|
+
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 1.7.2
|
143
|
+
signing_key:
|
144
|
+
specification_version: 3
|
145
|
+
summary: Quick drop-in pseudo-markup documentation
|
146
|
+
test_files: []
|
147
|
+
|