From 4886db0f6540c07f88fd9f43bfe174416958fa0d 2011-02-11 19:35:12 From: MinRK Date: 2011-02-11 19:35:12 Subject: [PATCH] gh-pages includes pdf also fixed illegal image name in latex closes gh-267 --- diff --git a/docs/Makefile b/docs/Makefile index 7c684cb..9a02a84 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -103,8 +103,8 @@ gitwash-update: nightly: dist rsync -avH --delete dist/ ipython:www/doc/nightly -gh-pages: html +gh-pages: html pdf python gh-pages.py -gh-pages-current: html - python gh-pages.py current +gh-pages-current: html pdf + python gh-pages.py current "Current Development Version" diff --git a/docs/gh-pages.py b/docs/gh-pages.py index e785611..6a9ac41 100755 --- a/docs/gh-pages.py +++ b/docs/gh-pages.py @@ -29,6 +29,7 @@ from subprocess import Popen, PIPE, CalledProcessError, check_call pages_dir = 'gh-pages' html_dir = 'build/html' +pdf_dir = 'build/latex' pages_repo = 'git@github.com:ipython/ipython-doc.git' #----------------------------------------------------------------------------- @@ -74,20 +75,28 @@ def init_repo(path): cd(here) -def render_htmlindex(fname, tag): - rel = '
  • Release: {t}'.format(t=tag) +def render_htmlindex(fname, tag, desc=None): + if desc is None: + desc = tag + + rel = '
  • {d}: HTML and PDF'.format(t=tag,d=desc) rep = re.compile('') out = [] with file(fname) as f: - for line in f: + contents = f.read() + lines = contents.splitlines() + if rel in contents: + out = lines + else: + for line in lines: out.append(line) if rep.search(line): out.append(rep.sub(rel, line)) - return ''.join(out) + return '\n'.join(out)+'\n' -def new_htmlindex(fname, tag): - new_page = render_htmlindex(fname, tag) +def new_htmlindex(fname, tag, desc=None): + new_page = render_htmlindex(fname, tag, desc) os.rename(fname, fname+'~') with file(fname, 'w') as f: f.write(new_page) @@ -102,7 +111,12 @@ if __name__ == '__main__': tag = sys.argv[1] except IndexError: tag = sh2('git describe') - + + try: + desc = sys.argv[2] + except IndexError: + desc="Release (%s)"%tag + startdir = os.getcwd() if not os.path.exists(pages_dir): init_repo(pages_dir) @@ -116,6 +130,7 @@ if __name__ == '__main__': # directory, and then copy the html tree in there shutil.rmtree(dest, ignore_errors=True) shutil.copytree(html_dir, dest) + shutil.copy(pjoin(pdf_dir, 'ipython.pdf'), pjoin(dest, 'ipython.pdf')) try: cd(pages_dir) @@ -128,7 +143,7 @@ if __name__ == '__main__': raise RuntimeError(e) sh('git add %s' % tag) - new_htmlindex('index.html', tag) + new_htmlindex('index.html', tag, desc) sh('git add index.html') sh('git commit -m"Created new doc release, named: %s"' % tag) print diff --git a/docs/source/interactive/figs/colors.dark.png b/docs/source/interactive/figs/colors_dark.png similarity index 100% rename from docs/source/interactive/figs/colors.dark.png rename to docs/source/interactive/figs/colors_dark.png Binary files a/docs/source/interactive/figs/colors.dark.png and b/docs/source/interactive/figs/colors_dark.png differ diff --git a/docs/source/interactive/qtconsole.txt b/docs/source/interactive/qtconsole.txt index 165153e..5d0f2f4 100644 --- a/docs/source/interactive/qtconsole.txt +++ b/docs/source/interactive/qtconsole.txt @@ -120,7 +120,7 @@ styles associated with each ``--colors`` option. Screenshot of ``ipython-qtconsole --colors dark``, which uses the 'monokai' theme by default: -.. image:: figs/colors.dark.png +.. image:: figs/colors_dark.png :width: 627px .. Note::