Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing terms in plural without the redundancy

I often have the situation that I want to link a term to the glossary but state the term in plural.

So normally you do something like this in singular:

Some text before the term :term:`important word` then the stuff after the term

This is considered a completely different term:

Some text before the term :term:`important words` then the stuff after the term

This doesn't get parsed:

Some text before the term :term:`important word`s then the stuff after the term

And this is very redundant (but the only choice I have with my current knowledge):

Some text before the term :term:`important words<important word>` then the stuff after the term

Is there another way to write a term in plural without needing to state the term twice?

like image 938
erikbstack Avatar asked Oct 16 '13 12:10

erikbstack


1 Answers

I'm facing the same problem. I'm no expert, but here's what I've found (partially overlapping your own findings):

.. won't resolve to "foo"
:term:`foos`

.. reST doesn't parse the string
:term:`foo`s

.. ugly markup and gives different formatting for "foo" and "s"
:term:`foo`\ s

.. redundant and verbose, but most versatile
:term:`foos<foo>`

While the penultimate pattern will work, kinda, the last one really is what you want. Not only does it format the plural "s" the same as the rest of the word (unlike :term:`foo`\ s, which may give you something like foos), but it works when the plural isn't just a simple concatenation. E.g. consider directory/directories, or datum/data. For these cases, a full rewrite mechanism is best.

You can make your document less verbose by defining substitutions:

.. |foos| replace:: :term:`foos<foo>`

Then anywhere you want the plural "foos", you can write the substitution reference (see the previous link) |foos|, and the document processor will treat it like :term:`foos<foo>`


References:

https://sourceforge.net/p/docutils/mailman/message/31536488/

like image 98
goodmami Avatar answered Nov 13 '22 02:11

goodmami