[Config]
Name = hReview
Summary = Extracts reviews.

[Description]
This metadata module extracts reviews that have been embedded in feeds using
<a href="http://microformats.org/wiki/hreview" target="_blank">hReview</a>.

; NOTE: hReview elements are tagged with attributes that may contain multiple words. 
; Locating these is fiddly since we can't do the obvious contains(@attr,"findme")
; since this will also match things like "x-findme".
; We hack around this by putting a space before and after the attribute
; and then trying to match " findme " i.e.
;   @contains( concat(concat(" ",@attr)," ") , " findme " )

; NOTE: The lack of well-defined structure in hReview makes parsing tricky.
; We need some way of being able to match nodes that are child nodes (to an
; arbitrary depth) of the current XPathRoot node. Using a //* type of query 
; is risky since it won't work properly if there is more than one hReview
; in a given feed item but (for hReview), is probably OK.

[Item Metadata]
_XPathRoot = //*[contains(concat(concat(" ",@class)," ")," hreview ")]
_MetadataGroupRoot = review
subject/name = //*[contains(concat(concat(" ",@class)," ")," item ")]
subject/url = //a[contains(concat(concat(" ",@class)," ")," item ")]/@href
image/url = //img[contains(concat(concat(" ",@class)," ")," photo ")]/@src
summary = //*[contains(concat(concat(" ",@class)," ")," summary ")]
description = {xml} //*[contains(concat(concat(" ",@class)," ")," description ")]
rating = //*[contains(concat(concat(" ",@class)," ")," rating ")]/@title
reviewer/name = //*[contains(concat(concat(" ",@class)," ")," reviewer ")]
time = //*[contains(concat(concat(" ",@class)," ")," dtreviewed ")]/@title

[Item Pane Columns]
_AvailabilityMsg=Available for channels that embed hReview information into their feed items.
Subject=review/subject/name
Rating=review/rating
Reviewer=review/reviewer/name
Time=review/time

[Item Description Template Block]
{%REPEAT% review}
    <div class="review">
    <strong>
        Review
        {%?ITEM-METADATA% review/subject/name} of
            {%?ITEM-METADATA% review/subject/url} <a href="{%@% encode=attr}"> {%ENDIF%}
            {%ITEM-METADATA% review/subject/name}
            {%?ITEM-METADATA% review/subject/url} </a> {%ENDIF%}
        {%ENDIF%}
    </strong>
    {%?ITEM-METADATA% review/reviewer} by {%@%} {%ENDIF%}
    <div style="margin-left:1em; font-size:80%;">
        {%?ITEM-METADATA% review/summary} {%@%} {%ENDIF%}
        {%?ITEM-METADATA% review/description} <br/><em>{%@%}</em> {%ENDIF%}
    </div>
    </div>
{%/REPEAT}

