summaryrefslogtreecommitdiff
path: root/FBGM.py
diff options
context:
space:
mode:
Diffstat (limited to 'FBGM.py')
-rw-r--r--FBGM.py40
1 files changed, 37 insertions, 3 deletions
diff --git a/FBGM.py b/FBGM.py
index e36457f..601f509 100644
--- a/FBGM.py
+++ b/FBGM.py
@@ -1,23 +1,57 @@
from ftplib import parse150
import os, sys
+def paragraph_parser(contents):
+ paragraph_end = ['.\n', '?\n', '!\n', '"\n']
+ paragraph_index = [0]
+ paragraph_number = 1
+ paragraph = []
+ x = 0
+ while len(paragraph_end) > 1:
+ while x in range (len(paragraph_end)):
+ if contents[paragraph_index[paragraph_number-1]:].find(paragraph_end[x]) == -1:
+ paragraph_end.pop(x)
+ else:
+ x += 1
+ minimum = contents[paragraph_index[paragraph_number-1]:].index(paragraph_end[0])+paragraph_index[paragraph_number-1]
+ x = 1
+ for x in range (len(paragraph_end)):
+ if contents[paragraph_index[paragraph_number-1]:].index(paragraph_end[x]) < minimum:
+ minimum = contents[paragraph_index[paragraph_number-1]:].index(paragraph_end[x])+paragraph_index[paragraph_number-1]
+ paragraph_index.append(minimum)
+ print(minimum)
+
+
+
+ #paragraph.append(contents[paragraph_index[paragraph_number-1]: paragraph_index[paragraph_number]+1])
+ #print(paragraph_index[paragraph_number])
+ paragraph_number +=1
+
+
+
+
def txthandler(path, htmlfile):
+
filename = path[path.rfind('/')+1: path.rfind('.')]
f = open(path, "r")
contents = f.read()
+ title = filename
+ main_header = contents[0:contents.find('\n')]
+ paragraph_parser(contents)
+
htmlfile.write('<!DOCTYPE html>'
'<html lang ="en">'
'<head>'
- '<title>' +filename+ '</title>'
+ '<title>' +title+ '</title>'
'<link rel="stylesheet" type="text/css" href="stylesheet.css">'
'<link rel="icon" type="image/x-icon" href="images/favicon.ico">'
'<meta charset="utf-8"/>'
'</head>'
'<body>'
- '<h1>' +contents[0:contents.find('\n')]+ '</h1>'
+ '<h1>' +main_header+ '</h1>'
'<article class="introduction">'
'<h2>&nbsp Introduction &nbsp</h2>'
- '<p>'+contents[contents.find('\n'):contents[contents.find('\n'):].find('.\n')+contents.find('\n')+1]+'</p>'
+ '<p>''</p>'
'</article>'
'</body>'
'</html>')