Discussion:
[Docutils-users] space in front of footnotes?
Matěj Cepl
2015-08-17 22:06:35 UTC
Permalink
Hi, I cannot find on
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#footnotes
concise explanation about the relationship between whitespace
and footnotes. Consider this paragraph (obviously all examples
are not indendent in the original):

There was a feeling of vanity and that lead me to the
theological mediation about the dying church.[#]_

However, I don’t want to have a space between the period
character and the footnote label. When I write the rST source
like this, rst2html (both 0.11 and 0.12 version) doesn’t
recognize the footnote label as such, so I get in literally the
footnote label:

<p>There was a feeling of vanity and that lead me to the
theological mediation about the dying church.[#]_</p>

When I change the source to

There was a feeling of vanity and that lead me to the
theological mediation about the dying church. [#]_

I get the footnote but with the space in front of it:

<p>There was a feeling of vanity and that lead me to the
theological mediation about the dying church. <a
class="footnote-reference" href="#id8" id="id2">[1]</a></p>

How can I get the footnote without the space in front of it?

Thanks for any reply,

Matěj
--
http://www.ceplovi.cz/matej/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

Faithful love is what people look for in a person; ...
-- Proverbs 19:22 (NJB)
Matěj Cepl
2015-08-17 22:13:51 UTC
Permalink
Post by Matěj Cepl
How can I get the footnote without the space in front of it?
Oh, I got it. I have to add to docutils configuration:

[restructuredtext parser]
trim_footnote_reference_space=yes

Why in the world is this not a default?

Matěj
--
http://www.ceplovi.cz/matej/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

understand, v.:
To reach a point, in your investigation of some subject, at
which you cease to examine what is really present, and
operate on the basis of your own internal model instead.


------------------------------------------------------------------------------
Guenter Milde
2015-08-18 07:49:10 UTC
Permalink
Post by Matěj Cepl
Post by Matěj Cepl
How can I get the footnote without the space in front of it?
[restructuredtext parser]
trim_footnote_reference_space=yes
Why in the world is this not a default?
Probabely because it was introduced later and backwards compatibility was a
priority.

Also, with "bracket footnotes" [1] instead of superscript ones² you may
want to keep the space.

Footnote references are by default "bracket" in HTML and "superscript" in
LaTeX.
http://docutils.sourceforge.net/docs/user/config.html#footnote-references
http://docutils.sourceforge.net/docs/user/config.html#footnote-references-latex2e-writer

However, you are free to set your own defaults in a system-wide or user-
config file.
http://docutils.sourceforge.net/docs/user/config.html#configuration-files

Also, there is the possibilty to escape the required whitespace like
this.\ [#]_

Günter


[1] this looks like a citation in a scientific article

² this looks like a footnote in a scientific article


------------------------------------------------------------------------------
Matěj Cepl
2015-08-18 09:59:26 UTC
Permalink
Post by Guenter Milde
Also, with "bracket footnotes" [1] instead of superscript
ones² you may want to keep the space.
Footnote references are by default "bracket" in HTML and
"superscript" in LaTeX.
I had an epiphany right now (again) … docutils maintainers are
a way more smart than I am!

Thanks,

Matěj
--
http://www.ceplovi.cz/matej/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

Experience is what you get when you don't get what you want.
-- Dan Stanford


------------------------------------------------------------------------------
Gour
2015-08-18 10:24:18 UTC
Permalink
Post by Guenter Milde
However, you are free to set your own defaults in a system-wide or user-
config file.
http://docutils.sourceforge.net/docs/user/config.html#configuration-files
Using:

[restructuredtext parser]
trim_footnote_reference_space=yes

in ~/.docutils this works, but I’ve tried with this one:

[html4css1 writer]
footnote_references="superscript"

and it does not work. Any hint?
Post by Guenter Milde
Also, there is the possibilty to escape the required whitespace like
this.\ [#]_
Thank you. Another very helpful info.

Sincerely,
Gour

p.s. Even after subscribing to the mailing list, posting via Gmane does
not work. Any idea?
--
But for one who takes pleasure in the self, whose human life
is one of self-realization, and who is satisfied in the self only,
fully satiated — for him there is no duty.
Matěj Cepl
2015-08-18 10:57:39 UTC
Permalink
Post by Matěj Cepl
Post by Guenter Milde
However, you are free to set your own defaults in a system-wide or user-
config file.
http://docutils.sourceforge.net/docs/user/config.html#configuration-files
[restructuredtext parser]
trim_footnote_reference_space=yes
[html4css1 writer]
footnote_references="superscript"
It works perfectly well for HTML and LaTeX, but I think I would
prefer ODT not to have space in front of the footnote label.
Post by Matěj Cepl
p.s. Even after subscribing to the mailing list, posting via
Gmane does not work. Any idea?
Didn’t you miss to reply to some confirmation email?

Matěj
--
http://www.ceplovi.cz/matej/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

The world is coming to an end! Repent and return those library
books!
Gour
2015-08-18 11:14:49 UTC
Permalink
Post by Matěj Cepl
It works perfectly well for HTML and LaTeX, but I think I would
prefer ODT not to have space in front of the footnote label.
What did you do for HTML, iow. how to use it?

I get:

***@atmarama ~/p/n/n/posts> rst2html --traceback how-what-to-preach.rst
Traceback (most recent call last):
File "/usr/bin/rst2html", line 23, in <module>
publish_cmdline(writer_name='html', description=description)
File "/usr/lib/python2.7/dist-packages/docutils/core.py", line 352, in publish_cmdline
config_section=config_section, enable_exit_status=enable_exit_status)
File "/usr/lib/python2.7/dist-packages/docutils/core.py", line 219, in publish
output = self.writer.write(self.document, self.destination)
File "/usr/lib/python2.7/dist-packages/docutils/writers/__init__.py", line 80, in write
self.translate()
File "/usr/lib/python2.7/dist-packages/docutils/writers/html4css1/__init__.py", line 176, in translate
self.document.walkabout(visitor)
File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 174, in walkabout
if child.walkabout(visitor):
File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 166, in walkabout
visitor.dispatch_visit(self)
File "/usr/lib/python2.7/dist-packages/docutils/nodes.py", line 1882, in dispatch_visit
return method(node)
File "/usr/lib/python2.7/dist-packages/docutils/writers/html4css1/__init__.py", line 992, in visit_footnote_reference
assert format == 'superscript'
AssertionError
Post by Matěj Cepl
Didn’t you miss to reply to some confirmation email?
Nope, no Gmane auth message received…


Sincerely,
Gour
--
The spirit soul bewildered by the influence of false ego thinks
himself the doer of activities that are in actuality carried out
by the three modes of material nature.
Matěj Cepl
2015-08-18 12:46:21 UTC
Permalink
Post by Gour
Post by Matěj Cepl
It works perfectly well for HTML and LaTeX, but I think I would
prefer ODT not to have space in front of the footnote label.
What did you do for HTML, iow. how to use it?
Put the source somewhere on the net. This::

rst2html --footnote-reference=superscript \
how_church_does_not_die_EN.rst >how_church_does_not_die_EN.html

works for me just fine. (source file on
https://gitlab.com/mcepl/madr/blob/master/jak_cirkev_neumira_EN.rst)

Best,

Matěj
--
http://www.ceplovi.cz/matej/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

A day without sunshine is like night.


------------------------------------------------------------------------------
Guenter Milde
2015-08-18 11:21:34 UTC
Permalink
Post by Matěj Cepl
Post by Guenter Milde
However, you are free to set your own defaults in a system-wide or user-
config file.
http://docutils.sourceforge.net/docs/user/config.html#configuration-files
[restructuredtext parser]
trim_footnote_reference_space=yes
[html4css1 writer]
footnote_references="superscript"
and it does not work. Any hint?
Use the `Config File Syntax`__ in the config file?

__ http://docutils.sourceforge.net/docs/user/config.html#configuration-file-syntax


With ::

[html4css1 writer]
footnote-references: superscript

and using the html4css writer (rst2html.py), it works here.

With ::

[writers]
footnote-references: superscript

it works also for rst2html5.py.
Post by Matěj Cepl
p.s. Even after subscribing to the mailing list, posting via Gmane does
not work. Any idea?
It may require one additional confirmation step (telling Gmane that
posting is OK). I don't recall the actual procedure but I use my
news-reader via Gmane for reading and posting both docutils-user and
docutils-devel.

Günter
Gour
2015-08-18 12:26:30 UTC
Permalink
Post by Guenter Milde
Use the `Config File Syntax`__ in the config file?
Ahh, thank you. I did mis it. :-(
Post by Guenter Milde
[html4css1 writer]
footnote-references: superscript
and using the html4css writer (rst2html.py), it works here.
Here I get superscript in the running text, but the footnote reference
is still in brackets, iow.

[1] this text belongs to the footnote..

Is it normal?
Post by Guenter Milde
It may require one additional confirmation step (telling Gmane that
posting is OK).
Most of the lists I follow is via Gmane, but, somehow, I haven’t receive
its authorization message for this list.
Post by Guenter Milde
I don't recall the actual procedure but I use my news-reader via Gmane
for reading and posting both docutils-user and docutils-devel.
OK. Thank you for confirmation, although for now I have to post
directly. :-(


Sincerely,
Gour
--
While contemplating the objects of the senses, a person
develops attachment for them, and from such attachment lust
develops, and from lust anger arises.
Guenter Milde
2015-08-20 09:41:53 UTC
Permalink
Post by Gour
Post by Guenter Milde
Use the `Config File Syntax`__ in the config file?
Ahh, thank you. I did mis it. :-(
Post by Guenter Milde
[html4css1 writer]
footnote-references: superscript
BTW, it is also possible to use the "=" like ::

[writers]
footnote-references=superscript

However, quoting the value leads to errors.
Post by Gour
Post by Guenter Milde
and using the html4css writer (rst2html.py), it works here.
Here I get superscript in the running text, but the footnote reference
is still in brackets, iow.
[1] this text belongs to the footnote..
Is it normal?
It is the "state of the art". Currently, only the reference is set as
superscript.


OTOH, leading style guides say that the label should match in footnote
reference and footnote itself:

example [1] text

----
[1] example note

or
example² text

----
² example note

For superscript labels, there is also the recommendation to set the label in
normal size and position before the footnote:

example³ text

----
3 example note


I would like to implement this in the new "html_plain" writer.

Question for the developers: should this be "hard-coded" or as a class value
for styling with CSS?

hard-coded: put [ and ] into the text

+1 safe, works also without CSS

CSS-rules: use ``:before:`` and ``:after:`` pseudo-classes for [ and ]

+1 customizable (can be changed by local style-sheet)

The implementation via CSS rules would also allow to open up the set of
allowed values (currently "brackets" or "superscript"): any value could be
used (and added as class argument to the label), for "brackets" and
"superscript" we would provide default rules in the "required" style-sheet
``minimal.css``.

Günter




------------------------------------------------------------------------------
Matěj Cepl
2015-08-18 12:30:07 UTC
Permalink
Post by Gour
[html4css1 writer]
footnote-references: superscript
and using the html4css writer (rst2html.py), it works here.
From the same config documentation:

"name=value" is also accepted.

What’s the problem with the standard win.ini convention?
I thought that ConfigParser.ConfigParser should work with it
quite well?

Best,

Matěj
--
http://www.ceplovi.cz/matej/, Jabber: ***@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

A GOOD name is rather to be chosen than great riches.
-- Proverbs 22:1


------------------------------------------------------------------------------
Guenter Milde
2015-08-18 11:35:46 UTC
Permalink
Dear Matěj,
Post by Matěj Cepl
I cannot find on
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#footnotes
concise explanation about the relationship between whitespace
and footnotes.
The problem with whitespace regards not the footnote itself, but what
Docutils names `footnote references`_.

I added cross-links for these related entries. However, even the footnote
references section does not explain the whitespace issue - for this you
need to know that footnote references are an instance of "inline markup"
and hence adhere to the "inline markup recognition rules".

I agree that a concise explanation whold help and addet it. The crosslinked
version with a paragraph about whitespace before footnote references is now
in the repository (as restructuredtext.txt).



I would be glad, if a Docutils developer with the required expertise could
update the documentation pages (outdated also regarding the new HTML writer
(now "html-plain"/"rst2html5.py")).

Günter


.. _footnote references:
http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#footnote-references
Loading...