noword / MdxConverter

generate a html or pdf or jpg file for specific words through a mdx dirctionary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

这是一个用来从 mdx 字典中抓取所需的单词,并生成 html,pdf 或 jpg 文件的小工具。

用法

usage: MdxConverter.py [-h] [--type [{pdf,html,jpg}]] [--invalid {0,1,2}] mdx_name input_name [output_name]

positional arguments:
mdx_name
input_name
output_name

optional arguments:
-h, --help            show this help message and exit
--type [{pdf,html,jpg}]
--invalid {0,1,2}     action for meeting invalid words
                        0: exit immediately
                        1: output warnning message to pdf/html
                        2: collect them to invalid_words.txt (default)

例如:

MdxConverter 某某词典.mdx input.xlsx output.pdf

依赖库

mdict-query

BeautifulSoup4

openpyxl

pdfkit

imgkit

lxml

chardet

输入

txt 示例

#Lesson 1
hello
world

#Lesson 2
python
is
awesome

json 示例

 [
 {
     "name": "Lesson 1",
     "words": [
         "hello",
         "world"
     ]
 },
 {
     "name": "Lesson 2",
     "words": [
         "python",
         "is",
         "awesome"
     ]
 }
 ]

excel 示例

输出

HTML

PDF

JPG

About

generate a html or pdf or jpg file for specific words through a mdx dirctionary


Languages

Language:Python 98.3%Language:Batchfile 1.7%