[ 
https://issues.apache.org/jira/browse/SPARK-16294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Cheng Lian updated SPARK-16294:
-------------------------------
    Description: 
Part of the Spark programming guide pages are using the {{include_example}} 
Jekyll plugin to extract line blocks surrounded by {{example on}} and {{example 
off}} tag pairs (usually written as comments) from source files under the 
{{examples}} sub-project.

One limitation of the {{include_example}} plugin is that all line blocks within 
a single file must be included in a single example snippet block in the final 
HTML file. It would be nice to add labelling support to this plugin, so that we 
mark different line blocks with different labels in the source file:

{code}
// $example on:init_session$
val spark = SparkSession
  .builder()
  .appName("Spark Examples")
  .config("spark.some.config.option", "some-value")
  .getOrCreate()

// For implicit conversions like RDDs to DataFrames
import spark.implicits._
// $example off:init_session$

// $example on:create_df$
val df = spark.read.json("examples/src/main/resources/people.json")

// Displays the content of the DataFrame to stdout
df.show()
// age  name
// null Michael
// 30   Andy
// 19   Justin
// $example off:create_df$
{code}

and then, by referring different labels in the Liquid template, like this:

{code}
{% include_example init_session 
scala/org/apache/spark/examples/sql/SparkSessionExample.scala %}

{% include_example create_df 
scala/org/apache/spark/examples/sql/SparkSessionExample.scala %}
{code}

we may generate multiple example snippet blocks in the final HTML page from a 
single source file.


  was:
Part of the Spark programming guide pages are using the {{include_example}} 
Jekyll plugin to extract line blocks surrounded by {{example on}} and {{example 
off}} tag pairs (usually written as comments) from source files under the 
{{examples}} sub-project.

One limitation of the {{include_example}} plugin is that all line blocks within 
a single file must be included in a single example snippet block in the final 
HTML file. It would be nice to add labelling support to this plugin, so that we 
mark different line blocks with different labels in the source file:

{code}
// $example on:init_session$
val spark = SparkSession
  .builder()
  .appName("Spark Examples")
  .config("spark.some.config.option", "some-value")
  .getOrCreate()

// For implicit conversions like RDDs to DataFrames
import spark.implicits._
// $example off:init_session$

// $example on:create_df$
val df = spark.read.json("examples/src/main/resources/people.json")

// Displays the content of the DataFrame to stdout
df.show()
// age  name
// null Michael
// 30   Andy
// 19   Justin
// $example off:create_df$
{code}

and then, by referring different labels in the Liquid template, like this:

{code}
{% include_example init_session 
scala/org/apache/spark/examples/sql/SparkSessionExample.scala %}

{% include_example create_df 
scala/org/apache/spark/examples/sql/SparkSessionExample.scala %}
{code}

We may generate multiple example snippet blocks in the final HTML page from a 
single source file.



> Labelling support for the include_example Jekyll plugin
> -------------------------------------------------------
>
>                 Key: SPARK-16294
>                 URL: https://issues.apache.org/jira/browse/SPARK-16294
>             Project: Spark
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 2.0.0
>            Reporter: Cheng Lian
>            Assignee: Cheng Lian
>
> Part of the Spark programming guide pages are using the {{include_example}} 
> Jekyll plugin to extract line blocks surrounded by {{example on}} and 
> {{example off}} tag pairs (usually written as comments) from source files 
> under the {{examples}} sub-project.
> One limitation of the {{include_example}} plugin is that all line blocks 
> within a single file must be included in a single example snippet block in 
> the final HTML file. It would be nice to add labelling support to this 
> plugin, so that we mark different line blocks with different labels in the 
> source file:
> {code}
> // $example on:init_session$
> val spark = SparkSession
>   .builder()
>   .appName("Spark Examples")
>   .config("spark.some.config.option", "some-value")
>   .getOrCreate()
> // For implicit conversions like RDDs to DataFrames
> import spark.implicits._
> // $example off:init_session$
> // $example on:create_df$
> val df = spark.read.json("examples/src/main/resources/people.json")
> // Displays the content of the DataFrame to stdout
> df.show()
> // age  name
> // null Michael
> // 30   Andy
> // 19   Justin
> // $example off:create_df$
> {code}
> and then, by referring different labels in the Liquid template, like this:
> {code}
> {% include_example init_session 
> scala/org/apache/spark/examples/sql/SparkSessionExample.scala %}
> {% include_example create_df 
> scala/org/apache/spark/examples/sql/SparkSessionExample.scala %}
> {code}
> we may generate multiple example snippet blocks in the final HTML page from a 
> single source file.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to