Ejemplo n.º 1
0
def nonnegative_int_list(argument):
    """
    Converts a space- or comma-separated list of values into a Python list
    of integers.

    (Directive option conversion function.)

    Raises ValueError for values that aren't non-negative integers.
    """
    if ',' in argument:
        entries = argument.split(',')
    else:
        entries = argument.split()
    return [directives.nonnegative_int(entry) for entry in entries]
Ejemplo n.º 2
0
def nonnegative_int_list(argument):
    """
    Converts a space- or comma-separated list of values into a Python list
    of integers.

    (Directive option conversion function.)

    Raises ValueError for values that aren't non-negative integers.
    """
    if ',' in argument:
        entries = argument.split(',')
    else:
        entries = argument.split()
    return [directives.nonnegative_int(entry) for entry in entries]
Ejemplo n.º 3
0
 def run(self):
     id = directives.nonnegative_int(self.arguments.pop(0))
     log.debug(self.arguments)
     return [
         nodes.raw(
             '', 
             self.html.format(
                 path=self.widget_path,
                 id=id,
                 type=self.type,
                 autoplay=('autoplay&' if 'autoplay' in self.arguments else '')
             ), 
             format='html'
         )
     ]
Ejemplo n.º 4
0
def nonnegative_int_list(argument):
    if ',' in argument:
        entries = argument.split(',')
    else:
        entries = argument.split()
    return [directives.nonnegative_int(entry) for entry in entries]
Ejemplo n.º 5
0
def figwidth_value(argument):
    if argument.lower() == 'image':
        return 'image'
    else:
        return directives.nonnegative_int(argument)
Ejemplo n.º 6
0
def figwidth_value(argument):
    if argument.lower() == 'image':
        return 'image'
    else:
        return directives.nonnegative_int(argument)
Ejemplo n.º 7
0
def figwidth_value(argument):
    if argument.lower() == "image":
        return "image"
    else:
        return directives.nonnegative_int(argument)
Ejemplo n.º 8
0
def nonnegative_int_or_all(argument):
    if argument == 'all':
        return
    return nonnegative_int(argument)