diff --git a/frontend/management/commands/fake_data.py b/frontend/management/commands/fake_data.py index 7bd3610..ccdeb04 100644 --- a/frontend/management/commands/fake_data.py +++ b/frontend/management/commands/fake_data.py @@ -1,4 +1,5 @@ import random +import markdown.treeprocessors from django.core.management.base import BaseCommand from django.db.transaction import atomic @@ -82,13 +83,22 @@ def handle(self, fake_complex_challenges, fake_simple_challenges, ) for i in range(1, fake_complex_challenges + 1): - if random.choice((False, False, True)): + choice = random.choice((1, 2, 2, 3)) + if choice == 1: detail = """

众所周知,对 $x$ 求导得到的结果为 1。flag{FLAG_INDEX}

块状公式测试 flag{FLAG_INDEX:USER_ID}

$$\\frac{1}{3} = \\frac{2}{6}$$

""" - else: + elif choice == 2: detail = 'flag{FLAG_INDEX}flag{FLAG_INDEX:USER_ID}' + elif choice == 3: + # test markdown code block + detail = markdown.markdown( + """```python +def a(): + pass +```""", extensions=['codehilite', 'fenced_code'], + ) Challenge.create( Context(root), name=f'复杂题 {i}', diff --git a/requirements-lock.txt b/requirements-lock.txt index 36e81f2..6d99a52 100644 --- a/requirements-lock.txt +++ b/requirements-lock.txt @@ -10,7 +10,6 @@ django-allauth==0.57.0 gevent==23.9.1 greenlet==3.0.0 idna==3.4 -importlib-metadata==6.8.0 jmespath==0.10.0 Markdown==3.4.4 oauthlib==3.2.2 @@ -19,6 +18,7 @@ psycopg-binary==3.1.12 psycopg-pool==3.1.8 pycparser==2.21 pycryptodome==3.19.0 +Pygments==2.16.1 PyJWT==2.8.0 pymemcache==4.0.0 pyOpenSSL==23.2.0 @@ -27,9 +27,8 @@ PyYAML==6.0.1 requests==2.31.0 requests-oauthlib==1.3.1 sqlparse==0.4.4 -typing-extensions==4.8.0 +typing_extensions==4.8.0 urllib3==2.0.6 uWSGI==2.0.22 -zipp==3.17.0 zope.event==5.0 zope.interface==6.1 diff --git a/requirements.txt b/requirements.txt index c4c2132..c48f272 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,6 +9,7 @@ psycopg==3.1.12 psycopg-binary==3.1.12 psycopg-pool==3.1.8 pycryptodome==3.19.0 +pygments==2.16.1 pymemcache==4.0.0 pyOpenSSL==23.2.0 PyYAML==6.0.1