I hope that 3 isn't true.
What are folks up to?
I'm busy developing a bunch of new features for WineLog: avatars
(finally), labels (finally), group stuff, more mobile features.
Jason Coleman
Co-founder, WineLog.net
I guess the 24 hour days are just to short to do all the things one
would like to do.
Been busy with the next version of The Wine Cellar Book and testing the
vinoXML query stuff with Global Wine Stocks, which just did not leave
much for anything else lately.
--
Best regards*
Werner
*
The Wine Cellar Book
www.thewinecellarbook.com\en <http://www.thewinecellarbook.com/en>
Some vacation and a lot of work for me. Summer is just so busy.
Anyway, related to this group (and in response to Tim's plugin challenge
[1]), I created a tasting note tool on Scrugy that is targeted at wine
bloggers. It guides the user through building a tasting note with some
AJAX goo along the way and it takes care of annotating the finished
product using the hReview microformat. At the end, if you like, it will
also post the tasting note to your blog (assuming your blog supports the
required blogging API).
Haven't received much feedback yet but if anyone else would like to take
a look and let me know what you think, I'd appreciate the input. It's
definitely beta quality with limited testing (tested with Wordpress only
so far but Blogger, TypePad, and other mainstream blogging platforms
should work too).
Here's the URL for the tool.
http://scrugy.com/tasting-note-post
-James
[1] http://winecast.net/2007/06/13/please-build-a-notes-plug-in/
James Jory wrote:
> ...
> Here's the URL for the tool.
>
> http://scrugy.com/tasting-note-post
>
This looks very nice, makes it very easy to enter a tasting note. I
especially like the "entry help" for things like varietal etc (took me a
moment to figure out that "esc" is to be used if I wanted to keep what I
had entered).
Looked around to see if there are tools for Microformats and Python (dev
tool I use), but haven't found anything yet, if I do I will add it to
the tools section on the wiki. Found some xhtml parser which I will try
out to see if they would be useful and I will also try a generic python
parser tool I have used before.
I then copied the generated source into a file so I could try things out
on it, like parsing it. Noted that some end tags are missing "/img" on
all the images and a "/span" in the reviewerwrap.
Will (or are) the class names such as "hreview tn", vintage, producer,
varietal, winetype, alcohol, enclosure, currency etc etc part of the
WineFormats standard and are you or anyone else planning to document them?
See you
Werner
> -James
>
> [1] http://winecast.net/2007/06/13/please-build-a-notes-plug-in/
>
> >
>
>
>
After much wrangling, I did finally get iTunes to register my new
winemaking podcast, Crushnet TV. So I'll get a bunch more material
posted as soon as I can get the XML whacked out.
http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=260134729
thanks for firing this back up.
ab
Yes, I agree the key sequence for keeping what you entered is a bit awkward.
I think it has to do with the auto-complete drop down pre-selecting an item
when it loads. This is what forces you to have to hit escape to un-select
it. I'll see if that can be changed.
>
> Looked around to see if there are tools for Microformats and
> Python (dev tool I use), but haven't found anything yet, if I
> do I will add it to the tools section on the wiki. Found
> some xhtml parser which I will try out to see if they would
> be useful and I will also try a generic python parser tool I
> have used before.
I do not have any experience with Python but did find someone on the
microformats mailing list that had written a parser in Python [1].
>
> I then copied the generated source into a file so I could try
> things out on it, like parsing it. Noted that some end tags
> are missing "/img" on all the images and a "/span" in the
> reviewerwrap.
Good catches! The fixes for those will be in my next code update.
>
> Will (or are) the class names such as "hreview tn", vintage,
> producer, varietal, winetype, alcohol, enclosure, currency
> etc etc part of the WineFormats standard and are you or
> anyone else planning to document them?
Many of the class names that the tool uses are part of the hReview
microformat schema [2]. Also, the "currency" section is based on the
currency draft specification [3]. The wine specific class names (tn,
vintage, producer, designation, vineyard, classification, region, country,
varietal, winetype, alcohol, and enclosure) are part of the Wineformat
"extensions" to hReview which I have described in a blog post [4] but not
yet documented on the Wineformats wiki [5].
>
> See you
> Werner
Thanks for the feedback, Werner. Much appreciated.
-James
[1]
http://microformats.org/discuss/mail/microformats-dev/2005-November/000037.h
tml
[2] http://microformats.org/wiki/hreview#Schema
[3] http://microformats.org/wiki/currency
[4]
http://blog.scrugy.com/2006/11/13/introducing-high-definition-tasting-notes/
[5] http://wineformats.org
James Jory wrote:
> http://microformats.org/discuss/mail/microformats-dev/2005-November/000037.html
>
This one is a very good start, also it is "only" parsing at this point.
I added two lines of code:
hreviewtnprops = MicroformatSchema(['rating','value', 'best', 'vintage',
'producer', 'designation', 'varietal', 'region',
'country','winetype','alcohol','enclosure','money','currency', 'amount',
'unit',], [])
hreviewvcardprops = vcardprops
And changed one line:
SCHEMAS= {'vcard':vcardprops,'vevent':veventprops,
'hreviewtn':hreviewtnprops, 'hreview vcard':hreviewvcardprops}
And processing my little test file gives me:
hreviewtn
value : 3.0
best : 5
vintage : 2000
producer : Domain de Vieux Bourg
designation : Sainte Anne
varietal : Cabernet Sauvignon
varietal : Merlot
varietal : Cabernet Franc
region : Côtes de Duras
country : France
winetype : Red
alcohol : 13.5
enclosure : Cork
currency : EUR
amount : 6.50
unit : 750mL
description : Some nice description here
fn : Werner
Note that I had to change the 'hreview tn' to 'hreviewtn', i.e. remove
the space otherwise the parser does not work, also it is strange that it
had no problem on the 'hreview vcard', need to look into this some more
when I have a bit more time. There is also some encoding/decoding issue
with e.g. region I have to look into.
Werner
Did some research and with the help of a developer of the XML toolkit I
used I managed to parse a test hreview tn using xpath, however it
requires that the hreview tn document has document headers to declare
that it is an xhtml/xml doc (see attached sample).
I.e. the doc should start with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
The following Python code using the amara XML toolkit allows to access
whatever element in the review and process it according to whatever
requirements one might have.
<begin of code>
xhtml_NSS = {u'h': u'http://www.w3.org/1999/xhtml',}
from amara import binderytools
file = r'C:\Dev\BoaTest04\wineFormats\scrugyTastingTest2.xhtml'
doc = binderytools.bind_file(file, prefixes=xhtml_NSS)
vintageXpath = u".//h:div[contains(@class, 'hreview
tn')]//h:div[contains(@class, 'item wine')]//h:span[contains(@class,
'vintage')]"
producerXpath = u".//h:div[contains(@class, 'hreview
tn')]//h:div[contains(@class, 'item wine')]//h:span[contains(@class,
'producer')]"
regionXpath = u".//h:div[contains(@class, 'hreview
tn')]//h:div[contains(@class, 'item wine')]//h:span[contains(@class,
'region')]"
vintage = doc.html.xml_xpath(vintageXpath)
producer = doc.html.xml_xpath(producerXpath)
region = doc.html.xml_xpath(regionXpath)
print unicode(vintage[0])
print unicode(producer[0])
print unicode(region[0])
<end of code>
Producing the following output:
2000
Domain de Vieux Bourg
Côtes de Duras
Please note that the attached file is still not strictly complying with
xhtml standard, the Altova XMLSpy validator complains about the first
"div" in it.
The microformatsparser from Phil Dawes is not as "picky" as the parsers
in amara or XMLSpy are but it will need additional work to be able to
use the parsed result and write it e.g. to a database.
Werner
Good idea on the post. We're plugging away. For us, we're adding
retailers and wineries and continuing to flesh out the database. Rest
of our time is spent on the social networking aspects.
What's 'labels' comprise?
Best
Philip
Snooth.com
Yes, that's right. If you're going to use an XML parser to parse the tasting
note, the markup in the document must be valid. Unfortunately since the
tasting note tool is merely posting the tasting note into a blogging
platform, it is at the mercy of the conformance level of the blogging
software.
In general, though, I have found success using more lenient parsers, such as
Tidy, to parse real-world HTML pages that contain microformats.
> Please note that the attached file is still not strictly complying
> with xhtml standard, the Altova XMLSpy validator complains about the
> first "div" in it.
This div was necessary, unfortunately, due to the way that the blogging
platforms deal with newlines embedded in the posts submitted using the
blogging API. Without the div wrapping the CSS import, the blogging platform
would assume it's unformatted text and throw a <br/> on the end. This, of
course, confuses the browser and breaks the proper display of the tasting
note. A hack, I know.
Thanks for working through this, Werner.
-James
Can you put in an encoding declaration? When I use tidy it thinks the
document uses "<?xml version="1.0" encoding="us-ascii"?>" which is a bit
of a problem as all accents etc will not come over. See the attached
file. To get it to validate I had to add "alt" to the images, but
besides this and the encoding Tidy did a nice job to make it comply with
the XHTML standard.
I attache a changed Python script which uses a Python wrapper to Tidy to
create an XHTML doc and then parse it with the same XML parser as
before. Only problem is with the region it shows up as "Ctes de Duras"
instead of "Côtes de Duras" due to the bad encoding Tidy is guessing.
See you
Werner