forked from 20xd6/simple_blog_cms
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 469160cae6 | |||
| 73ab44d3f6 | |||
| 132fa394d4 |
+1
-24
@@ -42,13 +42,11 @@ def parse_file(article_path):
|
|||||||
path_to_publish = os.path.join(path_to_publish, article_number + final_title.replace(' ', '_'))
|
path_to_publish = os.path.join(path_to_publish, article_number + final_title.replace(' ', '_'))
|
||||||
print("Publishing to: {0}".format(path_to_publish))
|
print("Publishing to: {0}".format(path_to_publish))
|
||||||
os.makedirs(path_to_publish)
|
os.makedirs(path_to_publish)
|
||||||
index_file = os.path.join(blog_config['general']['web_root'], 'common', 'index.php')
|
index_file = os.path.join(blog_config['general']['web_root'], 'common', 'php', 'index.php')
|
||||||
place_indexes(index_check_path, path_to_publish, index_file)
|
place_indexes(index_check_path, path_to_publish, index_file)
|
||||||
add_datestamp(article_path, os.path.join(path_to_publish, "article.md"))
|
add_datestamp(article_path, os.path.join(path_to_publish, "article.md"))
|
||||||
article_imgs = find_local_links(article_path)
|
article_imgs = find_local_links(article_path)
|
||||||
copy_all_imgs(article_imgs, path_to_publish)
|
copy_all_imgs(article_imgs, path_to_publish)
|
||||||
menu_path = os.path.join(web_root, "common", "menu.php")
|
|
||||||
update_menu(menu_path, year, month)
|
|
||||||
tagging.tag_article(path_to_publish)
|
tagging.tag_article(path_to_publish)
|
||||||
|
|
||||||
|
|
||||||
@@ -127,27 +125,6 @@ def next_article_num(source_dir):
|
|||||||
return next_num.zfill(2) + "_"
|
return next_num.zfill(2) + "_"
|
||||||
|
|
||||||
|
|
||||||
def update_menu(menu_path, year, month):
|
|
||||||
print(menu_path)
|
|
||||||
with open(menu_path, "r") as menu_source:
|
|
||||||
menu_text = menu_source.read()
|
|
||||||
soup = BeautifulSoup(menu_text, 'html.parser')
|
|
||||||
list_items = soup.find_all(id="blog")
|
|
||||||
last_post = soup.find_all(id="current_year")
|
|
||||||
# current_date = soup.find_all(attrs={"id": "date"})
|
|
||||||
item_count = 0
|
|
||||||
for items in last_post:
|
|
||||||
item_count += 1
|
|
||||||
print(item_count)
|
|
||||||
print(type(items))
|
|
||||||
print(items.attrs)
|
|
||||||
if "date=" in items:
|
|
||||||
print(items)
|
|
||||||
# print(list_items)
|
|
||||||
# print(last_post)
|
|
||||||
# print(current_date)
|
|
||||||
|
|
||||||
|
|
||||||
def choose_option(options, selecting):
|
def choose_option(options, selecting):
|
||||||
count = 1
|
count = 1
|
||||||
for option in options:
|
for option in options:
|
||||||
|
|||||||
Reference in New Issue
Block a user