Scribo RSS

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

Scribo RSS

Вася Чайко
Hi Nico.

I have made some changes in rss for improvement of internalization and
for passing validation.

'From Squeak3.10.2 of ''5 June 2008'' [latest update: #7179] on 21 September 2008 at 11:48:34 am'! !AIDASite class methodsFor: 'codepage converting' stamp: 'VasyaChajko 9/21/2008 11:41'! convertIRItoURL: aString | stream aByteString | stream _ WriteStream on: ''. aByteString _ self convert: aString toCodepage: #utf8. aByteString do: [ :char | ('abcdefghijklmnopqrstuvwxyz0123456789./-+:~?#@=' includes: char asLowercase) ifTrue: [ stream nextPut: char. ] ifFalse: [ stream nextPut: $%; nextPutAll: (char codePoint radix: 16). ]. ]. ^ stream contents.! ! !WebRSSResource methodsFor: 'printing' stamp: 'VasyaChajko 9/21/2008 11:01'! printFeedEntry: aFeedEntry on: aStream forSession: aSession | author linkGuid | aStream nextPutAll: '<item>'; cr. aStream nextPutAll: '<title>'; nextPutAll: (AIDASite convertToWeb: aFeedEntry title on: aSession); nextPutAll: '</title>'; cr. linkGuid _ AIDASite convertIRItoURL: aFeedEntry directUrl. aStream nextPutAll: '<link>'; nextPutAll: linkGuid; nextPutAll: '</link>'; cr; nextPutAll: '<guid>'; nextPutAll: linkGuid; nextPutAll: '</guid>'; cr. "description" aStream nextPutAll: '<description>'. aStream nextPutAll: '<!![CDATA[', (AIDASite convertToWeb: aFeedEntry message on: aSession), ']]>'. aStream nextPutAll: '</description>'; cr. "pubDate" aStream nextPutAll: '<pubDate>'. aStream nextPutAll: aFeedEntry timeStamp printHttpFormat. aStream nextPutAll: '</pubDate>'; cr. "author" " author := aFeedEntry author. author notNil ifTrue: [ aStream nextPutAll: '<author>'; nextPutAll: (AIDASite convertToWeb: author on: aSession); nextPutAll: '</author>'; cr ]." "category" aFeedEntry tags notEmpty ifTrue: [ aStream nextPutAll: '<category>'. aFeedEntry tags do: [ :each | aStream nextPutAll: ', '. aStream nextPutAll: (AIDASite convertToWeb: each on: aSession) ]. aStream nextPutAll: '</category>'; cr.]. aStream nextPutAll: '</item>'; cr.! ! !WebRSSResource methodsFor: 'printing' stamp: 'VasyaChajko 9/21/2008 11:42'! printHTMLPageOn: aStream for: aRequest on: aSession | iri request iriStream port | aStream nextPutAll: '<?xml version="1.0" encoding="utf-8"?>' ; cr. aStream nextPutAll: '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">' ; cr. request _ aSession lastRequest. iriStream _ WriteStream on: ''. iriStream nextPutAll: 'http://';                 nextPutAll: request host. port _ request port. port ~= 80 ifTrue: [ iriStream nextPut: $:; nextPutAll: port asString. ]. iriStream nextPutAll: request requestLine requestURI asString. aStream nextPutAll: '<channel>'; cr ; nextPutAll: '<atom:link href="'; nextPutAll: (AIDASite convertIRItoURL: iriStream contents); nextPutAll: '" rel="self" type="application/rss+xml" />'; cr; nextPutAll: '  <title>' , (AIDASite convertToWeb: self title on: aSession) , '</title>' ; cr. aStream nextPutAll: '<description>' ; nextPutAll: (AIDASite convertToWeb: self description on: aSession) ; nextPutAll: '</description>' ; cr. aStream nextPutAll: '<link>' ; nextPutAll: (AIDASite convertIRItoURL: self url); nextPutAll: '</link>' ; cr. aStream nextPutAll: '<generator>' ; nextPutAll: (AIDASite convertToWeb: self generator on: aSession) ; nextPutAll: '</generator>' ; cr. " aStream nextPutAll: '<webMaster>' ; nextPutAll: (AIDASite convertToWeb: self webMaster email on: aSession) ; nextPutAll: '</webMaster>' ; cr." aStream nextPutAll: '<docs>' ; nextPutAll: 'http://www.rssboard.org/rss-specification' ; nextPutAll: '</docs>' ; cr. self printListingOn: aStream forSession: aSession. aStream nextPutAll: '</channel>' ; cr. aStream nextPutAll: '</rss>' ; cr.! !
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

rssValidation.png (43K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Scribo RSS

Nicolas Petton
Le dimanche 21 septembre 2008 à 12:00 +0700,
=?KOI8-R?Q?=F7=C1=D3=D1_=FE=C1=CA=CB=CF_ a écrit :
> Hi Nico.
>
> I have made some changes in rss for improvement of internalization and
> for passing validation.

Hi,

Thank you I will commit it and close a ticket ;)

Cheers!

Nico

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

signature.asc (196 bytes) Download Attachment