mirror of https://github.com/zulip/zulip.git
populate_db: Add Markdowns to stream descriptions.
Added a 20 percent chance to add a random markdown to a word in Stream descriptions on populate_db. Picks a random word and a markdown, adds the markdown to the picked word, then replace the word from stream description with the padded word.
This commit is contained in:
parent
a848afd078
commit
6f020c0c7d
|
@ -821,6 +821,14 @@ class Command(BaseCommand):
|
|||
("Richard Feynman", "https://www.britannica.com/biography/Richard-Feynman"),
|
||||
]
|
||||
|
||||
MARKDOWNS = [
|
||||
"**",
|
||||
"~~",
|
||||
"***~~",
|
||||
"`",
|
||||
"``",
|
||||
]
|
||||
|
||||
# Add stream names and stream descriptions
|
||||
for i in range(options["extra_streams"]):
|
||||
extra_stream_name = random.choice(extra_stream_names) + " " + str(i)
|
||||
|
@ -834,6 +842,18 @@ class Command(BaseCommand):
|
|||
}
|
||||
|
||||
for stream_name in zulip_stream_dict.keys():
|
||||
|
||||
# Add Markdowns to Stream descriptions
|
||||
if random.random() <= 0.20:
|
||||
markdown = random.choice(MARKDOWNS)
|
||||
words_in_description = zulip_stream_dict[stream_name]["description"].split()
|
||||
random_word = random.choice(words_in_description)
|
||||
zulip_stream_dict[stream_name]["description"] = zulip_stream_dict[
|
||||
stream_name
|
||||
]["description"].replace(
|
||||
random_word, str(markdown + random_word + markdown[::-1])
|
||||
)
|
||||
|
||||
# Add Urls to stream descriptions.
|
||||
if random.random() <= 0.10:
|
||||
hyperlink, url = random.choice(stream_description_urls)
|
||||
|
|
Loading…
Reference in New Issue