Merge pull request #30767 from geekpi/translating

translated
This commit is contained in:
geekpi 2024-01-11 08:38:40 +08:00 committed by GitHub
commit 94bf184087
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 151 additions and 151 deletions

View File

@ -1,151 +0,0 @@
[#]: subject: "Writing Docs with Kate"
[#]: via: "https://fedoramagazine.org/writing-docs-with-kate-and-git/"
[#]: author: "Hank Lee https://fedoramagazine.org/author/hankuoffroad/"
[#]: collector: "lujun9972/lctt-scripts-1700446145"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
Writing Docs with Kate
======
![][1]
Photo by [Daria Glakteeva][2] on [Unsplash][3]
Kate ( **K** DE **A** dvanced **T** ext **E** ditor) is a Free and Open Source text editor, available for Linux, Windows and macOS.
For documentation writers, the integrated Git features of Kate can help simplify the writing process. You do not need to remember Git commands and type them in the terminal every time you make changes to files or switch branches.
This article focuses on key features of Kate for contributors working on various Fedora documentation repositories. The capabilities can be extended to other documentation repositories.
### Preparations For Using Kate With Your Repository
1. Add SSH key to settings of your account on Pagure, GitLab or GitHub.
* On Pagure, go to My Settings SSH Keys Add SSH Key
* On GitLab, Preferences User Settings Add an SSH Key
* On GitHub, Settings SSH and GPG keys New SSH key
2. Fork a project: Go to the upstream repository and select the Fork button
3. Clone the repository
* In your forked repository, select Clone with SSH.
* Next, copy that link to your clipboard and paste it in GIT URL in terminal.
* When cloning a repository, you can specify the new directory name as an additional argument. $ git clone <GIT URL> new directory
4. Install Kate. If you are Linux users, go to the packager manager of your distro to install Kate. If you use Fedora Linux, we recommend the Fedora Linux RPM version or Flatpak.
### Sessions
Sessions in Kate text editor keep separate projects grouped together and help you work with multiple documentation repositories in a single view.
To save repositories in a session:
Go to the _File_ , pull down menu Select _Open folder_ Choose the cloned directory.
From the _Sessions,_ pull down menu Select _Save session_ Enter a session name Press OK.
On the left pane, click _project list_ saved to a new session Magazine. Next time you open Kate, the cloned repositories saved to the session will reappear.
![Sessions Menu][4]
### Using the Status Bar to checkout a branch
With Kate editor, you can switch branches or create a new branch on the status bar and pop-up screen.
The current branch is shown in the lower right corner in the status bar.
To create a new branch, select _Main_ branch.
From the popup menu select _Create New Branch_ and enter a new branch name.
![Popup menu showing Create New branch][5]
### Built-in support for AsciiDoc highlighting
Files with the AsciiDoc extension will automatically be highlighted using the rules in asciidoc.xml. You dont need to install external plugins.
### On-the-fly spell checking
If you want automatic spell checking as you type, press Ctrl + Shift + O. This key combination will toggle spell check on and off.
### Git toolview
The toolview on the left pane shows the git status of each open files.
![Show diff][6]
_Staged_ means the files are added (same as Git add) and will be committed if you select the **Commit** button at the top.
_Modified_ shows the changes that are not staged yet.
Click the _Commit_ button at the top of the left panel to show the diff for that commit. This will open the selected commit in the Commit toolview. If you want to see all the changes in the commit, right click and select _Show Full Commit_. Add a commit message.
_git push_ button is to the right of the _commit_ button. _git pull_ button is to the right of the git push button.
Select the _refresh_ icon (circular arrows) to see what has been going on with staged files and commits.
### Integrated terminal
Press _F4_ , or select the _terminal_ button, to toggle the integrated terminal on and off.
You may take your writing to the next level, ensure documentation quality, by using build scripts and Vale linter via the integrated terminal.
**Step 1. Run build scripts**
To check document quality locally, you may run build and preview scripts in the integrated terminal. Build and preview scripts let you view the changes exactly how it will be published in Docs pages through Antora static site generator.
Note: check the README page of your Fedora documentation repositories to use the correct file name for build scripts and instructions. The following is an example:
To build and preview the site, run:
$ ./docsbuilder.sh -p
The result will be available at <http://localhost:8080>
To stop the preview:
$ ./docsbuilder.sh -k
**Step 2. Run Vale on your text**
Vale is a command line tool that checks your text for adherence to a defined style guide. Run Vale locally referring [to the guide][7].
### Credits and acknowledgements
Big thanks to Nicco, a KDE developer, who provided me with a great deal of inspiration from his video tutorial channel [Nicco loves Linux][8].
Kate Version used in this article was 23.08.3
[Upstream documentation][9]
The following are Fedora documentation Git repos used in this article;
[Quick Docs][10]
[Kinoite User Docs][11]
[IoT User Docs][12]
[Documentation Contributors Guide][13]
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/writing-docs-with-kate-and-git/
作者:[Hank Lee][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/hankuoffroad/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2023/12/writing_w_kate-816x345.jpg
[2]: https://unsplash.com/@olenichek?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash
[3]: https://unsplash.com/photos/a-person-typing-on-a-laptop-on-a-desk-2w0IdiEI-hg?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash
[4]: https://fedoramagazine.org/wp-content/uploads/2023/12/1-multirepo-1024x418.png
[5]: https://fedoramagazine.org/wp-content/uploads/2023/12/2-branch-1024x493.png
[6]: https://fedoramagazine.org/wp-content/uploads/2023/12/4-Show-diff-1024x313.png
[7]: https://docs.fedoraproject.org/en-US/fedora-docs/contributing-docs/tools-vale-linter/
[8]: https://www.youtube.com/c/Niccol%C3%B2Ve
[9]: https://docs.kde.org/stable5/en/kate/kate/index.html
[10]: https://pagure.io/fedora-docs/quick-docs.git
[11]: https://pagure.io/fedora-kde/kinoite-docs.git
[12]: https://github.com/fedora-iot/iot-docs.git
[13]: https://gitlab.com/fedora/docs/community-tools/documentation-contributors-guide.git

View File

@ -0,0 +1,151 @@
[#]: subject: "Writing Docs with Kate"
[#]: via: "https://fedoramagazine.org/writing-docs-with-kate-and-git/"
[#]: author: "Hank Lee https://fedoramagazine.org/author/hankuoffroad/"
[#]: collector: "lujun9972/lctt-scripts-1700446145"
[#]: translator: "geekpi"
[#]: reviewer: " "
[#]: publisher: " "
[#]: url: " "
使用 Kate 编写文档
======
![][1]
照片由 [Daria Glakteeva][2] 在 [Unsplash][3] 上发布
Kate ( **K**DE **A**dvanced **T**ext **E**ditor) 是一款免费开源文本编辑器,适用于 Linux、Windows 和 macOS。
对于文档编写者来说Kate 集成的 Git 功能可以帮助简化编写过程。你无需记住 Git 命令,也无需在每次更改文件或切换分支时在终端中输入它们。
本文重点为从事各种 Fedora 文档仓库的贡献者介绍 Kate 的主要功能。这些功能可以扩展到其他文档仓库。
### 将 Kate 与你的仓库一起使用的准备工作
1. 将 SSH 密钥添加到 Pagure、GitLab 或 GitHub 上的帐户设置中。
* 在 Pagure 上,转到我的设置 SSH 密钥 添加 SSH 密钥
* 在 GitLab 上,首选项 用户设置 添加 SSH 密钥
* 在 GitHub 上,设置 SSH 和 GPG 密钥 新的 SSH 密钥
2. Fork 项目:转到上游仓库并选择 Fork 按钮
3. 克隆仓库
* 在你的分叉仓库中,选择“使用 SSH 克隆”。
* 接下来,将该链接复制到剪贴板并将其粘贴到终端中的 GIT URL 中。
* 克隆仓库时,你可以指定新目录名称作为附加参数。$ git clone <GIT URL> 新目录
4. 安装 Kate。如果你是 Linux 用户,请转到发行版的包管理器来安装 Kate。如果你使用 Fedora Linux我们推荐 Fedora Linux RPM 版本或 Flatpak。
### 会话
Kate 文本编辑器中的会话将单独的项目分组在一起,并帮助你在单个视图中处理多个文档仓库。
要将仓库保存在会话中:
转到_文件_下拉菜单 选择_打开文件夹_ 选择克隆的目录。
从_会话_下拉菜单中 选择_保存会话_ 输入会话名称 按确定。
在左侧窗格中单击_项目列表_保存到新会话“杂志”。下次打开 Kate 时,保存到会话中的克隆仓库将重新出现。
![Sessions Menu][4]
### 使用状态栏签出分支
使用 Kate 编辑器,你可以在状态栏和弹出屏幕上切换分支或创建新分支。
当前分支显示在状态栏的右下角。
要创建新分支,请选择 _Main_ 分支。
从弹出菜单中选择_创建新分支_并输入新分支名称。
![Popup menu showing Create New branch][5]
### 对 AsciiDoc 高亮显示的内置支持
具有 AsciiDoc 扩展名的文件将使用 asciidoc.xml 中的规则自动高亮显示。你不需要安装外部插件。
### 即时拼写检查
如果你希望在输入时自动进行拼写检查,请按 Ctrl + Shift + O。此组合键将打开和关闭拼写检查。
### Git 工具视图
左侧窗格中的工具视图显示每个打开文件的 git 状态。
![Show diff][6]
_Staged_ 表示文件已添加(与 Git 添加相同),并且如果你选择顶部的 **Commit** 按钮,文件将被提交。
_Modified_ 显示尚未暂存的更改。
单击左侧面板顶部的 _Commit_ 按钮以显示该提交的差异。这将在提交工具视图中打开选定的提交。如果你想查看提交中的所有更改请右键单击并选择_显示完整提交_。添加提交消息。
_git push_ 按钮在 _commit_ 按钮的右边。_git pull_ 按钮在 git push 按钮的右边。
选择_刷新_图标圆形箭头以查看暂存文件和提交的情况。
### 集成终端
_F4_ 或选择 _terminal_ 按钮可打开和关闭集成终端。
你可以通过集成终端使用构建脚本和 Vale linter将你的写作提升到一个新的水平确保文档质量。
**步骤 1. 运行构建脚本**
要在本地检查文档质量,你可以在集成终端中运行构建和预览脚本。构建和预览脚本可让你准确查看更改如何通过 Antora 静态站点生成器在文档页面中发布。
注意:检查 Fedora 文档仓库的 README 页面,为构建脚本和说明使用正确的文件名。下面是一个例子:
要构建和预览站点,请运行:
$ ./docsbuilder.sh -p
结果可访问 <http://localhost:8080>
要停止预览:
$ ./docsbuilder.sh -k
**步骤 2. 对你的文本运行 Vale**
Vale 是一个命令行工具,用于检查文本是否符合定义的样式指南。参考该[指南][7]在本地运行 Vale。
#### 鸣谢
非常感谢 KDE 开发人员 Nicco他的视频教程频道 “[Nicco loves Linux][8]” 给了我很多灵感。
本文使用的 Kate 版本为 23.08.3
[上游文档][9
以下是本文使用的 Fedora 文档 Git 仓库:
[快速文档][10
[Kinoite 用户文档][11
[IoT 用户文档][12
[文档贡献者指南][13
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/writing-docs-with-kate-and-git/
作者:[Hank Lee][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/hankuoffroad/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2023/12/writing_w_kate-816x345.jpg
[2]: https://unsplash.com/@olenichek?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash
[3]: https://unsplash.com/photos/a-person-typing-on-a-laptop-on-a-desk-2w0IdiEI-hg?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash
[4]: https://fedoramagazine.org/wp-content/uploads/2023/12/1-multirepo-1024x418.png
[5]: https://fedoramagazine.org/wp-content/uploads/2023/12/2-branch-1024x493.png
[6]: https://fedoramagazine.org/wp-content/uploads/2023/12/4-Show-diff-1024x313.png
[7]: https://docs.fedoraproject.org/en-US/fedora-docs/contributing-docs/tools-vale-linter/
[8]: https://www.youtube.com/c/Niccol%C3%B2Ve
[9]: https://docs.kde.org/stable5/en/kate/kate/index.html
[10]: https://pagure.io/fedora-docs/quick-docs.git
[11]: https://pagure.io/fedora-kde/kinoite-docs.git
[12]: https://github.com/fedora-iot/iot-docs.git
[13]: https://gitlab.com/fedora/docs/community-tools/documentation-contributors-guide.git