Init
This commit is contained in:
commit
96ad738abc
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
cache/*
|
||||
output/*
|
||||
__pycache__
|
||||
|
||||
|
9
.gitmodules
vendored
Normal file
9
.gitmodules
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
[submodule "plugins/thirdparty/md-metayaml"]
|
||||
path = plugins/thirdparty/md-metayaml
|
||||
url = git@git.246060.ru:/f1x1t/pelican-md-metayaml.git
|
||||
[submodule "plugins/thirdparty/pelican-css"]
|
||||
path = plugins/thirdparty/pelican-css
|
||||
url = https://notabug.org/jorgesumle/pelican-css
|
||||
[submodule "plugins/official"]
|
||||
path = plugins/official
|
||||
url = git@github.com:/getpelican/pelican-plugins.git
|
20
README.md
Normal file
20
README.md
Normal file
@ -0,0 +1,20 @@
|
||||
Сайт ДСП
|
||||
========
|
||||
|
||||
Установка:
|
||||
|
||||
```sh
|
||||
git clone git@git.246060.ru:/f1x1t/dsp-site dsp-site
|
||||
cd dsp-site
|
||||
git submodule update --init --recursive plugins/thirdparty/md-metayaml
|
||||
git submodule update --init plugins/official
|
||||
git submodule update --init plugins/thirdparty/pelican-css
|
||||
git submodule update --init themes/bootstrap4
|
||||
```
|
||||
|
||||
Первую компиляцию нужно выполнить без учёта кэша:
|
||||
|
||||
```sh
|
||||
pelican --ignore-cache
|
||||
```
|
||||
|
106
pelicanconf.py
Normal file
106
pelicanconf.py
Normal file
@ -0,0 +1,106 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*- #
|
||||
from __future__ import unicode_literals
|
||||
|
||||
class i18n(object):
|
||||
# looks for translations in
|
||||
# {LOCALE_DIR}/{LANGUAGE}/LC_MESSAGES/{DOMAIN}.mo
|
||||
# if not present, falls back to default
|
||||
|
||||
DOMAIN = 'messages'
|
||||
LOCALE_DIR = '{THEME}/translations'
|
||||
LANGUAGES = ['ru']
|
||||
NEWSTYLE = True
|
||||
|
||||
__name__ = 'i18n'
|
||||
|
||||
def register(self):
|
||||
from pelican.signals import generator_init
|
||||
generator_init.connect(self.install_translator)
|
||||
|
||||
def install_translator(self, generator):
|
||||
import gettext
|
||||
try:
|
||||
translator = gettext.translation(
|
||||
self.DOMAIN,
|
||||
self.LOCALE_DIR.format(THEME=THEME),
|
||||
self.LANGUAGES)
|
||||
except (OSError, IOError):
|
||||
translator = gettext.NullTranslations()
|
||||
generator.env.install_gettext_translations(translator, self.NEWSTYLE)
|
||||
|
||||
AUTHOR = 'Андрей Астафьев'
|
||||
SITENAME = 'ДСП'
|
||||
SITEURL = 'https://dsp.246060.ru'
|
||||
PORT = 33322
|
||||
|
||||
PATH = 'wiki'
|
||||
|
||||
TIMEZONE = 'Europe/Moscow'
|
||||
|
||||
DEFAULT_LANG = 'ru'
|
||||
|
||||
# Generation time
|
||||
CACHE_CONTENT = True
|
||||
LOAD_CONTENT_CACHE = True
|
||||
|
||||
# Feed generation is usually not desired when developing
|
||||
FEED_ALL_ATOM = None
|
||||
CATEGORY_FEED_ATOM = None
|
||||
TRANSLATION_FEED_ATOM = None
|
||||
AUTHOR_FEED_ATOM = None
|
||||
AUTHOR_FEED_RSS = None
|
||||
USE_FOLDER_AS_CATEGORY = True
|
||||
DEFAULT_DATE = 'fs'
|
||||
STATIC_PATHS = [ 'images', 'files' ]
|
||||
|
||||
MARKDOWN = {
|
||||
'extension_configs': {
|
||||
'markdown.extensions.codehilite': {'css_class': 'highlight'},
|
||||
'markdown.extensions.extra': {},
|
||||
'markdown.extensions.meta': {},
|
||||
},
|
||||
'output_format': 'html5',
|
||||
}
|
||||
|
||||
DISPLAY_CATEGORIES_ON_MENU = False
|
||||
DISPLAY_CATEGORIES_ON_SIDEBAR = True
|
||||
DISPLAY_TAGS_ON_SIDEBAR = True
|
||||
|
||||
THEME = 'themes/bootstrap4'
|
||||
BOOTSTRAP_THEME = 'litera'
|
||||
|
||||
I18N_TEMPLATES_LANG = 'ru'
|
||||
I18N_GETTEXT_NEWSTYLE = True
|
||||
I18N_GETTEXT_LOCALEDIR = 'themes/bootstrap4/translations'
|
||||
I18N_GETTEXT_DOMAIN = 'messages'
|
||||
JINJA_ENVIRONMENT = {'extensions': ['jinja2.ext.i18n']}
|
||||
|
||||
PLUGIN_PATHS = ["plugins/official", "plugins/thirdparty"]
|
||||
PLUGINS = [i18n(), "md-metayaml", "render_math", "series", "subcategory", "tag_cloud", "tipue_search", "pelican-css"]
|
||||
#PLUGINS = ["better_tables", "just_table"]
|
||||
|
||||
YUICOMPRESSOR_EXECUTABLE = "yui-compressor"
|
||||
PLUGINS += ["yuicompressor"]
|
||||
|
||||
DIRECT_TEMPLATES = ('index', 'categories', 'authors', 'archives', 'search')
|
||||
|
||||
# Blogroll
|
||||
LINKS = ()
|
||||
# LINKS = (('Pelican', 'http://getpelican.com/'),
|
||||
# ('Python.org', 'http://python.org/'),
|
||||
# ('Jinja2', 'http://jinja.pocoo.org/'),
|
||||
# ('You can modify those links in your config file', '#'),)
|
||||
|
||||
# Social widget
|
||||
SOCIAL = ()
|
||||
# SOCIAL = (('You can add links in your config file', '#'),
|
||||
# ('Another social link', '#'),)
|
||||
|
||||
PYGMENTS_STYLE='pastie'
|
||||
|
||||
DEFAULT_PAGINATION = 20
|
||||
|
||||
# Uncomment following line if you want document-relative URLs when developing
|
||||
RELATIVE_URLS = True
|
||||
|
1
plugins/official
Submodule
1
plugins/official
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit cfc7a3f224f1743063b034561f89a6a712d13587
|
1
plugins/thirdparty/md-metayaml
vendored
Submodule
1
plugins/thirdparty/md-metayaml
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 37143ae6e114e5f5e8a2ba782cb87f87f760d193
|
1
plugins/thirdparty/pelican-css
vendored
Submodule
1
plugins/thirdparty/pelican-css
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5d6009dcf558004b5bb3686f9b8ee269a398fb6b
|
25
publishconf.py
Normal file
25
publishconf.py
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*- #
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# This file is only used if you use `make publish` or
|
||||
# explicitly specify it as your config file.
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.curdir)
|
||||
from pelicanconf import *
|
||||
|
||||
# If your site is available via HTTPS, make sure SITEURL begins with https://
|
||||
SITEURL = 'https://dsp.246060.ru'
|
||||
RELATIVE_URLS = True
|
||||
|
||||
FEED_ALL_ATOM = 'feeds/all.atom.xml'
|
||||
CATEGORY_FEED_ATOM = 'feeds/{slug}.atom.xml'
|
||||
|
||||
DELETE_OUTPUT_DIRECTORY = True
|
||||
|
||||
# Following items are often useful when publishing
|
||||
|
||||
#DISQUS_SITENAME = ""
|
||||
#GOOGLE_ANALYTICS = ""
|
80
tasks.py
Normal file
80
tasks.py
Normal file
@ -0,0 +1,80 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import datetime
|
||||
|
||||
from invoke import task
|
||||
from invoke.util import cd
|
||||
from pelican.server import ComplexHTTPRequestHandler, RootedHTTPServer
|
||||
|
||||
CONFIG = {
|
||||
# Local path configuration (can be absolute or relative to tasks.py)
|
||||
'deploy_path': 'output',
|
||||
# Remote server configuration
|
||||
'production': 'root@localhost:22',
|
||||
'dest_path': '/var/www',
|
||||
# Port for `serve`
|
||||
'port': 8000,
|
||||
}
|
||||
|
||||
@task
|
||||
def clean(c):
|
||||
"""Remove generated files"""
|
||||
if os.path.isdir(CONFIG['deploy_path']):
|
||||
shutil.rmtree(CONFIG['deploy_path'])
|
||||
os.makedirs(CONFIG['deploy_path'])
|
||||
|
||||
@task
|
||||
def build(c):
|
||||
"""Build local version of site"""
|
||||
c.run('pelican -s pelicanconf.py')
|
||||
|
||||
@task
|
||||
def rebuild(c):
|
||||
"""`build` with the delete switch"""
|
||||
c.run('pelican -d -s pelicanconf.py')
|
||||
|
||||
@task
|
||||
def regenerate(c):
|
||||
"""Automatically regenerate site upon file modification"""
|
||||
c.run('pelican -r -s pelicanconf.py')
|
||||
|
||||
@task
|
||||
def serve(c):
|
||||
"""Serve site at http://localhost:8000/"""
|
||||
|
||||
class AddressReuseTCPServer(RootedHTTPServer):
|
||||
allow_reuse_address = True
|
||||
|
||||
server = AddressReuseTCPServer(
|
||||
CONFIG['deploy_path'],
|
||||
('', CONFIG['port']),
|
||||
ComplexHTTPRequestHandler)
|
||||
|
||||
sys.stderr.write('Serving on port {port} ...\n'.format(**CONFIG))
|
||||
server.serve_forever()
|
||||
|
||||
@task
|
||||
def reserve(c):
|
||||
"""`build`, then `serve`"""
|
||||
build(c)
|
||||
serve(c)
|
||||
|
||||
@task
|
||||
def preview(c):
|
||||
"""Build production version of site"""
|
||||
c.run('pelican -s publishconf.py')
|
||||
|
||||
|
||||
@task
|
||||
def publish(c):
|
||||
"""Publish to production via rsync"""
|
||||
c.run('pelican -s publishconf.py')
|
||||
c.run(
|
||||
'rsync --delete --exclude ".DS_Store" -pthrvz -c '
|
||||
'{} {production}:{dest_path}'.format(
|
||||
CONFIG['deploy_path'].rstrip('/') + '/',
|
||||
**CONFIG))
|
||||
|
22
wiki/Prog/Git/Git замена адреса подмодуля.md
Normal file
22
wiki/Prog/Git/Git замена адреса подмодуля.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Git: замена адреса подмодуля
|
||||
|
||||
---
|
||||
title: "Git: замена адреса подмодуля"
|
||||
category: Программирование
|
||||
tags: программирование, git
|
||||
summary:
|
||||
CSS: table-100.css
|
||||
...
|
||||
|
||||
|
||||
Если у подмодуля `thirdparty/example` нужно заменить адрес синхронизации
|
||||
и имя используемой ветки, то в каталоге с файлом `.gitmodules`, в котором
|
||||
содержится информация об этом подмодуле, нужно выполнить команды:
|
||||
|
||||
```sh
|
||||
git config --file=.gitmodules submodule.thirdparty/example.url https://github.com/username/ABC.git
|
||||
git config --file=.gitmodules submodule.thirdparty/example.branch new-branch-name
|
||||
git submodule sync
|
||||
git submodule update --init --recursive --remote
|
||||
```
|
||||
|
16
wiki/Prog/Git/Git распаковка объекта.md
Normal file
16
wiki/Prog/Git/Git распаковка объекта.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Git: распаковка объекта
|
||||
|
||||
---
|
||||
title: "Git: распаковка объекта"
|
||||
category: Программирование
|
||||
tags: программирование, git
|
||||
summary:
|
||||
CSS: table-100.css
|
||||
...
|
||||
|
||||
В случае повреждения репозитория можно восстановить отдельные
|
||||
объекты, которые сохраняются в формате zlib. Пример команды:
|
||||
|
||||
```
|
||||
perl -MCompress::Zlib -e 'undef $/; print uncompress(<>)' < 1234567890abcdef1234567890abcdef012345 > file
|
||||
```
|
Loading…
Reference in New Issue
Block a user