Skip to content

Commit

Permalink
chm script displays date
Browse files Browse the repository at this point in the history
  • Loading branch information
joshrieken committed Nov 16, 2011
1 parent 8e855b7 commit 410ba01
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/scripts/chm.coffee
Expand Up @@ -12,11 +12,14 @@ module.exports = (robot) ->
handler = new HtmlParser.DefaultHandler()
parser = new HtmlParser.Parser handler
parser.parseComplete body
result = Select handler.dom, ".tdihevent p"
return unless result
title = trim result[0].children[0].raw
blurb = trim result[1].children[0].raw
dateEl = Select handler.dom, ".title"
contentEl = Select handler.dom, ".tdihevent p"
return unless dateEl and contentEl
title = trim contentEl[0].children[0].raw
blurb = trim contentEl[1].children[0].raw
sentences = blurb.split('.')
date = trim dateEl[0].children[0].raw
msg.send date
msg.send title
for sentence in sentences
msg.send sentence + '.' if sentence and sentence isnt ""
Expand Down

0 comments on commit 410ba01

Please sign in to comment.