

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.\n\n    :param dayone_folder: Name of Day One folder; generally ends in ``.dayone``.\n    :type dayone_folder: string\n    :param reverse: If true, the entries are formatted in reverse chronological\n                    order.\n    :type reverse: bool\n    :param tags: Only include entries with the given tags.\n                 This paramater can also be the literal string ``any``,\n                 in which case only entries with tags are included.\n                 Tags are interpreted as words at the end of an entry\n                 beginning with ``#``.\n    :type tags: list of strings\n    :param exclude: Exclude all entries with given tags.\n    :type exclude: list of strings\n    :param before: Only include entries on before the given date.\n    :type before: naive datetime\n    :param after: Only include entries on or after the given date.\n    :type after: naive datetime\n    :param format: The file extension of the default template to use.\n    :type format: string\n    :param template: Template file name.\n                     The program looks for the template first\n                     in the  current directory, then the template directory.\n    :type template: string\n    :param template_dir: Directory containing templates.\n                         If not given, the program looks in\n                         ``~/.dayone_export`` followed by the\n                         dayone_export package.\n    :type template_dir: string\n    :param autobold: Specifies that the first line of each post should be\n                     a heading\n    :type autobold: bool\n    :param nl2br:  Specifies that new lines should be translated in to <br>s\n    :type nl2br: bool\n    :type filename_template: string\n    :param filename_template: An eventual filename, which can include strftime formatting codes.\n                Each time the result of formatting an entry's timestamp with this changes,\n                a new result will be returned.\n    :returns: Iterator yielding (filename, filled_in_template) as strings on each iteration.\n    "
    (loader, template) = _determine_inheritance(template, template_dir, format)
    custom_syntax = {
        
    }
    if (os.path.splitext(template)[1] == '.tex'):
        custom_syntax = {
            'block_start_string': '\\CMD{',
            'block_end_string': '}',
            'variable_start_string': '\\VAR{',
            'variable_end_string': '}',
        }
    env = jinja2.Environment(loader=loader, trim_blocks=True, **custom_syntax)
    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)
    template = env.get_template(template)
    j = parse_journal(dayone_folder)
    default_tz = j[(- 1)]['Date'].tzinfo
    after = _convert_to_utc(after, reverse)
    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()
    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/VarMisuse@235/1054 `default_tz`->`reverse`