Skip to content

Commit

Permalink
Added rakefile, install tasks, test tasks, build tasks, and changed x…
Browse files Browse the repository at this point in the history
…sl template to look nicer
  • Loading branch information
napcs committed Dec 9, 2009
1 parent adad5b8 commit 60ae1ad
Show file tree
Hide file tree
Showing 9 changed files with 184 additions and 109 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
output/*
Output/*
.DS_Store
.DS_Store
README.txt
docbook.pdf
tmp/*
33 changes: 26 additions & 7 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
= Short Attention Span Docbook

This package makes it easy for you to set up all of the tools you need to start authoring books and articles
with the open-source Docbook toolchain.
This package makes it easy for you to set up all of the tools you need to start authoring books and articles with the open-source Docbook toolchain.

Contained in this package are the Docbook XSLT stylesheets, a validation package, XML-FO to PDF translation, and
a project generator with build scripts.
Contained in this package are the Docbook XSLT stylesheets, a validation package, XML-FO to PDF translation, and a project generator with build scripts.

This package is intended for developers who want to integrate this into their existing programs, want to be on the bleeding edge, and who wish to do a manual installation. Authors and other end users can download the re-distributable packages available at http://www.napcs.com/products/docbook which are more stable.

This uses the dookbook-xsl-ns stylesheets.

== Usage
== Installation and Usage

See the readme_files/docbook.pdf for more information.
The easiest way to set this up on your machine is to do

rake install

This copies only the necessary files to c:/docbook on windows or ~/docbook on Linux and Mac OS. If you want to install elsewhere, specify a path

sudo rake install DIR=/opt/docbook


See the readme_files/docbook.pdf for more information on installation and usage for end users.

== Paths
The build system works best when you have an environment variable set. On Linux, you would add this to your .bash_profile or other profile scripts.

export SHORT_ATTENTION_SPAN_DOCBOOK_PATH="~/docbook"

On Windows, add this to your environment variables in Control Panel.

This step is not necessary, but can ease collaboration between multiple authors, as Docbook may be installed in different locations on each person's machine.

== Upgrading from previous versions

Expand All @@ -25,7 +40,11 @@ Remember - to build your books, you now use
rake book.pdf VALIOATE=false

== Changes

2009-12-08 - v1.1rc3
* Added Rake tasks for building, testing, and installing
* Added a cover PDF
* Updated stylesheet

2009-12-03 - v1.1rc2

* added DRAFT option
Expand Down
44 changes: 44 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
require 'fileutils'

files = %w{make.rb README.txt hhc.exe jars xsl docbook.pdf generate generate.bat template}


desc "create documentation"
task :doc do
`cd readme_files && rake docbook.pdf && cd ..`
FileUtils.cp "readme_files/docbook.pdf", "./docbook.pdf"
FileUtils.cp "README.rdoc","README.txt"
end

desc "test build chain"
task :test do
`#{File.expand_path(".")}/generate book mytestbook with_sample`
`cd mytestbook && rm book.pdf && rake callout_images && rake book.pdf && open book.pdf && cd .. && rm -rf mytestbook`
end

task :create_zip => :doc do
`zip -r output/docbook-1_1_0.zip #{files.join(" ")}`
end

task :install do
dest = ENV["DIR"] || (RUBY_PLATFORM =~ /(win|w)32$/ ? "c:/docbook" : ENV["HOME"] + "/docbook")
files.each do |file|
target_file = File.join(dest, file)
FileUtils.mkdir_p(File.dirname(target_file))
FileUtils.cp_r(file, target_file)
puts " Copied #{file} to #{target_file}"
end
if RUBY_PLATFORM =~ /(win|w)32$/
puts "Be sure to add #{dest} to your path. See"
puts "http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/path.mspx?mfr=true"
puts "for more information."
else
`chmod +x #{dest}/generate`
puts "Be sure to add"
puts " EXPORT PATH=$PATH:#{dest}"
puts " and optionally,"
puts " EXPORT SHORT_ATTENTION_SPAN_DOCBOOK_PATH=\"#{dest}\""
puts "to your .bashrc or .bash_login or .bash_profile"

end
end
4 changes: 2 additions & 2 deletions docbook.iss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AppUpdatesURL=http://www.napcs.com/products/docbooks
DefaultDirName=c:\docbook
DefaultGroupName=Short Attention Span Docbook
AllowNoIcons=yes
OutputBaseFilename=docbook_setup
OutputBaseFilename=docbook_setup-1_1_0
Compression=lzma
SolidCompression=yes
ChangesEnvironment=yes
Expand All @@ -32,7 +32,7 @@ Source: "make.rb"; DestDir: "{app}"; Flags: ignoreversion
Source: "generate.bat"; DestDir: "{app}"; Flags: ignoreversion
Source: "readme_files/docbook.pdf"; DestDir: "{app}"; Flags: ignoreversion
Source: "hhc.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "xsltproc\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
;Source: "xsltproc\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

; NOTE: Don't use "Flags: ignoreversion" on any shared system files

Expand Down
4 changes: 3 additions & 1 deletion make_zip.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
cp readme_files/docbook.pdf ./
zip -r output/docbook.zip jars xsl docbook.pdf generate generate.bat template
cp README.rdoc README.txt
zip -r output/docbook-1_1_0.zip make.rb README.txt hhc.exe jars xsl docbook.pdf generate generate.bat template
rm README.txt
Binary file modified readme_files/docbook.pdf
Binary file not shown.
8 changes: 4 additions & 4 deletions readme_files/docbook.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)]]></screen>
<sect1>
<title>Mac OS X Setup</title>
<para>Setup on Mac OS X 10.4 or above is quite easy. You have Java and Ruby already installed on the machine
in most cases. All you need to do is download the files from <link xlink:href="http://www.napcsweb.com/files/docbook.zip">http://www.napcsweb.com/files/docbook.zip</link>
and extract to a <filename>docbook</filename> in your home folder. Once extracted, you should have a list of files that resembles this in your <filename>~/docbook</filename> folder:</para>
in most cases. All you need to do is download the files from <link xlink:href="http://www.napcs.com/products/docbook/">http://www.napcs.com/products/docbook/</link>
and extract to <dirname>docbook</dirname> in your home folder. Once extracted, you should have a list of files that resembles this in your <filename>~/docbook</filename> folder:</para>
<screen><![CDATA[
drwxr-xr-x 18 brianhogan brianhogan 612B Apr 2 11:56 .
drwx------+ 63 brianhogan brianhogan 2.1K Apr 2 10:12 ..
Expand Down Expand Up @@ -127,10 +127,10 @@ Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)]]></screen>
Done]]></screen>
<para>Now try generating a PDF.</para>
<para><command>cd my_test_project</command></para>
<para><command>ruby make book.pdf</command></para>
<para><command>rake book.pdf</command></para>
<para>You'll get a brand-new PDF of the sample book.</para>
<tip>
<para>Add the docbook folder to your path to make the new_book command available without having to specify the full path. Modify your <filename>.bash_profile</filename> to change the path.</para>
<para>Add the <dirname>docbook</dirname> folder to your path to make the <command>generate</command> command available without having to specify the full path. Modify your <filename>.bash_profile</filename> to change the path.</para>
</tip>

</sect1>
Expand Down
113 changes: 56 additions & 57 deletions readme_files/xsl/pdf.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,21 @@
xmlns:xslthl="http://xslthl.sf.net"
xmlns:d="http://docbook.org/ns/docbook"
>
<xsl:import href="fo.xml" />

<!-- Import the original FO stylesheet -->
<xsl:import href="file:///Users/brianhogan/git/docbook/xsl/fo/docbook.xsl"/>
<!-- graphics for the alerts, tips, cautions, warnings, notes, etc. Build your own or turn this off! -->
<xsl:param name="admon.graphics" select="1" />

<!-- PDF bookmarking support -->
<xsl:param name="fop1.extensions" select="1" />

<!--programlisting stuff -->


<xsl:param name="use.extensions" select="1"/>
<xsl:param name="linenumbering.extension" select="1"/>
<xsl:param name="linenumbering.everyNth" select="1"/>
<xsl:param name="highlight.source" select="1" />

<!-- section numbering and depth -->
<xsl:param name="section.autolabel" select="1"></xsl:param>
<xsl:param name="section.autolabel.max.depth">2</xsl:param>
<xsl:param name="section.autolabel.max.depth">1</xsl:param>


<!-- xref -->
Expand Down Expand Up @@ -58,12 +55,6 @@ set toc,title
<!-- fonts -->



<!-- draft_settings -->

<xsl:param name="show.comments" select="0"></xsl:param>


<!-- page layout -->

<xsl:param name="page.height.portrait">11in</xsl:param>
Expand All @@ -77,39 +68,51 @@ set toc,title
<xsl:param name="page.margin.bottom">0.50in</xsl:param>
<xsl:param name="body.margin.bottom">0.65in</xsl:param>
<xsl:param name="double.sided">0</xsl:param>
<xsl:param name="body.start.indent">2pc</xsl:param>
<xsl:param name="body.end.indent">2pc</xsl:param>
<xsl:param name="body.start.indent">1pc</xsl:param>
<xsl:param name="body.end.indent">1pc</xsl:param>


<!-- Border and shading for section titles -->
<xsl:attribute-set name="section.title.properties">
<xsl:attribute name="padding">4pt</xsl:attribute>
<xsl:attribute name="color">#000000</xsl:attribute>
</xsl:attribute-set>


<xsl:attribute-set name="section.title.level1.properties">
<xsl:attribute name="start-indent">2pc</xsl:attribute>
<xsl:attribute name="start-indent">1pc</xsl:attribute>
</xsl:attribute-set>
<xsl:attribute-set name="section.level1.properties">
<xsl:attribute name="start-indent">4pc</xsl:attribute>
<xsl:attribute name="start-indent">3pc</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="section.title.level2.properties">
<xsl:attribute name="start-indent">4pc</xsl:attribute>
<xsl:attribute name="start-indent">3pc</xsl:attribute>
<xsl:attribute name="font-size">16pt</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="section.level2.properties">
<xsl:attribute name="start-indent">6pc</xsl:attribute>
<xsl:attribute name="start-indent">3pc</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="section.title.level3.properties">
<xsl:attribute name="start-indent">6pc</xsl:attribute>
<xsl:attribute name="start-indent">3pc</xsl:attribute>
<xsl:attribute name="font-size">14pt</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="section.level3.properties">
<xsl:attribute name="start-indent">8pc</xsl:attribute>
<xsl:attribute name="start-indent">3pc</xsl:attribute>

</xsl:attribute-set>


<xsl:attribute-set name="section.title.level4.properties">
<xsl:attribute name="start-indent">8pc</xsl:attribute>
<xsl:attribute name="start-indent">3pc</xsl:attribute>
<xsl:attribute name="font-size">14pt</xsl:attribute>
</xsl:attribute-set>

<xsl:attribute-set name="section.level4.properties">
<xsl:attribute name="start-indent">8pc</xsl:attribute>
<xsl:attribute name="start-indent">3pc</xsl:attribute>
</xsl:attribute-set>


Expand All @@ -123,40 +126,36 @@ set toc,title
<xsl:attribute name="wrap-option">wrap</xsl:attribute>
<xsl:attribute name="hyphenation-character">\</xsl:attribute>
<xsl:attribute name="font-size">8pt</xsl:attribute>

</xsl:attribute-set>


<!-- borders and shading to note, tip, sidebar, warning, caution -->
<xsl:attribute-set name="admonition.properties">
<xsl:attribute name="border">0.5pt #54514A</xsl:attribute>
<xsl:attribute name="background-color">#F2F2FF</xsl:attribute>
<xsl:attribute name="border">0.5pt solid black</xsl:attribute>
<xsl:attribute name="background-color">#ffffee</xsl:attribute>
<xsl:attribute name="padding">0.1in</xsl:attribute>
</xsl:attribute-set>


<!-- border and shade to screen and programlisting -->
<xsl:attribute-set name="verbatim.properties">
<xsl:attribute name="border">0.5pt #A9A394</xsl:attribute>
<xsl:attribute name="background-color">#FFF7E6</xsl:attribute>
<xsl:attribute name="padding">0.1in</xsl:attribute>
</xsl:attribute-set>


<!-- border and shade to screen and programlisting -->

<xsl:param name="shade.verbatim" select="1"/>

<!-- Border and shading for section titles -->
<xsl:attribute-set name="section.title.properties">
<xsl:attribute name="padding">4pt</xsl:attribute>
<xsl:attribute name="color">#3856A9</xsl:attribute>
<xsl:attribute-set name="shade.verbatim.style">
<xsl:attribute name="background-color">#eeeeee</xsl:attribute>
<xsl:attribute name="border-width">0.5pt</xsl:attribute>
<xsl:attribute name="border-style">solid</xsl:attribute>
<xsl:attribute name="border-color">#575757</xsl:attribute>
<xsl:attribute name="padding">3pt</xsl:attribute>
<xsl:attribute name="margin-left">2pt</xsl:attribute>

</xsl:attribute-set>


<!-- Border and shading for section 1 titles -->
<xsl:attribute-set name="chapter.title.properties">
<xsl:attribute name="padding">8pt</xsl:attribute>
<xsl:attribute name="color">#AF944C</xsl:attribute>
</xsl:attribute-set>





Expand Down Expand Up @@ -243,9 +242,9 @@ set toc,title
<xsl:when test="$position = 'left'">
<xsl:text>Copyright </xsl:text>
<!-- use xpath to grab the year - remember to prefix each node with d: -->
<xsl:value-of select="ancestor-or-self::d:book/d:info/d:copyright/d:year"/>
<xsl:value-of select="ancestor-or-self::d:article/d:info/d:copyright/d:year"/>
<xsl:text> </xsl:text>
<xsl:value-of select="ancestor-or-self::d:book/d:info/d:copyright/d:holder"/>
<xsl:value-of select="ancestor-or-self::d:article/d:info/d:copyright/d:holder"/>
</xsl:when>
<!--
<xsl:when test="$position = 'center'">
Expand Down Expand Up @@ -273,16 +272,16 @@ set toc,title



<xsl:template match='xslthl:keyword'>
<fo:inline font-weight="bold" color="blue"><xsl:apply-templates/></fo:inline>
<xsl:template match='xslthl:keyword' mode="xslthl">
<fo:inline font-weight="bold" color="blue"><xsl:apply-templates mode="xslthl"/></fo:inline>
</xsl:template>

<xsl:template match='xslthl:comment'>
<fo:inline font-style="italic" color="green"><xsl:apply-templates/></fo:inline>
<xsl:template match='xslthl:comment' mode="xslthl">
<fo:inline font-style="italic" color="green"><xsl:apply-templates mode="xslthl"/></fo:inline>
</xsl:template>

<xsl:template match='xslthl:string'>
<fo:inline color="red"><xsl:apply-templates/></fo:inline>
<xsl:template match='xslthl:string' mode="xslthl">
<fo:inline color="red"><xsl:apply-templates mode="xslthl"/></fo:inline>
</xsl:template>

<xsl:template match='d:filename'>
Expand All @@ -301,33 +300,33 @@ set toc,title


<xsl:template match='d:command'>
<fo:inline color="#384FA9">
<fo:inline color="#A2000C">
<xsl:call-template name="inline.monoseq"/>
</fo:inline>
</xsl:template>

<xsl:template match='d:userinput'>
<fo:inline color="#384FA9">
<xsl:call-template name="inline.boldmonoseq" />
<fo:inline color="#138900">
<xsl:call-template name="inline.monoseq" />

</fo:inline>
</xsl:template>

<xsl:template match='d:classname'>
<fo:inline color="#6D38A9">
<xsl:call-template name="inline.boldmonoseq" />
<fo:inline color="#161672">
<xsl:call-template name="inline.monoseq" />
</fo:inline>
</xsl:template>

<xsl:template match='d:methodname'>
<fo:inline color="#6D38A9">
<xsl:call-template name="inline.boldmonoseq" />
<fo:inline color="#161672">
<xsl:call-template name="inline.monoseq" />
</fo:inline>
</xsl:template>

<xsl:template match='d:literal'>
<fo:inline color="#2B541C">
<xsl:call-template name="inline.boldmonoseq" />
<xsl:call-template name="inline.monoseq" />
</fo:inline>
</xsl:template>

Expand Down
Loading

0 comments on commit 60ae1ad

Please sign in to comment.