Skip to content

Commit

Permalink
Merge pull request #99 from kartikprabhu/master
Browse files Browse the repository at this point in the history
Some reorganisation
  • Loading branch information
kevinmarks authored Apr 9, 2018
2 parents 0b862b8 + 5b47108 commit dda3a59
Show file tree
Hide file tree
Showing 43 changed files with 904 additions and 534 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
# Change Log
All notable changes to this project will be documented in this file.

## 1.1.0 - 2018-03-16

- bump version to 1.1.0 since it is a "major" change
- added tests for new implied name rules
- modified earlier tests to accommodate new rules
- use space separator instead of "T"
- Don't add "00" seconds unless authored
- use TZ authored in separate `value` element
- only use first found `value` of a particular type `date`, `time`, or `timezone`.
- move backcompat rules into JSON files
- reorganise value class pattern parsing into new files
- add datetime_helpers to organise datetime parsing rules
- reorganise tests
- remove Heroku frontend, point to mf2py-web and python.microformats.io instead in README.
- remove Flask and gunicorn requirements
- add debug info with description, version, url and the html parser used

## 1.0.6 - 2018-03-04

- strip leading/trailing white space for `e-*[html]`. update the corresponding tests
- blank values explicitly authored are allowed as property values
- include `alt` or `src` from `<img>` in parsing for `p-*` and `e-*[value]`
- parse `title` from `<link>` for `p-*` resolves #84
- and `poster` from `<video>` for `u-*` resolves #76
- use `html5lib` as default parser
- use the final redirect URL resolves #62
- update requirements to use BS4 v4.6.0 and html5lib v1.0.1
- drop support for Python 2.6 as html5lib dropped support

## 1.0.5 - 2016-05-09

- Implied property checks now ignore alt="", treating it the same as
Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mf2py
=====

[![Build Status](https://travis-ci.org/tommorris/mf2py.svg?branch=master)](https://travis-ci.org/tommorris/mf2py)
[![Build Status](https://travis-ci.org/microformats/mf2py.svg?branch=master)](https://travis-ci.org/microformats/mf2py)

[![Can I Use Python 3?](https://caniusepython3.com/project/mf2py.svg)](https://caniusepython3.com/project/mf2py)

Expand All @@ -10,7 +10,7 @@ Python parser for [microformats 2](http://microformats.org/wiki/Microformats2).
Current status: Full-featured and mostly stable. Implements the full
mf2 spec, including backward compatibility with microformats1.

Documentation, code tidying and so on is rather lacking.
Documentation, code tidying and so on is rather lacking.

License: [MIT](http://opensource.org/licenses/mit-license.php)

Expand All @@ -28,13 +28,13 @@ Import the parser using

Parse a file containing the content

with open('file/content.html','r') as file:
with open('file/content.html','r') as file:
obj = mf2py.parse(doc=file)

Parse string containing content

content = '<article class="h-entry"><h1 class="p-name">Hello</h1></article>'
obj = mf2py.parse(doc=content)
content = '<article class="h-entry"><h1 class="p-name">Hello</h1></article>'
obj = mf2py.parse(doc=content)

Parse content from a URL

Expand All @@ -47,14 +47,21 @@ available by invoking the object directly.
Get parsed microformat in a variety of formats

p = mf2py.Parser(...)
p.to_dict() # returns a python dictionary
p.to_json() # returns a JSON string
p.to_dict() # returns a python dictionary
p.to_json() # returns a JSON string

Filter by microformat type

p.to_dict(filter_by_type="h-entry")
p.to_json(filter_by_type="h-entry")

Frontends
-------------

A basic web interface for mf2py and [mf2util](https://github.com/kylewm/mf2util) is available at [mf2py-web](https://github.com/kylewm/mf2py-web).

A hosted live version can be found at [python.microformats.io](https://python.microformats.io).

Contributions
-------------

Expand Down
28 changes: 28 additions & 0 deletions mf2py/backcompat-rules/adr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"type": [
"h-adr"
],
"properties": {
"locality": [
"p-locality"
],
"region": [
"p-region"
],
"extended-address": [
"p-extended-address"
],
"post-office-box": [
"p-post-office-box"
],
"street-address": [
"p-street-address"
],
"postal-code": [
"p-postal-code"
],
"country-name": [
"p-country-name"
]
}
}
13 changes: 13 additions & 0 deletions mf2py/backcompat-rules/geo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"type": [
"h-geo"
],
"properties": {
"latitude": [
"p-latitude"
],
"longitude": [
"p-longitude"
]
}
}
39 changes: 39 additions & 0 deletions mf2py/backcompat-rules/hentry.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"type": [
"h-entry"
],
"properties": {
"category": [
"p-category"
],
"entry-title": [
"p-name"
],
"published": [
"dt-published"
],
"latitude": [
"p-latitude"
],
"entry-content": [
"e-content"
],
"entry-summary": [
"p-summary"
],
"author": [
"p-author",
"h-card"
],
"geo": [
"p-geo",
"h-geo"
],
"updated": [
"dt-updated"
],
"longitude": [
"p-longitude"
]
}
}
22 changes: 22 additions & 0 deletions mf2py/backcompat-rules/hfeed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"type": [
"h-feed"
],
"properties": {
"category": [
"p-category"
],
"site-description": [
"p-summary"
],
"description": [
"p-summary"
],
"site-title": [
"p-name"
],
"title": [
"p-name"
]
}
}
36 changes: 36 additions & 0 deletions mf2py/backcompat-rules/hproduct.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"type": [
"h-product"
],
"properties": {
"category": [
"p-category"
],
"price": [
"p-price"
],
"description": [
"p-description"
],
"url": [
"u-url"
],
"photo": [
"u-photo"
],
"brand": [
"p-brand"
],
"identifier": [
"u-identifier"
],
"review": [
"p-review",
"h-review",
"e-description"
],
"fn": [
"p-name"
]
}
}
35 changes: 35 additions & 0 deletions mf2py/backcompat-rules/hrecipe.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"type": [
"h-recipe"
],
"properties": {
"nutrition": [
"p-nutrition"
],
"yield": [
"p-yield"
],
"author": [
"p-author",
"h-card"
],
"duration": [
"dt-duration"
],
"photo": [
"u-photo"
],
"instructions": [
"e-instructions"
],
"summary": [
"p-summary"
],
"fn": [
"p-name"
],
"ingredient": [
"p-ingredient"
]
}
}
29 changes: 29 additions & 0 deletions mf2py/backcompat-rules/hresume.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"type": [
"h-resume"
],
"properties": {
"experience": [
"h-event",
"p-experience"
],
"summary": [
"p-summary"
],
"affiliation": [
"p-affiliation",
"h-card"
],
"contact": [
"h-card",
"p-contact"
],
"skill": [
"p-skill"
],
"education": [
"h-event",
"p-education"
]
}
}
47 changes: 47 additions & 0 deletions mf2py/backcompat-rules/hreview-aggregate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"type": [
"h-review-aggregate"
],
"properties": {
"rating": [
"p-rating"
],
"description": [
"p-description"
],
"photo": [
"u-photo"
],
"worst": [
"p-worst"
],
"reviewer": [
"p-reviewer",
"p-author",
"h-card"
],
"best": [
"p-best"
],
"count": [
"p-count"
],
"votes": [
"p-votes"
],
"dtreviewed": [
"dt-reviewed"
],
"url": [
"u-url"
],
"summary": [
"p-name"
],
"fn": [
"p-item",
"h-item",
"p-name"
]
}
}
Loading

0 comments on commit dda3a59

Please sign in to comment.