Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Recipe: How to quote a string when generating HTML?
Last updated at 6:20 pm UTC on 5 March 2017
In this recipe it is assumed that you want to write a method where a HTML template is assigned to a string variable.


To get the quoted HTML code do the following.


1. Open a Workspace.
2. Paste the HTML code into the workspace.


Workspace_with_HTML_template_string.png

3. Bring up the Halos of the workspace

Workspace_with_halos_2017-03-01.png

4. In the red halo menu choose 'debug' -> inspect model

5. Then click on 'explore' and 'dependents' and drill down until you find the 'text' instance variable.

text_of_Workspace2017-03-01.png

6. Open an inspector on the text and click on 'string' in the Text inspector.

7. Close the window labeled 'a Workspace'. You now have a workspace labeled 'Workspace with HTML template string' where the text you edit is automatically converted to a quoted string in the window on the right hand side.
Workspace_with_window_with_quoted_text_2017-03-01.png

8. To get the quoted string click on 'string' in the Text inspector and choose 'inspect'. This gives you the string you may paste into your method.


Source: Bob Arning - Squeak Mailing List Sat, Feb 2, 2013 at 1:03 AM


See also PluggableTextMorphWithModel
PluggableTextMorphWithModel_2017-03.png