Permalink
Browse files

Moves Options-Class up one level

Also additions to the build-script and the documentation have been made.
  • Loading branch information...
1 parent 07d7e16 commit 52de2c34c3290e21534f4825b1ed6547104b7821 @heiglandreas committed Nov 29, 2011
View
@@ -1,6 +1,6 @@
README:
-Copyright (c) 2009 Andreas Heigl<andreas@heigl.org>
+Copyright (c) 2011 Andreas Heigl<andreas@heigl.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -30,13 +30,13 @@ This package has the following requirements:
* Input has to be UTF8-encoded.
On loading the \Org\Heigl\Hyphenator\Hyphenator-class the internal encoding for
-the Multibyte-String-Extension will be set to UTF8.
+the Multibyte-String-Extension will be set to UTF8.
+----------------------------------------------------------------------------+
| Installation: |
+----------------------------------------------------------------------------+
-Copy at least the 'Hyphenator'-folder somewhere to your PHP-include-directory
+Copy the 'Org/Heigl/Hyphenator'-folder somewhere to your PHP-include-directory
+----------------------------------------------------------------------------+
| Usage: |
@@ -55,4 +55,4 @@ echo $hyphenatedText;
+----------------------------------------------------------------------------+
| Documentation: |
+----------------------------------------------------------------------------+
-Use the included documentation from the 'doc/api'-folder
+More documentation can be found in the 'documentation'-folder
View
@@ -38,15 +38,20 @@
<!-- This target deletes all temporary files from the directory -->
<target name="clean">
- <delete dir="doc/" />
- <delete dir="build" />
+ <delete includeemptydirs="true">
+ <fileset dir="${basedir}/build">
+ <include name="**/*" />
+ </fileset>
+ </delete>
</target>
<target name="build"
- depends="clean, doc, test, distribute" />
+ depends="clean, doc, test, docbook, distribute" />
<target name="test">
<mkdir dir="${basedir}/build/logs"/>
+ <mkdir dir="${basedir}/build/phpunit"/>
+ <mkdir dir="${basedir}/build/phpunit/coverage"/>
<delete includeemptydirs="true" verbose="false">
<fileset dir="${basedir}/build/phpunit/coverage">
<include name="**/*" />
@@ -68,9 +73,10 @@
<property file="build.number" />
<mkdir dir="${basedir}/dist"/>
<zip destfile="dist/Org_Heigl_Hyphenator-Build_${build.number}.zip">
- <zipfileset dir="build/api" prefix="doc/api" />
- <zipfileset dir="build/doc" prefix="doc/manuals" />
- <zipfileset dir="src" />
+ <zipfileset dir="build/api" prefix="documentation/api" />
+ <zipfileset dir="build/doc" prefix="documentation/manual" />
+ <zipfileset dir="build/phpunit/coverage" prefix="documentation/coverage" />
+ <zipfileset dir="src/Org/Heigl/Hyphenator" prefix="library/Org/Heigl/Hyphenator"/>
<fileset dir="." includes="CHANGELOG" />
<fileset dir="." includes="LICENSE" />
<fileset dir="." includes="README" />
@@ -86,7 +92,7 @@
</fileset>
</delete>
<exec executable="xsltproc" dir="${basedir}">
- <arg line="--xinclude --output build/doc/index.html --stringparam html.stylesheet css/style.css doc/main.xml "/>
+ <arg line="--output build/doc/index.html doc/hyphenator.xsl doc/main.xml "/>
</exec>
<copy todir="${basedir}/build/doc/">
<fileset dir="${basedir}/doc/inc/"/>
View
@@ -1 +0,0 @@
-*
View
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="hyphenator.configuration">
+ <title>Configuration-Options</title>
+ <para>
+ The <classname>Org\Heigl\Hyphenator</classname>-Package can be configured
+ using the <filename>Hyphenator.properties</filename>-File inside
+ the defined <varname>HYPHENATOR_HOME</varname>-Directory.
+ </para>
+ <para>
+ The <varname>HYPHENATOR_HOME</varname>-Directory will be retrieved on
+ Instantiation of the <package>Hyphenator</package> by checking
+ the following possibilities.
+ <orderedlist>
+ <listitem>Check for a folder defined via <methodname>Org\Heigl\Hyphenator::setDefaultHomePath</methodname>.</listitem>
+ <listitem>Check for a PHP-constant <varname>HYPHENATOR_HOME</varname>.</listitem>
+ <listitem>Check for an environment-variable <varname>HYPHENATOR_HOME</varname>.</listitem>
+ <listitem>Use the in the package included <filename>share</filename>-folder</listitem>
+ </orderedlist>
+ </para>
+ <para>
+ You can also configure the <package>Hyphenator</package> via an
+ <classname>Org\Heigl\Hyphenator\Options\Options</classname>-Instance
+ that can either be retrieved from or replace an existing
+ Options-Instance in an existing Hyphenator-Object;
+ <programlisting language="php" id="hyphenator.configuration.setorgetoptions"><![CDATA[$hyphenator = Hyphenator::factory();
+// Retrieve an existing Options-Instance
+$options = $hyphenator->getOptions();
+// Set an Options
+$options->setLeftMin(3);
+// You can also cascade that.
+$hyphenator->getOptions()->setLeftMin(3);
+// Or you can create a new Options-Object
+$options = new \Org\Heigl\Hyphenator\Options\Options();
+$options->setLeftMin(3);
+$hyphenator->setOptions($options);
+// CAVEAT: This will also set all other Options to the default values!]]></programlisting>
+ </para>
+ <para>
+ The following configuration-Options can be used in the
+ </para>
+ <para>
+ These are
+ </para>
+ <definitionlist>
+ <listitem></listitem>
+ </definitionlist>
+</chapter>
View
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="hyphenator.examples">
+ <title>Usage-Examples</title>
+ <sect1>
+ <title>Simple Example</title>
+ <para>
+ <programlisting language="php" id="example.simple">
+ <![CDATA[use \Org\Heigl\Hyphenator as h;
+$hyphenator = h\Hyphenator::factory();
+$result = $hyphenator->hyphenate('This is your text to be hyphenated');]]>
+ </programlisting>
+ </para>
+ <para>
+ Plainly create a <classname>Hyphenator</classname>-Object via the
+ factory-method and invoke its <methodname>hyphenate</methodname>-method.
+ </para>
+ <para>
+ It will be hard to make it more simple.
+ </para>
+ </sect1>
+ <sect1>
+ <title>Simple example with non-standard Hyphenator-Home-folder</title>
+ <para>
+ <programlisting language="php"><![CDATA[use \Org\Heigl\Hyphenator as h;
+$hyphenator = h\Hyphenator::factory('/path/to/home/directory');
+$result = $hyphenator->hyphenate('This is your text to be hyphenated');]]></programlisting>
+ </para>
+ <para>
+ Of course the Hyphenators home-folder has to be available in the
+ given location and has to be writeable to hte user executing the
+ hyphenator (normaly the webserver-user).
+ </para>
+ </sect1>
+</chapter>
View
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ version="1.0">
+
+ <xsl:import href="http://www.heigl.org/docbook/xsl/html/chunk.xsl"/>
+
+ <xsl:param name="html.stylesheet">css/style.css</xsl:param>
+ <xsl:param name="admon.graphics" select="1"/>
+ <xsl:param name="chunker.output.encoding" select="'UTF-8'"/>
+ <xsl:param name="chunk.section.depth" select="0"/>
+
+ <xsl:template match="lineannotation">
+ <fo:inline font-style="italic">
+ <xsl:call-template name="inline.charseq"/>
+ </fo:inline>
+ </xsl:template>
+</xsl:stylesheet>
View
@@ -35,26 +35,21 @@ PRE.PROGRAMLISTING
{
font-family:monospace;
white-space: pre;
- width: 100%;
- background-color: #ffffcc;
+ background-color: #dddddd;
border:solid;
color: #000000;
- border-color: #009999;
- border-left: solid #009999 2px;
- border-right: solid #009999 2px;
- border-top: solid #009999 2px;
- border-bottom: solid #009999 2px;
-
- padding-left: 15pt;
+ border: 1px solid #888888;
+ padding: 1em;
}
-H1
-{
+h1{
color: #cccccc;
- background-color: #ffffff;
+ background-color: #000000;
font-variant: small-caps;
- padding: 0.5em;
+ line-height: 1.5em;
+ padding-left:0.5em;
}
+.book h1 {background-color: transparent;}
H1.TITLE
{
@@ -85,7 +80,7 @@ h2
color: #cccccc ;
font-style: italic;
background-color: #ffffff;
- padding: 0.5em
+ padding: 0.5em 0;
}
TABLE.IMPORTANT
@@ -144,7 +139,7 @@ DIV.VARIABLELIST {
PADDING: 1px
}
a{
- text-decoration:none;
+ text-decoration:none;
color: inherit;
}
a:link{
@@ -211,22 +206,22 @@ hr {
}
div.navfooter td[align=right] a,div.navheader td[align=right] a {
- background: transparent url(../img/right.png) right center no-repeat;
- text-indent:-10000px;
- display:inline-block;
- height:20px;
- width:20px;
- color:transparent;
- text-shadow: transparent 0 0 0;
+ background: transparent url(../img/right.png) right center no-repeat;
+ text-indent:-10000px;
+ display:inline-block;
+ height:20px;
+ width:20px;
+ color:transparent;
+ text-shadow: transparent 0 0 0;
}
div.navfooter td[align=left] a,div.navheader td[align=left] a {
- background: transparent url(../img/left.png) right center no-repeat;
- text-indent:-10000px;
- display:inline-block;
- height:20px;
- width:20px;
- color:transparent;
- text-shadow: transparent 0 0 0;
+ background: transparent url(../img/left.png) right center no-repeat;
+ text-indent:-10000px;
+ display:inline-block;
+ height:20px;
+ width:20px;
+ color:transparent;
+ text-shadow: transparent 0 0 0;
}
DIV.NUKEFOOTER {
@@ -264,36 +259,49 @@ DIV.EXAMPLE{
}
div.toc{
- background-color:transparent;
- padding: 10px;
+ background-color:transparent;
+ padding: 10px;
}
div.toc dl {
- padding-left: 10px;
+ padding-left: 10px;
}
div.chapter .toc {
- margin-left: 20px;
- margin-bottom: 20px;
- width: 150px;
- position:absolute;
- top: 0;
- right:0;
- background-color: lightgoldenrodyellow;
- border: 1px solid gray;
-}
-
-UL {
- list-style: url("images/tux-bullet.png") disc;
+ display:none;
+ margin-left: 20px;
+ margin-bottom: 20px;
+ width: 150px;
+ position:absolute;
+ top: 0;
+ right:0;
+ background-color: lightgoldenrodyellow;
+ border: 1px solid gray;
+}
+
+div.titlepage .copyright, div.titlepage div.author{
+ padding: 0 2em;
+}
+
+UL, OL, DL {
+ list-style-position: inside;
+}
+ul,ol {
+ padding-left: 2em;
+ text-indent:-2em;
}
-
-div.chapter {
+ul {
+ list-style-type: circle;
+}
+
+div.chapter, div.toc {
position:relative;
top:0;
left: 0;
+ padding: 1em 2em;
}
div.chapter p {
- padding: 0.5em 20px;
+ padding: 0.5em 0;
line-height: 1.3em;
}
View
@@ -1,10 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="hyphenator.installation">
<title>Installation</title>
- <sect1 id="hyphenator.installation.reauirements">
- <title>Requirements</title>
- </sect1>
- <sect1 id="hyphenator.installation.installation">
- <title>Installation</title>
- </sect1>
+ <para>
+ Installation is fairly simple.
+ <orderedlist>
+ <listitem>Take the <filename>Org</filename>-Folder and place it somewhere
+ your include-path reaches it.</listitem>
+ <listitem>Make the folder <filename>Org/Heigl/Hyphenator/shared</filename>
+ writeable. As an alternative you can also copy that folder to any
+ location you like and set the <varname>HYPHERNATOR_HOME</varname>-Environment
+ Variable or PHP-constant to that path before invoking the Hyphenator
+ for the first time.
+ </listitem>
+ <listitem>
+ Register the autoloader by calling <code>Org\Heigl\Hyphenator\Hyphenator::registerAutoload()</code>
+ </listitem>
+ <listitem>
+ Hyphenate!
+ </listitem>
+ </orderedlist>
+ </para>
</chapter>
View
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- -->
-<chapter id="hyphenator.introduction">
- <title>Introduction</title>
- <para>
- <classname>Org\Heigl\Hyphenator</classname> is a package to enable
- word-hyphenation in PHP. It uses the algorithms described by Marc Liang
- in his thesis Word Hyphenation by computer and the extensions described
- by ?? in his work ??.
- </para>
- <para>
- These algorithms are based on matching words against certain patterns
- that describe places inside a word where hyphenation is possible or
- must not occur. This Hyphenator uses the pattern-files from OpenOffice
- which are based on the pattern-files created for TeX.
- </para>
-</chapter>
Oops, something went wrong.

0 comments on commit 52de2c3

Please sign in to comment.