Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use string.Template when creating a new file #21706

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Commits on Jan 14, 2024

  1. Configuration menu
    Copy the full SHA
    83b20f5 View commit details
    Browse the repository at this point in the history
  2. Adds more time-related variables which can be used in the new file te…

    …mplate.
    
    - `${year}`: The current year with century as a decimal number.
    - `${month}`: The current month as a decimal number [01,12].
    - `${monthname}`: The current month's (local) name.
    - `${day}`: The current day of the month as decimal number [01,31].
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    9fc35c0 View commit details
    Browse the repository at this point in the history
  3. Uses datetime instead of time.

    The new `plugin.py` imports `datetime`, so we use it.
    
    IMPORTANT: When backporting, add `from datetime import datetime`!
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    baa0359 View commit details
    Browse the repository at this point in the history
  4. Adds even more time-related variables which can be used in the new fi…

    …le template.
    
    We now have the following variables, which can be used in the new file
    template:
    - `${date}`: The date and time without timezone information.
    - `{$isodate}`: The date and time in ISO format (including timezone
    information).
    - `${year}`: The current year with century as a decimal number
    [0001,9999].
    - `${month}`: The current month as a zero-padded decimal number [01,12].
    - `${day}`: The current day of the month as zero-padded decimal number
    [01,31].
    - `${hour}`: The current hour (24-hour clock) as a zero-padded decimal
    number [00,23].
    - `${minute}`: The current minute as a zero-padded decimal number
    [00,59].
    - `${second}`: The current second as a zero-padded decimal number
    [00,59].
    - `${tzname}`: The local time zone name.
    - `${monthname}`: The current month as locale's abbreviated name.
    - `${weekday}`: The current weekday as locale's abbreviated name.
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    bb14240 View commit details
    Browse the repository at this point in the history
  5. Adds user's full name to the list of variables which can be used in t…

    …he new file template.
    
    Information, how this can be done on Windows, are taken from
    https://sjohannes.wordpress.com/2010/06/19/win32-python-getting-users-display-name-using-ctypes/.
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    67ea36e View commit details
    Browse the repository at this point in the history
  6. Removes heuristics when looking for the username.

    Uses the OS name instead of trying to receive the 'USERNAME' environment
    variable, which is only available on Windows.
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    a482acb View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9f53443 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    e354f62 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    289ef8f View commit details
    Browse the repository at this point in the history
  10. Moves the block for creating the template variables behind the creati…

    …on of the new file name.
    
    This is needed, so that we can include a filename and filepath variable
    to be used in the new file template.
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    5f249a6 View commit details
    Browse the repository at this point in the history
  11. Adds file name and path to the list of variables which can be used in…

    … the new file template.
    
    New template variables:
    - `${file}` - The full file name including the path.
    - `${filename}` - The file name.
    - `${filepath}` - The file path.
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    cc34075 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    0b24b4b View commit details
    Browse the repository at this point in the history
  13. Adds project name and path to the list of variables which can be used…

    … in the new file template.
    
    New template variables:
    - `${projectname}` - The project name.
    - `${projectpath}` - The project directory.
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    92f3c29 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    cc1af5d View commit details
    Browse the repository at this point in the history
  15. Adds marker to position the cursor in the new file template.

    The first occurance of the marker `$|$` is removed from the template and
    the cursor positioned in that place.
    sphh committed Jan 14, 2024
    Configuration menu
    Copy the full SHA
    059d98f View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    e23fdfc View commit details
    Browse the repository at this point in the history

Commits on Jan 15, 2024

  1. Configuration menu
    Copy the full SHA
    5e325a4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f082e6f View commit details
    Browse the repository at this point in the history
  3. Undoes the last change.

    sphh committed Jan 15, 2024
    Configuration menu
    Copy the full SHA
    ece32b7 View commit details
    Browse the repository at this point in the history