Error: <<<This string contains a character (ascii value 160) that is not normally used in code>>>

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
tty
Reply | Threaded
Open this post in threaded view
|

Error: <<<This string contains a character (ascii value 160) that is not normally used in code>>>

tty

Good morning,

At http://www.menmachinesmaterials.com/SeasideDoc I am trying to scrape http://wiki.squeak.org/squeak/  and store the html data in a method of a subclass of DocletSwiki.

I am able to create new subclasses with methods just fine until I try to store the html content in a method.

My latest attempt to just get something to work looks like this:


|ht createdMethodName |

createdMethodName := #htmlcontent.
ht := HelpTopic
title:'Dude'
contents:(HTTPLoader default retrieveContentsFor: ('http://wiki.squeak.org/squeak/1' asUrl)).



DocletSwiki compile: createdMethodName, (ht contents content asTextFromHtml).



that ht contents content asTextFromHtml is the latest contortion after many hours of hacking.

It throws the SyntaxError (?) shown in the subject header above.


A simple 
DocletSwiki compile: #htmlcontent, '^ 1'
works fine.

DocletSwiki is a simple subclass of WAComponent.

Thanks in advance.

t






_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Error: <<<This string contains a character (ascii value 160) that is not normally used in code>>>

jtuchel

Hi Timothy,


I'd start looking for quotes in the html string. Seems parts of the String are not interpreted as String contents.


Is that possible?


Joachim

gettimothy <[hidden email]> hat am 23. November 2018 um 13:51 geschrieben:


Good morning,

At http://www.menmachinesmaterials.com/SeasideDoc I am trying to scrape  http://wiki.squeak.org/squeak/  and store the html data in a method of a subclass of DocletSwiki.

I am able to create new subclasses with methods just fine until I try to store the html content in a method.

My latest attempt to just get something to work looks like this:


|ht createdMethodName |

createdMethodName := #htmlcontent.
ht := HelpTopic
title:'Dude'
contents:(HTTPLoader default retrieveContentsFor: (' http://wiki.squeak.org/squeak/1' asUrl)).



DocletSwiki compile: createdMethodName, (ht contents content asTextFromHtml).



that ht contents content asTextFromHtml is the latest contortion after many hours of hacking.

It throws the SyntaxError (?) shown in the subject header above.


A simple 
DocletSwiki compile: #htmlcontent, '^ 1'
works fine.

DocletSwiki is a simple subclass of WAComponent.

Thanks in advance.

t






 

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


 


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
tty
Reply | Threaded
Open this post in threaded view
|

Resolved: Error: <<<This string contains a character (ascii value 160) that is not normally used in code>>>

tty
Well, that was interesting...the secret was the format and {1} construct.

Interesting code:

scrapeWikiPagesToNewClassFrom: aInteger To: zInteger  pausingBetweenBy: delayInteger
|methodTemplate methodSource wikipage newclassname|

      methodTemplate := 'page ^', $', '{1}' ,$'.

      aInteger to:  zInteger do: [:pageNo |
      newclassname := ('DocletSwiki', pageNo asString) asSymbol.
      wikipage:= (((( 'http://wiki.squeak.org/squeak/', pageNo printString) asUrl retrieveContents contents withSeparatorsCompacted)
                              copyReplaceAll:(160 asCharacter asString) with:(Character space asString))
                                    copyReplaceAll:($' asString) with:(($" asString))).

        methodSource := methodTemplate format:{wikipage}.
        methodSource inspect.

         DocletSwiki subclass: newclassname
            instanceVariableNames: ''
            classVariableNames: ''
            poolDictionaries: ''
            category: 'SeasideDoc-Doclet'.

          (Smalltalk at:newclassname) compile: methodSource.

(Delay forSeconds: delayInteger) wait.]

It worked!

---- On Fri, 23 Nov 2018 07:56:34 -0500 Joachim Tuchel <[hidden email]> wrote ----

Hi Timothy,


I'd start looking for quotes in the html string. Seems parts of the String are not interpreted as String contents.


Is that possible?


Joachim




 


_______________________________________________
seaside mailing list



 


gettimothy <[hidden email]> hat am 23. November 2018 um 13:51 geschrieben:


Good morning,

At http://www.menmachinesmaterials.com/SeasideDoc I am trying to scrape  http://wiki.squeak.org/squeak/  and store the html data in a method of a subclass of DocletSwiki.

I am able to create new subclasses with methods just fine until I try to store the html content in a method.

My latest attempt to just get something to work looks like this:


|ht createdMethodName |

createdMethodName := #htmlcontent.
ht := HelpTopic
title:'Dude'
contents:(HTTPLoader default retrieveContentsFor: (' http://wiki.squeak.org/squeak/1' asUrl)).



DocletSwiki compile: createdMethodName, (ht contents content asTextFromHtml).



that ht contents content asTextFromHtml is the latest contortion after many hours of hacking.

It throws the SyntaxError (?) shown in the subject header above.


A simple 
DocletSwiki compile: #htmlcontent, '^ 1'
works fine.

DocletSwiki is a simple subclass of WAComponent.

Thanks in advance.

t







_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside