all repos — blogroll2email @ 43f010d46db1c01fa12c02cab29d49b2ec9bf8ae

adding composer
Peter Molnar hello@petermolnar.eu
Thu, 10 Dec 2015 14:14:34 +0000
commit

43f010d46db1c01fa12c02cab29d49b2ec9bf8ae

parent

9bfc5249e322f68336ba2a4d088559ee5ec5db03

419 files changed, 10377 insertions(+), 2 deletions(-)

jump to
M blogroll2email.phpblogroll2email.php

@@ -345,8 +345,10 @@

if ( empty ($owner) || !is_object ($owner)) return false; - if ( !class_exists('Mf2') ) - require_once ( dirname(__FILE__) . '/lib/php-mf2/Mf2/Parser.php' ); + if ( !class_exists('Mf2') ) { + require __DIR__ . '/vendor/autoload.php'; + //use Mf2; + } $last_updated = strtotime( $bookmark->link_updated );
A composer.json

@@ -0,0 +1,16 @@

+{ + "name": "petermolnar/blogroll2email", + "description": "blogroll2email WordPress plugin", + "require": { + "php": ">=5.3.0", + "mf2/mf2": "0.2.*" + }, + "license": "GPLv3", + "authors": [ + { + "name": "Peter Molnar", + "email": "hello@petermolnar.eu", + "homepage": "https://petermolnar.eu" + } + ] +}
A vendor/autoload.php

@@ -0,0 +1,7 @@

+<?php + +// autoload.php @generated by Composer + +require_once __DIR__ . '/composer' . '/autoload_real.php'; + +return ComposerAutoloaderInit948650bb27ddef968d09c0cba5384a3c::getLoader();
A vendor/bin/fetch-mf2

@@ -0,0 +1,1 @@

+../mf2/mf2/bin/fetch-mf2
A vendor/bin/parse-mf2

@@ -0,0 +1,1 @@

+../mf2/mf2/bin/parse-mf2
A vendor/composer/ClassLoader.php

@@ -0,0 +1,413 @@

+<?php + +/* + * This file is part of Composer. + * + * (c) Nils Adermann <naderman@naderman.de> + * Jordi Boggiano <j.boggiano@seld.be> + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier <fabien@symfony.com> + * @author Jordi Boggiano <j.boggiano@seld.be> + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + + private $classMapAuthoritative = false; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-0 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative) { + return false; + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if ($file === null && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if ($file === null) { + // Remember that this class does not exist. + return $this->classMap[$class] = false; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { + if (0 === strpos($class, $prefix)) { + foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +}
A vendor/composer/LICENSE

@@ -0,0 +1,21 @@

+ +Copyright (c) 2015 Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +
A vendor/composer/autoload_classmap.php

@@ -0,0 +1,9 @@

+<?php + +// autoload_classmap.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( +);
A vendor/composer/autoload_files.php

@@ -0,0 +1,10 @@

+<?php + +// autoload_files.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( + '757772e28a0943a9afe83def8db95bdf' => $vendorDir . '/mf2/mf2/Mf2/Parser.php', +);
A vendor/composer/autoload_namespaces.php

@@ -0,0 +1,9 @@

+<?php + +// autoload_namespaces.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( +);
A vendor/composer/autoload_psr4.php

@@ -0,0 +1,9 @@

+<?php + +// autoload_psr4.php @generated by Composer + +$vendorDir = dirname(dirname(__FILE__)); +$baseDir = dirname($vendorDir); + +return array( +);
A vendor/composer/autoload_real.php

@@ -0,0 +1,59 @@

+<?php + +// autoload_real.php @generated by Composer + +class ComposerAutoloaderInit948650bb27ddef968d09c0cba5384a3c +{ + private static $loader; + + public static function loadClassLoader($class) + { + if ('Composer\Autoload\ClassLoader' === $class) { + require __DIR__ . '/ClassLoader.php'; + } + } + + public static function getLoader() + { + if (null !== self::$loader) { + return self::$loader; + } + + spl_autoload_register(array('ComposerAutoloaderInit948650bb27ddef968d09c0cba5384a3c', 'loadClassLoader'), true, true); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + spl_autoload_unregister(array('ComposerAutoloaderInit948650bb27ddef968d09c0cba5384a3c', 'loadClassLoader')); + + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + + $loader->register(true); + + $includeFiles = require __DIR__ . '/autoload_files.php'; + foreach ($includeFiles as $fileIdentifier => $file) { + composerRequire948650bb27ddef968d09c0cba5384a3c($fileIdentifier, $file); + } + + return $loader; + } +} + +function composerRequire948650bb27ddef968d09c0cba5384a3c($fileIdentifier, $file) +{ + if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { + require $file; + + $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; + } +}
A vendor/composer/installed.json

@@ -0,0 +1,57 @@

+[ + { + "name": "mf2/mf2", + "version": "v0.2.12", + "version_normalized": "0.2.12.0", + "source": { + "type": "git", + "url": "https://github.com/indieweb/php-mf2.git", + "reference": "6701504876d6c9242eb310b35f41d40d9785ab4e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/indieweb/php-mf2/zipball/6701504876d6c9242eb310b35f41d40d9785ab4e", + "reference": "6701504876d6c9242eb310b35f41d40d9785ab4e", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "suggest": { + "barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you" + }, + "time": "2015-07-12 14:10:01", + "bin": [ + "bin/fetch-mf2", + "bin/parse-mf2" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "files": [ + "Mf2/Parser.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Barnaby Walters", + "homepage": "http://waterpigs.co.uk" + } + ], + "description": "A pure, generic microformats2 parser — makes HTML as easy to consume as a JSON API", + "keywords": [ + "html", + "microformats", + "microformats 2", + "parser", + "semantic" + ] + } +]
A vendor/mf2/mf2/.gitignore

@@ -0,0 +1,7 @@

+.DS_Store +/nbproject +composer.phar +/vendor/ +/tmp +.idea/ +/bin/test
A vendor/mf2/mf2/Mf2/Parser.php

@@ -0,0 +1,1441 @@

+<?php + +namespace Mf2; + +use DOMDocument; +use DOMElement; +use DOMXPath; +use DOMNode; +use DOMNodeList; +use Exception; +use SplObjectStorage; +use stdClass; + +/** + * Parse Microformats2 + * + * Functional shortcut for the commonest cases of parsing microformats2 from HTML. + * + * Example usage: + * + * use Mf2; + * $output = Mf2\parse('<span class="h-card">Barnaby Walters</span>'); + * echo json_encode($output, JSON_PRETTY_PRINT); + * + * Produces: + * + * { + * "items": [ + * { + * "type": ["h-card"], + * "properties": { + * "name": ["Barnaby Walters"] + * } + * } + * ], + * "rels": {} + * } + * + * @param string|DOMDocument $input The HTML string or DOMDocument object to parse + * @param string $url The URL the input document was found at, for relative URL resolution + * @param bool $convertClassic whether or not to convert classic microformats + * @return array Canonical MF2 array structure + */ +function parse($input, $url = null, $convertClassic = true) { + $parser = new Parser($input, $url); + return $parser->parse($convertClassic); +} + +/** + * Fetch microformats2 + * + * Given a URL, fetches it (following up to 5 redirects) and, if the content-type appears to be HTML, returns the parsed + * microformats2 array structure. + * + * Not that even if the response code was a 4XX or 5XX error, if the content-type is HTML-like then it will be parsed + * all the same, as there are legitimate cases where error pages might contain useful microformats (for example a deleted + * h-entry resulting in a 410 Gone page with a stub h-entry explaining the reason for deletion). Look in $curlInfo['http_code'] + * for the actual value. + * + * @param string $url The URL to fetch + * @param bool $convertClassic (optional, default true) whether or not to convert classic microformats + * @param &array $curlInfo (optional) the results of curl_getinfo will be placed in this variable for debugging + * @return array|null canonical microformats2 array structure on success, null on failure + */ +function fetch($url, $convertClassic = true, &$curlInfo=null) { + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); + curl_setopt($ch, CURLOPT_MAXREDIRS, 5); + $html = curl_exec($ch); + $info = $curlInfo = curl_getinfo($ch); + curl_close($ch); + + if (strpos(strtolower($info['content_type']), 'html') === false) { + // The content was not delivered as HTML, do not attempt to parse it. + return null; + } + + return parse($html, $url, $convertClassic); +} + +/** + * Unicode to HTML Entities + * @param string $input String containing characters to convert into HTML entities + * @return string + */ +function unicodeToHtmlEntities($input) { + return mb_convert_encoding($input, 'HTML-ENTITIES', mb_detect_encoding($input)); +} + +/** + * Collapse Whitespace + * + * Collapses any sequences of whitespace within a string into a single space + * character. + * + * @deprecated since v0.2.3 + * @param string $str + * @return string + */ +function collapseWhitespace($str) { + return preg_replace('/[\s|\n]+/', ' ', $str); +} + +function unicodeTrim($str) { + // this is cheating. TODO: find a better way if this causes any problems + $str = str_replace(mb_convert_encoding('&nbsp;', 'UTF-8', 'HTML-ENTITIES'), ' ', $str); + $str = preg_replace('/^\s+/', '', $str); + return preg_replace('/\s+$/', '', $str); +} + +/** + * Microformat Name From Class string + * + * Given the value of @class, get the relevant mf classnames (e.g. h-card, + * p-name). + * + * @param string $class A space delimited list of classnames + * @param string $prefix The prefix to look for + * @return string|array The prefixed name of the first microfomats class found or false + */ +function mfNamesFromClass($class, $prefix='h-') { + $class = str_replace(array(' ', ' ', "\n"), ' ', $class); + $classes = explode(' ', $class); + $matches = array(); + + foreach ($classes as $classname) { + $compare_classname = ' ' . $classname; + $compare_prefix = ' ' . $prefix; + if (strstr($compare_classname, $compare_prefix) !== false && ($compare_classname != $compare_prefix)) { + $matches[] = ($prefix === 'h-') ? $classname : substr($classname, strlen($prefix)); + } + } + + return $matches; +} + +/** + * Get Nested µf Property Name From Class + * + * Returns all the p-, u-, dt- or e- prefixed classnames it finds in a + * space-separated string. + * + * @param string $class + * @return array + */ +function nestedMfPropertyNamesFromClass($class) { + $prefixes = array('p-', 'u-', 'dt-', 'e-'); + $propertyNames = array(); + + $class = str_replace(array(' ', ' ', "\n"), ' ', $class); + foreach (explode(' ', $class) as $classname) { + foreach ($prefixes as $prefix) { + // Check if $classname is a valid property classname for $prefix. + if (mb_substr($classname, 0, mb_strlen($prefix)) == $prefix && $classname != $prefix) { + $propertyName = mb_substr($classname, mb_strlen($prefix)); + $propertyNames[$propertyName][] = $prefix; + } + } + } + + foreach ($propertyNames as $property => $prefixes) { + $propertyNames[$property] = array_unique($prefixes); + } + + return $propertyNames; +} + +/** + * Wraps mfNamesFromClass to handle an element as input (common) + * + * @param DOMElement $e The element to get the classname for + * @param string $prefix The prefix to look for + * @return mixed See return value of mf2\Parser::mfNameFromClass() + */ +function mfNamesFromElement(\DOMElement $e, $prefix = 'h-') { + $class = $e->getAttribute('class'); + return mfNamesFromClass($class, $prefix); +} + +/** + * Wraps nestedMfPropertyNamesFromClass to handle an element as input + */ +function nestedMfPropertyNamesFromElement(\DOMElement $e) { + $class = $e->getAttribute('class'); + return nestedMfPropertyNamesFromClass($class); +} + +/** + * Converts various time formats to HH:MM + * @param string $time The time to convert + * @return string + */ +function convertTimeFormat($time) { + $hh = $mm = $ss = ''; + preg_match('/(\d{1,2}):?(\d{2})?:?(\d{2})?(a\.?m\.?|p\.?m\.?)?/i', $time, $matches); + + // If no am/pm is specified: + if (empty($matches[4])) { + return $time; + } else { + // Otherwise, am/pm is specified. + $meridiem = strtolower(str_replace('.', '', $matches[4])); + + // Hours. + $hh = $matches[1]; + + // Add 12 to hours if pm applies. + if ($meridiem == 'pm' && ($hh < 12)) { + $hh += 12; + } + + $hh = str_pad($hh, 2, '0', STR_PAD_LEFT); + + // Minutes. + $mm = (empty($matches[2]) ) ? '00' : $matches[2]; + + // Seconds, only if supplied. + if (!empty($matches[3])) { + $ss = $matches[3]; + } + + if (empty($ss)) { + return sprintf('%s:%s', $hh, $mm); + } + else { + return sprintf('%s:%s:%s', $hh, $mm, $ss); + } + } +} + +/** + * Microformats2 Parser + * + * A class which holds state for parsing microformats2 from HTML. + * + * Example usage: + * + * use Mf2; + * $parser = new Mf2\Parser('<p class="h-card">Barnaby Walters</p>'); + * $output = $parser->parse(); + */ +class Parser { + /** @var string The baseurl (if any) to use for this parse */ + public $baseurl; + + /** @var DOMXPath object which can be used to query over any fragment*/ + public $xpath; + + /** @var DOMDocument */ + public $doc; + + /** @var SplObjectStorage */ + protected $parsed; + + public $jsonMode; + + /** + * Constructor + * + * @param DOMDocument|string $input The data to parse. A string of HTML or a DOMDocument + * @param string $url The URL of the parsed document, for relative URL resolution + * @param boolean $jsonMode Whether or not to use a stdClass instance for an empty `rels` dictionary. This breaks PHP looping over rels, but allows the output to be correctly serialized as JSON. + */ + public function __construct($input, $url = null, $jsonMode = false) { + libxml_use_internal_errors(true); + if (is_string($input)) { + $doc = new DOMDocument(); + @$doc->loadHTML(unicodeToHtmlEntities($input)); + } elseif (is_a($input, 'DOMDocument')) { + $doc = $input; + } else { + $doc = new DOMDocument(); + @$doc->loadHTML(''); + } + + $this->xpath = new DOMXPath($doc); + + $baseurl = $url; + foreach ($this->xpath->query('//base[@href]') as $base) { + $baseElementUrl = $base->getAttribute('href'); + + if (parse_url($baseElementUrl, PHP_URL_SCHEME) === null) { + /* The base element URL is relative to the document URL. + * + * :/ + * + * Perhaps the author was high? */ + + $baseurl = resolveUrl($url, $baseElementUrl); + } else { + $baseurl = $baseElementUrl; + } + break; + } + + // Ignore <template> elements as per the HTML5 spec + foreach ($this->xpath->query('//template') as $templateEl) { + $templateEl->parentNode->removeChild($templateEl); + } + + $this->baseurl = $baseurl; + $this->doc = $doc; + $this->parsed = new SplObjectStorage(); + $this->jsonMode = $jsonMode; + } + + private function elementPrefixParsed(\DOMElement $e, $prefix) { + if (!$this->parsed->contains($e)) + $this->parsed->attach($e, array()); + + $prefixes = $this->parsed[$e]; + $prefixes[] = $prefix; + $this->parsed[$e] = $prefixes; + } + + private function isElementParsed(\DOMElement $e, $prefix) { + if (!$this->parsed->contains($e)) + return false; + + $prefixes = $this->parsed[$e]; + + if (!in_array($prefix, $prefixes)) + return false; + + return true; + } + + private function resolveChildUrls(DOMElement $el) { + $hyperlinkChildren = $this->xpath->query('.//*[@src or @href or @data]', $el); + + foreach ($hyperlinkChildren as $child) { + if ($child->hasAttribute('href')) + $child->setAttribute('href', $this->resolveUrl($child->getAttribute('href'))); + if ($child->hasAttribute('src')) + $child->setAttribute('src', $this->resolveUrl($child->getAttribute('src'))); + if ($child->hasAttribute('data')) + $child->setAttribute('data', $this->resolveUrl($child->getAttribute('data'))); + } + } + + public function textContent(DOMElement $el) { + $this->resolveChildUrls($el); + + $clonedEl = $el->cloneNode(true); + + foreach ($this->xpath->query('.//img', $clonedEl) as $imgEl) { + $newNode = $this->doc->createTextNode($imgEl->getAttribute($imgEl->hasAttribute('alt') ? 'alt' : 'src')); + $imgEl->parentNode->replaceChild($newNode, $imgEl); + } + + return $clonedEl->textContent; + } + + // TODO: figure out if this has problems with sms: and geo: URLs + public function resolveUrl($url) { + // If the URL is seriously malformed it’s probably beyond the scope of this + // parser to try to do anything with it. + if (parse_url($url) === false) + return $url; + + $scheme = parse_url($url, PHP_URL_SCHEME); + + if (empty($scheme) and !empty($this->baseurl)) { + return resolveUrl($this->baseurl, $url); + } else { + return $url; + } + } + + // Parsing Functions + + /** + * Parse value-class/value-title on an element, joining with $separator if + * there are multiple. + * + * @param \DOMElement $e + * @param string $separator = '' if multiple value-title elements, join with this string + * @return string|null the parsed value or null if value-class or -title aren’t in use + */ + public function parseValueClassTitle(\DOMElement $e, $separator = '') { + $valueClassElements = $this->xpath->query('./*[contains(concat(" ", @class, " "), " value ")]', $e); + + if ($valueClassElements->length !== 0) { + // Process value-class stuff + $val = ''; + foreach ($valueClassElements as $el) { + $val .= $this->textContent($el); + } + + return unicodeTrim($val); + } + + $valueTitleElements = $this->xpath->query('./*[contains(concat(" ", @class, " "), " value-title ")]', $e); + + if ($valueTitleElements->length !== 0) { + // Process value-title stuff + $val = ''; + foreach ($valueTitleElements as $el) { + $val .= $el->getAttribute('title'); + } + + return unicodeTrim($val); + } + + // No value-title or -class in this element + return null; + } + + /** + * Given an element with class="p-*", get it’s value + * + * @param DOMElement $p The element to parse + * @return string The plaintext value of $p, dependant on type + * @todo Make this adhere to value-class + */ + public function parseP(\DOMElement $p) { + $classTitle = $this->parseValueClassTitle($p, ' '); + + if ($classTitle !== null) + return $classTitle; + + if ($p->tagName == 'img' and $p->getAttribute('alt') !== '') { + $pValue = $p->getAttribute('alt'); + } elseif ($p->tagName == 'area' and $p->getAttribute('alt') !== '') { + $pValue = $p->getAttribute('alt'); + } elseif ($p->tagName == 'abbr' and $p->getAttribute('title') !== '') { + $pValue = $p->getAttribute('title'); + } elseif (in_array($p->tagName, array('data', 'input')) and $p->getAttribute('value') !== '') { + $pValue = $p->getAttribute('value'); + } else { + $pValue = unicodeTrim($this->textContent($p)); + } + + return $pValue; + } + + /** + * Given an element with class="u-*", get the value of the URL + * + * @param DOMElement $u The element to parse + * @return string The plaintext value of $u, dependant on type + * @todo make this adhere to value-class + */ + public function parseU(\DOMElement $u) { + if (($u->tagName == 'a' or $u->tagName == 'area') and $u->getAttribute('href') !== null) { + $uValue = $u->getAttribute('href'); + } elseif (in_array($u->tagName, array('img', 'audio', 'video', 'source')) and $u->getAttribute('src') !== null) { + $uValue = $u->getAttribute('src'); + } elseif ($u->tagName == 'object' and $u->getAttribute('data') !== null) { + $uValue = $u->getAttribute('data'); + } + + if (isset($uValue)) { + return $this->resolveUrl($uValue); + } + + $classTitle = $this->parseValueClassTitle($u); + + if ($classTitle !== null) { + return $classTitle; + } elseif ($u->tagName == 'abbr' and $u->getAttribute('title') !== null) { + return $u->getAttribute('title'); + } elseif (in_array($u->tagName, array('data', 'input')) and $u->getAttribute('value') !== null) { + return $u->getAttribute('value'); + } else { + return unicodeTrim($this->textContent($u)); + } + } + + /** + * Given an element with class="dt-*", get the value of the datetime as a php date object + * + * @param DOMElement $dt The element to parse + * @param array $dates Array of dates processed so far + * @return string The datetime string found + */ + public function parseDT(\DOMElement $dt, &$dates = array()) { + // Check for value-class pattern + $valueClassChildren = $this->xpath->query('./*[contains(concat(" ", @class, " "), " value ") or contains(concat(" ", @class, " "), " value-title ")]', $dt); + $dtValue = false; + + if ($valueClassChildren->length > 0) { + // They’re using value-class + $dateParts = array(); + + foreach ($valueClassChildren as $e) { + if (strstr(' ' . $e->getAttribute('class') . ' ', ' value-title ')) { + $title = $e->getAttribute('title'); + if (!empty($title)) + $dateParts[] = $title; + } + elseif ($e->tagName == 'img' or $e->tagName == 'area') { + // Use @alt + $alt = $e->getAttribute('alt'); + if (!empty($alt)) + $dateParts[] = $alt; + } + elseif ($e->tagName == 'data') { + // Use @value, otherwise innertext + $value = $e->hasAttribute('value') ? $e->getAttribute('value') : unicodeTrim($e->nodeValue); + if (!empty($value)) + $dateParts[] = $value; + } + elseif ($e->tagName == 'abbr') { + // Use @title, otherwise innertext + $title = $e->hasAttribute('title') ? $e->getAttribute('title') : unicodeTrim($e->nodeValue); + if (!empty($title)) + $dateParts[] = $title; + } + elseif ($e->tagName == 'del' or $e->tagName == 'ins' or $e->tagName == 'time') { + // Use @datetime if available, otherwise innertext + $dtAttr = ($e->hasAttribute('datetime')) ? $e->getAttribute('datetime') : unicodeTrim($e->nodeValue); + if (!empty($dtAttr)) + $dateParts[] = $dtAttr; + } + else { + if (!empty($e->nodeValue)) + $dateParts[] = unicodeTrim($e->nodeValue); + } + } + + // Look through dateParts + $datePart = ''; + $timePart = ''; + foreach ($dateParts as $part) { + // Is this part a full ISO8601 datetime? + if (preg_match('/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2})?(?:Z?[+|-]\d{2}:?\d{2})?$/', $part)) { + // Break completely, we’ve got our value. + $dtValue = $part; + break; + } else { + // Is the current part a valid time(+TZ?) AND no other time representation has been found? + if ((preg_match('/\d{1,2}:\d{1,2}(Z?[+|-]\d{2}:?\d{2})?/', $part) or preg_match('/\d{1,2}[a|p]m/', $part)) and empty($timePart)) { + $timePart = $part; + } elseif (preg_match('/\d{4}-\d{2}-\d{2}/', $part) and empty($datePart)) { + // Is the current part a valid date AND no other date representation has been found? + $datePart = $part; + } + + if ( !empty($datePart) && !in_array($datePart, $dates) ) { + $dates[] = $datePart; + } + + $dtValue = ''; + + if ( empty($datePart) && !empty($timePart) ) { + $timePart = convertTimeFormat($timePart); + $dtValue = unicodeTrim($timePart, 'T'); + } + else if ( !empty($datePart) && empty($timePart) ) { + $dtValue = rtrim($datePart, 'T'); + } + else { + $timePart = convertTimeFormat($timePart); + $dtValue = rtrim($datePart, 'T') . 'T' . unicodeTrim($timePart, 'T'); + } + } + } + } else { + // Not using value-class (phew). + if ($dt->tagName == 'img' or $dt->tagName == 'area') { + // Use @alt + // Is it an entire dt? + $alt = $dt->getAttribute('alt'); + if (!empty($alt)) + $dtValue = $alt; + } elseif (in_array($dt->tagName, array('data'))) { + // Use @value, otherwise innertext + // Is it an entire dt? + $value = $dt->getAttribute('value'); + if (!empty($value)) + $dtValue = $value; + else + $dtValue = $dt->nodeValue; + } elseif ($dt->tagName == 'abbr') { + // Use @title, otherwise innertext + // Is it an entire dt? + $title = $dt->getAttribute('title'); + if (!empty($title)) + $dtValue = $title; + else + $dtValue = $dt->nodeValue; + } elseif ($dt->tagName == 'del' or $dt->tagName == 'ins' or $dt->tagName == 'time') { + // Use @datetime if available, otherwise innertext + // Is it an entire dt? + $dtAttr = $dt->getAttribute('datetime'); + if (!empty($dtAttr)) + $dtValue = $dtAttr; + else + $dtValue = $dt->nodeValue; + } else { + $dtValue = $dt->nodeValue; + } + + if (preg_match('/(\d{4}-\d{2}-\d{2})/', $dtValue, $matches)) { + $dates[] = $matches[0]; + } + } + + /** + * if $dtValue is only a time and there are recently parsed dates, + * form the full date-time using the most recently parsed dt- value + */ + if ((preg_match('/^\d{1,2}:\d{1,2}(Z?[+|-]\d{2}:?\d{2})?/', $dtValue) or preg_match('/^\d{1,2}[a|p]m/', $dtValue)) && !empty($dates)) { + $dtValue = convertTimeFormat($dtValue); + $dtValue = end($dates) . 'T' . unicodeTrim($dtValue, 'T'); + } + + return $dtValue; + } + + /** + * Given the root element of some embedded markup, return a string representing that markup + * + * @param DOMElement $e The element to parse + * @return string $e’s innerHTML + * + * @todo need to mark this element as e- parsed so it doesn’t get parsed as it’s parent’s e-* too + */ + public function parseE(\DOMElement $e) { + $classTitle = $this->parseValueClassTitle($e); + + if ($classTitle !== null) + return $classTitle; + + // Expand relative URLs within children of this element + // TODO: as it is this is not relative to only children, make this .// and rerun tests + $this->resolveChildUrls($e); + + $html = ''; + foreach ($e->childNodes as $node) { + $html .= $node->C14N(); + } + + return array( + 'html' => $html, + 'value' => unicodeTrim($this->textContent($e)) + ); + } + + /** + * Recursively parse microformats + * + * @param DOMElement $e The element to parse + * @return array A representation of the values contained within microformat $e + */ + public function parseH(\DOMElement $e) { + // If it’s already been parsed (e.g. is a child mf), skip + if ($this->parsed->contains($e)) + return null; + + // Get current µf name + $mfTypes = mfNamesFromElement($e, 'h-'); + + // Initalise var to store the representation in + $return = array(); + $children = array(); + $dates = array(); + + // Handle nested microformats (h-*) + foreach ($this->xpath->query('.//*[contains(concat(" ", @class)," h-")]', $e) as $subMF) { + // Parse + $result = $this->parseH($subMF); + + // If result was already parsed, skip it + if (null === $result) + continue; + + // In most cases, the value attribute of the nested microformat should be the p- parsed value of the elemnt. + // The only times this is different is when the microformat is nested under certain prefixes, which are handled below. + $result['value'] = $this->parseP($subMF); + + // Does this µf have any property names other than h-*? + $properties = nestedMfPropertyNamesFromElement($subMF); + + if (!empty($properties)) { + // Yes! It’s a nested property µf + foreach ($properties as $property => $prefixes) { + // Note: handling microformat nesting under multiple conflicting prefixes is not currently specified by the mf2 parsing spec. + $prefixSpecificResult = $result; + if (in_array('p-', $prefixes)) { + $prefixSpecificResult['value'] = $prefixSpecificResult['properties']['name'][0]; + } elseif (in_array('e-', $prefixes)) { + $eParsedResult = $this->parseE($subMF); + $prefixSpecificResult['html'] = $eParsedResult['html']; + $prefixSpecificResult['value'] = $eParsedResult['value']; + } elseif (in_array('u-', $prefixes)) { + $prefixSpecificResult['value'] = $this->parseU($subMF); + } + $return[$property][] = $prefixSpecificResult; + } + } else { + // No, it’s a child µf + $children[] = $result; + } + + // Make sure this sub-mf won’t get parsed as a µf or property + // TODO: Determine if clearing this is required? + $this->elementPrefixParsed($subMF, 'h'); + $this->elementPrefixParsed($subMF, 'p'); + $this->elementPrefixParsed($subMF, 'u'); + $this->elementPrefixParsed($subMF, 'dt'); + $this->elementPrefixParsed($subMF, 'e'); + } + + if($e->tagName == 'area') { + $coords = $e->getAttribute('coords'); + $shape = $e->getAttribute('shape'); + } + + // Handle p-* + foreach ($this->xpath->query('.//*[contains(concat(" ", @class) ," p-")]', $e) as $p) { + if ($this->isElementParsed($p, 'p')) + continue; + + $pValue = $this->parseP($p); + + // Add the value to the array for it’s p- properties + foreach (mfNamesFromElement($p, 'p-') as $propName) { + if (!empty($propName)) + $return[$propName][] = $pValue; + } + + // Make sure this sub-mf won’t get parsed as a top level mf + $this->elementPrefixParsed($p, 'p'); + } + + // Handle u-* + foreach ($this->xpath->query('.//*[contains(concat(" ", @class)," u-")]', $e) as $u) { + if ($this->isElementParsed($u, 'u')) + continue; + + $uValue = $this->parseU($u); + + // Add the value to the array for it’s property types + foreach (mfNamesFromElement($u, 'u-') as $propName) { + $return[$propName][] = $uValue; + } + + // Make sure this sub-mf won’t get parsed as a top level mf + $this->elementPrefixParsed($u, 'u'); + } + + // Handle dt-* + foreach ($this->xpath->query('.//*[contains(concat(" ", @class), " dt-")]', $e) as $dt) { + if ($this->isElementParsed($dt, 'dt')) + continue; + + $dtValue = $this->parseDT($dt, $dates); + + if ($dtValue) { + // Add the value to the array for dt- properties + foreach (mfNamesFromElement($dt, 'dt-') as $propName) { + $return[$propName][] = $dtValue; + } + } + + // Make sure this sub-mf won’t get parsed as a top level mf + $this->elementPrefixParsed($dt, 'dt'); + } + + // Handle e-* + foreach ($this->xpath->query('.//*[contains(concat(" ", @class)," e-")]', $e) as $em) { + if ($this->isElementParsed($em, 'e')) + continue; + + $eValue = $this->parseE($em); + + if ($eValue) { + // Add the value to the array for e- properties + foreach (mfNamesFromElement($em, 'e-') as $propName) { + $return[$propName][] = $eValue; + } + } + // Make sure this sub-mf won’t get parsed as a top level mf + $this->elementPrefixParsed($em, 'e'); + } + + // Implied Properties + // Check for p-name + if (!array_key_exists('name', $return)) { + try { + // Look for img @alt + if (($e->tagName == 'img' or $e->tagName == 'area') and $e->getAttribute('alt') != '') + throw new Exception($e->getAttribute('alt')); + + if ($e->tagName == 'abbr' and $e->hasAttribute('title')) + throw new Exception($e->getAttribute('title')); + + // Look for nested img @alt + foreach ($this->xpath->query('./img[count(preceding-sibling::*)+count(following-sibling::*)=0]', $e) as $em) { + $emNames = mfNamesFromElement($em, 'h-'); + if (empty($emNames) && $em->getAttribute('alt') != '') { + throw new Exception($em->getAttribute('alt')); + } + } + + // Look for nested area @alt + foreach ($this->xpath->query('./area[count(preceding-sibling::*)+count(following-sibling::*)=0]', $e) as $em) { + $emNames = mfNamesFromElement($em, 'h-'); + if (empty($emNames) && $em->getAttribute('alt') != '') { + throw new Exception($em->getAttribute('alt')); + } + } + + + // Look for double nested img @alt + foreach ($this->xpath->query('./*[count(preceding-sibling::*)+count(following-sibling::*)=0]/img[count(preceding-sibling::*)+count(following-sibling::*)=0]', $e) as $em) { + $emNames = mfNamesFromElement($em, 'h-'); + if (empty($emNames) && $em->getAttribute('alt') != '') { + throw new Exception($em->getAttribute('alt')); + } + } + + // Look for double nested img @alt + foreach ($this->xpath->query('./*[count(preceding-sibling::*)+count(following-sibling::*)=0]/area[count(preceding-sibling::*)+count(following-sibling::*)=0]', $e) as $em) { + $emNames = mfNamesFromElement($em, 'h-'); + if (empty($emNames) && $em->getAttribute('alt') != '') { + throw new Exception($em->getAttribute('alt')); + } + } + + throw new Exception($e->nodeValue); + } catch (Exception $exc) { + $return['name'][] = unicodeTrim($exc->getMessage()); + } + } + + // Check for u-photo + if (!array_key_exists('photo', $return)) { + // Look for img @src + try { + if ($e->tagName == 'img') + throw new Exception($e->getAttribute('src')); + + // Look for nested img @src + foreach ($this->xpath->query('./img[count(preceding-sibling::*)+count(following-sibling::*)=0]', $e) as $em) { + if ($em->getAttribute('src') != '') + throw new Exception($em->getAttribute('src')); + } + + // Look for double nested img @src + foreach ($this->xpath->query('./*[count(preceding-sibling::*)+count(following-sibling::*)=0]/img[count(preceding-sibling::*)+count(following-sibling::*)=0]', $e) as $em) { + if ($em->getAttribute('src') != '') + throw new Exception($em->getAttribute('src')); + } + } catch (Exception $exc) { + $return['photo'][] = $this->resolveUrl($exc->getMessage()); + } + } + + // Check for u-url + if (!array_key_exists('url', $return)) { + // Look for img @src + if ($e->tagName == 'a' or $e->tagName == 'area') + $url = $e->getAttribute('href'); + + // Look for nested a @href + foreach ($this->xpath->query('./a[count(preceding-sibling::a)+count(following-sibling::a)=0]', $e) as $em) { + $emNames = mfNamesFromElement($em, 'h-'); + if (empty($emNames)) { + $url = $em->getAttribute('href'); + break; + } + } + + // Look for nested area @src + foreach ($this->xpath->query('./area[count(preceding-sibling::area)+count(following-sibling::area)=0]', $e) as $em) { + $emNames = mfNamesFromElement($em, 'h-'); + if (empty($emNames)) { + $url = $em->getAttribute('href'); + break; + } + } + + if (!empty($url)) + $return['url'][] = $this->resolveUrl($url); + } + + // Make sure things are in alphabetical order + sort($mfTypes); + + // Phew. Return the final result. + $parsed = array( + 'type' => $mfTypes, + 'properties' => $return + ); + + if (!empty($shape)) { + $parsed['shape'] = $shape; + } + + if (!empty($coords)) { + $parsed['coords'] = $coords; + } + + if (!empty($children)) { + $parsed['children'] = array_values(array_filter($children)); + } + return $parsed; + } + + /** + * Parse Rels and Alternatives + * + * Returns [$rels, $alternatives]. If the $rels value is to be empty, i.e. there are no links on the page + * with a rel value *not* containing `alternate`, then the type of $rels depends on $this->jsonMode. If set + * to true, it will be a stdClass instance, optimising for JSON serialisation. Otherwise (the default case), + * it will be an empty array. + */ + public function parseRelsAndAlternates() { + $rels = array(); + $alternates = array(); + + // Iterate through all a, area and link elements with rel attributes + foreach ($this->xpath->query('//*[@rel and @href]') as $hyperlink) { + if ($hyperlink->getAttribute('rel') == '') + continue; + + // Resolve the href + $href = $this->resolveUrl($hyperlink->getAttribute('href')); + + // Split up the rel into space-separated values + $linkRels = array_filter(explode(' ', $hyperlink->getAttribute('rel'))); + + // If alternate in rels, create alternate structure, append + if (in_array('alternate', $linkRels)) { + $alt = array( + 'url' => $href, + 'rel' => implode(' ', array_diff($linkRels, array('alternate'))) + ); + if ($hyperlink->hasAttribute('media')) + $alt['media'] = $hyperlink->getAttribute('media'); + + if ($hyperlink->hasAttribute('hreflang')) + $alt['hreflang'] = $hyperlink->getAttribute('hreflang'); + + if ($hyperlink->hasAttribute('title')) + $alt['title'] = $hyperlink->getAttribute('title'); + + if ($hyperlink->hasAttribute('type')) + $alt['type'] = $hyperlink->getAttribute('type'); + + if ($hyperlink->nodeValue) + $alt['text'] = $hyperlink->nodeValue; + + $alternates[] = $alt; + } else { + foreach ($linkRels as $rel) { + $rels[$rel][] = $href; + } + } + } + + if (empty($rels) and $this->jsonMode) { + $rels = new stdClass(); + } + + return array($rels, $alternates); + } + + /** + * Kicks off the parsing routine + * + * If `$htmlSafe` is set, any angle brackets in the results from non e-* properties + * will be HTML-encoded, bringing all output to the same level of encoding. + * + * If a DOMElement is set as the $context, only descendants of that element will + * be parsed for microformats. + * + * @param bool $htmlSafe whether or not to html-encode non e-* properties. Defaults to false + * @param DOMElement $context optionally an element from which to parse microformats + * @return array An array containing all the µfs found in the current document + */ + public function parse($convertClassic = true, DOMElement $context = null) { + $mfs = array(); + + if ($convertClassic) { + $this->convertLegacy(); + } + + $mfElements = null === $context + ? $this->xpath->query('//*[contains(concat(" ", @class), " h-")]') + : $this->xpath->query('.//*[contains(concat(" ", @class), " h-")]', $context); + + // Parser microformats + foreach ($mfElements as $node) { + // For each microformat + $result = $this->parseH($node); + + // Add the value to the array for this property type + $mfs[] = $result; + } + + // Parse rels + list($rels, $alternates) = $this->parseRelsAndAlternates(); + + $top = array( + 'items' => array_values(array_filter($mfs)), + 'rels' => $rels + ); + + if (count($alternates)) + $top['alternates'] = $alternates; + + return $top; + } + + /** + * Parse From ID + * + * Given an ID, parse all microformats which are children of the element with + * that ID. + * + * Note that rel values are still document-wide. + * + * If an element with the ID is not found, an empty skeleton mf2 array structure + * will be returned. + * + * @param string $id + * @param bool $htmlSafe = false whether or not to HTML-encode angle brackets in non e-* properties + * @return array + */ + public function parseFromId($id, $convertClassic=true) { + $matches = $this->xpath->query("//*[@id='{$id}']"); + + if (empty($matches)) + return array('items' => array(), 'rels' => array(), 'alternates' => array()); + + return $this->parse($convertClassic, $matches->item(0)); + } + + /** + * Convert Legacy Classnames + * + * Adds microformats2 classnames into a document containing only legacy + * semantic classnames. + * + * @return Parser $this + */ + public function convertLegacy() { + $doc = $this->doc; + $xp = new DOMXPath($doc); + + // replace all roots + foreach ($this->classicRootMap as $old => $new) { + foreach ($xp->query('//*[contains(concat(" ", @class, " "), " ' . $old . ' ") and not(contains(concat(" ", @class, " "), " ' . $new . ' "))]') as $el) { + $el->setAttribute('class', $el->getAttribute('class') . ' ' . $new); + } + } + + foreach ($this->classicPropertyMap as $oldRoot => $properties) { + $newRoot = $this->classicRootMap[$oldRoot]; + foreach ($properties as $old => $new) { + foreach ($xp->query('//*[contains(concat(" ", @class, " "), " ' . $oldRoot . ' ")]//*[contains(concat(" ", @class, " "), " ' . $old . ' ") and not(contains(concat(" ", @class, " "), " ' . $new . ' "))]') as $el) { + $el->setAttribute('class', $el->getAttribute('class') . ' ' . $new); + } + } + } + + return $this; + } + + /** + * XPath Query + * + * Runs an XPath query over the current document. Works in exactly the same + * way as DOMXPath::query. + * + * @param string $expression + * @param DOMNode $context + * @return DOMNodeList + */ + public function query($expression, $context = null) { + return $this->xpath->query($expression, $context); + } + + /** + * Classic Root Classname map + */ + public $classicRootMap = array( + 'vcard' => 'h-card', + 'hfeed' => 'h-feed', + 'hentry' => 'h-entry', + 'hrecipe' => 'h-recipe', + 'hresume' => 'h-resume', + 'vevent' => 'h-event', + 'hreview' => 'h-review', + 'hproduct' => 'h-product' + ); + + public $classicPropertyMap = array( + 'vcard' => array( + 'fn' => 'p-name', + 'url' => 'u-url', + 'honorific-prefix' => 'p-honorific-prefix', + 'given-name' => 'p-given-name', + 'additional-name' => 'p-additional-name', + 'family-name' => 'p-family-name', + 'honorific-suffix' => 'p-honorific-suffix', + 'nickname' => 'p-nickname', + 'email' => 'u-email', + 'logo' => 'u-logo', + 'photo' => 'u-photo', + 'url' => 'u-url', + 'uid' => 'u-uid', + 'category' => 'p-category', + 'adr' => 'p-adr h-adr', + 'extended-address' => 'p-extended-address', + 'street-address' => 'p-street-address', + 'locality' => 'p-locality', + 'region' => 'p-region', + 'postal-code' => 'p-postal-code', + 'country-name' => 'p-country-name', + 'label' => 'p-label', + 'geo' => 'p-geo h-geo', + 'latitude' => 'p-latitude', + 'longitude' => 'p-longitude', + 'tel' => 'p-tel', + 'note' => 'p-note', + 'bday' => 'dt-bday', + 'key' => 'u-key', + 'org' => 'p-org', + 'organization-name' => 'p-organization-name', + 'organization-unit' => 'p-organization-unit', + ), + 'hentry' => array( + 'entry-title' => 'p-name', + 'entry-summary' => 'p-summary', + 'entry-content' => 'e-content', + 'published' => 'dt-published', + 'updated' => 'dt-updated', + 'author' => 'p-author h-card', + 'category' => 'p-category', + 'geo' => 'p-geo h-geo', + 'latitude' => 'p-latitude', + 'longitude' => 'p-longitude', + ), + 'hrecipe' => array( + 'fn' => 'p-name', + 'ingredient' => 'p-ingredient', + 'yield' => 'p-yield', + 'instructions' => 'e-instructions', + 'duration' => 'dt-duration', + 'nutrition' => 'p-nutrition', + 'photo' => 'u-photo', + 'summary' => 'p-summary', + 'author' => 'p-author h-card' + ), + 'hresume' => array( + 'summary' => 'p-summary', + 'contact' => 'h-card p-contact', + 'education' => 'h-event p-education', + 'experience' => 'h-event p-experience', + 'skill' => 'p-skill', + 'affiliation' => 'p-affiliation h-card', + ), + 'vevent' => array( + 'dtstart' => 'dt-start', + 'dtend' => 'dt-end', + 'duration' => 'dt-duration', + 'description' => 'p-description', + 'summary' => 'p-summary', + 'description' => 'p-description', + 'url' => 'u-url', + 'category' => 'p-category', + 'location' => 'h-card', + 'geo' => 'p-location h-geo' + ), + 'hreview' => array( + 'summary' => 'p-name', + 'fn' => 'p-item h-item p-name', // doesn’t work properly, see spec + 'photo' => 'u-photo', // of the item being reviewed (p-item h-item u-photo) + 'url' => 'u-url', // of the item being reviewed (p-item h-item u-url) + 'reviewer' => 'p-reviewer p-author h-card', + 'dtreviewed' => 'dt-reviewed', + 'rating' => 'p-rating', + 'best' => 'p-best', + 'worst' => 'p-worst', + 'description' => 'p-description' + ), + 'hproduct' => array( + 'fn' => 'p-name', + 'photo' => 'u-photo', + 'brand' => 'p-brand', + 'category' => 'p-category', + 'description' => 'p-description', + 'identifier' => 'u-identifier', + 'url' => 'u-url', + 'review' => 'p-review h-review', + 'price' => 'p-price' + ) + ); +} + +function parseUriToComponents($uri) { + $result = array( + 'scheme' => null, + 'authority' => null, + 'path' => null, + 'query' => null, + 'fragment' => null + ); + + $u = @parse_url($uri); + + if(array_key_exists('scheme', $u)) + $result['scheme'] = $u['scheme']; + + if(array_key_exists('host', $u)) { + if(array_key_exists('user', $u)) + $result['authority'] = $u['user']; + if(array_key_exists('pass', $u)) + $result['authority'] .= ':' . $u['pass']; + if(array_key_exists('user', $u) || array_key_exists('pass', $u)) + $result['authority'] .= '@'; + $result['authority'] .= $u['host']; + if(array_key_exists('port', $u)) + $result['authority'] .= ':' . $u['port']; + } + + if(array_key_exists('path', $u)) + $result['path'] = $u['path']; + + if(array_key_exists('query', $u)) + $result['query'] = $u['query']; + + if(array_key_exists('fragment', $u)) + $result['fragment'] = $u['fragment']; + + return $result; +} + +function resolveUrl($baseURI, $referenceURI) { + $target = array( + 'scheme' => null, + 'authority' => null, + 'path' => null, + 'query' => null, + 'fragment' => null + ); + + # 5.2.1 Pre-parse the Base URI + # The base URI (Base) is established according to the procedure of + # Section 5.1 and parsed into the five main components described in + # Section 3 + $base = parseUriToComponents($baseURI); + + # If base path is blank (http://example.com) then set it to / + # (I can't tell if this is actually in the RFC or not, but seems like it makes sense) + if($base['path'] == null) + $base['path'] = '/'; + + # 5.2.2. Transform References + + # The URI reference is parsed into the five URI components + # (R.scheme, R.authority, R.path, R.query, R.fragment) = parse(R); + $reference = parseUriToComponents($referenceURI); + + # A non-strict parser may ignore a scheme in the reference + # if it is identical to the base URI's scheme. + # TODO + + if($reference['scheme']) { + $target['scheme'] = $reference['scheme']; + $target['authority'] = $reference['authority']; + $target['path'] = removeDotSegments($reference['path']); + $target['query'] = $reference['query']; + } else { + if($reference['authority']) { + $target['authority'] = $reference['authority']; + $target['path'] = removeDotSegments($reference['path']); + $target['query'] = $reference['query']; + } else { + if($reference['path'] == '') { + $target['path'] = $base['path']; + if($reference['query']) { + $target['query'] = $reference['query']; + } else { + $target['query'] = $base['query']; + } + } else { + if(substr($reference['path'], 0, 1) == '/') { + $target['path'] = removeDotSegments($reference['path']); + } else { + $target['path'] = mergePaths($base, $reference); + $target['path'] = removeDotSegments($target['path']); + } + $target['query'] = $reference['query']; + } + $target['authority'] = $base['authority']; + } + $target['scheme'] = $base['scheme']; + } + $target['fragment'] = $reference['fragment']; + + # 5.3 Component Recomposition + $result = ''; + if($target['scheme']) { + $result .= $target['scheme'] . ':'; + } + if($target['authority']) { + $result .= '//' . $target['authority']; + } + $result .= $target['path']; + if($target['query']) { + $result .= '?' . $target['query']; + } + if($target['fragment']) { + $result .= '#' . $target['fragment']; + } elseif($referenceURI == '#') { + $result .= '#'; + } + return $result; +} + +# 5.2.3 Merge Paths +function mergePaths($base, $reference) { + # If the base URI has a defined authority component and an empty + # path, + if($base['authority'] && $base['path'] == null) { + # then return a string consisting of "/" concatenated with the + # reference's path; otherwise, + $merged = '/' . $reference['path']; + } else { + if(($pos=strrpos($base['path'], '/')) !== false) { + # return a string consisting of the reference's path component + # appended to all but the last segment of the base URI's path (i.e., + # excluding any characters after the right-most "/" in the base URI + # path, + $merged = substr($base['path'], 0, $pos + 1) . $reference['path']; + } else { + # or excluding the entire base URI path if it does not contain + # any "/" characters). + $merged = $base['path']; + } + } + return $merged; +} + +# 5.2.4.A Remove leading ../ or ./ +function removeLeadingDotSlash(&$input) { + if(substr($input, 0, 3) == '../') { + $input = substr($input, 3); + } elseif(substr($input, 0, 2) == './') { + $input = substr($input, 2); + } +} + +# 5.2.4.B Replace leading /. with / +function removeLeadingSlashDot(&$input) { + if(substr($input, 0, 3) == '/./') { + $input = '/' . substr($input, 3); + } else { + $input = '/' . substr($input, 2); + } +} + +# 5.2.4.C Given leading /../ remove component from output buffer +function removeOneDirLevel(&$input, &$output) { + if(substr($input, 0, 4) == '/../') { + $input = '/' . substr($input, 4); + } else { + $input = '/' . substr($input, 3); + } + $output = substr($output, 0, strrpos($output, '/')); +} + +# 5.2.4.D Remove . and .. if it's the only thing in the input +function removeLoneDotDot(&$input) { + if($input == '.') { + $input = substr($input, 1); + } else { + $input = substr($input, 2); + } +} + +# 5.2.4.E Move one segment from input to output +function moveOneSegmentFromInput(&$input, &$output) { + if(substr($input, 0, 1) != '/') { + $pos = strpos($input, '/'); + } else { + $pos = strpos($input, '/', 1); + } + + if($pos === false) { + $output .= $input; + $input = ''; + } else { + $output .= substr($input, 0, $pos); + $input = substr($input, $pos); + } +} + +# 5.2.4 Remove Dot Segments +function removeDotSegments($path) { + # 1. The input buffer is initialized with the now-appended path + # components and the output buffer is initialized to the empty + # string. + $input = $path; + $output = ''; + + $step = 0; + + # 2. While the input buffer is not empty, loop as follows: + while($input) { + $step++; + + if(substr($input, 0, 3) == '../' || substr($input, 0, 2) == './') { + # A. If the input buffer begins with a prefix of "../" or "./", + # then remove that prefix from the input buffer; otherwise, + removeLeadingDotSlash($input); + } elseif(substr($input, 0, 3) == '/./' || $input == '/.') { + # B. if the input buffer begins with a prefix of "/./" or "/.", + # where "." is a complete path segment, then replace that + # prefix with "/" in the input buffer; otherwise, + removeLeadingSlashDot($input); + } elseif(substr($input, 0, 4) == '/../' || $input == '/..') { + # C. if the input buffer begins with a prefix of "/../" or "/..", + # where ".." is a complete path segment, then replace that + # prefix with "/" in the input buffer and remove the last + # segment and its preceding "/" (if any) from the output + # buffer; otherwise, + removeOneDirLevel($input, $output); + } elseif($input == '.' || $input == '..') { + # D. if the input buffer consists only of "." or "..", then remove + # that from the input buffer; otherwise, + removeLoneDotDot($input); + } else { + # E. move the first path segment in the input buffer to the end of + # the output buffer and any subsequent characters up to, but not including, + # the next "/" character or the end of the input buffer + moveOneSegmentFromInput($input, $output); + } + } + + return $output; +}
A vendor/mf2/mf2/README.md

@@ -0,0 +1,401 @@

+php-mf2 +======= + +php-mf2 is a pure, generic [microformats-2](http://microformats.org/wiki/microformats-2) parser. It makes HTML as easy to consume as JSON. + +Instead of having a hard-coded list of all the different microformats, it follows a set of procedures to handle different property types (e.g. `p-` for plaintext, `u-` for URL, etc). This allows for a very small and maintainable parser. + +## Installation + +There are two ways of installing php-mf2. I **highly recommend** installing php-mf2 using [Composer](http://getcomposer.org). The rest of the documentation assumes that you have done so. + +To install using Composer, run `./composer.phar require mf2/mf2:~0.2` + +If you can’t or don’t want to use Composer, then php-mf2 can be installed the old way by downloading [`/Mf2/Parser.php`](https://raw.githubusercontent.com/indieweb/php-mf2/master/Mf2/Parser.php), adding it to your project and requiring it from files you want to call its functions from, like this: + +```php +<?php + +require_once 'Mf2/Parser.php'; + +// Now all the functions documented below are available, for example: +$mf = Mf2\fetch('https://waterpigs.co.uk'); +``` + +### Signed Code Verification + +From v0.2.9, php-mf2’s version tags are signed using GPG by barnaby@waterpigs.co.uk. This allows you to cryptographically verify that you’re using the right code. To do so you will need my key — you don’t have it, get it like this: + +```bash +gpg --recv-keys 7D49834B0416CFA3 +``` + +Then verify the installed files like this: + +```bash +# in your project root +cd vendor/mf2/mf2 +git tag -v v0.2.9 +``` + +If nothing went wrong, you should see the tag commit message, ending something like this: + +``` +gpg: Signature made Wed 6 Aug 10:04:20 2014 GMT using RSA key ID 2B2BBB65 +gpg: Good signature from "Barnaby Walters <barnaby@waterpigs.co.uk>" +gpg: aka "[jpeg image of size 12805]" +``` + +Possible issues: + +* **Git complains that there’s no such tag**: check for a .git file in the source folder; odds are you have the prefer-dist setting enabled and composer is just extracting a zip rather than checking out from git. +* **Git complains the gpg command doesn’t exist**: If you successfully imported my key then you obviously do have gpg installed, but you might have gpg2, whereas git looks for gpg. Solution: tell git which binary to use: `git config --global gpg.program 'gpg2'` + +## Usage + +php-mf2 is PSR-0 autoloadable, so simply include Composer’s auto-generated autoload file (`/vendor/autoload.php`) and you can start using it. These two functions cover most situations: + +* To fetch microformats from a URL, call `Mf2\fetch($url)` +* To parse microformats from HTML, call `Mf2\parse($html, $url)`, where `$url` is the URL from which `$html` was loaded, if any. This parameter is required for correct relative URL parsing and must not be left out unless parsing HTML which is not loaded from the web. + +## Examples + +### Fetching microformats from a page + +```php +<?php + +namespace YourApp; + +require '/vendor/autoload.php'; + +use Mf2; + +// (Above code (or equivalent) assumed in future examples) + +$mf = Mf2\fetch('http://microformats.org'); + +foreach ($mf['items'] as $microformat) { + echo "A {$microformat['type'][0]} called {$microformat['properties']['name'][0]}\n"; +} + +``` + +### Parsing microformats from a HTML string + +Here we demonstrate parsing of microformats2 implied property parsing, where an entire h-card with name and URL properties is created using a single `h-card` class. + +```php +<?php + +$output = Mf2\parse('<a class="h-card" href="https://waterpigs.co.uk/">Barnaby Walters</a>'); +``` + +`$output` is a canonical microformats2 array structure like: + +```json +{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Barnaby Walters"], + "url": ["https://waterpigs.co.uk/"] + } + }], + "rels": {} +} +``` + +If no microformats are found, `items` will be an empty array. + +Note that, whilst the property prefixes are stripped, the prefix of the `h-*` classname(s) in the "type" array are retained. + +### Parsing a document with relative URLs + +Most of the time you’ll be getting your input HTML from a URL. You should pass that URL as the second parameter to `Mf2\parse()` so that any relative URLs in the document can be resolved. For example, say you got the following HTML from `http://example.org`: + +```html +<div class="h-card"> + <h1 class="p-name">Mr. Example</h1> + <img class="u-photo" alt="" src="photo.png" /> +</div> +``` + +Parsing like this: + +```php +$output = Mf2\parse($html, 'http://example.org'); +``` + +will result in the following output, with relative URLs made absolute: + +```json +{ + "items": [{ + "type": ["h-card"], + "properties": { + "photo": ["http://example.org/photo.png"] + } + }], + "rels": {} +} +``` + +php-mf2 correctly handles relative URL resolution according to the URI and HTML specs, including correct use of the `<base>` element. + +### Parsing `rel` and `rel=alternate` values + +php-mf2 also parses any link relations in the document, placing them into two top-level arrays — one for `rel=alternate` and another for all other rel values, e.g. when parsing: + +```html +<a rel="me" href="https://twitter.com/barnabywalters">Me on twitter</a> +<link rel="alternate etc" href="http://example.com/notes.atom" /> +``` + +parsing will result in the following keys: + +```json +{ + "items": [], + "rels": { + "me": ["https://twitter.com/barnabywalters"] + }, + "alternates": [{ + "url": "http://example.com/notes.atom", + "rel": "etc" + }] +} +``` + +Protip: if you’re not bothered about the microformats2 data and just want rels and alternates, you can improve performance by creating a `Mf2\Parser` object (see below) and calling `->parseRelsAndAlternates()` instead of `->parse()`, e.g. + +```php +<?php + +$parser = new Mf2\Parser('<link rel="…'); +$relsAndAlternates = $parser->parseRelsAndAlternates(); +``` + +### Debugging Mf2\fetch + +`Mf2\fetch()` will attempt to parse any response served with “HTML” in the content-type, regardless of what the status code is. If it receives a non-HTML response it will return null. + +To learn what the HTTP status code for any request was, or learn more about the request, pass a variable name as the third parameter to `Mf2\fetch()` — this will be filled with the contents of `curl_getinfo()`, e.g: + +```php + +<?php + +$mf = Mf2\fetch('http://waterpigs.co.uk/this-page-doesnt-exist', true, $curlInfo); +if ($curlInfo['http_code'] == '404') { + // This page doesn’t exist. +} + +``` + +If it was HTML then it is still parsed, as there are cases where error pages contain microformats — for example a deleted h-entry resulting in a 410 Gone response containing a stub h-entry with amn explanation for the deletion. + +### Getting more control by creating a Parser object + +The `Mf2\parse()` function covers the most common usage patterns by internally creating an instance of `Mf2\Parser` and returning the output all in one step. For some advanced usage you can also create an instance of `Mf2\Parser` yourself. + +The constructor takes two arguments, the input HTML (or a DOMDocument) and the URL to use as a base URL. Once you have a parser, there are a few other things you can do: + +### Selectively parsing a document + +There are several ways to selectively parse microformats from a document. If you wish to only parse microformats from an element with a particular ID, `Parser::parseFromId($id) ` is the easiest way. + +If your needs are more complex, `Parser::parse` accepts an optional context DOMNode as its second parameter. Typically you’d use `Parser::query` to run XPath queries on the document to get the element you want to parse from under, then pass it to `Parser::parse`. Example usage: + +```php +$doc = 'More microformats, more microformats <div id="parse-from-here"><span class="h-card">This shows up</span></div> yet more ignored content'; +$parser = new Mf2\Parser($doc); + +$parser->parseFromId('parse-from-here'); // returns a document with only the h-card descended from div#parse-from-here + +$elementIWant = $parser->query('an xpath query')[0]; + +$parser->parse(true, $elementIWant); // returns a document with only mfs under the selected element + +``` + +### Generating output for JSON serialization with JSON-mode + +Due to a quirk with the way PHP arrays work, there is an edge case ([reported](https://github.com/indieweb/php-mf2/issues/29) by Tom Morris) in which a document with no rel values, when serialised as JSON, results in an empty object as the rels value rather than an empty array. Replacing this in code with a stdClass breaks PHP iteration over the values. + +As of version 0.2.6, the default behaviour is back to being PHP-friendly, so if you want to produce results specifically for serialisation as JSON (for example if you run a HTML -> JSON service, or want to run tests against JSON fixtures), enable JSON mode: + +```php +// …by passing true as the third constructor: +$jsonParser = new Mf2\Parser($html, $url, true); +``` + +### Classic Microformats Markup + +php-mf2 has some support for parsing classic microformats markup. It’s enabled by default, but can be turned off by calling `Mf2\parse($html, $url, false);` or `$parser->parse(false);` if you’re instanciating a parser yourself. + +In previous versions of php-mf2 you could also add your own class mappings — officially this is no longer supported. + +* If the built in mappings don’t successfully parse some classic microformats markup then raise an issue and we’ll fix it. +* If you want to screen-scrape websites which don’t use mf2 into mf2 data structures, consider contributing to [php-mf2-shim](https://github.com/indieweb/php-mf2-shim) +* If you *really* need to make one-off changes to the default mappings… It is possible. But you have to figure it out for yourself ;) + +## Security + +**No filtering of content takes place in mf2\Parser, so treat its output as you would any untrusted data from the source of the parsed document.** + +Some tips: + +* All content apart from the 'html' key in dictionaries produced by parsing an `e-*` property is not HTML-escaped. For example, `<span class="p-name">&lt;code&gt;</span>` will result in `"name": ["<code>"]`. At the very least, HTML-escape all properties before echoing them out in HTML +* If you’re using the raw HTML content under the 'html' key of dictionaries produced by parsing `e-*` properties, you SHOULD purify the HTML before displaying it to prevent injection of arbitrary code. For PHP I recommend using [HTML Purifier](http://htmlpurifier.org) + +TODO: move this section to a security/consumption best practises page on the wiki + +## Contributing + +Issues and bug reports are very welcome. If you know how to write tests then please do so as code always expresses problems and intent much better than English, and gives me a way of measuring whether or not fixes have actually solved your problem. If you don’t know how to write tests, don’t worry :) Just include as much useful information in the issue as you can. + +Pull requests very welcome, please try to maintain stylistic, structural and naming consistency with the existing codebase, and don’t be too upset if I make naming changes :) + +### How to make a Pull Request + +1. Fork the repo to your github account +2. Clone a copy to your computer (simply installing php-mf2 using composer only works for using it, not developing it) +3. Install the dev dependencies with `./composer.phar install` +4. Run PHPUnit with `./vendor/bin/phpunit` +5. Make your changes +6. Add PHPUnit tests for your changes, either in an existing test file if suitable, or a new one +7. Make sure your tests pass (`./vendor/bin/phpunit`), preferably using both PHP 5.3 and 5.4 +8. Go to your fork of the repo on github.com and make a pull request, preferably with a short summary, detailed description and references to issues/parsing specs as appropriate +9. Bask in the warm feeling of having contributed to a piece of free software + +### Testing + +There are currently two separate test suites: one, in `tests/Mf2`, is written in phpunit, containing many microformats parsing examples as well as internal parser tests and regression tests for specific issues over php-mf2’s history. Run it with `./vendor/bin/phpunit`. + +The other, in `tests/test-suite`, is a custom test harness which hooks up php-mf2 to the cross-platform microformats test suite. Each test consists of a HTML file and a corresponding JSON file, and the suite can be run with `php ./tests/test-suite/test-suite.php`. + +Currently php-mf2 passes the majority of it’s own test case, and a good percentage of the cross-platform tests. Contributors should ALWAYS test against the PHPUnit suite to ensure any changes don’t negatively impact php-mf2, and SHOULD run the cross-platform suite, especially if you’re changing parsing behaviour. + +### Changelog + +#### v0.2.10 + +2015-04-29 + +* Merged #58, fixing some parsing bugs and adding support for area element parsing. Thanks so much for your hard work and patience, <a class="h-card" href="http://ben.thatmustbe.me/">Ben</a>! + +#### v0.2.9 + +2014-08-06 + +* Added backcompat classmap for hProduct, associated tests +* Started GPG signing version tags as barnaby@waterpigs.co.uk, fingerprint CBC7 7876 BF7C 9637 B6AE 77BA 7D49 834B 0416 CFA3 + +#### v0.2.8 + +2014-07-17 + +* Fixed issue #51 causing php-mf2 to not work with PHP 5.3 +* Fixed issue #52 correctly handling the `<template>` element by ignoring it +* Fixed issue #53 improving the plaintext parsing of `<img>` elements + +#### v0.2.7 + +2014-06-18 + +* Added `Mf2\fetch()` which fetches content from a URL and returns parsed microformats +* Added implied `dt-end` discovery (thanks for all your hard work, @gRegorLove!) +* Fixed issue causing classnames like `blah e- blah` to produce properties with numeric keys (thanks @aaronpk and @gRegorLove) +* Fixed issue causing resolved URLs to not include port numbers (thanks @aaronpk) + +#### v0.2.6 + +* Added JSON mode as long-term fix for #29 +* Fixed bug causing microformats nested under multiple property names to be parsed only once + +#### v0.2.5 + +* Removed conditional replacing empty rel list with stdclass. Original purpose was to make JSON-encoding the output from the parser correct but it also caused Fatal Errors due to trying to treat stdclass as array. + +#### v0.2.4 + +#### v0.2.3 + +* Made p-* parsing consistent with implied name parsing +* Stopped collapsing whitespace in p-* properties +* Implemented unicodeTrim which removes &nbsp; characters as well as regex \s +* Added support for implied name via abbr[title] +* Prevented excessively nested value-class elements from being parsed incorrectly, removed incorrect separator which was getting added in some cases +* Updated u-* parsing to be spec-compliant, matching [href] before value-class and only attempting URL resolution for URL attributes +* Added support for input[value] parsing +* Tests for all the above + +#### v0.2.2 + +* Made resolveUrl method public, allowing advanced parsers and subclasses to make use of it +* Fixed bug causing multiple duplicate property values to appear + +#### v0.2.1 + +* Fixed bug causing classic microformats property classnames to not be parsed correctly + +#### v0.2.0 (BREAKING CHANGES) + +* Namespace change from mf2 to Mf2, for PSR-0 compatibility +* `Mf2\parse()` function added to simplify the most common case of just parsing some HTML +* Updated e-* property parsing rules to match mf2 parsing spec — instead of producing inconsistent HTML content, it now produces dictionaries like <pre><code> +{ + "html": "<b>The Content</b>", + "value: "The Content" +} +</code></pre> +* Removed `htmlSafe` options as new e-* parsing rules make them redundant +* Moved a whole load of static functions out of the class and into standalone functions +* Changed autoloading to always include Parser.php instead of using classmap + +#### v0.1.23 + +* Made some changes to the way back-compatibility with classic microformats are handled, ignoring classic property classnames inside mf2 roots and outside classic roots +* Deprecated ability to add new classmaps, removed twitter classmap. Use [php-mf2-shim](http://github.com/indieweb/php-mf2-shim) instead, it’s better + +#### v0.1.22 + +* Converts classic microformats by default + +#### v0.1.21 + +* Removed webignition dependency, also removing ext-intl dependency. php-mf2 is now a standalone, single file library again +* Replaced webignition URL resolving with custom code passing almost all tests, courtesy of <a class="h-card" href="http://aaronparecki.com">Aaron Parecki</a> + +#### v0.1.20 + +* Added in almost-perfect custom URL resolving code + +#### v0.1.19 (2013-06-11) + +* Required stable version of webigniton/absolute-url-resolver, hopefully resolving versioning problems + +#### v0.1.18 (2013-06-05) + +* Fixed problems with isElementParsed, causing elements to be incorrectly parsed +* Cleaned up some test files + +#### v0.1.17 + +* Rewrote some PHP 5.4 array syntax which crept into 0.1.16 so php-mf2 still works on PHP 5.3 +* Fixed a bug causing weird partial microformats to be added to parent microformats if they had doubly property-nested children +* Finally actually licensed this project under a real license (MIT, in composer.json) +* Suggested barnabywalters/mf-cleaner in composer.json + +#### v0.1.16 + +* Ability to parse from only an ID +* Context DOMElement can be passed to $parse +* Parser::query runs XPath queries on the current document +* When parsing e-* properties, elements with @src, @data or @href have relative URLs resolved in the output + +#### v0.1.15 + +* Added html-safe options +* Added rel+rel-alternate parsing
A vendor/mf2/mf2/bin/fetch-mf2

@@ -0,0 +1,42 @@

+#!/usr/bin/env php +<?php + +$files = array( + __DIR__ . '/../vendor/autoload.php', + __DIR__ . '/../../../autoload.php', + __DIR__ . '/../Mf2/Parser.php' +); + +foreach ($files as $file) { + if (file_exists($file)) { + require $file; + define('COMPOSER_INSTALL_LOCATION', $file); + break; + } +} + +if (!defined('COMPOSER_INSTALL_LOCATION')) { + die('A composer /vendor/autoload.php file could not be found. You need to install composer: https://getcomposer.org/download'); +} + +$url = $argv[1]; + +if (empty($url)) { + die("Please provide a URL to fetch+parse, e.g. bin/fetch-mf2 waterpigs.co.uk/notes"); +} + +if (!file_exists($url)) { + if (!preg_match('|https?://|', $url)) { + $url = 'http://' . $url; + } +} + +$html = file_get_contents($url); + +$result = Mf2\parse($html, $url); + +if (defined('JSON_PRETTY_PRINT')) { + echo json_encode($result, JSON_PRETTY_PRINT); +} else { + echo json_encode($result); +}
A vendor/mf2/mf2/bin/parse-mf2

@@ -0,0 +1,37 @@

+#!/usr/bin/env php +<?php + +$files = array( + __DIR__ . '/../vendor/autoload.php', + __DIR__ . '/../../../autoload.php', + __DIR__ . '/../Mf2/Parser.php' +); + +foreach ($files as $file) { + if (file_exists($file)) { + require $file; + define('COMPOSER_INSTALL_LOCATION', $file); + break; + } +} + +if (!defined('COMPOSER_INSTALL_LOCATION')) { + die('A composer /vendor/autoload.php file could not be found. You need to install composer: https://getcomposer.org/download'); +} + +if (!empty($argv[1])) { + $url = $argv[1]; + if (!preg_match('|https?://|', $url)) { + $url = 'http://' . $url; + } +} else { + $url = null; +} + +$result = Mf2\parse(fgets(STDIN), $url); + +if (defined('JSON_PRETTY_PRINT')) { + echo json_encode($result, JSON_PRETTY_PRINT); +} else { + echo json_encode($result); +}
A vendor/mf2/mf2/composer.json

@@ -0,0 +1,26 @@

+{ + "name": "mf2/mf2", + "type": "library", + "description": "A pure, generic microformats2 parser — makes HTML as easy to consume as a JSON API", + "keywords": ["microformats", "microformats 2", "parser", "semantic", "html"], + "authors" : [ + { + "name": "Barnaby Walters", + "homepage": "http://waterpigs.co.uk" + } + ], + "bin": ["bin/fetch-mf2", "bin/parse-mf2"], + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "autoload": { + "files": ["Mf2/Parser.php"] + }, + "license": "MIT", + "suggest": { + "barnabywalters/mf-cleaner": "To more easily handle the canonical data php-mf2 gives you" + } +}
A vendor/mf2/mf2/composer.lock

@@ -0,0 +1,438 @@

+{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "4ddb858a7bdae5163307bd104589bd95", + "packages": [], + "packages-dev": [ + { + "name": "phpunit/php-code-coverage", + "version": "1.2.18", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", + "reference": "fe2466802556d3fe4e4d1d58ffd3ccfd0a19be0b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": ">=1.3.0@stable", + "phpunit/php-text-template": ">=1.2.0@stable", + "phpunit/php-token-stream": ">=1.1.3,<1.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*@dev" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2014-09-02 10:13:14" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2015-04-02 05:19:05" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "Text/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2014-01-30 17:20:04" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2013-08-02 07:42:54" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/ad4e1e23ae01b483c16f600ff1bebec184588e32", + "reference": "ad4e1e23ae01b483c16f600ff1bebec184588e32", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2014-03-03 05:10:30" + }, + { + "name": "phpunit/phpunit", + "version": "3.7.38", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/38709dc22d519a3d1be46849868aa2ddf822bcf6", + "reference": "38709dc22d519a3d1be46849868aa2ddf822bcf6", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": "~1.2", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.1", + "phpunit/php-timer": "~1.0", + "phpunit/phpunit-mock-objects": "~1.2", + "symfony/yaml": "~2.0" + }, + "require-dev": { + "pear-pear.php.net/pear": "1.9.4" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "composer/bin/phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2014-10-17 09:04:17" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-text-template": ">=1.1.1@stable" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2013-01-13 10:24:48" + }, + { + "name": "symfony/yaml", + "version": "v2.6.6", + "target-dir": "Symfony/Component/Yaml", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "174f009ed36379a801109955fc5a71a49fe62dd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/174f009ed36379a801109955fc5a71a49fe62dd4", + "reference": "174f009ed36379a801109955fc5a71a49fe62dd4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com", + "time": "2015-03-30 15:54:10" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.3.0" + }, + "platform-dev": [] +}
A vendor/mf2/mf2/phpunit.xml

@@ -0,0 +1,8 @@

+<?xml version="1.0"?> +<phpunit bootstrap="tests/Mf2/bootstrap.php"> + <testsuites> + <testsuite name="php-mf2"> + <directory suffix="Test.php">tests/Mf2</directory> + </testsuite> + </testsuites> +</phpunit>
A vendor/mf2/mf2/tests/Mf2/ClassicMicroformatsTest.php

@@ -0,0 +1,131 @@

+<?php + +/** + * Tests of the parsing methods within mf2\Parser + */ + +namespace Mf2\Parser\Test; + +use Mf2\Parser; +use Mf2; +use PHPUnit_Framework_TestCase; + +/** + * Classic Microformats Test + * + * Contains tests of the classic microformat => µf2 functionality. + * + * Mainly based off BC tables on http://microformats.org/wiki/microformats2#v2_vocabularies + */ +class ClassicMicroformatsTest extends PHPUnit_Framework_TestCase { + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + public function testParsesClassicHcard() { + $input = '<div class="vcard"><span class="fn n">Barnaby Walters</span> is a person.</div>'; + $expected = '{"items": [{"type": ["h-card"], "properties": {"name": ["Barnaby Walters"]}}], "rels": {}}'; + $parser = new Parser($input, '', true); + $this->assertJsonStringEqualsJsonString(json_encode($parser->parse()), $expected); + } + + public function testParsesClassicHEntry() { + $input = '<div class="hentry"><h1 class="entry-title">microformats2 Is Great</h1> <p class="entry-summary">yes yes it is.</p></div>'; + $expected = '{"items": [{"type": ["h-entry"], "properties": {"name": ["microformats2 Is Great"], "summary": ["yes yes it is."]}}], "rels": {}}'; + $parser = new Parser($input, '', true); + $this->assertJsonStringEqualsJsonString(json_encode($parser->parse()), $expected); + } + + public function testIgnoresClassicClassnamesUnderMf2Root() { + $input = <<<EOT +<div class="h-entry"> + <p class="author">Not Me</p> + <p class="p-author h-card">I wrote this</p> +</div> +EOT; + $parser = new Parser($input); + $result = $parser->parse(); + $this->assertEquals('I wrote this', $result['items'][0]['properties']['author'][0]['properties']['name'][0]); + + } + + public function testIgnoresClassicPropertyClassnamesOutsideClassicRoots() { + $input = <<<EOT +<p class="author">Mr. Invisible</p> +EOT; + $parser = new Parser($input); + $result = $parser->parse(); + $this->assertCount(0, $result['items']); + } + + public function testParsesFBerrimanClassicHEntry() { + $input = <<<EOT +<article id="post-976" class="post-976 post type-post status-publish format-standard hentry category-speaking category-web-dev tag-conferences tag-front-trends tag-fronttrends tag-speaking tag-txjs"> + <header class="entry-header"> + <h1 class="entry-title"> + <a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/" rel="bookmark">April recap &#8211; TXJS &#038; Front-Trends</a> + </h1> + + <div class="entry-meta"> + <span class="date"> + <a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/" title="Permalink to April recap &#8211; TXJS &amp; Front-Trends" rel="bookmark"> + <time class="entry-date" datetime="2013-05-14T11:54:06+00:00">May 14, 2013</time> + </a> + </span> + <span class="categories-links"> + <a href="http://fberriman.com/category/speaking/" title="View all posts in Speaking" rel="category tag">Speaking</a>, + <a href="http://fberriman.com/category/web-dev/" title="View all posts in Web Dev" rel="category tag">Web Dev</a> + </span> + <span class="tags-links"> + <a href="http://fberriman.com/tag/conferences/" rel="tag">conferences</a>, + <a href="http://fberriman.com/tag/front-trends/" rel="tag">front-trends</a>, + <a href="http://fberriman.com/tag/fronttrends/" rel="tag">fronttrends</a>, + <a href="http://fberriman.com/tag/speaking/" rel="tag">Speaking</a>, + <a href="http://fberriman.com/tag/txjs/" rel="tag">txjs</a> + </span> + <span class="author vcard"><a class="url fn n" href="http://fberriman.com/author/admin/" title="View all posts by Frances" rel="author">Frances</a></span> </div> + </header> + + <div class="entry-content"> + <p>April was pretty decent. I got to attend two very good conferences <strong>and</strong> I got to speak at them.</p> + </div> + + <footer class="entry-meta"> + <div class="comments-link"> + <a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/#respond" title="Comment on April recap &#8211; TXJS &amp; Front-Trends"><span class="leave-reply">Leave a comment</span></a> + </div> + + </footer><!-- .entry-meta --> +</article><!-- #post --> +EOT; + $parser = new Parser($input); + $result = $parser->parse(); + $e = $result['items'][0]; + $this->assertContains('h-entry', $e['type']); + } + + public function testParsesSnarfedOrgArticleCorrectly() { + $input = file_get_contents(__DIR__ . '/snarfed.org.html'); + $result = Mf2\parse($input, 'http://snarfed.org/2013-10-23_oauth-dropins'); + } + + public function testParsesHProduct() { + $input = <<<'EOT' +<xml id="skufilterbrowse" class="slide"> +<productcatalog><labels><label key="skuset.deliverypolicyurl">Delivery policy content URL</label><label key="price.save">Save</label><label key="skuset.seemoredetails">See more details</label><label key="price.additionaloffers">Additional Offers</label><label key="price.freeitem">Includes Free Item*</label><label key="price.instsaving">Instant Savings</label><label key="skuset.eddieseedetails">See details </label><label key="price.rebateurl">RebateURL</label><label key="skuset.freedelivery">FREE SHIPPING, plus 5% back for Rewards Members</label><label key="price.printableCoupons">Click here for Printable Coupon</label><label key="price.value">Value</label><label key="skuset.eddieshipdetails">Estimated to arrive no later than </label><label key="price.qty">Qty.</label><label key="price.chooseyouritems">Choose your Items</label><label key="price.true">true</label><label key="skuset.clearancemessage">&lt;strong&gt;CLEARANCE ITEM:&lt;/strong&gt; </label><label key="price.ERF">Eco Fee</label><label key="skuset.viewlargerimage">View larger</label><label key="common.next">Next</label><label key="price.addtocart">Add to Cart</label><label key="common.reviews">reviews</label><label key="common.previous">Previous</label><label key="skuset.instockonline">In Stock Online</label><label key="price.priceafterrebate">Price &lt;strong&gt;after&lt;/strong&gt; rebate</label><label key="btn.bopis">PICK UP TODAY</label><label key="common.share">SHARE</label><label key="skuset.freedeliverytostore">FREE Shipping to store</label><label key="erf.popup.label">Environmental fee notice:</label><label key="price.details">Details</label><label key="common.stars">stars</label><label key="skuset.learnmore1">Learn more.</label><label key="common.share.twitter">Share on Twitter</label><label key="price.instorespecial">Available In Store Only</label><label key="price.priceincart">See Price in Cart</label><label key="skuset.giftcards">Orders containing this item are not eligible for Gift cards or certain other methods of payment.</label><label key="skuset.mysoftwaredownloads">"My Software Downloads"</label><label key="price.bmsmerf">Buy More Save More prices do not include eco fee.</label><label key="price.now">Now</label><label key="price.collapse">Collapse</label><label key="classpage.getstarted">Get Started</label><label key="skuset.printpage">Print this page</label><label key="price.learnmore">Learn More</label><label key="common.item">Item</label><label key="common.icon.path">/sbdpas/img/ico/</label><label key="skuset.selectcomponent">Select another component below</label><label key="skuset.freeshippingentireorder">Item qualifies entire order for free delivery</label><label key="skuset.eddieincart">in cart. </label><label key="common.selected">selected</label><label key="price.priceaftersavings">Price &lt;strong&gt;after&lt;/strong&gt; savings</label><label key="skuset.inktoner">Ink and toner</label><label key="classpage.comingsoon">Coming Soon</label><label key="price.before">Before</label><label key="price.was">Was</label><label key="skuset.viewfulldetails">View Full Details</label><label key="skuset.expdelivery">Expected Delivery:</label><label key="common.share.pinterest">Share on Pinterest</label><label key="skuset.deliveryonly">Online Only</label><label key="common.share.email">Email it</label><label key="price.seedetails">See Details</label><label key="skuset.expdelpopup">/sbd/content/help-center/shipping-and-delivery.html</label><label key="skuset.softwaredownload">Software Download</label><label key="erf.popup.url">/sbd/content/help/environmental_fee_popup.html</label><label key="price.finalprice">Final Price</label><label key="common.share.facebook">Share on Facebook</label><label key="skuset.eddiesaveproduct">on this product! </label><label key="skuset.suppliedandshippedby">Supplied and Shipped by</label><label key="common.addtofavorites">Add to Favorites</label><label key="skuset.esdnotepart1">Note: Shortly after purchase you will be able to access your Software Downloads in the </label><label key="skuset.esdnotepart2">section of your staples.com&#174; account. It's easy and secure!</label><label key="skuset.software1">/sbd/cre/marketing/technology-research-centers/software/software-downloads.html#z_faq</label><label key="price.instantcoupon">Instant Coupon</label><label key="skuset.eddieshipdetails1">to </label><label key="price.pricebefore">Price &lt;strong&gt;before&lt;/strong&gt;</label><label key="skuset.eddieoffer">Offer valid for 20 minutes. </label><label key="price.price">Price</label><label key="common.model">Model</label><label key="skuset.supplierhover">We have partnered with this trusted supplier to offer you a wider assortment of products and brands for all of your business needs, with the same great level of service you can expect from Staples.com.</label><label key="skuset.forceshiptostore">Item can be shipped only to a retail store location. </label><label key="price.rebate">Rebate</label><label key="price.bmsm">Buy More Save More</label><label key="common.print">print</label><label key="skuset.viewvideo">View video</label><label key="skuset.instoreavailability">Check in Store Availability</label><label key="price.aslowas">As low as</label><label key="price.reg">Reg</label><label key="price.free">FREE</label><label key="erf.message">Provincial recycling or deposit fees may be applicable upon checkout.</label><label key="skuset.eddiesave">Save an extra </label><label key="skuset.deferredfinancemessage">Special Financing Available </label><label key="price.promotions">Promotions</label><label key="price.availableinstore">Available In-Store Only</label><label key="skuset.outofstock">Currently Out of Stock.</label><label key="price.totalsavings">Total Savings</label><label key="price.beforePresentation">Before continuing, please select an item</label></labels> + +<product bss="ON" envfeeflag="0" comingsoonflag="0" price="18.35" name="Swingline® 747® Classic Desktop Staplers" bopispilot="true" mss="ON" zipcode="01701" comp="0" presnvalue="Select an Item" snum="SS264184" leadtimedescription="1 - 30 Business Days" expandedpromo="0" alttext="Swingline® 747® Classic Desktop Staplers" prdtypeid="0" presntype="D" review="4.5" class="hproduct" type="skuset" skubopswitch="ON" id="609548" bopisenableflag="0"><descs><desc typeid="2">All-steel construction with non-skid rubber base</desc><desc typeid="2">Spring-loaded inner channel prevents jams</desc><desc typeid="2">Available in black, burgundy and beige &lt;br /&gt; &lt;li&gt;Staples up to 20 sheets&lt;/li&gt;</desc><desc typeid="38">Select an Item</desc><desc typeid="39">All-steel construction with non-skid rubber base</desc><desc typeid="39">Spring-loaded inner channel prevents jams</desc><desc typeid="39">Available in black, burgundy and beige &lt;br /&gt; &lt;li&gt;Staples up to 20 sheets&lt;/li&gt;</desc><desc class="fn">Swingline® 747® Classic Desktop Staplers</desc></descs><price is="18.35" uom="Each"></price><span class="price">18.35</span><span class="currency">USD</span><imgs><pic class="photo" id="1">http://www.staples-3p.com/s7/is/image/Staples/s0021414_sc7?$std$</pic><pic altimg="Y" id="2">http://www.staples-3p.com/s7/is/image/Staples/s0021414_sc7?$thb$</pic><pic id="6">http://www.staples-3p.com/s7/is/image/Staples/s0021414</pic></imgs><producturl class="url">/Swingline-747-Classic-Desktop-Staplers/product_SS264184</producturl><review rating="4.5" count="99" css="45"></review><delivery shiptostore="true" free="false" instore="2" forceshiptostore="false"></delivery></product> + +<product bss="ON" envfeeflag="0" comingsoonflag="0" price="18.35" name="Swingline® 747® Classic Desktop Full Strip Stapler, 20 Sheet Capacity, Black" bopispilot="true" mss="ON" zipcode="01701" comp="1" snum="264184" leadtimedescription="1 Business Day" expandedpromo="0" alttext="Swingline® 747® Classic Desktop Full Strip Stapler, 20 Sheet Capacity, Black" prdtypeid="0" review="4.5" class="hproduct" mnum="S7074771G" type="sku" skubopswitch="ON" id="609315" bopisenableflag="1"><descs><desc typeid="2">All-steel construction with non-skid rubber base</desc><desc typeid="2">Full strip</desc><desc typeid="2">Staples up to 20 sheets</desc><desc typeid="19">Each</desc><desc typeid="39">All-steel construction with non-skid rubber base</desc><desc typeid="39">Full strip</desc><desc typeid="39">Staples up to 20 sheets</desc><desc class="fn">Swingline® 747® Classic Desktop Full Strip Stapler, 20 Sheet Capacity, Black</desc></descs><price is="18.35" uom="Each"></price><span class="price">18.35</span><span class="currency">USD</span><imgs><pic class="photo" id="1">http://www.staples-3p.com/s7/is/image/Staples/s0021412_sc7?$std$</pic><pic altimg="Y" id="2">http://www.staples-3p.com/s7/is/image/Staples/s0021412_sc7?$thb$</pic><pic id="6">http://www.staples-3p.com/s7/is/image/Staples/s0021412</pic><pic id="120"></pic></imgs><producturl class="url">/Swingline-747-Classic-Desktop-Full-Strip-Stapler-20-Sheet-Capacity-Black/product_264184</producturl><review rating="4.5" count="99" css="45"></review><delivery shiptostore="true" free="false" instore="1" forceshiptostore="false"></delivery></product> + +<product bss="ON" envfeeflag="0" comingsoonflag="0" price="19.59" name="Swingline® 747® Classic Desktop Stapler, Burgundy" bopispilot="true" mss="ON" zipcode="01701" comp="1" snum="413732" leadtimedescription="1 Business Day" expandedpromo="0" alttext="Swingline® 747® Classic Desktop Stapler, Burgundy" prdtypeid="0" review="3.5" class="hproduct" mnum="74718/74782" type="sku" skubopswitch="ON" id="1460639" bopisenableflag="0"><descs><desc typeid="2">All-steel construction with non-skid rubber base</desc><desc typeid="2">Spring-loaded inner channel prevents jams</desc><desc typeid="2">Burgundy &lt;br /&gt; &lt;li&gt;Staples up to 20 sheets&lt;/li&gt;</desc><desc typeid="19">Each</desc><desc typeid="39">All-steel construction with non-skid rubber base</desc><desc typeid="39">Spring-loaded inner channel prevents jams</desc><desc typeid="39">Burgundy &lt;br /&gt; &lt;li&gt;Staples up to 20 sheets&lt;/li&gt;</desc><desc class="fn">Swingline® 747® Classic Desktop Stapler, Burgundy</desc></descs><price is="19.59" uom="Each"></price><span class="price">19.59</span><span class="currency">USD</span><imgs><pic class="photo" id="1">http://www.staples-3p.com/s7/is/image/Staples/m000240695_sc7?$std$</pic><pic altimg="Y" id="2">http://www.staples-3p.com/s7/is/image/Staples/m000240695_sc7?$thb$</pic><pic id="6">http://www.staples-3p.com/s7/is/image/Staples/m000240695</pic></imgs><producturl class="url">/Swingline-747-Classic-Desktop-Stapler-Burgundy/product_413732</producturl><review rating="3.5" count="7" css="35"></review><delivery shiptostore="true" free="false" instore="2" forceshiptostore="false"></delivery></product> + +<product bss="ON" envfeeflag="0" comingsoonflag="0" price="39.49" name="Swingline® 747® Rio Red Stapler, 20 Sheet Capacity" bopispilot="true" mss="ON" zipcode="01701" comp="1" brandname="Swingline" snum="562485" leadtimedescription="1 - 4 Business Days" expandedpromo="0" alttext="Swingline® 747® Rio Red Stapler, 20 Sheet Capacity" prdtypeid="0" review="4.5" class="hproduct" mnum="74736" type="sku" skubopswitch="ON" id="1093798" bopisenableflag="0"><descs><desc typeid="2">20 sheet capacity with Swingline S.F.® 4® Staples</desc><desc typeid="2">Durable metal construction</desc><desc typeid="2">Stapler opens for tacking ability</desc><desc typeid="19">Each</desc><desc typeid="39">20 sheet capacity with Swingline S.F.® 4® Staples</desc><desc typeid="39">Durable metal construction</desc><desc typeid="39">Stapler opens for tacking ability</desc><desc class="fn">Swingline® 747® Rio Red Stapler, 20 Sheet Capacity</desc></descs><price is="39.49" uom="Each"></price><span class="price">39.49</span><span class="currency">USD</span><imgs><pic class="photo" id="1">http://www.staples-3p.com/s7/is/image/Staples/s0446269_sc7?$std$</pic><pic altimg="Y" id="2">http://www.staples-3p.com/s7/is/image/Staples/s0446269_sc7?$thb$</pic><pic id="6">http://www.staples-3p.com/s7/is/image/Staples/s0446269</pic></imgs><producturl class="url">/Swingline-747-Rio-Red-Stapler-20-Sheet-Capacity/product_562485</producturl><review rating="4.5" count="76" css="45"></review><delivery shiptostore="true" free="true" instore="2" forceshiptostore="false"></delivery></product> +</productcatalog> +</xml> +EOT; + + $result = Mf2\parse($input, 'http://www.staples.com/Swingline-747-Rio-Red-Stapler-20-Sheet-Capacity/product_562485'); + $this->assertCount(4, $result['items']); + } +}
A vendor/mf2/mf2/tests/Mf2/CombinedMicroformatsTest.php

@@ -0,0 +1,252 @@

+<?php + +namespace Mf2\Parser\Test; + +use Mf2\Parser; +use Mf2; +use PHPUnit_Framework_TestCase; + +/** + * Combined Microformats Test + * + * Tests the ability of Parser::parse() to handle nested microformats correctly. + * More info at http://microformats.org/wiki/microformats-2#combining_microformats + * + * @todo implement + */ +class CombinedMicroformatsTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + /** + * From http://microformats.org/wiki/microformats2#combining_microformats + */ + public function testHEventLocationHCard() { + $input = '<div class="h-event"> + <a class="p-name u-url" href="http://indiewebcamp.com/2012"> + IndieWebCamp 2012 + </a> + from <time class="dt-start">2012-06-30</time> + to <time class="dt-end">2012-07-01</time> at + <span class="p-location h-card"> + <a class="p-name p-org u-url" href="http://geoloqi.com/"> + Geoloqi</a>, <span class="p-street-address">920 SW 3rd Ave. Suite 400</span>, <span class="p-locality">Portland</span>, <abbr class="p-region" title="Oregon">OR</abbr> + </span> +</div>'; + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["IndieWebCamp 2012"], + "url": ["http://indiewebcamp.com/2012"], + "start": ["2012-06-30"], + "end": ["2012-07-01"], + "location": [{ + "value": "Geoloqi", + "type": ["h-card"], + "properties": { + "name": ["Geoloqi"], + "org": ["Geoloqi"], + "url": ["http://geoloqi.com/"], + "street-address": ["920 SW 3rd Ave. Suite 400"], + "locality": ["Portland"], + "region": ["Oregon"] + } + }] + } + }] +}'; + + $parser = new Parser($input, '', true); + $parser->stringDateTimes = true; + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats2#combining_microformats + */ + public function testHCardOrgPOrg() { + $input = '<div class="h-card"> + <a class="p-name u-url" + href="http://blog.lizardwrangler.com/" + >Mitchell Baker</a> + (<span class="p-org">Mozilla Foundation</span>) +</div>'; + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Mitchell Baker"], + "url": ["http://blog.lizardwrangler.com/"], + "org": ["Mozilla Foundation"] + } + }] +}'; + + $parser = new Parser($input, '', true); + $parser->stringDateTimes = true; + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats2#combining_microformats + */ + public function testHCardOrgHCard() { + $input = '<div class="h-card"> + <a class="p-name u-url" + href="http://blog.lizardwrangler.com/" + >Mitchell Baker</a> + (<a class="p-org h-card" + href="http://mozilla.org/" + >Mozilla Foundation</a>) +</div>'; + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Mitchell Baker"], + "url": ["http://blog.lizardwrangler.com/"], + "org": [{ + "value": "Mozilla Foundation", + "type": ["h-card"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + }] + } + }] +}'; + + $parser = new Parser($input, '', true); + $parser->stringDateTimes = true; + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats2#combining_microformats + */ + public function testHCardPOrgHCardHOrg() { + $input = '<div class="h-card"> + <a class="p-name u-url" + href="http://blog.lizardwrangler.com/" + >Mitchell Baker</a> + (<a class="p-org h-card h-org" + href="http://mozilla.org/" + >Mozilla Foundation</a>) +</div>'; + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Mitchell Baker"], + "url": ["http://blog.lizardwrangler.com/"], + "org": [{ + "value": "Mozilla Foundation", + "type": ["h-card", "h-org"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + }] + } + }] +}'; + + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats2#combining_microformats + */ + public function testHCardChildHCard() { + $input = '<div class="h-card"> + <a class="p-name u-url" + href="http://blog.lizardwrangler.com/"> + Mitchell Baker</a> + (<a class="h-card h-org" href="http://mozilla.org/"> + Mozilla Foundation</a>) +</div>'; + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Mitchell Baker"], + "url": ["http://blog.lizardwrangler.com/"] + }, + "children": [{ + "type": ["h-card","h-org"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + }, + "value": "Mozilla Foundation" + }] + }] +}'; + + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * Regression test for https://github.com/indieweb/php-mf2/issues/42 + * + * This was occurring because mfPropertyNamesFromClass was only ever returning the first property name + * rather than all of them. + */ + public function testNestedMicroformatUnderMultipleProperties() { + $input = '<article class="h-entry"><div class="p-like-of p-in-reply-to h-cite"></div></article>'; + $mf = Mf2\parse($input); + + $this->assertCount(1, $mf['items'][0]['properties']['like-of']); + $this->assertCount(1, $mf['items'][0]['properties']['in-reply-to']); + } + + /** + * Test microformats nested under e-* property classnames retain html: key in structure + * + * @see https://github.com/indieweb/php-mf2/issues/64 + */ + public function testMicroformatsNestedUnderEPropertyClassnamesRetainHtmlKey() { + $input = '<div class="h-entry"><div class="h-card e-content"><p>Hello</p></div></div>'; + $mf = Mf2\parse($input); + + $this->assertEquals($mf['items'][0]['properties']['content'][0]['html'], '<p>Hello</p>'); + } + + /** + * Test microformats nested under u-* property classnames derive value: key from parsing as u-* + */ + public function testMicroformatsNestedUnderUPropertyClassnamesDeriveValueCorrectly() { + $input = '<div class="h-entry"><img class="u-url h-card" alt="This should not be the value" src="This should be the value" /></div>'; + $mf = Mf2\parse($input); + + $this->assertEquals($mf['items'][0]['properties']['url'][0]['value'], 'This should be the value'); + } + + public function testMicroformatsNestedUnderPPropertyClassnamesDeriveValueFromFirstPName() { + $input = '<div class="h-entry"><div class="p-author h-card">This post was written by <span class="p-name">Zoe</span>.</div></div>'; + $mf = Mf2\parse($input); + + $this->assertEquals($mf['items'][0]['properties']['author'][0]['value'], 'Zoe'); + } +}
A vendor/mf2/mf2/tests/Mf2/MicroformatsWikiExamplesTest.php

@@ -0,0 +1,188 @@

+<?php + +/** + * Tests of the parsing methods within mf2\Parser + */ + +namespace Mf2\Parser\Test; + +use Mf2\Parser; +use PHPUnit_Framework_TestCase; + +/** + * Microformats Wiki Examples + * + * Contains tests built directly from examples given on the microformats wiki pages about µf2. + * + * These tend to compare the JSON-encoded output of Parser::parse() with the JSON strings given on the wiki. + * If the given JSON is not within an `items` key of the root object, I add it and mark as so. + * + * @author Barnaby Walters waterpigs.co.uk <barnaby@waterpigs.co.uk> + */ +class MicroformatsWikiExamplesTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + public function testHandlesEmptyStringsCorrectly() { + $input = ''; + $expected = '{ + "rels": {}, + "items": [] +}'; + + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + public function testHandlesNullCorrectly() { + $input = Null; + $expected = '{ + "rels": {}, + "items": [] +}'; + + $parser = new Parser($input, '', true); + $parser->jsonMode = true; + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats-2 + */ + public function testSimplePersonReference() { + $input = '<span class="h-card">Frances Berriman</span>'; + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Frances Berriman"] + } + }] +}'; + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats-2 + */ + public function testSimpleHyperlinkedPersonReference() { + $input = '<a class="h-card" href="http://benward.me">Ben Ward</a>'; + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Ben Ward"], + "url": ["http://benward.me"] + } + }] +}'; + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats-2-implied-properties + */ + public function testSimplePersonImage() { + $input = '<img class="h-card" src="http://example.org/pic.jpg" alt="Chris Messina" />'; + // Added root items key + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Chris Messina"], + "photo": ["http://example.org/pic.jpg"] + } +}]}'; + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats-2-implied-properties + */ + public function testHyperlinkedImageNameAndPhotoProperties() { + $input = '<a class="h-card" href="http://rohit.khare.org/"> + <img alt="Rohit Khare" + src="https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg" /> +</a>'; + // Added root items key + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Rohit Khare"], + "url": ["http://rohit.khare.org/"], + "photo": ["https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg"] + } +}]}'; + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** + * From http://microformats.org/wiki/microformats-2 + */ + public function testMoreDetailedPerson() { + $input = '<div class="h-card"> + <img class="u-photo" alt="photo of Mitchell" + src="https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"/> + <a class="p-name u-url" + href="http://blog.lizardwrangler.com/" + >Mitchell Baker</a> + (<a class="u-url" + href="https://twitter.com/MitchellBaker" + >@MitchellBaker</a>) + <span class="p-org">Mozilla Foundation</span> + <p class="p-note"> + Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities. + </p> + <span class="p-category">Strategy</span> + <span class="p-category">Leadership</span> +</div>'; + + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "photo": ["https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"], + "name": ["Mitchell Baker"], + "url": [ + "http://blog.lizardwrangler.com/", + "https://twitter.com/MitchellBaker" + ], + "org": ["Mozilla Foundation"], + "note": ["Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities."], + "category": [ + "Strategy", + "Leadership" + ] + } + }] +}'; + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } +}
A vendor/mf2/mf2/tests/Mf2/ParseDTTest.php

@@ -0,0 +1,261 @@

+<?php + +/** + * Tests of the parsing methods within mf2\Parser + */ + +namespace Mf2\Parser\Test; + +use Mf2\Parser; +use PHPUnit_Framework_TestCase; + +class ParseDTTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + // Note that value-class tests for dt-* attributes are stored elsewhere, as there are so many of the bloody things + + /** + * @group parseDT + */ + public function testParseDTHandlesImg() { + $input = '<div class="h-card"><img class="dt-start" alt="2012-08-05T14:50"></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + */ + public function testParseDTHandlesDataValueAttr() { + $input = '<div class="h-card"><data class="dt-start" value="2012-08-05T14:50"></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + */ + public function testParseDTHandlesDataInnerHTML() { + $input = '<div class="h-card"><data class="dt-start">2012-08-05T14:50</data></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + */ + public function testParseDTHandlesAbbrValueAttr() { + $input = '<div class="h-card"><abbr class="dt-start" title="2012-08-05T14:50"></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + */ + public function testParseDTHandlesAbbrInnerHTML() { + $input = '<div class="h-card"><abbr class="dt-start">2012-08-05T14:50</abbr></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + */ + public function testParseDTHandlesTimeDatetimeAttr() { + $input = '<div class="h-card"><time class="dt-start" datetime="2012-08-05T14:50"></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + */ + public function testParseDTHandlesTimeInnerHTML() { + $input = '<div class="h-card"><time class="dt-start">2012-08-05T14:50</time></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + */ + public function testParseDTHandlesInsDelDatetime() { + $input = '<div class="h-card"><ins class="dt-start" datetime="2012-08-05T14:50"></ins><del class="dt-end" datetime="2012-08-05T18:00"></del></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertArrayHasKey('end', $output['items'][0]['properties']); + $this->assertEquals('2012-08-05T14:50', $output['items'][0]['properties']['start'][0]); + $this->assertEquals('2012-08-05T18:00', $output['items'][0]['properties']['end'][0]); + } + + /** + * @group parseDT + * @group valueClass + */ + public function testYYYY_MM_DD__HH_MM() { + $input = '<div class="h-event"><span class="dt-start"><span class="value">2012-10-07</span> at <span class="value">21:18</span></span></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-10-07T21:18', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + * @group valueClass + */ + public function testAbbrYYYY_MM_DD__HH_MM() { + $input = '<div class="h-event"><span class="dt-start"><abbr class="value" title="2012-10-07">some day</abbr> at <span class="value">21:18</span></span></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-10-07T21:18', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + * @group valueClass + */ + public function testYYYY_MM_DD__HHpm() { + $input = '<div class="h-event"><span class="dt-start"><span class="value">2012-10-07</span> at <span class="value">9pm</span></span></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-10-07T21:00', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + * @group valueClass + */ + public function testYYYY_MM_DD__HH_MMpm() { + $input = '<div class="h-event"><span class="dt-start"><span class="value">2012-10-07</span> at <span class="value">9:00pm</span></span></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-10-07T21:00', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + * @group valueClass + */ + public function testYYYY_MM_DD__HH_MM_SSpm() { + $input = '<div class="h-event"><span class="dt-start"><span class="value">2012-10-07</span> at <span class="value">9:00:00pm</span></span></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2012-10-07T21:00:00', $output['items'][0]['properties']['start'][0]); + } + + /** + * This test name refers to the value-class used within the dt-end. + * @group parseDT + * @group valueClass + */ + public function testImpliedDTEndWithValueClass() { + $input = '<div class="h-event"> <span class="dt-start"><span class="value">2014-06-04</span> at <span class="value">18:30</span> <span class="dt-end"><span class="value">19:30</span></span></span> </div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertArrayHasKey('end', $output['items'][0]['properties']); + $this->assertEquals('2014-06-04T18:30', $output['items'][0]['properties']['start'][0]); + $this->assertEquals('2014-06-04T19:30', $output['items'][0]['properties']['end'][0]); + } + + /** + * This test name refers to the lack of value-class within the dt-end. + * @group parseDT + * @group valueClass + */ + public function testImpliedDTEndWithoutValueClass() { + $input = '<div class="h-event"> <span class="dt-start"><span class="value">2014-06-05</span> at <span class="value">18:31</span> <span class="dt-end">19:31</span></span> </div>'; + + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertArrayHasKey('end', $output['items'][0]['properties']); + $this->assertEquals('2014-06-05T18:31', $output['items'][0]['properties']['start'][0]); + $this->assertEquals('2014-06-05T19:31', $output['items'][0]['properties']['end'][0]); + } + + /** + * @see https://github.com/indieweb/php-mf2/pull/46 + * @group parseDT + * @group valueClass + */ + public function testImpliedDTEndUsingNonValueClassDTStart() { + $input = '<div class="h-event"> <time class="dt-start">2014-06-05T18:31</time> until <span class="dt-end">19:31</span></span> </div>'; + + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertArrayHasKey('end', $output['items'][0]['properties']); + $this->assertEquals('2014-06-05T18:31', $output['items'][0]['properties']['start'][0]); + $this->assertEquals('2014-06-05T19:31', $output['items'][0]['properties']['end'][0]); + } + + /** + * @group parseDT + * @group valueClass + */ + public function testDTStartOnly() { + $input = '<div class="h-event"> <span class="dt-start"><span class="value">2014-06-06</span> at <span class="value">18:32</span> </span> </div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2014-06-06T18:32', $output['items'][0]['properties']['start'][0]); + } + + /** + * @group parseDT + * @group valueClass + */ + public function testDTStartDateOnly() { + $input = '<div class="h-event"> <span class="dt-start"><span class="value">2014-06-07</span> </span> </div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('start', $output['items'][0]['properties']); + $this->assertEquals('2014-06-07', $output['items'][0]['properties']['start'][0]); + } + +}
A vendor/mf2/mf2/tests/Mf2/ParseImpliedTest.php

@@ -0,0 +1,185 @@

+<?php +/** + * Tests of the parsing methods within mf2\Parser + */ + +namespace Mf2\Parser\Test; + +use Mf2; +use Mf2\Parser; +use PHPUnit_Framework_TestCase; + +/** + * @todo some of these can be made into single tests with dataProviders + */ +class ParseImpliedTest extends PHPUnit_Framework_TestCase { + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + + public function testParsesImpliedPNameFromNodeValue() { + $input = '<span class="h-card">The Name</span>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('The Name', $output['items'][0]['properties']['name'][0]); + } + + public function testParsesImpliedPNameFromImgAlt() { + $input = '<img class="h-card" src="" alt="The Name" />'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('The Name', $output['items'][0]['properties']['name'][0]); + } + + public function testParsesImpliedPNameFromNestedImgAlt() { + $input = '<div class="h-card"><img src="" alt="The Name" /></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('The Name', $output['items'][0]['properties']['name'][0]); + } + + public function testParsesImpliedPNameFromDoublyNestedImgAlt() { + $input = '<div class="h-card"><span><img src="" alt="The Name" /></span></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('The Name', $output['items'][0]['properties']['name'][0]); + } + + public function testParsesImpliedUPhotoFromImgSrc() { + $input = '<img class="h-card" src="http://example.com/img.png" alt="" />'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('photo', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/img.png', $output['items'][0]['properties']['photo'][0]); + } + + public function testParsesImpliedUPhotoFromNestedImgSrc() { + $input = '<div class="h-card"><img src="http://example.com/img.png" alt="" /></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('photo', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/img.png', $output['items'][0]['properties']['photo'][0]); + } + + public function testParsesImpliedUPhotoFromDoublyNestedImgSrc() { + $input = '<div class="h-card"><span><img src="http://example.com/img.png" alt="" /></span></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('photo', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/img.png', $output['items'][0]['properties']['photo'][0]); + } + + public function testIgnoresImgIfNotOnlyChild() { + $input = '<div class="h-card"><img src="http://example.com/img.png" /> <p>Moar text</p></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayNotHasKey('photo', $output['items'][0]['properties']); + } + + public function testIgnoresDoublyNestedImgIfNotOnlyDoublyNestedChild() { + $input = '<div class="h-card"><span><img src="http://example.com/img.png" /> <p>Moar text</p></span></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayNotHasKey('photo', $output['items'][0]['properties']); + } + + + public function testParsesImpliedUUrlFromAHref() { + $input = '<a class="h-card" href="http://example.com/">Some Name</a>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('url', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/', $output['items'][0]['properties']['url'][0]); + } + + + public function testParsesImpliedUUrlFromNestedAHref() { + $input = '<span class="h-card"><a href="http://example.com/">Some Name</a></span>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('url', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/', $output['items'][0]['properties']['url'][0]); + } + + public function testMultipleImpliedHCards() { + $input = '<span class="h-card">Frances Berriman</span> + +<a class="h-card" href="http://benward.me">Ben Ward</a> + +<img class="h-card" alt="Sally Ride" + src="http://upload.wikimedia.org/wikipedia/commons/a/a4/Ride-s.jpg"/> + +<a class="h-card" href="http://tantek.com"> + <img alt="Tantek Çelik" src="http://ttk.me/logo.jpg"/> +</a>'; + $expected = '{ + "rels": {}, + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Frances Berriman"] + } + }, + { + "type": ["h-card"], + "properties": { + "name": ["Ben Ward"], + "url": ["http://benward.me"] + } + }, + { + "type": ["h-card"], + "properties": { + "name": ["Sally Ride"], + "photo": ["http://upload.wikimedia.org/wikipedia/commons/a/a4/Ride-s.jpg"] + } + }, + { + "type": ["h-card"], + "properties": { + "name": ["Tantek Çelik"], + "url": ["http://tantek.com"], + "photo": ["http://ttk.me/logo.jpg"] + } + }] +}'; + + $parser = new Parser($input, '', true); + $output = $parser->parse(); + + $this->assertJsonStringEqualsJsonString(json_encode($output), $expected); + } + + /** as per https://github.com/indieweb/php-mf2/issues/37 */ + public function testParsesImpliedNameConsistentWithPName() { + $inner = "Name \nand more"; + $test = '<span class="h-card"> ' . $inner .' </span><span class="h-card"><span class="p-name"> ' . $inner . ' </span></span>'; + $result = Mf2\parse($test); + $this->assertEquals($inner, $result['items'][0]['properties']['name'][0]); + $this->assertEquals($inner, $result['items'][1]['properties']['name'][0]); + } + + + /** @see https://github.com/indieweb/php-mf2/issues/6 */ + public function testParsesImpliedNameFromAbbrTitle() { + $input = '<abbr class="h-card" title="Barnaby Walters">BJW</abbr>'; + $result = Mf2\parse($input); + $this->assertEquals('Barnaby Walters', $result['items'][0]['properties']['name'][0]); + } +}
A vendor/mf2/mf2/tests/Mf2/ParsePTest.php

@@ -0,0 +1,105 @@

+<?php + +/** + * Tests of the parsing methods within mf2\Parser + */ + +namespace Mf2\Parser\Test; + +use Mf2; +use Mf2\Parser; +use PHPUnit_Framework_TestCase; + + +class ParsePTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + /** + * @group parseP + */ + public function testParsePHandlesInnerText() { + $input = '<div class="h-card"><p class="p-name">Example User</p></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('Example User', $output['items'][0]['properties']['name'][0]); + } + + /** + * @group parseP + */ + public function testParsePHandlesImg() { + $input = '<div class="h-card"><img class="p-name" alt="Example User"></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('Example User', $output['items'][0]['properties']['name'][0]); + } + + /** + * @group parseP + */ + public function testParsePHandlesAbbr() { + $input = '<div class="h-card h-person"><abbr class="p-name" title="Example User">@example</abbr></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('Example User', $output['items'][0]['properties']['name'][0]); + } + + /** + * @group parseP + */ + public function testParsePHandlesData() { + $input = '<div class="h-card"><data class="p-name" value="Example User"></data></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('Example User', $output['items'][0]['properties']['name'][0]); + } + + /** + * @group parseP + */ + public function testParsePReturnsEmptyStringForBrHr() { + $input = '<div class="h-card"><br class="p-name"/></div><div class="h-card"><hr class="p-name"/></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('', $output['items'][0]['properties']['name'][0]); + $this->assertEquals('', $output['items'][0]['properties']['name'][0]); + } + + public function testParsesInputValue() { + $input = '<span class="h-card"><input class="u-url" value="http://example.com" /></span>'; + $result = Mf2\parse($input); + $this->assertEquals('http://example.com', $result['items'][0]['properties']['url'][0]); + } + + /** + * @see https://github.com/indieweb/php-mf2/issues/53 + * @see http://microformats.org/wiki/microformats2-parsing#parsing_an_e-_property + */ + public function testConvertsNestedImgElementToAltOrSrc() { + $input = <<<EOT +<div class="h-entry"> + <p class="p-name">The day I saw a <img alt="five legged elephant" src="/photos/five-legged-elephant.jpg" /></p> + <p class="p-summary">Blah blah <img src="/photos/five-legged-elephant.jpg" /></p> +</div> +EOT; + $result = Mf2\parse($input, 'http://waterpigs.co.uk/articles/five-legged-elephant'); + $this->assertEquals('The day I saw a five legged elephant', $result['items'][0]['properties']['name'][0]); + $this->assertEquals('Blah blah http://waterpigs.co.uk/photos/five-legged-elephant.jpg', $result['items'][0]['properties']['summary'][0]); + } + +}
A vendor/mf2/mf2/tests/Mf2/ParseUTest.php

@@ -0,0 +1,178 @@

+<?php +/** + * Tests of the parsing methods within mf2\Parser + */ + +namespace Mf2\Parser\Test; + +use Mf2; +use Mf2\Parser; +use PHPUnit_Framework_TestCase; + +class ParseUTest extends PHPUnit_Framework_TestCase { + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + /** + * @group parseU + */ + public function testParseUHandlesA() { + $input = '<div class="h-card"><a class="u-url" href="http://example.com">Awesome example website</a></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('url', $output['items'][0]['properties']); + $this->assertEquals('http://example.com', $output['items'][0]['properties']['url'][0]); + } + + /** + * @group parseU + */ + public function testParseUHandlesImg() { + $input = '<div class="h-card"><img class="u-photo" src="http://example.com/someimage.png"></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('photo', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]); + } + + /** + * @group parseU + */ + public function testParseUHandlesArea() { + $input = '<div class="h-card"><area class="u-photo" href="http://example.com/someimage.png"></area></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('photo', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]); + } + + /** + * @group parseU + */ + public function testParseUHandlesObject() { + $input = '<div class="h-card"><object class="u-photo" data="http://example.com/someimage.png"></object></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('photo', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]); + } + + /** + * @group parseU + */ + public function testParseUHandlesAbbr() { + $input = '<div class="h-card"><abbr class="u-photo" title="http://example.com/someimage.png"></abbr></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('photo', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]); + } + + /** + * @group parseU + */ + public function testParseUHandlesData() { + $input = '<div class="h-card"><data class="u-photo" value="http://example.com/someimage.png"></data></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('photo', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/someimage.png', $output['items'][0]['properties']['photo'][0]); + } + + /** + * @group baseUrl + */ + public function testResolvesRelativeUrlsFromDocumentUrl() { + $input = '<div class="h-card"><img class="u-photo" src="../image.png" /></div>'; + $parser = new Parser($input, 'http://example.com/things/more/more.html'); + $output = $parser->parse(); + + $this->assertEquals('http://example.com/things/image.png', $output['items'][0]['properties']['photo'][0]); + } + + /** + * @group baseUrl + */ + public function testResolvesRelativeUrlsFromBaseUrl() { + $input = '<head><base href="http://example.com/things/more/andmore/" /></head><body><div class="h-card"><img class="u-photo" src="../image.png" /></div></body>'; + $parser = new Parser($input, 'http://example.com/things/more.html'); + $output = $parser->parse(); + + $this->assertEquals('http://example.com/things/more/image.png', $output['items'][0]['properties']['photo'][0]); + } + + /** + * @group baseUrl + */ + public function testResolvesRelativeUrlsInImpliedMicroformats() { + $input = '<a class="h-card"><img src="image.png" /></a>'; + $parser = new Parser($input, 'http://example.com/things/more.html'); + $output = $parser->parse(); + + $this->assertEquals('http://example.com/things/image.png', $output['items'][0]['properties']['photo'][0]); + } + + /** + * @group baseUrl + */ + public function testResolvesRelativeBaseRelativeUrlsInImpliedMicroformats() { + $input = '<base href="things/"/><a class="h-card"><img src="image.png" /></a>'; + $parser = new Parser($input, 'http://example.com/'); + $output = $parser->parse(); + + $this->assertEquals('http://example.com/things/image.png', $output['items'][0]['properties']['photo'][0]); + } + + /** @see https://github.com/indieweb/php-mf2/issues/33 */ + public function testParsesHrefBeforeValueClass() { + $input = '<span class="h-card"><a class="u-url" href="http://example.com/right"><span class="value">WRONG</span></a></span>'; + $result = Mf2\parse($input); + $this->assertEquals('http://example.com/right', $result['items'][0]['properties']['url'][0]); + } + + /** + * @group parseU + */ + public function testParseUHandlesAudio() { + $input = '<div class="h-entry"><audio class="u-audio" src="http://example.com/audio.mp3"></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('audio', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/audio.mp3', $output['items'][0]['properties']['audio'][0]); + } + + /** + * @group parseU + */ + public function testParseUHandlesVideo() { + $input = '<div class="h-entry"><video class="u-video" src="http://example.com/video.mp4"></video></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('video', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/video.mp4', $output['items'][0]['properties']['video'][0]); + } + + + /** + * @group parseU + */ + public function testParseUHandlesSource() { + $input = '<div class="h-entry"><video><source class="u-video" src="http://example.com/video.mp4" type="video/mp4"><source class="u-video" src="http://example.com/video.ogg" type="video/ogg"></video></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('video', $output['items'][0]['properties']); + $this->assertEquals('http://example.com/video.mp4', $output['items'][0]['properties']['video'][0]); + $this->assertEquals('http://example.com/video.ogg', $output['items'][0]['properties']['video'][1]); + } + +}
A vendor/mf2/mf2/tests/Mf2/ParseValueClassTitleTest.php

@@ -0,0 +1,108 @@

+<?php + +/** + * Tests of the parsing methods within mf2\Parser + */ + +namespace Mf2\Parser\Test; + +use Mf2; +use Mf2\Parser; +use PHPUnit_Framework_TestCase; + +class ParseValueClassTitleTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + public function testValueClassTitleHandlesSingleValueClass() { + $input = '<div class="h-card"><p class="p-name"><span class="value">Name</span> (this should not be included)</p></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('Name', $output['items'][0]['properties']['name'][0]); + } + + public function testValueClassTitleHandlesMultipleValueClass() { + $input = '<div class="h-card"><p class="p-name"><span class="value">Name</span> (this should not be included) <span class="value">Endname</span></p></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('NameEndname', $output['items'][0]['properties']['name'][0]); + } + + public function testValueClassTitleHandlesSingleValueTitle() { + $input = '<div class="h-card"><p class="p-name"><span class="value-title" title="Real Name">Wrong Name</span> (this should not be included)</p></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('Real Name', $output['items'][0]['properties']['name'][0]); + } + + public function testValueClassTitleHandlesMultipleValueTitle() { + $input = '<div class="h-card"><p class="p-name"><span class="value-title" title="Real ">Wrong Name</span> <span class="value-title" title="Name">(this should not be included)</span></p></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('name', $output['items'][0]['properties']); + $this->assertEquals('Real Name', $output['items'][0]['properties']['name'][0]); + } + + /** + * @see https://github.com/indieweb/php-mf2/issues/25 + */ + public function testValueClassDatetimeWorksWithUrlProperties() { + $input = <<<EOT +<div class="h-entry"> + <a href="2013/178/t1/surreal-meeting-dpdpdp-trondisc" + rel="bookmark" + class="dt-published published dt-updated updated u-url u-uid"> + <time class="value">10:17</time> + on <time class="value">2013-06-27</time> + </a> +</div> +EOT; + + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('published', $output['items'][0]['properties']); + $this->assertEquals('2013-06-27T10:17', $output['items'][0]['properties']['published'][0]); + } + + /** + * @see https://github.com/indieweb/php-mf2/issues/27 + */ + public function testParsesValueTitleDatetimes() { + $input = <<<EOT +<div class="h-entry"> + <h1 class="p-name">test</h1> + <span class="dt-published"><span class="value-title" title="2012-02-16T16:14:47+00:00"> </span>16.02.2012</span> +</div> +EOT; + + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertEquals('2012-02-16T16:14:47+00:00', $output['items'][0]['properties']['published'][0]); + } + + /** @see https://github.com/indieweb/php-mf2/issues/34 */ + public function testIgnoresValueClassNestedFurtherThanChild() { + $test = '<div class="h-card"><span class="p-tel"><span class="value">1234</span><span class="h-card"><span class="p-tel"><span class="value">5678</span>'; + $result = Mf2\parse($test); + $this->assertEquals('1234', $result['items'][0]['properties']['tel'][0]); + $this->assertEquals('5678', $result['items'][0]['children'][0]['properties']['tel'][0]); + } + + /** @see https://github.com/indieweb/php-mf2/issues/38 */ + public function testValueClassDtMatchesSingleDigitTimeComponent() { + $test = '<div class="h-entry"><span class="dt-published"><time class="value">6:01</time>, <time class="value">2013-02-01</time></span></div>'; + $result = Mf2\parse($test); + $this->assertEquals('2013-02-01T6:01', $result['items'][0]['properties']['published'][0]); + } +}
A vendor/mf2/mf2/tests/Mf2/ParserTest.php

@@ -0,0 +1,317 @@

+<?php + +namespace Mf2\Parser\Test; + +use Mf2\Parser; +use Mf2; +use PHPUnit_Framework_TestCase; + +/** + * Parser Test + * + * Contains tests for internal parsing functions and stuff which doesn’t go anywhere else, i.e. + * isn’t related to a particular property as such. + * + * Stuff for parsing E goes in here until there is enough of it to go elsewhere (like, never?) + */ +class ParserTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + public function testUnicodeTrim() { + $this->assertEquals('thing', Mf2\unicodeTrim(' thing ')); + $this->assertEquals('thing', Mf2\unicodeTrim(' thing ')); + $this->assertEquals('thing', Mf2\unicodeTrim(mb_convert_encoding(' &nbsp; thing &nbsp; ', 'UTF-8', 'HTML-ENTITIES') )); + } + + public function testMicroformatNameFromClassReturnsFullRootName() { + $expected = array('h-card'); + $actual = Mf2\mfNamesFromClass('someclass h-card someotherclass', 'h-'); + + $this->assertEquals($expected, $actual); + } + + public function testMicroformatNameFromClassHandlesMultipleHNames() { + $expected = array('h-card', 'h-person'); + $actual = Mf2\mfNamesFromClass('someclass h-card someotherclass h-person yetanotherclass', 'h-'); + + $this->assertEquals($expected, $actual); + } + + public function testMicroformatStripsPrefixFromPropertyClassname() { + $expected = array('name'); + $actual = Mf2\mfNamesFromClass('someclass p-name someotherclass', 'p-'); + + $this->assertEquals($expected, $actual); + } + + public function testNestedMicroformatPropertyNameWorks() { + $expected = array('location' => array('p-'), 'author' => array('u-', 'p-')); + $test = 'someclass p-location someotherclass u-author p-author'; + $actual = Mf2\nestedMfPropertyNamesFromClass($test); + + $this->assertEquals($expected, $actual); + } + + public function testMicroformatNamesFromClassIgnoresPrefixesWithoutNames() { + $expected = array(); + $actual = Mf2\mfNamesFromClass('someclass h- someotherclass', 'h-'); + + $this->assertEquals($expected, $actual); + } + + public function testMicroformatNamesFromClassHandlesExcessiveWhitespace() { + $expected = array('h-card'); + $actual = Mf2\mfNamesFromClass(' someclass + h-card someotherclass ', 'h-'); + + $this->assertEquals($expected, $actual); + } + + public function testMicroformatNamesFromClassIgnoresUppercaseClassnames() { + $expected = array(); + $actual = Mf2\mfNamesFromClass('H-ENTRY', 'h-'); + + $this->assertEquals($expected, $actual); + } + + public function testParseE() { + $input = '<div class="h-entry"><div class="e-content">Here is a load of <strong>embedded markup</strong></div></div>'; + //$parser = new Parser($input); + $output = Mf2\parse($input); + + $this->assertArrayHasKey('content', $output['items'][0]['properties']); + $this->assertEquals('Here is a load of <strong>embedded markup</strong>', $output['items'][0]['properties']['content'][0]['html']); + $this->assertEquals('Here is a load of embedded markup', $output['items'][0]['properties']['content'][0]['value']); + } + + public function testParseEResolvesRelativeLinks() { + $input = '<div class="h-entry"><p class="e-content">Blah blah <a href="/a-url">thing</a>. <object data="/object"></object> <img src="/img" /></p></div>'; + $parser = new Parser($input, 'http://example.com'); + $output = $parser->parse(); + + $this->assertEquals('Blah blah <a href="http://example.com/a-url">thing</a>. <object data="http://example.com/object"></object> <img src="http://example.com/img"></img>', $output['items'][0]['properties']['content'][0]['html']); + $this->assertEquals('Blah blah thing. http://example.com/img', $output['items'][0]['properties']['content'][0]['value']); + } + + /** + * @group parseH + */ + public function testInvalidClassnamesContainingHAreIgnored() { + $input = '<div class="asdfgh-jkl"></div>'; + $parser = new Parser($input); + $output = $parser->parse(); + + // Look through $output for an item which indicate failure + foreach ($output['items'] as $item) { + if (in_array('asdfgh-jkl', $item['type'])) + $this->fail(); + } + } + + public function testHtmlSpecialCharactersWorks() { + $this->assertEquals('&lt;&gt;', htmlspecialchars('<>')); + } + + public function testHtmlEncodesNonEProperties() { + $input = '<div class="h-card"> + <span class="p-name">&lt;p&gt;</span> + <span class="dt-published">&lt;dt&gt;</span> + <span class="u-url">&lt;u&gt;</span> + </div>'; + + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertEquals('<p>', $output['items'][0]['properties']['name'][0]); + $this->assertEquals('<dt>', $output['items'][0]['properties']['published'][0]); + $this->assertEquals('<u>', $output['items'][0]['properties']['url'][0]); + } + + + public function testHtmlEncodesImpliedProperties() { + $input = '<a class="h-card" href="&lt;url&gt;"><img src="&lt;img&gt;" />&lt;name&gt;</a>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertEquals('<name>', $output['items'][0]['properties']['name'][0]); + $this->assertEquals('<url>', $output['items'][0]['properties']['url'][0]); + $this->assertEquals('<img>', $output['items'][0]['properties']['photo'][0]); + } + + public function testParsesRelValues() { + $input = '<a rel="author" href="http://example.com">Mr. Author</a>'; + $parser = new Parser($input); + + $output = $parser->parse(); + + $this->assertArrayHasKey('rels', $output); + $this->assertEquals('http://example.com', $output['rels']['author'][0]); + } + + public function testParsesRelAlternateValues() { + $input = '<a rel="alternate home" href="http://example.org" hreflang="de", media="screen" type="text/html" title="German Homepage Link">German Homepage</a>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayHasKey('alternates', $output); + $this->assertEquals('http://example.org', $output['alternates'][0]['url']); + $this->assertEquals('home', $output['alternates'][0]['rel']); + $this->assertEquals('de', $output['alternates'][0]['hreflang']); + $this->assertEquals('screen', $output['alternates'][0]['media']); + $this->assertEquals('text/html', $output['alternates'][0]['type']); + $this->assertEquals('German Homepage Link', $output['alternates'][0]['title']); + $this->assertEquals('German Homepage', $output['alternates'][0]['text']); + } + + public function testParseFromIdOnlyReturnsMicroformatsWithinThatId() { + $input = <<<EOT +<div class="h-entry"><span class="p-name">Not Included</span></div> + +<div id="parse-here"> + <span class="h-card">Included</span> +</div> + +<div class="h-entry"><span class="p-name">Not Included</span></div> +EOT; + + $parser = new Parser($input); + $output = $parser->parseFromId('parse-here'); + + $this->assertCount(1, $output['items']); + $this->assertEquals('Included', $output['items'][0]['properties']['name'][0]); + } + + /** + * Issue #21 github.com/indieweb/php-mf2/issues/21 + */ + public function testDoesntAddArraysWithOnlyValueForAlreadyParsedNestedMicroformats() { + $input = <<<EOT +<div class="h-entry"> + <div class="p-in-reply-to h-entry"> + <span class="p-author h-card">Nested Author</span> + </div> + + <span class="p-author h-card">Real Author</span> +</div> +EOT; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertCount(1, $output['items'][0]['properties']['author']); + } + + public function testParsesNestedMicroformatsWithClassnamesInAnyOrder() { + $input = <<<EOT +<div class="h-entry"> + <div class="note- p-in-reply-to h-entry">Name</div> +</div> +EOT; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertCount(1, $output['items'][0]['properties']['in-reply-to']); + $this->assertEquals('Name', $output['items'][0]['properties']['in-reply-to'][0]['properties']['name'][0]); + } + + /** + * @group network + */ + public function testFetchMicroformats() { + $mf = Mf2\fetch('http://waterpigs.co.uk/'); + $this->assertArrayHasKey('items', $mf); + + $mf = Mf2\fetch('http://waterpigs.co.uk/photo.jpg', null, $curlInfo); + $this->assertNull($mf); + $this->assertContains('jpeg', $curlInfo['content_type']); + } + + /** + * @see https://github.com/indieweb/php-mf2/issues/48 + */ + public function testIgnoreClassesEndingInHyphen() { + $input = '<span class="h-entry"> <span class="e-">foo</span> </span>'; + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayNotHasKey('0', $output['items'][0]['properties']); + } + + /** + * @see https://github.com/indieweb/php-mf2/issues/52 + * @see https://github.com/tommorris/mf2py/commit/92740deb7e19b8f1e7fbf6bec001cf52f2b07e99 + */ + public function testIgnoresTemplateElements() { + $result = Mf2\parse('<template class="h-card"><span class="p-name">Tom Morris</span></template>'); + $this->assertCount(0, $result['items']); + } + + /** + * @see https://github.com/indieweb/php-mf2/issues/53 + * @see http://microformats.org/wiki/microformats2-parsing#parsing_an_e-_property + */ + public function testConvertsNestedImgElementToAltOrSrc() { + $input = <<<EOT +<div class="h-entry"> + <p class="e-content">It is a strange thing to see a <img alt="five legged elephant" src="/photos/five-legged-elephant.jpg" /></p> +</div> +EOT; + $result = Mf2\parse($input, 'http://waterpigs.co.uk/articles/five-legged-elephant'); + $this->assertEquals('It is a strange thing to see a five legged elephant', $result['items'][0]['properties']['content'][0]['value']); + } + + // parser not respecting not[h-*] in rule "else if .h-x>a[href]:only-of-type:not[.h-*] then use that [href] for url" + public function testNotImpliedUrlFromHCard() { + $input = <<<EOT +<span class="h-entry"> + <a class="h-card" href="http://test.com">John Q</a> +</span> +EOT; + + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertArrayNotHasKey('url', $output['items'][0]['properties']); + } + + public function testAreaTag() { + $input = <<<EOT +<div class="h-entry"> + <area class="p-category h-card" href="http://personB.example.com" alt="Person Bee" shape="rect" coords="100,100,120,120"> +</div> +EOT; + + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertEquals('', $output['items'][0]['properties']['name'][0]); + $this->assertEquals('rect', $output['items'][0]['properties']['category'][0]['shape']); + $this->assertEquals('100,100,120,120', $output['items'][0]['properties']['category'][0]['coords']); + $this->assertEquals('Person Bee', $output['items'][0]['properties']['category'][0]['value']); + } + + public function testParseHcardInCategory() { + $input = <<<EOT +<span class="h-entry"> + <a class="p-author h-card" href="http://a.example.com/">Alice</a> tagged + <a href="http://b.example.com/" class="u-category h-card">Bob Smith</a> in + <a class="u-tag-of u-in-reply-to" href="http://s.example.com/permalink47"> + <img src="http://s.example.com/photo47.png" alt="a photo of Bob and Cole" /> + </a> +</span> +EOT; + + $parser = new Parser($input); + $output = $parser->parse(); + + $this->assertContains('h-entry', $output['items'][0]['type']); + $this->assertArrayHasKey('category', $output['items'][0]['properties']); + $this->assertContains('h-card', $output['items'][0]['properties']['category'][0]['type']); + $this->assertArrayHasKey('name', $output['items'][0]['properties']['category'][0]['properties']); + $this->assertEquals('Bob Smith', $output['items'][0]['properties']['category'][0]['properties']['name'][0]); + $this->assertArrayHasKey('url', $output['items'][0]['properties']['category'][0]['properties']); + $this->assertEquals('http://b.example.com/', $output['items'][0]['properties']['category'][0]['properties']['url'][0]); + } +}
A vendor/mf2/mf2/tests/Mf2/URLTest.php

@@ -0,0 +1,296 @@

+<?php + +/** + * Tests of the URL resolver within mf2\Parser + */ + +namespace Mf2\Parser\Test; + +use Mf2; +use PHPUnit_Framework_TestCase; + +class UrlTest extends PHPUnit_Framework_TestCase { + + public function setUp() { + date_default_timezone_set('Europe/London'); + } + + public function testRemoveLeadingDotSlash() { + $input = '../one/two'; + mf2\removeLeadingDotSlash($input); + $this->assertEquals('one/two', $input); + + $input = './one/two'; + mf2\removeLeadingDotSlash($input); + $this->assertEquals('one/two', $input); + } + + public function testRemoveLeadingSlashDot() { + $input = '/./one/two'; + mf2\removeLeadingSlashDot($input); + $this->assertEquals('/one/two', $input); + + $input = '/.'; + mf2\removeLeadingSlashDot($input); + $this->assertEquals('/', $input); + + $input = '/./../'; + mf2\removeLeadingSlashDot($input); + $this->assertEquals('/../', $input); + + $input = '/./../../g'; + mf2\removeLeadingSlashDot($input); + $this->assertEquals('/../../g', $input); + } + + public function testRemoveOneDirLevel() { + $input = '/../../g'; + $output = '/a/b/c'; + mf2\removeOneDirLevel($input, $output); + $this->assertEquals('/../g', $input); + $this->assertEquals('/a/b', $output); + + $input = '/..'; + $output = '/a/b/c'; + mf2\removeOneDirLevel($input, $output); + $this->assertEquals('/', $input); + $this->assertEquals('/a/b', $output); + } + + public function testRemoveLoneDotDot() { + $input = '.'; + mf2\removeLoneDotDot($input); + $this->assertEquals('', $input); + + $input = '..'; + mf2\removeLoneDotDot($input); + $this->assertEquals('', $input); + } + + public function testMoveOneSegmentFromInput() { + $input = '/a/b/c/./../../g'; + $output = ''; + mf2\moveOneSegmentFromInput($input, $output); + $this->assertEquals('/b/c/./../../g', $input); + $this->assertEquals('/a', $output); + + $input = '/b/c/./../../g'; + $output = '/a'; + mf2\moveOneSegmentFromInput($input, $output); + $this->assertEquals('/c/./../../g', $input); + $this->assertEquals('/a/b', $output); + + $input = '/c/./../../g'; + $output = '/a/b'; + mf2\moveOneSegmentFromInput($input, $output); + $this->assertEquals('/./../../g', $input); + $this->assertEquals('/a/b/c', $output); + + $input = '/g'; + $output = '/a'; + mf2\moveOneSegmentFromInput($input, $output); + $this->assertEquals('', $input); + $this->assertEquals('/a/g', $output); + } + + /** + * @dataProvider removeDotSegmentsData + */ + public function testRemoveDotSegments($assert, $path, $expected) { + $actual = mf2\removeDotSegments($path); + $this->assertEquals($expected, $actual, $assert); + } + + public function removeDotSegmentsData() { + return array( + array('Should remove .. and .', + '/a/b/c/./../../g', '/a/g'), + array('Should remove ../..', + '/a/b/c/d/../../../g', '/a/g'), + array('Should not add leading slash', + 'a/b/c', 'a/b/c'), + + ); + } + + public function testNoPathOnBase() { + $actual = mf2\resolveUrl('http://example.com', ''); + $this->assertEquals('http://example.com/', $actual); + + $actual = mf2\resolveUrl('http://example.com', '#'); + $this->assertEquals('http://example.com/#', $actual); + + $actual = mf2\resolveUrl('http://example.com', '#thing'); + $this->assertEquals('http://example.com/#thing', $actual); + } + + public function testMisc() { + $expected = 'http://a/b/c/g'; + $actual = mf2\resolveUrl('http://a/b/c/d;p?q', './g'); + $this->assertEquals($expected, $actual); + + $expected = 'http://a/b/c/g/'; + $actual = mf2\resolveUrl('http://a/b/c/d;p?q', './g/'); + $this->assertEquals($expected, $actual); + + $expected = 'http://a/b/'; + $actual = mf2\resolveUrl('http://a/b/c/d;p?q', '..'); + $this->assertEquals($expected, $actual); + } + + /** as per https://github.com/indieweb/php-mf2/issues/35 */ + public function testResolvesProtocolRelativeUrlsCorrectly() { + $expected = 'http://cdn.example.org/thing/asset.css'; + $actual = Mf2\resolveUrl('http://example.com', '//cdn.example.org/thing/asset.css'); + $this->assertEquals($expected, $actual); + + $expected = 'https://cdn.example.org/thing/asset.css'; + $actual = Mf2\resolveUrl('https://example.com', '//cdn.example.org/thing/asset.css'); + $this->assertEquals($expected, $actual); + } + + /** + * @dataProvider testData + */ + public function testReturnsUrlIfAbsolute($assert, $base, $url, $expected) { + $actual = mf2\resolveUrl($base, $url); + + $this->assertEquals($expected, $actual, $assert); + } + + public function testData() { + // seriously, please update to PHP 5.4 so I can use nice array syntax ;) + // fail message, base, url, expected + $cases = array( + array('Should return absolute URL unchanged', + 'http://example.com', 'http://example.com', 'http://example.com'), + + array('Should return root given blank path', + 'http://example.com', '', 'http://example.com/'), + + array('Should return input unchanged given full URL and blank path', + 'http://example.com/something', '', 'http://example.com/something'), + + array('Should handle blank base URL', + '', 'http://example.com', 'http://example.com'), + + array('Should resolve fragment ID', + 'http://example.com', '#thing', 'http://example.com/#thing'), + + array('Should resolve blank fragment ID', + 'http://example.com', '#', 'http://example.com/#'), + + array('Should resolve same level URL', + 'http://example.com', 'thing', 'http://example.com/thing'), + + array('Should resolve directory level URL', + 'http://example.com', './thing', 'http://example.com/thing'), + + array('Should resolve parent level URL at root level', + 'http://example.com', '../thing', 'http://example.com/thing'), + + array('Should resolve nested URL', + 'http://example.com/something', 'another', 'http://example.com/another'), + + array('Should ignore query strings in base url', + 'http://example.com/index.php?url=http://example.org', '/thing', 'http://example.com/thing'), + + array('Should resolve query strings', + 'http://example.com/thing', '?stuff=yes', 'http://example.com/thing?stuff=yes'), + + array('Should resolve dir level query strings', + 'http://example.com', './?thing=yes', 'http://example.com/?thing=yes'), + + array('Should resolve up one level from root domain', + 'http://example.com', 'path/to/the/../file', 'http://example.com/path/to/file'), + + array('Should resolve up one level from base with path', + 'http://example.com/path/the', 'to/the/../file', 'http://example.com/path/to/file'), + + // Tests from webignition library + + array('relative add host from base', + 'http://www.example.com', 'server.php', 'http://www.example.com/server.php'), + + array('relative add scheme host user from base', + 'http://user:@www.example.com', 'server.php', 'http://user:@www.example.com/server.php'), + + array('relative add scheme host pass from base', + 'http://:pass@www.example.com', 'server.php', 'http://:pass@www.example.com/server.php'), + + array('relative add scheme host user pass from base', + 'http://user:pass@www.example.com', 'server.php', 'http://user:pass@www.example.com/server.php'), + + array('relative base has file path', + 'http://example.com/index.html', 'example.html', 'http://example.com/example.html'), + + array('input has absolute path', + 'http://www.example.com/pathOne/pathTwo/pathThree', '/server.php?param1=value1', 'http://www.example.com/server.php?param1=value1'), + + array('test absolute url with path', + 'http://www.example.com/', 'http://www.example.com/pathOne', 'http://www.example.com/pathOne'), + + array('testRelativePathIsTransformedIntoCorrectAbsoluteUrl', + 'http://www.example.com/pathOne/pathTwo/pathThree', 'server.php?param1=value1', 'http://www.example.com/pathOne/pathTwo/server.php?param1=value1'), + + array('testAbsolutePathHasDotDotDirecoryAndSourceHasFileName', + 'http://www.example.com/pathOne/index.php', '../jquery.js', 'http://www.example.com/jquery.js'), + + array('testAbsolutePathHasDotDotDirecoryAndSourceHasDirectoryWithTrailingSlash', + 'http://www.example.com/pathOne/', '../jquery.js', 'http://www.example.com/jquery.js'), + + array('testAbsolutePathHasDotDotDirecoryAndSourceHasDirectoryWithoutTrailingSlash', + 'http://www.example.com/pathOne', '../jquery.js', 'http://www.example.com/jquery.js'), + + array('testAbsolutePathHasDotDirecoryAndSourceHasFilename', + 'http://www.example.com/pathOne/index.php', './jquery.js', 'http://www.example.com/pathOne/jquery.js'), + + array('testAbsolutePathHasDotDirecoryAndSourceHasDirectoryWithTrailingSlash', + 'http://www.example.com/pathOne/', './jquery.js', 'http://www.example.com/pathOne/jquery.js'), + + array('testAbsolutePathHasDotDirecoryAndSourceHasDirectoryWithoutTrailingSlash', + 'http://www.example.com/pathOne', './jquery.js', 'http://www.example.com/jquery.js'), + + array('testAbsolutePathIncludesPortNumber', + 'http://example.com:8080/index.html', '/photo.jpg', 'http://example.com:8080/photo.jpg') + + ); + + // Test cases from RFC + // http://tools.ietf.org/html/rfc3986#section-5.4 + + $rfcTests = array( + array("g:h", "g:h"), + array("g", "http://a/b/c/g"), + array("./g", "http://a/b/c/g"), + array("g/", "http://a/b/c/g/"), + array("/g", "http://a/g"), + array("//g", "http://g"), + array("?y", "http://a/b/c/d;p?y"), + array("g?y", "http://a/b/c/g?y"), + array("#s", "http://a/b/c/d;p?q#s"), + array("g#s", "http://a/b/c/g#s"), + array("g?y#s", "http://a/b/c/g?y#s"), + array(";x", "http://a/b/c/;x"), + array("g;x", "http://a/b/c/g;x"), + array("g;x?y#s", "http://a/b/c/g;x?y#s"), + array("", "http://a/b/c/d;p?q"), + array(".", "http://a/b/c/"), + array("./", "http://a/b/c/"), + array("..", "http://a/b/"), + array("../", "http://a/b/"), + array("../g", "http://a/b/g"), + array("../..", "http://a/"), + array("../../", "http://a/"), + array("../../g", "http://a/g") + ); + + foreach($rfcTests as $i=>$test) { + $cases[] = array( + 'test rfc ' . $i, 'http://a/b/c/d;p?q', $test[0], $test[1] + ); + } + + return $cases; + } +}
A vendor/mf2/mf2/tests/Mf2/bootstrap.php

@@ -0,0 +1,3 @@

+<?php + +require dirname(__DIR__) . '/../vendor/autoload.php';
A vendor/mf2/mf2/tests/Mf2/fberriman.com.html

@@ -0,0 +1,286 @@

+<!DOCTYPE html> +<!--[if IE 7]> +<html class="ie ie7" lang="en-US"> +<![endif]--> +<!--[if IE 8]> +<html class="ie ie8" lang="en-US"> +<![endif]--> +<!--[if !(IE 7) | !(IE 8) ]><!--> +<html lang="en-US"> +<!--<![endif]--> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width"> + <title>fberriman | a blog for frances</title> + <link rel="profile" href="http://gmpg.org/xfn/11"> + <link rel="pingback" href="http://fberriman.com/xmlrpc.php"> + <!--[if lt IE 9]> + <script src="http://fberriman.com/wp-content/themes/twentythirteen/js/html5.js"></script> + <![endif]--> + <link rel="alternate" type="application/rss+xml" title="fberriman &raquo; Feed" href="http://fberriman.com/feed/" /> +<link rel="alternate" type="application/rss+xml" title="fberriman &raquo; Comments Feed" href="http://fberriman.com/comments/feed/" /> +<link rel='stylesheet' id='twentythirteen-fonts-css' href='//fonts.googleapis.com/css?family=Source+Sans+Pro%3A300%2C400%2C700%2C300italic%2C400italic%2C700italic%7CBitter%3A400%2C700&#038;subset=latin%2Clatin-ext' type='text/css' media='all' /> +<link rel='stylesheet' id='genericons-css' href='http://fberriman.com/wp-content/themes/twentythirteen/fonts/genericons.css?ver=2.09' type='text/css' media='all' /> +<link rel='stylesheet' id='twentythirteen-style-css' href='http://fberriman.com/wp-content/themes/twentythirteen/style.css?ver=2013-07-18' type='text/css' media='all' /> +<!--[if lt IE 9]> +<link rel='stylesheet' id='twentythirteen-ie-css' href='http://fberriman.com/wp-content/themes/twentythirteen/css/ie.css?ver=2013-07-18' type='text/css' media='all' /> +<![endif]--> +<script type='text/javascript' src='http://fberriman.com/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script> +<script type='text/javascript' src='http://fberriman.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script> +<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://fberriman.com/xmlrpc.php?rsd" /> +<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://fberriman.com/wp-includes/wlwmanifest.xml" /> +<meta name="generator" content="WordPress 3.6" /> + <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style> + <style type="text/css" id="twentythirteen-header-css"> + .site-header { + background: url(http://fberriman.com/wp-content/themes/twentythirteen/images/headers/star.png) no-repeat scroll top; + background-size: 1600px auto; + } + .site-title, + .site-description { + color: #000000; + } + </style> + </head> + +<body class="home blog single-author sidebar"> + <div id="page" class="hfeed site"> + <header id="masthead" class="site-header" role="banner"> + <a class="home-link" href="http://fberriman.com/" title="fberriman" rel="home"> + <h1 class="site-title">fberriman</h1> + <h2 class="site-description">a blog for frances</h2> + </a> + + <div id="navbar" class="navbar"> + <nav id="site-navigation" class="navigation main-navigation" role="navigation"> + <h3 class="menu-toggle">Menu</h3> + <a class="screen-reader-text skip-link" href="#content" title="Skip to content">Skip to content</a> + <div class="nav-menu"><ul><li class="page_item page-item-11"><a href="http://fberriman.com/about-me/">About me</a></li><li class="page_item page-item-151"><a href="http://fberriman.com/portfolio/">Hire me</a></li></ul></div> + <form role="search" method="get" class="search-form" action="http://fberriman.com/"> + <label> + <span class="screen-reader-text">Search for:</span> + <input type="search" class="search-field" placeholder="Search &hellip;" value="" name="s" title="Search for:" /> + </label> + <input type="submit" class="search-submit" value="Search" /> + </form> </nav><!-- #site-navigation --> + </div><!-- #navbar --> + </header><!-- #masthead --> + + <div id="main" class="site-main"> + + <div id="primary" class="content-area"> + <div id="content" class="site-content" role="main"> + + +<article id="post-976" class="post-976 post type-post status-publish format-standard hentry category-speaking category-web-dev tag-conferences tag-front-trends tag-fronttrends tag-speaking tag-txjs"> + <header class="entry-header"> + + <h1 class="entry-title"> + <a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/" rel="bookmark">April recap &#8211; TXJS &#038; Front-Trends</a> + </h1> + + <div class="entry-meta"> + <span class="date"><a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/" title="Permalink to April recap &#8211; TXJS &amp; Front-Trends" rel="bookmark"><time class="entry-date" datetime="2013-05-14T11:54:06+00:00">May 14, 2013</time></a></span><span class="categories-links"><a href="http://fberriman.com/category/speaking/" title="View all posts in Speaking" rel="category tag">Speaking</a>, <a href="http://fberriman.com/category/web-dev/" title="View all posts in Web Dev" rel="category tag">Web Dev</a></span><span class="tags-links"><a href="http://fberriman.com/tag/conferences/" rel="tag">conferences</a>, <a href="http://fberriman.com/tag/front-trends/" rel="tag">front-trends</a>, <a href="http://fberriman.com/tag/fronttrends/" rel="tag">fronttrends</a>, <a href="http://fberriman.com/tag/speaking/" rel="tag">Speaking</a>, <a href="http://fberriman.com/tag/txjs/" rel="tag">txjs</a></span><span class="author vcard"><a class="url fn n" href="http://fberriman.com/author/admin/" title="View all posts by Frances" rel="author">Frances</a></span> </div><!-- .entry-meta --> + </header><!-- .entry-header --> + + <div class="entry-content"> + <p>April was pretty decent. I got to attend two very good conferences <strong>and</strong> I got to speak at them. </p> +<h2><a href="http://2013.texasjavascript.com/">TXJS</a>, Austin, USA</h2> +<p>Austin! One of my favourite cities (mostly because <a href="http://www.flickr.com/photos/phae_/8649913228/in/photostream">I love tacos</a>). Was very pleased to be asked to return to this conference after I spoke there <a href="http://fberriman.com/2012/06/14/designing-better-user-experiences-txjs-2012/">last year</a>. The day was remarkable, if only because it&#8217;s one of the first conferences in a very long time where I actually watched all of the talks (although <a href="http://rmurphey.com/">Rebecca</a>, being on before me, may have only had half of my attention). Really a very well curated day, and I felt very lucky to be in the line-up.</p> +<p><a href="http://alexsexton.com/">Alex</a> was not overly prescriptive in what I should talk about, but suggested he liked the content of last year and would like a little more on that. So, I decided to pick an aspect about that that I felt was important to us at <a href="http://digital.cabinetoffice.gov.uk">GDS</a> and fundamental to the success of our <a href="https://www.gov.uk/designprinciples">Design Principles</a>.</p> +<p>For me, it&#8217;s been our honesty and simple language. The words that we&#8217;ve used to talk about user needs, technical aspects of the site and the ethos have been plain and no-nonsense. I think this is hugely down to the strength of a team that has the confidence to cut through bullshit and say what it really means &#8211; <a href="http://russelldavies.typepad.com">Russell</a> and <a href="http://twitter.com/escmum">Sarah</a> are particularly brilliant at this, and have had huge parts to play in getting this cult of simple down in writing.</p> +<p>The tech scene is sort of rife with nonsense words. Buzzwords and clichés and the new name for the next big thing, which is actually the new name for the same old sensible thing &#8211; but with better marketing and a twitter hashtag. Ugh. I want a lot less of that in our world.</p> +<p>So, I picked on a few of these and showed a few examples from how we&#8217;re dealing with them at GDS. I believe the video for that talk is out now, but <a href="https://speakerdeck.com/phae/culture-change-for-creating-better-user-experiences">the slides are here</a>.</p> +<h2><a href="2013.front-trends.com">Front-Trends</a>, Warsaw, Poland</h2> +<p>I attended this conference last year &#8211; definitely a favourite for its surprisingly sunny weather and for being one of the most friendly events I had been to in 2012. So, I was really glad to get to come back and share our Design Principles with the crowd. </p> +<p>It was very similar to the talk I gave at TXJS last year, except we&#8217;ve done a whole lot more at GDS since June of last year &#8211; we released v1.0 of <a href="http://www.gov.uk">gov.uk</a>, and a bunch of other stuff like the <a href="http://www.gov.uk/performance">performance platform</a>, <a href="http://www.gov.uk/government">Inside Government</a> (and the <a href="http://digital.cabinetoffice.gov.uk/2013/04/30/24-departments-later/">24 departments</a>) and <a href="http://digital.cabinetoffice.gov.uk/2013/03/25/fco-travel-services-check-in/">foreign travel advice</a>, to name a few. I showcased some of these things, and then went through the design principles with the lovely, receptive, Polish audience and it seemed to go over rather well. The slides for this <a href="https://speakerdeck.com/phae/culture-change-how-to-make-better-user-experiences-a-priority-in-your-organisation">version of the talk are here</a>.</p> +<p>Three days are a lot for a conference, but it was really high quality through-out and the breadth of subjects was really great. I wouldn&#8217;t recommend putting the party on the second night again, however &#8211; that last morning was something of a challenge. :)</p> + </div><!-- .entry-content --> + + <footer class="entry-meta"> + <div class="comments-link"> + <a href="http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/#respond" title="Comment on April recap &#8211; TXJS &amp; Front-Trends"><span class="leave-reply">Leave a comment</span></a> </div><!-- .comments-link --> + + </footer><!-- .entry-meta --> +</article><!-- #post --> + +<article id="post-959" class="post-959 post type-post status-publish format-standard hentry category-life tag-data-tracking tag-jawbone tag-review tag-up"> + <header class="entry-header"> + + <h1 class="entry-title"> + <a href="http://fberriman.com/2013/05/08/jawbone-up-review/" rel="bookmark">Jawbone Up Review</a> + </h1> + + <div class="entry-meta"> + <span class="date"><a href="http://fberriman.com/2013/05/08/jawbone-up-review/" title="Permalink to Jawbone Up Review" rel="bookmark"><time class="entry-date" datetime="2013-05-08T13:34:21+00:00">May 8, 2013</time></a></span><span class="categories-links"><a href="http://fberriman.com/category/life/" title="View all posts in Life" rel="category tag">Life</a></span><span class="tags-links"><a href="http://fberriman.com/tag/data-tracking/" rel="tag">data tracking</a>, <a href="http://fberriman.com/tag/jawbone/" rel="tag">jawbone</a>, <a href="http://fberriman.com/tag/review/" rel="tag">review</a>, <a href="http://fberriman.com/tag/up/" rel="tag">up</a></span><span class="author vcard"><a class="url fn n" href="http://fberriman.com/author/admin/" title="View all posts by Frances" rel="author">Frances</a></span> </div><!-- .entry-meta --> + </header><!-- .entry-header --> + + <div class="entry-content"> + <p>I&#8217;ve had a fair few people ask about the <a href="https://jawbone.com/up">Jawbone Up</a> I&#8217;ve been wearing since November (the second version, not the recalled first one &#8211; although, as you&#8217;ll read, perhaps this one should have been too). Here&#8217;s how I&#8217;ve found it.</p> +<h3>The good</h3> +<p>The reason I waited on the Up, over say the <a href="http://www.nike.com/us/en_us/c/nikeplus-fuelband">Nike Fuelband</a>, was because I wanted a wrist-wearable tracker <em>plus</em> sleep data. The <a href="http://www.fitbit.com/uk/one">FitBit One</a> has a wearable night-time band, but it looks rather large and cumbersome and I didn&#8217;t want a clothes-clip tracker in the day time (where do dress wearers clip them?).</p> +<p><a href="http://www.flickr.com/photos/phae_/8241147038/"><img class="alignleft" alt="Jawbone Up" src="http://farm9.staticflickr.com/8479/8241147038_46f04ae51b_m.jpg" width="240" height="240" /></a></p> +<p>The Up band&#8217;s size is really good and it&#8217;s comfy and it doesn&#8217;t look ridiculous.</p> +<p>I like the sleep tracking, although I feel like it&#8217;s not terribly accurate &#8211; if I wake and don&#8217;t move around much, it doesn&#8217;t record it as a waking period &#8211; but it&#8217;s accurate enough to collect the information I&#8217;m interested in.</p> +<p>I have been a bad sleeper for a long time, but having actual data about the length of time I&#8217;ve been asleep and awake has helped reduce my anxiety about a bad night&#8217;s sleep (it always feels like a lifetime when you&#8217;re awake in the middle of the night and don&#8217;t want to be &#8211; but turns out it isn&#8217;t), which in turn has helped improve how well I go to sleep generally, I think.</p> +<p>I also like the smart-alarm &#8211; before I&#8217;d put off looking at the clock to see the time, but the gentle nudge that, yes, it is about time I got up is really useful, and again, anxiety reducing.</p> +<p>The steps tracking seems fine. I&#8217;ve never bothered to calibrate it, since I don&#8217;t do much exercise except walking &#8211; but it seems to match the distances I do regularly around the city. It&#8217;s fun &#8211; I&#8217;m not competing, so it&#8217;s mostly just interesting. I hear from others that it basically can&#8217;t cope with running or cycling, though.</p> +<h3>The bad</h3> +<p>It broke. <em>Twice</em>. The first time, it broke after about 6 weeks &#8211; the vibration feature (needed for the smart-alarm and idle alert) just stopped working for no apparent reason. At the time, the Up band wasn&#8217;t out in the UK, so Jawbone were not willing to replace it (ugh) but when I said I&#8217;d be in New York for a week, they agreed to courier me a replacement to the Google office there while I was in town &#8211; which I think was really just a nice act on the part of one very good customer service rep I&#8217;d met on the support forums. Had I not been on the forum or nagged on twitter, I suspect I&#8217;d have been left out of pocket.</p> +<p>Unfortunately, the second band stopped working a couple of months later. The smart-alarm feature became temperamental and often wouldn&#8217;t go off at all, and the button on the end of the band had become dislodged and no longer clicked. This time, the band was out in the UK, and they sent me another one immediately.</p> +<p>I&#8217;ve been wearing the third one for about a week and I honestly expect it&#8217;ll break soon, too, sadly. <a href="http://e26.co.uk/" rel="friend met colleague">Edd</a>, who originally picked up my first band for me while he was in New York, had his first and second bands break too (the second after only 2 weeks) &#8211; so the statistical data I have available to me is not very favourable and a quick look through the forums will find most people in similar situations.</p> +<h3>The other stuff</h3> +<p>They just released third-party app integration, but sadly on iOS devices only (I use a Nexus 4 day to day, so syncing with an iOS device is an extra annoyance if I want to use those features). I expect that&#8217;ll help make the data the band is recording more interesting.</p> +<p>Otherwise, these are things I wish it had:</p> +<ul> +<li>A visible metre or <strong>something</strong> on the band. I have to sync it with my phone to find out how I&#8217;m doing. It doesn&#8217;t even tell me the time. I feel like it&#8217;s not providing me with much in return for the space it&#8217;s taking up on my wrist.</li> +<li>There&#8217;s no web view &#8211; the only way to share the data is through facebook (meh) or if your friend is also an Up user (which is basically no one). I&#8217;d like to be able to let my <a href="http://infrequently.org" rel="spouse met">husband</a> see my sleep data &#8211; then he&#8217;ll know that I&#8217;m just grumpy because I&#8217;m tired. He can sneak a look at it on my phone, I guess, but it would just be nice to have a public view somewhere on the web.</li> +<li>The food and mood logging is boring and pointless. It may be that the new app integration gives this value, but it was onerous and I gave up after a week. The insights offered to you only ever related to steps and sleep, so no matter how much food and mood you logged, it was for your own entertainment only. These features appear to be rather tacked-on.</li> +<li>Some people complain about the lack of wireless sync as a deal-breaker (you sync it via the mic jack). This personally doesn&#8217;t greatly bother me (longer battery life is a reasonable trade), but given that I have to take it off my arm to find out <strong>anything</strong> about it, as mentioned above, then I think it would have been preferential in this case to sync wirelessly.</li> +</ul> +<p>But, these are all minor gripes &#8211; I&#8217;d recommend but for the fact that they clearly have not managed to make a band that doesn&#8217;t expire every 2 months.</p> +<p>I&#8217;m mostly just hoping this band will hold out long enough for the delivery of the <a href="http://www.fitbit.com/uk/flex">Fitbit Flex</a> I just pre-ordered.</p> +<p>Update: My 3rd band has the same smart alarm fault. Sigh.</p> + </div><!-- .entry-content --> + + <footer class="entry-meta"> + <div class="comments-link"> + <a href="http://fberriman.com/2013/05/08/jawbone-up-review/#comments" title="Comment on Jawbone Up Review">One comment so far</a> </div><!-- .comments-link --> + + </footer><!-- .entry-meta --> +</article><!-- #post --> + +<article id="post-932" class="post-932 post type-post status-publish format-standard hentry category-books category-web-dev category-writing-2 tag-books tag-charity tag-published tag-the-pastry-box-project"> + <header class="entry-header"> + + <h1 class="entry-title"> + <a href="http://fberriman.com/2013/01/14/back-the-pastry-box-book/" rel="bookmark">Back the Pastry Box Book</a> + </h1> + + <div class="entry-meta"> + <span class="date"><a href="http://fberriman.com/2013/01/14/back-the-pastry-box-book/" title="Permalink to Back the Pastry Box Book" rel="bookmark"><time class="entry-date" datetime="2013-01-14T17:58:08+00:00">January 14, 2013</time></a></span><span class="categories-links"><a href="http://fberriman.com/category/books/" title="View all posts in Books" rel="category tag">Books</a>, <a href="http://fberriman.com/category/web-dev/" title="View all posts in Web Dev" rel="category tag">Web Dev</a>, <a href="http://fberriman.com/category/writing-2/" title="View all posts in Writing" rel="category tag">Writing</a></span><span class="tags-links"><a href="http://fberriman.com/tag/books/" rel="tag">Books</a>, <a href="http://fberriman.com/tag/charity/" rel="tag">charity</a>, <a href="http://fberriman.com/tag/published/" rel="tag">published</a>, <a href="http://fberriman.com/tag/the-pastry-box-project/" rel="tag">the pastry box project</a></span><span class="author vcard"><a class="url fn n" href="http://fberriman.com/author/admin/" title="View all posts by Frances" rel="author">Frances</a></span> </div><!-- .entry-meta --> + </header><!-- .entry-header --> + + <div class="entry-content"> + <p><a href="/2012/12/28/baked-posts/">As I mentioned</a>, I wrote for the Pastry Box Project for all of 2012.</p> +<p>Now, it&#8217;s hopefully going to be printed in dead tree form with the royalties going to the <a href="http://www.icrc.org/eng/">Red Cross</a>. That&#8217;s kind of nice, as are many of the fancier offerings at the higher tiers (hand press? illustrations? all sorts!).</p> +<p>So, if you&#8217;re a fan of paper and of the folks that wrote last year, <a href="https://backified.com/pastry-box-2012/project/">the details are all available here</a>. </p> +<p>It&#8217;s being crowd sourced, so it&#8217;ll only be as successful as your interest allows. That&#8217;s how the internet works now, or something.</p> + </div><!-- .entry-content --> + + <footer class="entry-meta"> + <div class="comments-link"> + <a href="http://fberriman.com/2013/01/14/back-the-pastry-box-book/#respond" title="Comment on Back the Pastry Box Book"><span class="leave-reply">Leave a comment</span></a> </div><!-- .comments-link --> + + </footer><!-- .entry-meta --> +</article><!-- #post --> + + <nav class="navigation paging-navigation" role="navigation"> + <h1 class="screen-reader-text">Posts navigation</h1> + <div class="nav-links"> + + <div class="nav-previous"><a href="http://fberriman.com/page/2/" ><span class="meta-nav">&larr;</span> Older posts</a></div> + + + </div><!-- .nav-links --> + </nav><!-- .navigation --> + + + </div><!-- #content --> + </div><!-- #primary --> + + <div id="tertiary" class="sidebar-container" role="complementary"> + <div class="sidebar-inner"> + <div class="widget-area"> + <aside id="linkcat-71" class="widget widget_links"><h3 class="widget-title">Me Elsewhere</h3> + <ul class='xoxo blogroll'> +<li><a href="http://www.dopplr.com/traveller/fberriman/public" rel="me" title="My travel plans">Dopplr</a></li> +<li><a href="http://flickr.com/photos/phae_/" rel="me">Flickr</a></li> +<li><a href="https://github.com/phae" rel="me">Github</a></li> +<li><a href="http://thisismyjam.com/phae" rel="me">Jam</a></li> +<li><a href="http://lanyrd.com/people/phae/" rel="me">Lanyrd</a></li> +<li><a href="http://www.last.fm/user/Phae/" rel="me">Last.fm</a></li> +<li><a href="http://www.linkedin.com/in/fberriman" rel="me">LinkedIn</a></li> +<li><a href="https://pictures.lytro.com/phae">Lytro</a></li> +<li><a href="http://oo5.whatiminto.com/peeps/phae" rel="me">oo5</a></li> +<li><a href="http://journal.fberriman.com/">Tumblr</a></li> +<li><a href="http://twitter.com/phae" rel="me">Twitter</a></li> + + </ul> +</aside> +<aside id="recent-comments-3" class="widget widget_recent_comments"><h3 class="widget-title">Recent Comments</h3><ul id="recentcomments"><li class="recentcomments"><a href='http://www.siiimplified.com/jawbone-up-second-generation-same-problems/' rel='external nofollow' class='url'>Jawbone Up: Second Generation, Same Problems | Technology : Siiimplified</a> on <a href="http://fberriman.com/2013/05/08/jawbone-up-review/#comment-136683">Jawbone Up Review</a></li><li class="recentcomments"><a href='http://fberriman.com/2013/05/14/april-recap-txjs-front-trends/' rel='external nofollow' class='url'>April recap &#8211; TXJS &amp; Front-Trends | fberriman</a> on <a href="http://fberriman.com/2012/06/14/designing-better-user-experiences-txjs-2012/#comment-97919">Designing better user experiences &#8211; TXJS 2012</a></li><li class="recentcomments"><a href='http://www.nczonline.net/blog/2013/01/21/what-the-nfl-can-teach-us-about-diversity-in-technology/' rel='external nofollow' class='url'>What the NFL can teach us about diversity in technology | NCZOnline</a> on <a href="http://fberriman.com/2013/01/06/conferences-arent-the-problem/#comment-76572">Conferences aren&#8217;t the problem</a></li><li class="recentcomments"><a href='http://fberriman.com/2013/01/14/back-the-pastry-box-book/' rel='external nofollow' class='url'>fberriman &raquo; Back the Pastry Box Book</a> on <a href="http://fberriman.com/2012/12/28/baked-posts/#comment-75476">Baked posts</a></li><li class="recentcomments"><a href='http://www.brucelawson.co.uk/2013/reading-list-36/' rel='external nofollow' class='url'>Bruce Lawson&#8217;s personal site&nbsp; : Reading List</a> on <a href="http://fberriman.com/2013/01/06/conferences-arent-the-problem/#comment-74877">Conferences aren&#8217;t the problem</a></li></ul></aside> </div><!-- .widget-area --> + </div><!-- .sidebar-inner --> + </div><!-- #tertiary --> + + </div><!-- #main --> + <footer id="colophon" class="site-footer" role="contentinfo"> + <div id="secondary" class="sidebar-container" role="complementary"> + <div class="widget-area"> + <aside id="linkcat-71" class="widget widget_links"><h3 class="widget-title">Me Elsewhere</h3> + <ul class='xoxo blogroll'> +<li><a href="http://www.dopplr.com/traveller/fberriman/public" rel="me" title="My travel plans">Dopplr</a></li> +<li><a href="http://flickr.com/photos/phae_/" rel="me">Flickr</a></li> +<li><a href="https://github.com/phae" rel="me">Github</a></li> +<li><a href="http://thisismyjam.com/phae" rel="me">Jam</a></li> +<li><a href="http://lanyrd.com/people/phae/" rel="me">Lanyrd</a></li> +<li><a href="http://www.last.fm/user/Phae/" rel="me">Last.fm</a></li> +<li><a href="http://www.linkedin.com/in/fberriman" rel="me">LinkedIn</a></li> +<li><a href="https://pictures.lytro.com/phae">Lytro</a></li> +<li><a href="http://oo5.whatiminto.com/peeps/phae" rel="me">oo5</a></li> +<li><a href="http://journal.fberriman.com/">Tumblr</a></li> +<li><a href="http://twitter.com/phae" rel="me">Twitter</a></li> + + </ul> +</aside> +<aside id="categories-4" class="widget widget_categories"><h3 class="widget-title">Categories</h3> <ul> + <li class="cat-item cat-item-114"><a href="http://fberriman.com/category/books/" title="View all posts filed under Books">Books</a> +</li> + <li class="cat-item cat-item-179"><a href="http://fberriman.com/category/craft/" title="View all posts filed under Craft">Craft</a> +</li> + <li class="cat-item cat-item-4"><a href="http://fberriman.com/category/design/" title="View all posts filed under Design">Design</a> +</li> + <li class="cat-item cat-item-150"><a href="http://fberriman.com/category/external-posts/" title="View all posts filed under external posts">external posts</a> +</li> + <li class="cat-item cat-item-115"><a href="http://fberriman.com/category/film/" title="View all posts filed under Film">Film</a> +</li> + <li class="cat-item cat-item-5"><a href="http://fberriman.com/category/games/" title="View all posts filed under Games">Games</a> +</li> + <li class="cat-item cat-item-178"><a href="http://fberriman.com/category/illustration/" title="View all posts filed under Illustration">Illustration</a> +</li> + <li class="cat-item cat-item-6"><a href="http://fberriman.com/category/life/" title="View all posts filed under Life">Life</a> +</li> + <li class="cat-item cat-item-7"><a href="http://fberriman.com/category/microformats/" title="View all posts filed under Microformats">Microformats</a> +</li> + <li class="cat-item cat-item-9"><a href="http://fberriman.com/category/music/" title="View all posts filed under Music">Music</a> +</li> + <li class="cat-item cat-item-10"><a href="http://fberriman.com/category/site/" title="View all posts filed under Site">Site</a> +</li> + <li class="cat-item cat-item-11"><a href="http://fberriman.com/category/speaking/" title="View all posts filed under Speaking">Speaking</a> +</li> + <li class="cat-item cat-item-12"><a href="http://fberriman.com/category/travel/" title="View all posts filed under Travel">Travel</a> +</li> + <li class="cat-item cat-item-13"><a href="http://fberriman.com/category/web-dev/" title="View all posts filed under Web Dev">Web Dev</a> +</li> + <li class="cat-item cat-item-15"><a href="http://fberriman.com/category/website/" title="View all posts filed under Website">Website</a> +</li> + <li class="cat-item cat-item-230"><a href="http://fberriman.com/category/writing-2/" title="View all posts filed under Writing">Writing</a> +</li> + </ul> +</aside><aside id="meta-3" class="widget widget_meta"><h3 class="widget-title">Meta</h3> <ul> + <li><a href="http://fberriman.com/wp-login.php">Log in</a></li> + <li><a href="http://fberriman.com/feed/" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li> + <li><a href="http://fberriman.com/comments/feed/" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li> + <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li> </ul> +</aside> </div><!-- .widget-area --> + </div><!-- #secondary --> + + <div class="site-info"> + <a href="http://wordpress.org/" title="Semantic Personal Publishing Platform">Proudly powered by WordPress</a> + </div><!-- .site-info --> + </footer><!-- #colophon --> + </div><!-- #page --> + + <script type='text/javascript' src='http://fberriman.com/wp-includes/js/jquery/jquery.masonry.min.js?ver=2.1.05'></script> +<script type='text/javascript' src='http://fberriman.com/wp-content/themes/twentythirteen/js/functions.js?ver=2013-07-18'></script> +</body> +</html>
A vendor/mf2/mf2/tests/Mf2/snarfed.org.html

@@ -0,0 +1,335 @@

+<!DOCTYPE html> +<html lang="en-US"> +<head> +<meta charset="UTF-8" /> +<meta name="viewport" content="width=device-width" /> +<title>oauth-dropins | snarfed.org</title> +<link rel="profile" href="http://gmpg.org/xfn/11" /> +<link rel="pingback" href="http://snarfed.org/w/xmlrpc.php" /> +<!--[if lt IE 9]> +<script src="http://snarfed.org/w/wp-content/themes/ryu/js/html5.js" type="text/javascript"></script> +<![endif]--> + +<link rel="alternate" type="application/rss+xml" title="snarfed.org &raquo; Feed" href="http://snarfed.org/feed" /> +<link rel="alternate" type="application/rss+xml" title="snarfed.org &raquo; Comments Feed" href="http://snarfed.org/comments/feed" /> +<link rel="alternate" type="application/rss+xml" title="snarfed.org &raquo; oauth-dropins Comments Feed" href="http://snarfed.org/2013-10-23_oauth-dropins/feed" /> +<link rel='stylesheet' id='nextgen_gallery_related_images-css' href='http://snarfed.org/w/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/nextgen_gallery_display/static/nextgen_gallery_related_images.css?ver=3.7' type='text/css' media='all' /> +<link rel='stylesheet' id='jetpack-widgets-css' href='http://snarfed.org/w/wp-content/plugins/jetpack/modules/widgets/widgets.css?ver=20121003' type='text/css' media='all' /> +<link rel='stylesheet' id='ryu-style-css' href='http://snarfed.org/w/wp-content/themes/snarfed-ryu/style.css?ver=3.7' type='text/css' media='all' /> +<link rel='stylesheet' id='ryu-lato-css' href='http://fonts.googleapis.com/css?family=Lato:100,300,400,700,900,100italic,300italic,400italic,700italic,900italic' type='text/css' media='all' /> +<link rel='stylesheet' id='ryu-playfair-display-css' href='http://fonts.googleapis.com/css?family=Playfair+Display:400,700,900,400italic,700italic,900italic&#038;subset=latin,latin-ext' type='text/css' media='all' /> +<script type='text/javascript' src='http://snarfed.org/w/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script> +<script type='text/javascript' src='http://snarfed.org/w/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script> +<script type='text/javascript'> +/* <![CDATA[ */ +var photocrati_ajax = {"url":"http:\/\/snarfed.org\/photocrati_ajax","wp_site_url":"http:\/\/snarfed.org","wp_site_static_url":"http:\/\/snarfed.org\/w"}; +/* ]]> */ +</script> +<script type='text/javascript' src='http://snarfed.org/w/wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ajax/static/ajax.js?ver=3.7'></script> +<link rel='prev' title='RSVP: #Indieweb catchup' href='http://snarfed.org/2013-10-22_rsvp-indieweb-catchup' /> + +<link rel='canonical' href='http://snarfed.org/2013-10-23_oauth-dropins' /> +<link rel='shortlink' href='http://wp.me/p3EDAq-1XE' /> +<link rel="openid2.provider" href="https://www.google.com/accounts/o8/ud?source=profiles"> +<link rel="openid2.local_id" href="http://www.google.com/profiles/heaven"> +<link href="https://plus.google.com/103651231634018158746" rel="publisher" /> +<meta property="fb:admins" content="212038" /> + +<script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', 'UA-11785301-1']); + _gaq.push(['_trackPageview']); + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); +</script> + +<!-- <meta name="NextGEN" version="2.0.33" /> --> +<link rel="http://webmention.org/" href="http://snarfed.org/w/?webmention=endpoint" /> +<style type='text/css'>img#wpstats{display:none}</style> +<!-- Jetpack Open Graph Tags --> +<meta property="og:type" content="article" /> +<meta property="og:title" content="oauth-dropins" /> +<meta property="og:url" content="http://snarfed.org/2013-10-23_oauth-dropins" /> +<meta property="og:description" content="Need to use an [OAuth](http://oauth.net/)-protected API in a Python webapp? [oauth-dropins](https://github.com/snarfed/oauth-dropins) is for you! It&#039;s a collection of drop-in OAuth client flows for..." /> +<meta property="og:site_name" content="snarfed.org" /> +<meta property="og:image" content="/oauth_shiny.png" /> +<meta name="twitter:site" content="@snarfed_org" /> +<meta name="twitter:image" content="/oauth_shiny.png" /> +<meta name="twitter:card" content="summary" /> +<meta name="twitter:description" content="Need to use an [OAuth](http://oauth.net/)-protected API in a Python webapp? [oauth-dropins](https://github.com/snarfed/oauth-dropins) is for you! It&#039;s a collection of drop-in OAuth client flows for..." /> + <style type="text/css"> + .site-title, + .site-description { + position: absolute; + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px, 1px, 1px, 1px); + } + .header-image { + margin-bottom: 0; + } + </style> + <link rel="stylesheet" id="custom-css-css" type="text/css" href="http://snarfed.org/?custom-css=1&#038;csblog=1&#038;cscache=6&#038;csrev=45" /> + </head> + +<body class="single single-post postid-7542 single-format-standard h-entry hentry h-as-article"> + + +<div id="page" class="site"> + <div id="widgets-wrapper" class="toppanel hide"> + <div id="secondary" role="complementary" class="wrap clear one"> + <div id="top-sidebar-one" class="widget-area" role="complementary"> + <aside id="text-2" class="widget widget_text"> <div class="textwidget"><div class="h-card vcard"> +<div id="my-header"> +I'm <a id="my-name" href="/about" class="p-name fn">Ryan Barrett</a>.<br /> +I <a href="/house">live</a>, <a href="/resume">work</a>, and <a href="/pictures">play</a> in San Francisco.<br /> +I <a href="/software">code</a>, <a href="/tag/essay">write</a>, and post <a href="/pictures">pictures</a> here. +</div> +<img class="u-photo photo" src="http://snarfed.org/ryan_profile_square_thumb.jpg" style="display: none" /> + +<ul id="my-icons"> + <li class="home-link"> + <a href="http://snarfed.org/" class="genericon url u-url" title="Home"> + <span class="screen-reader-text">Home</span> + </a> + </li> + <li class="search-trigger"> + <a href="#" class="genericon" title="Search"> + <span class="screen-reader-text">Search</span> + </a> + </li> + <li class="archives-link"> + <a href="/archive" class="genericon" title="Archives"> + <span class="screen-reader-text">Archives</span> + </a> + </li> + <li class="twitter-link"> + <a rel="me" href="https://twitter.com/snarfed_org" class="genericon" title="Twitter" target="_blank"> + <span class="screen-reader-text">Twitter</span> + </a> + </li> + <li class="facebook-link"> + <a rel="me" href="https://www.facebook.com/snarfed.org" class="genericon" title="Facebook" target="_blank"> + <span class="screen-reader-text">Facebook</span> + </a> + </li> + <li class="google-link"> + <a rel="me" href="https://plus.google.com/103651231634018158746" class="genericon" title="Google+" target="_blank"> + <span class="screen-reader-text">Google+</span> + </a> + </li> + <li class="github-link"> + <a rel="me" href="https://github.com/snarfed" class="genericon" title="GitHub" target="_blank"> + <span class="screen-reader-text">GitHub</span> + </a> + </li> + <li class="feed-link"> + <a href="/feed" class="genericon" title="RSS Feed"> + <span class="screen-reader-text">RSS Feed</span> + </a> + </li> +</ul> +</div></div> + </aside> </div><!-- #first .widget-area --> + + + + </div><!-- #secondary --> </div> + + + <div id="search-wrapper" class="toppanel hide"> + +<form method="get" id="searchform" class="searchform" action="http://snarfed.org/" role="search"> + <label for="s" class="screen-reader-text">Search</label> + <input type="search" class="field" name="s" value="" id="s" placeholder="Search &hellip;" /> + <input type="submit" class="submit" id="searchsubmit" value="Search" /> +</form> </div> + + <div id="triggers-wrapper"> + <ul class="triggers clear"> + <li class="widgets-trigger"> + <a href="#" class="genericon" title="Widgets"> + <span class="screen-reader-text">Widgets</span> + </a> + </li> + + + <li class="search-trigger"> + <a href="#" class="genericon" title="Search"> + <span class="screen-reader-text">Search</span> + </a> + </li> + </ul> + </div> + + <header id="masthead" class="site-header" role="banner"> + <div class="wrap"> + + <a class="site-logo" href="http://snarfed.org/" title="snarfed.org" rel="home"> + <img src="http://snarfed.org/w/wp-content/uploads/2013/06/copy-cropped-iraq_bar.jpg" width="1500" height="213" alt="" class="no-grav header-image" /> + </a> + + <hgroup> + <h1 class="site-title"><a href="http://snarfed.org/" title="snarfed.org" rel="home">snarfed.org</a></h1> + <h2 class="site-description">Ryan Barrett&#039;s blog</h2> + </hgroup> + </div><!-- .wrap --> + + </header><!-- #masthead --> + + <div id="main" class="site-main"> + <div id="primary" class="content-area"> + <div id="content" class="site-content" role="main"> + + + +<article id="post-7542" class="post-7542 post type-post status-publish format-standard category-uncategorized clear"> + <div class="entry-wrap wrap clear"> + + <header class="entry-header"> + <span class="categories-links"><a href="http://snarfed.org/category/uncategorized" title="View all posts in Uncategorized" rel="category tag">Uncategorized</a></span><h1 class="entry-title"><span class='p-name'>oauth-dropins</span></h1> </header><!-- .entry-header --> + + <footer class="entry-meta"> + <span class="entry-date"><a href="http://snarfed.org/2013-10-23_oauth-dropins" title="10:32am" rel="bookmark"><time class="dt-published" datetime="2013-10-23T10:32:06+00:00">10/23/2013</time></a></span><span class="author h-card vcard"> <img alt='' src='http://1.gravatar.com/avatar/947b5f3f323da0ef785b6f02d9c265d6?s=96&amp;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&amp;r=G' class='u-photo avatar avatar-96 photo' height='96' width='96' /><a class="u-url url fn n p-name" href="http://snarfed.org/" title="Ryan Barrett" rel="author">Ryan Barrett</a></span> + <span class="comments-link"><a href="http://snarfed.org/2013-10-23_oauth-dropins#comments" title="Comment on oauth-dropins">1 Comment</a></span> + + </footer><!-- .entry-meta --> + + <div class="entry-content clear"> + <div class='e-content'><p class="third right"> +<a href="https://oauth-dropins.appspot.com/"><img src="/oauth_shiny.png" /></a> +</p> + +<p>Need to use an <a href="http://oauth.net/">OAuth</a>-protected API in a Python webapp? +<a href="https://github.com/snarfed/oauth-dropins">oauth-dropins</a> is for you! It&#8217;s a +collection of drop-in OAuth client flows for many popular sites. It supports +Facebook, Twitter, Google+, Instagram, Dropbox, Blogger, Tumblr, and +WordPress.com, with more on the way. It also currently requires +<a href="https://appengine.google.com/">Google App Engine</a>, but should support other +platforms in the future.</p> + +<p><a href="https://oauth-dropins.appspot.com/">Try the demo!</a><span id="more-7542"></span><span /></p> + +<p>You can use oauth-dropins in your project with just a bit of code. For example, +to use it for Facebook, just add these two lines to your WSGI application:</p> + +<pre> +from oauth_dropins import facebook + +application = webapp2.WSGIApplication([ + ... + <b>('/facebook/start_oauth', facebook.StartHandler.to('/facebook/oauth_callback')),</b> + <b>('/facebook/oauth_callback', facebook.CallbackHandler.to('/next'))</b>, + ] +</pre> + +<p>Then map those URLs in your +<a href="https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_Script_handlers">app.yaml</a> +and put your <a href="https://developers.facebook.com/apps">Facebook app</a>&#8216;s key and +secret in <code>facebook_app_id</code> and <code>facebook_app_secret</code> files in your app&#8217;s root +directory, and you&#8217;re good to go!</p> + +<p>See the <a href="https://github.com/snarfed/oauth-dropins">GitHub repo</a> for more +details. Happy hacking!</p> +</div> </div><!-- .entry-content --> + + <span class="entry-format-badge genericon"><span class="screen-reader-text">Standard</span></span> + </div><!-- .entry-wrap --> +</article><!-- #post-## --> + + +<div id="comments" class="comments-area"> + <div class="comments-wrap wrap"> + + <h2 class="comments-title"> + One thought on &ldquo;<span>oauth-dropins</span>&rdquo; </h2> + + + <ol class="comment-list"> + <li class="comment even thread-even depth-1 p-comment h-entry" id="li-comment-783020"> + <article id="comment-783020" class="comment"> + <footer> + <div class="comment-author vcard"> + <span class="comment-author-avatar"><img alt='' src='http://0.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=48' class='u-photo avatar avatar-48 photo avatar-default' height='48' width='48' /></span> + <cite class="fn genericon"><a href='http://twitter.com/snarfed_org' rel='external nofollow' class='u-url url'>Ryan Barrett</a></cite> <span class="says">says:</span> </div><!-- .comment-author .vcard --> + </footer> + + <div class="comment-content"> + <div class='e-content p-name p-summary'><p>Need to use an OAuth-ed API in a Python webapp? oauth-dropins is for you! <a href="http://t.co/DHqkNf0OBX" rel="nofollow">http://t.co/DHqkNf0OBX</a> Try the demo: <a href="http://t.co/8Cg0GFAdDb" rel="nofollow">http://t.co/8Cg0GFAdDb</a> <cite><a href="http://twitter.com/snarfed_org/status/393075859000549376" rel="nofollow">via Twitter</a></cite></p> +</div> </div> + + <div class="comment-meta commentmetadata"> + <a href="http://snarfed.org/2013-10-23_oauth-dropins#comment-783020"><time datetime="2013-10-23T11:20:24+00:00"> + 10/23/2013 at 11:20am </time></a> + </div><!-- .comment-meta .commentmetadata --> + </article><!-- #comment-## --> + + </li><!-- #comment-## --> + </ol><!-- .comment-list --> + + + + + <div id="respond" class="comment-respond"> + <h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/2013-10-23_oauth-dropins#respond" style="display:none;">Cancel reply</a></small></h3> + <form action="http://snarfed.org/w/wp-comments-post.php" method="post" id="commentform" class="comment-form"> + <p class="comment-notes">Your email address will not be published.</p> <p class="comment-form-author"><label for="author">Name</label> <input id="author" name="author" type="text" value="" size="30" /></p> +<p class="comment-form-email"><label for="email">Email</label> <input id="email" name="email" type="text" value="" size="30" /></p> +<p class="comment-form-url"><label for="url">Website</label> <input id="url" name="url" type="text" value="" size="30" /></p> + <p class="comment-form-comment"><label for="comment">Comment</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p> <p class="form-allowed-tags">You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <code>&lt;a href=&quot;&quot; title=&quot;&quot;&gt; &lt;abbr title=&quot;&quot;&gt; &lt;acronym title=&quot;&quot;&gt; &lt;b&gt; &lt;blockquote cite=&quot;&quot;&gt; &lt;cite&gt; &lt;code&gt; &lt;del datetime=&quot;&quot;&gt; &lt;em&gt; &lt;i&gt; &lt;q cite=&quot;&quot;&gt; &lt;strike&gt; &lt;strong&gt; </code></p> <p class="form-submit"> + <input name="submit" type="submit" id="submit" value="Post Comment" /> + <input type='hidden' name='comment_post_ID' value='7542' id='comment_post_ID' /> +<input type='hidden' name='comment_parent' id='comment_parent' value='0' /> + </p> + <p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="9e21df4fc3" /></p> </form> + </div><!-- #respond --> + + </div><!-- .comments-wrap --> +</div><!-- #comments --> + + </div><!-- #content --> + </div><!-- #primary --> + + + </div><!-- #main --> + + <footer id="colophon" class="site-footer" role="contentinfo"> + <div class="site-info wrap"> + <a href="http://wordpress.org/" title="A Semantic Personal Publishing Platform" rel="generator">Proudly powered by WordPress</a> + <span class="sep"> | </span> + Theme: Ryu by <a href="http://automattic.com/" rel="designer">Automattic</a>. </div><!-- .site-info --> + </footer><!-- #colophon --> +</div><!-- #page --> + + <div style="display:none"> + <div class="grofile-hash-map-947b5f3f323da0ef785b6f02d9c265d6"> + </div> + <div class="grofile-hash-map-d41d8cd98f00b204e9800998ecf8427e"> + </div> + </div> + + <script src="http://stats.wordpress.com/e-201344.js" type="text/javascript"></script> + <script type="text/javascript"> + st_go({v:'ext',j:'1:2.5',blog:'54014302',post:'7542',tz:'-7'}); + var load_cmc = function(){linktracker_init(54014302,7542,2);}; + if ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc); + else load_cmc(); + </script> +<script type='text/javascript' src='http://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201344'></script> +<script type='text/javascript' src='http://s.gravatar.com/js/gprofiles.js?ver=2013Octaa'></script> +<script type='text/javascript'> +/* <![CDATA[ */ +var WPGroHo = {"my_hash":""}; +/* ]]> */ +</script> +<script type='text/javascript' src='http://snarfed.org/w/wp-content/plugins/jetpack/modules/wpgroho.js?ver=3.7'></script> +<script type='text/javascript' src='http://snarfed.org/w/wp-content/themes/ryu/js/skip-link-focus-fix.js?ver=20130115'></script> +<script type='text/javascript' src='http://snarfed.org/w/wp-content/themes/ryu/js/ryu.js?ver=20130319'></script> +</body> +</html> +<!-- Dynamic page generated in 0.502 seconds. --> +<!-- Cached page generated by WP-Super-Cache on 2013-10-30 08:32:04 --> + +<!-- Compression = gzip -->
A vendor/mf2/mf2/tests/test-suite/test-suite-data/adr/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="adr">665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/adr/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-adr"], + "properties": { + "name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/adr/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "adr", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/adr/simpleproperties/input.html

@@ -0,0 +1,8 @@

+<p class="adr"> + <span class="street-address">665 3rd St.</span> + <span class="extended-address">Suite 207</span> + <span class="locality">San Francisco</span>, + <span class="region">CA</span> + <span class="postal-code">94107</span> + <span class="country-name">U.S.A.</span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/adr/simpleproperties/output.json

@@ -0,0 +1,14 @@

+{ + "items": [{ + "type": ["h-adr"], + "properties": { + "street-address": ["665 3rd St."], + "extended-address": ["Suite 207"], + "locality": ["San Francisco"], + "region": ["CA"], + "postal-code": ["94107"], + "country-name": ["U.S.A."], + "name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/adr/simpleproperties/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Broken into properties", + "description": "h-adr", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/adr/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "adr parsing tests", + "description": "This page was design to test the parsing of adr and its output to the newer JSON structure of micorformats 2. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/abbrpattern/input.html

@@ -0,0 +1,4 @@

+<p class="geo"> + <abbr class="latitude" title="37.408183">N 37° 24.491</abbr>, + <abbr class="longitude" title="-122.13855">W 122° 08.313</abbr> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/abbrpattern/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "latitude": ["37.408183"], + "longitude": ["-122.13855"], + "name": ["N 37° 24.491, W 122° 08.313"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/abbrpattern/test.json

@@ -0,0 +1,5 @@

+{ + "name": "The <abbr> tag pattern", + "description": "geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/hidden/input.html

@@ -0,0 +1,10 @@

+<p> + <span class="geo">The Bricklayer's Arms + <span class="latitude"> + <span class="value-title" title="51.513458"> </span> + </span> + <span class="longitude"> + <span class="value-title" title="-0.14812"> </span> + </span> + </span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/hidden/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "latitude": ["51.513458"], + "longitude": ["-0.14812"], + "name": ["The Bricklayer's Arms"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/hidden/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Hidden value-title pattern", + "description": "geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/justaname/input.html

@@ -0,0 +1,3 @@

+<p>On my way to The Bricklayer's Arms + (Geo: <span class="geo">51.513458;-0.14812</span>) +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "name": ["51.513458;-0.14812"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/simpleproperties/input.html

@@ -0,0 +1,6 @@

+We are meeting at +<span class="geo"> + <span>The Bricklayer's Arms</span> + (Geo: <span class="p-latitude">51.513458</span>: + <span class="p-longitude">-0.14812</span>) +</span>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/simpleproperties/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "latitude": ["51.513458"], + "longitude": ["-0.14812"], + "name": ["The Bricklayer's Arms (Geo: 51.513458: -0.14812)"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/simpleproperties/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Broken into properties", + "description": "geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "geo parsing tests", + "description": "This page was design to test the parsing of geo and its output to the newer JSON structure of micorformats 2. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/valuetitleclass/input.html

@@ -0,0 +1,10 @@

+<p> + <span class="geo"> + <span class="latitude"> + <span class="value-title" title="51.513458">N 51° 51.345</span>, + </span> + <span class="longitude"> + <span class="value-title" title="-0.14812">W -0° 14.812</span> + </span> + </span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/valuetitleclass/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "latitude": ["51.513458"], + "longitude": ["-0.14812"], + "name": ["N 51° 51.345, W -0° 14.812"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/geo/valuetitleclass/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Value-title class pattern", + "description": "geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/geo/input.html

@@ -0,0 +1,10 @@

+<p class="h-adr"> + <span class="p-name">Bricklayer's Arms</span> + <span class="p-label"> + <span class="p-street-address">3 Charlotte Road</span>, + <span class="p-locality">City of London</span>, + <span class="p-postal-code">EC2A 3PE</span>, + <span class="p-country-name">UK</span> + </span> – + Geo:(<span class="p-geo">51.526421;-0.081067</span>) +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/geo/output.json

@@ -0,0 +1,14 @@

+{ + "items": [{ + "type": ["h-adr"], + "properties": { + "name": ["Bricklayer's Arms"], + "label": ["3 Charlotte Road, City of London, EC2A 3PE, UK"], + "street-address": ["3 Charlotte Road"], + "locality": ["City of London"], + "postal-code": ["EC2A 3PE"], + "country-name": ["UK"], + "geo": ["51.526421;-0.081067"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/geo/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With geo data", + "description": "h-adr", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/geourl/input.html

@@ -0,0 +1,4 @@

+<p class="h-adr"> + <a class="p-name u-geo" href="geo:51.526421;-0.081067;crs=wgs84;u=40">Bricklayer's Arms</a>, + <span class="p-locality">London</span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/geourl/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-adr"], + "properties": { + "name": ["Bricklayer's Arms"], + "geo": ["geo:51.526421;-0.081067;crs=wgs84;u=40"], + "locality": ["London"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/geourl/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With geo url", + "description": "h-adr", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="h-adr">665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-adr"], + "properties": { + "name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-adr", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/simpleproperties/input.html

@@ -0,0 +1,8 @@

+<p class="h-adr"> + <span class="p-street-address">665 3rd St.</span> + <span class="p-extended-address">Suite 207</span> + <span class="p-locality">San Francisco</span>, + <span class="p-region">CA</span> + <span class="p-postal-code">94107</span> + <span class="p-country-name">U.S.A.</span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/simpleproperties/output.json

@@ -0,0 +1,14 @@

+{ + "items": [{ + "type": ["h-adr"], + "properties": { + "street-address": ["665 3rd St."], + "extended-address": ["Suite 207"], + "locality": ["San Francisco"], + "region": ["CA"], + "postal-code": ["94107"], + "country-name": ["U.S.A."], + "name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/simpleproperties/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Broken into properties", + "description": "h-adr", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-adr/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-adr parsing tests", + "description": "This page was design to test the parsing of h-adr. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/childimplied/input.html

@@ -0,0 +1,6 @@

+<a class="h-card" href="http://people.opera.com/howcome/" title="Håkon Wium Lie, CTO Opera"> + <article> + <h2 class="p-name">Håkon Wium Lie</h2> + <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/9/96/H%C3%A5kon-Wium-Lie-2009-03.jpg/215px-H%C3%A5kon-Wium-Lie-2009-03.jpg" /> + </article> +</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/childimplied/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Håkon Wium Lie"], + "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/9/96/H%C3%A5kon-Wium-Lie-2009-03.jpg/215px-H%C3%A5kon-Wium-Lie-2009-03.jpg"], + "url": ["http://people.opera.com/howcome/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/childimplied/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Single child implied pattern", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/extendeddescription/input.html

@@ -0,0 +1,10 @@

+<div class="h-card"> + <img class="u-photo" alt="photo of Mitchell" src="http://blog.mozilla.org/press/files/2012/04/mitchell-baker.jpg" /> + <p> + <a class="p-name u-url" href="http://blog.lizardwrangler.com/">Mitchell Baker</a> + (<a class="u-url" href="https://twitter.com/MitchellBaker">@MitchellBaker</a>) + <span class="p-org">Mozilla Foundation</span> + </p> + <p class="p-note">Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities.</p> + <p><span class="p-category">Strategy</span> and <span class="p-category">Leadership</span></p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/extendeddescription/output.json

@@ -0,0 +1,13 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "photo": ["http://blog.mozilla.org/press/files/2012/04/mitchell-baker.jpg"], + "url": ["http://blog.lizardwrangler.com/", "https://twitter.com/MitchellBaker"], + "name": ["Mitchell Baker"], + "org": ["Mozilla Foundation"], + "note": ["Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities."], + "category": ["Strategy", "Leadership"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/extendeddescription/test.json

@@ -0,0 +1,5 @@

+{ + "name": "An extended description", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/hcard/input.html

@@ -0,0 +1,4 @@

+<div class="h-card"> + <a class="p-name u-url" href="http://blog.lizardwrangler.com/">Mitchell Baker</a> + (<a class="p-org h-card" href="http://mozilla.org/">Mozilla Foundation</a>) +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/hcard/output.json

@@ -0,0 +1,23 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "url": ["http://blog.lizardwrangler.com/"], + "name": ["Mitchell Baker"], + "org": [{ + "value": "Mozilla Foundation", + "type": ["h-card"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + }] + }
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/hcard/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Organization marked-up with h-card", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/horghcard/input.html

@@ -0,0 +1,4 @@

+<div class="h-card"> + <a class="p-name u-url" href="http://blog.lizardwrangler.com/">Mitchell Baker</a> + (<a class="p-org h-card h-org" href="http://mozilla.org/">Mozilla Foundation</a>) +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/horghcard/output.json

@@ -0,0 +1,28 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Mitchell Baker"], + "url": ["http://blog.lizardwrangler.com/"], + "org": [{ + "value": "Mozilla Foundation", + "type": ["h-card", "h-org"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + },{ + "type": ["h-org"], + "properties": { + "name": ["Mozilla Foundation"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/horghcard/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Organization marked-up with h-card and h-org", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/hyperlinkedphoto/input.html

@@ -0,0 +1,3 @@

+<a class="h-card" href="http://rohit.khare.org/"> + <img alt="Rohit Khare" src="https://twimg0-a.akamaihd.net/profile_images/53307499/180px-Rohit-sq.jpg" /> +</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/hyperlinkedphoto/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Rohit Khare"], + "photo": ["https://twimg0-a.akamaihd.net/profile_images/53307499/180px-Rohit-sq.jpg"], + "url": ["http://rohit.khare.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/hyperlinkedphoto/test.json

@@ -0,0 +1,5 @@

+{ + "name": "A hyperlinked photo", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/justahyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="h-card" href="http://benward.me/">Ben Ward</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/justahyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Ben Ward"], + "url": ["http://benward.me/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="h-card">Frances Berriman</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Frances Berriman"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/nested/input.html

@@ -0,0 +1,4 @@

+<div class="h-card"> + <a class="p-name u-url" href="http://blog.lizardwrangler.com/">Mitchell Baker</a> + (<a class="h-org h-card" href="http://mozilla.org/">Mozilla Foundation</a>) +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/nested/output.json

@@ -0,0 +1,27 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Mitchell Baker"], + "url": ["http://blog.lizardwrangler.com/"] + }, + "children": [{ + "type": ["h-card", "h-org"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + }] + },{ + "type": ["h-card"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + },{ + "type": ["h-org"], + "properties": { + "name": ["Mozilla Foundation"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/nested/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Additional nested microformats", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/p-property/input.html

@@ -0,0 +1,21 @@

+<div class="h-card"> + <!-- innerText and value pattern --> + <span class="p-name"> + <span class="p-given-name value">John</span> + <abbr class="p-additional-name" title="Peter">P</abbr> + <span class="p-family-name value ">Doe</span> + </span> + <data class="p-honorific-suffix" value="MSc"></data> + + <!-- theses should return no value --> + <br class="p-honorific-suffix">BSc</br> + <hr class="p-honorific-suffix">BA</hr> + + <!-- image and area tags --> + <img class="p-honorific-suffix" src="images/logo.gif" alt="PHD" /> + <img src="images/logo.gif" alt="company logos" usemap="#logomap" /> + <map name="logomap"> + <area class="p-org" shape="rect" coords="0,0,82,126" href="madgex.htm" alt="Madgex" /> + <area class="p-org" shape="circle" coords="90,58,3" href="mozilla.htm" alt="Mozilla" /> + </map> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/p-property/output.json

@@ -0,0 +1,13 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["John Doe"], + "given-name": ["John"], + "additional-name": ["Peter"], + "family-name": ["Doe"], + "honorific-suffix": ["MSc","PHD"], + "org": ["Madgex", "Mozilla"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/p-property/test.json

@@ -0,0 +1,5 @@

+{ + "name": "p-property", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-card/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-card parsing tests", + "description": "This page was design to test the parsing of h-card. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/justahyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="h-entry" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/justahyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "h-entry", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="h-entry">microformats.org at 7</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-entry", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-entry parsing tests", + "description": "This page was design to test the parsing of h-entry. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/summarycontent/input.html

@@ -0,0 +1,19 @@

+<div class="h-entry"> + <h1><a class="p-name u-url" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a></h1> + <div class="e-content"> + <p class="p-summary">Last week the microformats.org community + celebrated its 7th birthday at a gathering hosted by Mozilla in + San Francisco and recognized accomplishments, challenges, and + opportunities.</p> + + <p>The microformats tagline “humans first, machines second” + forms the basis of many of our + <a href="http://microformats.org/wiki/principles">principles</a>, and + in that regard, we’d like to recognize a few people and + thank them for their years of volunteer service </p> + </div> + <p>Updated + <time class="dt-updated" datetime="2012-06-25T17:08:26">June 25th, 2012</time> by + <a class="p-author h-card" href="http://tantek.com/">Tantek</a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/summarycontent/output.json

@@ -0,0 +1,28 @@

+{ + "items": [{ + "type": ["h-entry"], + "properties": { + "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"], + "name": ["microformats.org at 7"], + "content": [{ + "value": "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service", + "html": "\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n " + }], + "updated": ["2012-06-25T17:08:26"], + "author": [{ + "value": "Tantek", + "type": ["h-card"], + "properties": { + "name": ["Tantek"], + "url": ["http://tantek.com/"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Tantek"], + "url": ["http://tantek.com/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/summarycontent/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Entry with summary and content", + "description": "h-entry", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/u-property/input.html

@@ -0,0 +1,28 @@

+<div class="h-entry"> + <p class="p-name">microformats.org at 7</p> + + <!-- value and value-title patterns --> + <p class="u-url"> + <span class="value-title" title="http://microformats.org/"> </span> + Article permalink + </p> + <p class="u-url"> + <span class="value">http://microformats.org/</span> - + <span class="value">2012/06/25/microformats-org-at-7</span> + </p> + + <p><a class="u-url" href="http://microformats.org/2012/06/25/microformats-org-at-7">Article permalink</a></p> + + <img src="images/logo.gif" alt="company logos" usemap="#logomap" /> + <map name="logomap"> + <area class="u-url" shape="rect" coords="0,0,82,126" href="http://microformats.org/" alt="microformats.org" /> + </map> + + <img class="u-photo" src="images/logo.gif" alt="company logos" /> + + <object class="u-url" data="http://microformats.org/wiki/microformats2-parsing"></object> + + <abbr class="u-url" title="http://microformats.org/wiki/value-class-pattern">value-class-pattern</abbr> + <data class="u-url" value="http://microformats.org/wiki/"></data> + <p class="u-url">http://microformats.org/discuss</p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/u-property/output.json

@@ -0,0 +1,19 @@

+{ + "items": [{ + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "url": [ + "http://microformats.org/", + "http://microformats.org/2012/06/25/microformats-org-at-7", + "http://microformats.org/2012/06/25/microformats-org-at-7", + "http://microformats.org/", + "http://microformats.org/wiki/microformats2-parsing", + "http://microformats.org/wiki/value-class-pattern", + "http://microformats.org/wiki/", + "http://microformats.org/discuss" + ], + "photo": ["http://example.com/images/logo.gif"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-entry/u-property/test.json

@@ -0,0 +1,5 @@

+{ + "name": "u-property", + "description": "h-entry", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/ampm/input.html

@@ -0,0 +1,41 @@

+<span class="h-event"> + <span class="p-name">The 4th Microformat party</span> will be on + <ul> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00:00pm + </span></li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00:00am + </span></li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00pm + </span></li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07pm + </span></li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">7pm + </span></li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">7:00pm + </span></li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00p.m. + </span></li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00PM + </span></li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">7:00am + </span></li> + </ul> +</span>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/ampm/output.json

@@ -0,0 +1,19 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["The 4th Microformat party"], + "start": [ + "2009-06-26T19:00:00", + "2009-06-26T07:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T07:00:00" + ] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/ampm/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Meridiem time formats (am pm)", + "description": "h-event", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/attendees/input.html

@@ -0,0 +1,12 @@

+<div class="h-event"> + <span class="p-name">CPJ Online Press Freedom Summit</span> + (<time class="dt-start" datetime="2012-10-10">10 Nov 2012</time>) in + <span class="p-location">San Francisco</span>. + Attendees: + <ul> + <li class="p-attendee h-card">Brian Warner</li> + <li class="p-attendee h-card">Kyle Machulis</li> + <li class="p-attendee h-card">Tantek Çelik</li> + <li class="p-attendee h-card">Sid Sutter</li> + </ul> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/attendees/output.json

@@ -0,0 +1,55 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["CPJ Online Press Freedom Summit"], + "start": ["2012-10-10"], + "location": ["San Francisco"], + "attendee": [{ + "value": "Brian Warner", + "type": ["h-card"], + "properties": { + "name": ["Brian Warner"] + } + },{ + "value": "Kyle Machulis", + "type": ["h-card"], + "properties": { + "name": ["Kyle Machulis"] + } + },{ + "value": "Tantek Çelik", + "type": ["h-card"], + "properties": { + "name": ["Tantek Çelik"] + } + },{ + "value": "Sid Sutter", + "type": ["h-card"], + "properties": { + "name": ["Sid Sutter"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Brian Warner"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Kyle Machulis"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Tantek Çelik"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Sid Sutter"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/attendees/test.json

@@ -0,0 +1,5 @@

+{ + "name": "h-event with attendees", + "description": "h-event", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/combining/input.html

@@ -0,0 +1,13 @@

+<div class="h-event"> + <a class="p-name u-url" href="http://indiewebcamp.com/2012"> + IndieWebCamp 2012 + </a> + from <time class="dt-start">2012-06-30</time> + to <time class="dt-end">2012-07-01</time> at + <span class="p-location h-card"> + <a class="p-name p-org u-url" href="http://geoloqi.com/">Geoloqi</a>, + <span class="p-street-address">920 SW 3rd Ave. Suite 400</span>, + <span class="p-locality">Portland</span>, + <abbr class="p-region" title="Oregon">OR</abbr> + </span> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/combining/output.json

@@ -0,0 +1,33 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["IndieWebCamp 2012"], + "url": ["http://indiewebcamp.com/2012"], + "start": ["2012-06-30"], + "end": ["2012-07-01"], + "location": [{ + "value": "Geoloqi, 920 SW 3rd Ave. Suite 400, Portland, OR", + "type": ["h-card"], + "properties": { + "name": ["Geoloqi"], + "org": ["Geoloqi"], + "url": ["http://geoloqi.com/"], + "street-address": ["920 SW 3rd Ave. Suite 400"], + "locality": ["Portland"], + "region": ["Oregon"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Geoloqi"], + "org": ["Geoloqi"], + "url": ["http://geoloqi.com/"], + "street-address": ["920 SW 3rd Ave. Suite 400"], + "locality": ["Portland"], + "region": ["Oregon"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/combining/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Event with location", + "description": "h-event", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/concatenate/input.html

@@ -0,0 +1,7 @@

+<span class="h-event"> + <span class="p-name">The 4th Microformat party</span> will be on + <span class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00</time></span> to + <span class="dt-end"><time class="value">22:00</time></span>. +</span>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/concatenate/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["The 4th Microformat party"], + "start": ["2009-06-26T19:00:00"], + "end": ["2009-06-26T22:00:00"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/concatenate/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Concatenate multiple datetime elements", + "description": "h-event", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/dt-property/input.html

@@ -0,0 +1,23 @@

+<span class="h-event"> + <span class="p-name">The party</span> will be on + <!-- value and value-title patterns --> + <p class="dt-start"> + <span class="value-title" title="2013-03-14"> </span> + March 14th 2013 + </p> + <p class="dt-start"> + <time class="value" datetime="2013-06-25">25 July</time>, from + <span class="value">07:00:00am + </span></p> + <!-- elements with datetime attribute --> + <p> + <time class="dt-start" datetime="2013-06-26">26 June</time> + + <ins class="dt-start" datetime="2013-06-27">Just added</ins>, + <del class="dt-start" datetime="2013-06-28">Removed</del> + </p> + <abbr class="dt-start" title="2013-06-29">June 29</abbr> + <data class="dt-start" value="2013-07-01"></data> + <p class="dt-start">2013-07-02</p> + +</span>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/dt-property/output.json

@@ -0,0 +1,18 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["The party"], + "start": [ + "2013-03-14", + "2013-06-25T07:00:00", + "2013-06-26", + "2013-06-27", + "2013-06-28", + "2013-06-29", + "2013-07-01", + "2013-07-02" + ] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/dt-property/test.json

@@ -0,0 +1,5 @@

+{ + "name": "dt-property", + "description": "h-event", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/justahyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="h-event" href="http://indiewebcamp.com/2012">IndieWebCamp 2012</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/justahyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["IndieWebCamp 2012"], + "url": ["http://indiewebcamp.com/2012"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "h-event", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="h-event">IndieWebCamp 2012</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["IndieWebCamp 2012"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-event", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-event parsing tests", + "description": "This page was design to test the parsing of h-event. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/time/input.html

@@ -0,0 +1,47 @@

+<span class="h-event"> + <span class="p-name">The 4th Microformat party</span> will be on + <ul> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00-08:00</time> + </li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00-0800</time> + </li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00+0800</time> + </li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00Z</time> + </li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00</time> + </li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00-08:00</time> + </li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00+08:00</time> + </li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00Z</time> + </li> + <li class="dt-start"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00</time> + </li> + <li> + <time class="dt-end" datetime="2013-034">3 February 2013</time> + </li> + <li> + <time class="dt-end" datetime="2013-06-27 15:34">26 July 2013</time> + </li> + </ul> +</span>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/time/output.json

@@ -0,0 +1,23 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["The 4th Microformat party"], + "start": [ + "2009-06-26T19:00:00-0800", + "2009-06-26T19:00:00-0800", + "2009-06-26T19:00:00+0800", + "2009-06-26T19:00:00Z", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00-0800", + "2009-06-26T19:00:00+0800", + "2009-06-26T19:00:00Z", + "2009-06-26T19:00:00" + ], + "end": [ + "2013-034", + "2013-06-27 15:34:00" + ] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-event/time/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Time formats", + "description": "h-event", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/abbrpattern/input.html

@@ -0,0 +1,4 @@

+<p class="h-geo"> + <abbr class="p-latitude" title="37.408183">N 37° 24.491</abbr>, + <abbr class="p-longitude" title="-122.13855">W 122° 08.313</abbr> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/abbrpattern/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "latitude": ["37.408183"], + "longitude": ["-122.13855"], + "name": ["N 37° 24.491, W 122° 08.313"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/abbrpattern/test.json

@@ -0,0 +1,5 @@

+{ + "name": "The <abbr> Tag Pattern", + "description": "h-geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/altitude/input.html

@@ -0,0 +1,8 @@

+<p>My favourite hill in the lakes is + <span class="h-geo"> + <span class="p-name">Pen-y-ghent</span> + (Geo: <span class="p-latitude">54.155278</span>, + <span class="p-longitude">-2.249722</span>). It + raises to <span class="p-altitude">694</span>m. + </span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/altitude/output.json

@@ -0,0 +1,11 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "name": ["Pen-y-ghent"], + "latitude": ["54.155278"], + "longitude": ["-2.249722"], + "altitude": ["694"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/altitude/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Geo with a altitude property", + "description": "h-geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/hidden/input.html

@@ -0,0 +1,10 @@

+<p> + <span class="h-geo">The Bricklayer's Arms + <span class="p-latitude"> + <span class="value-title" title="51.513458"> </span> + </span> + <span class="p-longitude"> + <span class="value-title" title="-0.14812"> </span> + </span> + </span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/hidden/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "latitude": ["51.513458"], + "longitude": ["-0.14812"], + "name": ["The Bricklayer's Arms"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/hidden/test.json

@@ -0,0 +1,5 @@

+{ + "name": "The <abbr> tag pattern", + "description": "h-geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/justaname/input.html

@@ -0,0 +1,3 @@

+<p>On my way to The Bricklayer's Arms + (Geo: <span class="h-geo">51.513458;-0.14812</span>) +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "name": ["51.513458;-0.14812"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/simpleproperties/input.html

@@ -0,0 +1,5 @@

+<p class="h-geo">We are meeting at + <span class="p-name">The Bricklayer's Arms</span> + (Geo: <span class="p-latitude">51.513458</span>: + <span class="p-longitude">-0.14812</span>) +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/simpleproperties/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "name": ["The Bricklayer's Arms"], + "latitude": ["51.513458"], + "longitude": ["-0.14812"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/simpleproperties/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Broken into properties", + "description": "h-geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-geo parsing tests", + "description": "This page was design to test the parsing of h-geo. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/valuetitleclass/input.html

@@ -0,0 +1,10 @@

+<p> + <span class="h-geo"> + <span class="p-latitude"> + <span class="value-title" title="51.513458">N 51° 51.345</span>, + </span> + <span class="p-longitude"> + <span class="value-title" title="-0.14812">W -0° 14.812</span> + </span> + </span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/valuetitleclass/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-geo"], + "properties": { + "latitude": ["51.513458"], + "longitude": ["-0.14812"], + "name": ["N 51° 51.345, W -0° 14.812"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-geo/valuetitleclass/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Value-title class pattern", + "description": "h-geo", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-news/all/input.html

@@ -0,0 +1,35 @@

+<div class="h-news"> + <div class="p-entry h-entry"> + <h1><a class="p-name u-url" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a></h1> + <div class="e-content"> + <p class="p-summary">Last week the microformats.org community + celebrated its 7th birthday at a gathering hosted by Mozilla in + San Francisco and recognized accomplishments, challenges, and + opportunities.</p> + + <p>The microformats tagline “humans first, machines second” + forms the basis of many of our + <a href="http://microformats.org/wiki/principles">principles</a>, and + in that regard, we’d like to recognize a few people and + thank them for their years of volunteer service </p> + </div> + <p>Updated + <time class="dt-updated" datetime="2012-06-25T17:08:26">June 25th, 2012</time> by + <a class="p-author h-card" href="http://tantek.com/">Tantek</a> + </p> + </div> + + <p> + <span class="p-dateline h-adr"> + <span class="p-locality">San Francisco</span>, + <span class="p-region">CA</span> + </span> + (Geo: <span class="p-geo">37.774921;-122.445202</span>) + <span class="p-source-org h-card"> + <a class="p-name u-url" href="http://microformats.org/">microformats.org</a> + </span> + </p> + <p> + <a class="u-principles" href="http://microformats.org/wiki/Category:public_domain_license">Publishing policy</a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-news/all/output.json

@@ -0,0 +1,49 @@

+{ + "items": [{ + "type": ["h-news"], + "properties": { + "entry": [{ + "value": "microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek", + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"], + "content": [{ + "value": "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service", + "html": "\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n " + }], + "summary": ["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."], + "updated": ["2012-06-25T17:08:26"], + "author": { + "value": "Tantek", + "type": ["h-card"], + "properties": { + "name": ["Tantek"], + "url": ["http://tantek.com/"] + } + } + } + }], + "dateline": [{ + "value": "San Francisco, CA", + "type": ["h-adr"], + "properties": { + "locality": ["San Francisco"], + "region": ["CA"], + "name": ["San Francisco, CA"] + } + }], + "geo": ["37.774921;-122.445202"], + "source-org": [{ + "value": "microformats.org", + "type": ["h-card"], + "properties": { + "name": ["microformats.org"], + "url": ["http://microformats.org/"] + } + }], + "principles": ["http://microformats.org/wiki/Category:public_domain_license"], + "name": ["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek San Francisco, CA (Geo: 37.774921;-122.445202) microformats.org Publishing policy"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-news/all/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With dateline h-card", + "description": "h-news", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-news/minimum/input.html

@@ -0,0 +1,24 @@

+<div class="h-news"> + <div class="p-entry h-entry"> + <h1><a class="p-name u-url" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a></h1> + <div class="e-content"> + <p class="p-summary">Last week the microformats.org community + celebrated its 7th birthday at a gathering hosted by Mozilla in + San Francisco and recognized accomplishments, challenges, and + opportunities.</p> + + <p>The microformats tagline “humans first, machines second” + forms the basis of many of our + <a href="http://microformats.org/wiki/principles">principles</a>, and + in that regard, we’d like to recognize a few people and + thank them for their years of volunteer service </p> + </div> + <p>Updated + <time class="dt-updated" datetime="2012-06-25T17:08:26">June 25th, 2012</time> by + <a class="p-author h-card" href="http://tantek.com/">Tantek</a> + </p> + </div> + <p> + <a class="p-source-org h-card" href="http://microformats.org/">microformats.org</a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-news/minimum/output.json

@@ -0,0 +1,37 @@

+{ + "items": [{ + "type": ["h-news"], + "properties": { + "entry": [{ + "value": "microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek", + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"], + "content": [{ + "value": "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service", + "html": "\n <p class=\"p-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n " + }], + "updated": ["2012-06-25T17:08:26"], + "author": { + "value": "Tantek", + "type": ["h-card"], + "properties": { + "name": ["Tantek"], + "url": ["http://tantek.com/"] + } + } + } + }], + "source-org": [{ + "value": "microformats.org", + "type": ["h-card"], + "properties": { + "name": ["microformats.org"], + "url": ["http://microformats.org/"] + } + }], + "name": ["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek microformats.org"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-news/minimum/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Minimum properties", + "description": "h-news", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-news/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-news parsing tests", + "description": "This page was design to test the parsing of h-news. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/hyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="h-org" href="http://mozilla.org/">Mozilla Foundation</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/hyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-org"], + "properties": { + "name": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/hyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "h-org", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/simple/input.html

@@ -0,0 +1,1 @@

+<span class="h-org">Mozilla Foundation</span>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/simple/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-org"], + "properties": { + "name": ["Mozilla Foundation"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/simple/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Simple org", + "description": "h-org", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/simpleproperties/input.html

@@ -0,0 +1,4 @@

+<p class="h-org"> + <span class="p-organization-name">W3C</span> - + <span class="p-organization-unit">CSS Working Group</span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/simpleproperties/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-org"], + "properties": { + "organization-name": ["W3C"], + "organization-unit": ["CSS Working Group"], + "name": ["W3C - CSS Working Group"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/simpleproperties/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Simple properties", + "description": "h-org", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-org/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-org parsing tests", + "description": "This page was design to test the parsing of h-org. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/aggregate/input.html

@@ -0,0 +1,20 @@

+<div class="h-product"> + <h2 class="p-name">Raspberry Pi</h2> + <img class="u-photo" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg" /> + <p class="e-description">The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.</p> + <a class="u-url" href="http://www.raspberrypi.org/">More info about the Raspberry Pi</a> + <p class="p-price">£29.95</p> + <p class="p-review h-review-aggregate"> + <span class="p-rating h-rating"> + <span class="p-average">9.2</span> out of + <span class="p-best">10</span> + based on <span class="p-count">178</span> reviews + </span> + </p> + <p>Categories: <span class="p-category">Computer</span>, <span class="p-category">Education</span></p> + <p class="p-brand h-card">From: + <span class="p-name p-org">The Raspberry Pi Foundation</span> - + <span class="p-locality">Cambridge</span> + <span class="p-country-name">UK</span> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/aggregate/output.json

@@ -0,0 +1,43 @@

+{ + "items": [{ + "type": ["h-product"], + "properties": { + "name": ["Raspberry Pi"], + "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"], + "description": [{ + "value": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.", + "html": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming." + }], + "url": ["http://www.raspberrypi.org/"], + "price": ["£29.95"], + "review": [{ + "value": "9.2 out of 10 based on 178 reviews", + "type": ["h-review-aggregate"], + "properties": { + "rating": [{ + "value": "9.2 out of 10 based on 178 reviews", + "type": ["h-rating"], + "properties": { + "average": ["9.2"], + "best": ["10"], + "count": ["178"], + "name": ["9.2 out of 10 based on 178 reviews"] + } + }], + "name": ["9.2 out of 10 based on 178 reviews"] + } + }], + "category": ["Computer","Education"], + "brand": [{ + "value": "From: The Raspberry Pi Foundation - Cambridge UK", + "type": ["h-card"], + "properties": { + "name": ["The Raspberry Pi Foundation"], + "org": ["The Raspberry Pi Foundation"], + "locality": ["Cambridge"], + "country-name": ["UK"] + } + }] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/aggregate/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With h-review-aggregate", + "description": "h-product", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/justahyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="h-product" href="http://www.raspberrypi.org/">Raspberry Pi</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/justahyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-product"], + "properties": { + "name": ["Raspberry Pi"], + "url": ["http://www.raspberrypi.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "h-product", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="h-product">Raspberry Pi</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-product"], + "properties": { + "name": ["Raspberry Pi"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-product", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/simpleproperties/input.html

@@ -0,0 +1,9 @@

+<div class="h-product"> + <h2 class="p-name">Raspberry Pi</h2> + <img class="u-photo" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg" /> + <p class="e-description">The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.</p> + <a class="u-url" href="http://www.raspberrypi.org/">More info about the Raspberry Pi</a> + <p class="p-price">£29.95</p> + <p class="p-review h-review"><span class="p-rating">4.5</span> out of 5</p> + <p>Categories: <span class="p-category">Computer</span>, <span class="p-category">Education</span></p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/simpleproperties/output.json

@@ -0,0 +1,24 @@

+{ + "items": [{ + "type": ["h-product"], + "properties": { + "name": ["Raspberry Pi"], + "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"], + "description": [{ + "value": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.", + "html": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming." + }], + "url": ["http://www.raspberrypi.org/"], + "price": ["£29.95"], + "category": ["Computer","Education"], + "review": [{ + "value": "4.5 out of 5", + "type": ["h-review"], + "properties": { + "rating": ["4.5"], + "name": ["4.5 out of 5"] + } + }] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/simpleproperties/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With h-review", + "description": "h-product", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-product/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-product parsing tests", + "description": "This page was design to test the parsing of h-product. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-recipe/all/input.html

@@ -0,0 +1,63 @@

+<section class="hrecipe"> + <h1 class="p-name">Yorkshire Puddings</h1> + <p class="p-summary">Makes <span class="p-yield">6 good sized Yorkshire puddings</span>, the way my mum taught me</p> + + + <p><img class="u-photo" src="http://codebits.glennjones.net/semantic/yorkshire-puddings.jpg" /></p> + + <span class="p-review h-review-aggregate"> + <span class="p-rating"> + <span class="p-average">4.5</span> stars out 5 based on </span> + <span class="p-count">35</span> reviews</span> + + + + <div id="ingredients-container"> + <h3>Ingredients</h3> + <ul> + <li class="e-ingredient">1 egg</li> + <li class="e-ingredient">75g plain flour</li> + <li class="e-ingredient">70ml milk</li> + <li class="e-ingredient">60ml water</li> + <li class="e-ingredient">Pinch of salt</li> + </ul> + </div> + + <h3>Time</h3> + <ul> + <li class="prepTime">Preparation <span class="value-title" title="PT0H10M">10 mins</span></li> + <li class="cookTime">Cook <span class="value-title" title="PT0H25M">25 mins</span></li> + </ul> + + + <h3>Instructions</h3> + <div class="e-instructions"> + <ol> + <li>Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole + Yorkshire pudding tins and place in the oven to heat through.</li> + + <li>To make the batter, add all the flour into a bowl and beat in the eggs until smooth. + Gradually add the milk and water while beating the mixture. It should be smooth and + without lumps. Finally add a pinch of salt.</li> + + <li>Make sure the oil is piping hot before pouring the batter evenly into the tins. + Place in the oven for 20-25 minutes until pudding have risen and look golden brown</li> + </ol> + </div> + + <h3>Nutrition</h3> + <ul id="nutrition-list"> + <li class="nutrition">Calories: <span class="calories">125</span></li> + <li class="nutrition">Fat: <span class="fat">3.2g</span></li> + <li class="nutrition">Cholesterol: <span class="cholesterol">77mg</span></li> + </ul> + <p>(Amount per pudding)</p> + + <p> + Published on <time class="dt-published" datetime="2011-10-27">27 Oct 2011</time> by + <span class="p-author h-card"> + <a class="p-name u-url" href="http://glennjones.net">Glenn Jones</a> + </span> + </p> + <a href="http://www.flickr.com/photos/dithie/4106528495/">Photo by dithie</a> + </section>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-recipe/all/output.json

@@ -0,0 +1,59 @@

+{ + "items": [ { + "type": ["h-recipe"], + "properties": { + "name": ["Yorkshire Puddings"], + "summary": ["Makes 6 good sized Yorkshire puddings, the way my mum taught me"], + "yield": ["6 good sized Yorkshire puddings"], + "photo": ["http://codebits.glennjones.net/semantic/yorkshire-puddings.jpg"], + "review": [ + { + "value": "4.5 stars out 5 based on 35 reviews", + "type": ["h-review-aggregate"], + "properties": { + "rating": ["4.5 stars out 5 based on"], + "average": ["4.5"], + "count": ["35"], + "name": ["4.5 stars out 5 based on 35 reviews"] + } + } + ], + "ingredient": [{ + "value": "1 egg", + "html": "1 egg" + },{ + "value": "75g plain flour", + "html": "75g plain flour" + },{ + "value": "70ml milk", + "html": "70ml milk" + },{ + "value": "60ml water", + "html": "60ml water" + },{ + "value": "Pinch of salt", + "html": "Pinch of salt" + }], + "instructions": [{ + "value": "Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole Yorkshire pudding tins and place in the oven to heat through. To make the batter, add all the flour into a bowl and beat in the eggs until smooth. Gradually add the milk and water while beating the mixture. It should be smooth and without lumps. Finally add a pinch of salt. Make sure the oil is piping hot before pouring the batter evenly into the tins. Place in the oven for 20-25 minutes until pudding have risen and look golden brown", + "html": "\n <ol>\n <li>Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole \n Yorkshire pudding tins and place in the oven to heat through.</li> \n \n <li>To make the batter, add all the flour into a bowl and beat in the eggs until smooth. \n Gradually add the milk and water while beating the mixture. It should be smooth and \n without lumps. Finally add a pinch of salt.</li>\n \n <li>Make sure the oil is piping hot before pouring the batter evenly into the tins. \n Place in the oven for 20-25 minutes until pudding have risen and look golden brown</li>\n </ol>\n " + }], + "nutrition": [ + "Calories: 125", + "Fat: 3.2g", + "Cholesterol: 77mg" + ], + "published": ["2011-10-27"], + "author": [ + { + "value": "Glenn Jones", + "type": ["h-card"], + "properties": { + "name": ["Glenn Jones"], + "url": ["http://glennjones.net"] + } + } + ] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-recipe/all/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Broken into properties", + "description": "h-recipe", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-recipe/minimum/input.html

@@ -0,0 +1,7 @@

+<div class="h-recipe"> + <p class="p-name">Toast</p> + <ul> + <li class="e-ingredient">Slice of bread</li> + <li class="e-ingredient">Butter</li> + </ul> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-recipe/minimum/output.json

@@ -0,0 +1,15 @@

+{ + "items": [{ + "type": ["h-recipe"], + "properties": { + "name": ["Toast"], + "ingredient": [{ + "value": "Slice of bread", + "html": "Slice of bread" + },{ + "value": "Butter", + "html": "Butter" + }] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-recipe/minimum/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Minimum properties", + "description": "h-recipe", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-recipe/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-recipe parsing tests", + "description": "This page was design to test the parsing of h-recipe. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/affiliation/input.html

@@ -0,0 +1,12 @@

+<div class="h-resume"> + <p> + <span class="p-name">Tim Berners-Lee</span>, + <span class="p-summary">invented the World Wide Web</span>. + </p> + Belongs to following groups: + <p> + <a class="p-affiliation h-card" href="http://www.w3.org/"> + <img class="p-name u-photo" alt="W3C" src="http://www.w3.org/Icons/WWW/w3c_home_nb.png" /> + </a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/affiliation/output.json

@@ -0,0 +1,25 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "name": ["Tim Berners-Lee"], + "summary": ["invented the World Wide Web"], + "affiliation": [{ + "value": "", + "type": ["h-card"], + "properties": { + "name": ["W3C"], + "photo": ["http://www.w3.org/Icons/WWW/w3c_home_nb.png"], + "url": ["http://www.w3.org/"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["W3C"], + "photo": ["http://www.w3.org/Icons/WWW/w3c_home_nb.png"], + "url": ["http://www.w3.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/affiliation/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Affiliations", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/contact/input.html

@@ -0,0 +1,17 @@

+<div class="h-resume"> + <p class="p-name">Tim Berners-Lee</p> + <p class="p-summary">Invented the World Wide Web.</p><hr /> + <div class="p-contact h-card"> + <p class="p-name">MIT</p> + <p> + <span class="p-street-address">32 Vassar Street</span>, + <span class="p-extended-address">Room 32-G524</span>, + <span class="p-locality">Cambridge</span>, + <span class="p-region">MA</span> + <span class="p-postal-code">02139</span>, + <span class="p-country-name">USA</span>. + </p> + <p>Tel:<span class="p-tel">+1 (617) 253 5702</span></p> + <p>Email:<a class="u-email" href="mailto:timbl@w3.org">timbl@w3.org</a></p> + </div> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/contact/output.json

@@ -0,0 +1,37 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "name": ["Tim Berners-Lee"], + "summary": ["Invented the World Wide Web."], + "contact": [{ + "value": "MIT 32 Vassar Street, Room 32-G524, Cambridge, MA 02139, USA. Tel:+1 (617) 253 5702 Email:timbl@w3.org", + "type": ["h-card"], + "properties": { + "name": ["MIT"], + "street-address": ["32 Vassar Street"], + "extended-address": ["Room 32-G524"], + "locality": ["Cambridge"], + "region": ["MA"], + "postal-code": ["02139"], + "country-name": ["USA"], + "tel": ["+1 (617) 253 5702"], + "email": ["mailto:timbl@w3.org"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["MIT"], + "street-address": ["32 Vassar Street"], + "extended-address": ["Room 32-G524"], + "locality": ["Cambridge"], + "region": ["MA"], + "postal-code": ["02139"], + "country-name": ["USA"], + "tel": ["+1 (617) 253 5702"], + "email": ["timbl@w3.org"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/contact/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Contact", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/education/input.html

@@ -0,0 +1,13 @@

+<div class="h-resume"> + <p class="p-name">Tim Berners-Lee</p> + <div class="p-contact h-card"> + <p class="p-title">Director of the World Wide Web Foundation</p> + </div> + <p class="p-summary">Invented the World Wide Web.</p><hr /> + <p class="p-education h-event h-card"> + <span class="p-name p-org">The Queen's College, Oxford University</span>, + <span class="p-description">BA Hons (I) Physics</span> + <time class="dt-start" datetime="1973-09">1973</time> – + <time class="dt-end" datetime="1976-06">1976</time> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/education/output.json

@@ -0,0 +1,52 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "name": ["Tim Berners-Lee"], + "summary": ["Invented the World Wide Web."], + "contact": [{ + "value": "Director of the World Wide Web Foundation", + "type": ["h-card"], + "properties": { + "name": ["Director of the World Wide Web Foundation"], + "title": ["Director of the World Wide Web Foundation"] + } + }], + "education": [{ + "value": "The Queen's College, Oxford University, BA Hons (I) Physics 1973 - 1976", + "type": ["h-event", "h-card"], + "properties": { + "name": ["The Queen's College, Oxford University"], + "org": ["The Queen's College, Oxford University"], + "description": ["BA Hons (I) Physics"], + "start": ["1973-09"], + "end": ["1976-06"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Director of the World Wide Web Foundation"], + "title": ["Director of the World Wide Web Foundation"] + } + },{ + "type": ["h-event"], + "properties": { + "name": ["The Queen's College, Oxford University"], + "org": ["The Queen's College, Oxford University"], + "description": ["BA Hons (I) Physics"], + "start": ["1973-09"], + "end": ["1976-06"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["World Wide Web Foundation"], + "org": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"], + "start": ["2009-01-18"], + "duration": ["P2Y11M"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/education/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Educational experience", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="h-resume">Tim Berners-Lee, invented the World Wide Web.</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "name": ["Tim Berners-Lee, invented the World Wide Web."] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/skill/input.html

@@ -0,0 +1,12 @@

+<div class="h-resume"> + <p> + <span class="p-name">Tim Berners-Lee</span>, + <span class="p-summary">invented the World Wide Web</span>. + </p> + Skills: + <ul> + <li class="p-skill">information systems</li> + <li class="p-skill">advocacy</li> + <li class="p-skill">leadership</li> + <ul> +</ul></ul></div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/skill/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "name": ["Tim Berners-Lee"], + "summary": ["invented the World Wide Web"], + "skill": ["information systems", "advocacy", "leadership"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/skill/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Skills", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-resume parsing tests", + "description": "This page was design to test the parsing of h-resume. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/work/input.html

@@ -0,0 +1,15 @@

+<div class="h-resume"> + <p class="p-name">Tim Berners-Lee</p> + <div class="p-contact h-card"> + <p class="p-title">Director of the World Wide Web Foundation</p> + </div> + <p class="p-summary">Invented the World Wide Web.</p><hr /> + <div class="p-experience h-event h-card"> + <p class="p-title">Director</p> + <p><a class="p-name p-org u-url" href="http://www.webfoundation.org/">World Wide Web Foundation</a></p> + <p> + <time class="dt-start" datetime="2009-01-18">Jan 2009</time> – Present + <time class="dt-duration" datetime="P2Y11M">(2 years 11 month)</time> + </p> + </div> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/work/output.json

@@ -0,0 +1,52 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "name": ["Tim Berners-Lee"], + "summary": ["Invented the World Wide Web."], + "contact": [{ + "value": "Director of the World Wide Web Foundation", + "type": ["h-card"], + "properties": { + "name": ["Director of the World Wide Web Foundation"], + "title": ["Director of the World Wide Web Foundation"] + } + }], + "experience": [{ + "value": "Director World Wide Web Foundation Jan 2009 - Present (2 years 11 month)", + "type": ["h-event", "h-card"], + "properties": { + "name": ["World Wide Web Foundation"], + "org": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"], + "start": ["2009-01-18"], + "duration": ["P2Y11M"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Director of the World Wide Web Foundation"], + "title": ["Director of the World Wide Web Foundation"] + } + },{ + "type": ["h-event"], + "properties": { + "name": ["World Wide Web Foundation"], + "org": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"], + "start": ["2009-01-18"], + "duration": ["P2Y11M"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["World Wide Web Foundation"], + "org": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"], + "start": ["2009-01-18"], + "duration": ["P2Y11M"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-resume/work/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Work experience", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/hevent/input.html

@@ -0,0 +1,13 @@

+<div class="h-review-aggregate"> + <div class="p-item h-event"> + <h3 class="p-name">Fullfrontal</h3> + <p class="p-description">A one day JavaScript Conference held in Brighton</p> + <p><time class="dt-start" datetime="2012-11-09">9th November 2012</time></p> + </div> + + <p class="p-rating"> + <span class="p-average value">9.9</span> out of + <span class="p-best">10</span> + based on <span class="p-count">62</span> reviews + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/hevent/output.json

@@ -0,0 +1,21 @@

+{ + "items": [{ + "type": ["h-review-aggregate"], + "properties": { + "item": [{ + "value": "Fullfrontal A one day JavaScript Conference held in Brighton 9th November 2012", + "type": ["h-event"], + "properties": { + "name": ["Fullfrontal"], + "description": ["A one day JavaScript Conference held in Brighton"], + "start": ["2012-11-09"] + } + }], + "rating": ["9.9"], + "average": ["9.9"], + "best": ["10"], + "count": ["62"], + "name": ["Fullfrontal A one day JavaScript Conference held in Brighton 9th November 2012 9.9 out of 10 based on 62 reviews"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/hevent/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With p-item as a h-event", + "description": "hreview-aggregate", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/justahyperlink/input.html

@@ -0,0 +1,8 @@

+<div class="h-review-aggregate"> + <h3 class="p-item h-item">Mediterranean Wraps</h3> + <span class="p-summary"> + Customers flock to this small restaurant for their + tasty falafel and shawerma wraps and welcoming staff. + </span> + <span class="p-rating">4.5</span> out of 5 +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/justahyperlink/output.json

@@ -0,0 +1,17 @@

+{ + "items": [{ + "type": ["h-review-aggregate"], + "properties": { + "item": [{ + "value": "Mediterranean Wraps", + "type": ["h-item"], + "properties": { + "name": ["Mediterranean Wraps"] + } + }], + "summary": ["Customers flock to this small restaurant for their tasty falafel and shawerma wraps and welcoming staff."], + "rating": ["4.5"], + "name": ["Mediterranean Wraps Customers flock to this small restaurant for their tasty falafel and shawerma wraps and welcoming staff. 4.5 out of 5"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Minimum properties", + "description": "h-review-aggregate", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/simpleproperties/input.html

@@ -0,0 +1,18 @@

+<div class="hreview-aggregate"> + <div class="p-item h-card"> + <h3 class="p-name">Mediterranean Wraps</h3> + <p> + <span class="p-street-address">433 S California Ave</span>, + <span class="p-locality">Palo Alto</span>, + <span class="p-region">CA</span> - + <span class="p-tel">(650) 321-8189</span> + </p> + </div> + <span class="p-summary">Customers flock to this small restaurant for their + tasty falafel and shawerma wraps and welcoming staff.</span> + <span class="p-rating"> + <span class="p-average value">9.2</span> out of + <span class="p-best">10</span> + based on <span class="p-count">17</span> reviews + </span> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/simpleproperties/output.json

@@ -0,0 +1,24 @@

+{ + "items": [{ + "type": ["h-review-aggregate"], + "properties": { + "item": [{ + "value": "Mediterranean Wraps 433 S California Ave, Palo Alto, CA - (650) 321-8189", + "type": ["h-card"], + "properties": { + "name": ["Mediterranean Wraps"], + "street-address": ["433 S California Ave"], + "locality": ["Palo Alto"], + "region": ["CA"], + "tel": ["(650) 321-8189"] + } + }], + "summary": ["Customers flock to this small restaurant for their tasty falafel and shawerma wraps and welcoming staff."], + "rating": ["9.2"], + "average": ["9.2"], + "best": ["10"], + "count": ["17"], + "name": ["Mediterranean Wraps 433 S California Ave, Palo Alto, CA - (650) 321-8189 Customers flock to this small restaurant for their tasty falafel and shawerma wraps and welcoming staff. 9.2 out of 10 based on 17 reviews"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/simpleproperties/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Broken into properties", + "description": "h-review-aggregate", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review-aggregate/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-review-aggregate parsing tests", + "description": "This page was design to test the parsing of h-review-aggregate. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/hyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="h-review" href="https://plus.google.com/116941523817079328322/about">Crepes on Cole</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/hyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "name": ["Crepes on Cole"], + "url": ["https://plus.google.com/116941523817079328322/about"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/hyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "h-review", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/implieditem/input.html

@@ -0,0 +1,4 @@

+<div class="h-review"> + <a class="p-item h-item" href="http://example.com/crepeoncole">Crepes on Cole</a> + <p><span class="rating">4.7</span> out of 5 stars</p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/implieditem/output.json

@@ -0,0 +1,17 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "item": [{ + "value": "Crepes on Cole", + "type": ["h-item"], + "properties": { + "name": ["Crepes on Cole"], + "url": ["http://example.com/crepeoncole"] + } + }], + "rating": ["4.7"], + "name": ["Crepes on Cole 4.7 out of 5 stars"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/implieditem/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With implied item name and url", + "description": "h-review", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/item/input.html

@@ -0,0 +1,7 @@

+<div class="h-review"> + <p class="p-item h-item"> + <img class="u-photo" src="images/photo.gif" /> + <a class="p-name u-url" href="http://example.com/crepeoncole">Crepes on Cole</a> + </p> + <p><span class="p-rating">5</span> out of 5 stars</p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/item/output.json

@@ -0,0 +1,18 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + + "item": [{ + "value": "Crepes on Cole", + "type": ["h-item"], + "properties": { + "photo": ["http://example.com/images/photo.gif"], + "name": ["Crepes on Cole"], + "url": ["http://example.com/crepeoncole"] + } + }], + "rating": ["5"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/item/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With item", + "description": "h-review", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="h-review">Crepes on Cole</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "name": ["Crepes on Cole"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-review", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/photo/input.html

@@ -0,0 +1,1 @@

+<img class="h-review" src="images/photo.gif" alt="Crepes on Cole" />
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/photo/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "name": ["Crepes on Cole"], + "photo": ["http://example.com/images/photo.gif"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/photo/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a photo", + "description": "h-review", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-review parsing tests", + "description": "This page was design to test the parsing of h-review. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/vcard/input.html

@@ -0,0 +1,23 @@

+<div class="h-review"> + <span><span class="p-rating">5</span> out of 5 stars</span> + <h4 class="p-name">Crepes on Cole is awesome</h4> + <span class="p-reviewer h-card"> + Reviewer: <span class="p-name">Tantek</span> - + </span> + <time class="dt-reviewed" datetime="2005-04-18">April 18, 2005</time> + <div class="e-description"> + <p class="p-item h-card"> + <span class="p-name p-org">Crepes on Cole</span> is one of the best little + creperies in <span class="p-adr h-adr"><span class="p-locality">San Francisco</span></span>. + Excellent food and service. Plenty of tables in a variety of sizes + for parties large and small. Window seating makes for excellent + people watching to/from the N-Judah which stops right outside. + I've had many fun social gatherings here, as well as gotten + plenty of work done thanks to neighborhood WiFi. + </p> + </div> + <p>Visit date: <span>April 2005</span></p> + <p>Food eaten: <a class="p-category" href="http://en.wikipedia.org/wiki/crepe">crepe</a></p> + <p>Permanent link for review: <a class="u-url" href="http://example.com/crepe">http://example.com/crepe</a></p> + <p><a rel="license" href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons Attribution-ShareAlike License</a></p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/vcard/output.json

@@ -0,0 +1,38 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "rating": ["5"], + "name": ["Crepes on Cole is awesome"], + "reviewer": [{ + "value": "Reviewer: Tantek -", + "type": ["h-card"], + "properties": { + "name": ["Tantek"] + } + }], + "description": [{ + "value": "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.", + "html": "\n <p class=\"p-item h-card\">\n <span class=\"p-name p-org\">Crepes on Cole</span> is one of the best little \n creperies in <span class=\"p-adr h-adr\"><span class=\"p-locality\">San Francisco</span></span>.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n </p>\n " + }], + "item": [{ + "value": "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.", + "type": ["h-card"], + "properties": { + "name": ["Crepes on Cole"], + "org": ["Crepes on Cole"], + "adr": [{ + "value": "San Francisco", + "type": ["h-adr"], + "properties": { + "locality": ["San Francisco"], + "name": ["San Francisco"] + } + }] + } + }], + "category": ["crepe"], + "url": ["http://example.com/crepe"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/h-review/vcard/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With vcard item", + "description": "h-review", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/ampm/input.html

@@ -0,0 +1,41 @@

+<div class="vevent"> + <span class="summary">The 4th Microformat party</span> will be on + <ul> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00:00pm + </span></li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00:00am + </span></li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00pm + </span></li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07pm + </span></li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">7pm + </span></li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">7:00pm + </span></li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00p.m. + </span></li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">07:00PM + </span></li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <span class="value">7:00am + </span></li> + </ul> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/ampm/output.json

@@ -0,0 +1,19 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["The 4th Microformat party"], + "start": [ + "2009-06-26T19:00:00", + "2009-06-26T07:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00", + "2009-06-26T07:00:00" + ] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/ampm/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Meridiem time formats (am pm)", + "description": "hcalendar", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/attendees/input.html

@@ -0,0 +1,12 @@

+<div class="vevent"> + <span class="summary">CPJ Online Press Freedom Summit</span> + (<time class="dtstart" datetime="2012-10-10">10 Nov 2012</time>) in + <span class="location">San Francisco</span>. + Attendees: + <ul> + <li class="attendee vcard">Brian Warner</li> + <li class="attendee vcard">Kyle Machulis</li> + <li class="attendee vcard">Tantek Çelik</li> + <li class="attendee vcard">Sid Sutter</li> + </ul> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/attendees/output.json

@@ -0,0 +1,55 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["CPJ Online Press Freedom Summit"], + "start": ["2012-10-10"], + "location": ["San Francisco"], + "attendee": [{ + "value": "Brian Warner", + "type": ["h-card"], + "properties": { + "name": ["Brian Warner"] + } + },{ + "value": "Kyle Machulis", + "type": ["h-card"], + "properties": { + "name": ["Kyle Machulis"] + } + },{ + "value": "Tantek Çelik", + "type": ["h-card"], + "properties": { + "name": ["Tantek Çelik"] + } + },{ + "value": "Sid Sutter", + "type": ["h-card"], + "properties": { + "name": ["Sid Sutter"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Brian Warner"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Kyle Machulis"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Tantek Çelik"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Sid Sutter"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/attendees/test.json

@@ -0,0 +1,5 @@

+{ + "name": "hcalendar with attendees", + "description": "hcalendar", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/combining/input.html

@@ -0,0 +1,15 @@

+<div class="vevent"> + <a class="summary url" href="http://indiewebcamp.com/2012"> + IndieWebCamp 2012 + </a> + from <time class="dtstart">2012-06-30</time> + to <time class="dtend">2012-07-01</time> at + <span class="location vcard"> + <a class="fn org url" href="http://geoloqi.com/">Geoloqi</a>, + <span class="adr"> + <span class="street-address">920 SW 3rd Ave. Suite 400</span>, + <span class="locality">Portland</span>, + <abbr class="region" title="Oregon">OR</abbr> + </span> + </span> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/combining/output.json

@@ -0,0 +1,40 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["IndieWebCamp 2012"], + "url": ["http://indiewebcamp.com/2012"], + "start": ["2012-06-30"], + "end": ["2012-07-01"], + "location": [{ + "value": "Geoloqi, 920 SW 3rd Ave. Suite 400, Portland, OR", + "type": ["h-card"], + "properties": { + "name": ["Geoloqi"], + "org": ["Geoloqi"], + "url": ["http://geoloqi.com/"], + "adr": [{ + "value": "920 SW 3rd Ave. Suite 400, Portland, OR", + "type": ["h-adr"], + "properties": { + "street-address": ["920 SW 3rd Ave. Suite 400"], + "locality": ["Portland"], + "region": ["Oregon"], + "name": ["920 SW 3rd Ave. Suite 400, Portland, OR"] + } + }] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Geoloqi"], + "org": ["Geoloqi"], + "url": ["http://geoloqi.com/"], + "street-address": ["920 SW 3rd Ave. Suite 400"], + "locality": ["Portland"], + "region": ["Oregon"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/combining/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Event with location", + "description": "hcalendar", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/concatenate/input.html

@@ -0,0 +1,7 @@

+<div class="vevent"> + <span class="summary">The 4th Microformat party</span> will be on + <span class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00</time></span> to + <span class="dtend"><time class="value">22:00</time></span>. +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/concatenate/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["The 4th Microformat party"], + "start": ["2009-06-26T19:00:00"], + "end": ["2009-06-26T22:00:00"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/concatenate/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Concatenate multiple datetime elements", + "description": "hcalendar", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/justahyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="vevent" href="http://indiewebcamp.com/2012">IndieWebCamp 2012</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/justahyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["IndieWebCamp 2012"], + "url": ["http://indiewebcamp.com/2012"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "hcalendar", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/justaname/input.html

@@ -0,0 +1,1 @@

+<a class="vevent" href="http://indiewebcamp.com/2012">IndieWebCamp 2012</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/justaname/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["IndieWebCamp 2012"], + "url": ["http://indiewebcamp.com/2012"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "hcalendar", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "hcalendar parsing tests", + "description": "This page was design to test the parsing of hcalendar and its output to the newer JSON structure of micorformats 2. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/time/input.html

@@ -0,0 +1,44 @@

+<div class="vevent"> + <span class="summary">The 4th Microformat party</span> will be on + <ul> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00-08:00</time> + </li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00-0800</time> + </li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00+0800</time> + </li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00Z</time> + </li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00:00</time> + </li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00-08:00</time> + </li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00+08:00</time> + </li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00Z</time> + </li> + <li class="dtstart"> + <time class="value" datetime="2009-06-26">26 July</time>, from + <time class="value">19:00</time> + </li> + <li> + <time class="dtend" datetime="2013-034">3 February 2013</time> + </li> + </ul> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/time/output.json

@@ -0,0 +1,20 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["The 4th Microformat party"], + "start": [ + "2009-06-26T19:00:00-0800", + "2009-06-26T19:00:00-0800", + "2009-06-26T19:00:00+0800", + "2009-06-26T19:00:00Z", + "2009-06-26T19:00:00", + "2009-06-26T19:00:00-0800", + "2009-06-26T19:00:00+0800", + "2009-06-26T19:00:00Z", + "2009-06-26T19:00:00" + ], + "end": ["2013-034"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcalendar/time/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Time formats", + "description": "hcalendar", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/email/input.html

@@ -0,0 +1,14 @@

+<div class="vcard"> + <span class="fn">John Doe</span> + <ul> + <li><a class="email" href="mailto:john@example.com">notthis@example.com</a></li> + <li> + <span class="email"> + <span class="type">internet</span> + <a class="value" href="mailto:john@example.com">notthis@example.com</a> + </span> + </li> + <li><a class="email" href="mailto:john@example.com?subject=parser-test">notthis@example.com</a></li> + <li class="email">john@example.com</li> + </ul> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/email/output.json

@@ -0,0 +1,14 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["John Doe"], + "email": [ + "mailto:john@example.com", + "mailto:john@example.com", + "mailto:john@example.com?subject=parser-test", + "john@example.com" + ] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/email/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Emails", + "description": "hcard", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/format/input.html

@@ -0,0 +1,6 @@

+<p class="vcard"> + <span class="profile-name fn n"> + <span class=" given-name ">John</span> + <span class="FAMILY-NAME">Doe</span> + </span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/format/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["John Doe"], + "given-name": ["John"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/format/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Class attribute format", + "description": "hcard", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/hyperlinkedphoto/input.html

@@ -0,0 +1,3 @@

+<a class="vcard" href="http://rohit.khare.org/"> + <img alt="Rohit Khare" src="https://twimg0-a.akamaihd.net/profile_images/53307499/180px-Rohit-sq.jpg" /> +</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/hyperlinkedphoto/output.json

@@ -0,0 +1,10 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Rohit Khare"], + "photo": ["https://twimg0-a.akamaihd.net/profile_images/53307499/180px-Rohit-sq.jpg"], + "url": ["http://rohit.khare.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/hyperlinkedphoto/test.json

@@ -0,0 +1,5 @@

+{ + "name": "A hyperlinked photo", + "description": "hcard", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/justahyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="vcard" href="http://benward.me/">Ben Ward</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/justahyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Ben Ward"], + "url": ["http://benward.me/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "hcard", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="vcard">Frances Berriman</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Frances Berriman"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "hcard", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/multiple/input.html

@@ -0,0 +1,73 @@

+<div class="vcard"> + <!-- This may not be the best semantic use of HTML element --> + <div class="fn n"><span class="given-name">John</span> <span class="family-name">Doe</span></div> + <a class="sound" href="http://www.madgex.com/johndoe.mpeg">Pronunciation of my name</a> + <div><img class="photo" src="images/photo.gif" alt="Photo of John Doe" /></div> + + <p>Nicknames:</p> + <ul> + <li class="nickname">Man with no name</li> + <li class="nickname">Lost boy</li> + </ul> + + <p>About:</p> + <p class="note">John Doe is one of those names you always have issues with.</p> + <p class="note">It can be a real problem booking a hotel room with the name John Doe.</p> + + <p>Companies:</p> + <div> + <img class="logo" src="images/logo.gif" alt="Madgex company logo" /> + <img class="logo" src="images/logo.gif" alt="Web Feet Media company logo" /> + </div> + <ul> + <li><a class="url org" href="http://www.madgex.com/">Madgex</a> <span class="title">Creative Director</span></li> + <li><a class="url org" href="http://www.webfeetmedia.com/">Web Feet Media Ltd</a> <span class="title">Owner</span></li> + </ul> + + <p>Tags: + <a rel="tag" class="category" href="http://en.wikipedia.org/wiki/design">design</a>, + <a rel="tag" class="category" href="http://en.wikipedia.org/wiki/development">development</a> and + <a rel="tag" class="category" href="http://en.wikipedia.org/wiki/web">web</a> + </p> + + <p>Phone numbers:</p> + <ul> + <li class="tel"> + <span class="type">Work</span> (<span class="type">pref</span>erred): + <span class="value">+1 415 555 100</span> + </li> + <li class="tel"><span class="type">Home</span>: <span class="value">+1 415 555 200</span></li> + <li class="tel"><span class="type">Postal</span>: <span class="value">+1 415 555 300</span></li> + </ul> + + <p>Emails:</p> + <ul> + <li><a class="email" href="mailto:john.doe@madgex.com">John Doe at Madgex</a></li> + <li><a class="email" href="mailto:john.doe@webfeetmedia.com">John Doe at Web Feet Media</a></li> + </ul> + <p>John Doe uses <span class="mailer">PigeonMail 2.1</span> or <span class="mailer">Outlook 2007</span> for email.</p> + + <p>Addresses:</p> + <ul> + <li class="label"> + <span class="adr"> + <span class="type">Work</span>: + <span class="street-address">North Street</span>, + <span class="locality">Brighton</span>, + <span class="country-name">United Kingdom</span> + </span> + + </li> + <li class="label"> + <span class="adr"> + <span class="type">Home</span>: + <span class="street-address">West Street</span>, + <span class="locality">Brighton</span>, + <span class="country-name">United Kingdom</span> + </span> + </li> + </ul> + + <p>In emergency contact: <span class="agent">Jane Doe</span> or <span class="agent vcard">Dave Doe</span>.</p> + <p>Key: <span class="key">hd02$Gfu*d%dh87KTa2=23934532479</span></p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/multiple/output.json

@@ -0,0 +1,51 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["John Doe"], + "given-name": ["John"], + "family-name": ["Doe"], + "sound": ["http://www.madgex.com/johndoe.mpeg"], + "photo": ["http://example.com/images/photo.gif"], + "nickname": ["Man with no name","Lost boy"], + "note": [ + "John Doe is one of those names you always have issues with.", + "It can be a real problem booking a hotel room with the name John Doe." + ], + "url": ["http://www.madgex.com/", "http://www.webfeetmedia.com/"], + "org": ["Madgex","Web Feet Media Ltd"], + "title": ["Creative Director", "Owner"], + "category": ["design", "development", "web"], + "tel": ["+1 415 555 100", "+1 415 555 200", "+1 415 555 300"], + "email": ["mailto:john.doe@madgex.com", "mailto:john.doe@webfeetmedia.com"], + "mailer": ["PigeonMail 2.1","Outlook 2007"], + "adr": [{ + "value": "Work: North Street, Brighton, United Kingdom", + "type": ["h-adr"], + "properties": { + "street-address": ["North Street"], + "locality": ["Brighton"], + "country-name": ["United Kingdom"] + } + },{ + "value": "Home: West Street, Brighton, United Kingdom", + "type": ["h-adr"], + "properties": { + "street-address": ["West Street"], + "locality": ["Brighton"], + "country-name": ["United Kingdom"] + } + }], + "label": ["Work: North Street, Brighton, United Kingdom", "Home: West Street, Brighton, United Kingdom"], + "agent": ["Jane Doe", + { + "value": "Dave Doe", + "type": ["h-card"], + "properties": { + "name": ["Dave Doe"] + } + }], + "key": ["hd02$Gfu*d%dh87KTa2=23934532479"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/multiple/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Multiple occurrence properties", + "description": "hcard", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/name/input.html

@@ -0,0 +1,10 @@

+<div class="vcard"> + <div class="name"> + <span class="honorific-prefix">Dr</span> + <span class="given-name">John</span> + <abbr class="additional-name" title="Peter">P</abbr> + <span class="family-name">Doe</span> + <data class="honorific-suffix" value="MSc"></data> + <img class="honorific-suffix" src="images/logo.gif" alt="PHD" /> + </div> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/name/output.json

@@ -0,0 +1,13 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "honorific-prefix": ["Dr"], + "given-name": ["John"], + "additional-name": ["Peter"], + "family-name": ["Doe"], + "honorific-suffix": ["MSc","PHD"], + "name": ["Dr John P Doe"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/name/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Name properties", + "description": "hcard", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/single/input.html

@@ -0,0 +1,14 @@

+<div class="vcard"> + <!-- This may not be the best semantic use of HTML element --> + <div class="fn n"><span class="given-name sort-string">John</span> Doe</div> + <div>Birthday: <abbr class="bday" title="2000-01-01T00:00:00-08:00">January 1st, 2000</abbr></div> + <div>Role: <span class="role">Designer</span></div> + <div>Location: <abbr class="geo" title="30.267991;-97.739568">Brighton</abbr></div> + <div>Time zone: <abbr class="tz" title="-05:00">Eastern Standard Time</abbr></div> + + <div>Profile details: + <div>Profile id: <span class="uid">http://example.com/profiles/johndoe</span></div> + <div>Details are: <span class>Public</span></div> + <div>Last updated: <abbr class="rev" title="2008-01-01T13:45:00">January 1st, 2008 - 13:45</abbr></div> + </div> + </div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/single/output.json

@@ -0,0 +1,23 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["John Doe"], + "given-name": ["John"], + "sort-string": ["John"], + "bday": ["2000-01-01T00:00:00-0800"], + "role": ["Designer"], + "geo": [{ + "value": "Brighton", + "type": ["h-geo"], + "properties": { + "name": ["30.267991;-97.739568"] + } + }], + "tz": ["-05:00"], + "uid": ["http://example.com/profiles/johndoe"], + "class": ["Public"], + "rev": ["2008-01-01T13:45:00"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/single/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Single occurrence properties", + "description": "hcard", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hcard/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "hcard parsing tests", + "description": "This page was design to test the parsing of hcard and its output to the newer JSON structure of micorformats 2. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/justahyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="hentry" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/justahyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "hentry", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/justaname/input.html

@@ -0,0 +1,1 @@

+<a class="hentry" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/justaname/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "url": ["http://microformats.org/2012/06/25/microformats-org-at-7"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "hentry", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "hentry parsing tests", + "description": "This page was design to test the parsing of hentry and its output to the newer JSON structure of micorformats 2. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/summarycontent/input.html

@@ -0,0 +1,19 @@

+<div class="hentry"> + <h1><a class="entry-title" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a></h1> + <div class="entry-content"> + <p class="entry-summary">Last week the microformats.org community + celebrated its 7th birthday at a gathering hosted by Mozilla in + San Francisco and recognized accomplishments, challenges, and + opportunities.</p> + + <p>The microformats tagline “humans first, machines second” + forms the basis of many of our + <a href="http://microformats.org/wiki/principles">principles</a>, and + in that regard, we’d like to recognize a few people and + thank them for their years of volunteer service </p> + </div> + <p>Updated + <time class="updated" datetime="2012-06-25T17:08:26">June 25th, 2012</time> by + <a class="author vcard" href="http://tantek.com/">Tantek</a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/summarycontent/output.json

@@ -0,0 +1,28 @@

+{ + "items": [{ + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "content": [{ + "value": "Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service", + "html": "\n <p class=\"entry-summary\">Last week the microformats.org community \n celebrated its 7th birthday at a gathering hosted by Mozilla in \n San Francisco and recognized accomplishments, challenges, and \n opportunities.</p>\n\n <p>The microformats tagline “humans first, machines second” \n forms the basis of many of our \n <a href=\"http://microformats.org/wiki/principles\">principles</a>, and \n in that regard, we’d like to recognize a few people and \n thank them for their years of volunteer service </p>\n " + }], + "summary": ["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."], + "updated": ["2012-06-25T17:08:26"], + "author": [{ + "value": "Tantek", + "type": ["h-card"], + "properties": { + "name": ["Tantek"], + "url": ["http://tantek.com/"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Tantek"], + "url": ["http://tantek.com/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hentry/summarycontent/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Entry with summary and content", + "description": "hentry", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hnews/all/input.html

@@ -0,0 +1,37 @@

+<div class="hnews"> + <div class="entry hentry"> + <h1><a class="entry-title" rel="bookmark" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a></h1> + <div class="entry-content"> + <p class="entry-summary">Last week the microformats.org community + celebrated its 7th birthday at a gathering hosted by Mozilla in + San Francisco and recognized accomplishments, challenges, and + opportunities.</p> + + <p>The microformats tagline “humans first, machines second” + forms the basis of many of our + <a href="http://microformats.org/wiki/principles">principles</a>, and + in that regard, we’d like to recognize a few people and + thank them for their years of volunteer service </p> + </div> + <p>Updated + <time class="updated" datetime="2012-06-25T17:08:26">June 25th, 2012</time> by + <span class="author vcard"><a class="fn url" href="http://tantek.com/">Tantek</a></span> + </p> + </div> + + <p> + <span class="dateline vcard"> + <span class="adr"> + <span class="locality">San Francisco</span>, + <span class="region">CA</span> + </span> + </span> + (Geo: <span class="geo">37.774921;-122.445202</span>) + <span class="source-org vcard"> + <a class="fn org url" href="http://microformats.org/">microformats.org</a> + </span> + </p> + <p> + <a rel="principles" href="http://microformats.org/wiki/Category:public_domain_license">Publishing policy</a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hnews/all/output.json

@@ -0,0 +1,62 @@

+{ + "items": [{ + "type": ["h-news"], + "properties": { + "entry": [{ + "value": "microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek", + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "summary": ["Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities."], + "updated": ["2012-06-25T17:08:26"], + "author": { + "value": "Tantek", + "type": ["h-card"], + "properties": { + "name": ["Tantek"], + "url": ["http://tantek.com/"] + } + } + } + }], + "dateline": [{ + "value": "San Francisco, CA", + "type": ["h-card"], + "properties": { + "adr": [{ + "value": "San Francisco, CA", + "type": ["h-adr"], + "properties": { + "locality": ["San Francisco"], + "region": ["CA"], + "name": ["San Francisco, CA"] + } + }], + "name": ["San Francisco, CA"] + } + }], + "geo": [{ + "value": "37.774921;-122.445202", + "type": ["h-geo"], + "properties": { + "name": ["37.774921;-122.445202"] + } + }], + "source-org": [{ + "value": "microformats.org", + "type": ["h-card"], + "properties": { + "name": ["microformats.org"], + "url": ["http://microformats.org/"] + } + }], + "name": ["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek San Francisco, CA (Geo: 37.774921;-122.445202) microformats.org Publishing policy"] + } + },{ + "type": ["rel"], + "properties": { + "bookmark": ["http://microformats.org/2012/06/25/microformats-org-at-7"], + "principles": ["http://microformats.org/wiki/Category:public_domain_license"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hnews/all/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With dateline vcard", + "description": "hnews", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hnews/minimum/input.html

@@ -0,0 +1,25 @@

+<div class="hnews"> + <div class="entry hentry"> + <h1><a class="entry-title" rel="bookmark" href="http://microformats.org/2012/06/25/microformats-org-at-7">microformats.org at 7</a></h1> + <div class="entry-content"> + <p class="entry-summary">Last week the microformats.org community + celebrated its 7th birthday at a gathering hosted by Mozilla in + San Francisco and recognized accomplishments, challenges, and + opportunities.</p> + + <p>The microformats tagline “humans first, machines second” + forms the basis of many of our + <a href="http://microformats.org/wiki/principles">principles</a>, and + in that regard, we’d like to recognize a few people and + thank them for their years of volunteer service </p> + </div> + <p>Updated + <time class="updated" datetime="2012-06-25T17:08:26">June 25th, 2012</time> by + <span class="author vcard"><a class="fn url" href="http://tantek.com/">Tantek</a></span> + </p> + </div> + + <p class="source-org vcard"> + <a class="fn org url" href="http://microformats.org/">microformats.org</a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hnews/minimum/output.json

@@ -0,0 +1,36 @@

+{ + "items": [{ + "type": ["h-news"], + "properties": { + "entry": [{ + "value": "microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek", + "type": ["h-entry"], + "properties": { + "name": ["microformats.org at 7"], + "author": { + "value": "Tantek", + "type": ["h-card"], + "properties": { + "name": ["Tantek"], + "url": ["http://tantek.com/"] + } + } + } + }], + "source-org": [{ + "value": "microformats.org", + "type": ["h-card"], + "properties": { + "name": ["microformats.org"], + "url": ["http://microformats.org/"] + } + }], + "name": ["microformats.org at 7 Last week the microformats.org community celebrated its 7th birthday at a gathering hosted by Mozilla in San Francisco and recognized accomplishments, challenges, and opportunities. The microformats tagline “humans first, machines second” forms the basis of many of our principles, and in that regard, we’d like to recognize a few people and thank them for their years of volunteer service Updated June 25th, 2012 by Tantek microformats.org"] + } + },{ + "type": ["rel"], + "properties": { + "bookmark": ["http://microformats.org/2012/06/25/microformats-org-at-7"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hnews/minimum/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Minimum properties", + "description": "hnews", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hnews/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "hnews parsing tests", + "description": "This page was design to test the parsing of hnews. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/aggregate/input.html

@@ -0,0 +1,25 @@

+<div class="hproduct"> + <h2 class="fn">Raspberry Pi</h2> + <img class="photo" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg" /> + <p class="description">The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.</p> + <a class="url" href="http://www.raspberrypi.org/">More info about the Raspberry Pi</a> + <p class="price">£29.95</p> + <p class="review hreview-aggregate"> + <span class="rating"> + <span class="average value">9.2</span> out of + <span class="best">10</span> + based on <span class="count">178</span> reviews + </span> + </p> + <p>Categories: + <a rel="tag" href="http://en.wikipedia.org/wiki/computer" class="category">Computer</a>, + <a rel="tag" href="http://en.wikipedia.org/wiki/education" class="category">Education</a> + </p> + <p class="brand vcard">From: + <span class="fn org">The Raspberry Pi Foundation</span> - + <span class="adr"> + <span class="locality">Cambridge</span> + <span class="country-name">UK</span> + </span> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/aggregate/output.json

@@ -0,0 +1,43 @@

+{ + "items": [{ + "type": ["h-product"], + "properties": { + "name": ["Raspberry Pi"], + "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"], + "description": [{ + "value": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.", + "html": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming." + }], + "url": ["http://www.raspberrypi.org/"], + "price": ["£29.95"], + "review": [{ + "value": "9.2 out of 10 based on 178 reviews", + "type": ["h-review-aggregate"], + "properties": { + "rating": ["9.2"], + "average": ["9.2"], + "best": ["10"], + "count": ["178"] + } + }], + "category": ["Computer","Education"], + "brand": [{ + "value": "From: The Raspberry Pi Foundation - Cambridge UK", + "type": ["h-card"], + "properties": { + "name": ["The Raspberry Pi Foundation"], + "org": ["The Raspberry Pi Foundation"], + "adr": [{ + "value": "Cambridge UK", + "type": ["h-adr"], + "properties": { + "locality": ["Cambridge"], + "country-name": ["UK"], + "name": ["Cambridge UK"] + } + }] + } + }] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/aggregate/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With h-review-aggregate", + "description": "hproduct", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/justahyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="hproduct" href="http://www.raspberrypi.org/">Raspberry Pi</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/justahyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-product"], + "properties": { + "name": ["Raspberry Pi"], + "url": ["http://www.raspberrypi.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "hproduct", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="hproduct">Raspberry Pi</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-product"], + "properties": { + "name": ["Raspberry Pi"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "hproduct", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/simpleproperties/input.html

@@ -0,0 +1,12 @@

+<div class="hproduct"> + <h2 class="fn">Raspberry Pi</h2> + <img class="photo" src="http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg" /> + <p class="description">The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.</p> + <a class="url" href="http://www.raspberrypi.org/">More info about the Raspberry Pi</a> + <p class="price">£29.95</p> + <p class="review h-review"><span class="rating">4.5</span> out of 5</p> + <p>Categories: + <a rel="tag" href="http://en.wikipedia.org/wiki/computer" class="category">Computer</a>, + <a rel="tag" href="http://en.wikipedia.org/wiki/education" class="category">Education</a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/simpleproperties/output.json

@@ -0,0 +1,24 @@

+{ + "items": [{ + "type": ["h-product"], + "properties": { + "name": ["Raspberry Pi"], + "photo": ["http://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/RaspberryPi.jpg/320px-RaspberryPi.jpg"], + "description": [{ + "value": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming.", + "html": "The Raspberry Pi is a credit-card sized computer that plugs into your TV and a keyboard. It’s a capable little PC which can be used for many of the things that your desktop PC does, like spreadsheets, word-processing and games. It also plays high-definition video. We want to see it being used by kids all over the world to learn programming." + }], + "url": ["http://www.raspberrypi.org/"], + "price": ["£29.95"], + "category": ["Computer","Education"], + "review": [{ + "value": "4.5 out of 5", + "type": ["h-review"], + "properties": { + "rating": ["4.5"], + "name": ["4.5 out of 5"] + } + }] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/simpleproperties/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With h-review", + "description": "hproduct", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hproduct/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "hproduct parsing tests", + "description": "This page was design to test the parsing of hproduct. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hrecipe/all/input.html

@@ -0,0 +1,63 @@

+<section class="hrecipe"> + <h1 class="p-name">Yorkshire Puddings</h1> + <p class="p-summary">Makes <span class="p-yield">6 good sized Yorkshire puddings</span>, the way my mum taught me</p> + + + <p><img class="u-photo" src="http://codebits.glennjones.net/semantic/yorkshire-puddings.jpg" /></p> + + <span class="p-review h-review-aggregate"> + <span class="p-rating"> + <span class="p-average">4.5</span> stars out 5 based on </span> + <span class="p-count">35</span> reviews</span> + + + + <div id="ingredients-container"> + <h3>Ingredients</h3> + <ul> + <li class="e-ingredient">1 egg</li> + <li class="e-ingredient">75g plain flour</li> + <li class="e-ingredient">70ml milk</li> + <li class="e-ingredient">60ml water</li> + <li class="e-ingredient">Pinch of salt</li> + </ul> + </div> + + <h3>Time</h3> + <ul> + <li class="prepTime">Preparation <span class="value-title" title="PT0H10M">10 mins</span></li> + <li class="cookTime">Cook <span class="value-title" title="PT0H25M">25 mins</span></li> + </ul> + + + <h3>Instructions</h3> + <div class="e-instructions"> + <ol> + <li>Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole + Yorkshire pudding tins and place in the oven to heat through.</li> + + <li>To make the batter, add all the flour into a bowl and beat in the eggs until smooth. + Gradually add the milk and water while beating the mixture. It should be smooth and + without lumps. Finally add a pinch of salt.</li> + + <li>Make sure the oil is piping hot before pouring the batter evenly into the tins. + Place in the oven for 20-25 minutes until pudding have risen and look golden brown</li> + </ol> + </div> + + <h3>Nutrition</h3> + <ul id="nutrition-list"> + <li class="nutrition">Calories: <span class="calories">125</span></li> + <li class="nutrition">Fat: <span class="fat">3.2g</span></li> + <li class="nutrition">Cholesterol: <span class="cholesterol">77mg</span></li> + </ul> + <p>(Amount per pudding)</p> + + <p> + Published on <time class="dt-published" datetime="2011-10-27">27 Oct 2011</time> by + <span class="p-author h-card"> + <a class="p-name u-url" href="http://glennjones.net">Glenn Jones</a> + </span> + </p> + <a href="http://www.flickr.com/photos/dithie/4106528495/">Photo by dithie</a> + </section>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hrecipe/all/output.json

@@ -0,0 +1,49 @@

+{ + "items": [ { + "type": ["h-recipe"], + "properties": { + "name": ["Yorkshire Puddings"], + "summary": ["Makes 6 good sized Yorkshire puddings, the way my mum taught me"], + "yield": ["6 good sized Yorkshire puddings"], + "photo": ["http://codebits.glennjones.net/semantic/yorkshire-puddings.jpg"], + "review": [ + { + "value": "4.5 stars out 5 based on 35 reviews", + "type": ["h-review-aggregate"], + "properties": { + "rating": ["4.5 stars out 5 based on"], + "average": ["4.5"], + "count": ["35"], + "name": ["4.5 stars out 5 based on 35 reviews"] + } + } + ], + "ingredient": [ + "1 egg", + "75g plain flour", + "70ml milk", + "60ml water", + "Pinch of salt" + ], + "instructions": [ + "\n <ol>\n <li>Pre-heat oven to 230C or gas mark 8. Pour the vegetable oil evenly into 2 x 4-hole \n Yorkshire pudding tins and place in the oven to heat through.</li> \n \n <li>To make the batter, add all the flour into a bowl and beat in the eggs until smooth. \n Gradually add the milk and water while beating the mixture. It should be smooth and \n without lumps. Finally add a pinch of salt.</li>\n \n <li>Make sure the oil is piping hot before pouring the batter evenly into the tins. \n Place in the oven for 20-25 minutes until pudding have risen and look golden brown</li>\n </ol>\n " + ], + "nutrition": [ + "Calories: 125", + "Fat: 3.2g", + "Cholesterol: 77mg" + ], + "published": ["2011-10-27"], + "author": [ + { + "value": "Glenn Jones", + "type": ["h-card"], + "properties": { + "name": ["Glenn Jones"], + "url": ["http://glennjones.net"] + } + } + ] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hrecipe/all/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Broken into properties", + "description": "h-recipe", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hrecipe/minimum/input.html

@@ -0,0 +1,7 @@

+<div class="h-recipe"> + <p class="p-name">Toast</p> + <ul> + <li class="e-ingredient">Slice of bread</li> + <li class="e-ingredient">Butter</li> + </ul> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hrecipe/minimum/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-recipe"], + "properties": { + "name": ["Toast"], + "ingredient": ["Slice of bread", "Butter"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hrecipe/minimum/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Minimum properties", + "description": "h-recipe", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hrecipe/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-recipe parsing tests", + "description": "This page was design to test the parsing of h-recipe. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/affiliation/input.html

@@ -0,0 +1,12 @@

+<div class="h-resume"> + <p> + <span class="contact vcard"><span class="fn">Tim Berners-Lee</span></span>, + <span class="summary">invented the World Wide Web</span>. + </p> + Belongs to following groups: + <p> + <a class="affiliation vcard" href="http://www.w3.org/"> + <img class="fn photo" alt="W3C" src="http://www.w3.org/Icons/WWW/w3c_home_nb.png" /> + </a> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/affiliation/output.json

@@ -0,0 +1,31 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "contact": [{ + "value": "Tim Berners-Lee", + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"] + } + }], + "summary": ["invented the World Wide Web"], + "affiliation": [{ + "value": "", + "type": ["h-card"], + "properties": { + "name": ["W3C"], + "photo": ["http://www.w3.org/Icons/WWW/w3c_home_nb.png"], + "url": ["http://www.w3.org/"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["W3C"], + "photo": ["http://www.w3.org/Icons/WWW/w3c_home_nb.png"], + "url": ["http://www.w3.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/affiliation/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Affiliations", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/contact/input.html

@@ -0,0 +1,18 @@

+<div class="hresume"> + <div class="contact vcard"> + <p class="fn">Tim Berners-Lee</p> + <p class="org">MIT</p> + <p class="adr"> + <span class="street-address">32 Vassar Street</span>, + <span class="extended-address">Room 32-G524</span>, + <span class="locality">Cambridge</span>, + <span class="region">MA</span> + <span class="postal-code">02139</span>, + <span class="country-name">USA</span>. + (<span class="type">Work</span>) + </p> + <p>Tel:<span class="tel">+1 (617) 253 5702</span></p> + <p>Email:<a class="email" href="mailto:timbl@w3.org">timbl@w3.org</a></p> + </div> + <p class="summary">Invented the World Wide Web.</p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/contact/output.json

@@ -0,0 +1,52 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "contact": [{ + "value": "Tim Berners-Lee MIT 32 Vassar Street, Room 32-G524, Cambridge, MA 02139, USA. (Work) Tel:+1 (617) 253 5702 Email:timbl@w3.org", + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"], + "org": ["MIT"], + "adr": [{ + "value": "32 Vassar Street, Room 32-G524, Cambridge, MA 02139, USA. (Work)", + "type": ["h-adr"], + "properties": { + "street-address": ["32 Vassar Street"], + "extended-address": ["Room 32-G524"], + "locality": ["Cambridge"], + "region": ["MA"], + "postal-code": ["02139"], + "country-name": ["USA"], + "name": ["32 Vassar Street, Room 32-G524, Cambridge, MA 02139, USA. (Work)"] + } + }], + "tel": ["+1 (617) 253 5702"], + "email": ["mailto:timbl@w3.org"] + } + }], + "summary": ["Invented the World Wide Web."] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"], + "org": ["MIT"], + "adr": [{ + "value": "32 Vassar Street, Room 32-G524, Cambridge, MA 02139, USA. (Work)", + "type": ["h-adr"], + "properties": { + "street-address": ["32 Vassar Street"], + "extended-address": ["Room 32-G524"], + "locality": ["Cambridge"], + "region": ["MA"], + "postal-code": ["02139"], + "country-name": ["USA"], + "name": ["32 Vassar Street, Room 32-G524, Cambridge, MA 02139, USA. (Work)"] + } + }], + "tel": ["+1 (617) 253 5702"], + "email": ["mailto:timbl@w3.org"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/contact/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Contact", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/education/input.html

@@ -0,0 +1,13 @@

+<div class="hresume"> + <div class="contact vcard"> + <p class="fn">Tim Berners-Lee</p> + <p class="title">Director of the World Wide Web Foundation</p> + </div> + <p class="summary">Invented the World Wide Web.</p><hr /> + <p class="education vevent vcard"> + <span class="fn summary org">The Queen's College, Oxford University</span>, + <span class="description">BA Hons (I) Physics</span> + <time class="dtstart" datetime="1973-09">1973</time> – + <time class="dtend" datetime="1976-06">1976</time> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/education/output.json

@@ -0,0 +1,48 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "contact": [{ + "value": "Tim Berners-Lee Director of the World Wide Web Foundation", + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"], + "title": ["Director of the World Wide Web Foundation"] + } + }], + "summary": ["Invented the World Wide Web."], + "education": [{ + "value": "The Queen's College, Oxford University, BA Hons (I) Physics 1973 - 1976", + "type": ["h-event", "h-card"], + "properties": { + "name": ["The Queen's College, Oxford University"], + "org": ["The Queen's College, Oxford University"], + "description": ["BA Hons (I) Physics"], + "start": ["1973-09"], + "end": ["1976-06"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"], + "title": ["Director of the World Wide Web Foundation"] + } + },{ + "type": ["h-event"], + "properties": { + "name": ["The Queen's College, Oxford University"], + "description": ["BA Hons (I) Physics"], + "start": ["1973-09"], + "end": ["1976-06"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["The Queen's College, Oxford University"], + "org": ["The Queen's College, Oxford University"], + "description": ["BA Hons (I) Physics"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/education/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Educational experience", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="h-resume">Tim Berners-Lee, invented the World Wide Web.</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "name": ["Tim Berners-Lee, invented the World Wide Web."] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/skill/input.html

@@ -0,0 +1,13 @@

+<div class="h-resume"> + + <p> + <span class="contact vcard"><span class="fn">Tim Berners-Lee</span></span>, + <span class="summary">invented the World Wide Web</span>. + </p> + Skills: + <ul> + <li><a class="skill" rel="tag" href="http://example.com/skills/informationsystems">information systems</a></li> + <li><a class="skill" rel="tag" href="http://example.com/skills/advocacy">advocacy</a></li> + <li><a class="skill" rel="tag" href="http://example.com/skills/informationsystems">leadership</a></li> + <ul> +</ul></ul></div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/skill/output.json

@@ -0,0 +1,15 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "contact": [{ + "value": "Tim Berners-Lee", + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"] + } + }], + "summary": ["invented the World Wide Web"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/skill/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Skills", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "hresume parsing tests", + "description": "This page was design to test the parsing of hresume and its output to the newer JSON structure of micorformats 2. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/work/input.html

@@ -0,0 +1,15 @@

+<div class="hresume"> + <div class="contact vcard"> + <p class="fn">Tim Berners-Lee</p> + <p class="title">Director of the World Wide Web Foundation</p> + </div> + <p class="summary">Invented the World Wide Web.</p><hr /> + <div class="experience vevent vcard"> + <p class="title">Director</p> + <p><a class="fn summary org url" href="http://www.webfoundation.org/">World Wide Web Foundation</a></p> + <p> + <time class="dtstart" datetime="2009-01-18">Jan 2009</time> – Present + <time class="duration" datetime="P2Y11M">(2 years 11 month)</time> + </p> + </div> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/work/output.json

@@ -0,0 +1,50 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "contact": [{ + "value": "Tim Berners-Lee Director of the World Wide Web Foundation", + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"], + "title": ["Director of the World Wide Web Foundation"] + } + }], + "summary": ["Invented the World Wide Web."], + "experience": [{ + "value": "Director World Wide Web Foundation Jan 2009 - Present (2 years 11 month)", + "type": ["h-event", "h-card"], + "properties": { + "title": ["Director"], + "name": ["World Wide Web Foundation"], + "org": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"], + "start": ["2009-01-18"], + "duration": ["P2Y11M"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"], + "title": ["Director of the World Wide Web Foundation"] + } + },{ + "type": ["h-event"], + "properties": { + "name": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"], + "start": ["2009-01-18"], + "duration": ["P2Y11M"] + } + },{ + "type": ["h-card"], + "properties": { + "title": ["Director"], + "name": ["World Wide Web Foundation"], + "org": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hresume/work/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Work experience", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/hcard/input.html

@@ -0,0 +1,18 @@

+<div class="hreview-aggregate"> + <div class="item vcard"> + <h3 class="fn org">Mediterranean Wraps</h3> + <p> + <span class="adr"> + <span class="street-address">433 S California Ave</span>, + <span class="locality">Palo Alto</span>, + <span class="region">CA</span></span> - + + <span class="tel">(650) 321-8189</span> + </p> + </div> + <p class="rating"> + <span class="average value">9.2</span> out of + <span class="best">10</span> + based on <span class="count">17</span> reviews + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/hcard/output.json

@@ -0,0 +1,29 @@

+{ + "items": [{ + "type": ["h-review-aggregate"], + "properties": { + "item": [{ + "value": "Mediterranean Wraps 433 S California Ave, Palo Alto, CA - (650) 321-8189", + "type": ["h-item","h-card"], + "properties": { + "name": ["Mediterranean Wraps"], + "adr": [{ + "value": "433 S California Ave, Palo Alto, CA", + "type": ["h-adr"], + "properties": { + "street-address": ["433 S California Ave"], + "locality": ["Palo Alto"], + "region": ["CA"] + } + }], + "tel": ["(650) 321-8189"] + } + }], + "rating": ["9.2"], + "average": ["9.2"], + "best": ["10"], + "count": ["17"], + "name": ["Mediterranean Wraps 433 S California Ave, Palo Alto, CA - (650) 321-8189 9.2 out of 10 based on 17 reviews"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/hcard/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With item as a vcard", + "description": "hreview-aggregate", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/justahyperlink/input.html

@@ -0,0 +1,6 @@

+<p class="hreview-aggregate"> + <span class="item"> + <a class="fn url" href="http://example.com/mediterraneanwraps">Mediterranean Wraps</a> + </span> - Rated: + <span class="rating">4.5</span> out of 5 (<span class="count">6</span> reviews) +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/justahyperlink/output.json

@@ -0,0 +1,18 @@

+{ + "items": [{ + "type": ["h-review-aggregate"], + "properties": { + "item": [{ + "value": "", + "type": ["h-item"], + "properties": { + "name": ["Mediterranean Wraps"], + "url": ["http://example.com/mediterraneanwraps"] + } + }], + "rating": ["4.5"], + "count": ["6"], + "name": ["Mediterranean Wraps - Rated: 4.5 out of 5 (6 reviews)"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/justahyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Minimum properties", + "description": "hreview-aggregate", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "hreview-aggregate parsing tests", + "description": "This page was design to test the parsing of hreview-aggregate. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/vevent/input.html

@@ -0,0 +1,13 @@

+<div class="hreview-aggregate"> + <div class="item vevent"> + <h3 class="summary">Fullfrontal</h3> + <p class="description">A one day JavaScript Conference held in Brighton</p> + <p><time class="dtstart" datetime="2012-11-09">9th November 2012</time></p> + </div> + + <p class="rating"> + <span class="average value">9.9</span> out of + <span class="best">10</span> + based on <span class="count">62</span> reviews + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/vevent/output.json

@@ -0,0 +1,21 @@

+{ + "items": [{ + "type": ["h-review-aggregate"], + "properties": { + "item": [{ + "value": "Fullfrontal A one day JavaScript Conference held in Brighton 9th November 2012", + "type": ["h-item","h-event"], + "properties": { + "name": ["Fullfrontal"], + "description": ["A one day JavaScript Conference held in Brighton"], + "start": ["2012-11-09"] + } + }], + "rating": ["9.9"], + "average": ["9.9"], + "best": ["10"], + "count": ["62"], + "name": ["Fullfrontal A one day JavaScript Conference held in Brighton 9th November 2012 9.9 out of 10 based on 62 reviews"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview-aggregate/vevent/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With item as a vevent", + "description": "hreview-aggregate", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/hyperlink/input.html

@@ -0,0 +1,1 @@

+<a class="hreview" href="https://plus.google.com/116941523817079328322/about">Crepes on Cole</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/hyperlink/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "name": ["Crepes on Cole"], + "url": ["https://plus.google.com/116941523817079328322/about"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/hyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a hyperlink", + "description": "hreview", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/implieditem/input.html

@@ -0,0 +1,4 @@

+<div class="hreview"> + <a class="item" href="http://example.com/crepeoncole">Crepes on Cole</a> + <p><span class="rating">4.7</span> out of 5 stars</p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/implieditem/output.json

@@ -0,0 +1,17 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "item": [{ + "value": "Crepes on Cole", + "type": ["h-item"], + "properties": { + "name": ["Crepes on Cole"], + "url": ["http://example.com/crepeoncole"] + } + }], + "rating": ["4.7"], + "name": ["Crepes on Cole 4.7 out of 5 stars"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/implieditem/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With implied item name and url", + "description": "hreview", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/item/input.html

@@ -0,0 +1,7 @@

+<div class="hreview"> + <p class="item"> + <img class="photo" src="images/photo.gif" /> + <a class="fn url" href="http://example.com/crepeoncole">Crepes on Cole</a> + </p> + <p><span class="rating">5</span> out of 5 stars</p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/item/output.json

@@ -0,0 +1,18 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + + "item": [{ + "value": "Crepes on Cole", + "type": ["h-item"], + "properties": { + "photo": ["http://example.com/images/photo.gif"], + "name": ["Crepes on Cole"], + "url": ["http://example.com/crepeoncole"] + } + }], + "rating": ["5"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/item/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With item", + "description": "hreview", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/justaname/input.html

@@ -0,0 +1,1 @@

+<p class="hreview">Crepes on Cole</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/justaname/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "name": ["Crepes on Cole"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/justaname/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a name", + "description": "hreview", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/photo/input.html

@@ -0,0 +1,1 @@

+<img class="hreview" src="images/photo.gif" alt="Crepes on Cole" />
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/photo/output.json

@@ -0,0 +1,9 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "name": ["Crepes on Cole"], + "photo": ["http://example.com/images/photo.gif"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/photo/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Just a photo", + "description": "hreview", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "hreview parsing tests", + "description": "This page was design to test the parsing of hreview. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/vcard/input.html

@@ -0,0 +1,23 @@

+<div class="hreview"> + <span><span class="rating">5</span> out of 5 stars</span> + <h4 class="summary">Crepes on Cole is awesome</h4> + <span class="reviewer vcard"> + Reviewer: <span class="fn">Tantek</span> - + </span> + <time class="reviewed" datetime="2005-04-18">April 18, 2005</time> + <div class="description"> + <p class="item vcard"> + <span class="fn org">Crepes on Cole</span> is one of the best little + creperies in <span class="adr"><span class="locality">San Francisco</span></span>. + Excellent food and service. Plenty of tables in a variety of sizes + for parties large and small. Window seating makes for excellent + people watching to/from the N-Judah which stops right outside. + I've had many fun social gatherings here, as well as gotten + plenty of work done thanks to neighborhood WiFi. + </p> + </div> + <p>Visit date: <span>April 2005</span></p> + <p>Food eaten: <a rel="tag" href="http://en.wikipedia.org/wiki/crepe">crepe</a></p> + <p>Permanent link for review: <a rel="self bookmark" href="http://example.com/crepe">http://example.com/crepe</a></p> + <p><a rel="license" href="http://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License">Creative Commons Attribution-ShareAlike License</a></p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/vcard/output.json

@@ -0,0 +1,38 @@

+{ + "items": [{ + "type": ["h-review"], + "properties": { + "rating": ["5"], + "name": ["Crepes on Cole is awesome"], + "reviewer": [{ + "value": "Reviewer: Tantek -", + "type": ["h-card"], + "properties": { + "name": ["Tantek"] + } + }], + "description": [{ + "value": "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.", + "html": "\n <p class=\"item vcard\">\n <span class=\"fn org\">Crepes on Cole</span> is one of the best little \n creperies in <span class=\"adr\"><span class=\"locality\">San Francisco</span></span>.\n Excellent food and service. Plenty of tables in a variety of sizes \n for parties large and small. Window seating makes for excellent \n people watching to/from the N-Judah which stops right outside. \n I've had many fun social gatherings here, as well as gotten \n plenty of work done thanks to neighborhood WiFi.\n </p>\n " + }], + "item": [{ + "value": "Crepes on Cole is one of the best little creperies in San Francisco. Excellent food and service. Plenty of tables in a variety of sizes for parties large and small. Window seating makes for excellent people watching to/from the N-Judah which stops right outside. I've had many fun social gatherings here, as well as gotten plenty of work done thanks to neighborhood WiFi.", + "type": ["h-item", "h-card"], + "properties": { + "name": ["Crepes on Cole"], + "org": ["Crepes on Cole"], + "adr": [{ + "value": "San Francisco", + "type": ["h-adr"], + "properties": { + "locality": ["San Francisco"], + "name": ["San Francisco"] + } + }] + } + }], + "category": ["crepe"], + "url": ["http://example.com/crepe"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/hreview/vcard/test.json

@@ -0,0 +1,5 @@

+{ + "name": "With vcard item", + "description": "hreview", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/hcarditemref/input.html

@@ -0,0 +1,16 @@

+<div class="h-card" itemref="mozilla-org mozilla-adr"> + <span class="p-name">Brendan Eich</span> +</div> +<div class="h-card" itemref="mozilla-org mozilla-adr"> + <span class="p-name">Mitchell Baker</span> +</div> + +<p id="mozilla-org" class="p-org">Mozilla</p> +<p id="mozilla-adr" class="p-adr h-adr"> + <span class="p-street-address">665 3rd St.</span> + <span class="p-extended-address">Suite 207</span> + <span class="p-locality">San Francisco</span>, + <span class="p-region">CA</span> + <span class="p-postal-code">94107</span> + <span class="p-country-name">U.S.A.</span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/hcarditemref/output.json

@@ -0,0 +1,41 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Brendan Eich"], + "org": ["Mozilla"], + "adr": [{ + "value": "665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.", + "type": ["h-adr"], + "properties": { + "street-address": ["665 3rd St."], + "extended-address": ["Suite 207"], + "locality": ["San Francisco"], + "region": ["CA"], + "postal-code": ["94107"], + "country-name": ["U.S.A."], + "name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Mitchell Baker"], + "org": ["Mozilla"], + "adr": [{ + "value": "665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.", + "type": ["h-adr"], + "properties": { + "street-address": ["665 3rd St."], + "extended-address": ["Suite 207"], + "locality": ["San Francisco"], + "region": ["CA"], + "postal-code": ["94107"], + "country-name": ["U.S.A."], + "name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."] + } + }] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/hcarditemref/test.json

@@ -0,0 +1,5 @@

+{ + "name": "itemref include pattern - h-card", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/heventitemref/input.html

@@ -0,0 +1,25 @@

+<div class="h-event" itemref="io-session07"> + <span class="p-name">Monetizing Android Apps</span> - spaekers: + <span class="p-speaker">Chrix Finne</span>, + <span class="p-speaker">Kenneth Lui</span> - + <span itemref="io-location" class="p-location h-adr"> + <span class="p-extended-address">Room 10</span> + </span> +</div> +<div class="h-event" itemref="io-session07"> + <span class="p-name">New Low-Level Media APIs in Android</span> - spaekers: + <span class="p-speaker">Dave Burke</span> - + <span itemref="io-location" class="p-location h-adr"> + <span class="p-extended-address">Room 11</span> + </span> +</div> + +<p id="io-session07"> + Session 01 is between: + <time class="dt-start" datetime="2012-06-27T15:45:00-0800">3:45PM</time> to + <time class="dt-end" datetime="2012-06-27T16:45:00-0800">4:45PM</time> +</p> +<p id="io-location"> + <span class="p-extended-address">Moscone Center</span>, + <span class="p-locality">San Francisco</span> +</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/heventitemref/output.json

@@ -0,0 +1,52 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["Monetizing Android Apps"], + "speaker": ["Chrix Finne","Kenneth Lui"], + "location": [{ + "value": "Room 10 Moscone Center, San Francisco", + "type": ["h-adr"], + "properties": { + "extended-address": ["Room 10", "Moscone Center"], + "locality": ["San Francisco"], + "name": ["Room 10 Moscone Center, San Francisco"] + } + }], + "start": ["2012-06-27T15:45:00-0800"], + "end": ["2012-06-27T16:45:00-0800"] + } + },{ + "type": ["h-event"], + "properties": { + "name": ["New Low-Level Media APIs in Android"], + "speaker": ["Dave Burke"], + "location": [{ + "value": "Room 11 Moscone Center, San Francisco", + "type": ["h-adr"], + "properties": { + "extended-address": ["Room 11", "Moscone Center"], + "locality": ["San Francisco"], + "name": ["Room 11 Moscone Center, San Francisco"] + } + }], + "start": ["2012-06-27T15:45:00-0800"], + "end": ["2012-06-27T16:45:00-0800"] + } + },{ + "type": ["h-adr"], + "properties": { + "extended-address": ["Room 10", "Moscone Center"], + "locality": ["San Francisco"], + "name": ["Room 10 Moscone Center, San Francisco"] + } + },{ + "type": ["h-adr"], + "properties": { + "extended-address": ["Room 11", "Moscone Center"], + "locality": ["San Francisco"], + "name": ["Room 11 Moscone Center, San Francisco"] + } + } + ] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/heventitemref/test.json

@@ -0,0 +1,5 @@

+{ + "name": "itemref include pattern - h-event", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/hyperlink/input.html

@@ -0,0 +1,18 @@

+<div class="h-card"> + <span class="p-name">Ben Ward</span> + <a class="include" href="#twitter">Twitter</a> +</div> +<div class="h-card"> + <span class="p-name">Dan Webb</span> + <a class="include" href="#twitter">Twitter</a> +</div> + +<div id="twitter"> + <p class="p-org">Twitter</p> + <p class="p-adr h-adr"> + <span class="p-street-address">1355 Market St</span>, + <span class="p-locality">San Francisco</span>, + <span class="p-region">CA</span> + <span class="p-postal-code">94103</span> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/hyperlink/output.json

@@ -0,0 +1,38 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Ben Ward"], + "org": ["Twitter"], + "adr": [{ + "value": "1355 Market St, San Francisco, CA 94103", + "type": ["h-adr"], + "properties": { + "street-address": ["1355 Market St"], + "locality": ["San Francisco"], + "region": ["CA"], + "postal-code": ["94103"], + "name": ["1355 Market St, San Francisco, CA 94103"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Dan Webb"], + "org": ["Twitter"], + "adr": [{ + "value": "1355 Market St, San Francisco, CA 94103", + "type": ["h-adr"], + "properties": { + "street-address": ["1355 Market St"], + "locality": ["San Francisco"], + "region": ["CA"], + "postal-code": ["94103"], + "name": ["1355 Market St, San Francisco, CA 94103"] + } + }] + } + } + ] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/hyperlink/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Hyperlink header include pattern", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/object/input.html

@@ -0,0 +1,23 @@

+<div class="h-event"> + <span class="p-name">HTML5 & CSS3 latest features in action!</span> - + <span class="p-speaker">David Rousset</span> - + <time class="dt-start" datetime="2012-10-30T11:45:00-08:00">Tue 11:45am</time> + <object data="#buildconf" class="include" type="text/html" height="0" width="0"></object> +</div> +<div class="h-event"> + <span class="p-name">Building High-Performing JavaScript for Modern Engines</span> - + <span class="p-speaker">John-David Dalton</span> and + <span class="p-speaker">Amanda Silver</span> - + <time class="dt-start" datetime="2012-10-31T11:15:00-08:00">Wed 11:15am</time> + <object data="#buildconf" class="include" type="text/html" height="0" width="0"></object> +</div> + + +<div id="buildconf"> + <p class="p-summary">Build Conference</p> + <p class="p-location h-adr"> + <span class="p-locality">Redmond</span>, + <span class="p-region">Washington</span>, + <span class="p-country-name">USA</span> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/object/output.json

@@ -0,0 +1,40 @@

+{ + "items": [{ + "type": ["h-event"], + "properties": { + "name": ["HTML5 & CSS3 latest features in action!"], + "speaker": ["David Rousset"], + "summary": ["Build Conference"], + "start": ["2012-10-30T11:45:00-0800"], + "location": [{ + "value": "Redmond, Washington, USA", + "type": ["h-adr"], + "properties": { + "locality": ["Redmond"], + "region": ["Washington"], + "country-name": ["USA"], + "name": ["Redmond, Washington, USA"] + } + }] + } + },{ + "type": ["h-event"], + "properties": { + "name": ["Building High-Performing JavaScript for Modern Engines"], + "speaker": ["John-David Dalton","Amanda Silver"], + "summary": ["Build Conference"], + "start": ["2012-10-31T11:15:00-0800"], + "location": [{ + "value": "Redmond, Washington, USA", + "type": ["h-adr"], + "properties": { + "locality": ["Redmond"], + "region": ["Washington"], + "country-name": ["USA"], + "name": ["Redmond, Washington, USA"] + } + }] + } + } + ] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/object/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Object include pattern", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "include pattern tests", + "description": "This page was design to test the parsing of includes. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/table/input.html

@@ -0,0 +1,11 @@

+<table> + <tr> + <th id="org"><a class="u-url p-org" href="http://dev.opera.com/">Opera</a></th> + </tr> + <tr> + <td class="h-card" headers="org"><span class="p-name">Chris Mills</span></td> + </tr> + <tr> + <td class="h-card" headers="org"><span class="p-name">Erik Möller</span></td> + </tr> + </table>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/table/output.json

@@ -0,0 +1,18 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Chris Mills"], + "url": ["http://dev.opera.com/"], + "org": ["Opera"] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Erik Möller"], + "url": ["http://dev.opera.com/"], + "org": ["Opera"] + } + } + ] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/includes/table/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Table header include pattern", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/mixedpropertries/input.html

@@ -0,0 +1,13 @@

+<div class="h-card"> + <p> + <a class="p-name org u-url" href="http://mozilla.org/">Mozilla Foundation</a> + </p> + <p class="adr"> + <span class="street-address">665 3rd St.</span> + <span class="extended-address">Suite 207</span> + <span class="locality">San Francisco</span>, + <span class="region">CA</span> + <span class="postal-code">94107</span> + <span class="country-name">U.S.A.</span> + </p> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/mixedpropertries/output.json

@@ -0,0 +1,23 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Mozilla Foundation"], + "org": ["Mozilla Foundation"], + "url": ["http://mozilla.org/"], + "adr": [{ + "value": "665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A.", + "type": ["h-adr"], + "properties": { + "street-address": ["665 3rd St."], + "extended-address": ["Suite 207"], + "locality": ["San Francisco"], + "region": ["CA"], + "postal-code": ["94107"], + "country-name": ["U.S.A."], + "name": ["665 3rd St. Suite 207 San Francisco, CA 94107 U.S.A."] + } + }] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/mixedpropertries/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Mixed propertries form different versions", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/mixedroots/input.html

@@ -0,0 +1,15 @@

+<div class="h-resume"> + <div class="p-contact vcard"> + <p class="fn">Tim Berners-Lee</p> + <p class="title">Director of the World Wide Web Foundation</p> + </div> + <p class="summary">Invented the World Wide Web.</p><hr /> + <div class="p-experience vevent h-card"> + <p class="title">Director</p> + <p><a class="fn p-org summary url" href="http://www.webfoundation.org/">World Wide Web Foundation</a></p> + <p> + <time class="dtstart" datetime="2009-01-18">Jan 2009</time> – Present + <time class="duration" datetime="P2Y11M">(2 years 11 month)</time> + </p> + </div> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/mixedroots/output.json

@@ -0,0 +1,51 @@

+{ + "items": [{ + "type": ["h-resume"], + "properties": { + "contact": [{ + "value": "Tim Berners-Lee Director of the World Wide Web Foundation", + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"], + "title": ["Director of the World Wide Web Foundation"] + } + }], + "summary": ["Invented the World Wide Web."], + "experience": [{ + "value": "Director World Wide Web Foundation Jan 2009 - Present (2 years 11 month)", + "type": ["h-event", "h-card"], + "properties": { + "org": ["World Wide Web Foundation"], + "name": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"], + "start": ["2009-01-18"], + "duration": ["P2Y11M"], + "title": ["Director"] + } + }] + } + },{ + "type": ["h-card"], + "properties": { + "name": ["Tim Berners-Lee"], + "title": ["Director of the World Wide Web Foundation"] + } + },{ + "type": ["h-event"], + "properties": { + "org": ["World Wide Web Foundation"], + "name": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"], + "start": ["2009-01-18"], + "duration": ["P2Y11M"] + } + },{ + "type": ["h-card"], + "properties": { + "title": ["Director"], + "name": ["World Wide Web Foundation"], + "org": ["World Wide Web Foundation"], + "url": ["http://www.webfoundation.org/"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/mixedroots/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Mixed roots form different versions", + "description": "h-resume", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "h-adr parsing tests", + "description": "This page was design to test the parsing of mark-up which mixes version 1 and 2 microformats. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/tworoots/input.html

@@ -0,0 +1,1 @@

+<p class="h-card vcard">Frances Berriman</p>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/tworoots/output.json

@@ -0,0 +1,8 @@

+{ + "items": [{ + "type": ["h-card"], + "properties": { + "name": ["Frances Berriman"] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/mixed-versions/tworoots/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Roots from two versions", + "description": "h-card", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/alternate/input.html

@@ -0,0 +1,1 @@

+<link rel="updates alternate" type="application/atom+xml" href="updates.atom" />
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/alternate/output.json

@@ -0,0 +1,8 @@

+{ + "items": [], + "alternates": [{ + "url": "http://tantek.com/updates.atom", + "type": "application/atom+xml", + "rel": "updates" + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/alternate/test.json

@@ -0,0 +1,5 @@

+{ + "name": "A rel=alternate", + "description": "rel=alternate", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/license/input.html

@@ -0,0 +1,1 @@

+<a rel="license" href="http://creativecommons.org/licenses/by/2.5/">cc by 2.5</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/license/output.json

@@ -0,0 +1,6 @@

+{ + "items": [], + "rels": { + "license": ["http://creativecommons.org/licenses/by/2.5/"] + } +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/license/test.json

@@ -0,0 +1,5 @@

+{ + "name": "A rel=license", + "description": "rel=license", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/nofollow/input.html

@@ -0,0 +1,1 @@

+<a rel="nofollow" href="http://microformats.org/wiki/microformats:copyrights">Copyrights</a>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/nofollow/output.json

@@ -0,0 +1,6 @@

+{ + "items": [], + "rels": { + "nofollow": ["http://microformats.org/wiki/microformats:copyrights"] + } +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/nofollow/test.json

@@ -0,0 +1,5 @@

+{ + "name": "A rel=nofollow", + "description": "rel=nofollow", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "rel=* and xfn parsing tests", + "description": "This page was design to test the parsing of rel=* and xfn. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/xfn-all/input.html

@@ -0,0 +1,19 @@

+<ul> + <li><a rel="friend" href="http://example.com/profile/jane">jane</a></li> + <li><a rel="acquaintance" href="http://example.com/profile/jeo">jeo</a></li> + <li><a rel="contact" href="http://example.com/profile/lily">lily</a></li> + <li><a rel="met" href="http://example.com/profile/oliver">oliver</a></li> + <li><a rel="co-worker" href="http://example.com/profile/emily">emily</a></li> + <li><a rel="colleague" href="http://example.com/profile/jack">jack</a></li> + <li><a rel="neighbor" href="http://example.com/profile/isabella">isabella</a></li> + <li><a rel="child" href="http://example.com/profile/harry">harry</a></li> + <li><a rel="parent" href="http://example.com/profile/sophia">sophia</a></li> + <li><a rel="sibling" href="http://example.com/profile/charlie">charlie</a></li> + <li><a rel="spouse" href="http://example.com/profile/olivia">olivia</a></li> + <li><a rel="kin" href="http://example.com/profile/james">james</a></li> + <li><a rel="muse" href="http://example.com/profile/ava">ava</a></li> + <li><a rel="crush" href="http://example.com/profile/joshua">joshua</a></li> + <li><a rel="date" href="http://example.com/profile/chloe">chloe</a></li> + <li><a rel="sweetheart" href="http://example.com/profile/alfie">alfie</a></li> + <li><a rel="me" href="http://example.com/profile/isla">isla</a></li> +</ul>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/xfn-all/output.json

@@ -0,0 +1,22 @@

+{ + "items": [], + "rels": { + "friend": ["http://example.com/profile/jane"], + "acquaintance": ["http://example.com/profile/jeo"], + "contact": ["http://example.com/profile/lily"], + "met": ["http://example.com/profile/oliver"], + "co-worker": ["http://example.com/profile/emily"], + "colleague": ["http://example.com/profile/jack"], + "neighbor": ["http://example.com/profile/isabella"], + "child": ["http://example.com/profile/harry"], + "parent": ["http://example.com/profile/sophia"], + "sibling": ["http://example.com/profile/charlie"], + "spouse": ["http://example.com/profile/olivia"], + "kin": ["http://example.com/profile/james"], + "muse": ["http://example.com/profile/ava"], + "crush": ["http://example.com/profile/joshua"], + "date": ["http://example.com/profile/chloe"], + "sweetheart": ["http://example.com/profile/alfie"], + "me": ["http://example.com/profile/isla"] + } +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/xfn-all/test.json

@@ -0,0 +1,5 @@

+{ + "name": "A xfn all properties", + "description": "xfn", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/xfn-elsewhere/input.html

@@ -0,0 +1,10 @@

+<ul> + <li><a rel="me" href="http://twitter.com/glennjones">twitter</a></li> + <li><a rel="me" href="http://delicious.com/glennjonesnet/">delicious</a></li> + <li><a rel="me" href="https://plus.google.com/u/0/105161464208920272734/about">google+</a></li> + <li><a rel="me" href="http://lanyrd.com/people/glennjones/">lanyrd</a></li> + <li><a rel="me" href="http://github.com/glennjones">github</a></li> + <li><a rel="me" href="http://www.flickr.com/photos/glennjonesnet/">flickr</a></li> + <li><a rel="me" href="http://www.linkedin.com/in/glennjones">linkedin</a></li> + <li><a rel="me" href="http://www.slideshare.net/glennjones/presentations">slideshare</a></li> +</ul>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/xfn-elsewhere/output.json

@@ -0,0 +1,15 @@

+{ + "items": [], + "rels": { + "me": [ + "http://twitter.com/glennjones", + "http://delicious.com/glennjonesnet/", + "https://plus.google.com/u/0/105161464208920272734/about", + "http://lanyrd.com/people/glennjones/", + "http://github.com/glennjones", + "http://www.flickr.com/photos/glennjonesnet/", + "http://www.linkedin.com/in/glennjones", + "http://www.slideshare.net/glennjones/presentations" + ] + } +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/rel/xfn-elsewhere/test.json

@@ -0,0 +1,5 @@

+{ + "name": "A xfn elsewhere list", + "description": "xfn", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/url/suite.json

@@ -0,0 +1,4 @@

+{ + "name": "Expanding URLs in e-* properties parsing tests", + "description": "This page was design to test the expanding of relative URLs to absolute URLs in the HTML content of e-* propreties. These tests are part of the micorformats 2 test suite." +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/url/urlincontent/input.html

@@ -0,0 +1,13 @@

+<div class="h-entry"> + <h1><a class="p-name">Expanding URLs within HTML content</a></h1> + <div class="e-content"> + <ul> + <li><a href="http://www.w3.org/">Should not change: http://www.w3.org/</a></li> + <li><a href="http://example.com/">Should not change: http://example.com/</a></li> + <li><a href="test.html">File relative: test.html = http://example.com/test.html</a></li> + <li><a href="/test/test.html">Directory relative: /test/test.html = http://example.com/test/test.html</a></li> + <li><a href="/test.html">Relative to root: /test.html = http://example.com/test.html</a></li> + </ul> + <img src="http://www.w3.org/2008/site/images/logo-w3c-mobile-lg" /><img src="/images/test.gif" /> + </div> +</div>
A vendor/mf2/mf2/tests/test-suite/test-suite-data/url/urlincontent/output.json

@@ -0,0 +1,12 @@

+{ + "items": [{ + "type": ["h-entry"], + "properties": { + "name": ["Expanding URLs within HTML content"], + "content": [{ + "value": "Should not change: http://www.w3.org/ Should not change: http://example.com/ File relative: test.html = http://example.com/test.html Directory relative: /test/test.html = http://example.com/test/test.html Relative to root: /test.html = http://example.com/test.html", + "html": "\n <ul>\n <li><a href=\"http://www.w3.org/\">Should not change: http://www.w3.org/</a></li>\n <li><a href=\"http://example.com/\">Should not change: http://example.com/</a></li>\n <li><a href=\"http://example.com/test.html\">File relative: test.html = http://example.com/test.html</a></li>\n <li><a href=\"http://example.com/test/test.html\">Directory relative: /test/test.html = http://example.com/test/test.html</a></li>\n <li><a href=\"http://example.com/test.html\">Relative to root: /test.html = http://example.com/test.html</a></li>\n </ul>\n <img src=\"http://www.w3.org/2008/site/images/logo-w3c-mobile-lg\"><img src=\"http://example.com/images/test.gif\">\n " + }] + } + }] +}
A vendor/mf2/mf2/tests/test-suite/test-suite-data/url/urlincontent/test.json

@@ -0,0 +1,5 @@

+{ + "name": "Expanding URLs in e-* properties", + "description": "h-entry", + "author": "Glenn Jones" +}
A vendor/mf2/mf2/tests/test-suite/test-suite.php

@@ -0,0 +1,133 @@

+<?php + +/** + * php-mf2 test suite + * CLI usage from the tests/test-suite/ directory: php test-suite.php + * @see https://github.com/tobiastom/tests + * + * This will look through the specified directory for suite.json files + * that represent a suite of tests. Then, for each suite the sub-directories + * will be parsed for input.html, output.json, and test.json files. Each + * test will then be executed. If a test fails, a message is displayed along + * with the parsed output (array format) and the expected output (array format). + * + * Individual test suites may be run by calling TestSuite->runSuite($path) + * where $path is the file path to the suite.json file. + */ + +namespace Mf2\Parser\TestSuite; + +use Mf2\Parser; +use Mf2; + +require dirname(__DIR__) . '/../vendor/autoload.php'; + +class TestSuite +{ + private $path = ''; + + private $suites; + + private $tests_total = 0; + + private $tests_passed = 0; + + private $tests_failed = 0; + + /** + * This method constructs the TestSuite + * @param string $path: path to test-suite-data + * @access public + */ + public function __construct($path = './test-suite-data/') + { + $this->path = $path; + } # end method __construct() + + + /** + * This method runs the test suite + * @param array + * @access public + * @return bool + */ + public function start() + { + $directory = new \RecursiveDirectoryIterator($this->path); + $iterator = new \RecursiveIteratorIterator($directory); + $this->suites = new \RegexIterator($iterator, '/^.+suite\.json$/i', \RecursiveRegexIterator::GET_MATCH); + + foreach ( $this->suites as $suite ) + { + $this->runSuite(reset($suite)); + // echo "\n"; + } + + echo sprintf('Total tests: %d', $this->tests_total), "\n"; + echo sprintf('Passed: %d', $this->tests_passed), "\n"; + echo sprintf('Failed: %d', $this->tests_failed), "\n"; + + return TRUE; + } # end method start() + + + /** + * This method handles running a test suite + * @param string $path: path to the suite's JSON file + * @access public + * @return bool + */ + public function runSuite($path) + { + $suite = json_decode(file_get_contents($path)); + echo sprintf('Running %s.', $suite->name), "\n"; + + $iterator = new \DirectoryIterator(dirname($path)); + + # loop: each file in the test suite + foreach ( $iterator as $file ) + { + + # if: file is a sub-directory and not a dot-directory + if ( $file->isDir() && !$file->isDot() ) + { + $this->tests_total++; + + $path_of_test = $file->getPathname() . '/'; + + $test = json_decode(file_get_contents($path_of_test . 'test.json')); + $input = file_get_contents($path_of_test . 'input.html'); + $expected_output = json_decode(file_get_contents($path_of_test . 'output.json'), TRUE); + + $parser = new Parser($input, '', TRUE); + $output = $parser->parse(TRUE); + + # if: test passed + if ( $output['items'] === $expected_output['items'] ) + { + // echo '.'; # can output a dot for successful tests + $this->tests_passed++; + } + # else: test failed + else + { + echo sprintf('"%s" failed.', $test->name), "\n\n"; + echo sprintf('Parsed: %s', print_r($output, TRUE)), "\n"; + echo sprintf('Expected: %s', print_r($expected_output, TRUE)), "\n"; + $this->tests_failed++; + } # end if + + } # end if + + } # end loop + + return TRUE; + } # end method runSuite() + +} + +$TestSuite = new TestSuite(); +$TestSuite->start(); # run all test suites + +// Alternately, run a specific suite +// $TestSuite->runSuite('./test-suite-data/adr/suite.json');