Merge branch 'master' into master

This commit is contained in:
Luong Vo 2017-10-27 09:53:51 +07:00 committed by GitHub
commit c149e7d9af
5 changed files with 2726 additions and 1211 deletions

1345
README.md

File diff suppressed because it is too large Load Diff

1121
README_es-ES.md Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,7 @@
- [English](#introduction) - [English](#introduction)
- [中文](#介绍) - [中文](#介绍)
- [Português (Brasil)](#português-brasil) - [Português (Brasil)](#português-brasil)
- [Español](#español)
# Introduction # Introduction
`asort.py` is a very simple python3 script that aims to make sure items in the README file of the repo [Awesome-Linux-Software](https://github.com/VoLuong/Awesome-Linux-Software) are sorted alphabetically. `asort.py` is a very simple python3 script that aims to make sure items in the README file of the repo [Awesome-Linux-Software](https://github.com/VoLuong/Awesome-Linux-Software) are sorted alphabetically.
@ -14,13 +15,15 @@ This script only sorts items in the following topics for now (items between topi
# Usage # Usage
1. Add items to corresponding topics, don't worry about the order of those items. 1. Add items to corresponding topics, don't worry about the order of those items.
1. Make sure you've installed python3 environment on your system. 2. Make sure you've installed python3 environment on your system.
1. Open a terminal, type `python3 asort.py` to run this script. After that, you'll get a new README file with all the items in the above topics sorted alphabetically. 3. Open a terminal, type `python3 asort.py` to run this script. After that, you'll get a new README file with all the items in the above topics sorted alphabetically.
![test screenshot](./test.png) ![test screenshot](./test.png)
## Note ## Note
`asort_zh.py` works for the file [README_zh-CN.md](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_zh-CN.md), the Chinese version of this list. `asort_zh.py` works for the file [README_zh-CN.md](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_zh-CN.md), the Chinese version of this list.
`asort_pt-BR.py` works for the Brasilian Portuguese version of the file [README_pt-BR](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_pt-BR.md)
`asort_zh.py` works for the Spanish version of the file [README_es-ES](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_es-ES.md)
# License # License
MIT License. MIT License.
@ -38,8 +41,8 @@ MIT License.
# 用法 # 用法
1. 请首先按照说明将新的条目添加到合适的主题下,不用考虑排序问题; 1. 请首先按照说明将新的条目添加到合适的主题下,不用考虑排序问题;
1. 然后,确保你在系统上安装了 Python3 运行环境; 2. 然后,确保你在系统上安装了 Python3 运行环境;
1. 打开终端,运行 `python3 asort.py` 即可。之后,你将得到一个新生成的 README 文件,并且文件中所有的在上述几个主题中的条目都已经按照字母表的顺序排列好了。 3. 打开终端,运行 `python3 asort.py` 即可。之后,你将得到一个新生成的 README 文件,并且文件中所有的在上述几个主题中的条目都已经按照字母表的顺序排列好了。
![test 截图](./test.png) ![test 截图](./test.png)
@ -62,8 +65,8 @@ Este script apenas classifica itens nos seguintes tópicos por enquanto (Itens e
# Modo de usar # Modo de usar
1. Adicione itens aos tópicos correspondentes, não se preocupe com a ordem desses itens. 1. Adicione itens aos tópicos correspondentes, não se preocupe com a ordem desses itens.
1. Verifique se está instalado o ambiente python3 em seu sistema. 2. Verifique se está instalado o ambiente python3 em seu sistema.
1. Abra o terminal e digite `python3 asort.py` para executar o script. Depois disso, você receberá um novo arquivo README com todos os itens nos tópicos acima classificados em ordem alfabética. 3. Abra o terminal e digite `python3 asort.py` para executar o script. Depois disso, você receberá um novo arquivo README com todos os itens nos tópicos acima classificados em ordem alfabética.
![test screenshot](./test.png) ![test screenshot](./test.png)
@ -72,3 +75,31 @@ Este script apenas classifica itens nos seguintes tópicos por enquanto (Itens e
# Licença # Licença
Licença MIT. Licença MIT.
---------------------------------------------
# Español
`asort.py` es un es un simple script para garantizar los elementos del archivo README del repositorio [Awesome-Linux-Software](https://github.com/VoLuong/Awesome-Linux-Software) se ordenan alfabéticamente.
Este script sólo puede ordenar elementos en estas secciones por ahora (Los elementos son las secciones entre aplicaciones y Configuración)
- Aplicaciones
- Herramientas de línea de comandos
- Los Entornos des escritorios
- Gestors des pantallas
- Gestor de ventanas
# modo de uso
1. Añadir un nuevo software a las secciones correspondientes. El orden del software no importa.
2. Asegúrese de que el entorno de desarrollo de Python3 está instalado.
3. abra una línea de comandos y escriba: 'python3 asort.py' para activar el script. Después de esto, el script creará un nuevo archivo README con todos los elementos ordenados automáticamente.
![Una captura de pantalla de prueba](./test.png)
#Notas
`asort.py` es compatible con la versión en inglés de la lista [README](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README.md)
`asort_zh.py` es compatible con la versión china de la lista [README_zh-CN.md](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_zh-CN.md)
`asort_pt-BR.py` es compatible con la versión portuguesa brasileña de la lista [README_pt-BR](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_pt-BR.md)
`asort_es-ES.py` es compatible con la versión español de la lista [README_es-ES](https://github.com/VoLuong/Awesome-Linux-Software/blob/master/README_es-ES.md)
# Licencia
Licencia MIT

77
auto_sort/asort_es-ES.py Normal file
View File

@ -0,0 +1,77 @@
#!/usr/bin/env python3
# -*-coding: utf-8-*-
# Author : Christopher L
# Blog : http://blog.chriscabin.com
# GitHub : https://www.github.com/chrisleegit
# File : asort.py
# Date : 2016/08/22 11:12
# Version: 0.1
# Description: A very simple python script that can sort items alphabetically.
from __future__ import print_function
import os
import shutil
README_FILE = '../README_es-ES.md'
TEMP_FILE = 'temp_es-ES.md'
# only works for those items between BEGIN and END.
BEGIN = '## Aplicaciones'
END = '## Configurar'
def main():
global README_FILE
# make sure the script can find file: README.md
README_FILE = os.path.abspath(README_FILE)
if not os.path.exists(README_FILE):
print('Error: archivo o directorio no existe: {}'.format(README_FILE))
exit(1)
sort_enable = False
items = list()
print('cargando archivo: {}'.format(README_FILE))
# read file: README.md
with open(README_FILE) as infile, open(TEMP_FILE, 'w') as outfile:
# process each line
for line in infile:
if not sort_enable and BEGIN in line:
sort_enable = True
# if sort_enable and END in line:
# sort_enable = False
if sort_enable:
line = line.strip()
# each item starts with a character '-' (maybe '*' and '+')
if line.startswith(('-', '*', '+')):
items.append(line)
elif line.startswith('#'):
sort_enable = False if END in line else True
# when we meet the next header, we should stop adding new item to the list.
for item in sorted(items, key=lambda x: x.upper()):
# write the ordered list to the temporary file.
print(item, file=outfile)
print('', file=outfile)
items.clear()
# remember to put the next header in the temporary file.
print(line, file=outfile)
else:
print(line, end='', file=outfile)
else:
print(line, end='', file=outfile)
print('reemplazar el archivo original: README_es-ES.md')
shutil.move(TEMP_FILE, README_FILE)
if __name__ == '__main__':
main()