.git files
This commit is contained in:
parent
c590d9ad49
commit
a7330f35ff
4 changed files with 248 additions and 181 deletions
20
.gitattributes
vendored
Normal file
20
.gitattributes
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
* text=auto
|
||||
|
||||
*.html text eol=lf
|
||||
*.java text eol=lf
|
||||
*.js text eol=lf
|
||||
*.json text eol=lf
|
||||
*.jsp text eol=lf
|
||||
*.md text eol=lf
|
||||
*.properties text eol=lf
|
||||
*.svg text auto
|
||||
*.xml text eol=lf
|
||||
*.xsl text eol=lf
|
||||
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.gif binary
|
||||
*.ttf binary
|
||||
*.eot binary
|
||||
*.otf binary
|
||||
*.woff binary
|
47
.gitignore
vendored
Normal file
47
.gitignore
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Intellij
|
||||
###################
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
# Eclipse #
|
||||
###########
|
||||
.project
|
||||
.settings
|
||||
.classpath
|
||||
|
||||
# NetBeans #
|
||||
############
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
catalog.xml
|
||||
|
||||
# Compiled source #
|
||||
###################
|
||||
*.com
|
||||
*.class
|
||||
*.dll
|
||||
*.exe
|
||||
*.o
|
||||
*.so
|
||||
|
||||
# Packages #
|
||||
############
|
||||
# it's better to unpack these files and commit the raw source
|
||||
# git has its own built in compression methods
|
||||
*.7z
|
||||
*.dmg
|
||||
*.gz
|
||||
*.iso
|
||||
*.jar
|
||||
*.rar
|
||||
*.tar
|
||||
*.zip
|
||||
|
||||
# Logs and databases #
|
||||
######################
|
||||
*.log
|
||||
|
||||
# Maven #
|
||||
#########
|
||||
target
|
||||
|
150
book.json
150
book.json
|
@ -1,76 +1,76 @@
|
|||
{
|
||||
"gitbook": "2.x.x",
|
||||
"structure": {
|
||||
"readme": "README.adoc"
|
||||
},
|
||||
"plugins": [
|
||||
"toggle-chapters",
|
||||
"ungrey",
|
||||
"splitter"
|
||||
],
|
||||
"variables": {
|
||||
"title": "Keycloak Installation and Configuration Guide",
|
||||
"community": true,
|
||||
"product": false,
|
||||
"images": "keycloak-images",
|
||||
"appserver": {
|
||||
"name": "Wildfly",
|
||||
"version": "10",
|
||||
"admindoc": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/"
|
||||
},
|
||||
"datasource": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/chap-Datasource_Management.html"
|
||||
},
|
||||
"network": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/chap-Network_and_Port_Configuration.html#Configure_interfaces"
|
||||
},
|
||||
"socket": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/sect-Socket_Binding_Groups.html"
|
||||
},
|
||||
"loadbalancer": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/sect-Web_HTTP_Connectors_and_HTTP_Clustering.html"
|
||||
},
|
||||
"jgroups": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/sect-JGroups.html"
|
||||
}
|
||||
},
|
||||
"caching": {
|
||||
"name": "JBoss Data Grid",
|
||||
"version": "???",
|
||||
"admindoc": {
|
||||
"name": "JBoss Data Grid Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Data_Grid/6.6/html/Administration_and_Configuration_Guide/index.html",
|
||||
"eviction": "https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Data_Grid/7.0/html/Administration_and_Configuration_Guide/sect-Eviction_Strategies.html"
|
||||
}
|
||||
},
|
||||
"jpa": {
|
||||
"name": "Hibernate",
|
||||
"version": "???",
|
||||
"admindoc": {
|
||||
"name": "JBoss Development Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Development_Guide/sect-Java_Persistence_API_JPA.html#sect-Configuration2"
|
||||
}
|
||||
|
||||
},
|
||||
"developerguide": {
|
||||
"name": "Keycloak Server Developer Guide",
|
||||
"link": "https://keycloak.gitbooks.io/server-developer-guide/content/"
|
||||
|
||||
},
|
||||
"adminguide": {
|
||||
"name": "Keycloak Adminstration Guide",
|
||||
"link": "https://keycloak.gitbooks.io/server-adminstration-guide/content/"
|
||||
},
|
||||
"project": {
|
||||
"name": "Keycloak",
|
||||
"version": "1.9.3.Final-SNAPSHOT"
|
||||
}
|
||||
}
|
||||
{
|
||||
"gitbook": "2.x.x",
|
||||
"structure": {
|
||||
"readme": "README.adoc"
|
||||
},
|
||||
"plugins": [
|
||||
"toggle-chapters",
|
||||
"ungrey",
|
||||
"splitter"
|
||||
],
|
||||
"variables": {
|
||||
"title": "Keycloak Installation and Configuration Guide",
|
||||
"community": true,
|
||||
"product": false,
|
||||
"images": "keycloak-images",
|
||||
"appserver": {
|
||||
"name": "Wildfly",
|
||||
"version": "10",
|
||||
"admindoc": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/"
|
||||
},
|
||||
"datasource": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/chap-Datasource_Management.html"
|
||||
},
|
||||
"network": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/chap-Network_and_Port_Configuration.html#Configure_interfaces"
|
||||
},
|
||||
"socket": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/sect-Socket_Binding_Groups.html"
|
||||
},
|
||||
"loadbalancer": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/sect-Web_HTTP_Connectors_and_HTTP_Clustering.html"
|
||||
},
|
||||
"jgroups": {
|
||||
"name": "JBoss EAP Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Administration_and_Configuration_Guide/sect-JGroups.html"
|
||||
}
|
||||
},
|
||||
"caching": {
|
||||
"name": "JBoss Data Grid",
|
||||
"version": "???",
|
||||
"admindoc": {
|
||||
"name": "JBoss Data Grid Administration and Configuration Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Data_Grid/6.6/html/Administration_and_Configuration_Guide/index.html",
|
||||
"eviction": "https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Data_Grid/7.0/html/Administration_and_Configuration_Guide/sect-Eviction_Strategies.html"
|
||||
}
|
||||
},
|
||||
"jpa": {
|
||||
"name": "Hibernate",
|
||||
"version": "???",
|
||||
"admindoc": {
|
||||
"name": "JBoss Development Guide",
|
||||
"link": "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Development_Guide/sect-Java_Persistence_API_JPA.html#sect-Configuration2"
|
||||
}
|
||||
|
||||
},
|
||||
"developerguide": {
|
||||
"name": "Keycloak Server Developer Guide",
|
||||
"link": "https://keycloak.gitbooks.io/server-developer-guide/content/"
|
||||
|
||||
},
|
||||
"adminguide": {
|
||||
"name": "Keycloak Adminstration Guide",
|
||||
"link": "https://keycloak.gitbooks.io/server-adminstration-guide/content/"
|
||||
},
|
||||
"project": {
|
||||
"name": "Keycloak",
|
||||
"version": "1.9.3.Final-SNAPSHOT"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,106 +1,106 @@
|
|||
import sys, os, re, json, shutil, errno
|
||||
|
||||
def transform(root, f, targetdir):
|
||||
full = os.path.join(root, f)
|
||||
input = open(full, 'r').read()
|
||||
dir = os.path.join(targetdir, root)
|
||||
if not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
output = open(os.path.join(dir, f), 'w')
|
||||
input = applyTransformation(input)
|
||||
output.write(input)
|
||||
|
||||
|
||||
def applyTransformation(input):
|
||||
for variable in re.findall(r"\{\{(.*?)\}\}", input):
|
||||
tmp = variable.replace('.', '_')
|
||||
input = input.replace(variable, tmp)
|
||||
input = input.replace('{{', '{').replace('}}', '}')
|
||||
input = re.sub(r"<<fake.+#", "<<", input)
|
||||
for variable in re.findall(r"[ ]*{% if (.*?) %}", input):
|
||||
tmp = variable.replace('.', '_')
|
||||
input = input.replace(variable, tmp)
|
||||
exp = re.compile("[ ]*{% if (.*?) %}(.*?)[ ]*{% endif %}", re.DOTALL)
|
||||
input = re.sub(exp, "ifeval::[{\g<1>}==true]\g<2>endif::[]", input)
|
||||
input = re.sub(r"image:(\.\./)*", "image:", input)
|
||||
return input
|
||||
|
||||
|
||||
indir = 'topics'
|
||||
targetdir = 'target'
|
||||
if len(sys.argv) > 1:
|
||||
targetdir = sys.argv[1]
|
||||
|
||||
shutil.rmtree(os.path.join(targetdir, 'images'))
|
||||
shutil.rmtree(os.path.join(targetdir, 'keycloak-images'))
|
||||
shutil.rmtree(os.path.join(targetdir, 'rhsso-images'))
|
||||
shutil.copytree('images',os.path.join(targetdir, 'images'))
|
||||
shutil.copytree('keycloak-images',os.path.join(targetdir, 'keycloak-images'))
|
||||
shutil.copytree('rhsso-images',os.path.join(targetdir, 'rhsso-images'))
|
||||
|
||||
tmp = os.path.join(targetdir, 'topics')
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
|
||||
# transform files
|
||||
for root, dirs, filenames in os.walk(indir):
|
||||
for f in filenames:
|
||||
transform(root,f,targetdir)
|
||||
|
||||
# Create master.doc includes
|
||||
input = open('SUMMARY.adoc', 'r').read()
|
||||
output = open(os.path.join(targetdir, 'master.adoc'), 'w')
|
||||
|
||||
output.write("""
|
||||
:toc:
|
||||
:toclevels: 3
|
||||
:numbered:
|
||||
|
||||
include::document-attributes.adoc[]
|
||||
""")
|
||||
|
||||
input = re.sub(r"[ ]*\.+\s*link:(.*)\[(.*)\]", "include::\g<1>[]", input)
|
||||
input = applyTransformation(input)
|
||||
output.write(input)
|
||||
|
||||
# parse book.json file and create document attributes
|
||||
with open('book.json') as data_file:
|
||||
data = json.load(data_file)
|
||||
|
||||
variables = data['variables']
|
||||
|
||||
def makeAttributes(variables, variable, list):
|
||||
for i in variables.keys():
|
||||
if variable is None:
|
||||
tmp = i
|
||||
else:
|
||||
tmp = variable + '_' + i
|
||||
if isinstance(variables[i],dict):
|
||||
makeAttributes(variables[i], tmp, list)
|
||||
elif isinstance(variables[i],bool):
|
||||
boolval = 'false'
|
||||
if variables[i]:
|
||||
boolval = 'true'
|
||||
list.append({tmp: boolval})
|
||||
else:
|
||||
list.append({tmp: str(variables[i])})
|
||||
|
||||
|
||||
attributeList = []
|
||||
makeAttributes(variables, None, attributeList)
|
||||
|
||||
output = open(os.path.join(targetdir, 'document-attributes.adoc'), 'w')
|
||||
for attribute in attributeList:
|
||||
for k in attribute.keys():
|
||||
output.write(':book_' + k + ": " + attribute[k] + "\n")
|
||||
|
||||
print "Transformation complete!"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import sys, os, re, json, shutil, errno
|
||||
|
||||
def transform(root, f, targetdir):
|
||||
full = os.path.join(root, f)
|
||||
input = open(full, 'r').read()
|
||||
dir = os.path.join(targetdir, root)
|
||||
if not os.path.exists(dir):
|
||||
os.makedirs(dir)
|
||||
output = open(os.path.join(dir, f), 'w')
|
||||
input = applyTransformation(input)
|
||||
output.write(input)
|
||||
|
||||
|
||||
def applyTransformation(input):
|
||||
for variable in re.findall(r"\{\{(.*?)\}\}", input):
|
||||
tmp = variable.replace('.', '_')
|
||||
input = input.replace(variable, tmp)
|
||||
input = input.replace('{{', '{').replace('}}', '}')
|
||||
input = re.sub(r"<<fake.+#", "<<", input)
|
||||
for variable in re.findall(r"[ ]*{% if (.*?) %}", input):
|
||||
tmp = variable.replace('.', '_')
|
||||
input = input.replace(variable, tmp)
|
||||
exp = re.compile("[ ]*{% if (.*?) %}(.*?)[ ]*{% endif %}", re.DOTALL)
|
||||
input = re.sub(exp, "ifeval::[{\g<1>}==true]\g<2>endif::[]", input)
|
||||
input = re.sub(r"image:(\.\./)*", "image:", input)
|
||||
return input
|
||||
|
||||
|
||||
indir = 'topics'
|
||||
targetdir = 'target'
|
||||
if len(sys.argv) > 1:
|
||||
targetdir = sys.argv[1]
|
||||
|
||||
shutil.rmtree(os.path.join(targetdir, 'images'))
|
||||
shutil.rmtree(os.path.join(targetdir, 'keycloak-images'))
|
||||
shutil.rmtree(os.path.join(targetdir, 'rhsso-images'))
|
||||
shutil.copytree('images',os.path.join(targetdir, 'images'))
|
||||
shutil.copytree('keycloak-images',os.path.join(targetdir, 'keycloak-images'))
|
||||
shutil.copytree('rhsso-images',os.path.join(targetdir, 'rhsso-images'))
|
||||
|
||||
tmp = os.path.join(targetdir, 'topics')
|
||||
if not os.path.exists(tmp):
|
||||
os.makedirs(tmp)
|
||||
|
||||
# transform files
|
||||
for root, dirs, filenames in os.walk(indir):
|
||||
for f in filenames:
|
||||
transform(root,f,targetdir)
|
||||
|
||||
# Create master.doc includes
|
||||
input = open('SUMMARY.adoc', 'r').read()
|
||||
output = open(os.path.join(targetdir, 'master.adoc'), 'w')
|
||||
|
||||
output.write("""
|
||||
:toc:
|
||||
:toclevels: 3
|
||||
:numbered:
|
||||
|
||||
include::document-attributes.adoc[]
|
||||
""")
|
||||
|
||||
input = re.sub(r"[ ]*\.+\s*link:(.*)\[(.*)\]", "include::\g<1>[]", input)
|
||||
input = applyTransformation(input)
|
||||
output.write(input)
|
||||
|
||||
# parse book.json file and create document attributes
|
||||
with open('book.json') as data_file:
|
||||
data = json.load(data_file)
|
||||
|
||||
variables = data['variables']
|
||||
|
||||
def makeAttributes(variables, variable, list):
|
||||
for i in variables.keys():
|
||||
if variable is None:
|
||||
tmp = i
|
||||
else:
|
||||
tmp = variable + '_' + i
|
||||
if isinstance(variables[i],dict):
|
||||
makeAttributes(variables[i], tmp, list)
|
||||
elif isinstance(variables[i],bool):
|
||||
boolval = 'false'
|
||||
if variables[i]:
|
||||
boolval = 'true'
|
||||
list.append({tmp: boolval})
|
||||
else:
|
||||
list.append({tmp: str(variables[i])})
|
||||
|
||||
|
||||
attributeList = []
|
||||
makeAttributes(variables, None, attributeList)
|
||||
|
||||
output = open(os.path.join(targetdir, 'document-attributes.adoc'), 'w')
|
||||
for attribute in attributeList:
|
||||
for k in attribute.keys():
|
||||
output.write(':book_' + k + ": " + attribute[k] + "\n")
|
||||
|
||||
print "Transformation complete!"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue