Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
7ba7586c
Commit
7ba7586c
authored
3 years ago
by
Ondrej Rehounek
Browse files
Options
Downloads
Patches
Plain Diff
Add article title
parent
cad76df6
Branches
Branches containing commit
No related tags found
2 merge requests
!450
Release
,
!449
Bugfix import praha 11
Pipeline
#7483
passed
3 years ago
Stage: build
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/jekyll_import.py
+13
-3
13 additions, 3 deletions
shared/jekyll_import.py
with
13 additions
and
3 deletions
shared/jekyll_import.py
+
13
−
3
View file @
7ba7586c
...
...
@@ -6,7 +6,7 @@ import string
import
urllib
import
xml.etree.ElementTree
as
ET
import
zipfile
from
datetime
import
date
from
datetime
import
date
,
datetime
from
http.client
import
InvalidURL
from
io
import
StringIO
from
typing
import
List
...
...
@@ -508,8 +508,15 @@ class JekyllArticleImporter:
"""
Projde adresář článků a pokusí se zprocesovat Markdown do article.
Vrací list dict pro django messages (klíč levelu, text).
Začne vyčištěním logu.
"""
logger
.
info
(
"
Import započat
"
)
self
.
article_parent_page
.
last_import_log
=
""
self
.
article_parent_page
.
save
()
msg
=
"
{} Import započat
"
.
format
(
datetime
.
now
())
logger
.
info
(
msg
)
self
.
page_log
+=
"
{}
\n\n
"
.
format
(
msg
)
for
file_name
in
os
.
listdir
(
os
.
path
.
join
(
self
.
path
,
POSTS_DIR
)):
# Případ podsložek (typicky po jednotlivých letech)
if
os
.
path
.
isdir
(
os
.
path
.
join
(
self
.
path
,
POSTS_DIR
,
file_name
)):
...
...
@@ -522,8 +529,11 @@ class JekyllArticleImporter:
file_path
=
os
.
path
.
join
(
POSTS_DIR
,
file_name
)
self
.
process_article
(
file_name
,
file_path
)
msg
=
"
{} Import ukončen
"
.
format
(
datetime
.
now
())
logger
.
info
(
msg
)
self
.
page_log
+=
"
{}
\n\n
"
.
format
(
msg
)
self
.
create_summary_log
()
logger
.
info
(
"
Import dokončen
"
)
def
process_article
(
self
,
file_name
:
str
,
file_path
:
str
):
match
=
re
.
match
(
r
"
(\d*)-(\d*)-(\d*)-(.*)\.(.*)
"
,
file_name
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment