spacedocs 0.0.2 → 0.0.3
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.
- data/README.md +6 -2
- data/{source → lib}/class.html.haml +1 -4
- data/{source → lib}/index.html.haml +2 -2
- data/{dox → lib/node_modules/dox}/History.md +0 -0
- data/{dox → lib/node_modules/dox}/Makefile +0 -0
- data/{dox → lib/node_modules/dox}/Readme.md +0 -0
- data/{dox → lib/node_modules/dox}/bin/dox +0 -0
- data/{dox → lib/node_modules/dox}/index.js +0 -0
- data/{dox → lib/node_modules/dox}/lib/dox.js +1 -10
- data/{dox → lib/node_modules/dox}/lib/utils.js +0 -0
- data/lib/node_modules/dox/node_modules/commander/History.md +99 -0
- data/lib/node_modules/dox/node_modules/commander/Makefile +7 -0
- data/lib/node_modules/dox/node_modules/commander/Readme.md +263 -0
- data/lib/node_modules/dox/node_modules/commander/index.js +2 -0
- data/lib/node_modules/dox/node_modules/commander/lib/commander.js +992 -0
- data/lib/node_modules/dox/node_modules/commander/package.json +38 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/README.md +17 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/_config.yml +3 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/_layouts/default.html +77 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/code.rb +67 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/images/gfm.png +0 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/index.md +78 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/package.json +27 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/preview.md +27 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/sample_content.html +169 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/scripts/preview.js +18 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/scripts/showdown.js +1414 -0
- data/lib/node_modules/dox/node_modules/github-flavored-markdown/stylesheets/screen.css +20 -0
- data/lib/node_modules/dox/package.json +43 -0
- data/lib/spacedocs.rb +42 -53
- data/lib/{assets/stylesheets/spacedocs/docs.css.sass → spacedocs.sass} +0 -0
- data/lib/spacedocs/version.rb +1 -1
- metadata +116 -25
- data/dox/package.json +0 -16
- data/dox/test/dox.test.js +0 -287
- data/dox/test/fixtures/a.js +0 -12
- data/dox/test/fixtures/b.js +0 -26
- data/dox/test/fixtures/c.js +0 -266
- data/dox/test/fixtures/d.js +0 -15
- data/dox/test/fixtures/titles.js +0 -14
- data/lib/spacedocs/engine.rb +0 -6
@@ -0,0 +1,38 @@
|
|
1
|
+
{
|
2
|
+
"name": "commander",
|
3
|
+
"version": "0.5.2",
|
4
|
+
"description": "the complete solution for node.js command-line programs",
|
5
|
+
"keywords": [
|
6
|
+
"command",
|
7
|
+
"option",
|
8
|
+
"parser",
|
9
|
+
"prompt",
|
10
|
+
"stdin"
|
11
|
+
],
|
12
|
+
"author": {
|
13
|
+
"name": "TJ Holowaychuk",
|
14
|
+
"email": "tj@vision-media.ca"
|
15
|
+
},
|
16
|
+
"repository": {
|
17
|
+
"type": "git",
|
18
|
+
"url": "git://github.com/visionmedia/commander.js.git"
|
19
|
+
},
|
20
|
+
"dependencies": {},
|
21
|
+
"devDependencies": {
|
22
|
+
"should": ">= 0.0.1"
|
23
|
+
},
|
24
|
+
"scripts": {
|
25
|
+
"test": "make test"
|
26
|
+
},
|
27
|
+
"main": "index",
|
28
|
+
"engines": {
|
29
|
+
"node": ">= 0.4.x < 0.8.0"
|
30
|
+
},
|
31
|
+
"_id": "commander@0.5.2",
|
32
|
+
"optionalDependencies": {},
|
33
|
+
"_engineSupported": true,
|
34
|
+
"_npmVersion": "1.1.3",
|
35
|
+
"_nodeVersion": "v0.6.11",
|
36
|
+
"_defaultsLoaded": true,
|
37
|
+
"_from": "commander@0.5.2"
|
38
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
See:
|
2
|
+
[github-flavored-markdown](http://github.github.com/github-flavored-markdown/)
|
3
|
+
|
4
|
+
As an npm package:
|
5
|
+
|
6
|
+
npm install github-flavored-markdown
|
7
|
+
|
8
|
+
And then in your node program:
|
9
|
+
|
10
|
+
var ghm = require("github-flavored-markdown")
|
11
|
+
ghm.parse("I **love** GHM.\n\n#2", "isaacs/npm")
|
12
|
+
// returns:
|
13
|
+
// '<p>I <strong>love</strong> GHM. '+
|
14
|
+
// '<a href=\'http://github.com/isaacs/npm/issues/#issue/2\'>#2</a></p>'
|
15
|
+
|
16
|
+
To get the sha/issue/fork links, pass in a second argument specifying
|
17
|
+
the current project that things should be relative to.
|
@@ -0,0 +1,77 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
7
|
+
<title>GitHub Flavored Markdown - {{ page.title }}</title>
|
8
|
+
<link href="http://github.com/stylesheets/bundle_common.css" media="screen" rel="stylesheet" type="text/css" />
|
9
|
+
<link href="http://github.com/stylesheets/bundle_github.css" media="screen" rel="stylesheet" type="text/css" />
|
10
|
+
<link href="stylesheets/screen.css" media="screen" rel="stylesheet" type="text/css" />
|
11
|
+
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
|
12
|
+
<script type="text/javascript" src="http://github.github.com/github-flavored-markdown/scripts/showdown.js"></script>
|
13
|
+
<script type="text/javascript" src="http://github.github.com/github-flavored-markdown/scripts/preview.js"></script>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
<div id="main">
|
17
|
+
<div id="header" class="basic" style="margin-bottom:20px">
|
18
|
+
<div class="site">
|
19
|
+
<div class="logo boring">
|
20
|
+
<a href="http://github.github.com/github-flavored-markdown/"><img src="images/gfm.png" alt="github flavored markdown" /></a>
|
21
|
+
</div>
|
22
|
+
<div class="topsearch">
|
23
|
+
<ul class="nav logged_out" style="margin-top:20px">
|
24
|
+
<li><a href="http://support.github.com/">Support</a></li>
|
25
|
+
<li><a href="http://github.com/">Back to GitHub</a></li>
|
26
|
+
</ul>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="content" class="site">
|
32
|
+
<div class="wikistyle">
|
33
|
+
|
34
|
+
{{ content }}
|
35
|
+
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
|
39
|
+
<div class="push"></div>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div id="footer">
|
43
|
+
<div class="site">
|
44
|
+
<div class="info">
|
45
|
+
<div class="links">
|
46
|
+
<a href="http://github.com/blog"><b>Blog</b></a> |
|
47
|
+
<a href="http://support.github.com/">Support</a> |
|
48
|
+
<a href="http://github.com/training">Training</a> |
|
49
|
+
<a href="http://github.com/contact">Contact</a> |
|
50
|
+
<a href="http://develop.github.com">API</a> |
|
51
|
+
<a href="http://status.github.com">Status</a> |
|
52
|
+
<a href="http://twitter.com/github">Twitter</a> |
|
53
|
+
<a href="http://github.com/security">Security</a>
|
54
|
+
</div>
|
55
|
+
<div class="company">
|
56
|
+
©
|
57
|
+
{{ site.time | date: "%Y" }}
|
58
|
+
GitHub Inc.
|
59
|
+
All rights reserved.
|
60
|
+
| <a href="http://github.com/site/terms">Terms of Service</a> | <a href="http://github.com/site/privacy">Privacy</a>
|
61
|
+
</div>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<script type="text/javascript">
|
67
|
+
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
68
|
+
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
69
|
+
</script>
|
70
|
+
<script type="text/javascript">
|
71
|
+
var pageTracker = _gat._getTracker("UA-3769691-2");
|
72
|
+
pageTracker._initData();
|
73
|
+
pageTracker._trackPageview();
|
74
|
+
</script>
|
75
|
+
|
76
|
+
</body>
|
77
|
+
</html>
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'digest/md5'
|
2
|
+
|
3
|
+
def gfm(text)
|
4
|
+
# Extract pre blocks
|
5
|
+
extractions = {}
|
6
|
+
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
|
7
|
+
md5 = Digest::MD5.hexdigest(match)
|
8
|
+
extractions[md5] = match
|
9
|
+
"{gfm-extraction-#{md5}}"
|
10
|
+
end
|
11
|
+
|
12
|
+
# prevent foo_bar_baz from ending up with an italic word in the middle
|
13
|
+
text.gsub!(/(^(?! {4}|\t)\w+_\w+_\w[\w_]*)/) do |x|
|
14
|
+
x.gsub('_', '\_') if x.split('').sort.to_s[0..1] == '__'
|
15
|
+
end
|
16
|
+
|
17
|
+
# in very clear cases, let newlines become <br /> tags
|
18
|
+
text.gsub!(/(\A|^$\n)(^\w[^\n]*\n)(^\w[^\n]*$)+/m) do |x|
|
19
|
+
x.gsub(/^(.+)$/, "\\1 ")
|
20
|
+
end
|
21
|
+
|
22
|
+
# Insert pre block extractions
|
23
|
+
text.gsub!(/\{gfm-extraction-([0-9a-f]{32})\}/) do
|
24
|
+
extractions[$1]
|
25
|
+
end
|
26
|
+
|
27
|
+
text
|
28
|
+
end
|
29
|
+
|
30
|
+
if $0 == __FILE__
|
31
|
+
require 'test/unit'
|
32
|
+
require 'shoulda'
|
33
|
+
|
34
|
+
class GFMTest < Test::Unit::TestCase
|
35
|
+
context "GFM" do
|
36
|
+
should "not touch single underscores inside words" do
|
37
|
+
assert_equal "foo_bar", gfm("foo_bar")
|
38
|
+
end
|
39
|
+
|
40
|
+
should "not touch underscores in code blocks" do
|
41
|
+
assert_equal " foo_bar_baz", gfm(" foo_bar_baz")
|
42
|
+
end
|
43
|
+
|
44
|
+
should "not touch underscores in pre blocks" do
|
45
|
+
assert_equal "<pre>\nfoo_bar_baz\n</pre>", gfm("<pre>\nfoo_bar_baz\n</pre>")
|
46
|
+
end
|
47
|
+
|
48
|
+
should "escape two or more underscores inside words" do
|
49
|
+
assert_equal "foo\\_bar\\_baz", gfm("foo_bar_baz")
|
50
|
+
end
|
51
|
+
|
52
|
+
should "turn newlines into br tags in simple cases" do
|
53
|
+
assert_equal "foo \nbar ", gfm("foo\nbar")
|
54
|
+
end
|
55
|
+
|
56
|
+
should "convert newlines in all groups" do
|
57
|
+
assert_equal "apple \npear \norange\n\nruby \npython \nerlang",
|
58
|
+
gfm("apple\npear\norange\n\nruby\npython\nerlang")
|
59
|
+
end
|
60
|
+
|
61
|
+
should "not convert newlines in lists" do
|
62
|
+
assert_equal "# foo\n# bar", gfm("# foo\n# bar")
|
63
|
+
assert_equal "* foo\n* bar", gfm("* foo\n* bar")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
---
|
2
|
+
title: Introduction
|
3
|
+
layout: default
|
4
|
+
---
|
5
|
+
|
6
|
+
GitHub uses what we're calling "GitHub Flavored Markdown" (GFM) for messages, issues, and comments. It differs from standard Markdown (SM) in a few significant ways and adds some additional functionality.
|
7
|
+
|
8
|
+
If you're not already familiar with Markdown, you should spend 15 minutes and go over the excellent [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) at Daring Fireball.
|
9
|
+
|
10
|
+
If you prefer to learn by example, see the following source and result:
|
11
|
+
|
12
|
+
* [Source](sample_content.html)
|
13
|
+
* [Result](http://github.com/mojombo/github-flavored-markdown/issues/#issue/1)
|
14
|
+
|
15
|
+
You can also use our [live javascript preview](http://github.github.com/github-flavored-markdown/preview.html) to see GFM in action.
|
16
|
+
|
17
|
+
Differences from traditional Markdown
|
18
|
+
-------------------------------------
|
19
|
+
|
20
|
+
### Newlines
|
21
|
+
|
22
|
+
The biggest difference that GFM introduces is in the handling of linebreaks. With SM you can hard wrap paragraphs of text and they will be combined into a single paragraph. We find this to be the cause of a huge number of unintentional formatting errors. GFM treats newlines in paragraph-like content as real line breaks, which is probably what you intended.
|
23
|
+
|
24
|
+
The next paragraph contains two phrases separated by a single newline character:
|
25
|
+
|
26
|
+
Roses are red
|
27
|
+
Violets are blue
|
28
|
+
|
29
|
+
becomes
|
30
|
+
|
31
|
+
Roses are red
|
32
|
+
Violets are blue
|
33
|
+
|
34
|
+
### Multiple underscores in words
|
35
|
+
|
36
|
+
It is not reasonable to italicize just _part_ of a word, especially when you're dealing with code and names often appear with multiple underscores. Therefore, GFM ignores multiple underscores in words.
|
37
|
+
|
38
|
+
perform_complicated_task
|
39
|
+
do_this_and_do_that_and_another_thing
|
40
|
+
|
41
|
+
becomes
|
42
|
+
|
43
|
+
perform\_complicated\_task
|
44
|
+
do\_this\_and\_do\_that\_and\_another\_thing
|
45
|
+
|
46
|
+
### URL autolinking
|
47
|
+
|
48
|
+
GFM will autolink standard URLs, so if you want to link to a URL (instead of setting link text), you can simply enter the URL and it will be turned into a link to that URL.
|
49
|
+
|
50
|
+
A bit of the GitHub spice
|
51
|
+
-------------------------
|
52
|
+
|
53
|
+
In addition to the changes in the previous section, certain references are auto-linked:
|
54
|
+
|
55
|
+
* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
|
56
|
+
* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
|
57
|
+
* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
|
58
|
+
* \#Num: #1
|
59
|
+
* User/#Num: mojombo#1
|
60
|
+
* User/Project#Num: mojombo/god#1
|
61
|
+
|
62
|
+
becomes
|
63
|
+
|
64
|
+
<ul>
|
65
|
+
<li>SHA: <a href="http://github.com/mojombo/github-flavored-markdown/commit/be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2">be6a8cc</a></li>
|
66
|
+
<li>User@SHA ref: <a href="http://github.com/mojombo/github-flavored-markdown/commit/be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2">mojombo@be6a8cc</a></li>
|
67
|
+
<li>User/Project@SHA: <a href="http://github.com/mojombo/god/commit/be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2">mojombo/god@be6a8cc</a></li>
|
68
|
+
<li>#Num: <a href="http://github.com/mojombo/github-flavored-markdown/issues/#issue/1" class="internal">#1</a></li>
|
69
|
+
<li>User/#Num: <a href="http://github.com/mojombo/github-flavored-markdown/issues/#issue/1">mojombo#1</a></li>
|
70
|
+
<li>User/Project#Num: <a href="http://github.com/mojombo/god/issues/#issue/1">mojombo/god#1</a></li>
|
71
|
+
</ul>
|
72
|
+
|
73
|
+
Code
|
74
|
+
----
|
75
|
+
|
76
|
+
The newline and underscore modification code can be seen below. If you find a bug in the rendering, we'd love to hear about it.
|
77
|
+
|
78
|
+
<script src="http://gist.github.com/118964.js"></script>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"name": "github-flavored-markdown",
|
3
|
+
"version": "1.0.1",
|
4
|
+
"description": "The port of Showdown used on github.com",
|
5
|
+
"author": {
|
6
|
+
"name": "tekkup",
|
7
|
+
"email": "git@tekkub.net",
|
8
|
+
"url": "http://tekkub.net/"
|
9
|
+
},
|
10
|
+
"main": "./scripts/showdown.js",
|
11
|
+
"repository": {
|
12
|
+
"type": "git",
|
13
|
+
"url": "git://github.com/isaacs/github-flavored-markdown.git"
|
14
|
+
},
|
15
|
+
"_id": "github-flavored-markdown@1.0.1",
|
16
|
+
"dependencies": {},
|
17
|
+
"devDependencies": {},
|
18
|
+
"optionalDependencies": {},
|
19
|
+
"engines": {
|
20
|
+
"node": "*"
|
21
|
+
},
|
22
|
+
"_engineSupported": true,
|
23
|
+
"_npmVersion": "1.1.3",
|
24
|
+
"_nodeVersion": "v0.6.11",
|
25
|
+
"_defaultsLoaded": true,
|
26
|
+
"_from": "github-flavored-markdown@>= 0.0.1"
|
27
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
title: Live Preview
|
3
|
+
layout: default
|
4
|
+
---
|
5
|
+
|
6
|
+
This page provides a live GFM preview, rendered client-side using javascript.
|
7
|
+
The majority of the credit goes to the wonderful [Showdown](http://attacklab.net/showdown/) script, which handles the meat of the processing.
|
8
|
+
GFM modifications for newlines, underscore-words, autolinking and GitHub SHA1/issue link syntaxes were added.
|
9
|
+
|
10
|
+
User input
|
11
|
+
----------
|
12
|
+
|
13
|
+
<script type="text/javascript">
|
14
|
+
var GitHub = {}
|
15
|
+
GitHub.nameWithOwner = "mojombo/god";
|
16
|
+
</script>
|
17
|
+
|
18
|
+
<textarea id="user_input"></textarea>
|
19
|
+
|
20
|
+
Live preview
|
21
|
+
------------
|
22
|
+
|
23
|
+
<div id="result"></div>
|
24
|
+
|
25
|
+
### HTML
|
26
|
+
|
27
|
+
<textarea id="html_result"></textarea>
|
@@ -0,0 +1,169 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<title>Example Source</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<pre>GitHub Flavored Markdown
|
10
|
+
================================
|
11
|
+
|
12
|
+
*View the [source of this content](http://github.github.com/github-flavored-markdown/sample_content.html).*
|
13
|
+
|
14
|
+
Let's get the whole "linebreak" thing out of the way. The next paragraph contains two phrases separated by a single newline character:
|
15
|
+
|
16
|
+
Roses are red
|
17
|
+
Violets are blue
|
18
|
+
|
19
|
+
The next paragraph has the same phrases, but now they are separated by two spaces and a newline character:
|
20
|
+
|
21
|
+
Roses are red
|
22
|
+
Violets are blue
|
23
|
+
|
24
|
+
Oh, and one thing I cannot stand is the mangling of words with multiple underscores in them like perform_complicated_task or do_this_and_do_that_and_another_thing.
|
25
|
+
|
26
|
+
A bit of the GitHub spice
|
27
|
+
-------------------------
|
28
|
+
|
29
|
+
In addition to the changes in the previous section, certain references are auto-linked:
|
30
|
+
|
31
|
+
* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
|
32
|
+
* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
|
33
|
+
* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
|
34
|
+
* \#Num: #1
|
35
|
+
* User/#Num: mojombo#1
|
36
|
+
* User/Project#Num: mojombo/god#1
|
37
|
+
|
38
|
+
These are dangerous goodies though, and we need to make sure email addresses don't get mangled:
|
39
|
+
|
40
|
+
My email addy is tom@github.com.
|
41
|
+
|
42
|
+
Math is hard, let's go shopping
|
43
|
+
-------------------------------
|
44
|
+
|
45
|
+
In first grade I learned that 5 > 3 and 2 < 7. Maybe some arrows. 1 -> 2 -> 3. 9 <- 8 <- 7.
|
46
|
+
|
47
|
+
Triangles man! a^2 + b^2 = c^2
|
48
|
+
|
49
|
+
We all like making lists
|
50
|
+
------------------------
|
51
|
+
|
52
|
+
The above header should be an H2 tag. Now, for a list of fruits:
|
53
|
+
|
54
|
+
* Red Apples
|
55
|
+
* Purple Grapes
|
56
|
+
* Green Kiwifruits
|
57
|
+
|
58
|
+
Let's get crazy:
|
59
|
+
|
60
|
+
1. This is a list item with two paragraphs. Lorem ipsum dolor
|
61
|
+
sit amet, consectetuer adipiscing elit. Aliquam hendrerit
|
62
|
+
mi posuere lectus.
|
63
|
+
|
64
|
+
Vestibulum enim wisi, viverra nec, fringilla in, laoreet
|
65
|
+
vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
|
66
|
+
sit amet velit.
|
67
|
+
|
68
|
+
2. Suspendisse id sem consectetuer libero luctus adipiscing.
|
69
|
+
|
70
|
+
What about some code **in** a list? That's insane, right?
|
71
|
+
|
72
|
+
1. In Ruby you can map like this:
|
73
|
+
|
74
|
+
['a', 'b'].map { |x| x.uppercase }
|
75
|
+
|
76
|
+
2. In Rails, you can do a shortcut:
|
77
|
+
|
78
|
+
['a', 'b'].map(&:uppercase)
|
79
|
+
|
80
|
+
Some people seem to like definition lists
|
81
|
+
|
82
|
+
<dl>
|
83
|
+
<dt>Lower cost</dt>
|
84
|
+
<dd>The new version of this product costs significantly less than the previous one!</dd>
|
85
|
+
<dt>Easier to use</dt>
|
86
|
+
<dd>We've changed the product so that it's much easier to use!</dd>
|
87
|
+
</dl>
|
88
|
+
|
89
|
+
I am a robot
|
90
|
+
------------
|
91
|
+
|
92
|
+
Maybe you want to print `robot` to the console 1000 times. Why not?
|
93
|
+
|
94
|
+
def robot_invasion
|
95
|
+
puts("robot " * 1000)
|
96
|
+
end
|
97
|
+
|
98
|
+
You see, that was formatted as code because it's been indented by four spaces.
|
99
|
+
|
100
|
+
How about we throw some angle braces and ampersands in there?
|
101
|
+
|
102
|
+
<div class="footer">
|
103
|
+
&copy; 2004 Foo Corporation
|
104
|
+
</div>
|
105
|
+
|
106
|
+
Set in stone
|
107
|
+
------------
|
108
|
+
|
109
|
+
Preformatted blocks are useful for ASCII art:
|
110
|
+
|
111
|
+
<pre>
|
112
|
+
,-.
|
113
|
+
, ,-. ,-.
|
114
|
+
/ \ ( )-( )
|
115
|
+
\ | ,.>-( )-<
|
116
|
+
\|,' ( )-( )
|
117
|
+
Y ___`-' `-'
|
118
|
+
|/__/ `-'
|
119
|
+
|
|
120
|
+
|
|
121
|
+
| -hrr-
|
122
|
+
___|_____________
|
123
|
+
</pre>
|
124
|
+
|
125
|
+
Playing the blame game
|
126
|
+
----------------------
|
127
|
+
|
128
|
+
If you need to blame someone, the best way to do so is by quoting them:
|
129
|
+
|
130
|
+
> I, at any rate, am convinced that He does not throw dice.
|
131
|
+
|
132
|
+
Or perhaps someone a little less eloquent:
|
133
|
+
|
134
|
+
> I wish you'd have given me this written question ahead of time so I
|
135
|
+
> could plan for it... I'm sure something will pop into my head here in
|
136
|
+
> the midst of this press conference, with all the pressure of trying to
|
137
|
+
> come up with answer, but it hadn't yet...
|
138
|
+
>
|
139
|
+
> I don't want to sound like
|
140
|
+
> I have made no mistakes. I'm confident I have. I just haven't - you
|
141
|
+
> just put me under the spot here, and maybe I'm not as quick on my feet
|
142
|
+
> as I should be in coming up with one.
|
143
|
+
|
144
|
+
Table for two
|
145
|
+
-------------
|
146
|
+
|
147
|
+
<table>
|
148
|
+
<tr>
|
149
|
+
<th>ID</th><th>Name</th><th>Rank</th>
|
150
|
+
</tr>
|
151
|
+
<tr>
|
152
|
+
<td>1</td><td>Tom Preston-Werner</td><td>Awesome</td>
|
153
|
+
</tr>
|
154
|
+
<tr>
|
155
|
+
<td>2</td><td>Albert Einstein</td><td>Nearly as awesome</td>
|
156
|
+
</tr>
|
157
|
+
</table>
|
158
|
+
|
159
|
+
Crazy linking action
|
160
|
+
--------------------
|
161
|
+
|
162
|
+
I get 10 times more traffic from [Google] [1] than from
|
163
|
+
[Yahoo] [2] or [MSN] [3].
|
164
|
+
|
165
|
+
[1]: http://google.com/ "Google"
|
166
|
+
[2]: http://search.yahoo.com/ "Yahoo Search"
|
167
|
+
[3]: http://search.msn.com/ "MSN Search"</pre>
|
168
|
+
</body>
|
169
|
+
</html>
|