Creating a link to start a new topic with pre-filled information

여기에는 일반인들이 다루기에는 다소 부담스러운 상당한 기술적 작업이 포함되어 있습니다. 이러한 링크를 쉽게 생성할 수 있도록 하는 ‘도움말’ 웹페이지를 만들 수 있을 것 같네요.

이것을 구현하는 것은 누군가에게는 멋진 소규모 프로젝트가 될 수 있을 것입니다:

import urllib

site = 'meta.discourse.org'
title = '''My special checklist'''
category = 'todo'
tags = ['tag1', 'tag2']

template = '''\
# Important!

Do these things:

[ ] thing one
[ ] thing two
'''

query = urllib.parse.urlencode(dict(
    title =    title,
    category = category,
    tags =     ','.join(tags),
    body =     template,
))
print(f'https://{site}/new-topic?{query}')

이 링크를 출력합니다.

5개의 좋아요