Skip to content

Commit

Permalink
gh-pages includes pdf
Browse files Browse the repository at this point in the history
also fixed illegal image name in latex

closes ipythongh-267
  • Loading branch information
minrk committed Feb 11, 2011
1 parent eecc1b6 commit 4886db0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
6 changes: 3 additions & 3 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
31 changes: 23 additions & 8 deletions docs/gh-pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

pages_dir = 'gh-pages'
html_dir = 'build/html'
pdf_dir = 'build/latex'
pages_repo = 'git@github.com:ipython/ipython-doc.git'

#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -74,20 +75,28 @@ def init_repo(path):
cd(here)


def render_htmlindex(fname, tag):
rel = '<li> Release: <a href="{t}/index.html">{t}</a>'.format(t=tag)
def render_htmlindex(fname, tag, desc=None):
if desc is None:
desc = tag

rel = '<li>{d}: <a href="{t}/index.html">HTML</a> and <a href="{t}/ipython.pdf">PDF</a>'.format(t=tag,d=desc)
rep = re.compile('<!-- RELEASE -->')
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)
Expand All @@ -102,7 +111,12 @@ def new_htmlindex(fname, tag):
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)
Expand All @@ -116,6 +130,7 @@ def new_htmlindex(fname, tag):
# 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)
Expand All @@ -128,7 +143,7 @@ def new_htmlindex(fname, tag):
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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/interactive/qtconsole.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down

0 comments on commit 4886db0

Please sign in to comment.