Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
1 result

wikilabbook

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Nicolas Mielec authored
    a3c16d69
    History
    Name Last commit Last update
    wikilabbook
    .gitignore
    README.md
    setup.py

    Wikilabbook

    This package can be used to generate pages in dokuwiki script for a basic labbook. With the basic template, pages can be generated for years, months and days.

    A year page will show links to every month. A month page will show links to every day, and links to previous month, current year and next month. A day page will show links to previous day, current month and next day.

    The .template.yaml located in the a user folder (see installation notes) holds the templates for the pages. Date formats are python datetime strftime formats, see the documentation of datetime. The LABBOOK_PATH variable should be the root page of the labbook in dokuwiki link notation, e.g. wiki:tfc:prive:gyro:cavity:labbook. It can be changed using the --config-path argument (see installation notes).

    Installation :

    The package can be installed with python setup.py install or as an editable package with pip install -e path/to/package.

    On first use, the program will copy the template configuration to a user directory : %APPDATA%\wikilabbook\.template.yaml on windows, ~/user/.config/wikilabbook/.template.yaml on linux, and inside the package installation directory else.

    After installation, modify the LABBOOK_PATH in the template using the command python -m wikilabbook --config-path path:to:the:labbook.

    To be able to copy results to the clipboard, you should install the pyperclip package from pip.

    Usage

    Get a dokuwiki labbook page template

    positional arguments:
      date                  Date of the requested page
    
    optional arguments:
      -h, --help            show this help message and exit
      --noclip              Do not store in clipboard
      --file filename, -f filename Save to file
      --verbose, -v         Print result to console

    Examples :

    • Get today's page
      python -m wikilabbook
      The page of the day will get copied to the clipboard

    • Get a year page
      python -m wikilabbook 1992
      will get the year page

    • Get a month page
      python -m wikilabbook 1992 5
      will copy May 1992 page to the clipboard

    • To save the page to a file
      python -m wikilabbook 1992 5 6 -f page.txt
      will save the May 6th 1992 page to page.txt and copy it to the clipboard

    • To see the output in the console
      python -m wikilabbook 1992 5 6 -v
      will output the May 6th 1992 page to the console and copy it to the clipboard

    • To not copy to clipboard python -m wikilabbook 1992 5 6 -v --noclip
      will only output the May 6th 1992 page to the console

    Options can be combined : python -m wikilabbook 1992 5 6 -v --noclip -f whosbirthday.txt
    will output the May 6th 1992 page to the console and to the file whosbirthday.txt only

    Example page :

    On Friday January 12th the command python -m wikilabook will copy this text to the clipboard

    ====== Friday 2018-01-12 ======
    
    
    ^[[wiki:tfc:prive:gyro:cavity:labbook:2018:Jan18:2018_01_11|Thursday 2018-01-11]] ^ [[wiki:tfc:prive:gyro:cavity:labbook:2018:Jan18:January 2018]] ^ [[wiki:tfc:prive:gyro:cavity:labbook:2018:Jan18:2018_01_13|Saturday 2018-01-13]]^