Regex Added for target blank
Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata-site/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata-site/commit/21475904 Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata-site/tree/21475904 Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata-site/diff/21475904 Branch: refs/heads/asf-site Commit: 214759049f2f0c0cd33a1a14c2886cace890c21a Parents: e206c92 Author: jatin <jatin.de...@knoldus.in> Authored: Thu Apr 6 12:19:49 2017 +0530 Committer: jatin <jatin.de...@knoldus.in> Committed: Thu Apr 6 12:19:49 2017 +0530 ---------------------------------------------------------------------- src/main/scala/MdFilehandler.scala | 4 +- src/main/webapp/quick-start-guide.html | 322 ---------------------------- 2 files changed, 3 insertions(+), 323 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-carbondata-site/blob/21475904/src/main/scala/MdFilehandler.scala ---------------------------------------------------------------------- diff --git a/src/main/scala/MdFilehandler.scala b/src/main/scala/MdFilehandler.scala index df423cd..7522ab3 100644 --- a/src/main/scala/MdFilehandler.scala +++ b/src/main/scala/MdFilehandler.scala @@ -22,10 +22,12 @@ class MdFilehandler { val modifyContentPattern = new Regex("id=\"user-content-") val modifyMdPattern = new Regex(".md") val modifyImagePattern=new Regex("<img src=\"../docs") + val modifyFileLink="""(<a href=\"https)://([a-zA-Z0-9-/.]+)(\")""".r val contentAfterRemovingUserContent: String = modifyContentPattern replaceAllIn(input, "id=\"") val contentAfterReplacingId: String = modifyMdPattern replaceAllIn(contentAfterRemovingUserContent, ".html") val contentAfterReplacingImage: String = modifyImagePattern replaceAllIn(contentAfterReplacingId, "<img src=\"https://github.com/apache/incubator-carbondata/blob/master/docs") - contentAfterReplacingImage + val contentAfterReplacingFileLink: String = modifyFileLink replaceAllIn(contentAfterReplacingImage, "$1://$2$3 target=_blank") + contentAfterReplacingFileLink } /** http://git-wip-us.apache.org/repos/asf/incubator-carbondata-site/blob/21475904/src/main/webapp/quick-start-guide.html ---------------------------------------------------------------------- diff --git a/src/main/webapp/quick-start-guide.html b/src/main/webapp/quick-start-guide.html deleted file mode 100644 index 97b2240..0000000 --- a/src/main/webapp/quick-start-guide.html +++ /dev/null @@ -1,322 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> -<head> - <meta charset="utf-8"> - <meta http-equiv="X-UA-Compatible" content="IE=edge"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <link href='images/favicon.ico' rel='shortcut icon' type='image/x-icon'> - <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> - <title>CarbonData</title> - <style> - - </style> - <!-- Bootstrap --> - - <link rel="stylesheet" href="css/bootstrap.min.css"> - <link href="css/style.css" rel="stylesheet"> - <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> - <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> - <!--[if lt IE 9]> - <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> - <script src="https://oss.maxcdn.scom/respond/1.4.2/respond.min.js"></script> - <![endif]--> - <script src="js/jquery.min.js"></script> - <script src="js/bootstrap.min.js"></script> - - -</head> -<body> -<header> - <nav class="navbar navbar-default navbar-custom cd-navbar-wrapper"> - <div class="container"> - <div class="navbar-header"> - <button aria-controls="navbar" aria-expanded="false" data-target="#navbar" data-toggle="collapse" - class="navbar-toggle collapsed" type="button"> - <span class="sr-only">Toggle navigation</span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - <span class="icon-bar"></span> - </button> - <a href="index.html" class="logo"> - <img src="images/CarbonDataLogo.png" alt="CarbonData logo" title="CarbocnData logo"/> - </a> - </div> - <div class="navbar-collapse collapse cd_navcontnt" id="navbar"> - <ul class="nav navbar-nav navbar-right navlist-custom"> - <li><a href="index.html" class="hidden-xs"><i class="fa fa-home" aria-hidden="true"></i> </a> - </li> - <li><a href="index.html" class="hidden-lg hidden-md hidden-sm">Home</a></li> - <li class="dropdown"> - <a href="#" class="dropdown-toggle " data-toggle="dropdown" role="button" aria-haspopup="true" - aria-expanded="false"> Download <span class="caret"></span></a> - <ul class="dropdown-menu"> - <li> - <a href="https://www.apache.org/dyn/closer.lua/incubator/carbondata/1.0.0-incubating" - target="_blank">Apache CarbonData 1.0.0</a></li> - <li> - <a href="https://www.apache.org/dyn/closer.lua/incubator/carbondata/0.2.0-incubating" - target="_blank">Apache CarbonData 0.2.0</a></li> - <li> - <a href="https://www.apache.org/dyn/closer.lua/incubator/carbondata/0.1.1-incubating" - target="_blank">Apache CarbonData 0.1.1</a></li> - <li> - <a href="https://www.apache.org/dyn/closer.lua/incubator/carbondata/0.1.0-incubating" - target="_blank">Apache CarbonData 0.1.0</a></li> - <li> - <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/Releases" - target="_blank">Release Archive</a></li> - </ul> - </li> - <li><a href="mainpage.html" class="">Documentation</a></li> - <li class="dropdown"> - <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" - aria-expanded="false">Community <span class="caret"></span></a> - <ul class="dropdown-menu"> - <li> - <a href="https://github.com/apache/incubator-carbondata/blob/master/docs/How-to-contribute-to-Apache-CarbonData.md" - target="_blank">Contributing to CarbonData</a></li> - <li> - <a href="https://cwiki.apache.org/confluence/display/CARBONDATA/PPMC+and+Committers+member+list" - target="_blank">Project PPMC and Committers</a></li> - <li> - <a href="https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=66850609" - target="_blank">CarbonData Meetups</a></li> - <li><a href="security.html">Apache CarbonData Security</a></li> - <li><a href="https://issues.apache.org/jira/browse/CARBONDATA" target="_blank">Apache - Jira</a></li> - <li><a href="videogallery.html">CarbonData Videos </a></li> - </ul> - </li> - <li class="dropdown"> - <a href="http://www.apache.org/" class="apache_link hidden-xs dropdown-toggle" - data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Apache</a> - <ul class="dropdown-menu"> - <li><a href="http://www.apache.org/" target="_blank">Apache Homepage</a></li> - <li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li> - <li><a href="http://www.apache.org/foundation/sponsorship.html" - target="_blank">Sponsorship</a></li> - <li><a href="http://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a></li> - </ul> - </li> - - <li class="dropdown"> - <a href="http://www.apache.org/" class="hidden-lg hidden-md hidden-sm dropdown-toggle" - data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Apache</a> - <ul class="dropdown-menu"> - <li><a href="http://www.apache.org/" target="_blank">Apache Homepage</a></li> - <li><a href="http://www.apache.org/licenses/" target="_blank">License</a></li> - <li><a href="http://www.apache.org/foundation/sponsorship.html" - target="_blank">Sponsorship</a></li> - <li><a href="http://www.apache.org/foundation/thanks.html" target="_blank">Thanks</a></li> - </ul> - </li> - - <li> - <a href="#" id="search-icon"><i class="fa fa-search" aria-hidden="true"></i></a> - - </li> - - </ul> - </div><!--/.nav-collapse --> - <div id="search-box"> - <form method="get" action="http://www.google.com/search"> - <div class="search-block"> - <table border="0" cellpadding="0" width="100%"> - <tr> - <td style="width:80%"> - <input type="text" name="q" size=" 5" maxlength="255" value="" - class="search-input"/> - </td> - <td style="width:20%"> - <input type="submit" value="Search"/></td> - </tr> - <tr> - <td align="left" style="font-size:75%" colspan="2"> - <input type="checkbox" name="sitesearch" value="carbondata.apache.org" checked/> - Only search for CarbonData - </td> - </tr> - </table> - </div> - </form> - </div> - </div> - </nav> -</header> <!-- end Header part --> - -<div class="fixed-padding"></div> <!-- top padding with fixde header --> - -<section><!-- Dashboard nav --> - <div class="container-fluid q"> - <div class="col-sm-12 col-md-12 maindashboard"> - <div class="row"> - <section> - <div style="padding:10px 15px;"> - <div id="viewpage" name="viewpage"> - <div class="row"> - <div class="col-sm-12 col-md-12"> - <div> - -<h1> -<a id="quick-start" class="anchor" href="#quick-start" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Quick Start</h1> - -<p>This tutorial provides a quick introduction to using CarbonData.</p> - -<h2> -<a id="prerequisites" class="anchor" href="#prerequisites" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Prerequisites</h2> - -<ul> -<li> -<a href="https://github.com/apache/incubator-carbondata/blob/master/build">Installation and building CarbonData</a>.</li> -<li> -<p>Create a sample.csv file using the following commands. The CSV file is required for loading data into CarbonData.</p> - -<pre><code>cd carbondata -cat > sample.csv << EOF -id,name,city,age -1,david,shenzhen,31 -2,eason,shenzhen,27 -3,jarry,wuhan,35 -EOF -</code></pre> -</li> -</ul> - -<h2> -<a id="interactive-analysis-with-spark-shell" class="anchor" href="#interactive-analysis-with-spark-shell" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Interactive Analysis with Spark Shell</h2> - -<h2> -<a id="version-21" class="anchor" href="#version-21" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Version 2.1</h2> - -<p>Apache Spark Shell provides a simple way to learn the API, as well as a powerful tool to analyze data interactively. Please visit <a href="http://spark.apache.org/docs/latest/">Apache Spark Documentation</a> for more details on Spark shell.</p> - -<h4> -<a id="basics" class="anchor" href="#basics" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Basics</h4> - -<p>Start Spark shell by running the following command in the Spark directory:</p> - -<pre><code>./bin/spark-shell --jars <carbondata assembly jar path> -</code></pre> - -<p>In this shell, SparkSession is readily available as <code>spark</code> and Spark context is readily available as <code>sc</code>.</p> - -<p>In order to create a CarbonSession we will have to configure it explicitly in the following manner :</p> - -<ul> -<li>Import the following :</li> -</ul> - -<pre><code>import org.apache.spark.sql.SparkSession -import org.apache.spark.sql.CarbonSession._ -</code></pre> - -<ul> -<li>Create a CarbonSession :</li> -</ul> - -<pre><code>val carbon = SparkSession.builder().config(sc.getConf).getOrCreateCarbonSession("<hdfs store path>") -</code></pre> - -<p><strong>NOTE</strong>: By default metastore location is pointed to <code>../carbon.metastore</code>, user can provide own metastore location to CarbonSession like <code>SparkSession.builder().config(sc.getConf).getOrCreateCarbonSession("<hdfs store path>", "<local metastore path>")</code></p> - -<h4> -<a id="executing-queries" class="anchor" href="#executing-queries" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Executing Queries</h4> - -<h5> -<a id="creating-a-table" class="anchor" href="#creating-a-table" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Creating a Table</h5> - -<pre><code>scala>carbon.sql("CREATE TABLE IF NOT EXISTS test_table(id string, name string, city string, age Int) STORED BY 'carbondata'") -</code></pre> - -<h5> -<a id="loading-data-to-a-table" class="anchor" href="#loading-data-to-a-table" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Loading Data to a Table</h5> - -<pre><code>scala>carbon.sql("LOAD DATA INPATH 'sample.csv file path' INTO TABLE test_table") -</code></pre> - -<p><strong>NOTE</strong>: Please provide the real file path of <code>sample.csv</code> for the above script.</p> - -<h6> -<a id="query-data-from-a-table" class="anchor" href="#query-data-from-a-table" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Query Data from a Table</h6> - -<pre><code>scala>carbon.sql("SELECT * FROM test_table").show() - -scala>carbon.sql("SELECT city, avg(age), sum(age) FROM test_table GROUP BY city").show() -</code></pre> - -<h2> -<a id="interactive-analysis-with-spark-shell-1" class="anchor" href="#interactive-analysis-with-spark-shell-1" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Interactive Analysis with Spark Shell</h2> - -<h2> -<a id="version-16" class="anchor" href="#version-16" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Version 1.6</h2> - -<h4> -<a id="basics-1" class="anchor" href="#basics-1" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Basics</h4> - -<p>Start Spark shell by running the following command in the Spark directory:</p> - -<pre><code>./bin/spark-shell --jars <carbondata assembly jar path> -</code></pre> - -<p><strong>NOTE</strong>: In this shell, SparkContext is readily available as <code>sc</code>.</p> - -<ul> -<li>In order to execute the Queries we need to import CarbonContext:</li> -</ul> - -<pre><code>import org.apache.spark.sql.CarbonContext -</code></pre> - -<ul> -<li>Create an instance of CarbonContext in the following manner :</li> -</ul> - -<pre><code>val cc = new CarbonContext(sc, "<hdfs store path>") -</code></pre> - -<p><strong>NOTE</strong>: If running on local machine without hdfs, configure the local machine's store path instead of hdfs store path</p> - -<h4> -<a id="executing-queries-1" class="anchor" href="#executing-queries-1" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Executing Queries</h4> - -<h5> -<a id="creating-a-table-1" class="anchor" href="#creating-a-table-1" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Creating a Table</h5> - -<pre><code>scala>cc.sql("CREATE TABLE IF NOT EXISTS test_table (id string, name string, city string, age Int) STORED BY 'carbondata'") -</code></pre> - -<p>To see the table created :</p> - -<pre><code>scala>cc.sql("SHOW TABLES").show() -</code></pre> - -<h5> -<a id="loading-data-to-a-table-1" class="anchor" href="#loading-data-to-a-table-1" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Loading Data to a Table</h5> - -<pre><code>scala>cc.sql("LOAD DATA INPATH 'sample.csv file path' INTO TABLE test_table") -</code></pre> - -<p><strong>NOTE</strong>: Please provide the real file path of <code>sample.csv</code> for the above script.</p> - -<h5> -<a id="query-data-from-a-table-1" class="anchor" href="#query-data-from-a-table-1" aria-hidden="true"><span aria-hidden="true" class="octicon octicon-link"></span></a>Query Data from a Table</h5> - -<pre><code>scala>cc.sql("SELECT * FROM test_table").show() -scala>cc.sql("SELECT city, avg(age), sum(age) FROM test_table GROUP BY city").show() -</code></pre> -</div> -</div> -</div> -</div> -<div class="doc-footer"> - <a href="#top" class="scroll-top">Top</a> -</div> -</div> -</section> -</div> -</div> -</div> -</section><!-- End systemblock part --> -<script src="js/custom.js"></script> -</body> -</html> \ No newline at end of file