Explorar el Código

Open external links in online documentation in a new window or tab (#1696)

* Documentation: Hubspot template changed

* Documentation: Title of website documentation is now a parameter in the Hubspot template.

* Documentation: Hubspot template changed

* Documentation: links on website fixed

* Documentation: build path fixed

* Documentation: most broken links in the online documentation fixed.

* Documentation: more links fixed

* Documentation: Hubspot template changed

* Documentation: URLs to be excluded fixed in link checker script

* Documentation: open external links in new window or tab

* Documentation: "Edit on GitHub" removed from installation guide, too
Rainer Klute hace 7 años
padre
commit
0adb228b10

+ 16 - 2
plugins/org.yakindu.sct.doc.user/src/main/java/org/yakindu/sct/doc/user/wikitext/HubspotDocumentBuilder.java

@@ -277,8 +277,22 @@ public class HubspotDocumentBuilder extends HtmlDocumentBuilder {
 		} else {
 			if (SpanType.LINK == type && attributes instanceof LinkAttributes) {
 				final LinkAttributes linkAttributes = (LinkAttributes) attributes;
-				String hrefOrHashName = linkAttributes.getHref();
-				if (hrefOrHashName.startsWith("../")) {
+
+				final String hrefOrHashName = linkAttributes.getHref();
+
+				if (hrefOrHashName.startsWith("http")) {
+					/*
+					 * An external link should be opened in a new tab or window
+					 * and thus gets the target="_blank" attribute attached.
+					 */
+					linkAttributes.setTarget("_blank");
+				} else if (hrefOrHashName.startsWith("../")) {
+					/*
+					 * Links pointing into the parent directory are referring
+					 * another section of our documentation are require some
+					 * special handling in order to comply with the Hubspot
+					 * template.
+					 */
 					boolean hasHash = false;
 					boolean hasFragment = false;
 					boolean hasFilename = false;

+ 0 - 2
plugins/org.yakindu.sct.doc.user/src/user-guide/installation.textile

@@ -214,8 +214,6 @@ Depending on your Linux distribution and version, you might need to install addi
 
 The list of Linux distributions mentioned below is in no way meant to be exhaustive. If your Linux distribution is not yet among them and you manage to find out the proper commands for it, please let us know – e.g. by directly editing this document:
 
-p(edit-on-github). "Edit on GitHub":https://github.com/Yakindu/statecharts/edit/master/plugins/org.yakindu.sct.doc.user/src/installation/installation.textile
-
 
 h4(#inst_linux_webkit_gtk). Webkit GTK