Back to home page

EIC code displayed by LXR

 
 

    


Warning, /east/docs/_content/contribute.md is written in an unsupported language. File is not indexed.

0001 ---
0002 title: "Contribute to this site"
0003 layout: base
0004 name: contribute
0005 ---
0006 
0007 <h1>Contribute to this site</h1>
0008 
0009 ---
0010 
0011 * TOC
0012 {:toc}
0013 
0014 ---
0015 
0016 ## Overview
0017 
0018 This page will be of interest to the collaborators interested in contributing to this
0019 site or involved in its maintenance. In many cases making a contribution can be as easy
0020 as editing a text file.
0021 
0022 We use GitHub to manage the content and formatting for this site. Please take a look at the
0023 {% include link.md name='github_east' tag='eAST repository' %}, which
0024 is under the {% include link.md name='github_eic' tag='EIC Software Organization' %}
0025 on GitHub to get an idea of the general organization of the data, layouts and supporing logic.
0026 The content and code for this website is in the ```docs``` folder of the repository.
0027 
0028 At the time of writing we are taking advantage of the {% include link.md name='github_east' tag='"GitHub Pages"' %}
0029 functionality of GitHub, which provides hosting and automatic generation of web pages
0030 from the content of the ```docs``` folder using the {% include link.md name='jekyll' tag='Jekyll' %}
0031 website generator.
0032 
0033 ---
0034 
0035 ## Jekyll, Markdown and Liquid
0036 
0037 The {% include link.md name='jekyll' tag='Jekyll' %} website generator renders
0038 pages written in {% include link.md name='markdown' tag='Markdown' %} format, which
0039 is quite easy to read and edit since it's just plain text for the most part.
0040 In a nutshell, the input for Jekyll is a collection of Markdown-formatted files
0041 and optionally some content formatted in YAML, and the output is a complete
0042 tree of HTML files representing the site to be served on the Web.
0043 
0044 Markdown is widely used on GitHub and elsewhere to maintain README files so it's familiar
0045 to most users. Jekyll expects a small section of YAML-formatted data on top of every Markdown
0046 page included in the website. It can be quite minimalistic, e.g.
0047 
0048 ```yaml
0049 ---
0050 title: My eAST Code
0051 name: my_east_code
0052 category: geant4
0053 layout: default
0054 ---
0055 ```
0056 
0057 In fact only two attributes are mandatory - the *layout* which specifies the template use
0058 to render the page, and *name* which is used to reference the page. Any number of templates
0059 can be created for use on the website.
0060 
0061 If you decide to contribute to this website we strongly recommend that you install
0062 Jekyll on your machine. The workflow would then consist of
0063 
0064 * Cloning or forking the eAST repository
0065 * Making and validating changes locally using Jekyll (i.e. using your editor to make changes, then inspecting pages with a browser, as explained below)
0066 * git - commit and push
0067 
0068 Since Jekyll is an application written in Ruby language installing Ruby is a requirement.
0069 **Knowledge of Ruby is absolutely not required**
0070 since all development takes place in the very basic Markdown and YAML environment.
0071 Installation instructions can be found on
0072 on the [installation page](https://jekyllrb.com/docs/installation/) of the Jekyll website.
0073 Once the installation is done, you can run a development web server locally. Assuming
0074 you are working on eAST documentation (this website), and your current folder is
0075 _east_, this is achieved as follows:
0076 
0077 ```bash
0078 # Go the folder which contains the website materials:
0079 cd docs
0080 # This is done only once, after you clone the eAST repository, in order to install necesary dependencies
0081 bundle install
0082 # Finally run
0083 bundle exec jekyll serve
0084 ```
0085 
0086 At this point Jekyll has been started in the _docs_ folder, and
0087 you can view the web site by pointing your browser to `localhost:4000`.
0088 Depending on the OS environment, for host name resolution to work, you may
0089 also need to specify the host address as ```0.0.0.0```. Also, when working in the
0090 WSL2 environment, please be aware that port 4000 is often blocked. In these
0091 circumstances, the above command line should be modified to:
0092 
0093 ```bash
0094 bundle exec jekyll serve  --host 0.0.0.0 --port 8000
0095 ```
0096 
0097 ...and you would need to point your browser to ```localhost:8000``` to
0098 view the locally generated website.
0099 
0100 Changes made to files locally are automatically compiled and reflected on the
0101 displayed site (when the page is reloaded). The optimal workflow is to make changes and debug
0102 entirely locally before doing a 'git commit' and pushing to GitHub. Once material
0103 is pushed to GitHub the instance of the website hosted on that portal will be automatically
0104 recompiled and serve. This may take a few minutes.
0105 
0106 Users who whish to develop or maintain templates for this website need to get
0107 basic familiarity with the {% include link.md name='liquid' tag='Liquid' %} template
0108 language. It is easy to read and learn.
0109 
0110 ---
0111 
0112 ## Formatting
0113 
0114 We aim to provide a uniform look and feel across the site.
0115 
0116 Blockquotes are used to put emphasis on quoted text. The standard
0117 way of doing it in Markdown is to prepend the lines that need this
0118 formatting with the '>' character. For example:
0119 
0120 ```
0121 >Blockquote!
0122 ```
0123 
0124 ...will produce
0125 >Blockquote!
0126 
0127 Language-aware code highlighting capability has been integrated and
0128 can be easily used via the fenced code blocks i.e. blocks delimited by
0129 triple backticks, with an optional shortcut for the programming language name.
0130 For example,
0131 
0132     ```bash
0133     export foo="foo"
0134     echo $foo
0135     ls -l .
0136     ```
0137 
0138 will be rendered as:
0139 
0140 ```bash
0141 export foo="foo"
0142 echo $foo
0143 ls -l .
0144 ```
0145 
0146 and
0147 
0148     ```python
0149     def my_function():
0150       print("Hello from a function")
0151     ```
0152 
0153 will show as:
0154 
0155 ```python
0156 def my_function():
0157   print("Hello from a function")
0158 ```
0159 
0160 For C++, the opening line should be triple backticks followed by "c++"
0161 similar to examples above and the code will be rendered accordingly such as:
0162 
0163 ```c++
0164 class MyClass {       // The class
0165   public:             // Access specifier
0166     int myNum;        // Attribute (int variable)
0167     string myString;  // Attribute (string variable)
0168 };
0169 ```
0170 ---
0171 
0172 ## Managing Data
0173 
0174 Jekyll is a capable platform when it comes to storing and manipulating structured data.
0175 The data component of the site can reside in the "front matter" section of the Markdown-formatted
0176 files or in separate YAML (or JSON, CSV etc) data sources. The front matter approach works well
0177 for small sites. For scalability, it is recommended to rely mostly on dedicated data files (i.e.
0178 files in the "<a href="https://github.com/eic/east/tree/main/docs/_data" target="_blank">_data</a>" folder)
0179 and keep the content of the front matter sections of individual MD files to a minimum.
0180 
0181 YAML (and data in other formats) are parsed into data structures such as lists an arrays,
0182 providing an intuitive way for the developer to combine and process data using 
0183 the {% include link.md name='liquid' tag='Liquid' %} template language. This is often
0184 done using *macros* which are technically include files but are semantically similar to functions.
0185 For example, this site contains a file named
0186 <a href="https://github.com/eic/east/tree/main/docs/_data/links.yml" target="_blank">links.yml</a>
0187 which provides a way to quickly generate URLs on pages using mnemonic names. This is done
0188 using this simple macro:
0189 <a href="https://raw.githubusercontent.com/eic/east/main/docs/_includes/link.md" target="_blank">link.md</a>
0190