Skip to content

dot size for second level in a list #54

Description

@Firnic

the dot size of the second row is very big, here is a simple code to reproduce :

import calendar
from markdown_pdf import MarkdownPdf, Section
from datetime import datetime, timedelta
import os
import argparse

# Function to get the previous week's Sunday
def get_previous_week_sunday():
    today = datetime.now()
    previous_week_sunday = today - timedelta(days=(today.weekday() - calendar.SUNDAY + 7) % 7 + 7)
    return previous_week_sunday

# Function to get this week's Sunday
def get_this_week_sunday():
    today = datetime.now()
    this_week_sunday = today + timedelta(days=(calendar.SUNDAY - today.weekday() + 7) % 7 - 7)
    return this_week_sunday

# Function to get the dates for next week from Sunday to Saturday
def get_next_week_dates():
    next_week_sunday = get_this_week_sunday() + timedelta(days=7)
    week_dates = [next_week_sunday + timedelta(days=i) for i in range(7)]
    return week_dates

# Function to parse command-line arguments
def parse_arguments():
    parser = argparse.ArgumentParser(description='Generate PDF from Markdown with date range.')
    parser.add_argument('-w', '--week', choices=['past', 'current', 'next'], default='current', help='Select the week: past, current, or next')
    return parser.parse_args()

# Main function to generate the PDF
def main():
    args = parse_arguments()
    
    if args.week == 'past':
        wanted_dates = get_previous_week_sunday
    elif args.week == 'next':
        wanted_dates = get_next_week_dates
    else:
        wanted_dates = get_this_week_sunday

    # Read the Markdown file
    with open('../update.md', 'r') as f:
        text = f.read()

    # Replace the placeholder with the date range
    start_date = wanted_dates().strftime("%Y-%m-%d")
    end_date = (wanted_dates() + timedelta(days=6)).strftime("%Y-%m-%d")
    date_range = f"{start_date} to {end_date}"
    text = text.replace("[Insert Date Range]", date_range)

    # Get the current date in YYYY-MM-DD format
    date = datetime.now().strftime("%Y-%m-%d")

    # Generate the PDF file name with the current date
    pdf_file_name = f"update-{date}.pdf"

    # Create the 'update' folder if it doesn't exist
    os.makedirs('update', exist_ok=True)

    # Create a MarkdownPdf object
    pdf = MarkdownPdf()

    # Create a Section object with the Markdown content
    section = Section(text)

    # Add the section to the PDF
    pdf.add_section(section)

    # Save the PDF in the 'update' folder with the generated file name
    pdf.save(os.path.join('update', pdf_file_name))
    print(f"The PDF has been successfully saved as {os.path.join('update', pdf_file_name)}.")

if __name__ == "__main__":
    main()

and the markdown:

Weekly Summary

Week of [Insert Date Range]

Monday

  • Task 1: [Description of Task 1]
    • Estimated Time: [Time in hours/minutes]
  • Task 2: [Description of Task 2]
    • Estimated Time: [Time in hours/minutes]
  • Highlights: [Any notable achievements or events]

Tuesday

  • Task 1: [Description of Task 1]
    • Estimated Time: [Time in hours/minutes]
  • Task 2: [Description of Task 2]
    • Estimated Time: [Time in hours/minutes]
  • Highlights: [Any notable achievements or events]

Wednesday

  • Task 1: [Description of Task 1]
    • Estimated Time: [Time in hours/minutes]
  • Task 2: [Description of Task 2]
    • Estimated Time: [Time in hours/minutes]
  • Highlights: [Any notable achievements or events]

Thursday

  • Task 1: [Description of Task 1]
    • Estimated Time: [Time in hours/minutes]
  • Task 2: [Description of Task 2]
    • Estimated Time: [Time in hours/minutes]
  • Highlights: [Any notable achievements or events]

Friday

  • Task 1: [Description of Task 1]
    • Estimated Time: [Time in hours/minutes]
  • Task 2: [Description of Task 2]
    • Estimated Time: [Time in hours/minutes]
  • Highlights: [Any notable achievements or events]

Overall Highlights

  • Achievement 1: [Description of Achievement 1]

  • Achievement 2: [Description of Achievement 2]

  • Challenges: [Any challenges faced and how you overcame them]

Next week forecast

  • Achievement 1: [Description of Achievement 1]

    • Estimated Time: [Time in hours/minutes]
  • Achievement 2: [Description of Achievement 2]

    • Estimated Time: [Time in hours/minutes]
  • Achievement 3: [Description of Achievement 3]

    • Estimated Time: [Time in hours/minutes]
  • Challenges: [Any challenges faced and how you forecast]

Notes

  • [Any additional notes or reflections]

result :

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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