Coder Social home page Coder Social logo

sphinxcontrib.asciinema's People

Contributors

divi255 avatar euri10 avatar jdillard avatar mike-matera avatar mrgreentea avatar ovidner avatar pierremarchand20 avatar thehappydinoa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

sphinxcontrib.asciinema's Issues

Settings will be the same for all asciinema-player in generated pages

I want to include two casts in my document.
It looks something like this:

.. asciinema:: first.cast
   :poster: npt:0:03
   :cols: 80
   :rows: 10
   :title: first example


.. asciinema:: second.cast
   :cols: 80
   :rows: 20
   :poster: npt:0:04
   :title: second example

In the html they will both be identical with the only difference being the reference cast file:

<asciinema-player 
    poster="npt:0:04" 
    cols="80" 
    rows="20" 
    title="second example" 
    src="_casts/XXX/first.cast"
/>
<asciinema-player 
    poster="npt:0:04" 
    cols="80" 
    rows="20" 
    title="second example" 
    src="_casts/YYY/second.cast" 
/>

Error in "asciinema" directive: unknown option: "title"

With the update of sphinxcontrib.asciinema to v0.4.0 we get an issue

/builds/.../test.rst:80: ERROR: Error in "asciinema" directive:
unknown option: "title".
.. asciinema:: examples/test.cast
   :poster: npt:0:03
   :cols: 300
   :rows: 38
   :title: my test title

The change comes with update of asciinema from 2.6.1 to 3.6.3 PULLREQUEST: #24

and the remove of the title in this line

'title': directives.unchanged,

Is this intended?

Possible to set source directory default path?

The docs I am working on have a source/_static/asciinema folder in which all casts will be placed. Instead of having to refer to this full path like this:

.. asciinema:: ../_static/asciinema/set-device-tags.cast

It would be great if we could just refer to it like this:

.. asciinema:: set-device-tags.cast

Perhaps it could be a config option?

sphinxcontrib_asciinema_defaults = {
       'path': source/_static/asciinema
}

Self hosted, wrong (fixed) player JS location

Hi,

load = """<script src="../_static/asciinema-player_3.6.3.js"></script>"""

I think, this commit assumes that the position of the page with asciinema directive is fixed to _static directory. This assumption makes many pages broken.

It looks like the previous version is fine:

.css file is included correctly thanks to:

def copy_asset_files(app, exc):

Thanks!

Crashes when building with singlehtml

Using sphinx-build -b singlehtml crashes sphinxcontrib.asciinema with:

Exception occurred:
  File "/usr/local/lib/python3.8/site-packages/sphinxcontrib/asciinema/asciinema.py", line 38, in visit_html
    for n, v in node.options.items():
AttributeError: 'Asciinema' object has no attribute 'options'

local paths in directories are not included correctly.

When I have this structure:

❯ tree doc
doc
├── conf.py
├── examples
│      └──  example.cast
└── index.rst

And try to include example.cast in index.rst like this:
.. asciinema:: examples/example.cast the built html will not be able to access the cast.
It seems this is because example.cast is put top level into the generated hash directory in build/_casts/ but the reference in the index.html points to _casts/<hash>/examples/example.cast instead of at _casts/<hash>/example.cast.

Content below local asciinema is hidden

NOTE: This bug comes with changes from 0.2.1 to 0.3.1.

After an update to version 0.3.1 the content below an asciinema element is hidden.
It is using a local file.

If the generated html <asciinema-player ... is manually wrapped into a container like <p>, <span> or <div> the content is visible again.

Maybe the <asciinema-player {options} src="data:application/json;base64,{src}" /> should be moved into a container?

Available workarounds:

  • downgrade to 0.2.1
  • move the asciinema into a container by hand e.g.
.. container:: custom

   .. asciinema:: examples/test.cast
      :title: test me

I'm hidden if the container is removed.

Pip installation fails if sphinx is not in pip cache

Installation through pip fails if sphinx is not available in the pip cache. E.g., explicitly disabling the cache:

$ conda create -n satest
$ conda activate satest
$ pip install --no-cache-dir sphinxcontrib.asciinema
...
    ERROR: Command errored out with exit status 1:
...
        from sphinxcontrib import asciinema as pkg
      File "/tmp/pip-install-e7tmpd_3/sphinxcontrib.asciinema/sphinxcontrib/asciinema/__init__.py", line 9, in <module>
        from docutils import nodes
    ModuleNotFoundError: No module named 'docutils'
...

The error also occurs without --no-cache-dir if sphinx has not been installed earlier through pip, e.g. on a freshly installed machine, which is harder to reproduce.

The same error occurs when installing sphinx at the same time:

$ pip install --no-cache-dir sphinxcontrib.asciinema

This can be resolved by first installing sphinx:

$ pip install --no-cache-dir sphinx
Successfully installed ... sphinx-2.2.1 ...
$ pip install --no-cache-dir sphinxcontrib.asciinema
Successfully installed sphinxcontrib.asciinema-0.1.6

It would be better if the both sphinx and the asciinema extension can be installed with a single pip command. If that's not possible, then the documentation should be updated to mention that sphinx must be installed first before installing this plugin.

Embedding local asciinema files into web pages broken

Security settings in modern browsers prevent mixing the web based player with local cast files.

The workaround is to directly embed the data as base64 data url: asciinema/asciinema-player#64

It would be great to automatically generate base64 encoded data from the ascii-cast and create the specific data url.

If this can not be done default, maybe offer a configuration switch to make this optional

0.3.3: pep517 based build fails

Looks like it something wrong when pep517 build is used.

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting dependencies for wheel...
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/pep517/in_process/_in_process.py", line 363, in <module>
    main()
  File "/usr/lib/python3.8/site-packages/pep517/in_process/_in_process.py", line 345, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/lib/python3.8/site-packages/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 162, in get_requires_for_build_wheel
    return self._get_build_requires(
  File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 143, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 267, in run_setup
    super(_BuildMetaLegacyBackend,
  File "/usr/lib/python3.8/site-packages/setuptools/build_meta.py", line 158, in run_setup
    exec(compile(code, __file__, 'exec'), locals())
  File "setup.py", line 2, in <module>
    from sphinxcontrib import asciinema as pkg
ImportError: cannot import name 'asciinema' from 'sphinxcontrib' (/usr/lib/python3.8/site-packages/sphinxcontrib/__init__.py)

ERROR Backend subproccess exited when trying to invoke get_requires_for_build_wheel

Fails when manpages are built

Thanks for the extension, it works great for HTML. I'm trying to build the fish-shell docs (charego/fish-shell@85ff7f8) and it builds fine when manpages are excluded.

But when manpages are enabled again, I get this error:

~/sandbox/fish-shell/build (docs/asciinema) > make doc
[ 21%] Built target pcre2-32
[ 21%] Built target CHECK-FISH-BUILD-VERSION-FILE
[ 94%] Built target fishlib
[ 97%] Built target fish_indent
[ 98%] Building man pages with Sphinx

Exception occurred:
  File "/usr/local/lib/python3.7/site-packages/sphinx/writers/manpage.py", line 459, in unknown_visit
    raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: Asciinema
The full traceback has been saved in /var/folders/j6/5pd6brws00n7k_6l6j_v8v840000gy/T/sphinx-err-qj3ipsl5.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make[3]: *** [CMakeFiles/sphinx-manpages] Error 2
make[2]: *** [CMakeFiles/sphinx-manpages.dir/all] Error 2
make[1]: *** [CMakeFiles/doc.dir/rule] Error 2
make: *** [doc] Error 2

Full error:

> cat /var/folders/j6/5pd6brws00n7k_6l6j_v8v840000gy/T/sphinx-err-qj3ipsl5.log
# Sphinx version: 2.4.4
# Python version: 3.7.7 (CPython)
# Docutils version: 0.16 release
# Jinja2 version: 2.11.2
# Last messages:
#   cmds/vared
#   cmds/wait
#   cmds/while
#   design
#   tutorial
#   completions
#   faq
#   license
#   }
#   failed
# Loaded extensions:
#   sphinx.ext.mathjax (2.4.4) from /usr/local/lib/python3.7/site-packages/sphinx/ext/mathjax.py
#   sphinxcontrib.applehelp (1.0.2) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/applehelp/__init__.py
#   sphinxcontrib.devhelp (1.0.2) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/devhelp/__init__.py
#   sphinxcontrib.htmlhelp (1.0.3) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/htmlhelp/__init__.py
#   sphinxcontrib.serializinghtml (1.1.4) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/serializinghtml/__init__.py
#   sphinxcontrib.qthelp (1.0.3) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/qthelp/__init__.py
#   alabaster (0.7.12) from /usr/local/lib/python3.7/site-packages/alabaster/__init__.py
#   sphinxcontrib.asciinema (unknown version) from /usr/local/lib/python3.7/site-packages/sphinxcontrib/asciinema/__init__.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sphinx/cmd/build.py", line 276, in build_main
    app.build(args.force_all, filenames)
  File "/usr/local/lib/python3.7/site-packages/sphinx/application.py", line 349, in build
    self.builder.build_update()
  File "/usr/local/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 294, in build_update
    self.build(['__all__'], to_build)
  File "/usr/local/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 361, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/local/lib/python3.7/site-packages/sphinx/util/__init__.py", line 686, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/sphinx/builders/manpage.py", line 100, in write
    docwriter.write(largetree, destination)
  File "/usr/local/lib/python3.7/site-packages/docutils/writers/__init__.py", line 78, in write
    self.translate()
  File "/usr/local/lib/python3.7/site-packages/sphinx/writers/manpage.py", line 45, in translate
    self.document.walkabout(visitor)
  File "/usr/local/lib/python3.7/site-packages/docutils/nodes.py", line 214, in walkabout
    if child.walkabout(visitor):
  File "/usr/local/lib/python3.7/site-packages/docutils/nodes.py", line 214, in walkabout
    if child.walkabout(visitor):
  File "/usr/local/lib/python3.7/site-packages/docutils/nodes.py", line 214, in walkabout
    if child.walkabout(visitor):
  [Previous line repeated 3 more times]
  File "/usr/local/lib/python3.7/site-packages/docutils/nodes.py", line 206, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/local/lib/python3.7/site-packages/sphinx/util/docutils.py", line 486, in dispatch_visit
    super().dispatch_visit(node)
  File "/usr/local/lib/python3.7/site-packages/docutils/nodes.py", line 1995, in dispatch_visit
    return method(node)
  File "/usr/local/lib/python3.7/site-packages/sphinx/writers/manpage.py", line 459, in unknown_visit
    raise NotImplementedError('Unknown node: ' + node.__class__.__name__)
NotImplementedError: Unknown node: Asciinema

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.