gpt4 book ai didi

python-sphinx - 错误 "rubric"指令中没有内容被允许

转载 作者:行者123 更新时间:2023-12-03 16:06:51 32 4
gpt4 key购买 nike

我尝试添加的文件包含许多评分细则,但我收到了一个奇怪的错误。我一定在做一些愚蠢的事情,但我似乎无法弄清楚。这是我的文档:

==========================
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

最佳答案

原来我不小心在标题下方缩进了我的段落,这是最终文档:

==========================
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)

关于python-sphinx - 错误 "rubric"指令中没有内容被允许,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30781932/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com