add as-rss blog summarizer

This commit is contained in:
Anton Dyudin 2015-11-23 16:17:23 -08:00
parent 8b45e30836
commit afd24fac00
2 changed files with 34 additions and 2 deletions

32
as-rss/xml.hook Normal file
View File

@ -0,0 +1,32 @@
:: Simple rss transformer
::
:::: /hook/xml/as-rss
::
/= sum /: /=== /% 2 /snip/
/^ kid=(map span ,[marl marl])
/: /=== /% 2 /_ /snip/
/$ |=([bem=beam but=path] [our=p.bem dez=q.bem tub=(flop (slag 2 but))])
::
:::: ~fyr
::
:: Link from relative path
=+ hok=`hart`[& ~ `/org/urbit/(rsh 3 1 (scot %p our))]
=+ ref=|=(a=path (earn hok `[dez %tree (weld tub a)] ~))
:: urb:front attrs confuse RSS validators, readers
=+ no-meta=|=(a=marl `_a`?~(a ~ ?.(?=(%meta n.g.i.a) a $(a t.a))))
::
%- crip %- poxo
;rss(version "2.0")
;channel
;title: *{hed.sum}
;link: {(ref /)}
;description: *{(no-meta tal.sum)}
;* %+ turn (~(tap by kid))
|= [nom=@t hed=marl tal=marl]
;item
;title: *{hed}
;description: *{(no-meta tal)}
;link: {(ref /[nom])}
==
==
==

View File

@ -1,7 +1,7 @@
::
/? 314
/- tree-include
/= gas /$ fuel
/$ |=([bem=beam but=spur] [dez=(trip q.bem) tub=(flop (slag 2 but))])
/= dat /^ tree-include
/: /===/tree-gen /%
/tree-include/
@ -13,7 +13,6 @@
!:
::::
::
=+ dez=(trip &2:%)
=+ kids-json=a/(turn (~(tap by kid)) |=([a=span *] (joba %name s/a)))
;html
;head
@ -23,6 +22,7 @@
;link(type "text/css", rel "stylesheet", href "/{dez}/pub/tree/src/css/main.css");
;link(type "text/css", rel "stylesheet", href "/{dez}/lib/syntax/codemirror.css");
::;link(type "text/css", rel "stylesheet", href "http://localhost:8000/docs/pub/tree/src/css/main.css");
;link(type "application/rss+xml", rel "alternate", href "/{dez}/as-rss{(spud tub)}.xml");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js");
;script(type "text/javascript", src "//cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js");