From ac7128b66ef44659fc0c01cf174f1c29aba68e06 Mon Sep 17 00:00:00 2001
From: hanwen <hanwen>
Date: Fri, 4 Jul 2003 13:59:39 +0000
Subject: [PATCH] * python/lilylib.py (make_ps_images): make multipage _really_
 work.

* scripts/lilypond-book.py (do_file): put texidoc before image.
(TexiPaper.process_ly2dvi_block): make multipage _really_ work.
---
 ChangeLog                        |  3 +++
 Documentation/user/lilypond.tely |  4 ++--
 python/lilylib.py                |  5 +++--
 scripts/lilypond-book.py         | 23 ++++++++++++++++++-----
 scripts/update-lily.py           |  2 +-
 5 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ffcf494534..1692d00ab8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2003-07-04  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
+	* python/lilylib.py (make_ps_images): make multipage _really_ work.
+
 	* scripts/lilypond-book.py (do_file): put texidoc before image.
+	(TexiPaper.process_ly2dvi_block): make multipage _really_ work.
 
 	* input/regression/*.ly: fix snippet octaves 
 
diff --git a/Documentation/user/lilypond.tely b/Documentation/user/lilypond.tely
index 688cd78a7e..fe42caac3f 100644
--- a/Documentation/user/lilypond.tely
+++ b/Documentation/user/lilypond.tely
@@ -112,7 +112,7 @@ Copyright 1999--2003 by the authors
 
 @chapter GNU LilyPond --- The music typesetter
 
-This is the user manual for GNU LilyPond 1.7.16.
+This is the user manual for GNU LilyPond 1.8.0.
 
 @cindex web site
 
@@ -128,11 +128,11 @@ this and other documentation.
 * Tutorial::                       A tutorial introduction.
 * Notation manual::                All notation supported, and how to
                                    produce it 
+* Literature::                     Books about notation and engraving.
 * Technical manual::                How it all works.
 * Invoking LilyPond::              Operation.
 * Converting from other formats::  Converting to lilypond source format.
 * lilypond-book manual::           Integrating text and music with lilypond-book.
-* Literature::                     Additional reading material.
 * Index::                          Unified index.
 * Reference manual details::
 * Cheat sheet::     
diff --git a/python/lilylib.py b/python/lilylib.py
index e3ae7917ba..e4116f7cc5 100644
--- a/python/lilylib.py
+++ b/python/lilylib.py
@@ -401,8 +401,9 @@ def make_ps_images (ps_name, resolution = 90):
 	## todo:
 	## have better algorithm for deciding when to crop page,
 	## and when to show full page
-	
-	multi_page = re.search ('^%%Pages: ', open (ps_name).read (1024))
+
+	header = open (ps_name).read (1024)
+	multi_page = re.search ('\n%%Pages: ', header)
 	cmd = ''
 
 	if multi_page == None:
diff --git a/scripts/lilypond-book.py b/scripts/lilypond-book.py
index 974acec389..316694e909 100644
--- a/scripts/lilypond-book.py
+++ b/scripts/lilypond-book.py
@@ -1157,20 +1157,30 @@ def format_lilypond_block (chunk):
 		s = 'output-html'
 
 	def html_pages (basename):
-		files =  glob.glob ("%s-page*.png"%  basename)
-
+		pat = os.path.join (g_outdir, "%s-page*.png"%  basename)
+		
+		files =  glob.glob (pat)
+		
+		
 		template = '''<img align="center" valign="center"
 		border="0" src="%s" alt="[picture of music]">'''
 
 		str = ''
-		if not files:
+		if  files == []:
 			files = [basename+'.png' ]
-		for  f in  files:
+		else:
+			files = map (os.path.basename, files)
+			
+		for f in  files:
 			str += template % f
 
 		str = '<a href="%s.ly">%s</a>' % (basename, str)
+
+		print 'hai', str
+		
 		return str
 
+	
 	newbody = newbody + get_output (s) % {'fn': basename,
 					      'htmlimages': html_pages(basename)
 					      }
@@ -1234,7 +1244,10 @@ linking to the menu.
 		changed = update_file (content, outname)
 
 		preview = base + ".png"
-		if changed or not os.path.isfile (preview):
+		preview_page = base + '-page1.png'
+		
+		if changed or not (os.path.isfile (preview) or
+				   os.path.isfile (preview_page)):
 			
 			ly.system ('%s --preview --postscript --verbose %s ' % (ly2dvi_binary, base) ) 
 
diff --git a/scripts/update-lily.py b/scripts/update-lily.py
index 9c5e9e6043..d90bc62c37 100644
--- a/scripts/update-lily.py
+++ b/scripts/update-lily.py
@@ -32,7 +32,7 @@ import stat
 import string
 import sys
 import __main__
-
+  
 package_name = 'lilypond'
 program_name = 'build-lily'
 program_version = '@TOPLEVEL_VERSION@'
-- 
2.39.5