diff --git a/lokrez/__init__.py b/lokrez/__init__.py index 23346b2..a9555d5 100644 --- a/lokrez/__init__.py +++ b/lokrez/__init__.py @@ -84,14 +84,24 @@ def main(): default = None, help = "The lkrz file in which the results are stored ; if it " \ "does not exist, one will be created from the smashgg data", - ) + ) top8_parser.add_argument( "--outfile", "-o", default = None, help = "The SVG local result file to output to ; defaults to " \ "./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", @@ -237,7 +247,7 @@ def main(): # Build the context which will be passed to the template context = { - "tournament": tournament, + "tournament": tournament.clean_name(args.name_seo_delimiter), "players" : sorted( top_players.values(), key = lambda p: p.placement, diff --git a/lokrez/smashgg.py b/lokrez/smashgg.py index ad52c44..e7d71f6 100644 --- a/lokrez/smashgg.py +++ b/lokrez/smashgg.py @@ -150,6 +150,14 @@ numEntrants: {nbe}""" \ 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(