Exemple #1
0
    def run(self):
        env = self.state.document.settings.env
        substitutions = env.config.aplusmeta_substitutions

        # Substitute values of options if a corresponding string is found in
        # the configuration variable aplusmeta_substitutions (set in conf.py).
        # Example:
        #     self.options['open-time'] == 'open01'
        #     aplusmeta_substitutions['open01'] == '2020-01-03 12:00'
        #     # Result
        #     modified_options['open-time'] = '2020-01-03 12:00'
        #
        # See the section "5. Meta (exercise round settings)" in README.md.
        for opt, value in self.options.items():
            old_value = None
            if value in substitutions:
                old_value = value
                self.options[opt] = substitutions[value]
            if opt in AplusMeta.date_format_required:
                self.validate_time(opt, self.options[opt], old_value)
            if opt in AplusMeta.reveal_rules:
                source, line = self.state_machine.get_source_and_line(
                    self.lineno)
                self.options[opt] = parse_reveal_rule(value, source, line, opt)

        return [aplusmeta(options=self.options)]
 def run(self):
     return [aplusmeta(options=self.options)]