mirror of
https://github.com/LearnOpenGL-CN/LearnOpenGL-CN.git
synced 2025-08-23 04:35:28 +08:00
4
.github/workflows/deploy.yml
vendored
4
.github/workflows/deploy.yml
vendored
@@ -14,9 +14,7 @@ jobs:
|
||||
- name: install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
pip install PyYAML==5.1.2
|
||||
pip install mkdocs==0.16.3
|
||||
python setup.py install
|
||||
pip install mkdocs==1.4.2 python-markdown-math==0.8
|
||||
- name: build site
|
||||
shell: bash
|
||||
run: mkdocs build --clean
|
||||
|
@@ -61,11 +61,10 @@ learnopengl.com系列教程的中文翻译,目前正在校对及翻译中。
|
||||
|
||||
## 构建
|
||||
|
||||
首先请安装Python,2和3都可以,之后初始化环境:
|
||||
首先请安装Python 3.7+,之后初始化环境:
|
||||
|
||||
```bash
|
||||
$ pip install mkdocs
|
||||
$ python setup.py install
|
||||
$ pip install mkdocs==1.4.2 python-markdown-math==0.8
|
||||
```
|
||||
|
||||
初始化以后,每次构建只需要输入以下指令即可,构建后的文件在`site`文件夹内:
|
||||
|
@@ -77,7 +77,7 @@ glm::vec2 BallObject::Move(GLfloat dt, GLuint window_width)
|
||||
- BallObject: [header](https://learnopengl.com/code_viewer.php?code=in-practice/breakout/ball_object_collisions.h), [code](https://learnopengl.com/code_viewer.php?code=in-practice/breakout/ball_object_collisions)
|
||||
|
||||
|
||||
首先我们在游戏中添加球。与玩家挡板相似,我们创建一个球对象并且定义两个用来初始化球的常量。对于球的纹理,我们会使用在LearnOpenGL Breakout游戏中完美适用的一张图片:[球纹理](../../../../img/06/Breakout/05/01/awesomeface.png)。
|
||||
首先我们在游戏中添加球。与玩家挡板相似,我们创建一个球对象并且定义两个用来初始化球的常量。对于球的纹理,我们会使用在LearnOpenGL Breakout游戏中完美适用的一张图片:[球纹理](../../../img/06/Breakout/05/01/awesomeface.png)。
|
||||
|
||||
```c++
|
||||
// 初始化球的速度
|
||||
|
@@ -1,7 +0,0 @@
|
||||
# 雾
|
||||
|
||||
**未完成**
|
||||
|
||||
这篇教程暂时还没有完成,您可以经常来刷新看看是否有更新的进展。
|
||||
|
||||
<img src="../../img/development.png" class="clean">
|
@@ -1,7 +0,0 @@
|
||||
# 卡通着色
|
||||
|
||||
**未完成**
|
||||
|
||||
这篇教程暂时还没有完成,您可以经常来刷新看看是否有更新的进展。
|
||||
|
||||
<img src="../../img/development.png" class="clean">
|
64
mdx_math.py
64
mdx_math.py
@@ -1,64 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
'''
|
||||
Math extension for Python-Markdown
|
||||
==================================
|
||||
|
||||
Adds support for displaying math formulas using [MathJax](http://www.mathjax.org/).
|
||||
|
||||
Author: 2015, Dmitry Shachnev <mitya57@gmail.com>.
|
||||
'''
|
||||
|
||||
import markdown
|
||||
|
||||
class MathExtension(markdown.extensions.Extension):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.config = {
|
||||
'enable_dollar_delimiter': [False, 'Enable single-dollar delimiter'],
|
||||
'render_to_span': [False,
|
||||
'Render to span elements rather than script for fallback'],
|
||||
}
|
||||
super(MathExtension, self).__init__(*args, **kwargs)
|
||||
|
||||
def extendMarkdown(self, md, md_globals):
|
||||
def handle_match_inline(m):
|
||||
if self.getConfig('render_to_span'):
|
||||
node = markdown.util.etree.Element('span')
|
||||
node.set('class', 'tex')
|
||||
node.text = ("\\\\(" + markdown.util.AtomicString(m.group(3)) +
|
||||
"\\\\)")
|
||||
else:
|
||||
node = markdown.util.etree.Element('script')
|
||||
node.set('type', 'math/tex')
|
||||
node.text = markdown.util.AtomicString(m.group(3))
|
||||
return node
|
||||
|
||||
def handle_match(m):
|
||||
node = markdown.util.etree.Element('script')
|
||||
node.set('type', 'math/tex; mode=display')
|
||||
if '\\begin' in m.group(2):
|
||||
node.text = markdown.util.AtomicString(m.group(2) + m.group(4) + m.group(5))
|
||||
else:
|
||||
node.text = markdown.util.AtomicString(m.group(3))
|
||||
return node
|
||||
|
||||
inlinemathpatterns = (
|
||||
markdown.inlinepatterns.Pattern(r'(?<!\\|\$)(\$)([^\$]+)(\$)'), # $...$
|
||||
markdown.inlinepatterns.Pattern(r'(?<!\\)(\\\()(.+?)(\\\))') # \(...\)
|
||||
)
|
||||
mathpatterns = (
|
||||
markdown.inlinepatterns.Pattern(r'(?<!\\)(\$\$)([^\$]+)(\$\$)'), # $$...$$
|
||||
markdown.inlinepatterns.Pattern(r'(?<!\\)(\\\[)(.+?)(\\\])'), # \[...\]
|
||||
markdown.inlinepatterns.Pattern(r'(?<!\\)(\\begin{([a-z]+?\*?)})(.+?)(\\end{\3})')
|
||||
)
|
||||
if not self.getConfig('enable_dollar_delimiter'):
|
||||
inlinemathpatterns = inlinemathpatterns[1:]
|
||||
for i, pattern in enumerate(inlinemathpatterns):
|
||||
pattern.handleMatch = handle_match_inline
|
||||
md.inlinePatterns.add('math-inline-%d' % i, pattern, '<escape')
|
||||
for i, pattern in enumerate(mathpatterns):
|
||||
pattern.handleMatch = handle_match
|
||||
md.inlinePatterns.add('math-%d' % i, pattern, '<escape')
|
||||
|
||||
def makeExtension(*args, **kwargs):
|
||||
return MathExtension(*args, **kwargs)
|
@@ -1,4 +1,4 @@
|
||||
pages:
|
||||
nav:
|
||||
- 主页: 'index.md'
|
||||
- 目录:
|
||||
- 简介: 'intro.md'
|
||||
@@ -100,4 +100,6 @@ extra_css:
|
||||
|
||||
docs_dir: 'docs'
|
||||
|
||||
theme_dir: 'yeti'
|
||||
theme:
|
||||
name: null
|
||||
custom_dir: 'yeti'
|
||||
|
26
setup.py
26
setup.py
@@ -1,26 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from distutils.core import setup
|
||||
|
||||
long_description = \
|
||||
"""This extension adds math formulas support to Python-Markdown_
|
||||
(works with version 2.6 or newer).
|
||||
|
||||
.. _Python-Markdown: https://github.com/waylan/Python-Markdown
|
||||
|
||||
You can find the source on GitHub_.
|
||||
Please refer to the `README file`_ for details on how to use it.
|
||||
|
||||
.. _GitHub: https://github.com/mitya57/python-markdown-math
|
||||
.. _`README file`: https://github.com/mitya57/python-markdown-math/blob/master/README.md
|
||||
"""
|
||||
|
||||
setup(name='python-markdown-math',
|
||||
description='Math extension for Python-Markdown',
|
||||
long_description=long_description,
|
||||
author='Dmitry Shachnev',
|
||||
author_email='mitya57@gmail.com',
|
||||
version='0.2',
|
||||
url='https://github.com/mitya57/python-markdown-math',
|
||||
py_modules=['mdx_math'],
|
||||
license='BSD')
|
@@ -1,12 +1,12 @@
|
||||
{% if meta.source %}
|
||||
{% if page.meta.source %}
|
||||
<div class="source-links">
|
||||
{% for filename in meta.source %}
|
||||
{% for filename in page.meta.source %}
|
||||
<span class="label label-primary">{{ filename }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{{ content }}
|
||||
{{ page.content }}
|
||||
|
||||
<div id="disqus_thread"></div>
|
||||
<script>
|
||||
|
@@ -4,13 +4,12 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
{% if page_description %}<meta name="description" content="{{ page_description }}">{% endif %}
|
||||
{% if site_author %}<meta name="author" content="{{ site_author }}">{% endif %}
|
||||
{% if canonical_url %}<link rel="canonical" href="{{ canonical_url }}">{% endif %}
|
||||
{% if favicon %}<link rel="shortcut icon" href="{{ favicon }}">
|
||||
{% else %}<link rel="shortcut icon" href="{{ base_url }}/img/favicon.ico">{% endif %}
|
||||
{% if config.site_description %}<meta name="description" content="{{ config.site_description }}">{% endif %}
|
||||
{% if config.site_author %}<meta name="author" content="{{ config.site_author }}">{% endif %}
|
||||
{% if page.canonical_url %}<link rel="canonical" href="{{ page.canonical_url }}">{% endif %}
|
||||
<link rel="shortcut icon" href="{{ base_url }}/img/favicon.ico">
|
||||
|
||||
<title>{% if page_title %}{{ page_title }} - {% endif %}{{ site_name }}</title>
|
||||
<title>{% if page.title %}{{ page.title }} - {% endif %}{{ config.site_name }}</title>
|
||||
|
||||
<link href="{{ base_url }}/css/bootstrap-custom.min.css" rel="stylesheet">
|
||||
<link href="{{ base_url }}/css/font-awesome-4.0.3.css" rel="stylesheet">
|
||||
@@ -57,7 +56,6 @@
|
||||
<script src="{{ base_url }}/js/bootstrap-3.0.3.min.js"></script>
|
||||
<script src="{{ base_url }}/js/highlight.pack.js"></script>
|
||||
<script>var base_url = '{{ base_url }}';</script>
|
||||
<script data-main="{{ base_url }}/mkdocs/js/search.js" src="{{ base_url }}/mkdocs/js/require.js"></script>
|
||||
<script src="{{ base_url }}/js/base.js"></script>
|
||||
{%- for path in extra_javascript %}
|
||||
<script src="{{ path }}"></script>
|
@@ -1,6 +1,6 @@
|
||||
{% if not nav_item.children %}
|
||||
<li {% if nav_item.active %}class="active"{% endif %}>
|
||||
<a href="{{ nav_item.url }}">{{ nav_item.title }}</a>
|
||||
<a href="{{ nav_item.url|url }}">{{ nav_item.title }}</a>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="dropdown-submenu">
|
||||
|
@@ -12,7 +12,7 @@
|
||||
</button>
|
||||
|
||||
<!-- Main title -->
|
||||
<a class="navbar-brand" href="{{ homepage_url }}">{{ site_name }}</a>
|
||||
<a class="navbar-brand" href="{{ nav.homepage.url|url }}">{{ config.site_name }}</a>
|
||||
</div>
|
||||
|
||||
<!-- Expanded navigation -->
|
||||
@@ -31,7 +31,7 @@
|
||||
</li>
|
||||
{% else %}
|
||||
<li {% if nav_item.active %}class="active"{% endif %}>
|
||||
<a href="{{ nav_item.url }}">{{ nav_item.title }}</a>
|
||||
<a href="{{ nav_item.url|url }}">{{ nav_item.title }}</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
@@ -44,25 +44,25 @@
|
||||
<i class="fa fa-search"></i> 搜索
|
||||
</a>
|
||||
</li>
|
||||
<li {% if not previous_page %}class="disabled"{% endif %}>
|
||||
<a rel="next" {% if previous_page %}href="{{ previous_page.url }}"{% endif %}>
|
||||
<li {% if not page.previous_page %}class="disabled"{% endif %}>
|
||||
<a rel="next" {% if page.previous_page %}href="{{ page.previous_page.url|url }}"{% endif %}>
|
||||
<i class="fa fa-arrow-left"></i> 上一节
|
||||
</a>
|
||||
</li>
|
||||
<li {% if not next_page %}class="disabled"{% endif %}>
|
||||
<a rel="prev" {% if next_page %}href="{{ next_page.url }}"{% endif %}>
|
||||
<li {% if not page.next_page %}class="disabled"{% endif %}>
|
||||
<a rel="prev" {% if page.next_page %}href="{{ page.next_page.url|url }}"{% endif %}>
|
||||
下一节 <i class="fa fa-arrow-right"></i>
|
||||
</a>
|
||||
</li>
|
||||
{% if repo_url %}
|
||||
{% if config.repo_url %}
|
||||
<li>
|
||||
<a href="{{ repo_url }}">
|
||||
{% if repo_name == 'GitHub' %}
|
||||
<a href="{{ config.repo_url }}">
|
||||
{% if config.repo_name == 'GitHub' %}
|
||||
<i class="fa fa-github"></i>
|
||||
{% elif repo_name == 'Bitbucket' %}
|
||||
{% elif config.repo_name == 'Bitbucket' %}
|
||||
<i class="fa fa-bitbucket"></i>
|
||||
{% endif %}
|
||||
{{ repo_name }}
|
||||
{{ config.repo_name }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
@@ -1,9 +1,9 @@
|
||||
<div class="bs-sidebar hidden-print affix well" role="complementary">
|
||||
<ul class="nav bs-sidenav">
|
||||
{% for toc_item in toc %}
|
||||
<li class="main {% if toc_item.active %}active{% endif %}"><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
{% for toc_item in page.toc %}
|
||||
<li class="main {% if toc_item.active %}active{% endif %}"><a href="{{ toc_item.url|url }}">{{ toc_item.title }}</a></li>
|
||||
{% for toc_item in toc_item.children %}
|
||||
<li><a href="{{ toc_item.url }}">{{ toc_item.title }}</a></li>
|
||||
<li><a href="{{ toc_item.url|url }}">{{ toc_item.title }}</a></li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
Reference in New Issue
Block a user