Skip to content

Vertical split breaks #66

@AndrewRoddy

Description

@AndrewRoddy

Vsplit breaks this file

Before V split
Image

After V split then moving down the file a bit
Image

After moving the entire way down the file on the right.
Image

Moving down the file on the left:

Image

code:

  1
  2 from datetime import datetime, date, timedelta
  3 from pathlib import Path
  4
  5 def getPath(DAY, OBSIDIAN_PATH, DAILY_NOTES_FOLDER, CUSTOM_FORMAT):
  6
  7     date = datetime.strptime(DAY, "%Y-%m-%d")
  8
  9     # Splits day up into its values
 10     year  = date.year
 11     month = date.month
 12     day   = date.day
 13
 14     note_path = CUSTOM_FORMAT
 15
 16     date_dict = {
 17         # Year
 18         "YYYY": "%Y",
 19         "YY":   "%y",
 20         # Month
 21         "MMMM": "%B",
 22         "MMM":  "%b",
 23         "MM":   "%m",
 24         # Day
 25         "dddd": "%A",
 26         "ddd":  "%a",
 27         # Day of Month
 28         "DD":   "%d",
 29     }
 30
 31     for key, value in date_dict.items():
 32         note_path = note_path.replace(
 33             key,
 34             date.strftime(value)
 35         )
 36
 37     path = OBSIDIAN_PATH + "/" + DAILY_NOTES_FOLDER + "/" + note_path + ".md"
 38
 39     return path
 40
 41 def dateRange(start_date: date, end_date: date):
 42     days = int((end_date - start_date).days)
 43     for n in range(days):
 44         yield start_date + timedelta(n)
 45
 46 def checkForSource(SOURCE, PATH):
 47     with open(PATH, "r", encoding="utf-8") as file:
 48         for line in file:
 49             print(line)
 50
 51     return False
 52
 53 def makeTemplatedFile(new_path, OBSIDIAN_PATH, DAILY_NOTE_TEMPLATE):
 54     template_path = f"{OBSIDIAN_PATH}/{DAILY_NOTE_TEMPLATE}.md"
 55     new_path = Path(new_path)
 56     parent = new_path.parent
 57
 58     DEBUG = False
 59     if DEBUG:
 60         print(new_path)
 61
 62     parent.mkdir(parents=True, exist_ok=True)
 63     with new_path.open("a", encoding="utf-8") as file:
 64         with open(template_path, "r", encoding="utf-8") as template:
 65             file.write(template.read())
 66
 67 def hasHeader(path, header):
 68     with open(path, "r", encoding="utf=8") as file:
 69         if header in file.read():
 70             return True
 71
 72     return False
 73
 74 def insertData(path, header, data):
 75     with path.open("a", encoding="utf=8") as file:
 76         file.write(header)
 77         file.write(data)
 78

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions