From: Julian C. D. <Jul...@cb...> - 2005-08-29 20:52:52
|
Hi all: I've been trying to fix this bug: http://sourceforge.net/tracker/index.php?func=detail&aid=1182778&group_id=61626&atid=497853 I'm a novice Jelly hacker, but I can see what the problem is: in the generate-html target, the output filename that is passed to the sdocbook:transform goal doesn't contain the full path information. Ok, so what I want to to is to assemble a variable which is basically the full path to the output file, with the source directory substituted with the target. I tried this: <echo>TESTING: ${file.absolutePath.replaceFirst(maven.sdocbook.src.dir,maven.sdocbook.generated)}</echo> This gets me a NPE though. However, if I do this: <j:set var="t1" value="${maven.sdocbook.src.dir}"/> <j:set var="t2" value="${maven.sdocbook.generated}"/> <j:set var="ofile" value="${file.absolutePath.replaceFirst(t1, t2)}"/> "ofile" is set to the right filename (less the extension which I fix up later). Can anyone tell me why this is? - Julian -- -- Julian C. Dunn, B.A.Sc, P.Eng. <Jul...@cb...> -- Platform Administrator, CBC.ca Production & Operations -- Office: 2C310-Q * Tel.: (416) 205-3311 x5592 |
From: Carlos S. <ca...@ap...> - 2005-08-29 21:00:34
|
Hi, Jelly can be very desperating at some times. Something that usually works i= s=20 ${context.getVariable('maven.sdocbook.src.dir')} instead of ${maven.sdocbook.src.dir} if you can send a patch in unified diff format I'll try to fix it in CVS. Regards. On 8/29/05, Julian C. Dunn <Jul...@cb...> wrote: > Hi all: >=20 > I've been trying to fix this bug: >=20 > http://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D1182778&grou= p_id=3D61626&atid=3D497853 >=20 > I'm a novice Jelly hacker, but I can see what the problem is: in the > generate-html target, the output filename that is passed to the > sdocbook:transform goal doesn't contain the full path information. Ok, > so what I want to to is to assemble a variable which is basically the > full path to the output file, with the source directory substituted with > the target. I tried this: >=20 > <echo>TESTING: > ${file.absolutePath.replaceFirst(maven.sdocbook.src.dir,maven.sdocbook.ge= nerated)}</echo> >=20 > This gets me a NPE though. However, if I do this: >=20 > <j:set var=3D"t1" value=3D"${maven.sdocbook.src.dir}"/> > <j:set var=3D"t2" value=3D"${maven.sdocbook.generated}"/> > <j:set var=3D"ofile" value=3D"${file.absolutePath.replaceFirst(t1, > t2)}"/> >=20 > "ofile" is set to the right filename (less the extension which I fix up > later). >=20 > Can anyone tell me why this is? >=20 > - Julian >=20 > -- > -- Julian C. Dunn, B.A.Sc, P.Eng. <Jul...@cb...> > -- Platform Administrator, CBC.ca Production & Operations > -- Office: 2C310-Q * Tel.: (416) 205-3311 x5592 >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is Sponsored by the Better Software Conference & EXPO > September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practic= es > Agile & Plan-Driven Development * Managing Projects & Teams * Testing & Q= A > Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf > _______________________________________________ > Maven-plugins-developer mailing list > Mav...@li... > https://lists.sourceforge.net/lists/listinfo/maven-plugins-developer > |
From: Julian C. D. <Jul...@cb...> - 2005-08-29 21:57:18
|
On Mon, 2005-08-29 at 14:00 -0700, Carlos Sanchez wrote: > Hi, > > Jelly can be very desperating at some times. Something that usually works is > ${context.getVariable('maven.sdocbook.src.dir')} > instead of > ${maven.sdocbook.src.dir} > > if you can send a patch in unified diff format I'll try to fix it in CVS. Yes, that fixed it... silly Jelly. Anyway, here's a patch. I still have to fix the PDF targets which have the same problem. This isn't the nicest way of doing it but I find Jelly so fragile I didn't want to do anything too adventurous :-/ =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/sdocbook/plugin.jelly,v retrieving revision 1.19 diff -u -r1.19 plugin.jelly --- plugin.jelly 1 Aug 2005 21:52:14 -0000 1.19 +++ plugin.jelly 29 Aug 2005 21:51:25 -0000 @@ -189,10 +189,20 @@ <j:forEach var="file" items="${scanner.iterator()}"> - <!-- strip the extension from the file name --> - <j:set var="index" value="${file.name.lastIndexOf('.')}"/> - <j:set var="maven.sdocbook.out" value="${maven.sdocbook.generated}/${file.name.substring(0,index)}.html"/> - + <!-- Ensure that the output file has the right hierarchy. --> + <!-- ofile initially contains the right path, wrong output extension, + which we fix just before attainGoal --> + <j:set var="ofile" value="${file.absolutePath.replaceFirst(context.getVariable('maven.sdocbook.src.dir'),context.getVariable('maven.sdocbook.generated'))}"/> + + <j:set var="oindex" value="${ofile.lastIndexOf('/')}"/> + <j:set var="odir" value="${ofile.substring(0,oindex)}"/> + + <!-- create target hierarchy --> + <mkdir dir="${odir}"/> + + <!-- fix up extension on output file before running transform goal --> + <j:set var="index" value="${ofile.lastIndexOf('.')}"/> + <j:set var="maven.sdocbook.out" value="${ofile.substring(0,index)}.html"/> <attainGoal name="sdocbook:transform"/> </j:forEach> -- -- Julian C. Dunn, B.A.Sc, P.Eng. <Jul...@cb...> -- Platform Administrator, CBC.ca Production & Operations -- Office: 2C310-Q * Tel.: (416) 205-3311 x5592 |
From: Carlos S. <ca...@ap...> - 2005-08-30 16:23:55
|
I've applied the patch to CVS, could you test if it's working? On 8/30/05, Julian C. Dunn <Jul...@cb...> wrote: > On Mon, 2005-08-29 at 14:00 -0700, Carlos Sanchez wrote: >=20 > > Jelly can be very desperating at some times. Something that usually wor= ks is > > ${context.getVariable('maven.sdocbook.src.dir')} > > instead of > > ${maven.sdocbook.src.dir} > > > > if you can send a patch in unified diff format I'll try to fix it in CV= S. >=20 > Hi Carlos, >=20 > Attached please find a reworked diff that fixes the bug. You can ignore > my "thinking out loud" diff from yesterday. >=20 > - Julian >=20 > -- > -- Julian C. Dunn, B.A.Sc, P.Eng. <Jul...@cb...> > -- Platform Administrator, CBC.ca Production & Operations > -- Office: 2C310-Q * Tel.: (416) 205-3311 x5592 >=20 >=20 >=20 > |
From: Julian C. D. <Jul...@cb...> - 2005-08-31 03:50:52
|
On Tue, 30 Aug 2005, Carlos Sanchez wrote: > I've applied the patch to CVS, could you test if it's working? Patch works fine. Thanks Carlos! - Julian -- Julian C. Dunn, P.Eng. <Jul...@cb...> <jd...@nm...> -- Platform Administrator, CBC.ca Production & Operations -- Office: 2C310-Q * Tel.: (416) 205-3311 x5592 |
From: Julian C. D. <Jul...@cb...> - 2005-08-30 14:42:12
Attachments:
plugin.jelly.diff
|
On Mon, 2005-08-29 at 14:00 -0700, Carlos Sanchez wrote: > Jelly can be very desperating at some times. Something that usually works is > ${context.getVariable('maven.sdocbook.src.dir')} > instead of > ${maven.sdocbook.src.dir} > > if you can send a patch in unified diff format I'll try to fix it in CVS. Hi Carlos, Attached please find a reworked diff that fixes the bug. You can ignore my "thinking out loud" diff from yesterday. - Julian -- -- Julian C. Dunn, B.A.Sc, P.Eng. <Jul...@cb...> -- Platform Administrator, CBC.ca Production & Operations -- Office: 2C310-Q * Tel.: (416) 205-3311 x5592 |