Example #1
0
 def __init__(self, rd, r, out, conv=None, change_units=True, mult=1):
     import mealmaster_importer
     self.add_to_instructions = []
     self.conv = conv
     mmf2mk = mealmaster_importer.mmf_constants()
     self.uc = mmf2mk.unit_convr
     recattrs_orig = mmf2mk.recattrs
     self.recattrs = {}
     for k, v in recattrs_orig.items():
         self.recattrs[v] = k
     self.categories = ""
     exporter_mult.__init__(self,
                            rd,
                            r,
                            out,
                            conv=conv,
                            order=['attr', 'ings', 'text'],
                            attr_order=[
                                'title', 'cuisine', 'category', 'yields',
                                'cooktime', 'preptime', 'rating', 'source',
                                'link'
                            ],
                            convert_attnames=False,
                            change_units=change_units,
                            mult=mult)
Example #2
0
 def __init__ (self, rd, r, out, conv=None,
               css=os.path.join(gglobals.style_dir,"default.css"),
               embed_css=True, start_html=True, end_html=True, imagedir="pics/", imgcount=1,
               link_generator=None,
               # exporter_mult args
               mult=1,
               change_units=True,
               ):
     """We export web pages. We have a number of possible options
     here. css is a css file which will be embedded if embed_css is
     true or referenced if not. start_html and end_html specify
     whether or not to write header info (so we can be called in
     the midst of another script writing a page). imgcount allows
     an outside function to keep number exported images, handing
     us the imgcount at the start of our export. link_generator
     will be handed the ID referenced by any recipes called for
     as ingredients. It should return a URL for that recipe
     or None if it can't reference the recipe based on the ID."""
     self.start_html=start_html
     self.end_html=end_html
     self.embed_css=embed_css
     self.css=css
     self.link_generator=link_generator
     if imagedir and imagedir[-1] != os.path.sep: imagedir += os.path.sep #make sure we end w/ slash
     if not imagedir: imagedir = "" #make sure it's a string
     self.imagedir_absolute = os.path.join(os.path.split(out.name)[0],imagedir)
     self.imagedir = imagedir
     exporter_mult.__init__(self, rd, r, out,
                            conv=conv,
                            imgcount=imgcount,
                            mult=mult,
                            change_units=change_units,
                            do_markup=True,
                            use_ml=True)
 def __init__ (self, rd, r, out, conv=None, change_units=True, mult=1):
     import mealmaster_importer
     self.add_to_instructions=""
     self.conv = conv
     mmf2mk = mealmaster_importer.mmf_constants()
     self.uc=mmf2mk.unit_convr
     recattrs_orig=mmf2mk.recattrs
     self.recattrs={}
     for k,v in recattrs_orig.items():
         self.recattrs[v]=k
     self.categories = ""
     exporter_mult.__init__(self, rd, r, out,
                            conv=conv,
                            order=['attr','ings','text'],
                            attr_order=['title',
                                        'cuisine',
                                        'category',
                                        'yields',
                                        'cooktime',
                                        'preptime',
                                        'rating',
                                        'source',
                                        'link'],
                            convert_attnames=False,
                            change_units=change_units,
                            mult=mult)
Example #4
0
    def __init__(
        self,
        rd,
        r,
        out,
        conv=None,
        doc=None,
        # exporter_mult args
        mult=1,
        change_units=True,
    ):
        self.doc = doc

        # This document will be appended by the strings to join them in the
        # last step and pass it to the ebookwriter.
        self.preparedDocument = []

        #self.link_generator=link_generator
        exporter_mult.__init__(self,
                               rd,
                               r,
                               out,
                               conv=conv,
                               imgcount=1,
                               mult=mult,
                               change_units=change_units,
                               do_markup=True,
                               use_ml=True)
Example #5
0
 def __init__ (self, rd, r, out, conv=None,
               css=os.path.join(gglobals.style_dir,"default.css"),
               embed_css=True, start_html=True, end_html=True, imagedir="pics/", imgcount=1,
               link_generator=None,
               # exporter_mult args
               mult=1,
               change_units=True,
               ):
     """We export web pages. We have a number of possible options
     here. css is a css file which will be embedded if embed_css is
     true or referenced if not. start_html and end_html specify
     whether or not to write header info (so we can be called in
     the midst of another script writing a page). imgcount allows
     an outside function to keep number exported images, handing
     us the imgcount at the start of our export. link_generator
     will be handed the ID referenced by any recipes called for
     as ingredients. It should return a URL for that recipe
     or None if it can't reference the recipe based on the ID."""
     self.start_html=start_html
     self.end_html=end_html
     self.embed_css=embed_css
     self.css=css
     self.link_generator=link_generator
     if imagedir and imagedir[-1] != os.path.sep: imagedir += os.path.sep #make sure we end w/ slash
     if not imagedir: imagedir = "" #make sure it's a string
     self.imagedir_absolute = os.path.join(os.path.split(out.name)[0],imagedir)
     self.imagedir = imagedir
     exporter_mult.__init__(self, rd, r, out,
                            conv=conv,
                            imgcount=imgcount,
                            mult=mult,
                            change_units=change_units,
                            do_markup=True,
                            use_ml=True)
Example #6
0
    def __init__ (self, rd, r, out, conv=None,
                  doc=None,
                  # exporter_mult args
                  mult=1,
                  change_units=True,
                  ):
        self.doc = doc

        # This document will be appended by the strings to join them in the
        # last step and pass it to the ebookwriter.
        self.preparedDocument = []

        #self.link_generator=link_generator
        exporter_mult.__init__(self, rd, r, out,
                               conv=conv,
                               imgcount=1,
                               mult=mult,
                               change_units=change_units,
                               do_markup=True,
                               use_ml=True)