Python · Paste
Lorem Ipsum
Pastes placeholder text into the app in front. Enter how many paragraphs you need (1 to 10, default 1).
- Language
- Python
- Output
- Paste
- Keyword
lorem- Arguments
- Paragraphs (optional) (optional)
- Licence
- MIT
- Author
- Docktopus
- File
- lorem-ipsum.py (1.5 KB)
- Downloads
- 1
In Docktopus: Settings → Scripts → Browse Community Scripts. Read the source before you run any script.
Source
lorem-ipsum.py · sha256 51512ef3875d…#!/usr/bin/env python3
# @docktopus.schemaVersion 1
# @docktopus.title Lorem Ipsum
# @docktopus.mode paste
# @docktopus.icon text.alignleft
# @docktopus.keyword lorem
# @docktopus.description Pastes placeholder text into the app in front. Enter how many paragraphs you need (1 to 10, default 1).
# @docktopus.argument1 {"type": "text", "placeholder": "Paragraphs (optional)", "optional": true}
# @docktopus.author Docktopus
import random
import sys
WORDS = (
"lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et "
"dolore magna aliqua enim ad minim veniam quis nostrud exercitation ullamco laboris nisi aliquip ex ea "
"commodo consequat duis aute irure in reprehenderit voluptate velit esse cillum fugiat nulla pariatur "
"excepteur sint occaecat cupidatat non proident sunt culpa qui officia deserunt mollit anim id est laborum"
).split()
raw = sys.argv[1].strip() if len(sys.argv) > 1 else ""
count = int(raw) if raw.isdigit() else 1
if not 1 <= count <= 10:
sys.exit("Choose from 1 to 10 paragraphs.")
def sentence() -> str:
words = random.choices(WORDS, k=random.randint(8, 16))
return " ".join(words).capitalize() + "."
paragraphs = []
for index in range(count):
body = " ".join(sentence() for _ in range(random.randint(4, 6)))
if index == 0:
body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + body
paragraphs.append(body)
print("\n\n".join(paragraphs), end="")