New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mathjax broken: No MathJax URL specified #928

Closed
walchko opened this Issue Aug 22, 2017 · 9 comments

Comments

Projects
None yet
6 participants
@walchko
Copy link

walchko commented Aug 22, 2017

When I try to build my site, it crashes because of render_math. This use to work nicely.

kevin@Logan pelican $ make html
pelican /Users/kevin/github/pelican/content -o /Users/kevin/github/pelican/www -s /Users/kevin/github/pelican/pelicanconf.py -D
DEBUG: Pelican version: 3.7.1
DEBUG: Python version: 3.6.1
DEBUG: Adding current directory to system path
DEBUG: Temporarily adding PLUGIN_PATHS to system path
DEBUG: Loading plugin `render_math`
DEBUG: Registering plugin `render_math`
DEBUG: Loading plugin `code_include`
DEBUG: Registering plugin `code_include`
DEBUG: Loading plugin `sitemap`
DEBUG: Registering plugin `sitemap`
DEBUG: Restoring system path
DEBUG: Found generator: <class 'sitemap.sitemap.SitemapGenerator'>
DEBUG: Template list: ['!simple/archives.html', '!simple/article.html', '!simple/author.html', '!simple/authors.html', '!simple/base.html', '!simple/categories.html', '!simple/category.html', '!simple/gosquared.html', '!simple/index.html', '!simple/page.html', '!simple/pagination.html', '!simple/period_archives.html', '!simple/tag.html', '!simple/tags.html', '!simple/translations.html', '.DS_Store', '_includes/.DS_Store', '_includes/footer.html', '_includes/header.html', '_includes/pages.html', '_includes/pagination.html', '_includes/social.html', '_includes/tags.html', 'archives.html', 'article.html', 'author.html', 'authors.html', 'base.html', 'categories.html', 'category.html', 'gosquared.html', 'index.html', 'page.html', 'pagination.html', 'period_archives.html', 'tag.html', 'tags.html', 'translations.html']
DEBUG: Read file blog/arch_linux/arch.rst -> Article
DEBUG: Signal article_generator_preread.send(ArticlesGenerator)
DEBUG: Signal article_generator_context.send(ArticlesGenerator, <metadata>)
DEBUG: Read file blog/computers/benchmark.rst -> Article
DEBUG: Read file blog/computers/clamav.rst -> Article
DEBUG: Read file blog/computers/curl.rst -> Article
DEBUG: Read file blog/computers/ethernet.rst -> Article
DEBUG: Read file blog/computers/ffmpeg.rst -> Article
DEBUG: Read file blog/computers/git.rst -> Article
DEBUG: Read file blog/computers/python.rst -> Article
DEBUG: Read file blog/computers/ssh.rst -> Article
DEBUG: Read file blog/computers/swift.rst -> Article
DEBUG: Read file blog/computers/windows.rst -> Article
DEBUG: Read file blog/cyber/cyber.rst -> Article
DEBUG: Read file blog/cyber/dpkt.rst -> Article
DEBUG: Read file blog/cyber/ip_subnetting.rst -> Article
DEBUG: Read file blog/macOS/commandline.rst -> Article
DEBUG: Read file blog/macOS/homebrew.rst -> Article
DEBUG: Read file blog/macOS/keyboard_commands.rst -> Article
DEBUG: Read file blog/macOS/ls.rst -> Article
DEBUG: Read file blog/macOS/macOS.rst -> Article
DEBUG: Read file blog/macOS/macOS_boot_disk.rst -> Article
DEBUG: Read file blog/macOS/ps4-controller.rst -> Article
DEBUG: Read file blog/macOS/virtualbox.rst -> Article
DEBUG: Read file blog/misc/misc.rst -> Article
DEBUG: Read file blog/programming/atom.rst -> Article
DEBUG: Read file blog/programming/binaries.rst -> Article
DEBUG: Read file blog/programming/files.rst -> Article
DEBUG: Read file blog/programming/html5.rst -> Article
DEBUG: Read file blog/programming/node.rst -> Article
DEBUG: Read file blog/programming/programming-i2c.rst -> Article
DEBUG: Read file blog/programming/python.rst -> Article
DEBUG: Read file blog/programming/python_modules.rst -> Article
DEBUG: Read file blog/programming/stitch.rst -> Article
DEBUG: Read file blog/raspbian/ascii_art.rst -> Article
DEBUG: Read file blog/raspbian/avahi.rst -> Article
DEBUG: Read file blog/raspbian/beacons.rst -> Article
DEBUG: Read file blog/raspbian/bluetooth.rst -> Article
DEBUG: Read file blog/raspbian/bt_sync.rst -> Article
DEBUG: Read file blog/raspbian/dlna.rst -> Article
DEBUG: Read file blog/raspbian/firewall.rst -> Article
DEBUG: Read file blog/raspbian/gpio.rst -> Article
DEBUG: Read file blog/raspbian/hardware.rst -> Article
DEBUG: Read file blog/raspbian/i2c.rst -> Article
DEBUG: Read file blog/raspbian/i2s.rst -> Article
DEBUG: Read file blog/raspbian/install.rst -> Article
DEBUG: Read file blog/raspbian/kernel.rst -> Article
DEBUG: Read file blog/raspbian/kinect.rst -> Article
DEBUG: Read file blog/raspbian/lan_protection.rst -> Article
DEBUG: Read file blog/raspbian/network.rst -> Article
DEBUG: Read file blog/raspbian/nodejs.rst -> Article
DEBUG: Read file blog/raspbian/opencv.rst -> Article
DEBUG: Read file blog/raspbian/pizero.rst -> Article
DEBUG: Read file blog/raspbian/ps4_controller.rst -> Article
DEBUG: Read file blog/raspbian/samba.rst -> Article
DEBUG: Read file blog/raspbian/sd_card.rst -> Article
DEBUG: Read file blog/raspbian/services.rst -> Article
DEBUG: Read file blog/raspbian/software.rst -> Article
DEBUG: Read file blog/raspbian/usb_hd.rst -> Article
DEBUG: Read file blog/repo/node.rst -> Article
DEBUG: Read file blog/repo/opencv.rst -> Article
DEBUG: Read file blog/repo/repo.rst -> Article
DEBUG: Read file blog/repo/zmq.rst -> Article
DEBUG: Read file blog/robots/adafruit-bno055.rst -> Article
/Users/kevin/github/pelican/content/blog/robots/adafruit-bno055.rst:: (WARNING/2) No MathJax URL specified, using local fallback (see config.html)
make: *** [html] Error 12
@jcbagneris

This comment has been minimized.

Copy link

jcbagneris commented Aug 24, 2017

Same problem here, render_math is the only plugin.

Edit: I made a simple example (mwe.rst):

Minimum Working Example
======================

:lang: en
:authors: JcB
:status: published

This is the example:

.. math::

    P_0 = \frac{1}{2} + \beta

That's all.

And here is the compilation with debug:

DEBUG: Pelican version: 3.7.0
DEBUG: Python version: 3.6.2
DEBUG: Adding current directory to system path
DEBUG: Temporarily adding PLUGIN_PATHS to system path
DEBUG: Loading plugin `render_math`
DEBUG: Registering plugin `render_math`
DEBUG: Restoring system path
DEBUG: Read file mwe/mwe.rst -> Article
DEBUG: Signal article_generator_preread.send(ArticlesGenerator)/home/jcb/work/projets/writing/test/content/mwe/mwe.rst:: (WARNING/2) No MathJax URL specified, using local fallback (see config.html)
@justinmayer

This comment has been minimized.

Copy link
Member

justinmayer commented Aug 24, 2017

@barrysteyn: Any thoughts regarding these reports of render_math problems?

@barrysteyn

This comment has been minimized.

Copy link
Contributor

barrysteyn commented Aug 24, 2017

@jcbagneris

This comment has been minimized.

Copy link

jcbagneris commented Aug 26, 2017

@justinmayer @barrysteyn

Ok, finally found it, the bug is related to a change in docutils, see the last comment in https://sourceforge.net/p/docutils/bugs/319/?limit=25

As a workaround, patch mathjax_for_rst() in math.py, line 277 and line 280:

def mathjax_for_rst(pelicanobj, mathjax_script, mathjax_settings):
    """Setup math for RST"""
    docutils_settings = pelicanobj.settings.get('DOCUTILS_SETTINGS', {})
    docutils_settings.setdefault('math_output', 'MathJax %s' % mathjax_settings['source'])
    pelicanobj.settings['DOCUTILS_SETTINGS'] = docutils_settings
    rst_add_mathjax.mathjax_script = mathjax_script

Then fix the call to mathjax_to_rst accordingly in pelican_init() line 305:

    # Configure Mathjax For RST
    mathjax_for_rst(pelicanobj, mathjax_script, mathjax_settings)

Diff attached here, just in case:
diff.txt

Have fun!

Edit: use setdefault and 'source' mathjax setting to allow user to provide her own URI.

@josephcslater

This comment has been minimized.

Copy link

josephcslater commented Sep 2, 2017

Thanks! I just ran into this problem myself it this saved me untold time.

@justinmayer

This comment has been minimized.

Copy link
Member

justinmayer commented Sep 4, 2017

@barrysteyn: Any chance you could look at this today?

@barrysteyn

This comment has been minimized.

Copy link
Contributor

barrysteyn commented Sep 5, 2017

jpli added a commit to jpli/jpli.github.io that referenced this issue Oct 14, 2017

senya added a commit to mipt-cs/course-site-python3 that referenced this issue Nov 18, 2017

gitmodules: переключил pelican plugins на наш форк
Попытка пофиксить билд, связанный с
getpelican/pelican-plugins#928

senya added a commit to mipt-cs/pelican-plugins that referenced this issue Nov 21, 2017

render_math/math.py: fix build for pelican
fix getpelican#928
Fix is provided by Jean-Charles Bagneris (jcbagneris)
@MicroJoe

This comment has been minimized.

Copy link

MicroJoe commented Dec 19, 2017

Any update on this? Build is still failing without the PR's fix that fixed my problem.

@justinmayer

This comment has been minimized.

Copy link
Member

justinmayer commented Dec 19, 2017

Addressed via 83bede1

gnotc added a commit to gnotc/pelican-plugins that referenced this issue Jan 16, 2018

sync (#4)
* Fixed class attribute in markdown (closes getpelican#838)

* Fixed plantuml markdown supporto for pelican 3.7 (fixes getpelican#833)

* Update Readme.md

Correct minor typo in display math command syntax

* Remove trailing whitespaces from neighbors plugin

* Fixed error: NameError: name 'unicode' is not defined (Python3)

* PEP8 fixes

* Sync just table plugin

* [Fix] Dots after numbers in headers

* Added a small bit of clarification for indexing

* Add github wiki plugin and update readme

* Add author images

* Move bootstrap-rst from submodule to in-tree

I no longer have intent to further this plugin, so I think it's best to move it
in-tree where it's more easily accessible for others.

Since everything is squashed, the changes from the last version are:
  * use relative imports in bootstrap.py (thanks to @davidchall)
  * updated maintainer email
  * very small documentation fixes

* Fix URL

* Update twitter sharing link to 'twitter.com/intent'

* Fix NameError in Python 3

This commit fixes the NameError produced by calling
 filter(lambda string: isinstance(string, basestring))
in Python 3. Because filter() is a generator, the lambda function doesn't
actually called at the point of the filter() statement (which is within
a try/except block), it gets called later and raises the error outside
the try block. With this commit, the code now identifies the relevant
string type (basestring or str) before ever using it, forcing the
NameError to get raised early in a controlled context.

* Parses rdf vocabularies, and processes them as a new media type

This plugin offers a flexible mechanism to write lightweight documentation
about rdf vocabularies, based on sparql queries.

* Add pelican-ert plugin
A plugin for estimating time that could be spent for an article reading.

* Update pelican-toc to 1.2.0

* Update bootstrapify to 1.0.0

* Thumbnailer: add optional input file name regex setting

With the help of the THUMBNAIL_INCLUDE_REGEX setting it is now possible
to restrict thumbnailing to a files matching this regular expression.
The setting is expected to be a string. If available, a regular
expression is created. The default behavior is still that all files not
starting with a dot are respected.

For instance, this can be set to only match files ending in "jpg",
"jpeg" or "png" one can use:

THUMBNAIL_INCLUDE_REGEX = r'(jp[e]g|png)$'

* Interlinks: patch to fix getpelican#920 (getpelican#925)

* fixes getpelican#920

* Interlinks: improves HTML img tag handling. Fixes getpelican#886 (again)

* Fix md_inline_extension for Pelican 3.7+ (getpelican#875)

* Deprecate feed_summary plugin. Closes getpelican#926

* Remove feed_summary plugin from list in ReadMe

* category_meta: Add support for Pelican >= 3.7.0

`category.slug` is not writeable since 648165b.

* fix a bug with autopages regarding context

* Better tags repartition with TAG_CLOUD_MAX_ITEMS

* Added Support for {attach} images

Handles images with {attach} differently, new feature of Pelican 3.5, current code was not compatible at all as it couldn’t understand where the file was.

* Expand photo size when rotated otherwise the image was being cut. See http://pillow.readthedocs.io/en/3.1.x/reference/Image.html#PIL.Image.Image.rotate for expand setting - this resizes the image when rotating.

It may be applicable to other orientations in this section of code, but I have no photos to test with.

See also https://stackoverflow.com/questions/31303938/how-do-i-stop-pil-from-swapping-height-width-when-rotating-an-image-90

* Fix ASSET_SOURCE_PATHS to be list instead of tuple

Tuple causes error when used, must be list.

* Add --no-headers option

* Handle non-ascii paths in filetime_from_git plugin

Paths with non-ascii characters would give encoding errors.

Fixes getpelican#328

* Events: new readme (getpelican#948)

Events: New ReadMe file

* Update submodule: pelican-linkclass

* mdx_linkclass.py: Fix typo in comment
* Make the plugin work also for reference-style links
* linkclass.py: Update to Pelican 3.7

* Updated AsciiDoc reader to support both legacy and asciidoctor CLI utilities.

* render_math/math.py: fix build for pelican
fix getpelican#928
Fix is provided by Jean-Charles Bagneris (jcbagneris)

gnotc added a commit to gnotc/pelican-plugins that referenced this issue Mar 1, 2018

sync (#5)
* Fixed class attribute in markdown (closes getpelican#838)

* Fixed plantuml markdown supporto for pelican 3.7 (fixes getpelican#833)

* Update Readme.md

Correct minor typo in display math command syntax

* Remove trailing whitespaces from neighbors plugin

* Fixed error: NameError: name 'unicode' is not defined (Python3)

* PEP8 fixes

* Sync just table plugin

* [Fix] Dots after numbers in headers

* Added a small bit of clarification for indexing

* Add github wiki plugin and update readme

* Add author images

* Move bootstrap-rst from submodule to in-tree

I no longer have intent to further this plugin, so I think it's best to move it
in-tree where it's more easily accessible for others.

Since everything is squashed, the changes from the last version are:
  * use relative imports in bootstrap.py (thanks to @davidchall)
  * updated maintainer email
  * very small documentation fixes

* Fix URL

* Update twitter sharing link to 'twitter.com/intent'

* Fix NameError in Python 3

This commit fixes the NameError produced by calling
 filter(lambda string: isinstance(string, basestring))
in Python 3. Because filter() is a generator, the lambda function doesn't
actually called at the point of the filter() statement (which is within
a try/except block), it gets called later and raises the error outside
the try block. With this commit, the code now identifies the relevant
string type (basestring or str) before ever using it, forcing the
NameError to get raised early in a controlled context.

* Parses rdf vocabularies, and processes them as a new media type

This plugin offers a flexible mechanism to write lightweight documentation
about rdf vocabularies, based on sparql queries.

* Add pelican-ert plugin
A plugin for estimating time that could be spent for an article reading.

* Update pelican-toc to 1.2.0

* Update bootstrapify to 1.0.0

* Thumbnailer: add optional input file name regex setting

With the help of the THUMBNAIL_INCLUDE_REGEX setting it is now possible
to restrict thumbnailing to a files matching this regular expression.
The setting is expected to be a string. If available, a regular
expression is created. The default behavior is still that all files not
starting with a dot are respected.

For instance, this can be set to only match files ending in "jpg",
"jpeg" or "png" one can use:

THUMBNAIL_INCLUDE_REGEX = r'(jp[e]g|png)$'

* Interlinks: patch to fix getpelican#920 (getpelican#925)

* fixes getpelican#920

* Interlinks: improves HTML img tag handling. Fixes getpelican#886 (again)

* Fix md_inline_extension for Pelican 3.7+ (getpelican#875)

* Deprecate feed_summary plugin. Closes getpelican#926

* Remove feed_summary plugin from list in ReadMe

* category_meta: Add support for Pelican >= 3.7.0

`category.slug` is not writeable since 648165b.

* fix a bug with autopages regarding context

* Better tags repartition with TAG_CLOUD_MAX_ITEMS

* Added Support for {attach} images

Handles images with {attach} differently, new feature of Pelican 3.5, current code was not compatible at all as it couldn’t understand where the file was.

* Expand photo size when rotated otherwise the image was being cut. See http://pillow.readthedocs.io/en/3.1.x/reference/Image.html#PIL.Image.Image.rotate for expand setting - this resizes the image when rotating.

It may be applicable to other orientations in this section of code, but I have no photos to test with.

See also https://stackoverflow.com/questions/31303938/how-do-i-stop-pil-from-swapping-height-width-when-rotating-an-image-90

* Fix ASSET_SOURCE_PATHS to be list instead of tuple

Tuple causes error when used, must be list.

* Add --no-headers option

* Handle non-ascii paths in filetime_from_git plugin

Paths with non-ascii characters would give encoding errors.

Fixes getpelican#328

* Events: new readme (getpelican#948)

Events: New ReadMe file

* Update submodule: pelican-linkclass

* mdx_linkclass.py: Fix typo in comment
* Make the plugin work also for reference-style links
* linkclass.py: Update to Pelican 3.7

* Updated AsciiDoc reader to support both legacy and asciidoctor CLI utilities.

* render_math/math.py: fix build for pelican
fix getpelican#928
Fix is provided by Jean-Charles Bagneris (jcbagneris)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment