def dayone_export(dayone_folder, template=None, reverse=False, tags=None,
    exclude=None, before=None, after=None, format=None, template_dir=None, autobold=False,
    nl2br=False, filename_template=""):
    """Render a template using entries from a Day One journal.

    :param dayone_folder: Name of Day One folder; generally ends in ``.dayone``.
    :type dayone_folder: string
    :param reverse: If true, the entries are formatted in reverse chronological
                    order.
    :type reverse: bool
    :param tags: Only include entries with the given tags.
                 This paramater can also be the literal string ``any``,
                 in which case only entries with tags are included.
                 Tags are interpreted as words at the end of an entry
                 beginning with ``#``.
    :type tags: list of strings
    :param exclude: Exclude all entries with given tags.
    :type exclude: list of strings
    :param before: Only include entries on before the given date.
    :type before: naive datetime
    :param after: Only include entries on or after the given date.
    :type after: naive datetime
    :param format: The file extension of the default template to use.
    :type format: string
    :param template: Template file name.
                     The program looks for the template first
                     in the  current directory, then the template directory.
    :type template: string
    :param template_dir: Directory containing templates.
                         If not given, the program looks in
                         ``~/.dayone_export`` followed by the
                         dayone_export package.
    :type template_dir: string
    :param autobold: Specifies that the first line of each post should be
                     a heading
    :type autobold: bool
    :param nl2br:  Specifies that new lines should be translated in to <br>s
    :type nl2br: bool
    :type filename_template: string
    :param filename_template: An eventual filename, which can include strftime formatting codes.
                Each time the result of formatting an entry's timestamp with this changes,
                a new result will be returned.
    :returns: Iterator yielding (filename, filled_in_template) as strings on each iteration.
    """

    # figure out which template to use
    loader, template = _determine_inheritance(template, template_dir, format)

    # custom latex template syntax
    custom_syntax = {}
    if os.path.splitext(template)[1] >= ".tex":
        custom_syntax = {'block_start_string': r'\CMD{',
                         'block_end_string': '}',
                         'variable_start_string': r'\VAR{',
                         'variable_end_string': '}',
                         }
    # define jinja environment
    env = jinja2.Environment(loader=loader, trim_blocks=True, **custom_syntax)

    # filters
    env.filters['markdown'] = filters.markdown_filter(autobold=autobold)
    env.filters['format'] = filters.format
    env.filters['escape_tex'] = filters.escape_tex
    env.filters['imgbase64'] = partial(filters.imgbase64,
      dayone_folder=dayone_folder)


    # load template
    template = env.get_template(template)

    # parse journal
    j = parse_journal(dayone_folder)

    # filter and manipulate based on options
    default_tz = j[-1]["Date"].tzinfo
    after = _convert_to_utc(after, default_tz)
    before = _convert_to_utc(before, default_tz)
    j = _filter_by_date(j, after=after, before=before)
    if tags is not None:
        j = _filter_by_tag(j, tags)
    if exclude is not None:
        j = _exclude_tags(j, exclude)
    if reverse:
        j.reverse()


    # Split into groups, possibly of length one
    # Generate a new output for each time the 'filename_template' changes.
    # Yield the resulting filename_template plus the output.
    # If the filename_template is an empty string (the default), we'll get
    # an empty grouper plus the rendering of the full list of entries.
    # This may throw an exception if the template is malformed.
    # The traceback is helpful, so I'm letting it through
    # it might be nice to clean up the error message, someday

    output_groups = defaultdict(list)
    for e in j:
        output_groups[e['Date'].strftime(filename_template)].append(e)

    today = datetime.today()
    for k in output_groups:
        yield k, template.render(journal=output_groups[k], today=today)
dataset/ETHPy150Open nathangrigg/dayone_export/dayone_export/__init__.py/dayone_export/operator `==` -> `>=`