librep - LIne Block REPlacement
librep is a python-based command-line tools allows to render file placeholders.
It replaces a placeholder of a given syntax with the content of the file that is
specified in the placeholder.
The tool is independent of the document type, since it is assumed that the chosen syntax does not interfere with the syntax of any (especially markup) language.
The indentation of the placeholder is used for the whole inserted code/text block.
Usage
Insert a placeholder of the following syntax inside a file:
§§§<filename>:<start>:<end>§§§
Afterwards, you can render the placeholder by running
$ librep -i "file_with_placeholder.md"
This will replace the original line in the file file_with_placeholder.md with
the content of the file <filename> from line <start> to line <end>.
The filename has to either be absolute or relative to the file you specify the
placeholder in.
Using a URL instead of a file from the repository
If you want to link a file that is not present on your machine, but you have a URL to that exact file, you can use the following syntax:
§§§url="<url>":<start>:<end>§§§
Note that this requires wget to be installed on your machine
Example
This file file_with_placeholders.md
# Heading
Check out this awesome python code!
```py
§§§./code.py§§§
```
Can be processed with librep by doing
$ librep -i "file_with_placeholder.md"
Which results in
# Heading
Check out this awesome python code!
```py
def calc_sum(a, b):
"""Calculates the sum of a+b
Parameters
----------
a : float, int
First number
b : float, int
Second number
Returns
-------
sum : float
Sum of a and b
"""
return a + b
```
Examples
Below you can find different versions for inserting different parts of the file
examples/plotting/plot_rocs.py into your markdown file.
| Placeholder | Result |
|---|---|
§§§examples/file.py§§§ |
whole file |
§§§examples/file.py::§§§ |
whole file |
§§§examples/file.py:10:20§§§ |
from line 10 to line 20 |
§§§examples/file.py::10§§§ |
from top to line 10 |
§§§examples/file.py:10§§§ |
from line 10 to bottom |
§§§examples/file.py:10:§§§ |
from line 10 to bottom |
Installation
librep can simply be installed using pip install:
pip install librep
# or
pip install https://github.com/umami-hep/librep/archive/master.tar.gz
Metadata
Release files for librep 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| librep-0.0.5.tar.gz | 9.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| librep-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.6 kB
Release files / librep-0.0.5.tar.gz
| Download URL | librep-0.0.5.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a0b4b2155a9788b18175e52f4c143a1621d7d8d268a3c4f206815ca5ea67952
|
|
BLAKE2b-256 checksum How to use checksums |
ef972fbabe2efae965206f5f628a905d5ba4297a1dca19118a7c12a57780e8eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.13
|
Release files / librep-0.0.5-py3-none-any.whl
| Download URL | librep-0.0.5-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37074435e5812508e6697f57f064d734e6b91ab1d60e2420cce21265f6a059ae
|
|
BLAKE2b-256 checksum How to use checksums |
d5d9bdb362e6bf816860f490b1afa489c11db846630bcc4bd04b117e6f16bfff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.7.13
|
Security for librep 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.