# Path: linux_story/common.py
# def get_story_file(name):
#     return os.path.join(fallback_story_files_dir, name)
# 
# Path: linux_story/step_helper_functions.py
# def unblock_cd_commands(line):
#     if line.startswith("mkdir") or \
#             (line.startswith("mv") and not line.strip() == 'mv --help'):
#         print _('Nice try! But you do not need that command for this challenge')
#         return True
#     return False
# 
# Path: linux_story/helper_functions.py
# def wrap_in_box(lines):
#     """Wrap lines in an ascii box"""
# 
#     def reduction(memo, line):
#         line_length = len(strip_formatting(line))
#         return memo if line_length < memo else line_length
# 
#     def format_line(line):
#         num_padding = max_characters - len(strip_formatting(line))
#         return "| {} |".format(line + (" " * num_padding))
# 
#     max_characters = reduce(reduction, lines, 0)
#     outer_line = " {} ".format("-" * (max_characters + 2))
# 
#     new_lines = map(format_line, lines)
# 
#     return [outer_line] + new_lines + [outer_line + "\n"]
# 
# Path: linux_story/story/challenges/CompanionMisc.py
# class StepTemplateMkdir(StepTemplateEleanorBernard):
#     TerminalClass = TerminalMkdirBernard
# 
# class StepTemplateNano(StepTemplateEleanorBernard):
#     TerminalClass = TerminalNanoBernard


from linux_story.common import get_story_file
from linux_story.step_helper_functions import unblock_cd_commands
from linux_story.helper_functions import wrap_in_box
from linux_story.story.challenges.CompanionMisc import StepTemplateMkdir, StepTemplateNano
    def next(self):
        return 27, 5


class Step5(StepTemplateNano):
    print_text = [
        _("{{yb:\"What's the next big tool you want to create?\"}}")
    ]

    story = [
        _("Bernard: {{Bb:\"I want to know how the}} {{bb:private-section}} {{Bb:is locked " +\
        "in the}} {{bb:library}}{{Bb:, and then make a key to unlock it.\"}}"),

        _("\nEleanor: {{Bb:\"I guess the}} {{bb:librarian}} {{Bb:would have locked the private section.\"}}"),

        _("{{Bb:\"Maybe she can tell us how she did it? We should look for her.\"}}"),

        _("\n{{lb:Leave}} the {{bb:shed-shop}}.")
    ]

    hints = [
        _("{{rb:Use}} {{yb:cd ..}} {{rb:to go}} {{lb:back}} {{rb:to town.}}")
    ]
    start_dir = "~/town/east/shed-shop"
    end_dir = "~/town/east"
    companion_speech = \
        _("Eleanor: {{Bb:\"What do you think is hidden in the private-section?}}" +\
        "\n{{Bb:Maybe Bernard shouldn't see it...\"}}")

    def block_command(self, line):

# Path: linux_story/common.py
# def get_story_file(name):
#     return os.path.join(fallback_story_files_dir, name)
# 
# Path: linux_story/step_helper_functions.py
# def unblock_cd_commands(line):
#     if line.startswith("mkdir") or \
#             (line.startswith("mv") and not line.strip() == 'mv --help'):
#         print _('Nice try! But you do not need that command for this challenge')
#         return True
#     return False
# 
# Path: linux_story/helper_functions.py
# def wrap_in_box(lines):
#     """Wrap lines in an ascii box"""
# 
#     def reduction(memo, line):
#         line_length = len(strip_formatting(line))
#         return memo if line_length < memo else line_length
# 
#     def format_line(line):
#         num_padding = max_characters - len(strip_formatting(line))
#         return "| {} |".format(line + (" " * num_padding))
# 
#     max_characters = reduce(reduction, lines, 0)
#     outer_line = " {} ".format("-" * (max_characters + 2))
# 
#     new_lines = map(format_line, lines)
# 
#     return [outer_line] + new_lines + [outer_line + "\n"]
# 
# Path: linux_story/story/challenges/CompanionMisc.py
# class StepTemplateMkdir(StepTemplateEleanorBernard):
#     TerminalClass = TerminalMkdirBernard
# 
# class StepTemplateNano(StepTemplateEleanorBernard):
#     TerminalClass = TerminalNanoBernard


# Path: linux_story/story/challenges/challenge_27.py
from linux_story.common import get_story_file
from linux_story.step_helper_functions import unblock_cd_commands
from linux_story.helper_functions import wrap_in_box
from linux_story.story.challenges.CompanionMisc import StepTemplateMkdir, StepTemplateNano

    def next(self):
        return 27, 5


class Step5(StepTemplateNano):
    print_text = [
        _("{{yb:\"What's the next big tool you want to create?\"}}")
    ]

    story = [
        _("Bernard: {{Bb:\"I want to know how the}} {{bb:private-section}} {{Bb:is locked " +\
        "in the}} {{bb:library}}{{Bb:, and then make a key to unlock it.\"}}"),

        _("\nEleanor: {{Bb:\"I guess the}} {{bb:librarian}} {{Bb:would have locked the private section.\"}}"),

        _("{{Bb:\"Maybe she can tell us how she did it? We should look for her.\"}}"),

        _("\n{{lb:Leave}} the {{bb:shed-shop}}.")
    ]

    hints = [
        _("{{rb:Use}} {{yb:cd ..}} {{rb:to go}} {{lb:back}} {{rb:to town.}}")
    ]
    start_dir = "~/town/east/shed-shop"
    end_dir = "~/town/east"
    companion_speech = \
        _("Eleanor: {{Bb:\"What do you think is hidden in the private-section?}}" +\
        "\n{{Bb:Maybe Bernard shouldn't see it...\"}}")

    def block_command(self, line):

        return unblock_cd_commands(line)