Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
docs.it4i.cz
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
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
SCS
docs.it4i.cz
Merge requests
!65
Capitalize
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Capitalize
capitalize
into
master
Overview
0
Commits
2
Pipelines
1
Changes
3
Merged
David Hrbáč
requested to merge
capitalize
into
master
8 years ago
Overview
0
Commits
2
Pipelines
1
Changes
3
Expand
Fixes #31
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
b2c7e45f
2 commits,
8 years ago
3 files
+
113
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
scripts/titlemd.py
0 → 100755
+
48
−
0
Options
#!/usr/bin/python
import
fnmatch
import
os
import
sys
try
:
from
titlecase
import
titlecase
except
ImportError
:
print
(
"
Please install titlecase
"
)
def
main
(
location
):
# Spelling exceptions
with
open
(
'
.spelling
'
)
as
f
:
spelling
=
f
.
readlines
()
def
abbreviations
(
word
,
**
kwargs
):
if
word
+
"
\n
"
in
spelling
:
return
word
# Open the file and read the lines as a list
with
open
(
location
)
as
f
:
lines
=
f
.
readlines
()
with
open
(
location
,
'
w
'
)
as
f
:
# Loop through the list of lines and titlecase
# any line beginning with '#'.
prev_line
=
lines
.
pop
(
0
)
disabled
=
0
for
line
in
lines
:
if
line
.
startswith
(
"
``
"
)
and
disabled
==
0
:
disabled
=
1
else
:
if
line
.
startswith
(
"
``
"
)
and
disabled
==
1
:
disabled
=
0
if
line
.
startswith
(
'
#
'
)
and
disabled
==
0
:
line
=
titlecase
(
line
[:(
line
.
find
(
"
]
"
))],
callback
=
abbreviations
)
+
line
[(
line
.
find
(
"
]
"
)):]
if
line
.
startswith
(
'
---
'
)
or
line
.
startswith
(
'
===
'
):
prev_line
=
titlecase
(
prev_line
[:(
prev_line
.
find
(
"
]
"
))],
callback
=
abbreviations
)
+
prev_line
[(
prev_line
.
find
(
"
]
"
)):]
f
.
write
(
prev_line
)
prev_line
=
line
f
.
write
(
prev_line
)
if
__name__
==
"
__main__
"
:
try
:
main
(
sys
.
argv
[
1
])
except
IndexError
:
main
(
'
.
'
)
Loading