Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
reduce the number of warnings while generating the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed May 27, 2014
1 parent 0de65ac commit a498618
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/pyquickhelper/helpgen/sphinx_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def generate_help_sphinx ( project_var_name,
root = ".",
filter_commit = lambda c : c.strip() != "documentation",
extra_ext = [],
nbformats = ["html", "python", "rst", "pdf"],
nbformats = ["ipynb", "html", "python", "rst", "pdf"],
layout = ["html"]) :
"""
runs the help generation
Expand Down Expand Up @@ -385,7 +385,7 @@ def process_notebooks( notebooks,
dto = os.stat(outputfile).st_mtime
dtnb = os.stat(notebook).st_mtime
if dtnb < dto :
fLOG("-- skipping notebook", format, notebook)
fLOG("-- skipping notebook", format, notebook, "(", outputfile, ")")
files.append ( outputfile )
continue

Expand Down Expand Up @@ -601,9 +601,19 @@ def add_link_to_notebook(file, nb, pdf, html, python):
len(lines[i-1][:4] != " " and \
lines[i+1].strip(" \n\r"))>0 :
rem.append(i)
if len(lines[i]) > 0 and lines[i] != " " and lines[i-1].startswith(" ") :
lines[i] = "\n" + lines[i]
rem.reverse()
for i in rem:
del lines[i]

# remove last ::
for i in range(len(lines)-1,0,-1) :
s = lines[i-1].strip(" \n\r")
if len(s) != 0 and s != "::" : break

if i < len(lines):
del lines[i:]

with open(file, "w", encoding="utf8") as f :
f.write("".join(lines))
Expand Down
11 changes: 9 additions & 2 deletions src/pyquickhelper/helpgen/utils_sphinx_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,8 @@ def apply_modification_template ( store_obj,
#text_specials = "".join([" :special-members: %s\n" % k for k in tspecials ])
text_specials = ""

rep = { "__FULLNAME_UNDERLINED__": fullname + "\n" + ("=" * len(fullname)) +"\n",
ttitle = "module ``{0}``".format(fullname)
rep = { "__FULLNAME_UNDERLINED__": ttitle + "\n" + ("=" * len(ttitle)) +"\n",
"__FILENAMENOEXT__":filenoext,
"__FULLNAMENOEXT__":fullnamenoext,
"__DOCUMENTATION__":doc,
Expand All @@ -371,11 +372,17 @@ def apply_modification_template ( store_obj,

for k,v in additional.items() :
rep [k] = v

res = template
for a,b in rep.items () :
res = res.replace(a,b)

has_class = "class " in content
if not has_class :
spl = res.split("\n")
spl = [ _ for _ in spl if not _.startswith(".. inheritance-diagram::") ]
res = "\n".join(spl)

if softfile(fullname) :
res = res.replace (":special-members:", "")

Expand Down
2 changes: 1 addition & 1 deletion src/pyquickhelper/loghelper/flog.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def init (path = None, filename = None, create = True, path_add = []) :

def GetSepLine () :
"""
return always \\n
return always ``\\n``
"""
return "\n" # previous value: sys.hal_log_values ["__log_file_sep"]

Expand Down

0 comments on commit a498618

Please sign in to comment.