<commit_before>#!/usr/bin/python3

import os
from datetime import datetime


def create_entry(folder, timestamp=None, title=None, filename=None, category=''):

    try:
        os.makedirs(folder)
    except:
        pass

    if timestamp is None:
        timestamp = datetime.now().strftime("%Y-%m-%d")
    if title is None:
        title = \
            datetime.strptime(timestamp, "%Y-%m-%d").strftime("%A %d %B, %Y")
    if filename is None:
        filepath = os.path.join(folder, title + '.md')
    else:
        filepath = os.path.join(folder, filename + '.md')
    if os.path.exists(filepath):
        return filepath
    
    meta =  "Title:          {}\n"
    meta += "Authors:        <NAME>\n"
    meta += "Date:           {}\n"
    meta += "Tags:           \n"
    meta += "HeaderImage:    \n"
    meta += "Category:       {}\n"
    meta += "Publish:        True\n"
    meta += "\n\n"
    meta = meta.format(title, timestamp, category)        
    
    with open(filepath, 'w') as op:
        op.write(meta)       
    
    return filepath<commit_msg>Made new_entry script more generic<commit_after>#!/usr/bin/python3

import os
from datetime import datetime


def create_entry(folder, timestamp='', title='', filename=None, category='',
                 name='', tags='', header_image='', categories='', 
                 publish_bool='True', content=''):

    try:
        os.makedirs(folder)
    except:
        pass

    if timestamp is None:
        timestamp = datetime.now().strftime("%Y-%m-%d")
    if title is None:
        title = \
            datetime.strptime(timestamp, "%Y-%m-%d").strftime("%A %d %B, %Y")
    if filename is None:
        filepath = os.path.join(folder, title + '.md')
    else:
        filepath = os.path.join(folder, filename + '.md')
    if os.path.exists(filepath):
        return filepath
    
    meta =  "Title:          {title}\n"
    meta += "Authors:        {name}\n"
    meta += "Date:           {date}\n"
    meta += "Tags:           {tags}\n"
    meta += "HeaderImage:    {header_image}\n"
    meta += "Category:       {categories}\n"
    meta += "Publish:        {publish_bool}\n"
    meta += "\n\n"
    meta = meta.format(title=title, name=name, date=timestamp, tags=tags, 
                       header_image=header_image, categories=categories, 
                       publish_bool=publish_bool)        
    
    with open(filepath, 'w') as op:
        op.write(meta)
        op.write(content)       
    
    return filepath
{'fraction_non_alphanumeric': 0.1495176848874598, 'fraction_numerical': 0.0008038585209003215, 'mean_word_length': 1.9490521327014219, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2601342', 'n_tokens_mistral': 792, 'n_tokens_neox': 768, 'n_words': 184}