Commit Graph

48 Commits

Author SHA1 Message Date
Yuki Nishijima
f7ba69436a Speed up Levenshtein by 50% and reduce 97% of memory usage
Calculating -------------------------------------
             each_char   924.000  i/100ms
        each_codepoint     1.381k i/100ms
  -------------------------------------------------
             each_char      9.320k (¡Þ 5.1%) i/s -     47.124k
        each_codepoint     13.857k (¡Þ 3.6%) i/s -     70.431k

  Comparison:
        each_codepoint:    13857.4 i/s
             each_char:     9319.5 i/s - 1.49x slower

The full report can be found here:
  https://gist.github.com/yuki24/a80988f35aceac76f1d5
2015-04-11 15:28:23 -07:00
yui-knk
ec895167c2 Fix place of require 'rails_guides/markdown' 2015-03-07 16:50:27 +09:00
schneems
6f0a69c589 fix bug in Levenshtein distance calculation
Bug was discovered and discussed in #18395.
2015-02-25 12:58:49 -06:00
Vipul A M
5cfaf5a46e - Changed IN to ON in markdown renderer condition
- Changed `IN` to `ON` in all note sentences in guides.
2015-01-14 11:52:13 +05:30
Robin Dupret
0aa18c7d18 Consider html+erb as a valid language for snippets
To highlight ERB snippets, both `erb` and `html+erb` are used as a
language passed to the code block. However, only the former will be
correctly highlighted.
2015-01-03 12:57:29 +01:00
Xavier Noria
6dd4c04b71 removes superfluous regexp group 2014-12-23 23:51:42 +01:00
Xavier Noria
f2bdca3bf9 third test to warn against reading guides in GitHub 2014-12-23 23:24:06 +01:00
Xavier Noria
82180f4ebd second test to warn against reading guides in GitHub 2014-12-23 23:18:51 +01:00
Xavier Noria
5a877d504e proof of concept, need to check in GitHub 2014-12-23 23:00:27 +01:00
Erik Michaels-Ober
d1374f99bf Pass symbol as an argument instead of a block 2014-11-29 11:53:24 +01:00
Juanito Fatas
2735b9cf97 Fix guide anchor generation logic.
This could use in any translation because it's not limited to `[^a-z0-9]`.

Verify after this change, all guides still have same anchors.

[Robin Dupret & Juanito Fatas]
2014-08-24 11:58:01 +08:00
Juanito Fatas
597a666601 Revert "Do not gsub non ASCII characters in header anchor.".
This reverts commit 699babe.

Also change the upgrading_ruby_on_rails link back to original in 4_2_release_notes.
2014-08-20 19:18:10 +08:00
Hendy Tanata
71c7fd1013 Uppercase HTML in docs.
[skip ci]
2014-08-08 14:27:05 -07:00
Juanito Fatas
d740b58a26 Update the levenshtein distance method in guides. 2014-06-28 15:27:15 +08:00
Juanito Fatas
699babe8e3 Do not gsub non ASCII characters in header anchor. 2014-05-22 16:14:31 +08:00
Robin Dupret
ad3628b311 Update Redcarpet to 3.1.2
This version fixes an API breakage between 3.0 and 3.1 ; the header
method's arity should not have changed.

[ci skip]
2014-05-14 19:52:47 +02:00
Nate Berkopec
220528548b Guides: output valid HTML5
[ci skip]
2014-05-05 17:42:04 -04:00
Yves Senn
67d4dc2bdb rails_guides/helpers.rb requires YAML to run.
Resolve the following error when running `bundle exec rake guides:generate:html`:

```
/Users/senny/.rbenv/versions/2.0.0-p353/bin/ruby rails_guides.rb
Generating 2_2_release_notes.md as 2_2_release_notes.html
/Users/senny/Projects/rails/guides/rails_guides/helpers.rb:17:in `documents_by_section': uninitialized constant RailsGuides::Helpers::YAML (ActionView::Template::Error)
	from /Users/senny/Projects/rails/guides/rails_guides/helpers.rb:32:in `docs_for_menu'
	from /Users/senny/Projects/rails/guides/source/layout.html.erb:56:in `block in ___sers_senny__rojects_rails_guides_source_layout_html_erb___3094858039481335962_70118647133480'
	from /Users/senny/Projects/rails/guides/source/layout.html.erb:54:in `each'
	from /Users/senny/Projects/rails/guides/source/layout.html.erb:54:in `___sers_senny__rojects_rails_guides_source_layout_html_erb___3094858039481335962_70118647133480'
	from /Users/senny/Projects/rails/actionview/lib/action_view/template.rb:143:in `block in render'
	from /Users/senny/Projects/rails/activesupport/lib/active_support/notifications.rb:161:in `instrument'
	from /Users/senny/Projects/rails/actionview/lib/action_view/template.rb:337:in `instrument'
	from /Users/senny/Projects/rails/actionview/lib/action_view/template.rb:141:in `render'
	from /Users/senny/Projects/rails/actionview/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
	from /Users/senny/Projects/rails/actionview/lib/action_view/renderer/template_renderer.rb:47:in `render_template'
	from /Users/senny/Projects/rails/actionview/lib/action_view/renderer/template_renderer.rb:17:in `render'
	from /Users/senny/Projects/rails/actionview/lib/action_view/renderer/renderer.rb:42:in `render_template'
	from /Users/senny/Projects/rails/actionview/lib/action_view/renderer/renderer.rb:23:in `render'
	from /Users/senny/Projects/rails/actionview/lib/action_view/helpers/rendering_helper.rb:24:in `render'
	from /Users/senny/Projects/rails/guides/rails_guides/markdown.rb:160:in `render_page'
	from /Users/senny/Projects/rails/guides/rails_guides/markdown.rb:25:in `render'
	from /Users/senny/Projects/rails/guides/rails_guides/generator.rb:205:in `block in generate_guide'
	from /Users/senny/Projects/rails/guides/rails_guides/generator.rb:195:in `open'
	from /Users/senny/Projects/rails/guides/rails_guides/generator.rb:195:in `generate_guide'
	from /Users/senny/Projects/rails/guides/rails_guides/generator.rb:144:in `block in generate_guides'
	from /Users/senny/Projects/rails/guides/rails_guides/generator.rb:142:in `each'
	from /Users/senny/Projects/rails/guides/rails_guides/generator.rb:142:in `generate_guides'
	from /Users/senny/Projects/rails/guides/rails_guides/generator.rb:97:in `generate'
	from rails_guides.rb:63:in `<main>'
rake aborted!
Command failed with status (1): [/Users/senny/.rbenv/versions/2.0.0-p353/bi...]
/Users/senny/Projects/rails/guides/Rakefile:11:in `block (3 levels) in <top (required)>'
Tasks: TOP => guides:generate:html
(See full trace by running task with --trace)
```
2014-02-03 12:01:32 +01:00
laurocaetano
d48222d22e remove warnings on ruby trunk 2013-11-01 18:15:53 -02:00
Karunakar (Ruby)
4f9ae6cfc6 used flat_map instead of map.flatten in /guides/rails_guides/helpers.rb 2013-08-04 01:13:24 +05:30
Vipul A M
7ecaa0057c remove unused variable 2013-04-13 13:19:54 +05:30
Gosha Arinich
af660ee717 place article name in the beginning of guides page title 2013-01-06 01:46:30 +03:00
Vijay Dev
86269b4207 Merge pull request #8348 from danchoi/master
Kindle ebook generation with working section navigation
2012-12-08 10:33:05 -08:00
Xavier Noria
0adcf6d90e let @version be always externally set in guides generation [fixes #8221]
Shelling out was there for authors convenience, but we are
rather going to have the tag or SHA1 always in RAILS_VERSION
and if the environment variable is blank, then just use
"local" as a reminder that you are just working locally.

The docs server has been updated to set the long SHA1 in
RAILS_VERSION when generating edge guides.
2012-12-07 15:20:56 +01:00
Daniel Choi
e8fe1d1a20 Add periodical-style TOC and navigation to Kindle version of guides 2012-12-01 18:08:10 -05:00
Carlos Antonio da Silva
9886b88a3b Do not strip code blocks, otherwise we may get misaligned output
[ci skip]
2012-11-07 09:22:14 -02:00
Joe Fiorini
03bcd416b0 [Guides] Navigation styling for small devices 2012-10-06 16:38:37 -04:00
Santiago Pastorino
a0613ad8a9 Revert "Use flat_map { } instead of map {}.flatten"
This reverts commit abf8de85519141496a6773310964ec03f6106f3f.
We should take a deeper look to those cases flat_map doesn't do deep
flattening.

irb(main):002:0> [[[1,3], [1,2]]].map{|i| i}.flatten
=> [1, 3, 1, 2]
irb(main):003:0> [[[1,3], [1,2]]].flat_map{|i| i}
=> [[1, 3], [1, 2]]
2012-10-05 12:07:16 -03:00
Santiago Pastorino
abf8de8551 Use flat_map { } instead of map {}.flatten 2012-10-05 11:52:20 -03:00
Xavier Noria
1e7b8d3a22 let .md be the only supported extension for guides 2012-09-18 23:04:12 +02:00
Prem Sichanugrist
1fa5c3b39f Fix footnote format
Markdown has footnote, but Redcarpet doesn't support it.
2012-09-17 15:55:17 -04:00
Prem Sichanugrist
05b4d59a8d Change #id generation rule
* Use the current heading by default
* If duplicate, then use #[parent]-[current] as the id
2012-09-17 15:55:17 -04:00
Prem Sichanugrist
5e2866cc34 No more Textile guide generation support 2012-09-17 15:55:17 -04:00
Prem Sichanugrist
5a4622b8b8 Retain heading styles in the page chapters list 2012-09-17 15:54:23 -04:00
Prem Sichanugrist
f35187be22 Make sure that styles in NOTE block got converted 2012-09-17 15:54:23 -04:00
Prem Sichanugrist
ed62b1bf0b Enable table 2012-09-17 15:54:22 -04:00
Prem Sichanugrist
0867fcdb5a Update Markdown renderer to be more flexible 2012-09-17 15:54:22 -04:00
Prem Sichanugrist
232b9ade1a Skip kindle's readme file on generation 2012-09-17 15:54:22 -04:00
Prem Sichanugrist
848d13a8aa Reuse parent's id if it's already exists 2012-09-17 15:54:21 -04:00
Prem Sichanugrist
efa7717b7a 4.0 release note now renders correctly with index 2012-09-17 15:54:21 -04:00
Prem Sichanugrist
544f6bcb90 Start rewriting 4.0 release note into Markdown 2012-09-17 15:54:21 -04:00
Xavier Noria
447b6a4e67 removes usage of Object#in? from the code base (the method remains defined by Active Support)
Selecting which key extensions to include in active_support/rails
made apparent the systematic usage of Object#in? in the code base.
After some discussion in

    5ea6b0df9a

we decided to remove it and use plain Ruby, which seems enough
for this particular idiom.

In this commit the refactor has been made case by case. Sometimes
include? is the natural alternative, others a simple || is the
way you actually spell the condition in your head, others a case
statement seems more appropriate. I have chosen the one I liked
the most in each case.
2012-08-06 00:30:02 +02:00
Rafael Magana
eb362e59c0 [guides] fix reference to railties directory, guides are no longer there 2012-05-28 16:21:25 -05:00
Rafael Magana
15b229e8aa [guides] guides:generate:kindle is the new interface to generate .mobi file instead of using KINDLE=1 2012-05-28 16:20:10 -05:00
Rafael Magana
1b5e1c1972 [guides] get rid of any reference to the generator script since rake tasks are now the new interface 2012-05-28 16:17:00 -05:00
Rafael Magana
e625056c82 [guides] update generator.rb to refer to guides:generate instead of generate_guides 2012-05-27 23:33:54 -05:00
Vijay Dev
58a49875df Make RedCloth not convert double hyphens to emdashes. Closes #5292
As mentioned in http://redcloth.org/textile/writing-paragraph-text/#dashes
RedCloth converts double hyphens to emdashes. This causes problems in
the guides where options like --database, --full are rendered incorrectly.

This commit fixes it by customizing the emdash method in the
RedCloth::Formatters::HTML module to just return '--'. See their FAQ
http://redcloth.org/faq in the section 'How do I customize RedCloth?'
2012-05-06 01:05:43 +05:30
Xavier Noria
6d87cd028b moves the guides up to the root directory 2012-03-17 08:32:49 -07:00