move create_post_from_image_list to Article (usage only there)

This commit is contained in:
tmshv committed 2020-02-29 01:02:04 +03:00
1 parent a2a73034da
commit 092fa4578b
2 files changed
+11 -12

No files matched your search

-10
View File
@@ -3,8 +3,6 @@ import re
from datetime import datetime from datetime import datetime
import lxml.html import lxml.html
from markdown import markdown
import kazimir import kazimir
import settings import settings
from kazimir.CSVToken import CSVToken from kazimir.CSVToken import CSVToken
@@ -181,11 +179,3 @@ def title_from_html(md):
titles = html.cssselect('h1') titles = html.cssselect('h1')
if len(titles): if len(titles):
return titles[0].text return titles[0].text
create_post_from_image_list = lambda images: markdown(
'\n'.join(map(
lambda i: '![]({img})'.format(img=i),
images
))
)
+11 -2
View File
@@ -5,8 +5,8 @@ import os
import kazimir import kazimir
import settings import settings
from db import collection from db import collection
from sync import create_date_and_title_from_folder_name, create_post_from_image_list, create_date, \ from markdown import markdown
create_post from sync import create_date_and_title_from_folder_name, create_date, create_post
from sync.data import list_images from sync.data import list_images
from sync.models import Model from sync.models import Model
from sync.models.Image import Image from sync.models.Image import Image
@@ -172,3 +172,12 @@ def read_manifest(provider, path):
return { return {
**manifest, **manifest,
} }
def create_post_from_image_list(images):
return markdown(
'\n'.join(map(
lambda i: '![]({img})'.format(img=i),
images
))
)