Thank you - using APT. I was able to successfully create a macro with
Doxia, easy once you see a working example. There could be a little
more documentation...
Q: Do you know of a location to get other third party macros?
Syntax:
%{swf|src=swf/Example1/Example1|id=Example1|width=268|height=172}
Downloaded Doxia src. Looked at Echo example in:
/doxia-1.0-alpha-8/doxia-core/src/main/java/org/apache/maven/doxia/macro
added Swf class, used maven to compile ;) and put in local repo.
Is still a little rough, simple but functional:
package org.apache.maven.doxia.macro;
/*
* Copyright 2004-2006 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.maven.doxia.sink.Sink;
import java.util.Iterator;
/**
* Macro for embedding Flash (SWF) within Maven documentation.
*
* @plexus.component role="org.apache.maven.doxia.macro.Macro"
* role-hint="swf"
*/
public class SwfMacro
extends AbstractMacro
{
private static final String EOL = System.getProperty(
"line.separator" );
public void execute( Sink sink, MacroRequest request )
{
// TODO: at what point to throw exceptions if some required
information
// is not provided?
// parameter defaults
String src = "";
String id = "swf";
String width = "400";
String height = "400";
String quality = "high";
String menu = "false";
String loop = "0";
String play = "true";
String version = "9,0,45,0";
String allowScript = "sameDomain";
// assign parameters
for ( Iterator i = request.getParameters().keySet().iterator();
i.hasNext(); )
{
String str = "";
String key = (String) i.next();
if(key.equals("src")) {
str = (String) request.getParameter(key);
if(str != "") {
src = str;
}
}
if(key.equals("id")) {
str = (String) request.getParameter(key);
if(str != "") {
id = str;
}
}
if(key.equals("width")) {
width = (String) request.getParameter(key);
if(str != "") {
width = str;
}
}
if(key.equals("height")) {
str = (String) request.getParameter(key);
if(str != "") {
height = str;
}
}
if(key.equals("quality")) {
str = (String) request.getParameter(key);
if(str != "") {
quality = str;
}
}
if(key.equals("menu")) {
str = (String) request.getParameter(key);
if(str != "") {
menu = str;
}
}
if(key.equals("loop")) {
str = (String) request.getParameter(key);
if(str != "") {
loop = str;
}
}
if(key.equals("play")) {
str = (String) request.getParameter(key);
if(str != "") {
play = str;
}
}
if(key.equals("version")) {
str = (String) request.getParameter(key);
// enable version shorthand
// TODO: put in other shorthand versions
if(str.equals("6")) {
version = "6,0,29,0";
} else {
if(str.equals("9")) {
version = "9,0,45,0";
} else {
if(str != "") {
version = str;
} } }
}
if(key.equals("allowScript")) {
str = (String) request.getParameter(key);
if(str != "") {
allowScript = str;
}
}
}
String content = "<center>" +
"<object
classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'
codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflas
h.cab#version=" + version + "' width='" + width + "' height='" + height
+ "' id='" + id + "'>" +
"<param name='movie' value='" + src + ".swf'>" +
"<param name='quality' value='" + quality + "'>" +
"<param name='menu' value='" + menu + "'>" +
"<param name='loop' value='" + loop + "'>" +
"<param name='play' value='" + play + "'>" +
"<param name='allowScriptAccess' value='" + allowScript
+ "'>" +
"<embed src='" + src + ".swf' width='" + width + "'
height='" + height + "' loop='" + loop + "' play='" + play + "'
quality='" + quality + "' allowScriptAccess='" + allowScript + "' " +
"pluginspage='http://www.macromedia.com/go/getflashplayer'
type='application/x-shockwave-flash' menu='" + menu + "'></embed>" +
"</object>" +
"</center>";
sink.rawText(content);
}
}
-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 15, 2007 5:59 PM
To: Maven Users List
Subject: Re: SWF within Maven documentation
On 5/15/07, Steve Motola <[EMAIL PROTECTED]> wrote:
> I am sure this question has been asked before but there is no
convenient
> way to search the archives.
We recommend Nabble: http://www.nabble.com/Maven---Users-f178.html
> How does one embed a SWF (Flash) file within the documentation?
>
> Do the velocity templates just have to be edited to put in a new tag
to
> produce something like the following?
>
> [:somefilename;550;400:] movie
>
> <object width="550" height="400">
> <param name="movie" value="somefilename.swf">
> <embed src="somefilename.swf" width="550" height="400">
> </embed>
> </object>
What documentation format are you using? You should be able to
include that in xdoc with no problem.
With APT it's probably not supported but I bet you could write a macro
to do it.
http://maven.apache.org/doxia/guide-doxia-macros.html
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]