From c96c85b2f96c1706319f29c9d48e358aa664c5ee Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 13 Nov 2018 15:05:15 +0100 Subject: [PATCH] update org-chef. Signed-off-by: Andreas Gerler --- .../org-chef-autoloads.el | 19 --- elpa/org-chef-20180304.1104/org-chef-pkg.el | 8 - .../org-chef-all-recipes.el | 4 +- .../org-chef-autoloads.el | 138 ++++++++++++++++++ .../org-chef-budget-bytes.el | 2 +- .../org-chef-chef-koch.el | 134 +++++++++++++++++ .../org-chef-cultures-for-health.el | 0 .../org-chef-genius-kitchen.el | 0 .../org-chef-marmiton.el | 127 ++++++++++++++++ .../org-chef-martha-stewart.el | 0 .../org-chef-nytimes.el | 128 ++++++++++++++++ elpa/org-chef-20181105.2035/org-chef-pkg.el | 13 ++ .../org-chef-reluctant-gourmet.el | 122 ++++++++++++++++ .../org-chef-serious-eats.el | 2 +- .../org-chef-simply-recipes.el | 0 .../org-chef-steamy-kitchen.el | 105 +++++++++++++ .../org-chef-utils.el | 2 +- .../org-chef-wordpress.el | 113 ++++++++++++++ .../org-chef.el | 34 ++++- 19 files changed, 912 insertions(+), 39 deletions(-) delete mode 100644 elpa/org-chef-20180304.1104/org-chef-autoloads.el delete mode 100644 elpa/org-chef-20180304.1104/org-chef-pkg.el rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef-all-recipes.el (93%) create mode 100644 elpa/org-chef-20181105.2035/org-chef-autoloads.el rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef-budget-bytes.el (98%) create mode 100644 elpa/org-chef-20181105.2035/org-chef-chef-koch.el rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef-cultures-for-health.el (100%) rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef-genius-kitchen.el (100%) create mode 100644 elpa/org-chef-20181105.2035/org-chef-marmiton.el rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef-martha-stewart.el (100%) create mode 100644 elpa/org-chef-20181105.2035/org-chef-nytimes.el create mode 100644 elpa/org-chef-20181105.2035/org-chef-pkg.el create mode 100644 elpa/org-chef-20181105.2035/org-chef-reluctant-gourmet.el rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef-serious-eats.el (98%) rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef-simply-recipes.el (100%) create mode 100644 elpa/org-chef-20181105.2035/org-chef-steamy-kitchen.el rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef-utils.el (98%) create mode 100644 elpa/org-chef-20181105.2035/org-chef-wordpress.el rename elpa/{org-chef-20180304.1104 => org-chef-20181105.2035}/org-chef.el (80%) diff --git a/elpa/org-chef-20180304.1104/org-chef-autoloads.el b/elpa/org-chef-20180304.1104/org-chef-autoloads.el deleted file mode 100644 index 7ec2048e..00000000 --- a/elpa/org-chef-20180304.1104/org-chef-autoloads.el +++ /dev/null @@ -1,19 +0,0 @@ -;;; org-chef-autoloads.el --- automatically extracted autoloads -;; -;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) - -;;;### (autoloads nil nil ("org-chef-all-recipes.el" "org-chef-budget-bytes.el" -;;;;;; "org-chef-cultures-for-health.el" "org-chef-genius-kitchen.el" -;;;;;; "org-chef-martha-stewart.el" "org-chef-pkg.el" "org-chef-serious-eats.el" -;;;;;; "org-chef-simply-recipes.el" "org-chef-utils.el" "org-chef.el") -;;;;;; (23201 17073 680606 28000)) - -;;;*** - -;; Local Variables: -;; version-control: never -;; no-byte-compile: t -;; no-update-autoloads: t -;; End: -;;; org-chef-autoloads.el ends here diff --git a/elpa/org-chef-20180304.1104/org-chef-pkg.el b/elpa/org-chef-20180304.1104/org-chef-pkg.el deleted file mode 100644 index 5812675f..00000000 --- a/elpa/org-chef-20180304.1104/org-chef-pkg.el +++ /dev/null @@ -1,8 +0,0 @@ -(define-package "org-chef" "20180304.1104" "Cookbook and recipe management with org-mode." - '((org "0") - (emacs "24")) - :url "https://github.com/Chobbes/org-chef" :keywords - '("convenience" "abbrev" "outlines" "org" "food" "recipes" "cooking")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/org-chef-20180304.1104/org-chef-all-recipes.el b/elpa/org-chef-20181105.2035/org-chef-all-recipes.el similarity index 93% rename from elpa/org-chef-20180304.1104/org-chef-all-recipes.el rename to elpa/org-chef-20181105.2035/org-chef-all-recipes.el index 45674baf..2556af84 100644 --- a/elpa/org-chef-20180304.1104/org-chef-all-recipes.el +++ b/elpa/org-chef-20181105.2035/org-chef-all-recipes.el @@ -46,7 +46,7 @@ (defun org-chef-all-recipes-extract-ingredients (dom) "Get the ingredients for a recipe from an allrecipes DOM." - (mapcar 'dom-text (dom-elements dom 'itemprop "^ingredients$"))) + (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-elements dom 'itemprop "^recipeIngredient$"))) (defun org-chef-all-recipes-extract-servings (dom) @@ -71,7 +71,7 @@ (defun org-chef-all-recipes-extract-directions (dom) "Get the directions for a recipe from an allrecipes DOM." - (org-chef-remove-empty-strings (mapcar 'dom-text (dom-by-class dom "^recipe-directions__list--item$")))) + (org-chef-remove-empty-strings (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-by-class dom "^recipe-directions__list--item$")))) (defun org-chef-all-recipes-fetch (url) diff --git a/elpa/org-chef-20181105.2035/org-chef-autoloads.el b/elpa/org-chef-20181105.2035/org-chef-autoloads.el new file mode 100644 index 00000000..f3a927b2 --- /dev/null +++ b/elpa/org-chef-20181105.2035/org-chef-autoloads.el @@ -0,0 +1,138 @@ +;;; org-chef-autoloads.el --- automatically extracted autoloads +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "org-chef" "org-chef.el" (0 0 0 0)) +;;; Generated autoloads from org-chef.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef" '("org-chef-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-all-recipes" "org-chef-all-recipes.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-all-recipes.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-all-recipes" '("org-chef-all-recipes-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-budget-bytes" "org-chef-budget-bytes.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-budget-bytes.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-budget-bytes" '("org-chef-budget-bytes-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-chef-koch" "org-chef-chef-koch.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-chef-koch.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-chef-koch" '("org-chef-chef-koch-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-cultures-for-health" "org-chef-cultures-for-health.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-cultures-for-health.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-cultures-for-health" '("org-chef-cultures-for-health-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-genius-kitchen" "org-chef-genius-kitchen.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-genius-kitchen.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-genius-kitchen" '("org-chef-genius-kitchen-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-marmiton" "org-chef-marmiton.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-marmiton.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-marmiton" '("org-chef-marmiton-" "extract-dom-text" "sanitize"))) + +;;;*** + +;;;### (autoloads nil "org-chef-martha-stewart" "org-chef-martha-stewart.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-martha-stewart.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-martha-stewart" '("org-chef-martha-stewart-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-nytimes" "org-chef-nytimes.el" (0 +;;;;;; 0 0 0)) +;;; Generated autoloads from org-chef-nytimes.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-nytimes" '("org-chef-nytimes-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-reluctant-gourmet" "org-chef-reluctant-gourmet.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-reluctant-gourmet.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-reluctant-gourmet" '("org-chef-reluctant-gourmet-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-serious-eats" "org-chef-serious-eats.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-serious-eats.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-serious-eats" '("org-chef-serious-eats-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-simply-recipes" "org-chef-simply-recipes.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-simply-recipes.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-simply-recipes" '("org-chef-simply-recipes-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-steamy-kitchen" "org-chef-steamy-kitchen.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-steamy-kitchen.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-steamy-kitchen" '("org-chef-steamy-kitchen-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-utils" "org-chef-utils.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from org-chef-utils.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-utils" '("org-chef-"))) + +;;;*** + +;;;### (autoloads nil "org-chef-wordpress" "org-chef-wordpress.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from org-chef-wordpress.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "org-chef-wordpress" '("org-chef-"))) + +;;;*** + +;;;### (autoloads nil nil ("org-chef-pkg.el") (0 0 0 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; org-chef-autoloads.el ends here diff --git a/elpa/org-chef-20180304.1104/org-chef-budget-bytes.el b/elpa/org-chef-20181105.2035/org-chef-budget-bytes.el similarity index 98% rename from elpa/org-chef-20180304.1104/org-chef-budget-bytes.el rename to elpa/org-chef-20181105.2035/org-chef-budget-bytes.el index 22b28f65..07f83c7a 100644 --- a/elpa/org-chef-20180304.1104/org-chef-budget-bytes.el +++ b/elpa/org-chef-20181105.2035/org-chef-budget-bytes.el @@ -87,7 +87,7 @@ (defun org-chef-budget-bytes-extract-directions (dom) "Get the directions for a recipe from an budgetbytes DOM." - (mapcar #'(lambda (n) (string-trim (dom-texts (dom-children n)))) + (mapcar #'(lambda (n) (string-trim (dom-texts n))) (dom-by-class dom "wprm-recipe-instruction-text"))) diff --git a/elpa/org-chef-20181105.2035/org-chef-chef-koch.el b/elpa/org-chef-20181105.2035/org-chef-chef-koch.el new file mode 100644 index 00000000..203931c8 --- /dev/null +++ b/elpa/org-chef-20181105.2035/org-chef-chef-koch.el @@ -0,0 +1,134 @@ +;;; org-chef-chef-koch.el --- Functions for fetching recipes from chefkoch.de. -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Calvin Beck + +;; Author: Calvin Beck +;; URL: https://github.com/Chobbes/org-chef +;; Created: 2018 + +;; Copyright 2018 Calvin Beck + +;; Permission is hereby granted, free of charge, to any person +;; obtaining a copy of this software and associated documentation +;; files (the "Software"), to deal in the Software without +;; restriction, including without limitation the rights to use, copy, +;; modify, merge, publish, distribute, sublicense, and/or sell copies +;; of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +;;; Commentary: + +;; Functions for fetching information from chefkoch.de. + +;;; Code: + + +(require 'org-chef-utils) +(require 'dom) + + +(defun org-chef-chef-koch-extract-name (dom) + "Get the name of a recipe from an chefkoch DOM." + (dom-text (car (dom-by-class dom "page-title")))) + + +(defun org-chef-chef-koch-ingredient-to-string (dom) + (let ((amount (replace-regexp-in-string " " " " (string-trim (dom-texts (car (dom-by-tag dom 'td)))))) + (name (string-trim (dom-texts (cadr (dom-by-tag dom 'td)))))) + (format "%s %s" amount name))) + + +(defun org-chef-chef-koch-extract-ingredients (dom) + "Get the ingredients for a recipe from an chefkoch DOM." + (mapcar #'org-chef-chef-koch-ingredient-to-string (dom-by-tag (dom-by-class dom "^incredients$") 'tr))) + + +(defun org-chef-chef-koch-extract-servings (dom) + "Get the number of servings for a recipe from an chefkoch DOM." + (dom-attr (dom-elements dom 'name "^portionen$") 'value)) + + +(defun org-chef-chef-koch-extract-prep-time (dom) + "Get the amount of prep-time for a recipe from an chefkoch DOM." + (let ((str (replace-regexp-in-string "\n" " " (dom-texts (dom-by-id dom "^preparation-info$"))))) + (string-match "Arbeitszeit:[[:space:]]+ca. \\(?1:[^\.]*\\)\." str) + (match-string 1 str))) + + +(defun org-chef-chef-koch-extract-cook-time (dom) + "Get the amount of cook-time for a recipe from an chefkoch DOM." + (let ((str (replace-regexp-in-string "\n" " " (dom-texts (dom-by-id dom "^preparation-info$"))))) + (string-match "Koch-/Backzeit:[[:space:]]+ca. \\(?1:[^\.]*\\)\." str) + (match-string 1 str))) + + +(defun org-chef-chef-koch-extract-ready-in (dom) + "Get the total amount of time for a recipe from an chefkoch DOM." + "") + + +(defun org-chef-chef-koch-extract-directions (dom) + "Get the directions for a recipe from an chefkoch DOM." + (with-temp-buffer + (insert (string-trim (dom-texts (dom-by-class dom "^instructions")))) + (delete-trailing-whitespace) + (split-string (buffer-string) "\n"))) + + +(defun org-chef-chef-koch-from-dom (dom) + "Given a chefkoch.de DOM, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions" + (let* ((prep-time (org-chef-chef-koch-extract-prep-time dom)) + (cook-time (org-chef-chef-koch-extract-cook-time dom)) + (total-time (org-chef-chef-koch-extract-ready-in dom))) + + `((ingredients . ,(org-chef-chef-koch-extract-ingredients dom)) + (name . ,(org-chef-chef-koch-extract-name dom)) + (servings . ,(org-chef-chef-koch-extract-servings dom)) + (prep-time . ,prep-time) + (cook-time . ,cook-time) + (ready-in . ,total-time) + (directions . ,(org-chef-chef-koch-extract-directions dom))))) + + +(defun org-chef-chef-koch-fetch (url) + "Given a chefkoch.de URL, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions +- source-url" + (with-current-buffer (url-retrieve-synchronously url) + (let ((dom (libxml-parse-html-region (point-min) (point-max)))) + (cons `(source-url . ,url) (org-chef-chef-koch-from-dom dom))))) + + +(provide 'org-chef-chef-koch) +;;; org-chef-chef-koch.el ends here diff --git a/elpa/org-chef-20180304.1104/org-chef-cultures-for-health.el b/elpa/org-chef-20181105.2035/org-chef-cultures-for-health.el similarity index 100% rename from elpa/org-chef-20180304.1104/org-chef-cultures-for-health.el rename to elpa/org-chef-20181105.2035/org-chef-cultures-for-health.el diff --git a/elpa/org-chef-20180304.1104/org-chef-genius-kitchen.el b/elpa/org-chef-20181105.2035/org-chef-genius-kitchen.el similarity index 100% rename from elpa/org-chef-20180304.1104/org-chef-genius-kitchen.el rename to elpa/org-chef-20181105.2035/org-chef-genius-kitchen.el diff --git a/elpa/org-chef-20181105.2035/org-chef-marmiton.el b/elpa/org-chef-20181105.2035/org-chef-marmiton.el new file mode 100644 index 00000000..57dd7e22 --- /dev/null +++ b/elpa/org-chef-20181105.2035/org-chef-marmiton.el @@ -0,0 +1,127 @@ +;;; org-chef-marmiton.el --- Functions for fetching recipes from marmiton.org. -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Calvin Beck/Sébastien Le Maguer + +;; Author: Calvin Beck /Sébastien Le Maguer +;; URL: https://github.com/Chobbes/org-chef +;; Created: 2018 + +;; Copyright 2018 Calvin Beck/Sébastien Le Maguer + +;; Permission is hereby granted, free of charge, to any person +;; obtaining a copy of this software and associated documentation +;; files (the "Software"), to deal in the Software without +;; restriction, including without limitation the rights to use, copy, +;; modify, merge, publish, distribute, sublicense, and/or sell copies +;; of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +;;; Commentary: + +;; Functions for fetching information from marmiton.org. + +;;; Code: + + +(require 'org-chef-utils) +(require 'dom) + + +(defun sanitize (str) + "Sanitize the STR by removing beginning/trailing spaces extracted from a marmiton dom." + (replace-regexp-in-string "^[ \r\n]*\\(.*[^ \r\n]\\)[ \r\n]*$" "\\1" str)) + +(defun extract-dom-text (dom) + "Embedded the operation santize of dom-text from a marmiton DOM." + (sanitize (dom-text dom))) + +(defun org-chef-marmiton-extract-name (dom) + "Get the name of a recipe from a marmiton DOM." + (dom-text (car (dom-elements dom 'class "^main-title $")))) + +(defun org-chef-marmiton-extract-current-ingredient (dom) + "Extract element for the current ingredient from a marmiton DOM." + (concat + (extract-dom-text (dom-elements dom 'class "^recipe-ingredient-qt$")) + " " + (extract-dom-text (dom-elements dom 'class "^ingredient$")))) + +(defun org-chef-marmiton-extract-ingredients (dom) + "Get the ingredients for a recipe from a marmiton DOM." + (mapcar 'org-chef-marmiton-extract-current-ingredient (dom-elements dom 'class "^recipe-ingredients__list__item$"))) + +(defun org-chef-marmiton-extract-directions (dom) + "Get the directions for a recipe from a marmiton DOM." + + (mapcar 'extract-dom-text (dom-elements dom 'class "^recipe-preparation__list__item$"))) + +(defun org-chef-marmiton-extract-prep-time (dom) + "Get the preparation time for a recipe from a marmiton DOM." + (extract-dom-text + (dom-elements (dom-elements dom 'class "recipe-infos__timmings__preparation") + 'class "^recipe-infos__timmings__value$"))) + +(defun org-chef-marmiton-extract-cook-time (dom) + "Extract the cooking time for a recipe from a marmiton DOM." + (extract-dom-text + (dom-elements (dom-elements dom 'class "recipe-infos__timmings__cooking") + 'class "^recipe-infos__timmings__value$"))) + + +(defun org-chef-marmiton-extract-servings (dom) + (dom-text (car (dom-elements dom 'class "^title-2 recipe-infos__quantity__value$")))) + + + +(defun org-chef-marmiton-from-dom (dom) + "Given a marmiton.org DOM, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions" + `((ingredients . ,(org-chef-marmiton-extract-ingredients dom)) + (name . ,(org-chef-marmiton-extract-name dom)) + (servings . ,(org-chef-marmiton-extract-servings dom)) + (prep-time . ,(org-chef-marmiton-extract-prep-time dom)) + (cook-time . ,(org-chef-marmiton-extract-cook-time dom)) + (ready-in . nil) + (directions . ,(org-chef-marmiton-extract-directions dom)))) + + +(defun org-chef-marmiton-fetch (url) + "Given a marmiton.org URL, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions +- source-url" + (with-current-buffer (url-retrieve-synchronously url) + (let ((dom (libxml-parse-html-region (point-min) (point-max)))) + (cons `(source-url . ,url) (org-chef-marmiton-from-dom dom))))) + +(provide 'org-chef-marmiton) +;;; org-chef-marmiton.el ends here diff --git a/elpa/org-chef-20180304.1104/org-chef-martha-stewart.el b/elpa/org-chef-20181105.2035/org-chef-martha-stewart.el similarity index 100% rename from elpa/org-chef-20180304.1104/org-chef-martha-stewart.el rename to elpa/org-chef-20181105.2035/org-chef-martha-stewart.el diff --git a/elpa/org-chef-20181105.2035/org-chef-nytimes.el b/elpa/org-chef-20181105.2035/org-chef-nytimes.el new file mode 100644 index 00000000..3712c585 --- /dev/null +++ b/elpa/org-chef-20181105.2035/org-chef-nytimes.el @@ -0,0 +1,128 @@ +;;; org-chef-nytimes.el --- Functions for fetching recipes from nytimes.com. -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Calvin Beck/Asilata Bapat + +;; Author: Calvin Beck /Asilata Bapat +;; URL: https://github.com/Chobbes/org-chef +;; Created: 2018 + +;; Copyright 2018 Calvin Beck/Asilata Bapat + +;; Permission is hereby granted, free of charge, to any person +;; obtaining a copy of this software and associated documentation +;; files (the "Software"), to deal in the Software without +;; restriction, including without limitation the rights to use, copy, +;; modify, merge, publish, distribute, sublicense, and/or sell copies +;; of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +;;; Commentary: + +;; Functions for fetching information from nytimes.com. + +;;; Code: + + +(require 'org-chef-utils) +(require 'dom) + + +(defun org-chef-nytimes-extract-name (dom) + "Get the name of a recipe from an nytimes DOM." + (string-trim (dom-text (car (dom-by-class dom "recipe-title"))))) + + +(defun org-chef-nytimes-ingredient-to-string (dom) + "Extract string representation of a single ingredient from an nytimes DOM." + (replace-regexp-in-string + " \\([,\.]\\)" "\\1" + (string-join (org-chef-remove-empty-strings (mapcar 'string-trim (dom-strings dom))) " "))) + +(defun org-chef-nytimes-extract-ingredients (dom) + "Get the ingredients for a recipe from an nytimes DOM." + (mapcar 'org-chef-nytimes-ingredient-to-string + (dom-elements dom 'itemprop "recipeIngredient"))) + + +(defun org-chef-nytimes-extract-servings (dom) + "Get the number of servings for a recipe from an nytimes DOM." + (replace-regexp-in-string " servings" "" (dom-text (car (dom-elements dom 'itemprop "recipeYield"))))) + + +(defun org-chef-nytimes-extract-prep-time (dom) + "Get the amount of prep-time for a recipe from an nytimes DOM." + "") + + +(defun org-chef-nytimes-extract-cook-time (dom) + "Get the amount of cook-time for a recipe from an nytimes DOM." + "") + + +(defun org-chef-nytimes-extract-ready-in (dom) + "Get the total amount of time for a recipe from an nytimes DOM." + (dom-texts (dom-by-class (cadr (dom-by-tag (dom-by-class dom "recipe-time-yield") 'li)) "recipe-yield-value"))) + + +(defun org-chef-nytimes-extract-directions (dom) + "Get the directions for a recipe from an nytimes DOM." + (mapcar 'dom-texts (dom-by-tag (dom-elements dom 'itemprop "recipeInstructions") 'li))) + + +(defun org-chef-nytimes-from-dom (dom) + "Given an nytimes.com DOM, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions" + (let* ((prep-time (org-chef-nytimes-extract-prep-time dom)) + (cook-time (org-chef-nytimes-extract-cook-time dom)) + (total-time (org-chef-nytimes-extract-ready-in dom))) + + `((ingredients . ,(org-chef-nytimes-extract-ingredients dom)) + (name . ,(org-chef-nytimes-extract-name dom)) + (servings . ,(org-chef-nytimes-extract-servings dom)) + (prep-time . ,prep-time) + (cook-time . ,cook-time) + (ready-in . ,total-time) + (directions . ,(org-chef-nytimes-extract-directions dom))))) + + +(defun org-chef-nytimes-fetch (url) + "Given an nytimes.com URL, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions +- source-url" + (with-current-buffer (url-retrieve-synchronously url) + (let ((dom (libxml-parse-html-region (point-min) (point-max)))) + (cons `(source-url . ,url) (org-chef-nytimes-from-dom dom))))) + + +(provide 'org-chef-nytimes) +;;; org-chef-nytimes.el ends here diff --git a/elpa/org-chef-20181105.2035/org-chef-pkg.el b/elpa/org-chef-20181105.2035/org-chef-pkg.el new file mode 100644 index 00000000..9340d6fa --- /dev/null +++ b/elpa/org-chef-20181105.2035/org-chef-pkg.el @@ -0,0 +1,13 @@ +(define-package "org-chef" "20181105.2035" "Cookbook and recipe management with org-mode." + '((org "0") + (emacs "24")) + :keywords + '("convenience" "abbrev" "outlines" "org" "food" "recipes" "cooking") + :authors + '(("Calvin Beck" . "hobbes@ualberta.ca")) + :maintainer + '("Calvin Beck" . "hobbes@ualberta.ca") + :url "https://github.com/Chobbes/org-chef") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/org-chef-20181105.2035/org-chef-reluctant-gourmet.el b/elpa/org-chef-20181105.2035/org-chef-reluctant-gourmet.el new file mode 100644 index 00000000..47e75e9d --- /dev/null +++ b/elpa/org-chef-20181105.2035/org-chef-reluctant-gourmet.el @@ -0,0 +1,122 @@ +;;; org-chef-reluctant-gourmet.el --- Functions for fetching recipes from reluctantgourmet.com. -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Calvin Beck + +;; Author: Calvin Beck +;; URL: https://github.com/Chobbes/org-chef +;; Created: 2018 + +;; Copyright 2018 Calvin Beck + +;; Permission is hereby granted, free of charge, to any person +;; obtaining a copy of this software and associated documentation +;; files (the "Software"), to deal in the Software without +;; restriction, including without limitation the rights to use, copy, +;; modify, merge, publish, distribute, sublicense, and/or sell copies +;; of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +;;; Commentary: + +;; Functions for fetching information from reluctantgourmet.com. + +;;; Code: + + +(require 'org-chef-utils) +(require 'dom) + + +(defun org-chef-reluctant-gourmet-extract-name (dom) + "Get the name of a recipe from an reluctantgourmet DOM." + (dom-text (car (dom-by-id dom "zlrecipe-title")))) + + +(defun org-chef-reluctant-gourmet-extract-ingredients (dom) + "Get the ingredients for a recipe from an reluctantgourmet DOM." + (mapcar #'(lambda (n) (string-trim (dom-text n))) (dom-by-class dom "^ingredient$"))) + + +(defun org-chef-reluctant-gourmet-extract-servings (dom) + "Get the number of servings for a recipe from an reluctantgourmet DOM." + (dom-texts (car (dom-elements dom 'itemprop "^recipeYield$")))) + + +(defun org-chef-reluctant-gourmet-extract-prep-time (dom) + "Get the amount of prep-time for a recipe from an reluctantgourmet DOM." + (dom-texts (car (dom-elements dom 'itemprop "^prepTime$")))) + + +(defun org-chef-reluctant-gourmet-extract-cook-time (dom) + "Get the amount of cook-time for a recipe from an reluctantgourmet DOM." + (dom-texts (car (dom-elements dom 'itemprop "^cookTime$")))) + + +(defun org-chef-reluctant-gourmet-extract-ready-in (dom) + "Get the total amount of time for a recipe from an reluctantgourmet DOM." + (dom-texts (car (dom-elements dom 'itemprop "^totalTime$")))) + + +(defun org-chef-reluctant-gourmet-extract-directions (dom) + "Get the directions for a recipe from an reluctantgourmet DOM." + (mapcar #'dom-text (seq-filter (lambda (x) (not (stringp x))) + (dom-elements dom 'itemprop "^recipeInstructions$")))) + + +(defun org-chef-reluctant-gourmet-from-dom (dom) + "Given a reluctantgourmet.com DOM, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions" + (let* ((prep-time (org-chef-reluctant-gourmet-extract-prep-time dom)) + (cook-time (org-chef-reluctant-gourmet-extract-cook-time dom)) + (total-time (org-chef-reluctant-gourmet-extract-ready-in dom))) + + `((ingredients . ,(org-chef-reluctant-gourmet-extract-ingredients dom)) + (name . ,(org-chef-reluctant-gourmet-extract-name dom)) + (servings . ,(org-chef-reluctant-gourmet-extract-servings dom)) + (prep-time . ,prep-time) + (cook-time . ,cook-time) + (ready-in . ,total-time) + (directions . ,(org-chef-reluctant-gourmet-extract-directions dom))))) + + +(defun org-chef-reluctant-gourmet-fetch (url) + "Given a reluctantgourmet.com URL, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions +- source-url" + (with-current-buffer (url-retrieve-synchronously url) + (let ((dom (libxml-parse-html-region (point-min) (point-max)))) + (cons `(source-url . ,url) (org-chef-reluctant-gourmet-from-dom dom))))) + + +(provide 'org-chef-reluctant-gourmet) +;;; org-chef-reluctant-gourmet.el ends here diff --git a/elpa/org-chef-20180304.1104/org-chef-serious-eats.el b/elpa/org-chef-20181105.2035/org-chef-serious-eats.el similarity index 98% rename from elpa/org-chef-20180304.1104/org-chef-serious-eats.el rename to elpa/org-chef-20181105.2035/org-chef-serious-eats.el index 54992555..0ed4300c 100644 --- a/elpa/org-chef-20180304.1104/org-chef-serious-eats.el +++ b/elpa/org-chef-20181105.2035/org-chef-serious-eats.el @@ -46,7 +46,7 @@ (defun org-chef-serious-eats-extract-ingredients (dom) "Get the ingredients for a recipe from an seriouseats DOM." - (mapcar 'dom-texts (dom-elements dom 'itemprop "^ingredients$"))) + (mapcar 'dom-texts (dom-elements dom 'itemprop "^recipeIngredient$"))) (defun org-chef-serious-eats-extract-servings (dom) diff --git a/elpa/org-chef-20180304.1104/org-chef-simply-recipes.el b/elpa/org-chef-20181105.2035/org-chef-simply-recipes.el similarity index 100% rename from elpa/org-chef-20180304.1104/org-chef-simply-recipes.el rename to elpa/org-chef-20181105.2035/org-chef-simply-recipes.el diff --git a/elpa/org-chef-20181105.2035/org-chef-steamy-kitchen.el b/elpa/org-chef-20181105.2035/org-chef-steamy-kitchen.el new file mode 100644 index 00000000..6591c0b4 --- /dev/null +++ b/elpa/org-chef-20181105.2035/org-chef-steamy-kitchen.el @@ -0,0 +1,105 @@ +;;; org-chef-steamy-kitchen.el --- org-chef steamykitchen fetching. -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Calvin Beck + +;; Author: Calvin Beck +;; URL: https://github.com/Chobbes/org-chef +;; Created: 2018 + +;; Copyright 2018 Calvin Beck + +;; Permission is hereby granted, free of charge, to any person +;; obtaining a copy of this software and associated documentation +;; files (the "Software"), to deal in the Software without +;; restriction, including without limitation the rights to use, copy, +;; modify, merge, publish, distribute, sublicense, and/or sell copies +;; of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +;;; Commentary: + +;; Functions for fetching information from steamykitchen.com. + +;;; Code: + + +(require 'org-chef-utils) +(require 'dom) + + +(defun org-chef-steamy-kitchen-extract-name (dom) + "Get the name of a recipe from an steamykitchen DOM." + (dom-text (car (dom-elements dom 'itemprop "^name$")))) + + +(defun org-chef-steamy-kitchen-extract-ingredients (dom) + "Get the ingredients for a recipe from an steamykitchen DOM." + (mapcar 'dom-texts (dom-elements dom 'itemprop "^ingredients$"))) + + +(defun org-chef-steamy-kitchen-extract-servings (dom) + "Get the number of servings for a recipe from an steamykitchen DOM." + (dom-text (car (dom-elements dom 'itemprop "^recipeYield$")))) + + +(defun org-chef-steamy-kitchen-extract-prep-time (dom) + "Get the amount of prep-time for a recipe from an steamykitchen DOM." + (dom-text (dom-parent dom (car (dom-elements dom 'itemprop "^prepTime$"))))) + + +(defun org-chef-steamy-kitchen-extract-cook-time (dom) + "Get the amount of cook-time for a recipe from an steamykitchen DOM." + (dom-text (dom-parent dom (car (dom-elements dom 'itemprop "^cookTime$"))))) + + +(defun org-chef-steamy-kitchen-extract-ready-in (dom) + "Get the total amount of time for a recipe from an steamykitchen DOM." + nil) + + +(defun org-chef-steamy-kitchen-extract-directions (dom) + "Get the directions for a recipe from an steamykitchen DOM." + (mapcar #'(lambda (n) (string-trim (dom-texts n))) + (org-chef-dom-children (car (dom-by-class dom "^instructions$"))))) + + +(defun org-chef-steamy-kitchen-fetch (url) + "Given an steamykitchen.com URL, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions +- source-url" + (with-current-buffer (url-retrieve-synchronously url) + (let ((dom (libxml-parse-html-region (point-min) (point-max)))) + + `((name . ,(org-chef-steamy-kitchen-extract-name dom)) + (ingredients . ,(org-chef-steamy-kitchen-extract-ingredients dom)) + (servings . ,(org-chef-steamy-kitchen-extract-servings dom)) + (prep-time . ,(org-chef-steamy-kitchen-extract-prep-time dom)) + (cook-time . ,(org-chef-steamy-kitchen-extract-cook-time dom)) + (ready-in . ,(org-chef-steamy-kitchen-extract-ready-in dom)) + (directions . ,(org-chef-steamy-kitchen-extract-directions dom)) + (source-url . ,url))))) + + +(provide 'org-chef-steamy-kitchen) +;;; org-chef-steamy-kitchen.el ends here diff --git a/elpa/org-chef-20180304.1104/org-chef-utils.el b/elpa/org-chef-20181105.2035/org-chef-utils.el similarity index 98% rename from elpa/org-chef-20180304.1104/org-chef-utils.el rename to elpa/org-chef-20181105.2035/org-chef-utils.el index 934781ba..2239825a 100644 --- a/elpa/org-chef-20180304.1104/org-chef-utils.el +++ b/elpa/org-chef-20181105.2035/org-chef-utils.el @@ -30,7 +30,7 @@ ;;; Commentary: -;; Utilitiy functions for org-chef. +;; Utility functions for org-chef. ;;; Code: diff --git a/elpa/org-chef-20181105.2035/org-chef-wordpress.el b/elpa/org-chef-20181105.2035/org-chef-wordpress.el new file mode 100644 index 00000000..fe831575 --- /dev/null +++ b/elpa/org-chef-20181105.2035/org-chef-wordpress.el @@ -0,0 +1,113 @@ +;;; org-chef-wordpress.el --- org-chef wordpress fetching. -*- lexical-binding: t; -*- + +;; Copyright (C) 2018 Calvin Beck + +;; Author: Calvin Beck +;; URL: https://github.com/Chobbes/org-chef +;; Created: 2018 + +;; Copyright 2018 Calvin Beck + +;; Permission is hereby granted, free of charge, to any person +;; obtaining a copy of this software and associated documentation +;; files (the "Software"), to deal in the Software without +;; restriction, including without limitation the rights to use, copy, +;; modify, merge, publish, distribute, sublicense, and/or sell copies +;; of the Software, and to permit persons to whom the Software is +;; furnished to do so, subject to the following conditions: + +;; The above copyright notice and this permission notice shall be +;; included in all copies or substantial portions of the Software. + +;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +;; ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +;; CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +;; SOFTWARE. + +;;; Commentary: + +;; Functions for fetching information from wordpress sites. + +;;; Code: + + +(require 'org-chef-utils) +(require 'dom) + + +(defun org-chef-wordpress-extract-name (dom) + "Get the name of a recipe from an wordpress DOM." + (dom-text (car (dom-by-class dom "^wprm-recipe-name")))) + + +(defun org-chef-wordpress-extract-ingredients (dom) + "Get the ingredients for a recipe from an wordpress DOM." + (mapcar #'(lambda (n) (string-trim (dom-texts n))) (dom-by-class dom "^wprm-recipe-ingredient$"))) + + +(defun org-chef-wordpress-extract-servings (dom) + "Get the number of servings for a recipe from an wordpress DOM." + (dom-texts (car (dom-by-class dom "wprm-recipe-servings$")))) + + +(defun org-chef-wordpress-extract-prep-time (dom) + "Get the amount of prep-time for a recipe from an wordpress DOM." + (dom-texts (car (dom-by-class dom "^wprm-recipe-time$")))) + + +(defun org-chef-wordpress-extract-cook-time (dom) + "Get the amount of cook-time for a recipe from an wordpress DOM." + (dom-texts (cadr (dom-by-class dom "^wprm-recipe-time$")))) + + +(defun org-chef-wordpress-extract-ready-in (dom) + "Get the total amount of time for a recipe from an wordpress DOM." + (dom-texts (caddr (dom-by-class dom "^wprm-recipe-time$")))) + + +(defun org-chef-wordpress-extract-directions (dom) + "Get the directions for a recipe from an wordpress DOM." + (org-chef-remove-empty-strings (mapcar #'(lambda (n) (string-trim (dom-texts n))) (dom-by-class dom "^wprm-recipe-instruction$")))) + + +(defun org-chef-is-wordpress-p (dom) + "Check if a DOM corresponds to a wordpress website." + (dom-by-class dom "^wprm-recipe-container$")) + + +(defun org-chef-wordpress-fetch (url) + "Given an wordpress URL, retrieve the recipe information. + +This returns an alist with the following keys: + +- name +- ingredients +- servings +- prep-time +- cook-time +- ready-in +- directions +- source-url + +If this is not a wordpress site, then return nil." + (with-current-buffer (url-retrieve-synchronously url) + (let ((dom (libxml-parse-html-region (point-min) (point-max)))) + + (if (org-chef-is-wordpress-p dom) + `((name . ,(org-chef-wordpress-extract-name dom)) + (ingredients . ,(org-chef-wordpress-extract-ingredients dom)) + (servings . ,(org-chef-wordpress-extract-servings dom)) + (prep-time . ,(org-chef-wordpress-extract-prep-time dom)) + (cook-time . ,(org-chef-wordpress-extract-cook-time dom)) + (ready-in . ,(org-chef-wordpress-extract-ready-in dom)) + (directions . ,(org-chef-wordpress-extract-directions dom)) + (source-url . ,url)) + nil)))) + + +(provide 'org-chef-wordpress) +;;; org-chef-wordpress.el ends here diff --git a/elpa/org-chef-20180304.1104/org-chef.el b/elpa/org-chef-20181105.2035/org-chef.el similarity index 80% rename from elpa/org-chef-20180304.1104/org-chef.el rename to elpa/org-chef-20181105.2035/org-chef.el index a9d5b612..227ebc3b 100644 --- a/elpa/org-chef-20180304.1104/org-chef.el +++ b/elpa/org-chef-20181105.2035/org-chef.el @@ -47,7 +47,13 @@ (require 'org-chef-martha-stewart) (require 'org-chef-budget-bytes) (require 'org-chef-cultures-for-health) +(require 'org-chef-marmiton) (require 'org-chef-serious-eats) +(require 'org-chef-reluctant-gourmet) +(require 'org-chef-chef-koch) +(require 'org-chef-steamy-kitchen) +(require 'org-chef-nytimes) +(require 'org-chef-wordpress) (defun org-chef-recipe-insert-org (recipe) @@ -80,13 +86,14 @@ (org-chef-recipe-insert-org recipe) (buffer-string))) + (defun org-chef-match-url (BASE URL) "Match URL against a BASE url." (not (null (string-match-p (regexp-quote BASE) URL)))) -(defun org-chef-fetch-recipe (URL) - "Look up a recipe at a URL." +(defun org-chef-fetch-recipe-specific-url (URL) + "Look up a recipe based on a specific URL." (cond ((org-chef-match-url "allrecipes.com" URL) (org-chef-all-recipes-fetch URL)) ((org-chef-match-url "geniuskitchen.com" URL) (org-chef-genius-kitchen-fetch URL)) @@ -94,14 +101,27 @@ ((org-chef-match-url "marthastewart.com" URL) (org-chef-martha-stewart-fetch URL)) ((org-chef-match-url "budgetbytes.com" URL) (org-chef-budget-bytes-fetch URL)) ((org-chef-match-url "culturesforhealth.com" URL) (org-chef-cultures-for-health-fetch URL)) - ((org-chef-match-url "seriouseats.com" URL) (org-chef-serious-eats-fetch URL)))) + ((org-chef-match-url "marmiton.org" URL) (org-chef-marmiton-fetch URL)) + ((org-chef-match-url "seriouseats.com" URL) (org-chef-serious-eats-fetch URL)) + ((org-chef-match-url "reluctantgourmet.com" URL) (org-chef-reluctant-gourmet-fetch URL)) + ((org-chef-match-url "chefkoch.de" URL) (org-chef-chef-koch-fetch URL)) + ((org-chef-match-url "steamykitchen.com" URL) (org-chef-steamy-kitchen-fetch URL)) + ((org-chef-match-url "nytimes.com" URL) (org-chef-nytimes-fetch URL)) + (t nil))) + +(defun org-chef-fetch-recipe (URL) + "Look up a recipe at a URL." + (let ((fetched-recipe (org-chef-fetch-recipe-specific-url URL))) + (if fetched-recipe + fetched-recipe + (org-chef-wordpress-fetch URL)))) -(defun org-chef-insert-recipe () + +(defun org-chef-insert-recipe (URL) "Prompt for a recipe URL, and then insert the recipe at point." - (interactive) - (let ((URL (read-string "Recipe URL: "))) - (org-chef-recipe-insert-org (org-chef-fetch-recipe (read-string "Recipe URL: "))))) + (interactive "sRecipe URL: ") + (org-chef-recipe-insert-org (org-chef-fetch-recipe URL))) (defun org-chef-get-recipe-from-url () -- 2.47.3