Bug 531685 - Incorrect rendering of PDF using <example> tags.
Summary: Incorrect rendering of PDF using <example> tags.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Publican
Classification: Community
Component: publican
Version: 1.6
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Jeff Fearn 🐞
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-10-29 05:06 UTC by BenC
Modified: 2010-11-24 04:17 UTC (History)
4 users (show)

Fixed In Version: 1.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-10-30 03:52:42 UTC
Embargoed:


Attachments (Terms of Use)
Image showing pdf result (57.42 KB, image/png)
2009-10-29 05:06 UTC, BenC
no flags Details
image of corrected output (92.27 KB, image/png)
2009-10-30 03:49 UTC, Jeff Fearn 🐞
no flags Details

Description BenC 2009-10-29 05:06:14 UTC
Created attachment 366552 [details]
Image showing pdf result

Description of problem:


Version-Release number of selected component (if applicable): 
publican 0.44
publican-jboss 0.19 


How reproducible:


<example>
<title>NumberGuess.java</title>

<programlisting><![CDATA[
@Name("numberGuess")
@Scope(ScopeType.CONVERSATION)
public class NumberGuess implements Serializable {
   
  private int randomNumber;
  private Integer currentGuess;
  private int biggest;
  private int smallest;
  private int guessCount;
  private int maxGuesses;
  private boolean cheated;
  
  @Create
  public void begin() {
    randomNumber = new Random().nextInt(100);
    guessCount = 0;
    biggest = 100;
    smallest = 1;
  }
  
  public void setCurrentGuess(Integer guess) {
    this.currentGuess = guess;
  }
  
  public Integer getCurrentGuess() {
    return currentGuess;
  }
  
  public void guess() {
    if (currentGuess>randomNumber) {
      biggest = currentGuess - 1;
    }
    if (currentGuess<randomNumber) {
      smallest = currentGuess + 1;
    }
    guessCount ++;
  }
  
  public boolean isCorrectGuess() {
    return currentGuess==randomNumber;
  }
  
  public int getBiggest() {
    return biggest;
  }
  
  public int getSmallest() {
    return smallest;
  }
  
  public int getGuessCount() {
    return guessCount;
  }
  
  public boolean isLastGuess() {
    return guessCount==maxGuesses;
  }

  public int getRemainingGuesses() {
    return maxGuesses-guessCount;
  }

  public void setMaxGuesses(int maxGuesses) {
    this.maxGuesses = maxGuesses;
  }

  public int getMaxGuesses() {
    return maxGuesses;
  }

  public int getRandomNumber() {
    return randomNumber;
  }

  public void cheated() {
    cheated = true;
  }
  
  public boolean isCheat() {
    return cheated;
  }
  
  public List<Integer> getPossibilities() {
    List<Integer> result = new ArrayList<Integer>();
    for(int i=smallest; i<=biggest; i++) result.add(i);
    return result;
  }
  
}]]>
</programlisting>
</example>

Additional info:
Note that the example label is rendered over the code listing in the pdf document. See attached image.

Comment 1 Jeff Fearn 🐞 2009-10-29 05:17:22 UTC
A: Please provide a link to the SVN repo, it makes it easier for me to test stuff.

B: You are nesting blocks in a way that FOP doesn't handle very well, similar to nested tables and lists of lists, see bforte for a dissertation of this issue :)

Having said that if you supply a repo I have access to I'll poke around and see what I can come up with.

Comment 2 BenC 2009-10-29 07:06:19 UTC
Here is the repo:

https://svn.jboss.org/repos/jbossas/projects/docs/enterprise/5.0/Seam_Reference_Guide. The relevant chapter is Tutorial.xml.

I am in the process of tidying this up (including removing the <example> tags) and haven't committed my changes to the repo.

The code example in the bugzilla ticket is an example of the code which produces the problem:

<example>
<title>NumberGuess.java</title>

<programlisting><![CDATA[

...

}]]>
</programlisting>
</example>




Ben

Comment 3 BenC 2009-10-30 00:28:18 UTC
Below is a link to the source (JBoss Community) pdf document:

http://docs.jboss.org/seam/2.2.0.GA/reference/en-US/pdf/

Note the correct rendering of the Example label (it doesn't overwrite the code as does our version). 

Is positioning the "Example" label above the code a JBoss "workaround"? Will it fix our rendering problems?


Ben

Comment 4 BenC 2009-10-30 00:30:06 UTC
NB. 

Go to page 3 for a relevant example relating to the above comment.

Comment 5 Jeff Fearn 🐞 2009-10-30 03:49:59 UTC
Created attachment 366758 [details]
image of corrected output

attribute-set formal.object.properties hard codes keep-together.within-column to 'always', this constrains an example to a single page, resulting in the mis-formatting of the supplied eaxmple.

Modified attribute-set example.properties to set keep-together.within-column to null, which allows the example to break across pages and displays the title correctly.

Comment 6 Jeff Fearn 🐞 2009-10-30 03:52:42 UTC
This fix will ship with Publican 1.0


Note You need to log in before you can comment on or make changes to this bug.