Skip to content

Commit

Permalink
Fix missed caps wrapped in parentheses. [#43 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarber committed Sep 16, 2008
1 parent 5494284 commit 56b0b3d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Expand Up @@ -2,6 +2,8 @@

* Added some very basic support for images in LaTeX. [virtualfunction]

* Fixed missed caps wrapped in parentheses. #43


*4.0.3 (August 18, 2008)*

Expand Down
23 changes: 12 additions & 11 deletions ext/redcloth_scan/redcloth_inline.rl
Expand Up @@ -67,7 +67,8 @@
arrow = "->" ;
endash = " - " ;
acronym = ( [A-Z] >A [A-Z0-9]{2,} %T "(" default+ >A %{ STORE(title) } :> ")" ) >X ;
caps = ( upper{3,} >A %*T ) >X ;
caps_noactions = upper{3,} ;
caps = ( caps_noactions >A %*T ) >X ;
dim_digit = [0-9.]+ ;
prime = ("'" | '"')?;
dim_noactions = dim_digit prime (("x" | " x ") dim_digit prime) %T (("x" | " x ") dim_digit prime)? ;
Expand All @@ -83,20 +84,20 @@
# info
redcloth_version = "[RedCloth::VERSION]" ;

other_phrase = phrase -- dim_noactions;
other_phrase = phrase -- (dim_noactions | caps_noactions);

code_tag := |*
code_tag_end { CAT(block); fgoto main; };
default => esc_pre;
*|;

main := |*

image { INLINE(block, image); };

link { PARSE_LINK_ATTR(link_text); PASS(block, name, link); };
bracketed_link { PARSE_LINK_ATTR(link_text); PASS(block, name, link); };

code { PARSE_ATTR(text); PASS_CODE(block, text, code, opts); };
code_tag_start { CAT(block); fgoto code_tag; };
notextile { INLINE(block, notextile); };
Expand All @@ -117,7 +118,7 @@
snip { PASS(block, text, snip); };
quote1 { PASS(block, text, quote1); };
quote2 { PASS(block, text, quote2); };

ellipsis { INLINE(block, ellipsis); };
emdash { INLINE(block, emdash); };
endash { INLINE(block, endash); };
Expand All @@ -130,21 +131,21 @@
copyright { INLINE(block, copyright); };
footno { PASS(block, text, footno); };
entity { INLINE(block, entity); };

script_tag { INLINE(block, inline_html); };
start_tag { INLINE(block, inline_html); };
end_tag { INLINE(block, inline_html); };
empty_tag { INLINE(block, inline_html); };
html_comment { INLINE(block, inline_html); };

redcloth_version { INLINE(block, inline_redcloth_version); };

other_phrase => esc;
PUNCT => esc;
space => esc;

EOF;

*|;

}%%
Expand Down
8 changes: 7 additions & 1 deletion test/basic.yml
Expand Up @@ -812,4 +812,10 @@ name: underscores in parentheses in quotes 2
in: |-
"one (two _three four_) five"
html: |-
<p>&#8220;one (two <em>three four</em>) five&#8221;</p>
<p>&#8220;one (two <em>three four</em>) five&#8221;</p>
---
name: caps in parentheses
desc: Uppercase words of three or more characters that are in parentheses should be recognized as well as those not in parentheses.
in: IBM or (HAL)
html: <p><span class="caps">IBM</span> or (<span class="caps">HAL</span>)</p>
no_span_caps_html: <p>IBM or (HAL)</p>
2 changes: 1 addition & 1 deletion test/links.yml
Expand Up @@ -160,7 +160,7 @@ in: '* "rubylang":http://www.ruby-lang.org/en/'
html: "<ul>\n\t<li><a href=\"http://www.ruby-lang.org/en/\">rubylang</a></li>\n</ul>"
---
in: 'The ION coding style document found at "IONCodingStyleGuide.doc":http://perforce:8081/@md=d&cd=//&c=82E@//depot/systest/system/main/pub/doc/IONCodingStyleGuide.doc?ac=22 codifies a couple of rules to ensure reasonably consistent code and documentation of libraries in ION. Test text'
html: <p>The <span class="caps">ION</span> coding style document found at <a href="http://perforce:8081/@md=d&amp;cd=//&amp;c=82E@//depot/systest/system/main/pub/doc/IONCodingStyleGuide.doc?ac=22">IONCodingStyleGuide.doc</a> codifies a couple of rules to ensure reasonably consistent code and documentation of libraries in <span class="caps">ION</span>. Test text</p>
html: <p>The <span class="caps">ION</span> coding style document found at <a href="http://perforce:8081/@md=d&amp;cd=//&amp;c=82E@//depot/systest/system/main/pub/doc/IONCodingStyleGuide.doc?ac=22"><span class="caps">IONC</span>odingStyleGuide.doc</a> codifies a couple of rules to ensure reasonably consistent code and documentation of libraries in <span class="caps">ION</span>. Test text</p>
---
in: '"testing":'
html: "<p>&#8220;testing&#8221;:</p>"
Expand Down

0 comments on commit 56b0b3d

Please sign in to comment.