hidden examples
This commit is contained in:
@ -9,6 +9,7 @@ for file in files:
|
||||
fileData = someFile.read()
|
||||
someFile.close()
|
||||
originalCode = re.search(codeRe,fileData).group(0)
|
||||
print(re.split(codeRe,fileData)[0])
|
||||
formatedCode = autopep8.fix_code(re.split(codeRe,fileData)[1])
|
||||
fileToSave = fileData.replace(originalCode,('```python \n'+formatedCode+'\n```'))
|
||||
someFile = open("snippets/"+file,'w')
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import os
|
||||
import re
|
||||
codeRe = "```\s*python([\s\S]*?)```"
|
||||
def title_case(str):
|
||||
return str[:1].upper() + str[1:].lower()
|
||||
EMOJIS = {
|
||||
@ -46,5 +48,6 @@ for category in tag_dict:
|
||||
for snippet in tag_dict[category]:
|
||||
someFile = open("snippets/" + snippet + '.md')
|
||||
fileData = someFile.read()
|
||||
toAppend += fileData + '\n'
|
||||
codeParts = re.split(codeRe,fileData)
|
||||
toAppend += codeParts[0] + f'```py{codeParts[1]} \n ```' +codeParts[2] + f'<details><summary>View Examples</summary>\n\n```py\n{codeParts[3]}\n```\n<details>' + '\n'
|
||||
open("README.md",'w').write(start+toAppend+'\n'+end)
|
||||
|
||||
Reference in New Issue
Block a user