sync drop dead code
This commit is contained in:
1 parent
92b64808ea
commit
5610e50863
3 files changed
+1
-53
No files matched your search
@@ -45,12 +45,6 @@ def create_date(date_str, date_formats=None):
|
||||
return None
|
||||
|
||||
|
||||
# 2016 На крыльях бабочек
|
||||
# 2016.10 На крыльях бабочек
|
||||
# 2016.10.10 На крыльях бабочек
|
||||
folder_name_pattern = re.compile('([\d.]+)(.*)')
|
||||
|
||||
|
||||
async def untouched(items: [Model]) -> [Model]:
|
||||
if settings.skip_unchanged:
|
||||
return items
|
||||
@@ -73,21 +67,6 @@ async def untouched(items: [Model]) -> [Model]:
|
||||
# return filtered_documents
|
||||
|
||||
|
||||
def create_date_and_title_from_folder_name(folder_name, date_formats=None):
|
||||
m = folder_name_pattern.findall(folder_name)
|
||||
if not m:
|
||||
return None, None
|
||||
|
||||
date_str, title = m[0]
|
||||
title = os.path.splitext(title.strip())[0]
|
||||
date = create_date(date_str, date_formats)
|
||||
|
||||
if not date:
|
||||
return None, title
|
||||
|
||||
return date, title
|
||||
|
||||
|
||||
async def create_post(provider: Provider, folder: str, md: str, sizes):
|
||||
from kazimir.fix_links_quotes import fix_links_quotes
|
||||
|
||||
@@ -171,19 +150,6 @@ async def create_post(provider: Provider, folder: str, md: str, sizes):
|
||||
return post, images, documents, encoded_tokens
|
||||
|
||||
|
||||
def images_from_html(md):
|
||||
if not md:
|
||||
return []
|
||||
|
||||
post_html = lxml.html.fromstring(md)
|
||||
|
||||
images = []
|
||||
for img in post_html.cssselect('img'):
|
||||
src = img.get('src')
|
||||
images.append(src)
|
||||
return images
|
||||
|
||||
|
||||
def title_from_html(md):
|
||||
html = lxml.html.fromstring(md)
|
||||
titles = html.cssselect('h1')
|
||||
|
||||
@@ -11,7 +11,7 @@ from db import collection
|
||||
from sync.data import request
|
||||
from sync.models import Model
|
||||
|
||||
from sync import create_date, images_from_html, title_from_html, create_post
|
||||
from sync import create_date, title_from_html, create_post
|
||||
from sync.models.Image import Image
|
||||
from utils.hash import hash_str
|
||||
from utils.io import parse_yaml_front_matter
|
||||
@@ -174,9 +174,6 @@ class Page(Model):
|
||||
files = []
|
||||
files += self.get_param('images')
|
||||
files += self.get_param('documents')
|
||||
if self.has_param('contentFile'):
|
||||
files += [self.get_param('contentFile')]
|
||||
|
||||
folder = self.get_param('folder')
|
||||
files = [os.path.join(folder, x) for x in files]
|
||||
files = sorted([self.file] + files)
|
||||
@@ -201,8 +198,4 @@ def get_manifest(provider, path):
|
||||
if 'id' in manifest:
|
||||
manifest['id'] = str(manifest['id'])
|
||||
|
||||
if 'contentFile' in manifest:
|
||||
dirname = os.path.dirname(path)
|
||||
manifest['contentHtml'] = provider.read(os.path.join(dirname, manifest['contentFile'])).read().decode('utf-8')
|
||||
|
||||
return manifest
|
||||
@@ -1,11 +0,0 @@
|
||||
import os
|
||||
import re
|
||||
import settings
|
||||
|
||||
__author__ = 'Roman Timashev'
|
||||
|
||||
__check_description_filename_exp = re.compile('^[%s]+(\[\d+\])\.md$' % settings.description_available_chars)
|
||||
|
||||
|
||||
def check_description_filename(filename):
|
||||
return __check_description_filename_exp.match(filename)
|
||||
Reference in new issue
Block a user