Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
thesis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
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
Jasper Gräflich
thesis
Commits
f3904936
Commit
f3904936
authored
2 years ago
by
Jasper Clemens Gräflich
Browse files
Options
Downloads
Patches
Plain Diff
Format journal_entry.py
parent
9a95cc5c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
journal_entry.py
+16
-20
16 additions, 20 deletions
journal_entry.py
with
16 additions
and
20 deletions
journal_entry.py
+
16
−
20
View file @
f3904936
...
...
@@ -30,8 +30,7 @@ def main():
os
.
system
(
"
git pull
"
)
update
(
new_date
)
os
.
system
(
"
git add .
"
)
os
.
system
(
f
"
git commit -m
'
Create journal entry for
{
new_date
}
'"
)
os
.
system
(
f
"
git commit -m
'
Create journal entry for
{
new_date
}
'"
)
os
.
system
(
"
git push
"
)
...
...
@@ -42,11 +41,7 @@ def update(new_date):
previous
=
glob
.
glob
(
"
./journal/2*
"
)[
-
1
]
with
open
(
previous
,
"
r
"
)
as
file
:
lines
=
file
.
readlines
()
lines
[
2
]
=
re
.
sub
(
r
'
next
'
,
r
'
[next](
'
+
f
'
journal/
{
new_date
}
'
+
'
)
'
,
lines
[
2
]
)
lines
[
2
]
=
re
.
sub
(
r
"
next
"
,
r
"
[next](
"
+
f
"
journal/
{
new_date
}
"
+
"
)
"
,
lines
[
2
])
# Modify previous entry
with
open
(
previous
,
"
w
"
)
as
file
:
...
...
@@ -57,11 +52,9 @@ def update(new_date):
# Extract upcoming and long-term tasks from previous
upcoming
=
lines
.
index
(
"
## Upcoming Tasks
\n
"
)
long_term
=
lines
.
index
(
"
## Long-term Tasks
\n
"
)
create_entry
(
previous
,
lines
[
upcoming
+
1
:
long_term
-
1
],
lines
[
long_term
+
1
:],
new_date
)
create_entry
(
previous
,
lines
[
upcoming
+
1
:
long_term
-
1
],
lines
[
long_term
+
1
:],
new_date
)
# Modify MoC
with
open
(
"
./journal/map-of-contents.md
"
,
"
a
"
)
as
moc
:
...
...
@@ -71,8 +64,10 @@ def update(new_date):
# Modify sidebar
os
.
system
(
"
head -n -1 ./_sidebar.md > temp.md; mv temp.md ./_sidebar.md
"
)
with
open
(
"
./_sidebar.md
"
,
"
a
"
)
as
file
:
file
.
write
(
"
[View all pages](https://gitlab1.ptb.de/graefl01/thesis/-/wikis/pages)
"
f
"
– [Journal](journal/
{
new_date
}
)
\n
"
)
file
.
write
(
"
[View all pages](https://gitlab1.ptb.de/graefl01/thesis/-/wikis/pages)
"
f
"
– [Journal](journal/
{
new_date
}
)
\n
"
)
print
(
"
[INFO] Updated sidebar
"
)
...
...
@@ -81,19 +76,20 @@ def create_entry(previous, prev_tasks, long_term, day):
week
=
day
.
strftime
(
"
%W
"
)
print
(
previous
)
lines
=
[
f
"
#
{
day
}
Journal
\n\n
"
,
f
"
[previous](
{
previous
[
2
:
-
3
]
}
) –
{
weekday
}
, week
{
week
}
– next
\n\n
"
,
"
## Tasks
\n
"
,
]
lines
=
[
f
"
#
{
day
}
Journal
\n\n
"
,
f
"
[previous](
{
previous
[
2
:
-
3
]
}
) –
{
weekday
}
, week
{
week
}
– next
\n\n
"
,
"
## Tasks
\n
"
,
]
lines
.
extend
(
prev_tasks
)
lines
.
extend
((
"
\n
"
,
"
## Upcoming Tasks
\n\n
"
,
"
- [ ]
\n\n
"
))
lines
.
append
(
"
## Long-term Tasks
\n
"
)
lines
.
extend
(
long_term
)
with
open
(
f
"
./journal/
{
day
}
.md
"
,
'
w
'
)
as
file
:
with
open
(
f
"
./journal/
{
day
}
.md
"
,
"
w
"
)
as
file
:
file
.
writelines
(
lines
)
print
(
f
"
[INFO] Created entry:
{
day
}
"
)
if
__name__
==
'
__main__
'
:
if
__name__
==
"
__main__
"
:
main
()
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