View Single Post
Old 08-13-2013, 02:24 PM   #12
ibu
Addict
ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.ibu can eat soup with a fork.
 
Posts: 264
Karma: 9246
Join Date: Feb 2010
Location: Berlin, Germany
Device: Kobo H20, iPhone 6+, Macbook Pro
Quote:
Originally Posted by DiapDealer View Post
Good reasons for doing something have almost zero relevance when talking about a program that must automatically work for whatever someone might try to do with it ... without blowing up in a spectacular mess.
Toxaris wrote, that it is not a rare case and I was curious. That's all.
To avoid a "spectacular mess" I already made a suggestion for the generation of IDs.
There's just a default file type: xhtml.
It get's the consise ids. Ready.

As I said before:
In my humble view consise and readable code - for standard cases - is valuable goal.

Irrational editors, which like messing around with their files, get a less consise code. Ready.

I created an example of a formatted OPF.
May be than it's easier to understand, what I'm talking about.
Code:
<?xml 
	version   ="1.0"
	encoding  ="UTF-8"
	standalone="yes"?>
<package 
	version          ="2.0"
	unique-identifier="book-id"
	xmlns            ="http://www.idpf.org/2007/opf"
	xmlns:dc         ="http://purl.org/dc/elements/1.1/"
	xmlns:opf        ="http://www.idpf.org/2007/opf">
	<metadata>
		<dc:language                                 >de-DE              </dc:language>
		<dc:title                                    >Lorem Ipsum        </dc:title>
		<dc:creator                 opf:role="aut"   >Erika Mustermann   </dc:creator>
		<dc:identifier id="book-id" opf:scheme="ISBN">978-3-86680-192-9  </dc:identifier>
		<dc:publisher                                >Adipisit Buchverlag</dc:publisher>
	</metadata>
	<manifest><!-- Alle Dateien -->
		<item id="toc"      href="toc.ncx"     media-type="application/x-dtbncx+xml" />
		<item id="coverimg" href="cover.jpg"   media-type="image/jpeg" />
		<item id="cover"    href="cover"       media-type="application/xhtml+xml" />
		<item id="title"    href="title"       media-type="application/xhtml+xml" />
		<item id="c01"      href="c01"         media-type="application/xhtml+xml" />
		<item id="c02"      href="c02"         media-type="application/xhtml+xml" />
	</manifest>
	<spine toc="toc"><!-- Reihenfolge von Textdokumenten -->
		<itemref idref="cover" />
		<itemref idref="title" />
		<itemref idref="c01" />
		<itemref idref="c02" />
	</spine>
	<guide><!-- Semantik von Textdokumenten -->
		<reference type="cover"      title="Buchdeckel" href="cover" />
		<reference type="title-page" title="Titelseite" href="title" />
	</guide>
</package>
To compare see a file, freshly generated with Sigil:

Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<package xmlns="http://www.idpf.org/2007/opf" unique-identifier="BookId" version="2.0">
  <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
    <dc:identifier id="BookId" opf:scheme="UUID">urn:uuid:45273454-57d8-4eaf-944b-07671c27d565</dc:identifier>
    <dc:title>Lorem Ipsum</dc:title>
    <dc:creator opf:role="aut">Erika Mustermann</dc:creator>
    <dc:language>de-DE</dc:language>
    <dc:identifier opf:scheme="ISBN">978-3-86680-192-9</dc:identifier>
    <dc:publisher>Adipisit Buchverlag</dc:publisher>
    <meta content="cover.jpg" name="cover" />
  </metadata>
  <manifest>
    <item href="toc.ncx" id="ncx" media-type="application/x-dtbncx+xml" />
    <item href="Text/Section0001.xhtml" id="Section0001.xhtml" media-type="application/xhtml+xml" />
    <item href="Text/Section0002.xhtml" id="Section0002.xhtml" media-type="application/xhtml+xml" />
    <item href="Images/cover.jpg" id="cover.jpg" media-type="image/jpeg" />
    <item href="Text/Cover.xhtml" id="Cover.xhtml" media-type="application/xhtml+xml" />
    <item href="Text/Title.xhtml" id="Title.xhtml" media-type="application/xhtml+xml" />
  </manifest>
  <spine toc="ncx">
    <itemref idref="Cover.xhtml" />
    <itemref idref="Title.xhtml" />
    <itemref idref="Section0001.xhtml" />
    <itemref idref="Section0002.xhtml" />
  </spine>
  <guide>
    <reference href="Text/Cover.xhtml" title="Cover" type="cover" />
  </guide>
</package>

Last edited by ibu; 08-14-2013 at 02:24 AM.
ibu is offline   Reply With Quote