~vorlon/ubuntu/saucy/gourmet/trunk

« back to all changes in this revision

Viewing changes to src/lib/importers/html_plugins/recipebookonline.py

  • Committer: Bazaar Package Importer
  • Author(s): Rolf Leggewie
  • Date: 2008-07-26 13:29:41 UTC
  • Revision ID: james.westby@ubuntu.com-20080726132941-6ldd73qmacrzz0bn
Tags: upstream-0.14.0
ImportĀ upstreamĀ versionĀ 0.14.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from gourmet import convert
 
2
import re
 
3
from html_helpers import *
 
4
 
 
5
SUPPORTED_URLS = ['www.recipebookonline.com']
 
6
SUPPORTED_URLS_REGEXPS = ['.*\.recipebookonline.com','recipebookonline.com.*']
 
7
 
 
8
RULES = [
 
9
    ['title',
 
10
     [{'tag':'font',
 
11
       'attributes':{'size':'4'}
 
12
       }],
 
13
     'text',
 
14
     ],
 
15
    ['ingredient_block',
 
16
     [{'tag':'td',
 
17
       'attributes':{'width':'100%',
 
18
                     'align':'center'},
 
19
       'index':[0,None],
 
20
       }],
 
21
     'text',
 
22
     ],
 
23
    ['instructions',
 
24
     [{'tag':'td',
 
25
       'attributes':{'width':'396'},
 
26
       'index':4,
 
27
       }],
 
28
     'text',
 
29
     ('Directions:\s+((.*\n)+)',False) # chop off "Directions: "
 
30
     ],
 
31
    ['instructions',
 
32
     [{'tag':'td',
 
33
       'attributes':{'width':'396'},
 
34
       'index':6,
 
35
       }],
 
36
     'text',
 
37
    ],
 
38
    ['source',
 
39
     [{'tag':'td',
 
40
       'attributes':{'width':'396'},
 
41
       'index':6,
 
42
       }],
 
43
     'text',
 
44
     ('Submitted\s+By:\s+(.*)\n',True),
 
45
     ],
 
46
    ['preptime',
 
47
     [{'tag':'font',
 
48
       'attributes':{'size':'2'},}],
 
49
     'text',
 
50
     ('Preparation Time: (.*)',True)
 
51
     ],
 
52
    ['cooktime',
 
53
     [{'tag':'font',
 
54
       'attributes':{'size':'2'},}],
 
55
     'text',
 
56
     ('Cooking Time: (.*)',True)
 
57
     ],
 
58
    ['servings',
 
59
     [{'tag':'font',
 
60
       'attributes':{'size':'2'},}],
 
61
     'text',
 
62
     ('Number\s+of\s+Servings\s*:\s*(%(num)s+).*'%{'num':convert.NUMBER_REGEXP},True)
 
63
     ] ,   
 
64
    ]
 
65