Skip to content

Commit

Permalink
#116 cleanup html from chapter title and intro (#129)
Browse files Browse the repository at this point in the history
  • Loading branch information
hasankhan authored Oct 18, 2020
1 parent 98faa71 commit 83bdc50
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 5 additions & 5 deletions models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from flask_sqlalchemy import SQLAlchemy
from main import app
from text_transform import cleanup_text, cleanup_en_text, cleanup_chapter_title
from text_transform import cleanup_text, cleanup_en_text, cleanup_chapter_title, cleanup_en_chapter_title
import json


Expand Down Expand Up @@ -78,9 +78,9 @@ def serialize(self):
{
"lang": "en",
"chapterNumber": str(self.englishBabNumber),
"chapterTitle": self.englishBabName,
"intro": self.englishIntro,
"ending": self.englishEnding,
"chapterTitle": cleanup_en_chapter_title(self.englishBabName),
"intro": cleanup_en_text(self.englishIntro),
"ending": cleanup_en_text(self.englishEnding),
},
{
"lang": "ar",
Expand Down Expand Up @@ -125,7 +125,7 @@ def serialize(self):
{
"lang": "en",
"chapterNumber": self.englishBabNumber,
"chapterTitle": self.englishBabName,
"chapterTitle": cleanup_en_chapter_title(self.englishBabName),
"urn": self.englishURN,
"body": cleanup_en_text(self.englishText),
"grades": grades["en"],
Expand Down
7 changes: 7 additions & 0 deletions text_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,10 @@ def cleanup_chapter_title(text):
text = fix_hyperlinks(text)
text = text.strip()
return text

def cleanup_en_chapter_title(text):
if not text:
return text
text = cleanup_chapter_title(text)
text = standardize_terms(text)
return text

0 comments on commit 83bdc50

Please sign in to comment.