Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shoes Manual string mishandling cause an error #51

Closed
IanTrudel opened this issue Feb 1, 2015 · 4 comments
Closed

Shoes Manual string mishandling cause an error #51

IanTrudel opened this issue Feb 1, 2015 · 4 comments
Milestone

Comments

@IanTrudel
Copy link
Collaborator

Unbalanced, unescaped double quotes seem to cause the error.

TESTING SCENARIO

  • Run Shoes
  • Open The Shoes Manual
  • Open The Shoes Console (alt-/)
  • Go to the search page
  • Type oval
  • Click on arc or shape

SHOES CONSOLE

Error in <unknown> line 0 | 2015-02-01 12:22:13 -0500
(eval):1: syntax error, unexpected tIDENTIFIER, expecting ')'
...trol than ", link("strong("oval", :fill => yellow), "") { op...
...                               ^
(eval):1: syntax error, unexpected ')', expecting end-of-input
... yellow), "") { open_link("",") }, ", by offering the ", cod...
...                               ^
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:47:in `eval'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:47:in `dewikify_p'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:126:in `block (2 levels) in dewikify'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:103:in `block in wiki_tokens'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:81:in `map'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:81:in `wiki_tokens'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:111:in `block in dewikify'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:373:in `instance_eval'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:373:in `block (2 levels) in open_methods'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:367:in `each'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:367:in `block in open_methods'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:363:in `call'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:363:in `clear'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:363:in `open_methods'
C:/Program Files (x86)/Shoes/lib/shoes/help.rb:286:in `block (7 levels) in show_search'
-e:1:in `call'

image
Description for arc is missing

EXPECTED RESULT

=== arc(left, top, width, height, angle1, angle2) » Shoes::Shape ===

Draws an arc shape (a section of an oval) at coordinates (left, top). This
method just give you a bit more control than oval, by offering the
:angle1 and :angle2 styles. (In fact, you can mimick the oval method by
setting :angle1 to 0 and :angle2 to Shoes::TWO_PI.)

RELEVANT FILES
https://github.com/Shoes3/shoes3/blob/master/lib/shoes/help.rb
https://github.com/Shoes3/shoes3/blob/master/static/manual-en.txt

@IanTrudel
Copy link
Collaborator Author

The value of str at the beginnig of dewikify_p for the arc method when you navigate to _Slots > Art_:

"Draws an arc shape (a section of an oval) at coordinates (left, top). This\nmethod just give you a bit more control than [[oval]], by offering the\n:angle1 and :angle2 styles. (In fact, you can mimick the oval method by\nsetting :angle1 to 0 and :angle2 to Shoes::TWO_PI.)"

The value of str when you go to Search, type oval and click arc method:

Draws an arc shape (a section of an @Oval@) at coordinates (left, top). This
method just give you a bit more control than [[@Oval@]], by offering the
:angle1 and :angle2 styles. (In fact, you can mimick the @oval@ method by
setting :angle1 to 0 and :angle2 to Shoes::TWO_PI.)

@IanTrudel
Copy link
Collaborator Author

Line 29 in dewikify_hi will cause a terms to be marked up for highlighting. Line 39 in dewikify_p will do the actual highlighting.

https://github.com/Shoes3/shoes3/blob/master/lib/shoes/help.rb#L29

gsub(/#{Regexp::quote(terms)}/i, '@\0@').

https://github.com/Shoes3/shoes3/blob/master/lib/shoes/help.rb#L39

gsub(/@(.+?)@/m, '", strong("\1", :fill => yellow), "').

The offending markup in manual-en.txt is [[oval]] because it becomes [[@Oval@]] when highlighted. The fall through gsub will first treat @Oval@ generating a strong emphasis and then treat [[]] trying to generate a link to open a section/method, resulting in a disaster.

@IanTrudel
Copy link
Collaborator Author

SOLUTION:

Insert on line 39, https://github.com/Shoes3/shoes3/blob/master/lib/shoes/help.rb#L39

gsub(/\[\[(.+\.)?@(.+?)@\]\]/m, '", link(strong("\2".empty? ? "\1" : "\2" , :fill => yellow)) { open_link("\1\2") }, "').

Also, change [[oval]] for [[Art.oval]] in https://github.com/Shoes3/shoes3/blob/master/static/manual-en.txt#L1683.

IanTrudel added a commit that referenced this issue Feb 2, 2015
Partial fix for #51
IanTrudel added a commit that referenced this issue Feb 2, 2015
@IanTrudel
Copy link
Collaborator Author

This issue is fixed. Should have committed with message _fixes #51_ instead of fixing #51.

@IanTrudel IanTrudel added this to the 3.2.21 milestone Feb 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant