@@ -96,7 +96,7 @@ use Mf2;
9696$mf = Mf2\fetch('http://microformats.org');
9797
9898foreach ($mf['items'] as $microformat) {
99- echo "A {$microformat['type'][0]} called {$microformat['properties']['name'][0]}\n";
99+ echo "A {$microformat['type'][0]} called {$microformat['properties']['name'][0]}\n";
100100}
101101
102102```
@@ -116,16 +116,16 @@ $output = Mf2\parse($html, 'https://waterpigs.co.uk/');
116116
117117``` json
118118{
119- "items" : [
120- {
121- "type" : [" h-card" ],
122- "properties" : {
123- "name" : [" Barnaby Walters" ],
124- "url" : [" https://waterpigs.co.uk/" ]
125- }
126- }
127- ],
128- "rels" : {}
119+ "items" : [
120+ {
121+ "type" : [" h-card" ],
122+ "properties" : {
123+ "name" : [" Barnaby Walters" ],
124+ "url" : [" https://waterpigs.co.uk/" ]
125+ }
126+ }
127+ ],
128+ "rels" : {}
129129}
130130```
131131
@@ -139,8 +139,8 @@ Most of the time you’ll be getting your input HTML from a URL. You should pass
139139
140140``` html
141141<div class =" h-card" >
142- <h1 class =" p-name" >Mr. Example</h1 >
143- <img class =" u-photo" alt =" " src =" /photo.png" />
142+ <h1 class =" p-name" >Mr. Example</h1 >
143+ <img class =" u-photo" alt =" " src =" /photo.png" />
144144</div >
145145```
146146
@@ -154,15 +154,15 @@ will result in the following output, with relative URLs made absolute:
154154
155155``` json
156156{
157- "items" : [{
158- "type" : [" h-card" ],
159- "properties" : {
160- "name" : [" Mr. Example" ],
161- "photo" : [" http://example.org/photo.png" ]
162- }
163- }],
164- "rels" : {},
165- "rel-urls" : {}
157+ "items" : [{
158+ "type" : [" h-card" ],
159+ "properties" : {
160+ "name" : [" Mr. Example" ],
161+ "photo" : [" http://example.org/photo.png" ]
162+ }
163+ }],
164+ "rels" : {},
165+ "rel-urls" : {}
166166}
167167```
168168
@@ -181,19 +181,19 @@ parsing will result in the following keys:
181181
182182``` json
183183{
184- "items" : [],
185- "rels" : {
186- "me" : [" https://twitter.com/barnabywalters" ]
187- },
188- "rel-urls" : {
189- "https://twitter.com/barnabywalters" : {
190- "text" : " Me on twitter" ,
191- "rels" : [" me" ]
192- },
193- "http://example.com/notes.atom" : {
194- "rels" : [" alternate" ," etc" ]
195- }
196- }
184+ "items" : [],
185+ "rels" : {
186+ "me" : [" https://twitter.com/barnabywalters" ]
187+ },
188+ "rel-urls" : {
189+ "https://twitter.com/barnabywalters" : {
190+ "text" : " Me on twitter" ,
191+ "rels" : [" me" ]
192+ },
193+ "http://example.com/notes.atom" : {
194+ "rels" : [" alternate" ," etc" ]
195+ }
196+ }
197197}
198198```
199199
@@ -218,7 +218,7 @@ To learn what the HTTP status code for any request was, or learn more about the
218218
219219$mf = Mf2\fetch('http://waterpigs.co.uk/this-page-doesnt-exist', true, $curlInfo);
220220if ($curlInfo['http_code'] == '404') {
221- // This page doesn’t exist.
221+ // This page doesn’t exist.
222222}
223223
224224```
@@ -255,9 +255,9 @@ There is still [ongoing brainstorming](http://microformats.org/wiki/microformats
255255
256256```php
257257$doc = '<div class=" h-entry " lang=" sv " id=" postfrag123 " >
258- <h1 class=" p-name " >En svensk titel</h1>
259- <div class=" e-content " lang=" en " >With an <em>english</em> summary</div>
260- <div class=" e-content " >Och <em>svensk</em> huvudtext</div>
258+ <h1 class=" p-name " >En svensk titel</h1>
259+ <div class=" e-content " lang=" en " >With an <em>english</em> summary</div>
260+ <div class=" e-content " >Och <em>svensk</em> huvudtext</div>
261261</div>';
262262$parser = new Mf2\Parser($doc);
263263$parser->lang = true;
@@ -266,29 +266,29 @@ $result = $parser->parse();
266266
267267```json
268268{
269- " items " : [
270- {
271- " type " : [" h-entry " ],
272- " properties " : {
273- " name " : [" En svensk titel " ],
274- " content " : [
275- {
276- " html " : " With an <em >english</em > summary",
277- "value": "With an english summary",
278- "lang": "en"
279- },
280- {
281- "html": "Och <em >svensk</em > huvudtext",
282- "value": "Och svensk huvudtext",
283- "lang": "sv"
284- }
285- ]
286- },
287- "lang": "sv"
288- }
289- ],
290- "rels": {},
291- "rel-urls": {}
269+ " items " : [
270+ {
271+ " type " : [" h-entry " ],
272+ " properties " : {
273+ " name " : [" En svensk titel " ],
274+ " content " : [
275+ {
276+ " html " : " With an <em >english</em > summary",
277+ "value": "With an english summary",
278+ "lang": "en"
279+ },
280+ {
281+ "html": "Och <em >svensk</em > huvudtext",
282+ "value": "Och svensk huvudtext",
283+ "lang": "sv"
284+ }
285+ ]
286+ },
287+ "lang": "sv"
288+ }
289+ ],
290+ "rels": {},
291+ "rel-urls": {}
292292}
293293```
294294
@@ -553,8 +553,8 @@ Many thanks to @aaronpk, @gRegorLove and @kylewm for contributions, @aaronpk and
553553* ` Mf2\parse() ` function added to simplify the most common case of just parsing some HTML
554554* Updated e-* property parsing rules to match mf2 parsing spec — instead of producing inconsistent HTML content, it now produces dictionaries like <pre ><code >
555555{
556- "html": "<b >The Content</b >",
557- "value: "The Content"
556+ "html": "<b >The Content</b >",
557+ "value: "The Content"
558558}
559559</code ></pre >
560560* Removed ` htmlSafe ` options as new e-* parsing rules make them redundant
0 commit comments