-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #220 from lxc-jp/update-2022-04-01
Update translations of LXD 5.0.0 (Closes #219)
- Loading branch information
Showing
30 changed files
with
772 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,34 @@ | ||
alabaster==0.7.12 | ||
Babel==2.9.1 | ||
certifi==2021.5.30 | ||
charset-normalizer==2.0.4 | ||
colorama==0.4.4 | ||
docutils==0.16.0 | ||
idna==3.2 | ||
imagesize==1.2.0 | ||
Jinja2==3.0.1 | ||
livereload==2.6.3 | ||
MarkupSafe==2.0.1 | ||
packaging==21.0 | ||
Pygments==2.10.0 | ||
pyparsing==2.4.7 | ||
pytz==2021.1 | ||
requests==2.26.0 | ||
six==1.16.0 | ||
snowballstemmer==2.1.0 | ||
Sphinx==4.1.2 | ||
sphinx-autobuild==2021.3.14 | ||
sphinxcontrib-applehelp==1.0.2 | ||
sphinxcontrib-devhelp==1.0.2 | ||
sphinxcontrib-htmlhelp==2.0.0 | ||
sphinxcontrib-jsmath==1.0.1 | ||
sphinxcontrib-qthelp==1.0.3 | ||
sphinxcontrib-serializinghtml==1.1.5 | ||
tornado==6.1 | ||
urllib3==1.26.6 | ||
alabaster | ||
Babel | ||
certifi | ||
charset-normalizer | ||
colorama | ||
docutils<0.18 | ||
idna | ||
imagesize | ||
Jinja2 | ||
livereload | ||
MarkupSafe | ||
packaging | ||
Pygments | ||
pyparsing | ||
pytz | ||
requests | ||
six | ||
snowballstemmer | ||
Sphinx | ||
sphinx-autobuild | ||
sphinxcontrib-applehelp | ||
sphinxcontrib-devhelp | ||
sphinxcontrib-htmlhelp | ||
sphinxcontrib-jsmath | ||
sphinxcontrib-qthelp | ||
sphinxcontrib-serializinghtml | ||
tornado | ||
urllib3 | ||
myst-parser | ||
sphinx-tabs | ||
sphinx-reredirects | ||
linkify-it-py | ||
furo | ||
sphinxext-opengraph>=0.6.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
###################################################################### | ||
# This extension allows adding related links on a per-page basis | ||
# in two ways (which can be combined): | ||
# | ||
# - Add links to Discourse topics by specifying the Discourse prefix | ||
# in the html_context variable in conf.py, for example: | ||
# | ||
# html_context = { | ||
# "discourse_prefix": "https://discuss.linuxcontainers.org/t/" | ||
# } | ||
# | ||
# Then add the topic IDs that you want to link to the metadata at | ||
# the top of the page using the tag "discourse". | ||
# For example (in MyST syntax): | ||
# | ||
# --- | ||
# discourse: 12033,13128 | ||
# --- | ||
# | ||
# - Add related URLs to the metadata at the top of the page using | ||
# the tag "relatedlinks". The link text is extracted automatically | ||
# or can be specified in Markdown syntax. Note that spaces are | ||
# ignored; if you need spaces in the title, replace them with  . | ||
# For example (in MyST syntax): | ||
# | ||
# --- | ||
# relatedlinks: https://www.example.com, [Link text](https://www.example.com) | ||
# --- | ||
# | ||
# If Sphinx complains about the metadata value because it starts | ||
# with "[", enclose the full value in double quotes. | ||
# | ||
# For both ways, check for errors in the output. Invalid links are | ||
# not added to the output. | ||
###################################################################### | ||
|
||
import requests | ||
import json | ||
from bs4 import BeautifulSoup | ||
|
||
cache = {} | ||
|
||
def setup_func(app, pagename, templatename, context, doctree): | ||
|
||
def discourse_links(IDlist): | ||
|
||
if context["discourse_prefix"] and IDlist: | ||
|
||
posts = IDlist.strip().replace(" ","").split(",") | ||
|
||
linklist = "<ul>"; | ||
|
||
for post in posts: | ||
title = "" | ||
linkurl = context["discourse_prefix"]+post | ||
|
||
if post in cache: | ||
title = cache[post] | ||
else: | ||
try: | ||
r = requests.get(linkurl+".json") | ||
r.raise_for_status() | ||
title = json.loads(r.text)["title"] | ||
cache[post] = title | ||
except requests.HTTPError as err: | ||
print(err) | ||
|
||
if title: | ||
linklist += '<li><a href="'+linkurl+'" target="_blank">'+title+'</a></li>' | ||
|
||
linklist += "</ul>" | ||
|
||
return linklist | ||
|
||
else: | ||
return "" | ||
|
||
def related_links(linklist): | ||
|
||
if linklist: | ||
|
||
links = linklist.strip().replace(" ","").split(",") | ||
|
||
linklist = "<ul>"; | ||
|
||
for link in links: | ||
title = "" | ||
|
||
if link in cache: | ||
title = cache[link] | ||
elif link.startswith("[") and link.endswith(")"): | ||
split = link.partition("](") | ||
title = split[0][1:] | ||
link = split[2][:-1] | ||
else: | ||
try: | ||
r = requests.get(link) | ||
r.raise_for_status() | ||
soup = BeautifulSoup(r.text, 'html.parser') | ||
title = soup.title.get_text() | ||
cache[link] = title | ||
except requests.HTTPError as err: | ||
print(err) | ||
|
||
if title: | ||
linklist += '<li><a href="'+link+'" target="_blank">'+title+'</a></li>' | ||
|
||
linklist += "</ul>" | ||
|
||
return linklist | ||
|
||
else: | ||
return "" | ||
|
||
context['discourse_links'] = discourse_links | ||
context['related_links'] = related_links | ||
|
||
def setup(app): | ||
app.connect("html-page-context", setup_func) | ||
|
||
return { | ||
'version': '0.1', | ||
'parallel_read_safe': True, | ||
'parallel_write_safe': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from docutils import nodes | ||
from docutils.parsers.rst import Directive | ||
|
||
class YouTubeLink(Directive): | ||
|
||
required_arguments = 1 | ||
optional_arguments = 0 | ||
has_content = False | ||
|
||
def run(self): | ||
|
||
fragment = ' \ | ||
<p class="youtube_link"> \ | ||
<a href="'+self.arguments[0]+'" target="_blank"> \ | ||
<span class="play_icon">▶</span> \ | ||
<span>Watch on YouTube</span> \ | ||
</a> \ | ||
</p>' | ||
raw = nodes.raw(text=fragment, format="html") | ||
|
||
return [raw] | ||
|
||
|
||
def setup(app): | ||
app.add_directive("youtube", YouTubeLink) | ||
|
||
return { | ||
'version': '0.1', | ||
'parallel_read_safe': True, | ||
'parallel_write_safe': True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.