Issue 36: there can be multiple examples for a command

git-svn-id: http://jclouds.googlecode.com/svn/trunk@1420 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
adrian.f.cole 2009-06-11 21:21:28 +00:00
parent 33bdc5438f
commit e4848344df
4 changed files with 559 additions and 199 deletions

View File

@ -23,12 +23,13 @@
*/
package org.jclouds.codegen.model;
import java.util.List;
public class TopLevelType extends Type {
private String ancestor;
private String exampleCode;
private String exampleHTML;
private List<String> exampleCode;
private List<String> exampleHTML;
public void setAncestor(String ancestor) {
this.ancestor = ancestor;
@ -38,19 +39,19 @@ public class TopLevelType extends Type {
return ancestor;
}
public void setExampleCode(String exampleCode) {
public void setExampleCode(List<String> exampleCode) {
this.exampleCode = exampleCode;
}
public String getExampleCode() {
public List<String> getExampleCode() {
return exampleCode;
}
public void setExampleHTML(String exampleHTML) {
public void setExampleHTML(List<String> exampleHTML) {
this.exampleHTML = exampleHTML;
}
public String getExampleHTML() {
public List<String> getExampleHTML() {
return exampleHTML;
}

View File

@ -233,7 +233,7 @@ sub build_contents {
}
push @params, \%param;
}
# Attribute query parameters come in as separate parameters, so
# we coallate them into one
my %attribute;
@ -298,14 +298,20 @@ sub build_item {
$item->{description} =
${descriptionDiv}->look_down( '_tag', 'p' )->as_text();
}
my $id = "ApiReference-query-${_}-Example-${class}-1";
my ${requestExampleDiv} =
$tree->look_down( '_tag', 'h3', 'id', "$id" )
->look_up( '_tag', 'div', 'class', 'section' );
$item->{exampleHTML} = ${requestExampleDiv}->as_HTML();
$item->{exampleCode} =
${requestExampleDiv}
->look_down( '_tag', 'pre', 'class', 'programlisting' )->as_text();
for my $I ( 1 .. 10 ) {
my $id = "ApiReference-query-${_}-Example-${class}-$I";
my ${requestExampleH3} =
$tree->look_down( '_tag', 'h3', 'id', "$id" );
last unless defined ${requestExampleH3};
my ${requestExampleDiv} =
${requestExampleH3}->look_up( '_tag', 'div', 'class', 'section' );
push @{ $item->{exampleHTML} }, ${requestExampleDiv}->as_HTML();
push @{ $item->{exampleCode} },
${requestExampleDiv}
->look_down( '_tag', 'pre', 'class', 'programlisting' )
->as_text();
}
$tree->eof;
$tree->delete;

View File

@ -23,6 +23,7 @@
*/
package org.jclouds.codegen.ec2.queryapi;
import java.util.List;
import java.util.Set;
public class DataType {
@ -30,8 +31,8 @@ public class DataType {
private String type;
private String ancestor;
private Set<String> see;
private String exampleCode;
private String exampleHTML;
private List<String> exampleCode;
private List<String> exampleHTML;
private Set<Content> contents;
public DataType() {
@ -62,14 +63,6 @@ public class DataType {
return see;
}
public void setExampleCode(String exampleCode) {
this.exampleCode = exampleCode;
}
public String getExampleCode() {
return exampleCode;
}
public void setContents(Set<Content> contents) {
this.contents = contents;
}
@ -78,11 +71,19 @@ public class DataType {
return contents;
}
public void setExampleHTML(String exampleHTML) {
public void setExampleCode(List<String> exampleCode) {
this.exampleCode = exampleCode;
}
public List<String> getExampleCode() {
return exampleCode;
}
public void setExampleHTML(List<String> exampleHTML) {
this.exampleHTML = exampleHTML;
}
public String getExampleHTML() {
public List<String> getExampleHTML() {
return exampleHTML;
}

File diff suppressed because it is too large Load Diff