Add --name-seo-delimiter option
parent
bef3d1b7b7
commit
3d7509e639
|
@ -84,14 +84,24 @@ def main():
|
||||||
default = None,
|
default = None,
|
||||||
help = "The lkrz file in which the results are stored ; if it " \
|
help = "The lkrz file in which the results are stored ; if it " \
|
||||||
"does not exist, one will be created from the smashgg data",
|
"does not exist, one will be created from the smashgg data",
|
||||||
)
|
)
|
||||||
|
|
||||||
top8_parser.add_argument(
|
top8_parser.add_argument(
|
||||||
"--outfile", "-o",
|
"--outfile", "-o",
|
||||||
default = None,
|
default = None,
|
||||||
help = "The SVG local result file to output to ; defaults to " \
|
help = "The SVG local result file to output to ; defaults to " \
|
||||||
"./tournament-slug.svg",
|
"./tournament-slug.svg",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
top8_parser.add_argument(
|
||||||
|
"--name-seo-delimiter",
|
||||||
|
default = None,
|
||||||
|
help = "A character that will delimit in a tournament name what " \
|
||||||
|
"really is its name, and what's actually here for SEO " \
|
||||||
|
"purposes (example: in 'Cornismash #42 - Ultimate Weekly " \
|
||||||
|
"Lyon', only the 'Cornismash #42' is the tournament name, "\
|
||||||
|
"the rest is here to help find the tournament).",
|
||||||
|
)
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
parser.add_argument( "--verbose", "-v",
|
parser.add_argument( "--verbose", "-v",
|
||||||
|
@ -237,7 +247,7 @@ def main():
|
||||||
|
|
||||||
# Build the context which will be passed to the template
|
# Build the context which will be passed to the template
|
||||||
context = {
|
context = {
|
||||||
"tournament": tournament,
|
"tournament": tournament.clean_name(args.name_seo_delimiter),
|
||||||
"players" : sorted(
|
"players" : sorted(
|
||||||
top_players.values(),
|
top_players.values(),
|
||||||
key = lambda p: p.placement,
|
key = lambda p: p.placement,
|
||||||
|
|
|
@ -150,6 +150,14 @@ numEntrants: {nbe}""" \
|
||||||
nbe = self.numEntrants,
|
nbe = self.numEntrants,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# -------------------------------------------------------------------------
|
||||||
|
def clean_name(self, name_seo_delimiter):
|
||||||
|
|
||||||
|
if name_seo_delimiter is not None:
|
||||||
|
self.name = self.name.split(name_seo_delimiter)[0].strip()
|
||||||
|
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
def run_query(
|
def run_query(
|
||||||
|
|
Loading…
Reference in New Issue