markslider-packager
This commit is contained in:
45
reporting/markslider.packager.sh
Normal file
45
reporting/markslider.packager.sh
Normal 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
|
||||||
|
|
||||||
@@ -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,13 +652,23 @@ 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)
|
||||||
bc=ansi.code()
|
|
||||||
getch=getch()
|
|
||||||
opts=setup_options()
|
def main():
|
||||||
browser(opts,opts.files)
|
global bc
|
||||||
if opts.screenshots:
|
global getch
|
||||||
print("\n\nCrop the images for terminal tabs, and PDFize e.g.:\n- mogrify -chop 0x50 %s/*png\n- convert %s/*png %s.pdf"%(
|
global opts
|
||||||
opts.screenshots,
|
bc = ansi.code()
|
||||||
opts.screenshots,
|
getch = getch()
|
||||||
os.path.basename(opts.screenshots),
|
opts = setup_options()
|
||||||
))
|
|
||||||
|
browser(opts,opts.files)
|
||||||
|
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"%(
|
||||||
|
opts.screenshots,
|
||||||
|
opts.screenshots,
|
||||||
|
os.path.basename(opts.screenshots),
|
||||||
|
))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|||||||
BIN
reporting/markslider.tar.gz
Normal file
BIN
reporting/markslider.tar.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user