From: <var...@us...> - 2015-12-14 10:03:53
|
Revision: 9747 http://sourceforge.net/p/phpwiki/code/9747 Author: vargenau Date: 2015-12-14 10:03:50 +0000 (Mon, 14 Dec 2015) Log Message: ----------- No space at end of line Modified Paths: -------------- trunk/admin/odt2phpwiki.xsl Modified: trunk/admin/odt2phpwiki.xsl =================================================================== --- trunk/admin/odt2phpwiki.xsl 2015-12-14 09:20:05 UTC (rev 9746) +++ trunk/admin/odt2phpwiki.xsl 2015-12-14 10:03:50 UTC (rev 9747) @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. This program is based on the OpenDocument to Mediawiki converter by Bernhard Haumacher. @@ -91,22 +91,22 @@ match="//text:list-style" use="@style:name" /> - + <key name="font-face-ref" match="//style:font-face" use="@style:name" /> - + <key name="reference-resolution" match="//text:reference-mark | //text:reference-mark-start" use="@text:name" /> - + <!-- Wiki style constants. --> - + <!-- Bold character style. --> <variable name="BOLD_BIT" select="1"/> @@ -121,7 +121,7 @@ <!-- Typewriter character style. --> <variable name="TYPEWRITER_BIT" select="16"/> - + <!-- Preformatted text paragraph style. --> <variable name="CODE_BIT" select="32"/> @@ -130,7 +130,7 @@ <!-- Right aligned paragraph style. --> <variable name="RIGHT_BIT" select="128"/> - + <!-- Constant defining the empty style. --> <variable name="NO_STYLE" select="0"/> @@ -169,11 +169,11 @@ <value-of select="$NL"/> </if> </template> - + <template name="mk-list-token"> <param name="list-style"/> <param name="level"/> - + <if test="$level > 1"> <call-template name="mk-list-token"> <with-param name="list-style" select="$list-style"/> @@ -223,7 +223,7 @@ <!-- Function generating a wiki heading prefix. - + @param level The heading level. The value must be between 1 and 5. --> @@ -247,7 +247,7 @@ <!-- Function generating a token consisting of the given character repeated 'level' times. - + @param level The lengh of the result. @param char @@ -264,8 +264,8 @@ </call-template> </if> </template> - - + + <!-- == Tables == --> @@ -346,7 +346,7 @@ <value-of select="$link-label"/> <text>]</text> </when> - + <otherwise> <apply-templates/> </otherwise> @@ -373,8 +373,8 @@ </choose> <value-of select="']]'"/> </template> - - + + <!-- == Paragraphs == --> @@ -392,7 +392,7 @@ select="($style mod (2 * $CENTER_BIT)) - ($style mod ($CENTER_BIT)) != 0"/> <variable name="right" select="($style mod (2 * $RIGHT_BIT)) - ($style mod ($RIGHT_BIT)) != 0"/> - + <choose> <when test="$center"> <text><div align="center"></text> @@ -404,7 +404,7 @@ <value-of select="' '"/> </when> </choose> - + <apply-templates/> <choose> @@ -434,10 +434,10 @@ <with-param name="node" select="$paragraph-right"/> </call-template> </variable> - + <variable name="code-right" select="($style-right mod (2 * $CODE_BIT)) - ($style-right mod ($CODE_BIT)) != 0"/> - + <value-of select="$NL"/> <if test="$code-right"> <value-of select="' '"/> @@ -460,7 +460,7 @@ <!-- == Preformatted text == --> - + <template match="text:s"> <variable name="style"> <call-template name="mk-style-set"> @@ -470,7 +470,7 @@ <variable name="code" select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/> - + <if test="$code"> <choose> <when test="@text:c"> @@ -485,7 +485,7 @@ </choose> </if> </template> - + <template match="text:line-break"> <variable name="style"> <call-template name="mk-style-set"> @@ -495,7 +495,7 @@ <variable name="code" select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/> - + <if test="$code"> <value-of select="$NL"/> <value-of select="' '"/> @@ -505,10 +505,10 @@ <!-- Footnotes --> - + <template match="text:note-body"> <variable name="note" select="./parent::text:note"/> - + <if test="$note/@text:note-class = 'footnote'"> <text><ref name="</text> <value-of select="$note/@text:id"/> @@ -517,140 +517,140 @@ <text></ref></text> </if> </template> - + <template match="text:note-ref[@text:note-class='footnote']"> <text><ref name="</text> <value-of select="@text:ref-name"/> <text>"/></text> </template> - - + + <!-- == Images == --> - - <template match="draw:text-box[boolean(.//draw:image)]"> - <variable name="image" select=".//draw:image[1]"/> - - <variable name="image-description"> - <apply-templates/> - </variable> - - <text>[[</text> + + <template match="draw:text-box[boolean(.//draw:image)]"> + <variable name="image" select=".//draw:image[1]"/> + + <variable name="image-description"> + <apply-templates/> + </variable> + + <text>[[</text> <call-template name="mk-image-name"> <with-param name="image" select="$image"/> </call-template> - <text>|thumb|</text> + <text>|thumb|</text> <value-of select="normalize-space($image-description)"/> - <text>]]</text> - </template> - - <template match="draw:image[not(boolean(ancestor::draw:text-box))]"> - <text>[[</text> + <text>]]</text> + </template> + + <template match="draw:image[not(boolean(ancestor::draw:text-box))]"> + <text>[[</text> <call-template name="mk-image-name"> <with-param name="image" select="."/> </call-template> - <text>]]</text> - </template> + <text>]]</text> + </template> <template name="mk-image-name"> <param name="image"/> - - <variable name="base-name"> - <call-template name="mk-base-name"> - <with-param name="href" select="$image/@xlink:href"/> - </call-template> - </variable> - + + <variable name="base-name"> + <call-template name="mk-base-name"> + <with-param name="href" select="$image/@xlink:href"/> + </call-template> + </variable> + <if test="not(starts-with($base-name, 'Image:'))"> <value-of select="'Image:'"/> </if> <value-of select="$base-name"/> - </template> - - <template name="mk-base-name"> - <param name="href"/> - - <variable name="result" select="substring-after($href, '/')"/> - <choose> - <when test="boolean($result)"> - <call-template name="mk-base-name"> - <with-param name="href" select="$result"/> - </call-template> - </when> - <otherwise> - <value-of select="$href"/> - </otherwise> - </choose> - </template> - - - <!-- - References - --> - + </template> + + <template name="mk-base-name"> + <param name="href"/> + + <variable name="result" select="substring-after($href, '/')"/> + <choose> + <when test="boolean($result)"> + <call-template name="mk-base-name"> + <with-param name="href" select="$result"/> + </call-template> + </when> + <otherwise> + <value-of select="$href"/> + </otherwise> + </choose> + </template> + + + <!-- + References + --> + <!-- TODO: text:bibliography-mark --> - <template match="text:reference-ref"> - <variable name="reference-mark" select="key('reference-resolution', @text:ref-name)"/> - - <choose> - <when test="boolean($reference-mark)"> - <!-- - In wiki syntax, only a local reference to a heading can be inserted. - If the link target is a descendant of a heading element, a link can be - inserted in the result. --> - <variable name="header-anchor" select="$reference-mark/ancestor::text:h[1]"/> - <if test="boolean($header-anchor)"> - <text>[[#</text> - <value-of select="string($header-anchor)"/> - <text>|</text> - </if> - - <variable name="reference-text" select="string(.)"/> - - <choose> - <!-- Check, whether the reference text is cached in the document. --> - <when test="string-length($reference-text) > 0"> - <value-of select="$reference-text"/> - </when> - - <otherwise> - <!-- - TODO: Evaluate the @text:reference-format attribute and - generate the replacement text (difficult).--> - <text>(REFERENCE TEXT UNAVAILABLE: "</text> - <value-of select="@text:ref-name"/> - <text>")</text> - </otherwise> - </choose> - - <if test="boolean($header-anchor)"> - <text>]]</text> - </if> - </when> + <template match="text:reference-ref"> + <variable name="reference-mark" select="key('reference-resolution', @text:ref-name)"/> - <otherwise> - <text>(UNDEFINED REFERENCE: "</text> - <value-of select="@text:ref-name"/> - <text>")</text> - </otherwise> - </choose> - </template> - - <template match="text:reference-mark"> - <!-- TODO: Output an anchor. --> - <apply-templates/> - </template> + <choose> + <when test="boolean($reference-mark)"> + <!-- + In wiki syntax, only a local reference to a heading can be inserted. + If the link target is a descendant of a heading element, a link can be + inserted in the result. --> + <variable name="header-anchor" select="$reference-mark/ancestor::text:h[1]"/> + <if test="boolean($header-anchor)"> + <text>[[#</text> + <value-of select="string($header-anchor)"/> + <text>|</text> + </if> - <template match="text:reference-mark-start"> - <!-- TODO: Output an anchor. --> - </template> + <variable name="reference-text" select="string(.)"/> + <choose> + <!-- Check, whether the reference text is cached in the document. --> + <when test="string-length($reference-text) > 0"> + <value-of select="$reference-text"/> + </when> + + <otherwise> + <!-- + TODO: Evaluate the @text:reference-format attribute and + generate the replacement text (difficult).--> + <text>(REFERENCE TEXT UNAVAILABLE: "</text> + <value-of select="@text:ref-name"/> + <text>")</text> + </otherwise> + </choose> + + <if test="boolean($header-anchor)"> + <text>]]</text> + </if> + </when> + + <otherwise> + <text>(UNDEFINED REFERENCE: "</text> + <value-of select="@text:ref-name"/> + <text>")</text> + </otherwise> + </choose> + </template> + + <template match="text:reference-mark"> + <!-- TODO: Output an anchor. --> + <apply-templates/> + </template> + + <template match="text:reference-mark-start"> + <!-- TODO: Output an anchor. --> + </template> + <!-- == Plain text == --> - + <template match="text:p/text() | text:h/text() | text:span/text() | text:sequence/text() | text:sequence-ref/text() | text:a/text() | text:bookmark-ref/text() | text:reference-mark/text()"> <choose> <when test="boolean(./ancestor::table:table-header-rows | ./ancestor::text:h)"> @@ -659,14 +659,14 @@ because those styles are consistently declared by the Wiki engine. --> <value-of select="."/> </when> - + <when test="string-length(.) > 0"> <variable name="style"> <call-template name="mk-style-set"> <with-param name="node" select="."/> </call-template> </variable> - + <variable name="current-paragraph" select="./ancestor::text:p[1]"/> <variable name="paragraph-id" @@ -675,7 +675,7 @@ select="$current-paragraph/descendant::draw:frame"/> <variable name="frame-count" select="count($frames)"/> - + <!-- The current style context consists of all text nodes that are descendants of the paragraph ancestor of this text node but not @@ -829,7 +829,7 @@ <!-- Function for looking up the position of a node identified by the given 'current-id' within a node set 'context'. - + The search starts with the the index 'test-index'. The search is recursive in the 'test-index' argument. To save recursion depth, each recursive call iteratively tests a fixed number of indexes (by loop unrolling). @@ -838,9 +838,9 @@ <param name="current-id"/> <param name="context"/> <param name="test-index"/> - + <variable name="context-size" select="count($context)"/> - + <choose> <when test="context-size < $test-index"> </when> @@ -883,10 +883,10 @@ </otherwise> </choose> </template> - + <template name="render-quoted-text"> <param name="text"/> - + <choose> <when test="contains($text, '<') or contains($text, '[') or starts-with($text, '----') or starts-with($text, '=') or starts-with($text, '*') or starts-with($text, ';') or starts-with($text, '#')"> <text><nowiki></text> @@ -900,7 +900,7 @@ <value-of select="$text"/> </otherwise> </choose> - <text></nowiki></text> + <text></nowiki></text> </when> <otherwise> <value-of select="$text"/> @@ -910,7 +910,7 @@ <template name="render-escaped-text"> <param name="text"/> - + <choose> <when test="contains($text, '<')"> <value-of select="substring-before($text, '<')"/> @@ -930,12 +930,12 @@ <template name="mk-style-set"> <param name="node"/> - + <variable name="context" select="$node/ancestor-or-self::*[@text:style-name][1]" /> - + <choose> <when test="boolean($context)"> <variable @@ -943,7 +943,7 @@ select="key('style-ref', $context/@text:style-name)" /> - <!-- Debugging: Print inspected styles. --> + <!-- Debugging: Print inspected styles. --> <!-- <message> <value-of select="'=== '"/> @@ -951,7 +951,7 @@ <value-of select="' ==='"/> </message> --> - + <call-template name="mk-style-set-internal"> <with-param name="node" select="$context"/> <with-param name="style" select="$style"/> @@ -964,11 +964,11 @@ </otherwise> </choose> </template> - + <!-- Compute the wiki style set that corresponds to the given office style at the given context node. - + @param node A node in which context the style is computed. If neither the given style nor one of its linked styles does specify a style of the given type, @@ -981,7 +981,7 @@ @style-mask A bit set of styles that must not be taken from the currently inspected style, because those styles are already defined by the context. - + @return A bit set composed of the wiki style constants. --> <template name="mk-style-set-internal"> @@ -989,9 +989,9 @@ <param name="style"/> <param name="style-set"/> <param name="style-mask"/> - + <variable name="text-properties" select="$style/style:text-properties"/> - + <!-- Decompose style-mask into individual bits. --> <variable name="bold-requested" select="($style-mask mod (2 * $BOLD_BIT)) = 0"/> @@ -1009,7 +1009,7 @@ select="($style-mask mod (2 * $CENTER_BIT)) - ($style-mask mod ($CENTER_BIT)) = 0"/> <variable name="right-requested" select="($style-mask mod (2 * $RIGHT_BIT)) - ($style-mask mod ($RIGHT_BIT)) = 0"/> - + <!-- Extract styles that are not already defined by the context. --> <variable name="bold-style"> <choose> @@ -1036,7 +1036,7 @@ </otherwise> </choose> </variable> - + <variable name="italic-style"> <choose> <when test="$italic-requested and boolean($text-properties/@fo:font-style='italic')"> @@ -1165,7 +1165,7 @@ </otherwise> </choose> </variable> - + <variable name="center-style"> <choose> <when test="$center-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align='center')"> @@ -1207,8 +1207,8 @@ </otherwise> </choose> </variable> - + <!-- Compute the updated styles and mask. --> <!-- Note: The bit masks style-mask, bold-style, italic-style,... are @@ -1232,7 +1232,7 @@ </when> <otherwise> <variable name="ancestors" select="$node/ancestor::*[@text:style-name][1]"/> - + <!-- Debugging: Print currently inspected style. --> <!-- <message> @@ -1250,7 +1250,7 @@ <value-of select="'}'"/> </message> --> - + <!-- If there is an ancestor that has a style, use that style, otherwise, a style is not found. --> @@ -1289,7 +1289,7 @@ <value-of select="$NL"/> </if> </template> - + <template match="office:document-content"> <apply-templates/> </template> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |