以复数形式书写没有冗余的术语 [英] Writing terms in plural without the redundancy

查看:36
本文介绍了以复数形式书写没有冗余的术语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常遇到这样的情况,我想将一个术语链接到词汇表,但用复数形式表述该术语.

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

这不会被解析:

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

是否有另一种方法可以用复数形式写一个术语而无需重复该术语?

推荐答案

我面临同样的问题.我不是专家,但这是我的发现(部分与您自己的发现重叠):

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>`

虽然倒数第二个模式会起作用,但最后一个确实是您想要的.它不仅将复数s"的格式与单词的其余部分相同(与 :term:`foo`\s 不同,它可能会给你类似 foos),但当复数不只是简单的连接时它有效.例如.考虑目录/目录,或数据/数据.对于这些情况,最好采用完整的重写机制.

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>`

然后在任何你想要复数foos"的地方,你可以写替换引用(见前面的链接)|foos|,文档处理器会处理它喜欢 :term:`foos`

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>`

参考文献:

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

这篇关于以复数形式书写没有冗余的术语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆