错误没有内容" rubric"指令允许

时间:2015-06-11 13:17:23

标签: python-sphinx restructuredtext

我试图添加的文件包含许多规则,但我发现了一个奇怪的错误。我必须做一些愚蠢的事情,但我似乎无法弄明白。这是我的文件:

==========================
Coding Conventions
==========================

Below is list of coding conventions agreed upon by ________. Please adhere to these conventions to create a more readable codebase!

.. rubric:: Variables

  Variables should be in the ``camelCase`` format in all cases.::

    var = 3
    anotherVar = 4
    moreWordsThanPreviousVar = 5

.. rubric:: Functions

  The same format as Variables, ``camelCase`` should be used.::

    def func():
        #...

    def adheresToCodingConventionFunc():
        #...

.. rubric:: Classes

  Uppercase ``CamelCase`` should be used to repesent classes.::

    class Shape(object):
        #...
    class SquareObject(Shape):
        #...

.. rubric:: Tabs

  Currently CALIPSO uses tabs instead of spaces.::

    var = [1,2,3,4,5]
    for v in var:
        print v        # tab should be 4 spaces long

.. rubric:: General Rules

  No spaces should be left between conditional statements and loops code blocks.::

    if x is not y:
        # ...

    for x in y:
        # ...

  Comments should be right justified when applicable, and only above lines when necessary to explain a section of code(not just one line).::

    var = x - y + r*2           # calculate ___ and place in var
    doFunc(var)                 # do some func with var param
    if var[-1] is not var[:3]:      
        err()                   # error is var does not match criteria

1 个答案:

答案 0 :(得分:3)

原来我不小心将我的段落缩进到量规下面,这是最后的文件:

==========================
Coding Conventions
==========================

Below is list of coding conventions agreed upon by ______. Please adhere to these conventions to create a more readable codebase.

.. rubric:: Variables

Variables should be in the ``camelCase`` format in all cases.::

    var = 3
    anotherVar = 4
    moreWordsThanPreviousVar = 5

.. rubric:: Functions

The same format as Variables, ``camelCase`` should be used.::

    def func():

    def adheresToCodingConventionFunc():

.. rubric:: Classes

Uppercase ``CamelCase`` should be used to repesent classes.::

    class Shape(object):

    class SquareObject(Shape):

.. rubric:: Tabs

Currently CALIPSO uses tabs instead of spaces.::

    var = [1,2,3,4,5]
    for v in var:
        print v        # tab should be 4 spaces long

.. rubric:: General Rules

No spaces should be left between conditional statements and loops code blocks.::

    if x is not y:
        # ...

    for x in y:
        # ...

Comments should be right justified when applicable, and only above lines when necessary to explain a section of code(not just one line).::

    var = x - y + r*2           # calculate ___ and place in var
    doFunc(var)                 # do some func with var param
    if var[-1] is not var[:3]:      
        err()                   # error is var does not match criteria

    # Set the value of var and pass var into a set of functions which calculate things based off var
    var = x - y + r*2
    doAllFuncs(var)