List Info

Thread: Optimus 0.5.1




Optimus 0.5.1
user name
2008-04-09 22:56:08
Hi,

I did some massive update to Optimus* (microformats
transformer):

• support of nested microformats
• support of multiple includes
• support of nested includes
• support of anchor (you can use URL like http://example.com#my-vca
rd
to narrow the target)
• support of couldbe attribute (internal feature, now
item in
hreview, for example, could be vcard or vevent)
• hfeed now is optional
• fix for text spacing
• fix for empty tags in output
• hListing support
• hAudio support
• general performance improvement
• add RSS as an output format
• rewrite validator from scratch
• better UTF-8 support

Enjoy.
As always feedback is highly appreciated.
_________
* http://www.mi
croformatique.com/optimus/

-- 
Best regards,
Dmitry Baranovskiy
http://dmitry.baranovsk
iy.com

_______________________________________________
microformats-discuss mailing list
microformats-discussmicroformats.org
http://microformats.org/mailman/listinfo/microforma
ts-discuss

Re: Optimus 0.5.1
country flaguser name
Australia
2008-04-10 01:07:37
> • support of nested includes

nested includes? !

my guess is that anyone doing that would be asking for
trouble!




_______________________________________________
microformats-discuss mailing list
microformats-discussmicroformats.org
http://microformats.org/mailman/listinfo/microforma
ts-discuss

Re: Optimus 0.5.1
country flaguser name
Australia
2008-04-10 01:39:42
Example:
Header: company name + company logo,
footer: company address
content: apart from some text, company news.

So, header is hCard, footer is included, company news is
hAtom where  
author is a company. So we include header as an author.
Ta-da! Nested  
inclusion. And after all, nothing should stop people from
using  
include pattern heavily.


On 10/04/2008, at 4:07 PM, Michael MD wrote:
>> • support of nested includes
>
> nested includes? !
>
> my guess is that anyone doing that would be asking for
trouble!


_______________________________________________
microformats-discuss mailing list
microformats-discussmicroformats.org
http://microformats.org/mailman/listinfo/microforma
ts-discuss

Re: Optimus 0.5.1
country flaguser name
United States
2008-04-10 03:53:26
Michael MD wrote:

> nested includes? !
> my guess is that anyone doing that would be asking for
trouble!

This is another thing that Cognition has supported since
alpha1. (Though 
until the latest release it supported including a node's own
parent, which 
really *is* asking for trouble!)

The only thing you've got to be careful of (from a parser's
POV) is making 
sure that you don't get stuck in an infinite loop. The
solution is to 
write your inclusion code to *not* support nested includes,
and then 
simply call the function a few times. (The first call will
handle 
includes, then the second call will handle includes within
includes, etc.)

My policy is to allow two levels of includes for adr and
geo, 4 levels for 
hCalendar valarm and hCalendar vfreebusy, and 6 for hCard,
hAtom entries, 
hCalendar vevent and hCalendar todo.

I also use an optimisation such that each call of the
function actually 
checks to see if any changes have been made. If no changes
have been made, 
then the loop is ended prematurely -- this prevents the
inclusion code 
(which is computationally expensive) from being called when
there are no 
instances of class="include" left, or those
instances are invalid (e.g. 
attempts to include an ancestor node).

-- 
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 14 days,
19:59.]

                   Tagliatelle with Fennel and Asparagus
   http://tobyinkster.co.uk/blog/2008/04/06/t
agliatelle-fennel-asparagus/

_______________________________________________
microformats-discuss mailing list
microformats-discussmicroformats.org
http://microformats.org/mailman/listinfo/microforma
ts-discuss

Re: Optimus 0.5.1
user name
2008-04-10 04:48:13
On Thu, Apr 10, 2008 at 4:56 AM, Dmitry Baranovskiy
<dmitrybaranovskiy.com> wrote:
>  I did some massive update to Optimus* (microformats
transformer):

Dmitry, all looks great!

The only problem I can see is that it doesn't handle invalid
HTML that
well (an example would be http://ciaranmc
nulty.livejournal.com/).

-Ciaran McNulty
_______________________________________________
microformats-discuss mailing list
microformats-discussmicroformats.org
http://microformats.org/mailman/listinfo/microforma
ts-discuss

Re: Optimus 0.5.1
country flaguser name
United States
2008-04-10 04:08:19
Dmitry Baranovskiy wrote:

> As always feedback is highly appreciated.

Just a few thoughts...

* Parsing <http://ex
amples.tobyinkster.co.uk/hcard> issues a few
warnings
  related to use of XHTML with namespaces. You might want to
think about
  turning down PHP's error reporting. e.g.

      error_reporting(E_ERROR);

* Parsing same page with output as JSON I see (line break
added):

      tel: [{, "type":
"work""value": "+1 (310) 597 3781
work"},
      {, "type":
"work""value": "+1 (310) 597 3781
work"}]}

  this is clearly garbled.

* There are other JSON output errors: e.g. not all strings
are quoted.

I might have some more feedback when I've gone through your
source code.

-- 
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 14 days,
20:17.]

                   Tagliatelle with Fennel and Asparagus
   http://tobyinkster.co.uk/blog/2008/04/06/t
agliatelle-fennel-asparagus/

_______________________________________________
microformats-discuss mailing list
microformats-discussmicroformats.org
http://microformats.org/mailman/listinfo/microforma
ts-discuss

Re: Optimus 0.5.1
user name
2008-04-10 05:21:29
On Thu, Apr 10, 2008 at 10:48 AM, Ciaran McNulty
<mailciaranmcnulty.com> wrote:
>  The only problem I can see is that it doesn't handle
invalid HTML that
>  well (an example would be http://ciaranmc
nulty.livejournal.com/).

In fact it does just look like you need to turn down error
reporting
to do that (or precede your loadHtml() call with an ).

You do also need to check the return value of your fopen() -
if I
enter a URL that 404s, your code appears to keep trying to
read from
that resource, meaning I get returned a few hundred Mb of
'error in
fread - file resource is not valid' type messages.

Send me an email off-list of you want me to take a look at
those bits for you.

-Ciaran McNulty
_______________________________________________
microformats-discuss mailing list
microformats-discussmicroformats.org
http://microformats.org/mailman/listinfo/microforma
ts-discuss

Re: Re: Optimus 0.5.1
country flaguser name
Australia
2008-04-10 18:44:14
Thanks guys for feedback. I fixed HTML parsing warnings.
Have to look  
into JSON. Looks like I broke it while was adding fixes.
Also will add  
to my list fix for infinite inclusion. Good point, Toby.

On 10/04/2008, at 7:08 PM, Toby A Inkster wrote:
> Dmitry Baranovskiy wrote:
>
>> As always feedback is highly appreciated.
>
> Just a few thoughts...
>
> * Parsing <http://ex
amples.tobyinkster.co.uk/hcard> issues a few  
> warnings
>  related to use of XHTML with namespaces. You might
want to think  
> about
>  turning down PHP's error reporting. e.g.
>
>      error_reporting(E_ERROR);
>
> * Parsing same page with output as JSON I see (line
break added):
>
>      tel: [{, "type":
"work""value": "+1 (310) 597 3781
work"},
>      {, "type":
"work""value": "+1 (310) 597 3781
work"}]}
>
>  this is clearly garbled.
>
> * There are other JSON output errors: e.g. not all
strings are quoted.
>
> I might have some more feedback when I've gone through
your source  
> code.
>
> -- 
> Toby A Inkster BSc (Hons) ARCS
> [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
> [OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 14 days,
20:17.]
>
>                   Tagliatelle with Fennel and
Asparagus
>   http://tobyinkster.co.uk/blog/2008/04/06/t
agliatelle-fennel-asparagus/
>
> _______________________________________________
> microformats-discuss mailing list
> microformats-discussmicroformats.org
> http://microformats.org/mailman/listinfo/microforma
ts-discuss

_______________________________________________
microformats-discuss mailing list
microformats-discussmicroformats.org
http://microformats.org/mailman/listinfo/microforma
ts-discuss

[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )