GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 更簡潔的 reST 的 literal block 標記語法 · python/python-docs-zh-tw · Discussion #568

更簡潔的 reST 的 literal block 標記語法 #568

Closed
mattwang44 started this conversation in General
更簡潔的 reST 的 literal block 標記語法 #568
@mattwang44 mattwang44
Aug 9, 2023 · 2 comments · 5 replies
Return to top
Discussion options
  • Uh oh!

    There was an error while loading. Please reload this page.

  • Uh oh!

    There was an error while loading. Please reload this page.

mattwang44
Aug 9, 2023
Maintainer

TL;DR

當原文以 :: 結尾時,希望譯文內用使用 : ::(全形冒號 x1+空格 x1+半形冒號 x2)就好。

Background

README 中有一段敘述 :: 的用法(如下圖):

image

也就是說當我們看到原文以 :: 結尾時,應該要像這樣翻譯:

msgid "blah blah::"
msgstr ""
"blah blah:\n"
"\n"
"::"

這樣的建議是完全正確的,因為 rst 會需要 :: 來確定接續的段落不是一個 rst markup 的 block(像是 code block),但是這樣的多行寫法並不是很方便。

根據 rst 文件,(英文)標示 literal block 有三種語法:

1st:

::

    literal block
2nd: ::

    literal block
3rd::

    literal block

其中 :: 若前面為 line break 或空格則不會被 render、但若作為一個段落的結尾則為 render 成單個 colon。

所以在中文譯文當中,除了這種基於上述第一種的寫法(也就是 readme 建議的寫法)外

1st:

::

    literal block

也可以基於上述第二種寫法寫成下面這樣

2nd: ::

    literal block

也就是說在 po file 中看到原文以 :: 結尾時,只要像以下這樣翻譯,就能顯示全形冒號並且同時成功標記接下來的段落是一個 literal block

msgid "blah blah::"
msgstr "blah blah: ::"
You must be logged in to vote
All reactions

Replies: 2 comments · 5 replies

Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

rockleona
Aug 9, 2023
Collaborator

原來還有這個寫法!我對於 rst 的認知真的太淺了

如果可以這樣寫的話我支持進行更改

我也想要自己實際測試看看能不能成功

You must be logged in to vote
All reactions
2 replies
@rockleona
Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

rockleona Aug 9, 2023
Collaborator

酷!語法檢查通過也有順利 render

image
image

All reactions
@mattwang44
Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

mattwang44 Aug 15, 2023
Maintainer Author

補充一下,這樣的實驗方式其實是有問題的XD
sphinx 在 build html 的流程看起來應該是先根據原文 render 再將字串替換成譯文,所以修改譯文其實不會影響 html 顯示(但修改 rst 原文就會)。
#542 (comment)

All reactions
Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

ken71301
Nov 29, 2023
Collaborator

這邊要更新到readme嗎

You must be logged in to vote
All reactions
3 replies
@rockleona
Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

rockleona Nov 29, 2023
Collaborator

支持更新,這次 meetup 的時候有人遇到這個問題,
感覺簡潔版的寫法可以取代原有寫法,也比較和原文 (msgid) 的寫法較為相近

All reactions
@mattwang44
Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

mattwang44 Nov 29, 2023
Maintainer Author

feel free to update the readme 🙏🏽

All reactions
@ken71301
Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

ken71301 Dec 30, 2023
Collaborator

先 update 到 wiki摟
https://github.com/python/python-docs-zh-tw/wiki/rST-%E7%89%B9%E6%AE%8A%E8%AA%9E%E6%B3%95%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A0%85

All reactions
  • ❤️ 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💬
General
Labels
None yet
3 participants
@mattwang44 @ken71301 @rockleona
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.