Coder Social home page Coder Social logo

alexprut / plg_system_structureddata Goto Github PK

View Code? Open in Web Editor NEW
3.0 6.0 0.0 124 KB

Joomla System Plugin for parsing the HTML markup and convert the data-* HTML5 attributes in Microdata or RDFa Lite 1.1 semantics.

License: GNU General Public License v2.0

PHP 99.92% HTML 0.08%
joomla php structureddata microdata html

plg_system_structureddata's People

Contributors

alexprut avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

plg_system_structureddata's Issues

Parser: match starting tags to ending tags in order to retrieve the content

In order to add fallbacks support we need to be able to match starting tags to ending tags in order to retrieve the content.

Example

<div data-sd="property">
    Content
    <div data-sd="property">
        Content
    </div>
    <meta data-sd="property" content="Content" />
</div>
First match
    Content
    <div data-sd="property">
        Content
    </div>
    <meta data-sd="property" content="Content" />
Second match
        Content
Third match
                                      Content

The problem

  • Match self-contained tags
  • Match starting tags to ending tags
  • Match nested starting tags to ending tags
  • Ordered matches, up โ†’ down matches flow

The solutions

Is there any Joomla parser library to solve that problem?

Multiple properties should be parsed, rather than use only the first valid

The problem

If you wish to declare multiple properties for an item, you should be able to do so using itemprop="property1 property2 property3".

With the current setup, only property1 would be parsed and the rest discarded. It might also be the case that I have a specific property which is in something other than position 1, and if the item in position 1 is valid they will never be parsed.

Source: http://www.w3.org/TR/2009/WD-html5-20090825/microdata.html

Example:

An element introducing a property can also introduce multiple properties at once, to avoid duplication when some of the properties have the same value.

Here we see an item with two properties, "favorite-color" and "favorite-fruit", both set to the value "orange":

<div item>
<span itemprop="favorite-color favorite-fruit">orange</span>
</div>

Example use 'in the wild'

http://www.seatrade-global.com/news/americas/would-selling-apl-logistics-be-good-for-nol.html

<span itemprop="CopyrightHolder publisher provider">Seatrade Communications Limited</span>

http://www.google.com/webmasters/tools/richsnippets?q=http%3A%2F%2Fwww.seatrade-global.com%2Fnews%2Famericas%2Fwould-selling-apl-logistics-be-good-for-nol.html

This validates as:

copyrightholder: Seatrade Communications Limited
publisher: Seatrade Communications Limited
provider: Seatrade Communications Limited

Possible workarounds

Perhaps consider some kind of logic which states if the first item is valid, use it, then check other items and add them if they are valid, exclude if they are not. If the first item is not valid it should naturally move to the next one.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.