示例#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]
示例#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]
示例#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'
         )
     ]
示例#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]
示例#5
0
def figwidth_value(argument):
    if argument.lower() == 'image':
        return 'image'
    else:
        return directives.nonnegative_int(argument)
示例#6
0
def figwidth_value(argument):
    if argument.lower() == 'image':
        return 'image'
    else:
        return directives.nonnegative_int(argument)
示例#7
0
文件: images.py 项目: yushiming/CS
def figwidth_value(argument):
    if argument.lower() == "image":
        return "image"
    else:
        return directives.nonnegative_int(argument)
def nonnegative_int_or_all(argument):
    if argument == 'all':
        return
    return nonnegative_int(argument)