markslider-packager

This commit is contained in:
ville rantanen
2018-10-01 17:07:36 +03:00
parent 6693de67ec
commit 47b9b68328
3 changed files with 113 additions and 58 deletions

View File

@@ -0,0 +1,45 @@
#!/bin/bash
set -e
set -x
rm -rf markslider
mkdir -p markslider/scripts markslider/markslider
cp -v ansi.py md_color.py markslider.py markslider/markslider/
echo '#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import re
import sys
from markslider import main
if __name__ == "__main__":
sys.exit(main())
' > markslider/scripts/markslider
echo 'from markslider import *' > markslider/markslider/__init__.py
echo 'Markdown slideshow. Display your markdown file directly in the terminal!' > markslider/README.md
echo '[metadata]
description-file = README.md' > markslider/setup.cfg
echo "from distutils.core import setup
setup(
name = 'markslider',
packages = ['markslider'],
scripts = ['scripts/markslider'],
version = '$( ./markslider.py -v 2>&1 )',
description = 'Markdown viewer as slides',
author = 'Ville Rantanen',
author_email = 'ville.q.rantanen@gmail.com',
url = 'https://bitbucket.org/MoonQ/tools',
download_url = 'https://bitbucket.org/MoonQ/tools/raw/tip/reporting/markslider.tar.gz',
keywords = ['markdown', 'console'],
classifiers = [],
license = 'MIT',
)" > markslider/setup.py
tar czf markslider.tar.gz markslider
rm -rf markslider

View File

@@ -318,7 +318,7 @@ Keyboard shortcuts:
content.add_argument("--toc-page",action="store",dest="toc_page",default=2, type=int, content.add_argument("--toc-page",action="store",dest="toc_page",default=2, type=int,
help="Insert table of contents on a chosen page. default: %(const)s") help="Insert table of contents on a chosen page. default: %(const)s")
content.add_argument("--toc-depth",action="store",dest="toc_depth",default=2, type=int, content.add_argument("--toc-depth",action="store",dest="toc_depth",default=2, type=int,
choices=xrange(1,5), choices=list(range(1,5)),
help="Table of contents display depth. default: %(const)s") help="Table of contents display depth. default: %(const)s")
parser.add_argument("files",type=str, nargs='+', parser.add_argument("files",type=str, nargs='+',
help="File(s) to show") help="File(s) to show")
@@ -459,7 +459,7 @@ def browser(opts,files):
try: try:
reader=slide_reader(files,opts) reader=slide_reader(files,opts)
except: except:
print "Error in reading the file:" print("Error in reading the file:")
for o in sys.exc_info(): for o in sys.exc_info():
print(o) print(o)
sys.exit(1) sys.exit(1)
@@ -550,8 +550,8 @@ def browser(opts,files):
except EndProgram: except EndProgram:
pass pass
except: except:
print "Unexpected error:" print("Unexpected error:")
print traceback.format_exc() print(traceback.format_exc())
sys.exit(1) sys.exit(1)
def get_console_size(): def get_console_size():
@@ -652,9 +652,16 @@ def take_screenshot(reader,opts):
subprocess.call("sleep 0.5; import -window $WINDOWID '%s'"%(out_file,), subprocess.call("sleep 0.5; import -window $WINDOWID '%s'"%(out_file,),
stdout=subprocess.PIPE,stderr=subprocess.PIPE, stdout=subprocess.PIPE,stderr=subprocess.PIPE,
shell=True) shell=True)
def main():
global bc
global getch
global opts
bc = ansi.code() bc = ansi.code()
getch = getch() getch = getch()
opts = setup_options() opts = setup_options()
browser(opts,opts.files) browser(opts,opts.files)
if opts.screenshots: if opts.screenshots:
print("\n\nCrop the images for terminal tabs, and PDFize e.g.:\n- mogrify -chop 0x50 %s/*png\n- convert %s/*png %s.pdf"%( print("\n\nCrop the images for terminal tabs, and PDFize e.g.:\n- mogrify -chop 0x50 %s/*png\n- convert %s/*png %s.pdf"%(
@@ -662,3 +669,6 @@ if opts.screenshots:
opts.screenshots, opts.screenshots,
os.path.basename(opts.screenshots), os.path.basename(opts.screenshots),
)) ))
if __name__ == "__main__":
main()

BIN
reporting/markslider.tar.gz Normal file

Binary file not shown.