issues

From Microformats Wiki
Revision as of 11:53, 23 November 2006 by Discoleo (talk | contribs) (Further minor corrections)
Jump to navigation Jump to search

Issues which apply to more than one microforamt.

Bloated Format

The Problem

Unfortunately, current microformats implementation consume a vast amount of space. The complexity will increase even more, when wanting to solve/add more complex issues. A direct consequence of this is a bloated format:

  • some of the markup is really bloated
    • instead of a number, we end sometimes with a whole new paragraph of markup
    • however, in order to be complete, the markup might need to be so
    • nevertheless, having a page with 1000 data points will be a horror scenario


Therefore, I proposed to open this new brainstorming session/page on how to efficiently implement the microformats in web pages.

Ideas/ Solutions

If we think a little bit back about css, one of the main reasons of its development was:

  • to separate content from style
    • page code becomes more easy to understand
    • and to maintain
    • and often the size shrinks significantly

We must learn this lesson when dealing with microformats. Specifically, the following issues are important:

  • extensive microformat markup inside the page code will significantly reduce the readability of the code
  • repeating the markup will increase page size
  • it will become more difficult to maintain/change the page


Solution

  • define microformat classes
    • e.g. in the page header, or
    • in a separate file (see later)
  • define abbreviations to those classes
    • use actually only the abbrevioations inside the web page, instead of the whole paragraph of markup


  • define the microformat classes inside a separate file (similarly to the css)
    • this file needs NOT to be downloaded automatically
      • you do NOT need it for displaying the data
      • it is only needed when wanting to import the data somewhere
      • most viewers, however, only view the data
    • let the browser automatically download this file, only IF:
      • there is enough bandwidth
      • the user wants to copy that data
      • the user wants to explicitly save the whole page
    • when the user wants to copy an item
      • the web browser should acces that microformats additional page and
      • download only the relevant class (NO need to actually download the whole page)
      • EXTEND html protocol to be able to download web-file/class-defined-inside-file without beeing necessary to download the whole file


Requirements

New Tags:

  • <struct> ... </struct>: like the C/C++ struct, will define the microformats structure
  • <v> ... </v>: this will define the variable inside the struct that should be replaced
  • <v ... />: similarly to above, but this will NOT be displayed by the browser
    • <v> is a shorthand for var, to further reduce file size

Examples

Lets take this code:

 <div class="hcite">
  <div class="book">
   <span class="fn">Book Title</span>
   <div class="chapter">
      <span class="fn">Chapter Title</span>
   </div>
  </div>
 </div>

We would define this in the header like this:

 <struct>
 MyName{
  <div class="hcite">
   <div class="book">
    <span class="fn"><v /></span>
    <div class="chapter">
       <span class="fn"><v /></span>
    </div>
   </div>
  </div>
 }
 </struct>

or in a separate microformats file (NO struct needed):

 MyName{
  <div class="hcite">
   <div class="book">
    <span class="fn"><v /></span>
    <div class="chapter">
       <span class="fn"><v /></span>
    </div>
   </div>
  </div>
 }

Inside the web page we use:

 <struct class="MyName">
   <v>1st variable</v>
   <v>2nd variable</v>
 </struct>


IF, one variable should NOT be displayed by the browser, we would use <v val="..." /> instead (the val= could be omitted), e.g.:

 <div class="geo">
  <abbr class="latitude" title="37.408183">N 37° 24.491</abbr> 
  <abbr class="longitude" title="-122.13855">W 122° 08.313</abbr>
 </div>

Would become:

  • inside the microformats definition page write:
 MyGeoStructure{
  <div class="geo">
   <abbr class="latitude" title=v><v /></abbr> 
   <abbr class="longitude" title=v><v /></abbr>
  </div>
 }
  • the code inside the web page:
 <struct class="MyGeoStructure">
   <v "37.408183" /><v>N 37° 24.491</v>
   <v "-122.13855" /><v>W 122° 08.313</v>
 </struct>


- discussion opened by Leonard Mada