Wednesday, December 14, 2011

Geek alert: If you're not interested in the minutia of XML markup, CSS modification and the back end of a digital cookbook, you're excused.  Otherwise...

I took a hard look at the RecipeBook XML DTD and stylesheet that is on the happy-monkey.net website.  Also looked at the RecipeML DTD...  Interesting stuff, though the RecipeML site content hasn't been updated since 2002.  I can't tell if anyone's even looking at it besides me...

RecipeBook XML is definitely more concise than RecipeML.  It looks more like there may still be someone at home, even though the copyright information hasn't been updated since 2005.  Still, there's no (lack-of-industry) standard.  Truthfully, I doubt if anyone is clamoring for one.  Still, I'd like a way to store my own recipes, print out new copies of soiled pages, share recipes and ideas with friends and have fast, easy access to recipes on the computer by clicking on a category (metadata).  The kind of access I want requires some level of database behind it.

Otherwise, I suspect I could create a template and application (Wordpress?) for entering and importing recipes to your cookbook...

The RecipeBook XML DTD is as follows:


<!--


RecipeXML - An XML recipe markup language.


Copyright (C) 2005 David Horton
This work is licensed under the Creative Commons Attribution Share-Alike
license.  See http://creativecommons.org/licenses/by/2.0/ for details.


-->




<!-- === Hyperlinks for URL references === -->


<!ELEMENT hyperlink (#PCDATA)>
<!ATTLIST hyperlink url CDATA #REQUIRED>




<!-- === Information about a recipe === -->


<!ELEMENT author (#PCDATA)>
<!ELEMENT blurb (#PCDATA)>
<!ELEMENT effort (#PCDATA)>
<!ELEMENT genre (#PCDATA)>
<!ELEMENT preptime (#PCDATA)>
<!ELEMENT source (#PCDATA|hyperlink)*>
<!ELEMENT yield (#PCDATA)>




<!-- === Lists of ingredients === -->


<!ELEMENT fooditem (#PCDATA)>
<!ELEMENT quantity (#PCDATA)>
<!ELEMENT unit (#PCDATA)>
<!-- FIXME? The mixed-content definition below does not enforce one and
     only one instance of the tags quantity, unit and fooditem. -->
<!ELEMENT ingredient (#PCDATA | quantity | unit | fooditem)*>




<!-- === Elements of preparation === -->


<!ELEMENT equipment (#PCDATA | hyperlink)*>
<!ELEMENT step (#PCDATA | equipment | hyperlink)*>




<!-- === The main elements of a recipe === -->


<!ELEMENT title (#PCDATA)>
<!ELEMENT recipeinfo (author | blurb | effort | genre | preptime | source | yield)*>
<!ELEMENT ingredientlist (ingredient)*>
<!ELEMENT preparation (#PCDATA | equipment | step | hyperlink)*>
<!ELEMENT serving (#PCDATA | hyperlink)*>
<!ELEMENT notes (#PCDATA | hyperlink)*>




<!-- === And finally, the recipe itself === -->


<!ELEMENT recipe (title, recipeinfo?, ingredientlist, preparation, serving?, notes?)>




<!-- === The following elements provide logical groupings of recipes === -->




<!-- === A section provides logical divisions of a cookbook === -->


<!ELEMENT section (title, recipe+)>




<!-- === A cookbook consists of one or more recipes or sections === -->


<!ELEMENT cookbook (title, (section | recipe)+)>

And the CSS file is:

/*

This cascading style sheet can be used to style raw RecipeBook XML
[http://www.happy-monkey.net/recipebook/] in a XML/CSS capable browser
It is also handy to use with XML editors like XMLMind's XXE
[http://www.xmlmind.com/xmleditor] that use CSS for presenting the
document while editing.

recipebook-xml.css was written by David Horton

*/

hyperlink {
  display: inline;
  color: #0000FF;
  text-decoration: underline;
}

cookbook {
  display: block;
  background-color: #FFFFFF;
  font-family: sans-serif;
  font-size: 12pt;
  margin: 12pt;
  padding: 12pt;
}

cookbook>title {
  display: block;
  font-size: 24pt;
}

cookbook>subtitle {
  display: block;
  font-size: 16pt;
  font-style: italic;
}

cookbook>cookbookinfo>author {
  display: block;
  font-size: 16pt;
}

cookbook>cookbookinfo>copyright {
  display: block;
}

cookbookinfo>license {
  display:block;
}

section {
  display: block;
  background-color: #FFFFFF;
  font-family: sans-serif;
  font-size: 12pt;
  margin: 12pt;
  padding: 12pt;
}

section>title {
  font-size: 16pt;
  font-weight: bold;
}

recipe {
  display: block;
  background-color: #FFFFFF;
  font-family: sans-serif;
  font-size: 12pt;
  margin: 12pt;
  padding: 12pt;
}

recipe>title {
  display: block;
  font-weight: bold;
}

recipe>subtitle {
  display: block;
  font-style: italic;
}

recipeinfo {
  display: block;
  margin-top: 12pt;
  margin-bottom: 12pt;
}

recipe>author {
  display: block;
}

recipe>author:before {
  display: inline;
  content: "Recipe by: ";
}

blurb {
  display: block;
}

genre {
  display: block;
}

genre:before {
  display: inline;
  content: "File under: ";
}

preptime {
  display: block;
}

preptime:before {
  display: inline;
  content: "Preparation Time: ";
}

source {
  display: block;
}

source:before {
  display: inline;
  content: "Source: ";
}

yield {
  display: block;
}

yield:before {
  display: inline;
  content: "Yield: ";
}

ingredientlist {
  display: block;
  margin-top: 12pt;
  margin-bottom: 12pt;
}

ingredientlist:before {
  display: block;
  content: "Ingredients";
  font-weight: bold;
  margin-bottom: 12pt;
}

ingredient {
  display: block;
}

preparation {
  display: block;
  margin-top: 12pt;
  margin-bottom: 12pt;
}

preparation:before {
  display: block;
  content: "Preparation Instructions";
  font-weight: bold;
  margin-bottom: 12pt;
}

serving {
  display: block;
  margin-top: 12pt;
  margin-bottom: 12pt;
}

serving:before {
  display: block;
  content: "Serving Suggestion";
  font-weight: bold;
  margin-bottom: 12pt;
}

notes {
  display: block;
  margin-top: 12pt;
  margin-bottom: 12pt;
}

notes:before {
  display: block;
  content: "Notes";
  font-weight: bold;
  margin-bottom: 12pt;
}

There is one ELEMENT missing which would make this useful for a custom cookbook as opposed to a printed and bound device: the Category metatag.  Different people categorize their recipes based on their needs.  I would categorize based on the holiday menu that a recipe is most useful for (Pesach, Rosh HaShanah, etc.); whether the recipe goes with a meat meal, a dairy meal or is parve; even the occasions for which I made the dish.  Some would lump this data in the notes ELEMENT.  I am torn as to whether <category> is a child of notes or its own ELEMENT...  

No comments:

Post a Comment