Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphic or logo in the header #44

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7ed9c20
Section about how to place a graphic or logo in the header of an docu…
der-schmelle2 Jul 1, 2018
e911f56
Add myself as author
der-schmelle2 Jul 1, 2018
3877f83
Add a link within the section
der-schmelle2 Jul 1, 2018
9dad7d6
Made alterations suggested through the review by @tomschr - Part I
der-schmelle2 Jul 10, 2018
f89141f
Imagefile handling within programlisting
der-schmelle2 Jul 10, 2018
f9c4c33
Build example stylesheet file
der-schmelle2 Jul 11, 2018
ffcf757
Merge branch develop into feature/pageheader-graphic
der-schmelle2 Jul 11, 2018
c324c08
Merge branch feature/pageheader-graphic into develop
der-schmelle2 Jul 11, 2018
6f34d84
Document redesign to prozedural steps
der-schmelle2 Jul 12, 2018
4b4d7c8
Syntax error in programlisting
der-schmelle2 Jul 13, 2018
283b9bc
Syntax error corrected, second time
der-schmelle2 Jul 13, 2018
339280c
Clarify the global option 'img.src.path'
der-schmelle2 Jul 13, 2018
17aa61d
Conducted the proposed changes by @tomschr
der-schmelle2 Jul 13, 2018
547da13
Conducted the proposed changes II
der-schmelle2 Jul 13, 2018
c6a9877
Discussion section rewritten
der-schmelle2 Jul 14, 2018
0e48460
Fixed two typos
der-schmelle2 Jul 15, 2018
bad3751
Conducted the proposed changes III
der-schmelle2 Jul 15, 2018
a5f09fd
Removed 'procedure' in line 192
der-schmelle2 Jul 16, 2018
4ad0914
oXygenXML line wrap a char 78
der-schmelle2 Jul 16, 2018
5afd918
oXygenXML view changes for 4K display
der-schmelle2 Jul 16, 2018
b554bf2
Merge branch 'develop' of https://github.com/tomschr/dbcookbook.git
der-schmelle2 Jul 24, 2018
73982f8
Merge remote-tracking branch 'origin/develop' into feature/pageheader…
der-schmelle2 Jul 25, 2018
7750465
Cleanup
der-schmelle2 Jul 25, 2018
39ac4fe
test
der-schmelle2 Sep 23, 2018
56f952d
Rewritten with new header.table content
der-schmelle2 Sep 23, 2018
ac67984
<tag/> correction
der-schmelle2 Oct 4, 2018
8667d2d
Project File changed
der-schmelle2 Oct 31, 2018
6e644b9
Intended shortend in file
der-schmelle2 Nov 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ tmp/

*.zip
*.tar.*

DocBook-Cookbook\.xpr

*.xpr
20 changes: 13 additions & 7 deletions DocBook-Cookbook.xpr
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@der-schmelle2 Did you delete this file by accident? 😉

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Tom,
I'm sorry for that.
Today I'm working on a new Windows Laptop with oXygenXML and Gitkraken. Gitkraken told me that I had changed the Docbook-Cookbook.xpr (which was correct). I set this file to ignore and Gitkraken tied to delete it. I don't know why it was deleted from the repo.
Maybe it's a better idea to stash the file.

Peter

Copy link
Owner

@tomschr tomschr Jul 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, don't worry. Such things can happen. 😃 It's easy to fix.

If you want to ignore the file, you can use a "global Git ignore" file like this:

$ git config --global core.excludesfile '~/.gitignore'
$ echo DocBook-Cookbook.xpr >> ~/.gitignore

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Tom,
thanks for the PDF output.
As discussed today I'll rewrite the hole section under a new feature branch due to more knowledge I received today. 😊

<project version="20.0">
<project version="20.1">
Copy link
Owner

@tomschr tomschr Sep 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't be modified in this PR. Unfortunately, oXygen does it automatically. Can you revert the change of this file?

<meta>
<filters directoryPatterns="" filePatterns="" positiveFilePatterns="" showHiddenFiles="false"/>
<options>
<serialized version="20.0" xml:space="preserve">
<serialized version="20.1" xml:space="preserve">
<serializableOrderedMap>
<entry>
<String>document.types</String>
Expand Down Expand Up @@ -503,7 +503,11 @@
</entry>
<entry>
<String>editor.font</String>
<String>DejaVu Sans Mono,0,13</String>
<String>Source Code Pro,0,16</String>
</entry>
<entry>
<String>editor.line.wrap</String>
<Boolean>true</Boolean>
</entry>
<entry>
<String>editor.print.margin.columns</String>
Expand Down Expand Up @@ -538,19 +542,19 @@
</entry>
<entry>
<String>font.for.author.v12</String>
<String>Droid Serif,0,15</String>
<String>Source Sans Pro,0,16</String>
</entry>
<entry>
<String>font.for.gui</String>
<String>DejaVu Sans Condensed,0,13</String>
<String>Monospaced,0,14</String>
</entry>
<entry>
<String>font.for.schema</String>
<String>Droid Sans,0,15</String>
<String>Source Serif Pro,0,16</String>
</entry>
<entry>
<String>font.for.text</String>
<String>Droid Sans,0,14</String>
<String>Monospaced,0,14</String>
</entry>
<entry>
<String>key.editor.document.type.association.option.pane</String>
Expand Down Expand Up @@ -1615,6 +1619,8 @@
<folder name="fo">
<file name="en/xml/fo/topic.design-titlepages.xml"/>
<file name="en/xml/fo/topic.empty-header-and-footer.xml"/>
<file name="en/xml/fo/topic.graphic-pageheader.xml"/>
<file name="en/xml/fo/topic.graphic-titlepage.xml"/>
<file name="en/xml/fo/topic.hyphenating-urls.xml"/>
<file name="en/xml/fo/topic.initials.xml"/>
<file name="en/xml/fo/topic.line-height.xml"/>
Expand Down
11 changes: 11 additions & 0 deletions en/xml/fo/graphic-pageheader/db-graphic-pageheader.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:d="http://docbook.org/ns/docbook">

<xsl:import href="https://cdn.docbook.org/release/xsl/current/xhtml/docbook.xsl"/>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This URL looks strange. Shouldn't it be ".../fo/docbook.xsl"?


<xsl:include href="graphic-pageheader.xsl"/>

</xsl:stylesheet>
295 changes: 295 additions & 0 deletions en/xml/fo/graphic-pageheader/graphic-pageheader.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:d="http://docbook.org/ns/docbook">

<!-- Path to your logo file -->
<xsl:param name="logo.src.path">logo/</xsl:param>
<!-- Name of your logo file -->
<xsl:param name="header.image.filename">Opensource.svg</xsl:param>
<!-- Header rule yes (1) / no (0) -->
<xsl:param name="header.rule" select="0"/>

<xsl:template name="header.table">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="gentext-key" select="''"/>

<!-- default is a single table style for all headers -->
<!-- Customize it for different page classes or sequence location -->

<xsl:variable name="column1">
<xsl:choose>
<xsl:when test="$double.sided = 0">1</xsl:when>
<xsl:when test="$sequence = 'first' or $sequence = 'odd'"
>1</xsl:when>
<xsl:otherwise>3</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<xsl:variable name="column3">
<xsl:choose>
<xsl:when test="$double.sided = 0">3</xsl:when>
<xsl:when test="$sequence = 'first' or $sequence = 'odd'"
>3</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:variable>

<xsl:variable name="candidate">
<fo:table xsl:use-attribute-sets="header.table.properties">
<xsl:call-template name="head.sep.rule">
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="gentext-key" select="$gentext-key"/>
</xsl:call-template>

<fo:table-column column-number="1">
<xsl:attribute name="column-width">
<xsl:text>proportional-column-width(</xsl:text>
<xsl:call-template name="header.footer.width">
<xsl:with-param name="location"
>header</xsl:with-param>
<xsl:with-param name="position" select="$column1"/>
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="gentext-key"
select="$gentext-key"/>
</xsl:call-template>
<xsl:text>)</xsl:text>
</xsl:attribute>
</fo:table-column>
<fo:table-column column-number="2">
<xsl:attribute name="column-width">
<xsl:text>proportional-column-width(</xsl:text>
<xsl:call-template name="header.footer.width">
<xsl:with-param name="location"
>header</xsl:with-param>
<xsl:with-param name="position" select="2"/>
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="gentext-key"
select="$gentext-key"/>
</xsl:call-template>
<xsl:text>)</xsl:text>
</xsl:attribute>
</fo:table-column>
<fo:table-column column-number="3">
<xsl:attribute name="column-width">
<xsl:text>proportional-column-width(</xsl:text>
<xsl:call-template name="header.footer.width">
<xsl:with-param name="location"
>header</xsl:with-param>
<xsl:with-param name="position" select="$column3"/>
<xsl:with-param name="pageclass" select="$pageclass"/>
<xsl:with-param name="sequence" select="$sequence"/>
<xsl:with-param name="gentext-key"
select="$gentext-key"/>
</xsl:call-template>
<xsl:text>)</xsl:text>
</xsl:attribute>
</fo:table-column>

<fo:table-body>
<fo:table-row>
<xsl:attribute
name="block-progression-dimension.minimum">
<xsl:value-of select="$header.table.height"/>
</xsl:attribute>
<fo:table-cell text-align="start" display-align="center">
<xsl:if test="$fop.extensions = 0">
<xsl:attribute name="relative-align"
>baseline</xsl:attribute>
</xsl:if>
<fo:block>
<xsl:call-template name="header.content">
<xsl:with-param name="pageclass"
select="$pageclass"/>
<xsl:with-param name="sequence"
select="$sequence"/>
<xsl:with-param name="position"
select="$direction.align.start"/>
<xsl:with-param name="gentext-key"
select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="center"
display-align="center">
<xsl:if test="$fop.extensions = 0">
<xsl:attribute name="relative-align"
>baseline</xsl:attribute>
</xsl:if>
<fo:block>
<xsl:call-template name="header.content">
<xsl:with-param name="pageclass"
select="$pageclass"/>
<xsl:with-param name="sequence"
select="$sequence"/>
<xsl:with-param name="position"
select="'center'"/>
<xsl:with-param name="gentext-key"
select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
<fo:table-cell text-align="right" display-align="center">
<xsl:if test="$fop.extensions = 0">
<xsl:attribute name="relative-align"
>baseline</xsl:attribute>
</xsl:if>
<fo:block>
<xsl:call-template name="header.content">
<xsl:with-param name="pageclass"
select="$pageclass"/>
<xsl:with-param name="sequence"
select="$sequence"/>
<xsl:with-param name="position"
select="$direction.align.end"/>
<xsl:with-param name="gentext-key"
select="$gentext-key"/>
</xsl:call-template>
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</xsl:variable>

<!-- Really output a header? -->
<xsl:choose>
<xsl:when
test="
$pageclass = 'titlepage' and $gentext-key = 'book'
and $sequence = 'first'">
<!-- no, book titlepages have no headers at all -->
</xsl:when>
<xsl:when test="$sequence = 'blank' and $headers.on.blank.pages = 0">
<!-- no output -->
</xsl:when>
<xsl:otherwise>
<xsl:copy-of select="$candidate"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="header.content">
<xsl:param name="pageclass" select="''"/>
<xsl:param name="sequence" select="''"/>
<xsl:param name="position" select="''"/>
<xsl:param name="gentext-key" select="''"/>

<fo:block>
<xsl:choose>
<xsl:when test="$pageclass = 'titlepage'">
<!-- No footer on titlepages -->
</xsl:when>
<xsl:otherwise>
<!-- Not a titlepage -->
<xsl:choose>
<xsl:when test="$double.sided = 0">
<!-- Start single-sided -->
<xsl:choose>
<xsl:when test="$position = 'left'">
<!-- Nothing or maybe a customer logo -->
<fo:block>
<xsl:apply-templates select="."
mode="titleabbrev.markup"/>
</fo:block>
</xsl:when>
<xsl:when test="$position = 'center'">
<!-- Nothing -->
</xsl:when>
<xsl:when test="$position = 'right'">
<fo:block>
<fo:external-graphic
content-height="10mm">
<xsl:attribute name="src">
<xsl:call-template
name="fo-external-image">
<xsl:with-param name="filename"
select="concat($logo.src.path, $header.image.filename)"
/>
</xsl:call-template>
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</xsl:when>
</xsl:choose>
</xsl:when>
<!-- End single-sided -->
<xsl:otherwise>
<!-- Start double-sided -->
<xsl:choose>
<xsl:when test="$position = 'left'">
<xsl:choose>
<xsl:when
test="$sequence = 'even' or $sequence = 'blank'">
<fo:block>
<fo:external-graphic
content-height="10mm">
<xsl:attribute name="src">
<xsl:call-template
name="fo-external-image">
<xsl:with-param name="filename"
select="concat($logo.src.path, $header.image.filename)"
/>
</xsl:call-template>
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</xsl:when>
<xsl:otherwise>
<!-- Start left (odd) -->
<fo:block>
<xsl:apply-templates select="."
mode="titleabbrev.markup"/>
</fo:block>
<!-- Nothing -->
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<!-- End left (odd) -->
<xsl:when test="$position = 'center'">
<!-- Nothing -->
</xsl:when>
<!-- Start right (even) -->
<xsl:when test="$position = 'right'">
<xsl:choose>
<xsl:when
test="
$sequence = 'even' or
$sequence = 'blank'">
<fo:block>
<xsl:apply-templates select="."
mode="titleabbrev.markup"/>
</fo:block>
</xsl:when>
<xsl:otherwise>
<fo:block>
<fo:external-graphic
content-height="10mm">
<xsl:attribute name="src">
<xsl:call-template
name="fo-external-image">
<xsl:with-param name="filename"
select="concat($logo.src.path, $header.image.filename)"
/>
</xsl:call-template>
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:otherwise>
<!-- Double-sided -->
</xsl:choose>
</xsl:otherwise>
<!--Not a title page-->
</xsl:choose>
</fo:block>
</xsl:template>
</xsl:stylesheet>