Exemplo n.º 1
0
 def list_lines(self, start, end, lines=None, ansi256=False,
                style='monokai'):
     lines = lines or self.lines
     code = '\n'.join(lines)
     highlighted_code = lua.highlight_code(code, ansi256=ansi256)
     highlighted_lines = highlighted_code.splitlines()
     return super(ScriptEditorSession, self).list_lines(start, end,
                                                        highlighted_lines)
Exemplo n.º 2
0
 def list_lines(self,
                start,
                end,
                lines=None,
                ansi256=False,
                style='monokai'):
     lines = lines or self.lines
     code = '\n'.join(lines)
     highlighted_code = lua.highlight_code(code, ansi256=ansi256)
     highlighted_lines = highlighted_code.splitlines()
     return super(ScriptEditorSession,
                  self).list_lines(start, end, highlighted_lines)
Exemplo n.º 3
0
 def run(self, actor, obj, name):
     """
     :type actor: mudslingcore.objects.Player
     :type obj: ScriptableObject
     :type name: str
     """
     try:
         command = obj.get_scripted_command(name)
     except s.CommandNotFound as e:
         raise self._err(e.message)
     code = lua.highlight_code(command.code, ansi256=actor.xterm256,
                               linenos=True)
     names = '/'.join(command.aliases)
     msg = '{c%s{n:{g%s {y%s' % (actor.name_for(obj), names, command.syntax)
     msg += '\n%s{b\n(end)' % code
     actor.msg(msg)
Exemplo n.º 4
0
 def run(self, actor, obj, name):
     """
     :type actor: mudslingcore.objects.Player
     :type obj: ScriptableObject
     :type name: str
     """
     try:
         command = obj.get_scripted_command(name)
     except s.CommandNotFound as e:
         raise self._err(e.message)
     code = lua.highlight_code(command.code,
                               ansi256=actor.xterm256,
                               linenos=True)
     names = '/'.join(command.aliases)
     msg = '{c%s{n:{g%s {y%s' % (actor.name_for(obj), names, command.syntax)
     msg += '\n%s{b\n(end)' % code
     actor.msg(msg)