Skip to main content

Filter pages for assignments

Project description

File filter plugin for docums

select-files is a docums plugin that filters out files (pages) using a parametrized regular expression.

The main use case for this plugin is to prepare lectures or assignments and only publishing them at a given date.

Quick start

  1. Install the module using pip: pip3 install docums-select-files

  2. In your project, add a plugin configuration to docums.yml:

    plugins:
      - select-files:
       select: '^s(\d+)'
       where: 'lambda x : int(x) <= 5'
    

This would search for files named sNN... and select only those where NN is less than or equal to 5.

In the where expression, you can use the following declared variables

  • now : represent the current time in ISO format
  • sfc : The value of the SELECT_FILE_CONDITION environment variable.

The modules os and datetime are imported, so you can use methods from them.

Disabling the plugin

You can disable the plugin using an environment variable. For example, you could configure your site this way:

plugins:
  - select-files:
  select: '^s(\d+)'
  where: 'lambda x : int(x) <= 5'
  disabled_if_env: SELECT_FILES_DISABLED

and then, running docums with SELECT_FILES_DISABLED set to 1 would disable this plugin and let all pages be processed:

SELECT_FILES_DISABLED=1 docums ...

Similar plugins

  • docums-exclude : exclude arbitrary file paths and patterns from the input

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docums-select-files-0.3.6.tar.gz (6.8 kB view details)

Uploaded Source

File details

Details for the file docums-select-files-0.3.6.tar.gz.

File metadata

  • Download URL: docums-select-files-0.3.6.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4

File hashes

Hashes for docums-select-files-0.3.6.tar.gz
Algorithm Hash digest
SHA256 f3293d5c86b5a2eab3f03d5f07adbf594e8e7d5c2525e0bf4a35c4b59c440377
MD5 6f7afb720516511e281ddb70b8010be1
BLAKE2b-256 62bdd9388b035d6b8073f440cab49e561d820d54a4b5338bdaf6614e9c56018c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page