Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lesson Template
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
prace-lessons
Lesson Template
Commits
b501b7ca
Commit
b501b7ca
authored
8 years ago
by
Greg Wilson
Browse files
Options
Downloads
Patches
Plain Diff
Laying groundwork for checking workshops
parent
c6688836
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/validator
+16
-3
16 additions, 3 deletions
bin/validator
with
16 additions
and
3 deletions
bin/validator
+
16
−
3
View file @
b501b7ca
...
@@ -15,8 +15,8 @@ from bs4 import BeautifulSoup
...
@@ -15,8 +15,8 @@ from bs4 import BeautifulSoup
from
lxml
import
etree
from
lxml
import
etree
# Default configuration.
# Default
lesson
configuration.
DEFAULT
_CONFIG
=
'''
\
LESSON
_CONFIG
=
'''
\
patterns:
patterns:
'
*.html
'
:
'
*.html
'
:
- has_title_in_head
- has_title_in_head
...
@@ -66,6 +66,11 @@ def parse_args():
...
@@ -66,6 +66,11 @@ def parse_args():
default
=
None
,
default
=
None
,
dest
=
'
config_file
'
,
dest
=
'
config_file
'
,
help
=
'
configuration file
'
)
help
=
'
configuration file
'
)
parser
.
add_option
(
'
-l
'
,
'
--lesson
'
,
default
=
False
,
action
=
'
store_true
'
,
dest
=
'
check_lesson
'
,
help
=
'
check a lesson
'
)
parser
.
add_option
(
'
-s
'
,
'
--source
'
,
parser
.
add_option
(
'
-s
'
,
'
--source
'
,
default
=
'
_site
'
,
default
=
'
_site
'
,
dest
=
'
source_dir
'
,
dest
=
'
source_dir
'
,
...
@@ -75,10 +80,16 @@ def parse_args():
...
@@ -75,10 +80,16 @@ def parse_args():
action
=
'
count
'
,
action
=
'
count
'
,
dest
=
'
verbose
'
,
dest
=
'
verbose
'
,
help
=
'
report actions
'
)
help
=
'
report actions
'
)
parser
.
add_option
(
'
-w
'
,
'
--workshop
'
,
default
=
False
,
action
=
'
store_true
'
,
dest
=
'
check_workshop
'
,
help
=
'
check a workshop
'
)
args
,
extras
=
parser
.
parse_args
()
args
,
extras
=
parser
.
parse_args
()
_require
(
not
extras
,
'
Unexpected trailing command-line arguments
"
{0}
"'
.
format
(
extras
))
_require
(
not
extras
,
'
Unexpected trailing command-line arguments
"
{0}
"'
.
format
(
extras
))
_require
(
args
.
check_lesson
!=
args
.
check_workshop
,
'
Must have exactly one of -l/-w
'
)
return
args
return
args
...
@@ -91,8 +102,10 @@ def read_config(args):
...
@@ -91,8 +102,10 @@ def read_config(args):
if
args
.
config_file
:
if
args
.
config_file
:
with
open
(
args
.
config_file
,
'
r
'
)
as
reader
:
with
open
(
args
.
config_file
,
'
r
'
)
as
reader
:
args
.
config
=
yaml
.
load
(
reader
)
args
.
config
=
yaml
.
load
(
reader
)
elif
args
.
check_lesson
:
args
.
config
=
yaml
.
load
(
LESSON_CONFIG
)
else
:
else
:
a
rgs
.
config
=
yaml
.
load
(
DEFAULT_CONFIG
)
a
ssert
False
,
'
Do not know what configuration to load
'
args
.
patterns
=
args
.
config
[
'
patterns
'
]
args
.
patterns
=
args
.
config
[
'
patterns
'
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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