sphinx-contrib / sphinxcontrib-versioning

Sphinx extension that allows building versioned docs for self-hosting.
https://sphinxcontrib-versioning.readthedocs.io/en/latest/
MIT License
123 stars 81 forks source link

html_last_updated_fmt in conf.py causes build failure #48

Open pgray-argo opened 6 years ago

pgray-argo commented 6 years ago

When using sphinx-versioning with html_last_updated_fmt = '' in my conf.py file, the following crash occurs. It appears that sphinx-versioning is attempting to call the format_date function with an extra argument. This could be related to #39.

# Sphinx version: 1.6.5
# Python version: 3.6.3 (CPython)
# Docutils version: 0.14 
# Jinja2 version: 2.9.6
# Last messages:
#   checking consistency...
#   
#   done
#   
#   preparing documents...
#   
#   done
#   
#   writing output... [ 20%] index
#   
# Loaded extensions:
#   alabaster (0.7.10) from /usr/local/lib/python3.6/site-packages/alabaster/__init__.py
#   sphinx.ext.todo (1.6.5) from /usr/local/lib/python3.6/site-packages/sphinx/ext/todo.py
#   sphinx.ext.githubpages (1.6.5) from /usr/local/lib/python3.6/site-packages/sphinx/ext/githubpages.py
#   sphinxcontrib.versioning.sphinx_ (2.2.1) from /usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sphinxcontrib/versioning/sphinx_.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/sphinx/cmdline.py", line 306, in main
    app.build(opts.force_all, filenames)
  File "/usr/local/lib/python3.6/site-packages/sphinx/application.py", line 339, in build
    self.builder.build_update()
  File "/usr/local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 331, in build_update
    'out of date' % len(to_build))
  File "/usr/local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 397, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 434, in write
    self._write_serial(sorted(docnames))
  File "/usr/local/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 443, in _write_serial
    self.write_doc(docname, doctree)
  File "/usr/local/lib/python3.6/site-packages/sphinx/builders/html.py", line 561, in write_doc
    self.handle_page(docname, ctx, event_arg=doctree)
  File "/usr/local/lib/python3.6/site-packages/sphinx/builders/html.py", line 949, in handle_page
    templatename, ctx, event_arg)
  File "/usr/local/lib/python3.6/site-packages/sphinx/application.py", line 493, in emit_firstresult
    return self.events.emit_firstresult(event, self, *args)
  File "/usr/local/lib/python3.6/site-packages/sphinx/events.py", line 84, in emit_firstresult
    for result in self.emit(name, *args):
  File "/usr/local/lib/python3.6/site-packages/sphinx/events.py", line 79, in emit
    results.append(callback(*args))
  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sphinxcontrib/versioning/sphinx_.py", line 134, in html_page_context
    context['last_updated'] = format_date(lufmt, mtime, language=app.config.language, warn=app.warn)
TypeError: format_date() got an unexpected keyword argument 'warn'
paddy-hack commented 4 years ago

This is a very different issue (but probably introduced by the same Sphinx version :wink:). There's a fix for this in #51.