[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

Android workbook


| stream trStart trEnd rows row next srow nextCell |
stream := 'https://developer.android.com/reference/android/app/Activity.html' fileContents stream.
stream := (stream upTo:'Public methods';upTo:'</table>') stream.
trStart := '<tr class='.
trEnd  := '</tr>'.
rows   := #().
next    := [:tag :s| | txt | s upTo:#< ,tag; upTo:#>. txt := s upTo:'</',tag,#>. txt trimBlanks ].
nextCell := [:s| next value:#code value:(next value:#td value:s) stream ].
[stream atEnd] whileFalse: [
    srow := (stream upTo: trStart; upTo:#>; upTo: trEnd) stream.
    row := Array with:(nextCell value:srow) with:((nextCell value:srow) upTo:'<p>')trimBlanks.
    rows add: row
].
rows last isEmpty ifTrue: [ rows removeLast ].
(rows collect:[:each|  each second stream upTo:$#;upTo:$" ]) do:[:each| self print: each ]