SEC-1858: Removed methods for generating docbook for xsd
Not squashing so this is around if needed again
This commit is contained in:
parent
c8b847f1ed
commit
ff495b698e
|
@ -23,27 +23,11 @@ package org.springframework.security.config.doc
|
|||
* @see XsdDocumentedSpec
|
||||
*/
|
||||
class Attribute {
|
||||
def prefix = ""
|
||||
def name
|
||||
def desc
|
||||
def elmt
|
||||
|
||||
def indent() {
|
||||
prefix += " "
|
||||
}
|
||||
|
||||
def toDocbook(prefix) {
|
||||
def indent = " "+prefix
|
||||
"""
|
||||
${prefix}<section xml:id="${id}">
|
||||
${indent}<title><literal>${name}</literal></title>
|
||||
${indent}<para>${desc}</para>
|
||||
${prefix}</section>"""
|
||||
}
|
||||
def getId() {
|
||||
return "${elmt.id}-${name}".toString()
|
||||
}
|
||||
public String toString() {
|
||||
prefix + '@' + name + " - " + desc
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ package org.springframework.security.config.doc
|
|||
* @see XsdDocumentedSpec
|
||||
*/
|
||||
class Element {
|
||||
def prefix = ""
|
||||
def name
|
||||
def desc
|
||||
def attrs
|
||||
|
@ -34,12 +33,6 @@ class Element {
|
|||
def childElmts = [:]
|
||||
def parentElmts = [:]
|
||||
|
||||
def indent() {
|
||||
prefix += " "
|
||||
attrs*.indent()
|
||||
childElmts.values()*.indent()
|
||||
}
|
||||
|
||||
def getId() {
|
||||
return "nsa-${name}".toString()
|
||||
}
|
||||
|
@ -83,73 +76,6 @@ class Element {
|
|||
ids
|
||||
}
|
||||
|
||||
def getFullName() {
|
||||
parentElmt ? parentElmt.fullName+"-"+name : name
|
||||
}
|
||||
|
||||
def docbookParentElmts(prefix) {
|
||||
if(parentElmts.empty) {
|
||||
return ''
|
||||
}
|
||||
def indent = prefix+' '
|
||||
def parents = """
|
||||
${prefix}<section xml:id="${id}-parents">
|
||||
${indent}<title>Parent Elements of <literal><${name}></literal></title>
|
||||
${indent}<orderedlist>"""
|
||||
parentElmts.sort {l,r -> l.name.compareTo(r.name)}.each {
|
||||
parents += """\n${indent} <listitem><link xlink:href="#${it.id}">${it.name}</link></listitem>"""
|
||||
}
|
||||
parents += "\n${indent}</orderedlist>\n${prefix}</section>"
|
||||
parents
|
||||
}
|
||||
|
||||
def docbookChildElmts(prefix) {
|
||||
if(!childElmts) {
|
||||
return ''
|
||||
}
|
||||
def indent = prefix+' '
|
||||
def children = """
|
||||
${prefix}<section xml:id="${id}-children">
|
||||
${indent}<title>Child Elements of <literal><${name}></literal></title>
|
||||
${indent}<orderedlist>"""
|
||||
childElmts.values().sort {l,r -> l.name.compareTo(r.name)}.each {
|
||||
children += """\n${indent} <listitem><link xlink:href="#${it.id}">${it.name}</link></listitem>"""
|
||||
}
|
||||
children += "\n${indent}</orderedlist>\n${prefix}</section>"
|
||||
children
|
||||
}
|
||||
def toDocbook(prefix) {
|
||||
def indent = prefix+' '
|
||||
def parentElmt = docbookParentElmts(indent)
|
||||
def attributes = ""
|
||||
attrs.sort {l,r -> l.name.compareTo(r.name)}.each {
|
||||
attributes += it.toDocbook(indent+' ')
|
||||
}
|
||||
if(attributes) {
|
||||
attributes = """
|
||||
${indent}<section xml:id="${id}-attributes">
|
||||
${indent} <title><literal><${name}></literal> Attributes</title>${attributes}
|
||||
${indent}</section>"""
|
||||
}
|
||||
def childElmts = docbookChildElmts(indent)
|
||||
def elements = ""
|
||||
childElmts.values().sort {l,r -> l.name.compareTo(r.name)}.each {
|
||||
elements += it.toDocbook(prefix)
|
||||
}
|
||||
"""
|
||||
${prefix}<section xml:id="${id}">
|
||||
${indent}<title><literal><${name}></literal></title>
|
||||
${indent}<para>${desc}</para>${parentElmt}${attributes}${childElmts}
|
||||
${prefix}</section>${elements}"""
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
def result = prefix + name + " - " + desc+"\n"
|
||||
attrs.sort {l,r -> l.name.compareTo(r.name)}.each { result+= it.toString()}
|
||||
childElmts.values().sort {l,r -> l.name.compareTo(r.name)}.each { result+= it.toString() }
|
||||
result
|
||||
}
|
||||
|
||||
def getAllChildElmts() {
|
||||
def result = [:]
|
||||
childElmts.values()*.subGrps*.each { elmt -> result.put(elmt.name,elmt) }
|
||||
|
|
|
@ -162,8 +162,6 @@ class SpringSecurityXsdParser {
|
|||
e.childElmts = elements(n)
|
||||
e.attrs = attrs(n)
|
||||
e.attrs.addAll(attrgrps(n))
|
||||
e.childElmts.values()*.indent()
|
||||
e.attrs*.indent()
|
||||
e.attrs*.elmt = e
|
||||
e.childElmts.values()*.each { it.parentElmts.put(e.name,e) }
|
||||
|
||||
|
|
Loading…
Reference in New Issue