Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
354e9120b2 | |||
c6107ca968 | |||
|
73aa9bf2aa | ||
|
888e494c2a | ||
|
b06b2224fb |
27
.travis.yml
27
.travis.yml
@ -1,27 +0,0 @@
|
|||||||
language: python
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
env:
|
|
||||||
- LUA="lua=5.1"
|
|
||||||
- LUA="lua=5.2"
|
|
||||||
- LUA="lua=5.3"
|
|
||||||
- LUA="lua=5.4"
|
|
||||||
|
|
||||||
before_install:
|
|
||||||
- pip install hererocks
|
|
||||||
- hererocks lua_install -r^ --$LUA
|
|
||||||
- export PATH=$PATH:$PWD/lua_install/bin
|
|
||||||
|
|
||||||
install:
|
|
||||||
- luarocks make
|
|
||||||
- luarocks install luacheck
|
|
||||||
- luarocks install busted
|
|
||||||
- luarocks install luacov
|
|
||||||
- luarocks install luacov-coveralls
|
|
||||||
|
|
||||||
script:
|
|
||||||
- luacheck --std max+busted src spec
|
|
||||||
- busted --verbose --coverage
|
|
||||||
|
|
||||||
after_success:
|
|
||||||
- luacov-coveralls -e $TRAVIS_BUILD_DIR/lua_install
|
|
21
LICENCE
Normal file
21
LICENCE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Shishkov Dmitriy
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
10
README.md
10
README.md
@ -2,9 +2,17 @@
|
|||||||
|
|
||||||
This tool helps to download all images in markdown document and put them into one folder with changed paths
|
This tool helps to download all images in markdown document and put them into one folder with changed paths
|
||||||
|
|
||||||
|
**Warning**: lua 5.2 version is required
|
||||||
|
|
||||||
|
## Dependency installation:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
luarocks install luasec
|
||||||
|
```
|
||||||
|
|
||||||
## Usage:
|
## Usage:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
md-parser [-o <output>] [-s <server>] [-c <config>] [-u] [-h]
|
md-parser [-o <output>] [-s <server>] [-c <config>] [-u] [-h]
|
||||||
<input>
|
<input>
|
||||||
|
|
||||||
|
@ -59,8 +59,8 @@ describe("process_md", function()
|
|||||||
|
|
||||||
local content = f:read('a')
|
local content = f:read('a')
|
||||||
|
|
||||||
local header
|
local header, _
|
||||||
content, header = ProcessMD.get_header(content, assets_dir .. 'tmp_dir/some file.md', true)
|
_, header = ProcessMD.get_header(content, assets_dir .. 'tmp_dir/some file.md', true)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
assert.equal('Header_:D', header)
|
assert.equal('Header_:D', header)
|
||||||
@ -71,7 +71,7 @@ describe("process_md", function()
|
|||||||
|
|
||||||
local content = f:read('a')
|
local content = f:read('a')
|
||||||
|
|
||||||
local header
|
local header, _
|
||||||
_, header = ProcessMD.get_header(content, assets_dir .. 'tmp_dir/and one more.md', true)
|
_, header = ProcessMD.get_header(content, assets_dir .. 'tmp_dir/and one more.md', true)
|
||||||
f:close()
|
f:close()
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ local function upload_to_server(local_article_directory, server_cred, server_pat
|
|||||||
os.exit(1)
|
os.exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local status, err = pcall(NetwOps.download_db, server_cred, server_path, local_article_directory)
|
status, err = pcall(NetwOps.download_db, server_cred, server_path, local_article_directory)
|
||||||
if not status then
|
if not status then
|
||||||
print('Error: ' .. err)
|
print('Error: ' .. err)
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
@ -55,7 +55,7 @@ local function upload_to_server(local_article_directory, server_cred, server_pat
|
|||||||
|
|
||||||
NetwOps.insert_article(local_article_directory, document_name)
|
NetwOps.insert_article(local_article_directory, document_name)
|
||||||
|
|
||||||
local status, err = pcall(NetwOps.upload_db, server_cred, server_path, local_article_directory)
|
status, err = pcall(NetwOps.upload_db, server_cred, server_path, local_article_directory)
|
||||||
if not status then
|
if not status then
|
||||||
print('Error: ' .. err)
|
print('Error: ' .. err)
|
||||||
os.exit(1)
|
os.exit(1)
|
||||||
|
@ -4,7 +4,7 @@ function process_md.get_file_content(path)
|
|||||||
local f, err = io.open(path, "r+")
|
local f, err = io.open(path, "r+")
|
||||||
assert(f, err)
|
assert(f, err)
|
||||||
|
|
||||||
local content = f:read("a")
|
local content = f:read("*a")
|
||||||
|
|
||||||
f:close()
|
f:close()
|
||||||
return content
|
return content
|
||||||
|
Loading…
x
Reference in New Issue
Block a user