Git Product home page Git Product logo

ox-rst's Introduction

reStructuredText Back-End for Org Export Engine

Ox-Rst

Ox-Rst exports your Org documents to reStructuredText. Ox-Rst relies on the Org-mode 9.0 export framework.

Configuration

Add the following in your init.el

(require 'ox-rst)

reStructuredText export

ox-rst export back-end generates reStructuredText syntax for an Org mode buffer.

reStructuredText commands

To export your org document to, press C-c C-e, and then r.

C-c C-e r r (org-rst-export-to-rst)

Export as a text file written in reStructured syntax. For an Org file, myfile.org, the resulting file will be myfile.rst. The file will be overwritten without warning.

C-c C-e r R (org-rst-export-as-rst)

Export as a temporary buffer. Do not create a file.

Title, Author, E-Mail and Date

Org:

#+TITLE: This is the title of the document
#+AUTHOR: Author
#+EMAIL: [email protected]
#+DATE: 2019/08/13 00:00
#+OPTIONS: author:t date:t email:t

reStructuredText:

=================================
This is the title of the document
=================================

    :Author: Author
    :Contact: [email protected]
    :Date: 2019/08/13 00:00

Headings

Org:

* Heading 1

contents 1

** Heading 1-1

contents 1-1

*** Heading 1-1-3

contents 1-1-3

reStructuredText:

Heading 1
---------

contents 1

Heading 1-1
~~~~~~~~~~~

contents 1-1

Heading 1-1-3
^^^^^^^^^^^^^

contents 1-1-3

Table of contents

Org:

#+OPTIONS: toc:t

reStructuredText:

.. contents::

Lists

Org:

** Lord of the Rings
1. The attack of the Rohirrim
2. Eowyn's fight with the witch king
   + this was already my favorite scene in the book
   + I really like Miranda Otto.
3. Peter Jackson being shot by Legolas
   - on DVD only
   He makes a really funny face when it happens.
But in the end, no individual scenes matter but the film as a whole.
Important actors in this film are:
- Elijah Wood :: He plays Frodo
- Sean Austin :: He plays Sam, Frodo's friend.  I still remember
  him very well from his role as Mikey Walsh in The Goonies.

reStructuredText:

Lord of the Rings
~~~~~~~~~~~~~~~~~

1. The attack of the Rohirrim

2. Eowyn's fight with the witch king

   - this was already my favorite scene in the book

   - I really like Miranda Otto.

3. Peter Jackson being shot by Legolas

   - on DVD only

   He makes a really funny face when it happens.

But in the end, no individual scenes matter but the film as a whole.
Important actors in this film are:

Elijah Wood
    He plays Frodo

Sean Austin
    He plays Sam, Frodo's friend.  I still remember
    him very well from his role as Mikey Walsh in The Goonies.

Special Characters

Org:

special characters * asterisk \ backspace
.. reStructuredText comment line

reStructuredText:

special characters \* asterisk \\ backspace
\.. reStructuredText comment line

Paragraphs

note Org line breaks \\ will be ignored.

Verse block

Org:

#+BEGIN_VERSE
 Great clouds overhead
      Tiny black birds rise and fall
      Snow covers Emacs

          -- AlexSchroeder
#+END_VERSE

reStructuredText Line Blocks:

| Great clouds overhead
|      Tiny black birds rise and fall
|      Snow covers Emacs
|
|          -- AlexSchroeder

Quote block

Org:

#+BEGIN_QUOTE
Everything should be made as simple as possible,
  but not any simpler -- Albert Einstein
#+END_QUOTE

reStructuredText Literal Blocks:

::

    Everything should be made as simple as possible,
      but not any simpler -- Albert Einstein

Org:

#+ATTR_RST: :margin 4
#+BEGIN_QUOTE
Everything should be made as simple as possible,
but not any simpler -- Albert Einstein
#+END_QUOTE

#+ATTR_RST: :margin 8
#+BEGIN_QUOTE
Everything should be made as simple as possible,
but not any simpler -- Albert Einstein
#+END_QUOTE

reStructuredText Block Quotes:

Everything should be made as simple as possible,
but not any simpler -- Albert Einstein

    Everything should be made as simple as possible,
    but not any simpler -- Albert Einstein

Org:

#+ATTR_RST: :directive note
#+BEGIN_QUOTE
Everything should be made as simple as possible,
but not any simpler -- Albert Einstein
#+END_QUOTE

reStructuredText Directives:

.. note::

    Everything should be made as simple as possible,
    but not any simpler -- Albert Einstein

Org:

#+ATTR_RST: :directive sidebar :title sidebar title
#+BEGIN_QUOTE
Everything should be made as simple as possible,
but not any simpler -- Albert Einstein
#+END_QUOTE

reStructuredText Directives with title:

.. sidebar:: sidebar title

    Everything should be made as simple as possible,
    but not any simpler -- Albert Einstein

Special blocks

Org:

#+BEGIN_caution
This is the second line of the first paragraph.
#+END_caution

reStructuredText:

.. caution::

    This is the second line of the first paragraph.

Org:

#+ATTR_RST: :title This is a note admonition.
#+BEGIN_note
This is the second line of the first paragraph.
#+END_note

reStructuredText:

.. note:: This is a note admonition.

    This is the second line of the first paragraph.

Center block

Center block will not affect.

Org:

#+BEGIN_CENTER
center block
#+END_CENTER

reStructuredText:

center block

Literal examples

example block

Org:

#+NAME: label
#+BEGIN_EXAMPLE
example
#+END EXAMPLE

reStructuredText:

::
    :name: label

    example

src block

Org:

#+BEGIN_SRC lisp
(require 'ox-rst)
#+END_SRC

reStructuredText:

.. code-block:: lisp

    (require 'ox-rst)

Emphasis and monospace

Org:

*bold* /italic/ _underlined_ =verbatim= ~code~ +strike-through+

reStructuredText:

**bold** *italic* underlined ``verbatim`` ``code`` strike-through

Subscript and superscript

Org:

H_{2}O
E = mc^2

reStructuredText:

H\ :sub:`2`\ O
E = mc\ :sup:`2`\ 

LaTeX fragments

Org:

If $a^2=b$ and \( b=2 \), then the solution must be
either $$ a=+\sqrt{2} $$ or \[ a=-\sqrt{2} \].

reStructuredText:

  If :math:`a^2=b` and :math:`b=2`, then the solution must be
either 

.. math::

    a=+\sqrt{2}

 or 

.. math::

    a=-\sqrt{2}

.

Horizontal rules

Org:

-----

reStructuredText:

------------

Comment block

Comment block will disapper.

Org:

#+BEGIN_COMMENT
comment
#+END_COMMENT

Images and Tables

Images

Org:

#+ATTR_RST: :alt alternate text :align right
[[./image.jpg]]

reStructuredText:

.. image:: ./image.jpg
    :alt: alternate text
    :align: right

Org:

#+CAPTION: image caption
#+ATTR_RST: :alt alternate text :align center :scale 50%
[[./image.jpg]]

reStructuredText:

.. figure:: ./image.jpg
    :alt: alternate text
    :align: center
    :scale: 50%

    image caption

Tables

Org:

| TOP1 | TOP2 | TOP3 |
| 1    | 2    | 3    |
| AAAA | BBBB | CCCC |
| END1 | END2 | END3 |

reStructuredText:

.. table::

    +------+------+------+
    | TOP1 | TOP2 | TOP3 |
    +------+------+------+
    | 1    | 2    | 3    |
    +------+------+------+
    | AAAA | BBBB | CCCC |
    +------+------+------+
    | END1 | END2 | END3 |
    +------+------+------+

Org:

| TOP1 | TOP2 | TOP3 |
|------+------+------|
| 1    | 2    | 3    |
| AAAA | BBBB | CCCC |
| END1 | END2 | END3 |

reStructuredText:

.. table::

    +------+------+------+
    | TOP1 | TOP2 | TOP3 |
    +======+======+======+
    | 1    | 2    | 3    |
    +------+------+------+
    | AAAA | BBBB | CCCC |
    +------+------+------+
    | END1 | END2 | END3 |
    +------+------+------+

Org:

|------+------+------|
| TOP1 | TOP2 | TOP3 |
|------+------+------|
| 1    | 2    | 3    |
|------+------+------|
| AAAA | BBBB | CCCC |
|------+------+------|
| END1 | END2 | END3 |
|------+------+------|

reStructuredText:

.. table::

    +------+------+------+
    | TOP1 | TOP2 | TOP3 |
    +======+======+======+
    | 1    | 2    | 3    |
    +------+------+------+
    | AAAA | BBBB | CCCC |
    +------+------+------+
    | END1 | END2 | END3 |
    +------+------+------+

Org:

#+CAPTION: caption
#+NAME: label
| TOP1 | TOP2 | TOP3 |
|------+------+------|
| 1    | 2    | 3    |
| AAAA | BBBB | CCCC |
| END1 | END2 | END3 |

reStructuredText:

.. table:: caption
    :name: label

    +------+------+------+
    | TOP1 | TOP2 | TOP3 |
    +======+======+======+
    | 1    | 2    | 3    |
    +------+------+------+
    | AAAA | BBBB | CCCC |
    +------+------+------+
    | END1 | END2 | END3 |
    +------+------+------+

Hyperlinks

External hyperlinks

Org:

[[http://orgmode.org][Org Mode]]

[[http://orgmode.org]]

reStructuredText:

`Org Mode <http://orgmode.org/>`_

`http://orgmode.org`_

Internal links

Org:

This is an <<example>> cross reference target.

Internal cross references, like [[example]]

reStructuredText:

This is an  _`example`  cross reference target.

Internal cross references, like `example`_

Org:

* headline

Internal cross references, [[*headline]]

reStructuredText:

headline
--------

Internal cross references, `headline`_

Org:

* headline
  :PROPERTIES:
  :CUSTOM_ID: customid
  :END:

Internal cross references, headline [[#customid]]

reStructuredText:

.. _customid:

headline
--------

Internal cross references, headline `customid`_

Org:

#+NAME: sampletable
| a | b | c |
| 1 | 2 | 3 |

Internal cross references, label [[sampletable]]

reStructuredText:

.. table::
  :name: sampletable

  +---+---+---+
  | a | b | c |
  +---+---+---+
  | 1 | 2 | 3 |
  +---+---+---+

Internal cross references, label `sampletable`_

Org:

#+NAME: samplefigure
[[./image.jpg]]

Internal cross references, label [[samplefigure]]

reStructuredText:

.. _samplefigure:

.. image:: ./image.jpg

Internal cross references, label `samplefigure`_

Footnote

Org:

* footnote sample

Org mode[fn:org] is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system.

reStructuredText[fn:rest] is plaintext that uses simple and intuitive constructs to indicate the structure of a document.

[fn:org] org-mode [[http://orgmode.org]]
[fn:rest] reStructuredText [[http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html]]

reStructuredText:

footnote sample
---------------

Org mode [2]_  is for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system.

reStructuredText [1]_  is plaintext that uses simple and intuitive constructs to indicate the structure of a document.


.. [1] reStructuredText `http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html>`_

.. [2] org-mode `http://orgmode.org <http://orgmode.org>`_

Export reStructuredText fragments

Org:

See also @@rst::meth:`mypackage.mymodule.MyClass.mymethod()`@@.

#+RST: .. class:: alert

#+BEGIN_EXPORT rst
.. class:: alert
#+END_EXPORT

reStructuredText:

See also :meth:`mypackage.mymodule.MyClass.mymethod()`.

.. class:: alert

.. class:: alert

ox-rst's People

Contributors

avoine avatar dajva avatar forin-xyz avatar msnoigrs avatar pgfoster avatar rational-curiosity avatar skgsergio avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ox-rst's Issues

Symbol's function definition is void: org-export-custom-protocol-maybe

I'm actually using ox-nikola to try convert an orgmode file to .rst. One file worked, but one with links to the web failed with this error.

I traced it back to ox-rst. It seems ox-rst is calling this function in converting org links, but the function is not a part of ox.el (at least, not in the latest orgmode package from the orgmode ELPA repo? (20150202)). Which version of org is this written against?

I have tried using the latest org package, and also the builtin orgmode from emacs 24.4, but get the same error.

I know that ox has been a bit of a moving target this past year or so, wondering if something has changed, yet again, affecting your code? Pretty interested to find a fix because this alternative looks a lot more flexible than the plugin for Nikola.

wrongly parsed DATE

In my org source I have:

#+date: <2019-07-23>

This gets translated to a wrong rst date:

    :Date: 23 00mm 19

I think yyyy-mm-dd is a very common date format:

  • it's the format of xsd:date, borrowed from ISO whichever
  • org-time-stamp produces the same (at least for me), but with a week-day attached, eg <2019-07-23 Tue>

Escaping '*' in verbatim blocks

Thanks for a great package.
In verbatim org blocks, consecutive * from start of the string becomes escaped when converting it to restrucured text.
Examples:

=* foo *= -> ``\* foo *``
=** foo *= -> ``\*\* foo *``

What is the background if this behavior? I don't know restructured text very well but using sphinx to export it to other formats preserve the backslash.
I'd like to have literal * in verbatim blocks but can't figure out how to do that.

Looking at the regexp in the code it confirms this behavior:

(string-match "\\`*" text)

I've been trying to avoid this issue by using this instead but not sure if it's what is intended:

(string-match "`+" text)

ox-rst adds section numbers on the headings

I installed Org mode 8.3beta and tried ox-rst. Strangely, it added section numbers automatically to headings. For example, when I export the following

*** Testing
**** Introduction
***** Introduction
****** Introduction
:PROPERTIES:
:BEAMER_OPT: allowframebreaks
:END:

- Introduction

I get

    Testing
    =======

        :Author: Joon Ro

    .. contents::
    1 Introduction
    --------------

    1.1 Introduction
    ~~~~~~~~~~~~~~~~

    1.1.1 Introduction
    ^^^^^^^^^^^^^^^^^^

    - Introduction

I have a org link with elisp:(org-rst-export-to-rst nil t), inside the Testing subtree which I use to export the subtree.

Support for math expressions

It seems ox-rst currently exports latex math expressions (such as \( K \)) as-is. It would be great if it converts $ \alpha $ or \( \alpha \) to :math:\alpha``and$$ \alpha $$or`[ \alpha ]` to

.. math::

   \alpha

where \alpha being an example of a math expression.

Sequence of 8 spaces is non-deterministically exported as tabulation

Example org input:

#+LANGUAGE: en
#+OPTIONS: ':t author:nil email:nil date:nil toc:nil

#+BEGIN_SRC python
def foo(x):
    if x % 2 == 0:
        return 42
    return 1337
#+END_SRC

Output:

.. code:: python

    def foo(x):
        if x % 2 == 0:
    	return 42
        return 1337

Notice that there is a tab before return 42 in the output.

If I disable tabulations in my .emacs config file with (setq-default indent-tabs-mode nil), then the export works as expected, there is no tabulation.

The main issue I have is the non-determinism: depending on the local Emacs configuration, the export will be different, which is annoying when the output is committed in a git repository with several people working on it.

Need space in table

Hi,

Apart from #10 , I also noticed a strange behaviour in exporting tables. In the following image, the first table is in org-format, the second table is the exported rst-format.

screenshot from 2015-03-30 10 17 49

Notice the separator | in the middle in table 2, does no line up (should be underneath the +), and I have to remove two spaces, while for the last separate, I have to add three spaces to make the table format correct, otherwise, the Spnix throws this error message:

ERROR: Malformed table.

I only see this strange behaviour in 3 out of 20-ish tables I was exporting, and I don't know why it was triggered since the org-table looks perfectly fine.

-Yi

Understanding inlinetask behavior

Thanks for a great package! I am trying to understand how inline tasks work with ox-rst. Here is an example of conversion with emacs 27.2 (org 9.5-b83ae59):

org:

*** TODO [#A] Test item
:PROPERTIES:
:CREATED:[2021-08-04 Wed 20:41]
:END:

translates to rst:

TODO Test Item
^^^^^^^^^^^^^^
:CREATED:[2021-08-04 Wed 20:41]

Is this the expected conversion? Or am I missing an export option? I have tried todo:t and tasks:t, but they don't seem to change behavior.

As a side note, it would be nice to convert todo items to rst admonitions to take advantage of sphinx.ext.todo.

replace-regexp-in-string: Invalid use of ‘\’ in replacement text

Hi there,
this issue comes with the latest release, since the previous one was working flawlessly.
Any org file that was previously correctly exported now fails with this error.

I have been using Emacs for more than a while but I am not an elisp writer/debugger (damn me!)

My config:
emacs 24.5 or 25.1.2 or 25.2
org 20171218

This is the failing block:

#+BEGIN_note The current revision is *20171019.1* #+END_note
If I remove the dot everything works fine, But the presence of the dot leads to the error in the subject.
Also, the bolding through '*' should be only on one word, inside a "BEGIN/END" block.

Thanks,
akall

#+BEGIN_EXPORT rst - don't work

Dear Masayuko

The ox-rst is work well for me. Thank you.

late week I was git pull, then find out #+BEGIN_EXPORT rst don't work.

(sample)
#+BEGIN_EXPORT rst
.. class:: alert
#+END_EXPORT

(output)
.. EXPORT::

\.. lass:: alert

version commit 7b6095c

Best Regards
Lloyd

Error while exporting

I've got this error while exporting with Emacs 24.4:

Debugger entered--Lisp error: (wrong-number-of-arguments #[(templates) "\212eb\210\306�\307\310\306\311#\205\\�\312 �\313   !\314=\203X�\315    
\"�\316\317 \"\211� \316\320    \"E\211��\235\203<�\321\322\316\323 \"\"\210\202W��\203W�
�B�\316\324    \"b\210\325\306x\210`|\210\212�c\210)+)\202��*\207" [record object templates value begin signature nil re-search-forward "{{{[-A-Za-z0-9_]" t org-element-context org-element-type macro org-macro-expand org-element-property :begin :args error "Circular macro expansion: %s" :key :end "    "] 6 ("/usr/share/emacs/24.4/lisp/org/org-macro.elc" . 3797)] 3)
  org-macro-replace-all((("modification-time" . "(eval (format-time-string \"$1\" '(22011 7223 28980 721000)))") ("input-file" . "mydoc.org") ("time" . "(eval (format-time-string \"$1\"))") ("property" . "(eval (org-entry-get nil \"$1\" 'selective))")) nil ("SUBTITLE" "TITLE" "DATE" "AUTHOR"))
  org-export-as(rst nil nil nil (:output-file "./mydoc.rst"))
  org-export-to-file(rst "./mydoc.rst" nil nil nil nil nil)
  org-rst-export-to-rst(nil nil nil nil)
  org-export-dispatch(nil)
  call-interactively(org-export-dispatch nil nil)
  command-execute(org-export-dispatch)

bold with emphasis

Hi,

Thanks for building this incredible ox-rst package, it makes my life a lot easier in working with software guys who use Sphinx for creating documentation.

I've noticed that */i/*, bold with emphasis, will be exported to ***i***, and I wonder if it is a legal syntax in rst for I am using Sphnix to compile and get this warning message:

WARNING: Inline strong start-string without end-string.

I don't understand rst format but I presume it will be a easy fix?

-Yi

links to other ".org" files not exporting correctly

Hi,
I noticed that links to other ".org" files are not correctly exported:
[[file:somefile.org]]
is exported to
'somefile. <somefile.>'_

Normally we would expect it to create something like 'somefile.rst <somefile.rst>'_ right ?

Not possible to provide custom link text for internal links

When using a CUSTOM_ID property, if a reference like [[#myid][text to display]] is used, then instead of the exported document having text to display appear for the link, only myid appears. Also, when just [[#myid]] is used, the exported link only displays myid and not the name of the headline possessing this id.

Multi-line footnotes

Thanks for this package!

I have installed ox-nikola (and therefore ox-rst) via MELPA.

Whenn footnotes span over multiple lines, the second and subsequent line are not indented so there are errors in the resulting html.

org input:

Testtext[fn:1]

[fn:1] First line of footnote text
    Second line of footnote text
    Third line of footnote text

rst output:

Testtext [1]_ 


.. [1] First line of footnote text
Second line of footnote text
Third line of footnote text

Is this a bug or is there another way to achieve the desired output?

Thanks and best regards
Stefan

Using ox-rst as a cli script

Hi,

Has anyone tried using ox-rst as a cli script?

I'd like to just run a script from the command line that is called org2rst
and uses ox-rst underneath. So, an elisp script.

#+Latex_header not being copied to rst file

Since I have a lot of latex in my org files, I routinely have lines at the beginning like

#+latex_header: \newcommand{\BB}{\mathbb{B}}

These definitions are necessary for the TeX to be formatted properly. They aren't however being copied into the generated rst file. I have org-version 9.0.5 in emacs 26.3 and ox-rst-20191013.551

Error attempting to install package in spacemacs

I'm a bit of a newcomer to the emacs ecosystem, so please forgive me if this is just user error.

Attempting to install the package in spacemacs results in the following error:
An error occurred while installing ox-rst (error: (error Package ‘emacs-26.1’ is unavailable))

I have tried in the user configuration section of .spacemacs

  1. (use-package ox-rst :ensure t)
  2. (use-package ox-rst :ensure nil)
  3. (require 'ox-rst)

I have also tried (what feels like the more idiomatically correct spacemacs method) of adding ox-rst to the dotspacemacs-additional-packages function in .spacemacs.

Unable to Export files with hyperlinks

When I try to export any file with a hyperlink:

This an example [[http://orgmode.org][Org Mode]].

I get the error:

Symbol's value as variable is void: org-link-escape-chars-browser

I found a commit message (for org) saying that this variable has been removed - http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=adcaf91648c1af347be28af5372df607808fe49d - but I don't know where it's referenced.

I had melpa set up so I don't know the exact version number of org-mode I had installed, but it was dated December 24, 2016 and I'm using emacs 26.0.50.2.

Org literals using colon notation are not converted well

Here are a couple of examples from the org manual

* This literal works well

#+BEGIN_EXAMPLE
Some example from a text file.
#+END_EXAMPLE

* This literal does not work well

Here is an example
    : Some example from a text file.

One problem here is that the second pair of back-ticks ends up on a line by itself.

``Some example from a text file.
``

The last commit (my-org-export-inline-image-p) fails with (wrong-type-argument stringp nil)

Debugger entered--Lisp error: (wrong-type-argument stringp nil) |
string-match(".(jpeg|jpg|png|gif|svg|svgz|swf)'" nil) |
#[(rule) "\302^HA "\205\f^@\303\304\305"\207" [rule link string-match throw exit t] 3](%28"file" .))
mapc(#[(rule) "\302^HA "\205\f^@\303\304\305"\207" [rule link string-match throw exit t] 3](%28"file" .) ("fuzzy" . ".(jpeg|jpg|png|gif|svg|svgz|swf)'") ("http" . ".(jpeg|jpg|png|gif|svg|svgz|swf)'") ("https" . ".(jpeg|jpg|png|gif|svg|svgz$
byte-code("\301\302^H"\210\303\207" [rules mapc #[(rule) "\302^HA "\205\f^@\303\304\305"\207" [rule link string-match throw exit t] 3] nil] 3)
my-org-export-inline-image-p(nil (("file" . ".(jpeg|jpg|png|gif|svg|svgz|swf)'") ("fuzzy" . ".(jpeg|jpg|png|gif|svg|svgz|swf)'") ("http" . ".(jpeg|jpg|png|gif|svg|svgz|swf)'") ("https" . ".(jpeg|jpg|png|gif|svg|svgz|swf)'")))
org-rst-link((link (:type "HTTP" :path "//localhost:8080/api/v2" :raw-link "HTTP://localhost:8080/api/v2" :application nil :search-option nil :begin 1363 :end 1391 :contents-begin nil :contents-end nil :post-blank 0 :parent (paragraph (:begin 1285 :end 1392 :contents-begin 1285 :contents-end 1392 :post-blank 1 :post-affiliated 1285 :parent (section (:begin $
org-export-data((link (:type "HTTP" :path "//localhost:8080/api/v2" :raw-link "HTTP://localhost:8080/api/v2" :application nil :search-option nil :begin 1363 :end 1391 :contents-begin nil :contents-end nil :post-blank 0 :parent (paragraph (:begin 1285 :end 1392 :contents-begin 1285 :contents-end 1392 :post-blank 1 :post-affiliated 1285 :parent (section (:beg$
#[(element) "\302^H "\207" [element info org-export-data] 3](%28link %28:type "HTTP" :path "//localhost:8080/api/v2" :raw-link "HTTP://localhost:8080/api/v2" :application nil :search-option nil :begin 1363 :end 1391 :contents-begin nil :contents-end nil :post-blank 0 :parent %28paragraph %28:begin 1285 :end 1392 :contents-begin 1285 :contents-end 1392 :post-blan$
mapconcat%28#[%28element) "\302^H "\207" [element info org-export-data] 3] (#("The system is accessible via a REST API.\nThe base URL for all requests is " 0 40 (:parent (paragraph (:begin 1285 :end 1392 :contents-begin 1285 :contents-end 1392 :post-blank 1 :post-affiliated 1285 :parent (section (:begin 1285 :end 1393 :contents-begin 1285 :contents-end 1392 :p$
org-export-data((paragraph (:begin 1285 :end 1392 :contents-begin 1285 :contents-end 1392 :post-blank 1 :post-affiliated 1285 :parent (section (:begin 1285 :end 1393 :contents-begin 1285 :contents-end 1392 :post-blank 1 :parent (headline (:raw-value "REST API" :begin 1274 :end 12802 :pre-blank 0 :hiddenp outline :contents-begin 1285 :contents-end 12802 :lev$
#[(element) "\302^H "\207" [element info org-export-data] 3](%28paragraph %28:begin 1285 :end 1392 :contents-begin 1285 :contents-end 1392 :post-blank 1 :post-affiliated 1285 :parent %28section %28:begin 1285 :end 1393 :contents-begin 1285 :contents-end 1392 :post-blank 1 :parent %28headline %28:raw-value "REST API" :begin 1274 :end 12802 :pre-blank 0 :hiddenp outli$
mapconcat%28#[%28element) "\302^H "\207" [element info org-export-data] 3] ((paragraph (:begin 1285 :end 1392 :contents-begin 1285 :contents-end 1392 :post-blank 1 :post-affiliated 1285 :parent (section (:begin 1285 :end 1393 :contents-begin 1285 :contents-end 1392 :post-blank 1 :parent (headline (:raw-value "REST API" :begin 1274 :end 12802 :pre-blank 0 :hidd$
org-export-data((section (:begin 1285 :end 1393 :contents-begin 1285 :contents-end 1392 :post-blank 1 :parent (headline (:raw-value "REST API" :begin 1274 :end 12802 :pre-blank 0 :hiddenp outline :contents-begin 1285 :contents-end 12802 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :co$
#[(element) "\302^H "\207" [element info org-export-data] 3](%28section %28:begin 1285 :end 1393 :contents-begin 1285 :contents-end 1392 :post-blank 1 :parent %28headline %28:raw-value "REST API" :begin 1274 :end 12802 :pre-blank 0 :hiddenp outline :contents-begin 1285 :contents-end 12802 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-bl$
mapconcat%28#[%28element) "\302^H "\207" [element info org-export-data] 3] ((section (:begin 1285 :end 1393 :contents-begin 1285 :contents-end 1392 :post-blank 1 :parent (headline (:raw-value "REST API" :begin 1274 :end 12802 :pre-blank 0 :hiddenp outline :contents-begin 1285 :contents-end 12802 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil$
org-export-data((headline (:raw-value "REST API" :begin 1274 :end 12802 :pre-blank 0 :hiddenp outline :contents-begin 1285 :contents-end 12802 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :quotedp nil :CATEGORY "howto" :title (#("REST API" 0 8 (:parent #0))) :parent (o$
#[(element) "\302^H "\207" [element info org-export-data] 3](%28headline %28:raw-value "REST API" :begin 1274 :end 12802 :pre-blank 0 :hiddenp outline :contents-begin 1285 :contents-end 12802 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp nil :quotedp nil :CATEGORY "howto" :t$
mapconcat%28#[%28element) "\302^H "\207" [element info org-export-data] 3] ((headline (:raw-value "Install" :begin 1 :end 810 :pre-blank 0 :hiddenp outline :contents-begin 19 :contents-end 810 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp 0 :quotedp nil :CATEGORY "howto" :titl$
org-export-data((org-data nil (headline (:raw-value "Install" :begin 1 :end 810 :pre-blank 0 :hiddenp outline :contents-begin 19 :contents-end 810 :level 1 :priority nil :tags nil :todo-keyword nil :todo-type nil :post-blank 1 :footnote-section-p nil :archivedp nil :commentedp 0 :quotedp nil :CATEGORY "howto" :title (#("Install" 0 7 (:parent #1))) :parent #$
org-export-as(rst nil nil nil (:output-file "./howto.rst")) |
org-export-to-file(rst "./howto.rst" nil nil nil nil nil) |
org-rst-export-to-rst(nil nil nil nil) |
org-export-dispatch(nil) |
#(org-export-dispatch nil nil) |
funcall(# org-export-dispatch nil nil) |
(with-no-warnings (funcall ad--addoit-function function record-flag keys)) |
(setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))
(let ((ido-ubiquitous-next-override (ido-ubiquitous-get-command-override function))) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys))))
(ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys))))
(let (ad-return-value) (ido-ubiquitous-with-override (ido-ubiquitous-get-command-override function) (setq ad-return-value (with-no-warnings (funcall ad--addoit-function function record-flag keys)))) ad-return-value)
ad-Advice-call-interactively(# org-export-dispatch nil nil)
apply(ad-Advice-call-interactively # (org-export-dispatch nil nil))
call-interactively(org-export-dispatch nil nil) |
command-execute(org-export-dispatch)

Can ox-rst export arbitrary fields?

rst supports arbitrary fields (date, author, etc are examples). However, I do not see any way to add arbitrary fields through org mode. It supports some (date, author, etc). But what if I want a field called "Blah"?

My use case is that I'm using ox-rst to export org docs to rst for use in a static site generator. Each post should have a Tags field (think blog posts). Right now I have to hand edit the .rst file that ox-rst produces, which is a pain.

definition is void: org-define-error

Upon installing ox-rst with package-install, I get an error buffer with the message:

ox-rst.el:33:1:Error: Symbol’s function definition is void: org-define-error

I'm running Emacs 25.1.1 on Ubuntu and org-version yields Org-mode version 9.1.6 (9.1.6-57-gec8590-elpa @ /redacted/.emacs.d/elpa/org-20180219/)

Any idea of how to fix?

Wrong type argument: sequencep, :input-buffer

Hi,

When I try to use ox-rst to convert a org file to rst format, it throw this error:

Wrong type argument: sequencep, :input-buffer

A minimal example is

* Headline 
A sentence 

If the org file has a table, I will get this error:

org-at-table.el-p: Symbol's function definition is void: org-table-begin

I am using org-mode 8.3beta, and ox-rst is installed from melpa.

ATTR_RST not exported for images

There seems to be some problem with #+ATTR_RST not being exported for images. Example:

#+title: Test RST image export
#+author: Jan Janský

Attrs fail here:

#+attr_rst: :width 50% :align center
[[./Desktop/image.jpg]]

But work fine here:

#+attr_rst: :margin 2
#+begin_quote
Just a quote.
#+end_quote

is exported as

=====================
Test RST image export
=====================

    :Author: Jan Janský

.. contents::

Attrs fail here:

.. image:: ./Desktop/image.jpg

But work fine here:

  Just a quote.

I am using orgmode v. 9.1.9 on Debian/Linux Emacs v. 26.1 and ox-rst from melpa v. 20190813.427.

Thanks, best regards,
Jan Janský

Links prepended with "c:" under Windows

When exporting a link of the form [[/images/test.png]] under Win10 (I don't have a choice at work), the resulting rst is .. image:: c:/images/test.png.

My indended result would be: .. image:: /images/ex-lst-lang.PNG

Are my expectations wrong or can that be fixed?

Thanks a lot!

Stefan

Not working with Org version 9.1?

I just installed the latest version of ox-rst (20170418.758) via the Emacs packages facilities, and added the following to an otherwise empty ~/.emacs (just to make sure).

(require 'ox-rst)

When trying to export from within org-mode using C-c C-e, I get the usual export menu, but no rst option shows up. Also, calling org-rst-export-to-rst directly results only in the following message.

Unknown "nil" back-end: Aborting export

My Emacs (Aquamacs 3.3 GNU Emacs 25.1.1) has only loaded a few other packages incl. org-mode version 9.1 (package 20170911). BTW: I found it confusing that the Readme at https://github.com/masayuko/ox-rst says "Ox-Rst relies on the Org-mode 9.0 export framework", while the actual source of ox-rst.el says "Package-Requires: ((emacs "24.4") (org "8.2.4"))".

For completeness, I tried other additional exporters like ox-pandoc, and those work.

What am I missing?

Thank you!

Best,
Torsten

Tables

Hi again,

By the way, ox-rst is great, really working really well except for this one issue.

It appears to me that ox-rst will only properly create rst tables if there are lines around all elements.

ie

| top | right |
| here | there |

will not be converted properly, but

|-------+--------|
| top | right |
|-------+--------|
| here | there |
|-------+--------|

will be converted properly.

For example, the following will also not be converted properly

|-------+--------|
| top | right |
| here | there |
|-------+--------|

Larrabee

Multiple links with same label/name lead to an invalid reST file.

Export of two or more org links with same name/label results in an invalid reST file. This is caused by ox-rst exporting references as named links instead of anonymous links.

Thus this .org notation:

[[https://example.com][this]] and [[http://example2.com][this]]

is exported as

`this <https://example.com>`_ and `this <http://example2.com>`_

creating an invalid reST file.

The solution would be to

  1. use anonymous links only, or
  2. use named link only in the first reference.

and thus to export the above fragment like this:

`this <https://example.com>`__ and `this <http://example2.com>`__

Thanks and regards,
Jan Janský

Newlines in direct quoting of RST code

Here is an example from the org manual for exporting quoted LaTeX ---

This is the line right before.
#+LATEX: Literal LaTeX code for export
This is the line right after.

That gets exported as

This is the line right before.     
Literal LaTeX code for export
This is the line right after.

When I do the analogous export to rst, of these lines

This is the line right before.     
#+RST: Literal RST code for export
This is the line right after.

The resulting rst has extra newlines, making unwanted paragraphs.

This is the line right before.     

Literal RST code for export

This is the line right after.

Why are Date, etc fields indented?

Context: I use Pelican (http://docs.getpelican.com/en/stable/) for my static site generator. It takes in several input formats (rst, md, etc).

I write my posts in rst, but really want to use org. Hence, ox-rst.

My ideal workflow would be where I can just write in Org, and export without having to edit the final rst file. Where this fails is the fact that fields like "Date" are indented in the output ox-rst produces.

I honestly don't know if Pelican is at fault, or ox-rst is not conforming. But is there a way to have the date not be indented so that I need not manually edit the rst files?

Thanks,

Error handling emacs-lisp source blocks

When I export my org document to the rst format, the source blocks of 'emacs-lisp' are converted to'commonlisp'. However, this has to be 'common-lisp' or 'lisp', or emacs-lisp for the pygments exporter to work correctly for using readthedocs.

Grepping through the package code, I see that the conversion definition is correct. Why am I getting the export as commonlisp ?

I tried using ox-pandoc as well, org-pandoc-export-as-rst, but have the same export result as 'commonlisp'. The repo in question is my dotemacs config https://github.com/shrysr/dotemacs/

How can I remove numbering before each item?

On the generated rst file there is numbering items before each item like:

1.2 Prerequisites
~~~~~~~~~~~~~~~~~

1.3 Using Docker
~~~~~~~~~~~~~~~~

1.4.1.2 Create app
~~~~~~~~~~~~~~~~~~

Is it possible to remove the numbering before all items like:

Prerequisites
~~~~~~~~~~~~~

Using Docker
~~~~~~~~~~~~~

Create app
~~~~~~~~~~

Prefixing problem when org-export-preserve-breaks is set

When org-export-preserve-breaks is set and I try to export org file below:

    #+OPTIONS: H:1 ^:nil toc:nil num:nil creator:nil author:nil
    This is a test org file for ox-rst preserve-breaks option.
    Each line of this paragraph expects to be prefixed by "| ".
    * Header 1. Prefix not expected.
    Paragraph under Header-1.
    It might include some *bold* or /italic/ words. 
    Prefix expected.
    - Item-1 Prefix not expected.
      - Item-2 Prefix not expected.
    ** Header-2 Prefix not expected.
    Single line paragraph. Prefix not expected.

I expect the following:

    | This is a test org file for ox-rst preserve-breaks option.
    | Each line of this paragraph expects to be prefixed by "| ".

    Header 1. Prefix not expected.
    ------------------------------

    | Paragraph under Header-1.
    | It might include some **bold** or *italic* words. 
    | Prefix expected.

    - Item-1 Prefix not expected.

      - Item-2 Prefix not expected.

    Header-2 Prefix not expected.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Single line paragraph. Prefix not expected.

However I actually get the following:

    | This is a test org file for ox-rst preserve-breaks option.
    | Each line of this paragraph expects to be prefixed by "| ".
    | 

    | Header 1. Prefix not expected.
    --------------------------------

    | Paragraph under Header-1.
    | It might include some **| bold** | or *| italic* | words. 
    | Prefix expected.
    | 

    - | Item-1 Prefix not expected.
      | 

      - | Item-2 Prefix not expected.
        |

    | Header-2 Prefix not expected.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    | Single line paragraph. Prefix not expected.
    |

Unlike Markdown requiring the mark to keep line break at the end of the line, reStructuredText requires it at the beggining of the line.
Given the result above, org-mode export framework divides text into small pieces of plain-texts, such as bolded string and the body of the items, so I think prefixing "| " to the lines should be done in org-rst-paragraph.

rst export doesn't do ID links.

  • headline
    :PROPERTIES:
    :ID: customid
    :END:

    Internal cross references, headline [[id:customid][something else]]

Generates:

Immanuel Litzroth

:Author: Immanuel Litzroth

.. contents::

1 headline

Internal cross references, headline customid_

org-element-insert-before

C-c C-e r r just generates an error:

Symbol's function defniition is void: org-element-insert-before

Note: Exporter menu is present for Export to reStructuredText

org-element-insert-before is defined on org-element.el in earlier versions of org-mode, but not in 8.2.10??

:number-lines: 0

Hello,

When I want to export I have this line that starts in the code block. ":number-lines: 0". I would like to turn this off because this break me problems with readthedocs.io (the code does not appear)

Here is my sample code org

#+BEGIN_SRC restclient :exports results :var urlws="http://127.0.0.1" secret="secret" id-instance="BPJ92"
 POST :urlws/myalerts?id-instance=:id-instance&secret=:secret
 #+END_SRC

 #+RESULTS:
 #+BEGIN_SRC js
 [
   {
     "id": 1,
     "title": "A Title 1",
     "message": "A message lorem lipsum alert 1",
     "destination": "local",
     "deleteurl": "http://127.0.0.1/delete/1/"
   },
   {
     "id": 2,
     "title": "A Title 2",
     "message": "A message lorem lipsum alert 2",
     "destination": "local",
     "deleteurl": "http://127.0.0.1/delete/2/"
   }
 ]
 // POST http://127.0.0.1/myalerts?id-instance=BPJ92&secret=secret
 // HTTP/1.1 200 OK
 // Host: 127.0.0.1
 // Connection: close
 // X-Powered-By: PHP/7.0.12
 // Access-Control-Allow-Origin: *
 // Cache-Control: no-cache
 // Content-Type: application/json
 // Date: Mon, 24 Oct 2016 17:16:33 GMT
 // Request duration: 0.017809s
 #+END_SRC

after export :

.. code-block:: js
    :number-lines: 0

    [
      {
        "id": 1,
        "title": "A Title 1",
        "message": "A message lorem lipsum alert 1",
        "destination": "local",
        "deleteurl": "http://127.0.0.1/delete/1/"
      },
      {
        "id": 2,
        "title": "A Title 2",
        "message": "A message lorem lipsum alert 2",
        "destination": "local",
        "deleteurl": "http://127.0.0.1/delete/2/"
      }
    ]
    // POST http://127.0.0.1/myalerts?id-instance=BPJ92&secret=secret
    // HTTP/1.1 200 OK
    // Host: 127.0.0.1
    // Connection: close
    // X-Powered-By: PHP/7.0.12
    // Access-Control-Allow-Origin: *
    // Cache-Control: no-cache
    // Content-Type: application/json
    // Date: Mon, 24 Oct 2016 17:28:32 GMT
    // Request duration: 0.017208s

https://github.com/masayuko/ox-rst/blob/master/ox-rst.el#L1346

Thank you for this plugin. Regards

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.