forked from indymedia/epicyon
Removing html formatting from patch
parent
b5053a9155
commit
03f88377dd
16
git.py
16
git.py
|
@ -9,6 +9,17 @@ __status__ = "Production"
|
|||
import os
|
||||
|
||||
|
||||
def gitFormatContent(content) -> str:
|
||||
""" replace html formatting, so that it's more
|
||||
like the original patch file
|
||||
"""
|
||||
contentStr = content.replace('<br>', '\n').replace('<br \>', '\n')
|
||||
contentStr = contentStr.replace('<p>', '').replace('</p>', '\n')
|
||||
if 'From ' in contentStr:
|
||||
contentStr = contentStr.split('From ', 1)[1]
|
||||
return contentStr
|
||||
|
||||
|
||||
def getGitProjectName(baseDir: str, nickname: str, domain: str,
|
||||
subject: str) -> str:
|
||||
"""Returns the project name for a git patch
|
||||
|
@ -76,10 +87,7 @@ def receiveGitPatch(baseDir: str, nickname: str, domain: str,
|
|||
subject, content):
|
||||
return False
|
||||
|
||||
# replace html formatting, so that it's more
|
||||
# like the original patch file
|
||||
contentStr = content.replace('<br>', '\n').replace('<br />', '\n')
|
||||
contentStr = contentStr.replace('<p>', '').replace('</p>', '\n')
|
||||
contentStr = gitFormatContent(content)
|
||||
|
||||
patchLines = contentStr.split('\n')
|
||||
patchFilename = None
|
||||
|
|
9
inbox.py
9
inbox.py
|
@ -60,7 +60,7 @@ from question import questionUpdateVotes
|
|||
from media import replaceYouTube
|
||||
from git import isGitPatch
|
||||
from git import receiveGitPatch
|
||||
|
||||
from git import gitFormatContent
|
||||
|
||||
def storeHashTags(baseDir: str, nickname: str, postJsonObject: {}) -> None:
|
||||
"""Extracts hashtags from an incoming post and updates the
|
||||
|
@ -1708,12 +1708,9 @@ def gitPatchNotify(baseDir: str, handle: str,
|
|||
patchFile = accountDir + '/.newPatch'
|
||||
with open(patchFile, 'w') as fp:
|
||||
fp.write(subject)
|
||||
contentStr = content.replace('<br>', '\n').replace('<br \>', '\n')
|
||||
contentStr = contentStr.replace('<p>', '').replace('</p>', '\n')
|
||||
if 'From ' in contentStr:
|
||||
contentStr = contentStr.split('From ', 1)[1]
|
||||
|
||||
with open(patchFile + 'Content', 'w') as fp:
|
||||
fp.write(contentStr)
|
||||
fp.write(gitFormatContent(content))
|
||||
|
||||
|
||||
def groupHandle(baseDir: str, handle: str) -> bool:
|
||||
|
|
Loading…
Reference in New Issue