diff --git a/aggregation/navbar-head.html b/aggregation/navbar-head.html index 2b8925e14e..32d892009d 100644 --- a/aggregation/navbar-head.html +++ b/aggregation/navbar-head.html @@ -119,4 +119,38 @@ span.image img { box-shadow: 3px 3px 15px 0px rgba(0,0,0,0.5); } +.sect1+.sect1 { + border-top: none; +} + +.page-links { + border-bottom: 1px solid #efefed; + border-top: none; + background: none; + position: relative; + left: 0em; + width: 100%; + top: -5em; + height: 0; + margin: 0; + padding: 0; +} + +.sect2 .page-links { + top: -3.5em; +} + +.page-links .content { + background: #f8f8f7; + border: 1px solid #e0e0dc; + float: right; + font-size: 0.8em; + margin: 0; + padding: 5px; +} + +.page-links a { + display: block; + padding: 5px; +} diff --git a/api_documentation/index.adoc b/api_documentation/index.adoc index 85b509a757..60a222254d 100644 --- a/api_documentation/index.adoc +++ b/api_documentation/index.adoc @@ -1,7 +1,8 @@ include::topics/templates/document-attributes-community.adoc[] :api_documentation: +:linkattrs: = {apidocs_name} -include::topics/overview.adoc[] +include::topics.adoc[] diff --git a/api_documentation/master.adoc b/api_documentation/master.adoc index 52e1dfe163..d36f73beaa 100644 --- a/api_documentation/master.adoc +++ b/api_documentation/master.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-product.adoc[] diff --git a/api_documentation/pom.xml b/api_documentation/pom.xml index 06358720b2..49b1fc26e3 100644 --- a/api_documentation/pom.xml +++ b/api_documentation/pom.xml @@ -15,6 +15,15 @@ + + org.keycloak.documentation + header-maven-plugin + + + add-file-headers + + + org.asciidoctor asciidoctor-maven-plugin diff --git a/api_documentation/topics.adoc b/api_documentation/topics.adoc new file mode 100644 index 0000000000..6d4f5942dd --- /dev/null +++ b/api_documentation/topics.adoc @@ -0,0 +1 @@ +include::topics/overview.adoc[] diff --git a/authorization_services/index.adoc b/authorization_services/index.adoc index 36c909381a..75aad87080 100644 --- a/authorization_services/index.adoc +++ b/authorization_services/index.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-community.adoc[] diff --git a/authorization_services/master.adoc b/authorization_services/master.adoc index f2ce6f603f..715efd33df 100644 --- a/authorization_services/master.adoc +++ b/authorization_services/master.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-product.adoc[] diff --git a/authorization_services/pom.xml b/authorization_services/pom.xml index 9fa0f5b6c3..60a3fbc478 100644 --- a/authorization_services/pom.xml +++ b/authorization_services/pom.xml @@ -15,6 +15,15 @@ + + org.keycloak.documentation + header-maven-plugin + + + add-file-headers + + + org.asciidoctor asciidoctor-maven-plugin diff --git a/getting_started/index.adoc b/getting_started/index.adoc index 2afbf8b689..fc659a8e99 100644 --- a/getting_started/index.adoc +++ b/getting_started/index.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-community.adoc[] include::topics.adoc[] \ No newline at end of file diff --git a/getting_started/master.adoc b/getting_started/master.adoc index 926d91a2b4..d697e6af09 100644 --- a/getting_started/master.adoc +++ b/getting_started/master.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-product.adoc[] diff --git a/getting_started/pom.xml b/getting_started/pom.xml index ccd685a97a..50ecd918bf 100644 --- a/getting_started/pom.xml +++ b/getting_started/pom.xml @@ -15,6 +15,15 @@ + + org.keycloak.documentation + header-maven-plugin + + + add-file-headers + + + org.asciidoctor asciidoctor-maven-plugin diff --git a/header-maven-plugin/pom.xml b/header-maven-plugin/pom.xml new file mode 100644 index 0000000000..06aaccbf26 --- /dev/null +++ b/header-maven-plugin/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + documentation-parent + org.keycloak.documentation + 1.0.0-SNAPSHOT + + + org.keycloak.documentation + header-maven-plugin + 1.0.0-SNAPSHOT + maven-plugin + + github-maven-plugin + + + UTF-8 + + + + + org.apache.maven + maven-project + 2.2.1 + + + org.apache.maven + maven-plugin-api + 3.0 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.1 + provided + + + org.codehaus.plexus + plexus-utils + 3.0.24 + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.4 + + header-maven-plugin + true + + + + mojo-descriptor + + descriptor + + + + header-goal + + helpmojo + + + + + + + diff --git a/header-maven-plugin/src/main/java/sample/plugin/HeaderMojo.java b/header-maven-plugin/src/main/java/sample/plugin/HeaderMojo.java new file mode 100644 index 0000000000..562f87d150 --- /dev/null +++ b/header-maven-plugin/src/main/java/sample/plugin/HeaderMojo.java @@ -0,0 +1,130 @@ +package sample.plugin; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintStream; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; + +/** + * Goal which touches a timestamp file. + */ +@Mojo(name = "header", defaultPhase = LifecyclePhase.PROCESS_SOURCES) +public class HeaderMojo extends AbstractMojo { + + @Parameter(defaultValue = "${project}", readonly = true) + private MavenProject mavenProject; + + @Parameter(defaultValue = "index", property = "masterFile", required = true) + private String masterFileName; + + @Parameter(defaultValue = "${project.build.directory}/sources", property = "outputDir", required = true) + private File outputDir; + + private File baseDir; + + private File topicsFile; + + private File topicsDir; + + public void execute() throws MojoExecutionException { + try { + baseDir = mavenProject.getBasedir(); + + copy(new File(baseDir, masterFileName + ".adoc")); + copy(new File(baseDir, "topics.adoc")); + + File docInfo = new File(baseDir, "docinfo.html"); + if (docInfo.isFile()) { + copy(docInfo); + copy(new File(baseDir, "docinfo-footer.html")); + } + + topicsDir = new File(baseDir, "topics"); + + processTopics(topicsDir); + } catch (IOException e) { + e.printStackTrace(); + throw new MojoExecutionException(e.getMessage(), e); + } + } + + private void copy(File file) throws IOException { + File out = new File(outputDir, file.getName()); + out.mkdirs(); + Files.copy(file.toPath(), out.toPath(), StandardCopyOption.REPLACE_EXISTING); + } + + private void processTopics(File f) throws IOException { + File out = new File(outputDir, f.getAbsolutePath().replaceFirst(topicsDir.getParentFile().getAbsolutePath(), "")); + + if (f.isFile() && f.getAbsolutePath().contains("/templates/")) { + out.getParentFile().mkdirs(); + Files.copy(f.toPath(), out.toPath(), StandardCopyOption.REPLACE_EXISTING); + } else if (f.isDirectory()) { + for (File c : f.listFiles()) { + processTopics(c); + } + } else if (f.getName().endsWith(".adoc")) { + out.getParentFile().mkdirs(); + + String filePath = f.getAbsolutePath().replace(baseDir.getParent(), "").substring(1); + + String includeHeaderPath = filePath.substring(baseDir.getName().length() + 7); + includeHeaderPath = includeHeaderPath.substring(0, includeHeaderPath.lastIndexOf('/')); + includeHeaderPath = includeHeaderPath.replaceAll("/[^/]+", "../"); + includeHeaderPath = includeHeaderPath + "templates/header.adoc"; + + String header = "\n\n:include_filename: " + filePath + "\ninclude::" + includeHeaderPath + "[]\n\n"; + + PrintStream ps = new PrintStream(new FileOutputStream(out)); + + + BufferedReader br = new BufferedReader(new FileReader(f)); + for (String l = br.readLine(); l != null; l = br.readLine()) { + ps.println(l); + if (l.contains("=")) { + break; + } + } + + ps.print(header); + + for (String l = br.readLine(); l != null; l = br.readLine()) { + ps.println(l); + } + + br.close(); + ps.close(); + } + } +} diff --git a/pom.xml b/pom.xml index 95d3c4efa4..dd5930c34b 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ + header-maven-plugin api_documentation authorization_services getting_started @@ -38,7 +39,7 @@ upgrading aggregation tests - + @@ -77,7 +78,6 @@ maven-install-plugin ${version.install.plugin} - org.apache.maven.plugins maven-antrun-plugin @@ -102,6 +102,23 @@ maven-dependency-plugin ${version.plugin.dependency} + + org.keycloak.documentation + header-maven-plugin + 1.0.0-SNAPSHOT + + + add-file-headers + + header + + + ${masterFile} + + + + + org.asciidoctor asciidoctor-maven-plugin @@ -114,7 +131,7 @@ process-asciidoc - ${basedir} + ${basedir}/target/sources ${masterFile}.adoc html5 coderay @@ -188,4 +205,4 @@ - + \ No newline at end of file diff --git a/securing_apps/index.adoc b/securing_apps/index.adoc index 2afbf8b689..fc659a8e99 100644 --- a/securing_apps/index.adoc +++ b/securing_apps/index.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-community.adoc[] include::topics.adoc[] \ No newline at end of file diff --git a/securing_apps/master.adoc b/securing_apps/master.adoc index 3fda78cef5..fa52bc507d 100644 --- a/securing_apps/master.adoc +++ b/securing_apps/master.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-product.adoc[] diff --git a/securing_apps/pom.xml b/securing_apps/pom.xml index 87d06962a6..53ea70d3ed 100644 --- a/securing_apps/pom.xml +++ b/securing_apps/pom.xml @@ -15,6 +15,15 @@ + + org.keycloak.documentation + header-maven-plugin + + + add-file-headers + + + org.asciidoctor asciidoctor-maven-plugin diff --git a/server_admin/index.adoc b/server_admin/index.adoc index 2afbf8b689..fc659a8e99 100644 --- a/server_admin/index.adoc +++ b/server_admin/index.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-community.adoc[] include::topics.adoc[] \ No newline at end of file diff --git a/server_admin/master.adoc b/server_admin/master.adoc index 0e5a0783a0..302098de35 100644 --- a/server_admin/master.adoc +++ b/server_admin/master.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-product.adoc[] diff --git a/server_admin/pom.xml b/server_admin/pom.xml index 8737aafa1e..13a4d52ef3 100644 --- a/server_admin/pom.xml +++ b/server_admin/pom.xml @@ -15,6 +15,15 @@ + + org.keycloak.documentation + header-maven-plugin + + + add-file-headers + + + org.asciidoctor asciidoctor-maven-plugin diff --git a/server_development/index.adoc b/server_development/index.adoc index 2afbf8b689..fc23ef30ca 100644 --- a/server_development/index.adoc +++ b/server_development/index.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-community.adoc[] -include::topics.adoc[] \ No newline at end of file +include::topics.adoc[] diff --git a/server_development/master.adoc b/server_development/master.adoc index d8cd4ad638..4534669897 100644 --- a/server_development/master.adoc +++ b/server_development/master.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-product.adoc[] diff --git a/server_development/pom.xml b/server_development/pom.xml index b905570bf1..0ec8ac3e64 100644 --- a/server_development/pom.xml +++ b/server_development/pom.xml @@ -11,10 +11,19 @@ Server Developer server-development - pom + jar + + org.keycloak.documentation + header-maven-plugin + + + add-file-headers + + + org.asciidoctor asciidoctor-maven-plugin diff --git a/server_installation/index.adoc b/server_installation/index.adoc index 2afbf8b689..fc659a8e99 100644 --- a/server_installation/index.adoc +++ b/server_installation/index.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-community.adoc[] include::topics.adoc[] \ No newline at end of file diff --git a/server_installation/master.adoc b/server_installation/master.adoc index 601b3938fe..cbd099ff65 100644 --- a/server_installation/master.adoc +++ b/server_installation/master.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-product.adoc[] diff --git a/server_installation/pom.xml b/server_installation/pom.xml index e46877b19b..01ff186ed8 100644 --- a/server_installation/pom.xml +++ b/server_installation/pom.xml @@ -15,6 +15,15 @@ + + org.keycloak.documentation + header-maven-plugin + + + add-file-headers + + + org.asciidoctor asciidoctor-maven-plugin diff --git a/topics/templates/header.adoc b/topics/templates/header.adoc new file mode 100644 index 0000000000..71ec67e424 --- /dev/null +++ b/topics/templates/header.adoc @@ -0,0 +1,3 @@ +[sidebar,role="page-links"] +link:https://github.com/keycloak/keycloak-documentation/blob/master/{include_filename}[Edit this section, window="_blank"] +link:https://issues.jboss.org/secure/CreateIssueDetails!init.jspa?pid=12313920&components=12323375&issuetype=1&priority=3&description=File:%20{include_filename}[Report an issue, window="_blank"] \ No newline at end of file diff --git a/upgrading/index.adoc b/upgrading/index.adoc index 2afbf8b689..fc659a8e99 100644 --- a/upgrading/index.adoc +++ b/upgrading/index.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 3 :numbered: +:linkattrs: include::topics/templates/document-attributes-community.adoc[] include::topics.adoc[] \ No newline at end of file diff --git a/upgrading/master.adoc b/upgrading/master.adoc index 027ffa764e..1c23d40c13 100644 --- a/upgrading/master.adoc +++ b/upgrading/master.adoc @@ -1,6 +1,7 @@ :toc: :toclevels: 2 :numbered: +:linkattrs: include::topics/templates/document-attributes-product.adoc[] diff --git a/upgrading/pom.xml b/upgrading/pom.xml index e93b97c20b..45fe6ee01c 100644 --- a/upgrading/pom.xml +++ b/upgrading/pom.xml @@ -15,6 +15,15 @@ + + org.keycloak.documentation + header-maven-plugin + + + add-file-headers + + + org.asciidoctor asciidoctor-maven-plugin