Discussion:
[Docutils-users] strikeout and hyperlinks
Gour
2016-12-23 09:30:19 UTC
Permalink
Hello,

I've a need for strikeout text in some of my blog posts that I migrate to
Nikola static-site-generator using rst markup...

I've the following in my post:

+---------------------+
.. role:: strike
:class: strike

Here are few things to do:

- :strike:`point which is already done in our `archive
<http://www.example.com/archive/>` which contains mp3 files`

- another point

+-----------------+
but that does not work. If I replace the above hyperlink with:

.. archive: httpi://www.example.com/archive

and then write item list as:

- :strike:`point which is already done in our archive_ which contains
mp3 files`

then the whole item's text is striked-out, but I lose the hyperlink for
the 'archive'.


Do you have any suggestion in rst for something simple as:

+---------------------------+
Here are few things to do:

- ~~point which is already done in our [archive]( <http://www.example.com/archive/)
which contains mp3 files~~

- another point

+------------------+

when written in Markdown and rendered as:

<p>Here are few things to do:</p>
<ul>
<li><p><del>point which is already done in our
<a href="%3Chttp://www.example.com/archive/">archive</a> which contains
mp3 files</del></p></li>
<li><p>another point</p></li>
</ul>


Sincerely,
Gour
--
When your intelligence has passed out of the dense forest
of delusion, you shall become indifferent to all that has
been heard and all that is to be heard.



------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Guenter Milde
2016-12-23 17:18:06 UTC
Permalink
Post by Gour
Hello,
I've a need for strikeout text in some of my blog posts that I migrate to
Nikola static-site-generator using rst markup...
.. role:: strike
:class: strike
BTW: There is no need for the :class: argument in this case (the class
defaults to the role name if not explicitely given).
Post by Gour
but that does not work.
You missed the trailing _ in the link, but most importantly:

.. note:: Docutils does not support nested inline markup!

This is an unfortunate, long known limitation and TODO item. It holds for
both, pre-defined and custom roles as well as substitutions and links.
...

You may consider giving the strikeout class to the list item:

Things to consider:

- .. class:: strike

point which is already done in our `archive
<http://www.example.com/archive/>`_ which contains mp3 files


Alternatively, you could strike out with Unicode:

- point which is a̶l̶r̶e̶a̶d̶y̶ ̶d̶o̶n̶e̶ ̶i̶n̶ ̶o̶u̶r̶ `a̶r̶c̶h̶i̶v̶e̶
<http://www.example.com/archive/>`_ which contains mp3 files


Günter
Gour
2016-12-25 10:09:17 UTC
Permalink
On Fri, 23 Dec 2016 17:18:06 +0000 (UTC)
Post by Guenter Milde
BTW: There is no need for the :class: argument in this case (the class
defaults to the role name if not explicitely given).
Thank you - learnt something new. ;)
Post by Guenter Milde
This is an unfortunate, long known limitation and TODO item. It holds
for both, pre-defined and custom roles as well as substitutions and
links.
Is there any chance that this feature is going to be added in the
foreseeable future?
Post by Guenter Milde
...
- .. class:: strike
point which is already done in our `archive
<http://www.example.com/archive/>`_ which contains mp3 files
That one looks pretty good. Thanks a lot!


Sincerely,
Gour
--
He who is satisfied with gain which comes of its own accord, who
is free from duality and does not envy, who is steady in both
success and failure, is never entangled, although performing actions.



------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Gour
2016-12-25 10:19:40 UTC
Permalink
On Fri, 23 Dec 2016 17:18:06 +0000 (UTC)
I played with it a bit, but the problem is that it works as long as one
needs to apply class to the *whole* list item, but, afaict, it fails
when one needs to be applied only to the part of the sentence, right?


Sincerely,
Gour
--
Therefore, without being attached to the fruits of activities,
one should act as a matter of duty, for by working without
attachment one attains the Supreme.



------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
David Goodger
2016-12-23 17:53:15 UTC
Permalink
Post by Gour
I've a need for strikeout text in some of my blog posts that I migrate to
Nikola static-site-generator using rst markup...
+---------------------+
.. role:: strike
:class: strike
- :strike:`point which is already done in our `archive
<http://www.example.com/archive/>` which contains mp3 files`
There is a workaround to reST limitation regarding nested inline
markup that allows you to style a hyperlink reference, described here:
http://docutils.sourceforge.net/FAQ.html#is-nested-inline-markup-possible.

This is how you'd do the example above:

:strike:`point which is already done in our` |archive|_ :strike:`which
contains mp3 files`

.. |archive| replace:: :strike:`archive`
.. _archive: http://www.example.com/archive/

Note that you'd have to break up your sentence into 3 pieces.

Also, if you use your strikeout role a lot, you can set it as the
default interpreted text role and use `this syntax`:
http://docutils.sourceforge.net/docs/ref/rst/directives.html#setting-the-default-interpreted-text-role

David Goodger
<http://python.net/~goodger>

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
_______________________________________________
Docutils-users mailing list
Docutils-***@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.
Saša Janiška
2016-12-25 10:22:23 UTC
Permalink
On Fri, 23 Dec 2016 11:53:15 -0600
Post by David Goodger
Note that you'd have to break up your sentence into 3 pieces.
That looks too obtrusive to me and it seems better to just change gear
into markdown when such things are required until there is proper
support for nested markup in rst.


Sincerely,
Gour
--
The humble sages, by virtue of true knowledge, see with equal
vision a learned and gentle brāhmana, a cow, an elephant, a dog
and a dog-eater.
Continue reading on narkive:
Loading...