コード例 #1
0
ファイル: book.py プロジェクト: vsajip/htmlhelp
    def __init__(self,
                 name=None,
                 archive=None,
                 contents=None,
                 index=None,
                 metadata=None):
        self.name = name

        if archive is None:
            self.archive = DummyArchive()
        else:
            self.archive = archive

        if contents is None:
            self.contents = Contents()
        else:
            self.contents = contents

        if index is None:
            self.index = Index()
        else:
            self.index = index

        if metadata is None:
            self.metadata = {}
        else:
            self.metadata = metadata
コード例 #2
0
ファイル: book.py プロジェクト: BackupTheBerlios/htmlhelp-svn
	def __init__(self, name=None, archive=None, contents=None, index=None, 
			metadata=None):
		self.name = name
		
		if archive is None:
			self.archive = DummyArchive()
		else:
			self.archive = archive

		if contents is None:
			self.contents = Contents()
		else:
			self.contents = contents
			
		if index is None:
			self.index = Index()
		else:
			self.index = index

		if metadata is None:
			self.metadata = {}
		else:
			self.metadata = metadata
コード例 #3
0
ファイル: book.py プロジェクト: BackupTheBerlios/htmlhelp-svn
class Book:
	"""Generic HTML Help book.
	
	@ivar name: Name of the book.
	@type archive: L{htmlhelp.archive.Archive}
	@ivar archive: Archive with the HTML files, pictures, etc.
	@type contents: L{Contents}
	@ivar contents: Table of Contents.
	@type index: L{Index}
	@ivar index: Index.
	@type metadata: dict
	@ivar metadata: Book metadata.
	"""
	
	def __init__(self, name=None, archive=None, contents=None, index=None, 
			metadata=None):
		self.name = name
		
		if archive is None:
			self.archive = DummyArchive()
		else:
			self.archive = archive

		if contents is None:
			self.contents = Contents()
		else:
			self.contents = contents
			
		if index is None:
			self.index = Index()
		else:
			self.index = index

		if metadata is None:
			self.metadata = {}
		else:
			self.metadata = metadata
		
	def _get_title(self):
		"""Get the book title, which is the name in the contents root entry."""

		return self.contents.name

	title = property(_get_title, doc="""Book title.""")

	def _get_default_link(self):
		"""Get the book title, which is the link in the contents root entry."""

		return self.contents.link

	default_link = property(_get_default_link, doc="""Default link.""")
	
	def list(self):
		"""List the pages in the book."""

		return self.archive.keys()
		
	def resource(self, path):
		"""Return a file-like object with the required link."""
		
		return self.archive[path]
コード例 #4
0
ファイル: book.py プロジェクト: vsajip/htmlhelp
class Book:
    """Generic HTML Help book.
	
	@ivar name: Name of the book.
	@type archive: L{htmlhelp.archive.Archive}
	@ivar archive: Archive with the HTML files, pictures, etc.
	@type contents: L{Contents}
	@ivar contents: Table of Contents.
	@type index: L{Index}
	@ivar index: Index.
	@type metadata: dict
	@ivar metadata: Book metadata.
	"""
    def __init__(self,
                 name=None,
                 archive=None,
                 contents=None,
                 index=None,
                 metadata=None):
        self.name = name

        if archive is None:
            self.archive = DummyArchive()
        else:
            self.archive = archive

        if contents is None:
            self.contents = Contents()
        else:
            self.contents = contents

        if index is None:
            self.index = Index()
        else:
            self.index = index

        if metadata is None:
            self.metadata = {}
        else:
            self.metadata = metadata

    def _get_title(self):
        """Get the book title, which is the name in the contents root entry."""

        return self.contents.name

    title = property(_get_title, doc="""Book title.""")

    def _get_default_link(self):
        """Get the book title, which is the link in the contents root entry."""

        return self.contents.link

    default_link = property(_get_default_link, doc="""Default link.""")

    def list(self):
        """List the pages in the book."""

        return self.archive.keys()

    def resource(self, path):
        """Return a file-like object with the required link."""

        return self.archive[path]
コード例 #5
0
ファイル: test_archive_dummy.py プロジェクト: vsajip/htmlhelp
 def setUp(self):
     self.archive = DummyArchive()