Add --name-seo-delimiter option
parent
bef3d1b7b7
commit
3d7509e639
|
@ -93,6 +93,16 @@ def main():
|
||||||
"./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",
|
||||||
default = 0,
|
default = 0,
|
||||||
|
@ -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