aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorneodarz <neodarz@neodarz.net>2017-05-22 22:41:40 +0200
committerneodarz <neodarz@neodarz.net>2017-05-22 22:41:40 +0200
commite95eeb9a06c912e1bba28d80510c8b1d616ac038 (patch)
tree28f10d6a21788cb6e0873576875ca73deaed92d7
parent414eee6f803885e2c67121782cf746e8b1ab05aa (diff)
downloadmy_new_personal_website-e95eeb9a06c912e1bba28d80510c8b1d616ac038.tar.xz
my_new_personal_website-e95eeb9a06c912e1bba28d80510c8b1d616ac038.zip
Add some generated
-rwxr-xr-xpyblog50
1 files changed, 48 insertions, 2 deletions
diff --git a/pyblog b/pyblog
index c431b51b..f921f8d2 100755
--- a/pyblog
+++ b/pyblog
@@ -371,7 +371,7 @@ def generate_situation1menu():
sys.stderr.write("generating situation1menu\n")
documents_fileList = []
- documents_fileList.append("/website/Documents/situation-pro-1.html")
+ documents_fileList.append("/website/Documents/PPE4.html")
fd, tmppath = tempfile.mkstemp()
os.close(fd)
@@ -411,7 +411,7 @@ def generate_situation2menu():
"""Generate situation2menu."""
documents_fileList = []
- documents_fileList.append("/website/Documents/situation-pro-2.html")
+ documents_fileList.append("/website/Documents/stage2.html")
fd, tmppath = tempfile.mkstemp()
os.close(fd)
@@ -892,6 +892,12 @@ def rewrite_title():
filenames.append("build"+os.path.join(root.split(BUILDDIR)[1], name))
except IndexError:
filenames.append(name)
+ if re.search(r'Documents($)',root):
+ if name.endswith(".html"):
+ try:
+ filenames.append("build"+os.path.join(root.split(BUILDDIR)[1], name))
+ except IndexError:
+ filenames.append(name)
if re.search(r'notes($)',root):
if name.endswith(".html"):
try:
@@ -907,6 +913,10 @@ def rewrite_title():
h1_titles_list = []
h1_title = []
+
+ h2_titles_list = []
+ h2_title = []
+
fd, tmppath = tempfile.mkstemp()
os.close(fd)
for filename in filenames:
@@ -944,6 +954,39 @@ def rewrite_title():
h1_titles_list.append(h1_title)
h1_title = []
+ for myh2 in soup.find_all("h2"):
+ if re.match("^(?!.*article-title).*$", str(myh2)):
+ h2_id = myh2['id']
+ h2_name = myh2.string
+
+ h2_title.append(str(myh2))
+
+
+ myh2['class'] = "h2"
+ myh2.string = ""
+
+ h2_span_left = soup.new_tag("span")
+ h2_span_left['class'] = "left-h2"
+ h2_span_left.string = ".: "
+
+ h2_span_title = soup.new_tag("span")
+ h2_span_title['class'] = "title-h2"
+ h2_span_title.string = h2_name
+
+ h2_span_right = soup.new_tag("span")
+ h2_span_right['class'] = "right-h2"
+ h2_span_right.string = " :."
+
+ myh2.string.insert_before(h2_span_left)
+ myh2.span.insert_after(h2_span_right)
+ myh2.span.insert_after(h2_span_title)
+
+ h2_title.append(myh2)
+ h2_title.append(h2_name)
+
+ h2_titles_list.append(h2_title)
+ h2_title = []
+
tested_title_list = []
tested_title = []
for filename in filenames:
@@ -958,6 +1001,9 @@ def rewrite_title():
for title in h1_titles_list:
if re.match(".*"+title[0]+".*", line):
string = str(title[1])
+ for title in h2_titles_list:
+ if re.match(".*"+title[0]+".*", line):
+ string = str(title[1])
if string != "":
indexmd.write(re.sub(line, string, line))
else: