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

View File

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

View File

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

File diff suppressed because it is too large Load Diff