Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-advanced-user-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
caosdb
Software
caosdb-advanced-user-tools
Commits
d150cee5
Commit
d150cee5
authored
5 years ago
by
Henrik tom Wörden
Browse files
Options
Downloads
Patches
Plain Diff
STY: ws
parent
074d8a1b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/caosadvancedtools/pandoc_header_tools.py
+5
-3
5 additions, 3 deletions
src/caosadvancedtools/pandoc_header_tools.py
src/caosadvancedtools/read_md_header.py
+1
-0
1 addition, 0 deletions
src/caosadvancedtools/read_md_header.py
with
6 additions
and
3 deletions
src/caosadvancedtools/pandoc_header_tools.py
+
5
−
3
View file @
d150cee5
...
@@ -45,6 +45,7 @@ class NoValidHeader(Exception):
...
@@ -45,6 +45,7 @@ class NoValidHeader(Exception):
"
using -f option
"
.
format
(
filename
))
"
using -f option
"
.
format
(
filename
))
super
().
__init__
(
msg
,
*
args
,
**
kwargs
)
super
().
__init__
(
msg
,
*
args
,
**
kwargs
)
class
MetadataFileMissing
(
Exception
):
class
MetadataFileMissing
(
Exception
):
def
__init__
(
self
,
filename
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
filename
,
*
args
,
**
kwargs
):
...
@@ -52,6 +53,7 @@ class MetadataFileMissing(Exception):
...
@@ -52,6 +53,7 @@ class MetadataFileMissing(Exception):
msg
=
"
Metadata file README.md missing in
"
+
filename
msg
=
"
Metadata file README.md missing in
"
+
filename
super
().
__init__
(
msg
,
*
args
,
**
kwargs
)
super
().
__init__
(
msg
,
*
args
,
**
kwargs
)
class
ParseErrorsInHeader
(
Exception
):
class
ParseErrorsInHeader
(
Exception
):
def
__init__
(
self
,
filename
,
reason
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
filename
,
reason
,
*
args
,
**
kwargs
):
self
.
filename
=
filename
self
.
filename
=
filename
...
@@ -59,6 +61,7 @@ class ParseErrorsInHeader(Exception):
...
@@ -59,6 +61,7 @@ class ParseErrorsInHeader(Exception):
msg
=
"
Invalid header in {}. Reason: {}
"
.
format
(
filename
,
reason
)
msg
=
"
Invalid header in {}. Reason: {}
"
.
format
(
filename
,
reason
)
super
().
__init__
(
msg
,
*
args
,
**
kwargs
)
super
().
__init__
(
msg
,
*
args
,
**
kwargs
)
TEMPLATEHEADER
=
"""
TEMPLATEHEADER
=
"""
---
---
responsible:
responsible:
...
@@ -185,7 +188,6 @@ def save_header(filename, header_data):
...
@@ -185,7 +188,6 @@ def save_header(filename, header_data):
f
.
writelines
(
textlines
)
f
.
writelines
(
textlines
)
def
add_header
(
filename
,
header_dict
=
None
):
def
add_header
(
filename
,
header_dict
=
None
):
"""
"""
Add a header to an md file.
Add a header to an md file.
...
@@ -195,10 +197,10 @@ def add_header(filename, header_dict=None):
...
@@ -195,10 +197,10 @@ def add_header(filename, header_dict=None):
If header_dict is a dictionary and not None the header
If header_dict is a dictionary and not None the header
will be created based on the keys and values of that dictionary.
will be created based on the keys and values of that dictionary.
"""
"""
if
os
.
path
.
isdir
(
filename
):
if
os
.
path
.
isdir
(
filename
):
filename
=
os
.
path
.
join
(
filename
,
"
README.md
"
)
filename
=
os
.
path
.
join
(
filename
,
"
README.md
"
)
if
os
.
path
.
exists
(
filename
):
if
os
.
path
.
exists
(
filename
):
with
open
(
filename
)
as
f
:
with
open
(
filename
)
as
f
:
textlines
=
f
.
readlines
()
textlines
=
f
.
readlines
()
...
...
This diff is collapsed.
Click to expand it.
src/caosadvancedtools/read_md_header.py
+
1
−
0
View file @
d150cee5
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
from
.
import
pandoc_header_tools
from
.
import
pandoc_header_tools
def
get_header
(
fn
):
def
get_header
(
fn
):
return
pandoc_header_tools
.
get_header
(
fn
)[
2
]
return
pandoc_header_tools
.
get_header
(
fn
)[
2
]
...
...
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