Using Microformat for address and coordinate output

Tobias Maier - November 22, 2006 - 17:49
Project:Location
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

It would be a great benefit to use Microformats for the address output.

I think that the hcard-Microformat or the geo-Microformat fits.

What do you think about this?

#1

Tobias Maier - November 22, 2006 - 20:02
Title:Investigate using Microformat for adress output» Using Microformat for address output
Version:6.x-3.x-dev» 4.7.x-1.x-dev
Status:active» needs review

here comes the first patch for this.

Changes:

  1. using hcard-Microformat at theme_location() and theme_location_de()
    One issue/question: What should we do (which hcard-class) with $location['name']? We can't say if it is the organization or the name of a person or anything else...
  2. removed ?> at the end of location.inc and location.de.inc
  3. removed white space at the end of lines
AttachmentSize
location_microformat_vcard.patch.txt 43.29 KB

#2

Tobias Maier - November 22, 2006 - 20:15

I forgot to mention that I added the $hide argument for functions like theme_location_de()...

btw. it seems like that this function can't be overwritten (like every other theme-function)

#3

Tobias Maier - November 22, 2006 - 22:42

since the class "fn" is required I added this one to $location['name']

AttachmentSize
location_microformat_vcard.patch_0.txt 43.31 KB

#4

Tobias Maier - November 25, 2006 - 00:37

Here is an example you can find on one of my sites:
standorte/waschsalon-albertrosshaupterstrasse-munchen

btw. I like the Tails extension for Firefox 2.0 to view and export microformats from websites.

#5

m3avrck - November 29, 2006 - 04:00

This patch looks much bigger than it should, I'm guessing it's a line ending problem, either unix or windows based.

Not sure if location module had it wrong or your patch but be good to double check that :-)

#6

Tobias Maier - December 1, 2006 - 16:12
Status:needs review» needs work

it is so big, because I removed blanks in the end of lines...
They were so much so that this patch got far too big...
I putted this in an own patch: http://drupal.org/node/100830
it is really not an important patch, but the code looks cleaner IMHO...

#7

Tobias Maier - December 1, 2006 - 16:26
Status:needs work» needs review

I hope this patch works...

is clean now..

AttachmentSize
location_microformat_vcard.patch_1.txt 6.32 KB

#8

Richard Eriksson - December 20, 2006 - 00:07

Building on the patches above, I added http://microformats.org/wiki/geo support. My patch definitely needs review because a) I applied the above patches manually and ended up moving around some curly braces (some possibly in the wrong spot).

AttachmentSize
location.inc-vcard-geo.patch.txt 3.35 KB

#9

ankur - December 22, 2006 - 02:30

Oh man. I gotta learn about microformats and geo-microformats before I can even test these patches? Any volunteers? I'm curious myself, but can't expense the time at the moment.

Taking a quick look at the microformat classes, I'm anxious to get both 'geo' and 'adr' class support.

Richard, if you're not sure your braces are in the right places, would you mind testing it and seeing if it works and outputs the appropriate HTML?

Tobias, would you be willing to a look if you get a chance. I would like to commit a verifiedly working version of this patch soon.

-Ankur

#10

Tobias Maier - December 22, 2006 - 10:38

I added Richards' patch to my one and made it translatable

You can see it live at
http://www.muenchner-waschsalon.de/standorte/waschsalon-aidenbachstrasse...

But to be honest: I dont like the way lat/lon gets presented to the end user.
my second thought is that I dont even know if we should bother the end-user with such specific data like this...

AttachmentSize
location_microformat_vcard.patch_2.txt 7.2 KB

#11

Tobias Maier - December 22, 2006 - 10:44

oh sorry
I tried a new editor which added a few new tabulators instead of two blanks.
here comes the corrected patch

AttachmentSize
location_microformat_vcard.patch_3.txt 7.22 KB

#12

Tobias Maier - January 4, 2007 - 13:32

Hello Ankur,

whats your opinion about this?
Personally I prefer the version without lat/lon (#7).

#13

ankur - January 5, 2007 - 00:51

Yeah, it would probably look aesthetically displeasing to have the lat/lon displayed for every address that has a pair figured out. Perhaps we can make it something configurable? or leave it up to the themer if the themer chooses to replace the theming function with one of their own.

Will update the patch so that it is configurable.

In the meantime, do microformats support fields that can be a part of a microformatting, but somehow hidden and parseable by something that collects microformat data?

#14

m3avrck - January 5, 2007 - 00:56

Sure, you could hide the microformat text using CSS.

Would be a technique similar to one of these: http://www.mezzoblue.com/tests/revised-image-replacement/

That would probably be the best be to comply fully with the microformat, no?

#15

m3avrck - January 5, 2007 - 01:04

For reference, this is exactly what Flickr does as evidenced here:

<div style="position: absolute; right:7px; bottom:7px; font-family: Arial; font-size: 11px; color: #999"><i>40°24' 54" N, 3°41' 57" W<span class='geo' style='display:none'><span class='latitude'>40.414933</span><span class='longitude'>-3.699259</span></span></i></div>

#16

Tobias Maier - January 5, 2007 - 08:18

the right way to do the same what flickr does is

<span class='geo'><abbr class='latitude' title="40.414933">40°24' 54" N</abbr>, <abbr class='longitude' title="-3.699259">3°41' 57" W</abbr></span>

and if you want to never show it then this should be right

<span class='geo'><abbr class='latitude' title="40.414933" /><abbr class='longitude' title="-3.699259" /></span>

see point 5 of http://microformats.org/wiki/hcard#Semantic_XHTML_Design_Principles

#17

m3avrck - January 5, 2007 - 20:31
Status:needs review» needs work

Tobias, right on.

And we should *not* hardcode display:none, that should go into the CSS file.

Just wanted to illustrate the point that we can use the full geo format and CSS to hide what we don't need, just like Flickr. That way people can use CSS to turn on and off what they don't want.

Seems like that solves this issue -- time for an updated patch?

#18

Tobias Maier - January 6, 2007 - 14:41
Status:needs work» needs review

allright, here it is

it uses <abbr /> to hide latitude and longitude in general

AttachmentSize
location_microformat_vcard.patch_4.txt 6.93 KB

#19

geodaniel - January 20, 2007 - 16:07

+1

Haven't tested the patch yet, but I like the idea of adding microformats for the addresses, and it fixes #109954 as well, which didn't close the tags properly in the .de include.

#20

ankur - February 25, 2007 - 00:06
Status:needs review» fixed

Applied to DRUPAL-4-7 and DRUPAL-5

#21

Pancho - February 28, 2007 - 12:31

subscribing

#22

ankur - February 28, 2007 - 20:47

Pancho, you're subscribing to an issue that's been marked fixed? Did the application of this patch break something?

#23

Anonymous - March 14, 2007 - 21:02
Status:fixed» closed

#24

geodaniel - September 6, 2007 - 10:57
Title:Using Microformat for address output» Using Microformat for address and coordinate output
Version:4.7.x-1.x-dev» 5.x-1.x-dev
Status:closed» needs work

I have just spotted a little bug in this: the latitude variable is being used twice, one in the right place and one in place of the longitude variable. Also, I can't see this in the current 5.x version of location.inc. Was it intentionally taken out in 1.45.2.5?

For testing these out by the way, the Operator toolbar for Firefox is very handy.

#25

jiangxijay - October 20, 2007 - 01:55

Has this been fixed?

#26

bdragon - March 7, 2008 - 18:14
Status:needs work» duplicate

It moved to the .theme file.
Fixed in seperate issue, thanks.

#27

bdragon - March 8, 2008 - 01:10

Committed a followup change to follow the recommendation from #16

 
 

Drupal is a registered trademark of Dries Buytaert.