From 18cbd287cb9bff608b5b6d6d8b579f02a06d525f Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Fri, 24 Nov 2017 15:35:23 +0100 Subject: [PATCH] Animated SVGs --- Doc/Sd1/objectsClasses.xml | 17 +- ws/Docbook/CustomLayer/slide/slideHdm.xsl | 34 +- .../Scale/FormatXfig/Ref/stack.multi.svg | 490 ++++++++++++++++++ .../Tdata/Scale/FormatXfig/xpath.xml | 10 + .../Preprocess/Xsl/docbookExtractFig.xsl | 86 ++- ws/Docbook/Preprocess/make.rules | 2 +- 6 files changed, 618 insertions(+), 21 deletions(-) create mode 100644 ws/Docbook/Extensions/Tdata/Scale/FormatXfig/Ref/stack.multi.svg diff --git a/Doc/Sd1/objectsClasses.xml b/Doc/Sd1/objectsClasses.xml index f863021c7..f3b6d837c 100644 --- a/Doc/Sd1/objectsClasses.xml +++ b/Doc/Sd1/objectsClasses.xml @@ -3271,7 +3271,7 @@ Club's member count:3</screen> </figure> <figure xml:id="sd1_fig_staticNoInstanceNeeded"> - <title>Why creating an instance?</title> + <title>Why requiring an instance?</title> <informaltable border="1"> <tr> @@ -3293,11 +3293,11 @@ Club's member count:3</screen> </tr> </informaltable> - <para>Observation: No object state required.</para> + <para>Observation: Object state irrelevant.</para> </figure> <figure xml:id="sd1_fig_staticStateIndependentMethods"> - <title>Solution: Use a class method</title> + <title>Favour class over instance method</title> <informaltable border="1"> <tr> @@ -4447,8 +4447,8 @@ Largest long value:9223372036854775807</screen></td> </tr> </informaltable> - <para>So 21! already yields a negative value. Actually - <inlineequation> + <para>So <code>21!</code> already yields a negative value. + Actually <inlineequation> <m:math display="inline"> <m:mrow> <m:mrow> @@ -4618,17 +4618,16 @@ Largest long value:9223372036854775807</screen></td> </m:mrow> </m:mrow> </m:math> - </inlineequation> having identical value by adding a simple - <code>if</code> statement:</para> + </inlineequation> having identical value:</para> <programlisting language="java"> public static long binomial(int n, int k) { - // Trying to avoid arithmetic overflow by making use of: + // Trying to avoid arithmetic overflow using: // n n // ( ) = ( ) // k n-k // - if (n / 2 < k) { + if (n - k < k) { k = n - k; } diff --git a/ws/Docbook/CustomLayer/slide/slideHdm.xsl b/ws/Docbook/CustomLayer/slide/slideHdm.xsl index b8b4b0b8f..5cdf15f37 100644 --- a/ws/Docbook/CustomLayer/slide/slideHdm.xsl +++ b/ws/Docbook/CustomLayer/slide/slideHdm.xsl @@ -133,11 +133,25 @@ <xsl:with-param name="path" select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/> <xsl:with-param name="separator" select="'.fig.svg'"/> </xsl:call-template> + <xsl:call-template name="hdm.get.leftmost.of.separator"> + <xsl:with-param name="path" select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/> + <xsl:with-param name="separator" select="'.multi.svg'"/> + </xsl:call-template> </xsl:variable> <xsl:if test="0 < string-length($xfigBasename)"> <xsl:variable name="xfigBasenameSet" select="document(concat($xfigBasename, '.filenames'), .)/start/file"/> + + <xsl:message> + <xsl:text>---------------</xsl:text> + <xsl:value-of select="d:mediaobject/d:imageobject/d:imagedata/@fileref"/> + <xsl:text>:</xsl:text> + <xsl:value-of select="$xfigBasename"/> + <xsl:text>:</xsl:text> + <xsl:value-of select="$xfigBasenameSet"/> + </xsl:message> + <xsl:if test="count($xfigBasenameSet)"> <xsl:for-each select="$xfigBasenameSet"> <xsl:if test="position() < last()"> @@ -147,15 +161,17 @@ </xsl:if> <xsl:apply-templates select="$titleNode"/> - <img alt="layered SVG image"> - <xsl:attribute name="src"> - <xsl:value-of select="$baseSupplementDir"/> - <xsl:value-of select="$xfigBasename"/> - <xsl:text>-</xsl:text> - <xsl:value-of select="position() - 1"/> - <xsl:text>.svg</xsl:text> - </xsl:attribute> - </img> + <div class="mediaobject"> + <img alt="layered SVG image" width="810"> + <xsl:attribute name="src"> + <xsl:value-of select="$baseSupplementDir"/> + <xsl:value-of select="$xfigBasename"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="position() - 1"/> + <xsl:text>.svg</xsl:text> + </xsl:attribute> + </img> + </div> <div class ="hdmfooter"> <p> diff --git a/ws/Docbook/Extensions/Tdata/Scale/FormatXfig/Ref/stack.multi.svg b/ws/Docbook/Extensions/Tdata/Scale/FormatXfig/Ref/stack.multi.svg new file mode 100644 index 000000000..19f30cd55 --- /dev/null +++ b/ws/Docbook/Extensions/Tdata/Scale/FormatXfig/Ref/stack.multi.svg @@ -0,0 +1,490 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:ns1="https://launchpad.net/jessyink" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="70.046959mm" + height="47.967087mm" + viewBox="0 0 70.046966 47.967086" + version="1.1" + id="svg8" + inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" + sodipodi:docname="stack.multi.svg"> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="3.6400351" + inkscape:cx="140.40046" + inkscape:cy="96.295154" + inkscape:document-units="mm" + inkscape:current-layer="g5062" + showgrid="true" + inkscape:window-width="1600" + inkscape:window-height="1145" + inkscape:window-x="0" + inkscape:window-y="27" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" + showguides="false"> + <inkscape:grid + type="xygrid" + id="grid153" + originx="-1.4239177" + originy="-0.32290521" /> + </sodipodi:namedview> + <defs + id="defs2"> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="marker4842" + style="overflow:visible" + inkscape:isstock="true"> + <path + inkscape:connector-curvature="0" + id="path4840" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" /> + </marker> + <marker + inkscape:isstock="true" + style="overflow:visible" + id="marker1748" + refX="0" + refY="0" + orient="auto" + inkscape:stockid="Arrow2Mend" + inkscape:collect="always"> + <path + transform="scale(-0.6)" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + id="path1746" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1073" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Lend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Lend" + style="overflow:visible" + inkscape:isstock="true"> + <path + id="path1067" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="matrix(-1.1,0,0,-1.1,-1.1,0)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-9" + style="overflow:visible" + inkscape:isstock="true" + inkscape:collect="always"> + <path + inkscape:connector-curvature="0" + id="path1073-3" + style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6)" /> + </marker> + </defs> + <metadata + id="metadata5"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + transform="translate(-1.4239073,-15.357164)" + style="display:none" + inkscape:label="Layer 7" + id="g5078" + inkscape:groupmode="layer"> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path5064" + d="m 29.104167,27.928419 c 0,-10.583334 0,-10.583334 10.583333,-10.583334" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1748)" /> + <text + id="text5068" + y="18.667999" + x="41.955357" + style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="18.667999" + x="41.955357" + sodipodi:role="line" + id="tspan5066">empty(): <tspan + style="fill:#008000" + id="tspan5080">false</tspan></tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="27.544979" + y="53.280647" + id="text5072"><tspan + sodipodi:role="line" + id="tspan5070" + x="27.544979" + y="53.280647" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332">1</tspan></text> + <text + id="text5076" + y="91.531288" + x="39.737396" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve" + transform="translate(-12.586607,-32.908036)"><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332" + y="91.531288" + x="39.737396" + id="tspan5074" + sodipodi:role="line">4</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="g4686" + inkscape:label="Layer 6" + style="display:none" + transform="translate(-1.4239073,-15.357164)"> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1748)" + d="m 29.104167,27.928419 c 0,-10.583334 0,-10.583334 10.583333,-10.583334" + id="path4666" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="41.955357" + y="18.667999" + id="text4670"><tspan + id="tspan4668" + sodipodi:role="line" + x="41.955357" + y="18.667999" + style="stroke-width:0.26458332">top(): <tspan + style="fill:#008000" + id="tspan5082">1</tspan></tspan></text> + <text + id="text4680" + y="53.280647" + x="27.544979" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332" + y="53.280647" + x="27.544979" + id="tspan4678" + sodipodi:role="line">1</tspan></text> + <text + transform="translate(-12.586607,-32.908036)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="39.737396" + y="91.531288" + id="text4684"><tspan + sodipodi:role="line" + id="tspan4682" + x="39.737396" + y="91.531288" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332">4</tspan></text> + </g> + <g + style="display:none" + inkscape:label="Layer 5" + id="g1744" + inkscape:groupmode="layer" + transform="translate(-1.4239073,-15.357164)"> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path1724" + d="m 29.104167,27.928419 c 0,-10.583334 0,-10.583334 10.583333,-10.583334" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1748)" /> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="27.544979" + y="53.280647" + id="text1738"><tspan + sodipodi:role="line" + id="tspan1736" + x="27.544979" + y="53.280647" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332">1</tspan></text> + <text + id="text1742" + y="91.531288" + x="39.737396" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve" + transform="translate(-12.586607,-32.908036)"><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332" + y="91.531288" + x="39.737396" + id="tspan1740" + sodipodi:role="line">4</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="41.620956" + y="18.697098" + id="text4670-3"><tspan + id="tspan4668-6" + sodipodi:role="line" + x="41.620956" + y="18.697098" + style="stroke-width:0.26458332">pop(): <tspan + style="fill:#008000" + id="tspan5084">7</tspan></tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer3" + inkscape:label="Layer 4" + style="display:none" + transform="translate(-1.4239073,-15.357164)"> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow2Mend-9)" + d="m 18.520833,17.345085 c 10.583333,0 10.583333,0 10.583333,10.583334" + id="path1044-4" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="1.0394347" + y="18.573505" + id="text1036-3-1"><tspan + sodipodi:role="line" + id="tspan1034-5-5" + x="1.0394347" + y="18.573505" + style="stroke-width:0.26458332">push(<tspan + style="fill:#ff0000" + id="tspan5086">7</tspan>)</tspan></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="27.450483" + y="47.799992" + id="text143"><tspan + sodipodi:role="line" + id="tspan141" + x="27.450483" + y="47.799992" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332">7</tspan><tspan + sodipodi:role="line" + x="27.450483" + y="53.09166" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332" + id="tspan1660" /></text> + <text + id="text1656-0" + y="53.280647" + x="27.544979" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332" + y="53.280647" + x="27.544979" + id="tspan1654-8" + sodipodi:role="line">1</tspan></text> + <text + transform="translate(-12.586607,-32.908036)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="39.737396" + y="91.531288" + id="text139-6"><tspan + sodipodi:role="line" + id="tspan137-59" + x="39.737396" + y="91.531288" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332">4</tspan></text> + </g> + <g + style="display:none" + inkscape:label="Layer 3" + id="g1658" + inkscape:groupmode="layer" + transform="translate(-1.4239073,-15.357164)"> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path1648" + d="m 18.520833,17.345085 c 10.583333,0 10.583333,0 10.583333,10.583334" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow2Mend-9)" /> + <text + id="text1652" + y="18.573505" + x="1.0394347" + style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="18.573505" + x="1.0394347" + id="tspan1650" + sodipodi:role="line">push(<tspan + style="fill:#ff0000" + id="tspan5088">1</tspan>)</tspan></text> + <text + id="text1656" + y="53.186153" + x="27.639473" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332" + y="53.186153" + x="27.639473" + id="tspan1654" + sodipodi:role="line">1</tspan></text> + <text + transform="translate(-12.586607,-32.908036)" + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="39.737396" + y="91.720276" + id="text139-3"><tspan + sodipodi:role="line" + id="tspan137-5" + x="39.737396" + y="91.720276" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332">4</tspan></text> + </g> + <g + transform="translate(-14.010514,-48.2652)" + inkscape:groupmode="layer" + id="layer2" + inkscape:label="Layer 2" + style="display:none"> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="73.524055" + y="52.45573" + id="text135"><tspan + sodipodi:role="line" + id="tspan133" + x="73.524055" + y="56.201237" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332" /></text> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333311px;line-height:1.25;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="39.737392" + y="91.720276" + id="text139"><tspan + sodipodi:role="line" + id="tspan137" + x="39.737392" + y="91.720276" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono';stroke-width:0.26458332">4</tspan></text> + <path + style="fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Arrow2Mend)" + d="m 31.107441,50.253121 c 10.583333,0 10.583333,0 10.583333,10.583334" + id="path1044" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <text + xml:space="preserve" + style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + x="13.626042" + y="51.481541" + id="text1036-3"><tspan + sodipodi:role="line" + id="tspan1034-5" + x="13.626042" + y="51.481541" + style="stroke-width:0.26458332">push(<tspan + style="fill:#ff0000" + id="tspan5090">4</tspan>)</tspan></text> + </g> + <g + transform="translate(-1.4239073,-15.357164)" + style="display:inline" + inkscape:label="Layer 1" + id="g5062" + inkscape:groupmode="layer"> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path5048" + d="m 29.104167,27.928419 c 0,-10.583334 0,-10.583334 10.583333,-10.583334" + style="display:inline;fill:none;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#marker1748)" /> + <text + id="text5052" + y="18.667999" + x="41.955357" + style="font-style:normal;font-weight:normal;font-size:4.23333311px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" + xml:space="preserve"><tspan + style="stroke-width:0.26458332" + y="18.667999" + x="41.955357" + sodipodi:role="line" + id="tspan5050">empty(): <tspan + style="fill:#008000" + id="tspan5092">true</tspan></tspan></text> + </g> + <g + ns1:masterSlide="masterSlide" + transform="translate(-14.010514,-48.2652)" + inkscape:label="Master" + inkscape:groupmode="layer" + id="layer1" + style="display:inline" + sodipodi:insensitive="true"> + <path + style="display:inline;fill:none;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="m 35.07619,59.513538 v 35.71875 h 13.229167 v -35.71875" + id="path155-1" + inkscape:connector-curvature="0" /> + </g> +</svg> diff --git a/ws/Docbook/Extensions/Tdata/Scale/FormatXfig/xpath.xml b/ws/Docbook/Extensions/Tdata/Scale/FormatXfig/xpath.xml index 4267fc531..501ac0529 100644 --- a/ws/Docbook/Extensions/Tdata/Scale/FormatXfig/xpath.xml +++ b/ws/Docbook/Extensions/Tdata/Scale/FormatXfig/xpath.xml @@ -11,6 +11,16 @@ xmlns:db="http://docbook.org/ns/docbook"> <title>Images</title> + <figure xml:id="fig_animatedStack"> + <title>Animated stack</title> + + <mediaobject> + <imageobject> + <imagedata fileref="Ref/stack.multi.svg"/> + </imageobject> + </mediaobject> + </figure> + <figure xml:id="sd1VideoUsingScannerClass"> <title>Using a <classname xlink:href="https://docs.oracle.com/javase/8/docs/api/java/util/Scanner.html">Scanner</classname> diff --git a/ws/Docbook/Preprocess/Xsl/docbookExtractFig.xsl b/ws/Docbook/Preprocess/Xsl/docbookExtractFig.xsl index bca4cc942..1f8ce93dc 100644 --- a/ws/Docbook/Preprocess/Xsl/docbookExtractFig.xsl +++ b/ws/Docbook/Preprocess/Xsl/docbookExtractFig.xsl @@ -1,7 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns="http://docbook.org/ns/docbook" xmlns:d="http://docbook.org/ns/docbook"> + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + xmlns:jessyink="https://launchpad.net/jessyink" + xmlns:d="http://docbook.org/ns/docbook"> <xsl:import href="../../docbook-xsl/xhtml/chunk.xsl"/> @@ -12,12 +15,14 @@ <xsl:variable name="figFiles" select="//d:imagedata[ends-with(@fileref, '.fig') ]" /> <xsl:variable name="pdfFiles" select="//d:imagedata[ends-with(@fileref, '.pdf') ]" /> + <xsl:variable name="animatedSvgFiles" select="//d:imagedata[ends-with(@fileref, '.multi.svg') ]" /> <xsl:apply-templates select="//d:imagedata[ends-with(@fileref, '.fig') ]" mode="printLatex"/> + <xsl:apply-templates select="$animatedSvgFiles" mode="sortLayer"/> <xsl:result-document method="text" encoding="utf-8" href="mediaobjects.list" > <xsl:text>all: </xsl:text> - + <xsl:for-each select="$figFiles"> <xsl:call-template name="relative-uri"> <xsl:with-param name="destdir"> @@ -57,8 +62,85 @@ </xsl:for-each> </xsl:result-document> + </xsl:template> + + <xsl:template match="d:imagedata" mode="sortLayer"> + <xsl:variable name="svgMulti" select="document(@fileref, .)"/> + + <xsl:value-of select="@fileref"/> + <xsl:text>.files </xsl:text> + + + <xsl:apply-templates select="$svgMulti/svg:svg" mode="sortLayer"> + <xsl:with-param name="svgMultiBasename"> + <xsl:call-template name="hdm.get.leftmost.of.separator"> + <xsl:with-param name="path"> + + <xsl:if test="ancestor::*/@xml:base"> + <xsl:call-template name="hdm.get.leftmost.of.separator"> + <xsl:with-param name="path" select="ancestor::*/@xml:base"/> + <xsl:with-param name="separator" select="'/'"/> + </xsl:call-template> + <xsl:text>/</xsl:text> + </xsl:if> + <xsl:value-of select="@fileref"/> + + </xsl:with-param> + <xsl:with-param name="separator" select="'.multi.svg'"/> + </xsl:call-template> + </xsl:with-param> + <xsl:with-param name="svgRoot" select="$svgMulti/svg:svg"/> + </xsl:apply-templates> + + </xsl:template> + + <xsl:template match="svg:svg" mode="sortLayer"> + <xsl:param name="svgMultiBasename"/> + <xsl:param name="svgRoot"/> + <xsl:variable name="masterSlide" select="svg:g[@jessyink:masterSlide]"/> + + <xsl:variable name="displayLayers" select="svg:g[not(@jessyink:masterSlide)]"/> + + <xsl:result-document href="{$svgMultiBasename}.filenames" exclude-result-prefixes="#all" indent="yes"> + <start> + <xsl:for-each select="$displayLayers"> + <xsl:sort select="@inkscape:label"/> + <xsl:variable name="svgLayerBasefilename"> + <xsl:value-of select="$svgMultiBasename"/> + <xsl:text>-</xsl:text> + <xsl:value-of select="position() - 1"/> + </xsl:variable> + <file> + <xsl:value-of select="$svgLayerBasefilename"/> + </file> + <xsl:result-document href="{$svgLayerBasefilename}.svg" exclude-result-prefixes="svg"> + <svg xmlns="http://www.w3.org/2000/svg"> + <xsl:copy-of select="$svgRoot/@*" /> + <xsl:copy-of select="$svgRoot/*[not (name(.) = 'g')]"/> + <xsl:copy-of select="$masterSlide"/> + <xsl:apply-templates select="." mode="sortLayer"/> + </svg> + </xsl:result-document> + </xsl:for-each> + </start> + </xsl:result-document> </xsl:template> + <xsl:template match="svg:g" mode="sortLayer"> + <svg:g> + <xsl:copy-of select="@*[not(name(.)='style')]|*"/> + </svg:g> + </xsl:template> + + <xsl:template match="*" mode="sortLayer"> + <xsl:message> + <xsl:text>Error: No template defined for element '</xsl:text> + <xsl:value-of select="name(.)"/> + <xsl:text>' in mode sortLayer</xsl:text> + </xsl:message> + </xsl:template> + + <xsl:template match="d:imagedata" mode="printLatex"> <xsl:variable name="dirPath"> diff --git a/ws/Docbook/Preprocess/make.rules b/ws/Docbook/Preprocess/make.rules index 77e19d6fc..10aa2bbab 100644 --- a/ws/Docbook/Preprocess/make.rules +++ b/ws/Docbook/Preprocess/make.rules @@ -99,8 +99,8 @@ SAXONCMD=java -cp "${DBOOK_XSL}/tools/lib/saxon9he.jar:/usr/share/java/xercesImp -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2slide.xsl > ${*}.slide.xml ${SAXONCMD} -s:$*.xml \ -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbook2print.xsl > ${*}.print.xml - cd $(@D); ${SAXONCMD} -s:$(<F) -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbookExtractFig.xsl tar cv- `find . -name Ref -and -type d|grep -v ^\./target`|tar -x -C $(@D) || echo + cd $(@D); ${SAXONCMD} -s:$(<F) -xsl:${DBOOK_XSL_PREPROCESS}/Xsl/docbookExtractFig.xsl cp -f ${DBOOK_XSL_PREPROCESS}/make.image ${DBOOK_XSL_PREPROCESS}/docbooksupplement.js $(@D) cd $(@D); $(MAKE) -j ${numCores} -f make.image;# rm -rf `find . -name Generate` -- GitLab