From 4d312a44e65c5ae7b494e4abaa559ecb26f8ef76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Goetz?= Date: Sat, 25 Apr 2020 14:44:43 +0200 Subject: [PATCH] Reformat documentation --- CODE_OF_CONDUCT.md | 26 +- README.md | 146 +- docs/00_Getting_Started.md | 84 +- docs/01_Features/CommonMark_compliant.md | 53 +- docs/01_Features/Edit_on_GitHub_links.md | 19 +- docs/01_Features/Landing_page.md | 12 +- docs/01_Features/Live_mode.md | 53 +- docs/01_Features/Multilanguage.md | 3 +- docs/01_Features/Multiple_Output_Formats.md | 26 +- docs/01_Features/Navigation_and_Sorting.md | 19 +- docs/01_Features/Search.md | 6 +- docs/01_Features/Static_Site_Generation.md | 13 +- docs/01_Features/Table_of_contents.md | 8 +- docs/02_Examples/05_Code_Highlighting.md | 4078 ++++++++--------- docs/02_Examples/index.md | 3 +- docs/05_Configuration/Confluence_upload.md | 40 +- docs/05_Configuration/Html_export.md | 89 +- docs/05_Configuration/_index.md | 66 +- .../10_For_Developers/Creating_a_Processor.md | 13 +- docs/10_For_Developers/Creating_a_Theme.md | 77 +- docs/_index.md | 42 +- 21 files changed, 2455 insertions(+), 2421 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index da46639..ddbafd3 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation. Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting ## Our Responsibilities diff --git a/README.md b/README.md index 602948b..a9379f6 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Daux.io - [![Latest Version](https://img.shields.io/github/release/dauxio/daux.io.svg?style=flat-square)](https://github.com/dauxio/daux.io/releases) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](https://github.com/dauxio/daux.io/blob/master/LICENSE.md) [![Build Status](https://github.com/dauxio/daux.io/workflows/CI/badge.svg)](https://github.com/dauxio/daux.io/actions) @@ -8,45 +7,42 @@ [![Quality Score](https://img.shields.io/scrutinizer/g/dauxio/daux.io.svg?style=flat-square)](https://scrutinizer-ci.com/g/dauxio/daux.io) [![Total Downloads](https://img.shields.io/packagist/dt/daux/daux.io.svg?style=flat-square)](https://packagist.org/packages/daux/daux.io) - **Daux.io** is a documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way. ## Features -* 100% Mobile Responsive -* CommonMark compliant (a Markdown specification) -* Supports Markdown tables -* Auto created homepage/landing page -* Auto Syntax Highlighting -* Auto Generated Navigation -* 4 Built-In Themes or roll your own -* Functional, Flat Design Style -* Shareable/Linkable SEO Friendly URLs -* Built On Bootstrap -* No Build Step -* Git/SVN Friendly -* Supports Google Analytics and Piwik Analytics -* Optional code float layout -* Static Output Generation +- 100% Mobile Responsive +- CommonMark compliant (a Markdown specification) +- Supports Markdown tables +- Auto created homepage/landing page +- Auto Syntax Highlighting +- Auto Generated Navigation +- 4 Built-In Themes or roll your own +- Functional, Flat Design Style +- Shareable/Linkable SEO Friendly URLs +- Built On Bootstrap +- No Build Step +- Git/SVN Friendly +- Supports Google Analytics and Piwik Analytics +- Optional code float layout +- Static Output Generation ## Demos This is a list of sites using Daux.io: -- With a custom theme: - * [Crafty](https://swissquote.github.io/crafty) - * [Pixolution flow](https://docs.pixolution.org) - * [Soisy](https://doc.soisy.it/) - * [Vulkan Tutorial](https://vulkan-tutorial.com) - * [3Q](https://docs.3q.video/) - * [The Advanced RSS Environment](https://thearsse.com/manual/) -- With the default Theme - * [Daux.io](https://daux.io/) - * [DoctrineWatcher](https://dsentker.github.io/WatcherDocumentation/) - * [DrupalGap](http://docs.drupalgap.org/8/) - * [ICADMIN: An admin panel powered by CodeIgniter.](http://istocode.com/shared/ic-admin/) - * [Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation](http://mun.ee) - * [Nuntius: A PHP framework for bots](https://roysegall.github.io/nuntius-bot/) +- With a custom theme: + - [Crafty](https://swissquote.github.io/crafty) + - [Pixolution flow](https://docs.pixolution.org) \* [Soisy](https://doc.soisy.it/) + - [Vulkan Tutorial](https://vulkan-tutorial.com) \* [3Q](https://docs.3q.video/) + - [The Advanced RSS Environment](https://thearsse.com/manual/) +- With the default Theme + - [Daux.io](https://daux.io/) + _ [DoctrineWatcher](https://dsentker.github.io/WatcherDocumentation/) + _ [DrupalGap](http://docs.drupalgap.org/8/) + - [ICADMIN: An admin panel powered by CodeIgniter.](http://istocode.com/shared/ic-admin/) + - [Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation](http://mun.ee) + - [Nuntius: A PHP framework for bots](https://roysegall.github.io/nuntius-bot/) Do you use Daux.io? Send me a pull request or open an [issue](https://github.com/dauxio/daux.io/issues) and I will add you to the list. @@ -101,18 +97,18 @@ You must use underscores instead of spaces. Here are some example file names and **Good:** -* 01_Getting_Started.md = Getting Started -* API_Calls.md = API Calls -* 200_Something_Else-Cool.md = Something Else-Cool -* _5_Ways_to_Be_Happy.md = 5 Ways To Be Happy +- 01_Getting_Started.md = Getting Started +- API_Calls.md = API Calls +- 200_Something_Else-Cool.md = Something Else-Cool +- \_5_Ways_to_Be_Happy.md = 5 Ways To Be Happy **Bad:** -* File Name With Space.md = FAIL +- File Name With Space.md = FAIL ## Sorting -To sort your files and folders in a specific way, you can prefix them with a number and underscore, e.g. `/docs/01_Hello_World.md` and `/docs/05_Features.md` This will list *Hello World* before *Features*, overriding the default alpha-numeric sorting. The numbers will be stripped out of the navigation and urls. For the file `6 Ways to Get Rich`, you can use `/docs/_6_Ways_to_Get_Rich.md` +To sort your files and folders in a specific way, you can prefix them with a number and underscore, e.g. `/docs/01_Hello_World.md` and `/docs/05_Features.md` This will list _Hello World_ before _Features_, overriding the default alpha-numeric sorting. The numbers will be stripped out of the navigation and urls. For the file `6 Ways to Get Rich`, you can use `/docs/_6_Ways_to_Get_Rich.md` ## Landing page @@ -120,9 +116,9 @@ If you want to create a beautiful landing page for your project, simply create a ```json { - "title": "Daux.io", - "tagline": "The Easiest Way To Document Your Project", - "image": "app.png" + "title": "Daux.io", + "tagline": "The Easiest Way To Document Your Project", + "image": "app.png" } ``` @@ -138,33 +134,37 @@ To customize the look and feel of your documentation, you can create a `config.j The `config.json` file is a simple JSON object that you can use to change some of the basic settings of the documentation. ### Title + Change the title bar in the docs ```json { - "title": "Daux.io" + "title": "Daux.io" } ``` ### Themes + We have 4 built-in Bootstrap themes. To use one of the themes, just set the `theme` option to one of the following: -* daux-blue -* daux-green -* daux-navy -* daux-red +- daux-blue +- daux-green +- daux-navy +- daux-red ```json { - "html": { "theme": "daux-green" } + "html": { "theme": "daux-green" } } ``` ### More options + Many other options are available: -- [Global options](http://daux.io/Configuration/index) -- [HTML Options](http://daux.io/Configuration/Html_export) -- [Confluence options](http://daux.io/Configuration/Confluence_upload) + +- [Global options](http://daux.io/Configuration/index) +- [HTML Options](http://daux.io/Configuration/Html_export) +- [Confluence options](http://daux.io/Configuration/Confluence_upload) ## Running Remotely @@ -173,7 +173,7 @@ Copy the files from the repo to a web server that can run PHP 7.2.0 or newer. ## Running Locally There are several ways to run the docs locally. -The recommended way is to run `daux serve` which will execute PHP's embedded server. +The recommended way is to run `daux serve` which will execute PHP's embedded server. By default the server will run at: http://localhost:8085 @@ -193,8 +193,8 @@ daux --source=docs --destination=static If you have set up a local or remote IIS web site, you may need a `web.config` with: -* A rewrite configuration, for handling clean urls. -* A mime type handler for less files, if using a custom theme. +- A rewrite configuration, for handling clean urls. +- A mime type handler for less files, if using a custom theme. ### Clean URLs @@ -202,20 +202,32 @@ The `web.config` needs an entry for `` under ``: ```xml - - - - - - - - - - - - - - + + + + + + + + + + + + + + ``` @@ -223,7 +235,7 @@ To use clean URLs on IIS 6, you will need to use a custom URL rewrite module, su ## PHP Requirements -Daux.io is compatible with the [officially supported](https://www.php.net/supported-versions.php) PHP versions; 7.2.0 and up. +Daux.io is compatible with the [officially supported](https://www.php.net/supported-versions.php) PHP versions; 7.2.0 and up. ### Extensions diff --git a/docs/00_Getting_Started.md b/docs/00_Getting_Started.md index 3098d8e..82c0e89 100644 --- a/docs/00_Getting_Started.md +++ b/docs/00_Getting_Started.md @@ -6,49 +6,48 @@ ### For Authors -* [Auto Generated Navigation / Page sorting](01_Features/Navigation_and_Sorting.md) -* [Internal documentation links](01_Features/Internal_links.md) -* [CommonMark compliant](01_Features/CommonMark_compliant.md) -* [Auto created homepage/landing page](01_Features/Landing_page.md) -* [Multiple Output Formats](01_Features/Multiple_Output_Formats.md) -* [Multiple Languages Support](01_Features/Multilanguage.md) -* [No Build Step](01_Features/Live_mode.md) -* [Static Output Generation](01_Features/Static_Site_Generation.md) -* [Table of Contents](01_Features/Table_of_contents.md) +- [Auto Generated Navigation / Page sorting](01_Features/Navigation_and_Sorting.md) +- [Internal documentation links](01_Features/Internal_links.md) +- [CommonMark compliant](01_Features/CommonMark_compliant.md) +- [Auto created homepage/landing page](01_Features/Landing_page.md) +- [Multiple Output Formats](01_Features/Multiple_Output_Formats.md) +- [Multiple Languages Support](01_Features/Multilanguage.md) +- [No Build Step](01_Features/Live_mode.md) +- [Static Output Generation](01_Features/Static_Site_Generation.md) +- [Table of Contents](01_Features/Table_of_contents.md) ### For Developers -* [Auto Syntax Highlighting](01_Features/Auto_Syntax_Highlight.md) -* [Extend Daux.io with Processors](01_For_Developers/Creating_a_Processor.md) -* Full access to the internal API to create new pages programatically -* Work with pages metadata +- [Auto Syntax Highlighting](01_Features/Auto_Syntax_Highlight.md) +- [Extend Daux.io with Processors](01_For_Developers/Creating_a_Processor.md) +- Full access to the internal API to create new pages programatically +- Work with pages metadata ### For Marketing -* 100% Mobile Responsive -* 4 Built-In Themes or roll your own -* Functional, Flat Design Style -* Optional code float layout -* Shareable/Linkable SEO Friendly URLs -* Supports Google Analytics and Piwik Analytics +- 100% Mobile Responsive +- 4 Built-In Themes or roll your own +- Functional, Flat Design Style +- Optional code float layout +- Shareable/Linkable SEO Friendly URLs +- Supports Google Analytics and Piwik Analytics ## Demos This is a list of sites using Daux.io: -- With a custom theme: - * [Crafty](https://swissquote.github.io/crafty) - * [Pixolution flow](https://docs.pixolution.org) - * [Soisy](https://doc.soisy.it/) - * [Vulkan Tutorial](https://vulkan-tutorial.com) - * [3Q](https://docs.3q.video/) -- With the default Theme - * [Daux.io](https://daux.io/) - * [DoctrineWatcher](https://dsentker.github.io/WatcherDocumentation/) - * [DrupalGap](http://docs.drupalgap.org/8/) - * [ICADMIN: An admin panel powered by CodeIgniter.](http://istocode.com/shared/ic-admin/) - * [Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation](http://mun.ee) - * [Nuntius: A PHP framework for bots](https://roysegall.github.io/nuntius-bot/) +- With a custom theme: + - [Crafty](https://swissquote.github.io/crafty) + - [Pixolution flow](https://docs.pixolution.org) \* [Soisy](https://doc.soisy.it/) + - [Vulkan Tutorial](https://vulkan-tutorial.com) + - [3Q](https://docs.3q.video/) +- With the default Theme + - [Daux.io](https://daux.io/) + _ [DoctrineWatcher](https://dsentker.github.io/WatcherDocumentation/) + _ [DrupalGap](http://docs.drupalgap.org/8/) + - [ICADMIN: An admin panel powered by CodeIgniter.](http://istocode.com/shared/ic-admin/) + - [Munee: Standalone PHP 5.3 Asset Optimisation & Manipulation](http://mun.ee) + - [Nuntius: A PHP framework for bots](https://roysegall.github.io/nuntius-bot/) Do you use Daux.io? Send us a pull request or open an [issue](https://github.com/dauxio/daux.io/issues) and I will add you to the list. @@ -81,10 +80,10 @@ docker run --rm -it -w /build -v "$PWD":/build daux/daux.io daux Any parameter valid in the PHP version is valid in the Docker version - ### Writing pages Creating new pages is very easy: + 1. Create a markdown file (`*.md` or `*.markdown`) 2. Start writing @@ -98,14 +97,14 @@ You must use underscores instead of spaces. Here are some example file names and **Good:** -* 01_Getting_Started.md = Getting Started -* API_Calls.md = API Calls -* 200_Something_Else-Cool.md = Something Else-Cool -* _5_Ways_to_Be_Happy.md = 5 Ways To Be Happy +- 01_Getting_Started.md = Getting Started +- API_Calls.md = API Calls +- 200_Something_Else-Cool.md = Something Else-Cool +- \_5_Ways_to_Be_Happy.md = 5 Ways To Be Happy **Bad:** -* File Name With Space.md = FAIL +- File Name With Space.md = FAIL ### See your pages @@ -129,9 +128,9 @@ Upload your files to an apache / nginx server and see your documentation Daux.io is extendable and comes by default with three export formats: -- Export to HTML, same as the website, but can be hosted without PHP. -- Export all documentation in a single HTML page -- Upload to your Atlassian Confluence server. +- Export to HTML, same as the website, but can be hosted without PHP. +- Export all documentation in a single HTML page +- Upload to your Atlassian Confluence server. [See a detailed feature comparison matrix](01_Features/Multiple_Output_Formats.md) @@ -145,7 +144,7 @@ Now that you got the basics, you can also [see what you can configure](05_Config ## PHP Requirements -Daux.io is compatible with the [officially supported](https://www.php.net/supported-versions.php) PHP versions; 7.2.0 and up. +Daux.io is compatible with the [officially supported](https://www.php.net/supported-versions.php) PHP versions; 7.2.0 and up. ### Extensions @@ -153,7 +152,6 @@ Daux.io needs the following PHP extensions to work : `php-mbstring` and `php-xml If you encounter an error similar to `utf8_decode() not found` this means that you're missing the `php-xml` package. - ## Support If you need help using Daux.io, or have found a bug, please create an issue on the GitHub repo. diff --git a/docs/01_Features/CommonMark_compliant.md b/docs/01_Features/CommonMark_compliant.md index 228efa7..9075e95 100644 --- a/docs/01_Features/CommonMark_compliant.md +++ b/docs/01_Features/CommonMark_compliant.md @@ -1,17 +1,14 @@ - As we support CommonMark, a broad range of markdown features is available to you. Many of the features shown below were known as Github Flavored Markdown. - -We all like making lists ------------------------- +## We all like making lists The above header should be an H2 tag. Now, for a list of fruits: -* Red Apples -* Purple Grapes -* Green Kiwifruits +- Red Apples +- Purple Grapes +- Green Kiwifruits Let's get crazy: @@ -27,18 +24,17 @@ Let's get crazy: What about some code **in** a list? That's insane, right? -1. In Ruby you can map like this: +1. In Ruby you can map like this: ['a', 'b'].map { |x| x.uppercase } -2. In Rails, you can do a shortcut: +2. In Rails, you can do a shortcut: ['a', 'b'].map(&:uppercase) Some people seem to like definition lists -I am a robot ------------- +## I am a robot Maybe you want to print `robot` to the console 1000 times. Why not? @@ -54,8 +50,7 @@ How about we throw some angle braces and ampersands in there? © 2004 Foo Corporation -Set in stone ------------- +## Set in stone Preformatted blocks are useful for ASCII art: @@ -73,8 +68,7 @@ Preformatted blocks are useful for ASCII art: ___|_____________ -Playing the blame game ----------------------- +## Playing the blame game If you need to blame someone, the best way to do so is by quoting them: @@ -92,26 +86,23 @@ Or perhaps someone a little less eloquent: > just put me under the spot here, and maybe I'm not as quick on my feet > as I should be in coming up with one. -Table for two -------------- +## Table for two -ID | Name | Rank ----|:------:|------: -1 | Tom Preston-Werner | Awesome -2 | Albert Einstein | Nearly as awesome +| ID | Name | Rank | +| --- | :----------------: | ----------------: | +| 1 | Tom Preston-Werner | Awesome | +| 2 | Albert Einstein | Nearly as awesome | -Crazy linking action --------------------- +## Crazy linking action -I get 10 times more traffic from [Google] [1] than from -[Yahoo] [2] or [MSN] [3]. +I get 10 times more traffic from [Google][1] than from +[Yahoo][2] or [MSN][3]. - [1]: http://google.com/ "Google" - [2]: http://search.yahoo.com/ "Yahoo Search" - [3]: http://search.msn.com/ "MSN Search" +[1]: http://google.com/ "Google" +[2]: http://search.yahoo.com/ "Yahoo Search" +[3]: http://search.msn.com/ "MSN Search" -Images ------- +## Images Here's an image. @@ -119,4 +110,4 @@ Here's an image. Note: to use images on a landing page (index.md), prefix the image URL with the name of the directory it appears in, omitting the numerical prefix used to order the sections. For example in this section, to display this image on the landing page (index.md), the URL for the image would be "Features/sampleimage.png" to display the same image. -*View the [source of this content](https://github.com/dauxio/daux.io/blob/master/docs/01_Features/CommonMark_compliant.md).* +_View the [source of this content](https://github.com/dauxio/daux.io/blob/master/docs/01_Features/CommonMark_compliant.md)._ diff --git a/docs/01_Features/Edit_on_GitHub_links.md b/docs/01_Features/Edit_on_GitHub_links.md index de229ab..76af370 100644 --- a/docs/01_Features/Edit_on_GitHub_links.md +++ b/docs/01_Features/Edit_on_GitHub_links.md @@ -1,4 +1,3 @@ - As you can see on the top of this page, you can add "Edit on Github" links to your pages, this feature can be enabled with a single parameter. The value has to be the path to the root of your documentation folder in your repository. @@ -7,12 +6,11 @@ In the value you see below, Daux's documentation is in the `docs` folder in the Daux.io will handle the rest - ```json { - "html": { - "edit_on_github": "dauxio/daux.io/blob/master/docs" - } + "html": { + "edit_on_github": "dauxio/daux.io/blob/master/docs" + } } ``` @@ -22,14 +20,13 @@ While GitHub is the most popular, it isn't the only, collaborative VCS out there As long as you can refer your files by a URL, you can create an edit link for your VCS with the following configuration: - ```json { - "html": { - "edit_on": { - "name": "Bitbucket", - "basepath": "https://bitbucket.org/dauxio/daux.io/src/master/docs" + "html": { + "edit_on": { + "name": "Bitbucket", + "basepath": "https://bitbucket.org/dauxio/daux.io/src/master/docs" + } } - } } ``` diff --git a/docs/01_Features/Landing_page.md b/docs/01_Features/Landing_page.md index ae73dc8..ba37806 100644 --- a/docs/01_Features/Landing_page.md +++ b/docs/01_Features/Landing_page.md @@ -2,9 +2,9 @@ If you want to create a beautiful landing page for your project, create a `_inde ```json { - "title": "Daux.io", - "tagline": "The Easiest Way To Document Your Project", - "image": "app.png" + "title": "Daux.io", + "tagline": "The Easiest Way To Document Your Project", + "image": "app.png" } ``` @@ -14,8 +14,8 @@ To disable the automatic landing page, you can set `auto_landing` to false in th ```json { - "html": { - "auto_landing": false - } + "html": { + "auto_landing": false + } } ``` diff --git a/docs/01_Features/Live_mode.md b/docs/01_Features/Live_mode.md index 864b72f..b095426 100644 --- a/docs/01_Features/Live_mode.md +++ b/docs/01_Features/Live_mode.md @@ -10,7 +10,6 @@ The easiest is to use PHP's built-in server. For that i've included a short command, run `daux serve` in the projects folder to start the local web server. By default the server will run at: http://localhost:8085 - ## Running Remotely ### Clean URLs configuration @@ -20,9 +19,9 @@ To enable the same, set the toggle in the `config.json` file in the `/docs` fold ```json { - "live": { - "clean_urls": true - } + "live": { + "clean_urls": true + } } ``` @@ -70,8 +69,8 @@ server { If you have set up a local or remote IIS web site, you may need a `web.config` with: -* A rewrite configuration, for handling clean urls. -* A mime type handler for less files, if using a custom theme. +- A rewrite configuration, for handling clean urls. +- A mime type handler for less files, if using a custom theme. ### Clean URLs @@ -79,20 +78,32 @@ The `web.config` needs an entry for `` under ``: ```xml - - - - - - - - - - - - - - + + + + + + + + + + + + + + ``` @@ -114,4 +125,4 @@ ENTRYPOINT [ "php", "-S", "0.0.0.0:80", "index.php" ] When you add this to a `Dockerfile` and run `docker build --name my-daux-doc .` and then `docker --rm run -p 8000:80 my-daux-doc` -You can access your documentation at `localhost:8000` \ No newline at end of file +You can access your documentation at `localhost:8000` diff --git a/docs/01_Features/Multilanguage.md b/docs/01_Features/Multilanguage.md index 4017c14..e409299 100644 --- a/docs/01_Features/Multilanguage.md +++ b/docs/01_Features/Multilanguage.md @@ -4,11 +4,12 @@ Add this to your config.json : ```json { - "languages": { "en": "English", "de": "German" } + "languages": { "en": "English", "de": "German" } } ``` You will the need separate directories for each language in `docs/` folder. + ``` ├── docs/ │ ├── _index.md diff --git a/docs/01_Features/Multiple_Output_Formats.md b/docs/01_Features/Multiple_Output_Formats.md index 5835ddf..c684c39 100644 --- a/docs/01_Features/Multiple_Output_Formats.md +++ b/docs/01_Features/Multiple_Output_Formats.md @@ -1,21 +1,21 @@ Daux.io is extendable and comes by default with three export formats: -- Export to HTML -- Export all documentation in a single HTML page -- Upload to your Atlassian Confluence server +- Export to HTML +- Export all documentation in a single HTML page +- Upload to your Atlassian Confluence server ## Feature Matrix -Feature | HTML | Single Page HTML | Confluence ---------------:|:----:|:----------------:|:----------: -Multilanguage | √ | X (Planned) | X -Landing Pages | √ | X | X -Index Pages | √ | √ | √ -Internal Links | √ | X (Planned) | √ -Code Highlight | √ | X (Planned) | √ (Using macros) -Live Mode | √ | X | X -Pages Ordering | √ | √ | X (API Limitation) -Google / Piwik analytics | √ | √ | √ (Configured on Conflence) +| Feature | HTML | Single Page HTML | Confluence | +| -----------------------: | :--: | :--------------: | :-------------------------: | +| Multilanguage | √ | X (Planned) | X | +| Landing Pages | √ | X | X | +| Index Pages | √ | √ | √ | +| Internal Links | √ | X (Planned) | √ | +| Code Highlight | √ | X (Planned) | √ (Using macros) | +| Live Mode | √ | X | X | +| Pages Ordering | √ | √ | X (API Limitation) | +| Google / Piwik analytics | √ | √ | √ (Configured on Conflence) | ## Confluence Example diff --git a/docs/01_Features/Navigation_and_Sorting.md b/docs/01_Features/Navigation_and_Sorting.md index 63b0a69..b1f4366 100644 --- a/docs/01_Features/Navigation_and_Sorting.md +++ b/docs/01_Features/Navigation_and_Sorting.md @@ -1,4 +1,3 @@ - ## Navigation The navigation is generated automatically with all pages that end with `.md` or `.markdown` @@ -12,21 +11,21 @@ For example, `/docs/02_Examples` has a landing page for that section since there ## Sorting To sort your files and folders in a specific way, you can prefix them with a number and underscore, e.g. `/docs/01_Hello_World.md` and `/docs/05_Features.md`. -This will list *Hello World* before *Features*, overriding the default alpha-numeric sorting. +This will list _Hello World_ before _Features_, overriding the default alpha-numeric sorting. The numbers will be stripped out of the navigation and urls. For the file `6 Ways to Get Rich`, you can use `/docs/_6_Ways_to_Get_Rich.md` You might also wish to stick certain links to the bottom of a page. -You can do so by prefixing the file name with a '-', e.g. a new file `/docs/-Contact_Us.md` will always appear at the bottom of the current list. +You can do so by prefixing the file name with a '-', e.g. a new file `/docs/-Contact_Us.md` will always appear at the bottom of the current list. Weights can also be added to further sort the bottom entries. e.g. `/docs/-01_Coming.md` will appear before `/docs/-02_Soon.md` but both will only appear after all positive or non-weighted files. It works the same for files prefixed with `+`. Page order priorities are like this: -- `+` in front of the filename and numbers in front -- `+` in front of the filename -- The index page -- Numbers in the front -- Pages without prefix -- `-` in front of the filename and numbers in front -- `-` in front of the filename +- `+` in front of the filename and numbers in front +- `+` in front of the filename +- The index page +- Numbers in the front +- Pages without prefix +- `-` in front of the filename and numbers in front +- `-` in front of the filename diff --git a/docs/01_Features/Search.md b/docs/01_Features/Search.md index c264fa1..27428af 100644 --- a/docs/01_Features/Search.md +++ b/docs/01_Features/Search.md @@ -6,8 +6,8 @@ To enable the generated search, you can set `search` to true in the `html` secti ```json { - "html": { - "search": true - } + "html": { + "search": true + } } ``` diff --git a/docs/01_Features/Static_Site_Generation.md b/docs/01_Features/Static_Site_Generation.md index dc1e3e4..e1a3c56 100644 --- a/docs/01_Features/Static_Site_Generation.md +++ b/docs/01_Features/Static_Site_Generation.md @@ -1,9 +1,8 @@ +If you don't want to serve the live version of your site, you can also generate files, these can be one of the three supported formats : -If you don't want to serve the live version of your site, you can also generate files, these can be one of the three supported formats : - -- HTML output -- Single page HTML output -- Atlassian Confluence upload +- HTML output +- Single page HTML output +- Atlassian Confluence upload Generating a complete set of pages, with navigation @@ -13,7 +12,7 @@ daux --destination=[Output Directory Relative Direction] ## Options -For more options, run +For more options, run ```bash daux generate --help @@ -32,7 +31,7 @@ daux --format=html ### Specify a processor -A processor can be specified through the `--processor` option, this should be the name of a class inside the `Todaymade\Daux\Extension` namespace. +A processor can be specified through the `--processor` option, this should be the name of a class inside the `Todaymade\Daux\Extension` namespace. By running : diff --git a/docs/01_Features/Table_of_contents.md b/docs/01_Features/Table_of_contents.md index c9c6a8c..fbaceb4 100644 --- a/docs/01_Features/Table_of_contents.md +++ b/docs/01_Features/Table_of_contents.md @@ -18,10 +18,8 @@ You can enable this feature in your configuration ```json { - "html": { - "auto_toc": true - } + "html": { + "auto_toc": true + } } ``` - - diff --git a/docs/02_Examples/05_Code_Highlighting.md b/docs/02_Examples/05_Code_Highlighting.md index 0d0807b..3c96a77 100644 --- a/docs/02_Examples/05_Code_Highlighting.md +++ b/docs/02_Examples/05_Code_Highlighting.md @@ -7,8 +7,9 @@ Highlight.js is a powerful but heavy library, since we don't know which language The good news is; if you use a fenced code block (` ``` `) with the language defined, the rendering is done on server side and entirely skips loading Highlight.js on the page. While still having the same end-result on your code. +[TOC] -**Python** +## Python ```python @requires_authorization @@ -24,2077 +25,2072 @@ class SomeClass:
pass ... prompt''' ``` -**Python's profiler output** - - 261917242 function calls in 686.251 CPU seconds - - ncalls tottime filename:lineno(function) - 152824 513.894 {method 'sort' of 'list' objects} - 129590630 83.894 rrule.py:842(__cmp__) - 129590630 82.439 {cmp} - 153900 1.296 rrule.py:399(_iter) - 304393/151570 0.963 rrule.py:102(_iter_cached) - - -**Ruby** - - class A < B; def self.create(object = User) object end end - class Zebra; def inspect; "X#{2 + self.object_id}" end end - - module ABC::DEF - include Comparable - - # @param test - # @return [String] nothing - def foo(test) - Thread.new do |blockvar| - ABC::DEF.reverse(:a_symbol, :'a symbol', :<=>, 'test' + test) - end.join - end - - def [](index) self[index] end - def ==(other) other == self end - end - - anIdentifier = an_identifier - Constant = 1 - render action: :new - -**Haml** - - !!! XML - %html - %body - %h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js - /html comment - -# ignore this line - %ul(style='margin: 0') - -items.each do |i| - %i= i - = variable - =variable2 - ~ variable3 - ~variable4 - The current year is #{DataTime.now.year}. - -**Perl** - - # loads object - sub load - { - my $flds = $c->db_load($id,@_) || do { - Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef - }; - my $o = $c->_perl_new(); - $id12 = $id / 24 / 3600; - $o->{'ID'} = $id12 + 123; - #$o->{'SHCUT'} = $flds->{'SHCUT'}; - my $p = $o->props; - my $vt; - $string =~ m/^sought_text$/; - $items = split //, 'abc'; - for my $key (keys %$p) - { - if(${$vt.'::property'}) { - $o->{$key . '_real'} = $flds->{$key}; - tie $o->{$key}, 'CMSBuilder::Property', $o, $key; - } - } - $o->save if delete $o->{'_save_after_load'}; - return $o; - } - - =head1 NAME - POD till the end of file - -**PHP** - - require_once 'Zend/Uri/Http.php'; - - abstract class URI extends BaseURI - { - - /** - * Returns a URI - * - * @return URI - */ - static public function _factory($stats = array(), $uri = 'http') - { - $uri = explode(':', $uri, 0b10); - $schemeSpecific = isset($uri[1]) ? $uri[1] : ''; - $desc = 'Multi - line description'; - - // Security check - if (!ctype_alnum($scheme)) { - throw new Zend_Uri_Exception('Illegal scheme'); - } - - return [ - 'uri' => $uri, - 'value' => null, - ]; - } - } - - __halt_compiler () ; datahere - datahere - datahere */ - datahere - -**Scala** - - object abstractTypes extends Application { - abstract class SeqBuffer { - type T; val element: Seq[T]; def length = element.length - } - } - - /** Turn command line arguments to uppercase */ - object Main { - def main(args: Array[String]) { - val res = for (a <- args) yield a.toUpperCase - println("Arguments: " + res.toString) - } - } - - /** Maps are easy to use in Scala. */ - object Maps { - val colors = Map("red" -> 0xFF0000, - "turquoise" -> 0x00FFFF, - "black" -> 0x000000, - "orange" -> 0xFF8040, - "brown" -> 0x804000) - def main(args: Array[String]) { - for (name <- args) println( - colors.get(name) match { - case Some(code) => - name + " has code: " + code - case None => - "Unknown color: " + name - } - ) - } - } - -**Go** - - package main - - import ( - "fmt" - "rand" - "os" - ) - - const ( - Sunday = iota - Partyday - numberOfDays // this constant is not exported - ) - - type Foo interface { - FooFunc(int, float32) (complex128, []int) - } - - // simple comment - type Bar struct { - os.File /* multi - line - comment */ - - PublicData chan int - } - - func main() { - ch := make(chan int) - ch <- 1 - x, ok := <- ch - ok = true - x = nil - float_var := 1.0e10 - defer fmt.Println('\'') - defer fmt.Println(`exitting now\`) - var fv1 float64 = 0.75 - go println(len("hello world!")) - return - } - -**XML** - - - - Ok - - magical. - ]]> - - - - -**HTML (with inline css and javascript)** - - - Title - - - - - - -

Title

- - - -**Lasso** - - 10 - ORDER BY `Name` LIMIT 30'); - Inline: -Username=$DBuser, -Password=$DBpass, -Database=$DBname, -sql=#query; - var("class.name" = (found_count != 0 ? `subtotal` | `nonefound`)); - records; - output: ?>[loop_count]
[found_count]
- [noprocess] causes [delimiters] to be skipped until the next [/noprocess] - { - local(result = #value->append(#other->asString)) - return #result - } - /**! descriptive text */ - define person => type { - data name::string, protected nickname - data birthdate::date - data private ssn = null - public showName() => return .'name' - protected fullName() => '"' + .nickname + '"' + .'name' - public ssnListed => .ssn ? true | false - } - define person->name=(value) => { - .'name' = #value - return self->'name' - } - // query expression - with n in array(-1, 0xABCD, 3.14159e14) - let swapped = pair(#n->second, #n->first) - group #swapped by #n->first into t - let key = #t->key - order by #key - select pair(#key, #t) - do {^ - #n->upperCase - ^} - ?> - -**Markdown** - - # hello world - - you can write text [with links](http://example.com). - - * one _thing_ has *em*phasis - * two __things__ are **bold** +## Python's profiler output + + 261917242 function calls in 686.251 CPU seconds + + ncalls tottime filename:lineno(function) + 152824 513.894 {method 'sort' of 'list' objects} + 129590630 83.894 rrule.py:842(__cmp__) + 129590630 82.439 {cmp} + 153900 1.296 rrule.py:399(_iter) + 304393/151570 0.963 rrule.py:102(_iter_cached) + +## Ruby + + class A < B; def self.create(object = User) object end end + class Zebra; def inspect; "X#{2 + self.object_id}" end end + + module ABC::DEF + include Comparable + + # @param test + # @return [String] nothing + def foo(test) + Thread.new do |blockvar| + ABC::DEF.reverse(:a_symbol, :'a symbol', :<=>, 'test' + test) + end.join + end + + def [](index) self[index] end + def ==(other) other == self end + end + + anIdentifier = an_identifier + Constant = 1 + render action: :new + +## Haml + + !!! XML + %html + %body + %h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js + /html comment + -# ignore this line + %ul(style='margin: 0') + -items.each do |i| + %i= i + = variable + =variable2 + ~ variable3 + ~variable4 + The current year is #{DataTime.now.year}. + +## Perl + + # loads object + sub load + { + my $flds = $c->db_load($id,@_) || do { + Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef + }; + my $o = $c->_perl_new(); + $id12 = $id / 24 / 3600; + $o->{'ID'} = $id12 + 123; + #$o->{'SHCUT'} = $flds->{'SHCUT'}; + my $p = $o->props; + my $vt; + $string =~ m/^sought_text$/; + $items = split //, 'abc'; + for my $key (keys %$p) + { + if(${$vt.'::property'}) { + $o->{$key . '_real'} = $flds->{$key}; + tie $o->{$key}, 'CMSBuilder::Property', $o, $key; + } + } + $o->save if delete $o->{'_save_after_load'}; + return $o; + } + + =head1 NAME + POD till the end of file + +## PHP + + require_once 'Zend/Uri/Http.php'; + + abstract class URI extends BaseURI + { + + /** + * Returns a URI + * + * @return URI + */ + static public function _factory($stats = array(), $uri = 'http') + { + $uri = explode(':', $uri, 0b10); + $schemeSpecific = isset($uri[1]) ? $uri[1] : ''; + $desc = 'Multi + line description'; + + // Security check + if (!ctype_alnum($scheme)) { + throw new Zend_Uri_Exception('Illegal scheme'); + } + + return [ + 'uri' => $uri, + 'value' => null, + ]; + } + } + + __halt_compiler () ; datahere + datahere + datahere */ + datahere + +## Scala + + object abstractTypes extends Application { + abstract class SeqBuffer { + type T; val element: Seq[T]; def length = element.length + } + } + + /** Turn command line arguments to uppercase */ + object Main { + def main(args: Array[String]) { + val res = for (a <- args) yield a.toUpperCase + println("Arguments: " + res.toString) + } + } + + /** Maps are easy to use in Scala. */ + object Maps { + val colors = Map("red" -> 0xFF0000, + "turquoise" -> 0x00FFFF, + "black" -> 0x000000, + "orange" -> 0xFF8040, + "brown" -> 0x804000) + def main(args: Array[String]) { + for (name <- args) println( + colors.get(name) match { + case Some(code) => + name + " has code: " + code + case None => + "Unknown color: " + name + } + ) + } + } + +## Go + + package main + + import ( + "fmt" + "rand" + "os" + ) + + const ( + Sunday = iota + Partyday + numberOfDays // this constant is not exported + ) + + type Foo interface { + FooFunc(int, float32) (complex128, []int) + } + + // simple comment + type Bar struct { + os.File /* multi + line + comment */ + + PublicData chan int + } + + func main() { + ch := make(chan int) + ch <- 1 + x, ok := <- ch + ok = true + x = nil + float_var := 1.0e10 + defer fmt.Println('\'') + defer fmt.Println(`exitting now\`) + var fv1 float64 = 0.75 + go println(len("hello world!")) + return + } + +## XML + + + + Ok + + magical. + ]]> +
+ + +## HTML (with inline css and javascript) + + + Title + + + + + + +

Title

+ + + +## Lasso + + 10 + ORDER BY `Name` LIMIT 30'); + Inline: -Username=$DBuser, -Password=$DBpass, -Database=$DBname, -sql=#query; + var("class.name" = (found_count != 0 ? `subtotal` | `nonefound`)); + records; + output: ?>[loop_count]
[found_count]
+ [noprocess] causes [delimiters] to be skipped until the next [/noprocess] + { + local(result = #value->append(#other->asString)) + return #result + } + /**! descriptive text */ + define person => type { + data name::string, protected nickname + data birthdate::date + data private ssn = null + public showName() => return .'name' + protected fullName() => '"' + .nickname + '"' + .'name' + public ssnListed => .ssn ? true | false + } + define person->name=(value) => { + .'name' = #value + return self->'name' + } + // query expression + with n in array(-1, 0xABCD, 3.14159e14) + let swapped = pair(#n->second, #n->first) + group #swapped by #n->first into t + let key = #t->key + order by #key + select pair(#key, #t) + do {^ + #n->upperCase + ^} + ?> + +## Markdown + + # hello world + + you can write text [with links](http://example.com). + + * one _thing_ has *em*phasis + * two __things__ are **bold** + + --- + + hello world + =========== + + + + > markdown is so cool - --- + so are code segments - hello world - =========== + 1. one thing (yeah!) + 2. two thing `i can write code`, and `more` wipee! - +## AsciiDoc - > markdown is so cool + Hello, World! + ============ + Author Name, - so are code segments + you can write text http://example.com[with links], optionally + using an explicit link:http://example.com[link prefix]. - 1. one thing (yeah!) - 2. two thing `i can write code`, and `more` wipee! + * single quotes around a phrase place 'emphasis' + ** alternatively, you can put underlines around a phrase to add _emphasis_ + * astericks around a phrase make the text *bold* + * pluses around a phrase make it +monospaced+ -**AsciiDoc** + - escape characters are supported + - you can escape a quote inside emphasized text like 'here\'s johnny!' - Hello, World! - ============ - Author Name, + term:: definition + another term:: another definition - you can write text http://example.com[with links], optionally - using an explicit link:http://example.com[link prefix]. + // this is just a comment + + Let's make a break. + + ''' - * single quotes around a phrase place 'emphasis' - ** alternatively, you can put underlines around a phrase to add _emphasis_ - * astericks around a phrase make the text *bold* - * pluses around a phrase make it +monospaced+ + //// + we'll be right with you - - escape characters are supported - - you can escape a quote inside emphasized text like 'here\'s johnny!' + after this brief interruption. + //// - term:: definition - another term:: another definition + == We're back! - // this is just a comment - - Let's make a break. - - ''' + Want to see a image::images/tiger.png[Tiger]? - //// - we'll be right with you + .Nested highlighting + ++++ + + ++++ - after this brief interruption. - //// + ____ + asciidoc is so powerful. + ____ - == We're back! + another quote: - Want to see a image::images/tiger.png[Tiger]? + [quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes] + ____ + When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth. + ____ - .Nested highlighting - ++++ - - ++++ + Getting Literal + --------------- - ____ - asciidoc is so powerful. - ____ + want to get literal? prefix a line with a space. - another quote: + .... + I'll join that party, too. + .... - [quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes] - ____ - When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth. - ____ + . one thing (yeah!) + . two thing `i can write code`, and `more` wipee! - Getting Literal - --------------- + NOTE: AsciiDoc is quite cool, you should try it. - want to get literal? prefix a line with a space. +## Django templates - .... - I'll join that party, too. - .... + {% if articles|length %} + {% for article in articles %} - . one thing (yeah!) - . two thing `i can write code`, and `more` wipee! + {# Striped table #} + + {{ article|default:"Hi... "|escape }} + {{ article.date|date:"d.m.Y" }} + - NOTE: AsciiDoc is quite cool, you should try it. + {% endfor %} + {% endif %} -**Django templates** + {% comment %} + Comments may be long and + multiline. + {% endcomment %} - {% if articles|length %} - {% for article in articles %} +## Handlebars - {# Striped table #} - - {{ article|default:"Hi... "|escape }} - {{ article.date|date:"d.m.Y" }} - +

Hours

- {% endfor %} - {% endif %} +
    + {{#each content.users}} +
  • {{firstName}}
  • + {{/each}} +
- {% comment %} - Comments may be long and - multiline. - {% endcomment %} +## CSS + + @media screen and (-webkit-min-device-pixel-ratio: 0) { + body:first-of-type pre::after { + content: 'highlight: ' attr(class); + } + body { + background: linear-gradient(45deg, blue, red); + } + } + + @import url('print.css'); + @page:right { + margin: 1cm 2cm 1.3cm 4cm; + } + + @font-face { + font-family: Chunkfive; src: url('Chunkfive.otf'); + } + + div.text, + #content, + li[lang=ru] { + font: Tahoma, Chunkfive, sans-serif; + background: url('hatch.png') /* wtf? */; color: #F0F0F0 !important; + width: 100%; + } + +## SCSS + + @import "compass/reset"; + + // variables + $colorGreen: #008000; + $colorGreenDark: darken($colorGreen, 10); + + @mixin container { + max-width: 980px; + } + + // mixins with parameters + @mixin button($color:green) { + @if ($color == green) { + background-color: #008000; + } + @else if ($color == red) { + background-color: #B22222; + } + } + + button { + @include button(red); + } + + div, + .navbar, + #header, + input[type="input"] { + font-family: "Helvetica Neue", Arial, sans-serif; + width: auto; + margin: 0 auto; + display: block; + } + + .row-12 > [class*="spans"] { + border-left: 1px solid #B5C583; + } + + // nested definitions + ul { + width: 100%; + padding: { + left: 5px; right: 5px; + } + li { + float: left; margin-right: 10px; + .home { + background: url('http://placehold.it/20') scroll no-repeat 0 0; + } + } + } + + .banner { + @extend .container; + } + + a { + color: $colorGreen; + &:hover { color: $colorGreenDark; } + &:visited { color: #c458cb; } + } + + @for $i from 1 through 5 { + .span#{$i} { + width: 20px*$i; + } + } + + @mixin mobile { + @media screen and (max-width : 600px) { + @content; + } + } + +## JSON + + [ + { + "title": "apples", + "count": [12000, 20000], + "description": {"text": "...", "sensitive": false} + }, + { + "title": "oranges", + "count": [17500, null], + "description": {"text": "...", "sensitive": false} + } + ] + +## JavaScript + + function $initHighlight(block, flags) { + try { + if (block.className.search(/\bno\-highlight\b/) != -1) + return processBlock(block, true, 0x0F) + ' class=""'; + } catch (e) { + /* handle exception */ + + var e4x = +
Example +

1234

; + } + for (var i = 0 / 2; i < classes.length; i++) { // "0 / 2" should not be parsed as regexp + if (checkCondition(classes[i]) === undefined) + return /\d+[\s/]/g; + } + } + +## CoffeeScript + + # Divisions + x = 6/foo/i + x = 6 /foo + x = 6 / foo + x = 6 /foo * 2/gm + x = f /foo + x = f / foo / gm + x = f /foo * 2/6 + + # Regexps + x = f /6 * 2/ - 3 + x = f /foo * 2/gm + x = if true then /\n/ else /[.,]+/ + + grade = (student, period=(if b? then 7 else 6), messages={"A": "Excellent"}) -> + if student.excellentWork + "A+" + else if student.okayStuff + if student.triedHard then "B" else "B-" + else + "C" + + square = (x) -> x * x + + two = -> 2 + + math = + root: Math.sqrt + square: square + cube: (x) -> x * square x + + race = (winner, runners...) -> + print winner, runners + + class Animal extends Being + constructor: (@name) -> + + move: (meters) -> + alert @name + " moved #{meters}m." + + hi = `function() { + return [document.title, "Hello JavaScript"].join(": "); + }` + + heredoc = """ + CoffeeScript subst test #{ 010 + 0xf / 0b10 + "nested string #{ /\n/ }"} + """ + + ### + CoffeeScript Compiler v1.2.0 + Released under the MIT License + ### + + OPERATOR = /// ^ ( + ?: [-=]> # function + ) /// + +## ActionScript + + package org.example.dummy { + import org.dummy.*; + + /*define package inline interface*/ + public interface IFooBarzable { + public function foo(... pairs):Array; + } + + public class FooBar implements IFooBarzable { + static private var cnt:uint = 0; + private var bar:String; + + //constructor + public function TestBar(bar:String):void { + bar = bar; + ++cnt; + } + + public function foo(... pairs):Array { + pairs.push(bar); + return pairs; + } + } + } + +## VB.NET + + Import System + Import System.IO + #Const DEBUG = True + + Namespace Highlighter.Test + ''' This is an example class. + Public Class Program + Protected Shared hello As Integer = 3 + Private Const ABC As Boolean = False + + #Region "Code" + ' Cheers! + _ + Public Shared Sub Main(ByVal args() As String, ParamArray arr As Object) Handles Form1.Click + On Error Resume Next + If ABC Then + While ABC : Console.WriteLine() : End While + For i As Long = 0 To 1000 Step 123 + Try + System.Windows.Forms.MessageBox.Show(CInt("1").ToString()) + Catch ex As Exception ' What are you doing? Well... + Dim exp = CType(ex, IOException) + REM ORZ + Return + End Try + Next + Else + Dim l As New System.Collections.List() + SyncLock l + If TypeOf l Is Decimal And l IsNot Nothing Then + RemoveHandler button1.Paint, delegate + End If + Dim d = New System.Threading.Thread(AddressOf ThreadProc) + Dim a = New Action(Sub(x, y) x + y) + Static u = From x As String In l Select x.Substring(2, 4) Where x.Length > 0 + End SyncLock + Do : Laugh() : Loop Until hello = 4 + End If + End Sub + #End Region + End Class + End Namespace + +## HTTP + + POST /task?id=1 HTTP/1.1 + Host: example.org + Content-Type: application/json; charset=utf-8 + Content-Length: 19 + + {"status": "ok", "extended": true} + +## Lua + + --[[ + Simple signal/slot implementation + ]] + local signal_mt = { + __index = { + register = table.insert + } + } + function signal_mt.__index:emit(... --[[ Comment in params ]]) + for _, slot in ipairs(self) do + slot(self, ...) + end + end + local function create_signal() + return setmetatable({}, signal_mt) + end + + -- Signal test + local signal = create_signal() + signal:register(function(signal, ...) + print(...) + end) + signal:emit('Answer to Life, the Universe, and Everything:', 42) + + --[==[ [=[ [[ + Nested ]] + multi-line ]=] + comment ]==] + [==[ Nested + [=[ multi-line + [[ string + ]] ]=] ]==] + +## AppleScript + + repeat 5 times + if foo is greater than bar then + display dialog "Hello there" + else + beep + end if + end repeat + + (* comment (*nested comment*) *) + on do_something(s, y) + return {s + pi, y mod 4} + end do_something + + do shell script "/bin/echo 'hello'" + +## Delphi + + TList=Class(TObject) + Private + Some: String; + Public + Procedure Inside; // Suxx + End;{TList} + + Procedure CopyFile(InFileName,var OutFileName:String); + Const + BufSize=4096; (* Huh? *) + Var + InFile,OutFile:TStream; + Buffer:Array[1..BufSize] Of Byte; + ReadBufSize:Integer; + Begin + InFile:=Nil; + OutFile:=Nil; + Try + InFile:=TFileStream.Create(InFileName,fmOpenRead); + OutFile:=TFileStream.Create(OutFileName,fmCreate); + Repeat + ReadBufSize:=InFile.Read(Buffer,BufSize); + OutFile.Write(Buffer,ReadBufSize); + Until ReadBufSize<>BufSize; + Log('File '''+InFileName+''' copied'#13#10); + Finally + InFile.Free; + OutFile.Free; + End;{Try} + End;{CopyFile} + +## Java + + /** + * @author John Smith + * @version 1.0 + */ + package l2f.gameserver.model; + + import java.util.ArrayList; + + public abstract class L2Character extends L2Object { + public static final Short ABNORMAL_EFFECT_BLEEDING = 0x0001; // not sure + + public void moveTo(int x, int y, int z) { + _ai = null; + _log.warning("Should not be called"); + if (1 > 5) { + return; + } + } + + /** Task of AI notification */ + @SuppressWarnings( { "nls", "unqualified-field-access", "boxing" }) + public class NotifyAITask implements Runnable { + private final CtrlEvent _evt; + + public void run() { + try { + getAI().notifyEvent(_evt, null, null); + } catch (Throwable t) { + t.printStackTrace(); + } + } + } + } + +## C++ + + #include + + int main(int argc, char *argv[]) { + + /* An annoying "Hello World" example */ + for (auto i = 0; i < 0xFFFF; i++) + cout << "Hello, World!" << endl; + + char c = '\n'; + unordered_map > m; + m["key"] = "\\\\"; // this is an error + + return -2e3 + 12l; + } + +## Objective C + + #import + #import "Dependency.h" + + @protocol WorldDataSource + @optional + - (NSString*)worldName; + @required + - (BOOL)allowsToLive; + @end + + @interface Test : NSObject { + NSString *_greeting; + } + + @property (nonatomic, readonly) NSString *greeting; + - (IBAction) show; + @end + + @implementation Test + + @synthesize test=_test; + + + (id) test { + return [self testWithGreeting:@"Hello, world!\nFoo bar!"]; + } + + + (id) testWithGreeting:(NSString*)greeting { + return [[[self alloc] initWithGreeting:greeting] autorelease]; + } + + - (id) initWithGreeting:(NSString*)greeting { + if ( (self = [super init]) ) { + _greeting = [greeting retain]; + } + return self; + } + + - (void) dealloc { + [_greeting release]; + [super dealloc]; + } + + @end + +## Vala + + using DBus; + + namespace Test { + class Foo : Object { + public signal void some_event (); // definition of the signal + public void method () { + some_event (); // emitting the signal (callbacks get invoked) + } + } + } + + /* defining a class */ + class Track : GLib.Object, Test.Foo { /* subclassing 'GLib.Object' */ + public double mass; /* a public field */ + public double name { get; set; } /* a public property */ + private bool terminated = false; /* a private field */ + public void terminate() { /* a public method */ + terminated = true; + } + } + + const ALL_UPPER_CASE = "you should follow this convention"; + + var t = new Track(); // same as: Track t = new Track(); + var s = "hello"; // same as: string s = "hello"; + var l = new List(); // same as: List l = new List(); + var i = 10; // same as: int i = 10; + + + #if (ololo) + Regex regex = /foo/; + #endif + + /* + * Entry point can be outside class + */ + void main () { + var long_string = """ + Example of "verbatim string". + Same as in @"string" in C# + """ + var foo = new Foo (); + foo.some_event.connect (callback_a); // connecting the callback functions + foo.some_event.connect (callback_b); + foo.method (); + } + +## C + + using System; + + #pragma warning disable 414, 3021 + + public class Program + { + /// The entry point to the program. + public static int Main(string[] args) + { + Console.WriteLine("Hello, World!"); + string s = @"This + ""string"" + spans + multiple + lines!"; + return 0; + } + } + + async Task AccessTheWebAsync() + { + // ... + string urlContents = await getStringTask; + return urlContents.Length; + } + +## F + + open System + + // Single line comment... + (* + This is a + multiline comment. + *) + let checkList alist = + match alist with + | [] -> 0 + | [a] -> 1 + | [a; b] -> 2 + | [a; b; c] -> 3 + | _ -> failwith "List is too big!" + + + type IEncoding = + abstract Encode : string -> string + abstract Decode : string -> string + + let text = "Some text..." + let text2 = @"A ""verbatim"" string..." + let catalog = """ + Some "long" string... + """ + + let rec fib x = if x <= 2 then 1 else fib(x-1) + fib(x-2) + + let fibs = + Async.Parallel [ for i in 0..40 -> async { return fib(i) } ] + |> Async.RunSynchronously + + type Sprocket(gears) = + member this.Gears : int = gears + + [] + type Animal = + abstract Speak : unit -> unit + + type Widget = + | RedWidget + | GreenWidget + + type Point = {X: float; Y: float;} + + [] + type s + let minutte = 60 + +## D + + #!/usr/bin/rdmd + // Computes average line length for standard input. + import std.stdio; + + /+ + this is a /+ nesting +/ comment + +/ + + enum COMPILED_ON = __TIMESTAMP__; // special token + + enum character = '©'; + enum copy_valid = '©'; + enum backslash_escaped = '\\'; + + // string literals + enum str = `hello "world"!`; + enum multiline = r"lorem + ipsum + dolor"; // wysiwyg string, no escapes here allowed + enum multiline2 = "sit + amet + \"adipiscing\" + elit."; + enum hex = x"66 6f 6f"; // same as "foo" + + #line 5 + + // float literals + enum f = [3.14f, .1, 1., 1e100, 0xc0de.01p+100]; + + static if (something == true) { + import std.algorithm; + } + + void main() pure nothrow @safe { + ulong lines = 0; + double sumLength = 0; + foreach (line; stdin.byLine()) { + ++lines; + sumLength += line.length; + } + writeln("Average line length: ", + lines ? sumLength / lines : 0); + } + +## RenderMan RSL + + #define TEST_DEFINE 3.14 + /* plastic surface shader + * + * Pixie is: + * (c) Copyright 1999-2003 Okan Arikan. All rights reserved. + */ + + surface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1; + color specularcolor = 1;) { + normal Nf = faceforward (normalize(N),I); + Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks * + specular(Nf,-normalize(I),roughness); + Oi = Os; + Ci *= Oi; + } -**Handlebars** +## RenderMan RIB + + FrameBegin 0 + Display "Scene" "framebuffer" "rgb" + Option "searchpath" "shader" "+&:/home/kew" + Option "trace" "int maxdepth" [4] + Attribute "visibility" "trace" [1] + Attribute "irradiance" "maxerror" [0.1] + Attribute "visibility" "transmission" "opaque" + Format 640 480 1.0 + ShadingRate 2 + PixelFilter "catmull-rom" 1 1 + PixelSamples 4 4 + Projection "perspective" "fov" 49.5502811377 + Scale 1 1 -1 -

Hours

+ WorldBegin -
    - {{#each content.users}} -
  • {{firstName}}
  • - {{/each}} -
- -**CSS** - - @media screen and (-webkit-min-device-pixel-ratio: 0) { - body:first-of-type pre::after { - content: 'highlight: ' attr(class); - } - body { - background: linear-gradient(45deg, blue, red); - } - } - - @import url('print.css'); - @page:right { - margin: 1cm 2cm 1.3cm 4cm; - } - - @font-face { - font-family: Chunkfive; src: url('Chunkfive.otf'); - } - - div.text, - #content, - li[lang=ru] { - font: Tahoma, Chunkfive, sans-serif; - background: url('hatch.png') /* wtf? */; color: #F0F0F0 !important; - width: 100%; - } - -**SCSS** - - @import "compass/reset"; - - // variables - $colorGreen: #008000; - $colorGreenDark: darken($colorGreen, 10); - - @mixin container { - max-width: 980px; - } - - // mixins with parameters - @mixin button($color:green) { - @if ($color == green) { - background-color: #008000; - } - @else if ($color == red) { - background-color: #B22222; - } - } - - button { - @include button(red); - } - - div, - .navbar, - #header, - input[type="input"] { - font-family: "Helvetica Neue", Arial, sans-serif; - width: auto; - margin: 0 auto; - display: block; - } - - .row-12 > [class*="spans"] { - border-left: 1px solid #B5C583; - } - - // nested definitions - ul { - width: 100%; - padding: { - left: 5px; right: 5px; - } - li { - float: left; margin-right: 10px; - .home { - background: url('http://placehold.it/20') scroll no-repeat 0 0; - } - } - } - - .banner { - @extend .container; - } - - a { - color: $colorGreen; - &:hover { color: $colorGreenDark; } - &:visited { color: #c458cb; } - } - - @for $i from 1 through 5 { - .span#{$i} { - width: 20px*$i; - } - } - - @mixin mobile { - @media screen and (max-width : 600px) { - @content; - } - } - -**JSON** - - [ - { - "title": "apples", - "count": [12000, 20000], - "description": {"text": "...", "sensitive": false} - }, - { - "title": "oranges", - "count": [17500, null], - "description": {"text": "...", "sensitive": false} - } - ] - -**JavaScript** - - function $initHighlight(block, flags) { - try { - if (block.className.search(/\bno\-highlight\b/) != -1) - return processBlock(block, true, 0x0F) + ' class=""'; - } catch (e) { - /* handle exception */ - - var e4x = -
Example -

1234

; - } - for (var i = 0 / 2; i < classes.length; i++) { // "0 / 2" should not be parsed as regexp - if (checkCondition(classes[i]) === undefined) - return /\d+[\s/]/g; - } - } - -**CoffeeScript** - - # Divisions - x = 6/foo/i - x = 6 /foo - x = 6 / foo - x = 6 /foo * 2/gm - x = f /foo - x = f / foo / gm - x = f /foo * 2/6 - - # Regexps - x = f /6 * 2/ - 3 - x = f /foo * 2/gm - x = if true then /\n/ else /[.,]+/ - - grade = (student, period=(if b? then 7 else 6), messages={"A": "Excellent"}) -> - if student.excellentWork - "A+" - else if student.okayStuff - if student.triedHard then "B" else "B-" - else - "C" - - square = (x) -> x * x - - two = -> 2 - - math = - root: Math.sqrt - square: square - cube: (x) -> x * square x - - race = (winner, runners...) -> - print winner, runners - - class Animal extends Being - constructor: (@name) -> - - move: (meters) -> - alert @name + " moved #{meters}m." - - hi = `function() { - return [document.title, "Hello JavaScript"].join(": "); - }` - - heredoc = """ - CoffeeScript subst test #{ 010 + 0xf / 0b10 + "nested string #{ /\n/ }"} - """ - - ### - CoffeeScript Compiler v1.2.0 - Released under the MIT License - ### - - OPERATOR = /// ^ ( - ?: [-=]> # function - ) /// - -**ActionScript** - - package org.example.dummy { - import org.dummy.*; - - /*define package inline interface*/ - public interface IFooBarzable { - public function foo(... pairs):Array; - } - - public class FooBar implements IFooBarzable { - static private var cnt:uint = 0; - private var bar:String; - - //constructor - public function TestBar(bar:String):void { - bar = bar; - ++cnt; - } - - public function foo(... pairs):Array { - pairs.push(bar); - return pairs; - } - } - } - -**VB.NET** - - Import System - Import System.IO - #Const DEBUG = True - - Namespace Highlighter.Test - ''' This is an example class. - Public Class Program - Protected Shared hello As Integer = 3 - Private Const ABC As Boolean = False - - #Region "Code" - ' Cheers! - _ - Public Shared Sub Main(ByVal args() As String, ParamArray arr As Object) Handles Form1.Click - On Error Resume Next - If ABC Then - While ABC : Console.WriteLine() : End While - For i As Long = 0 To 1000 Step 123 - Try - System.Windows.Forms.MessageBox.Show(CInt("1").ToString()) - Catch ex As Exception ' What are you doing? Well... - Dim exp = CType(ex, IOException) - REM ORZ - Return - End Try - Next - Else - Dim l As New System.Collections.List() - SyncLock l - If TypeOf l Is Decimal And l IsNot Nothing Then - RemoveHandler button1.Paint, delegate - End If - Dim d = New System.Threading.Thread(AddressOf ThreadProc) - Dim a = New Action(Sub(x, y) x + y) - Static u = From x As String In l Select x.Substring(2, 4) Where x.Length > 0 - End SyncLock - Do : Laugh() : Loop Until hello = 4 - End If - End Sub - #End Region - End Class - End Namespace - - -**HTTP** - - POST /task?id=1 HTTP/1.1 - Host: example.org - Content-Type: application/json; charset=utf-8 - Content-Length: 19 - - {"status": "ok", "extended": true} - -**Lua** - - --[[ - Simple signal/slot implementation - ]] - local signal_mt = { - __index = { - register = table.insert - } - } - function signal_mt.__index:emit(... --[[ Comment in params ]]) - for _, slot in ipairs(self) do - slot(self, ...) - end - end - local function create_signal() - return setmetatable({}, signal_mt) - end - - -- Signal test - local signal = create_signal() - signal:register(function(signal, ...) - print(...) - end) - signal:emit('Answer to Life, the Universe, and Everything:', 42) - - --[==[ [=[ [[ - Nested ]] - multi-line ]=] - comment ]==] - [==[ Nested - [=[ multi-line - [[ string - ]] ]=] ]==] - -**AppleScript** - - repeat 5 times - if foo is greater than bar then - display dialog "Hello there" - else - beep - end if - end repeat - - (* comment (*nested comment*) *) - on do_something(s, y) - return {s + pi, y mod 4} - end do_something - - do shell script "/bin/echo 'hello'" - - -**Delphi** - - TList=Class(TObject) - Private - Some: String; - Public - Procedure Inside; // Suxx - End;{TList} - - Procedure CopyFile(InFileName,var OutFileName:String); - Const - BufSize=4096; (* Huh? *) - Var - InFile,OutFile:TStream; - Buffer:Array[1..BufSize] Of Byte; - ReadBufSize:Integer; - Begin - InFile:=Nil; - OutFile:=Nil; - Try - InFile:=TFileStream.Create(InFileName,fmOpenRead); - OutFile:=TFileStream.Create(OutFileName,fmCreate); - Repeat - ReadBufSize:=InFile.Read(Buffer,BufSize); - OutFile.Write(Buffer,ReadBufSize); - Until ReadBufSize<>BufSize; - Log('File '''+InFileName+''' copied'#13#10); - Finally - InFile.Free; - OutFile.Free; - End;{Try} - End;{CopyFile} - -**Java** - - /** - * @author John Smith - * @version 1.0 - */ - package l2f.gameserver.model; - - import java.util.ArrayList; - - public abstract class L2Character extends L2Object { - public static final Short ABNORMAL_EFFECT_BLEEDING = 0x0001; // not sure - - public void moveTo(int x, int y, int z) { - _ai = null; - _log.warning("Should not be called"); - if (1 > 5) { - return; - } - } - - /** Task of AI notification */ - @SuppressWarnings( { "nls", "unqualified-field-access", "boxing" }) - public class NotifyAITask implements Runnable { - private final CtrlEvent _evt; - - public void run() { - try { - getAI().notifyEvent(_evt, null, null); - } catch (Throwable t) { - t.printStackTrace(); - } - } - } - } - -**C++** - - #include - - int main(int argc, char *argv[]) { - - /* An annoying "Hello World" example */ - for (auto i = 0; i < 0xFFFF; i++) - cout << "Hello, World!" << endl; - - char c = '\n'; - unordered_map > m; - m["key"] = "\\\\"; // this is an error - - return -2e3 + 12l; - } - -**Objective C** - - #import - #import "Dependency.h" - - @protocol WorldDataSource - @optional - - (NSString*)worldName; - @required - - (BOOL)allowsToLive; - @end - - @interface Test : NSObject { - NSString *_greeting; - } - - @property (nonatomic, readonly) NSString *greeting; - - (IBAction) show; - @end - - @implementation Test - - @synthesize test=_test; - - + (id) test { - return [self testWithGreeting:@"Hello, world!\nFoo bar!"]; - } - - + (id) testWithGreeting:(NSString*)greeting { - return [[[self alloc] initWithGreeting:greeting] autorelease]; - } - - - (id) initWithGreeting:(NSString*)greeting { - if ( (self = [super init]) ) { - _greeting = [greeting retain]; - } - return self; - } - - - (void) dealloc { - [_greeting release]; - [super dealloc]; - } - - @end - -**Vala** - - using DBus; - - namespace Test { - class Foo : Object { - public signal void some_event (); // definition of the signal - public void method () { - some_event (); // emitting the signal (callbacks get invoked) - } - } - } - - /* defining a class */ - class Track : GLib.Object, Test.Foo { /* subclassing 'GLib.Object' */ - public double mass; /* a public field */ - public double name { get; set; } /* a public property */ - private bool terminated = false; /* a private field */ - public void terminate() { /* a public method */ - terminated = true; - } - } - - const ALL_UPPER_CASE = "you should follow this convention"; - - var t = new Track(); // same as: Track t = new Track(); - var s = "hello"; // same as: string s = "hello"; - var l = new List(); // same as: List l = new List(); - var i = 10; // same as: int i = 10; - - - #if (ololo) - Regex regex = /foo/; - #endif - - /* - * Entry point can be outside class - */ - void main () { - var long_string = """ - Example of "verbatim string". - Same as in @"string" in C# - """ - var foo = new Foo (); - foo.some_event.connect (callback_a); // connecting the callback functions - foo.some_event.connect (callback_b); - foo.method (); - } - -**C** - - using System; - - #pragma warning disable 414, 3021 - - public class Program - { - /// The entry point to the program. - public static int Main(string[] args) - { - Console.WriteLine("Hello, World!"); - string s = @"This - ""string"" - spans - multiple - lines!"; - return 0; - } - } - - async Task AccessTheWebAsync() - { - // ... - string urlContents = await getStringTask; - return urlContents.Length; - } - -**F** - - open System - - // Single line comment... - (* - This is a - multiline comment. - *) - let checkList alist = - match alist with - | [] -> 0 - | [a] -> 1 - | [a; b] -> 2 - | [a; b; c] -> 3 - | _ -> failwith "List is too big!" - - - type IEncoding = - abstract Encode : string -> string - abstract Decode : string -> string - - let text = "Some text..." - let text2 = @"A ""verbatim"" string..." - let catalog = """ - Some "long" string... - """ - - let rec fib x = if x <= 2 then 1 else fib(x-1) + fib(x-2) - - let fibs = - Async.Parallel [ for i in 0..40 -> async { return fib(i) } ] - |> Async.RunSynchronously - - type Sprocket(gears) = - member this.Gears : int = gears - - [] - type Animal = - abstract Speak : unit -> unit - - type Widget = - | RedWidget - | GreenWidget - - type Point = {X: float; Y: float;} - - [] - type s - let minutte = 60 - -**D** - - #!/usr/bin/rdmd - // Computes average line length for standard input. - import std.stdio; - - /+ - this is a /+ nesting +/ comment - +/ - - enum COMPILED_ON = __TIMESTAMP__; // special token - - enum character = '©'; - enum copy_valid = '©'; - enum backslash_escaped = '\\'; - - // string literals - enum str = `hello "world"!`; - enum multiline = r"lorem - ipsum - dolor"; // wysiwyg string, no escapes here allowed - enum multiline2 = "sit - amet - \"adipiscing\" - elit."; - enum hex = x"66 6f 6f"; // same as "foo" - - #line 5 - - // float literals - enum f = [3.14f, .1, 1., 1e100, 0xc0de.01p+100]; - - static if (something == true) { - import std.algorithm; - } - - void main() pure nothrow @safe { - ulong lines = 0; - double sumLength = 0; - foreach (line; stdin.byLine()) { - ++lines; - sumLength += line.length; - } - writeln("Average line length: ", - lines ? sumLength / lines : 0); - } - -**RenderMan RSL** - - #define TEST_DEFINE 3.14 - /* plastic surface shader - * - * Pixie is: - * (c) Copyright 1999-2003 Okan Arikan. All rights reserved. - */ - - surface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1; - color specularcolor = 1;) { - normal Nf = faceforward (normalize(N),I); - Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks * - specular(Nf,-normalize(I),roughness); - Oi = Os; - Ci *= Oi; - } - -**RenderMan RIB** - - FrameBegin 0 - Display "Scene" "framebuffer" "rgb" - Option "searchpath" "shader" "+&:/home/kew" - Option "trace" "int maxdepth" [4] - Attribute "visibility" "trace" [1] - Attribute "irradiance" "maxerror" [0.1] - Attribute "visibility" "transmission" "opaque" - Format 640 480 1.0 - ShadingRate 2 - PixelFilter "catmull-rom" 1 1 - PixelSamples 4 4 - Projection "perspective" "fov" 49.5502811377 - Scale 1 1 -1 - - WorldBegin - - ReadArchive "Lamp.002_Light/instance.rib" - Surface "plastic" - ReadArchive "Cube.004_Mesh/instance.rib" - # ReadArchive "Sphere.010_Mesh/instance.rib" - # ReadArchive "Sphere.009_Mesh/instance.rib" - ReadArchive "Sphere.006_Mesh/instance.rib" - - WorldEnd - FrameEnd - -**MEL (Maya Embedded Language)** - - proc string[] getSelectedLights() - - { - string $selectedLights[]; - - string $select[] = `ls -sl -dag -leaf`; - - for ( $shape in $select ) - { - // Determine if this is a light. - // - string $class[] = getClassification( `nodeType $shape` ); - - - if ( ( `size $class` ) > 0 && ( "light" == $class[0] ) ) - { - $selectedLights[ `size $selectedLights` ] = $shape; - } - } - - // Result is an array of all lights included in - - // current selection list. - return $selectedLights; - } - -**GLSL** - - // vertex shader - #version 150 - in vec2 in_Position; - in vec3 in_Color; - - out vec3 ex_Color; - void main(void) { - gl_Position = vec4(in_Position.x, in_Position.y, 0.0, 1.0); - ex_Color = in_Color; - } - - - // geometry shader - #version 150 - - layout(triangles) in; - layout(triangle_strip, max_vertices = 3) out; - - void main() { - for(int i = 0; i < gl_in.length(); i++) { - gl_Position = gl_in[i].gl_Position; - EmitVertex(); - } - EndPrimitive(); - } - - - // fragment shader - #version 150 - precision highp float; - - in vec3 ex_Color; - out vec4 gl_FragColor; - - void main(void) { - gl_FragColor = vec4(ex_Color, 1.0); - } - -**SQL** - - BEGIN; - CREATE TABLE "topic" ( - "id" serial NOT NULL PRIMARY KEY, - "forum_id" integer NOT NULL, - "subject" varchar(255) NOT NULL - ); - ALTER TABLE "topic" ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id") REFERENCES "forum" ("id"); - - -- Initials - insert into "topic" ("forum_id", "subject") values (2, 'D''artagnian'); - - select count(*) from cicero_forum; - - -- this line lacks ; at the end to allow people to be sloppy and omit it in one-liners - COMMIT - -**SmallTalk** - - Object>>method: num - "comment 123" - | var1 var2 | - (1 to: num) do: [:i | |var| ^i]. - Klass with: var1. - Klass new. - arr := #('123' 123.345 #hello Transcript var $@). - arr := #(). - var2 = arr at: 3. - ^ self abc - - heapExample - "HeapTest new heapExample" - "Multiline - decription" - | n rnd array time sorted | - n := 5000. - "# of elements to sort" - rnd := Random new. - array := (1 to: n) - collect: [:i | rnd next]. - "First, the heap version" - time := Time - millisecondsToRun: [sorted := Heap withAll: array. - 1 - to: n - do: [:i | - sorted removeFirst. - sorted add: rnd next]]. - Transcript cr; show: 'Time for Heap: ' , time printString , ' msecs'. - "The quicksort version" - time := Time - millisecondsToRun: [sorted := SortedCollection withAll: array. - 1 - to: n - do: [:i | - sorted removeFirst. - sorted add: rnd next]]. - Transcript cr; show: 'Time for SortedCollection: ' , time printString , ' msecs' - -**Lisp** - - #!/usr/bin/env csi - - (defun prompt-for-cd () - "Prompts - for CD" - (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6)) - (prompt-read "Artist" &rest) - (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0) - (if x (format t "yes") (format t "no" nil) ;and here comment - ) - ;; second line comment - '(+ 1 2) - (defvar *lines*) ; list of all lines - (position-if-not #'sys::whitespacep line :start beg)) - (quote (privet 1 2 3)) - '(hello world) - (* 5 7) - (1 2 34 5) - (:use "aaaa") - (let ((x 10) (y 20)) - (print (+ x y)) - ) - -**Clojure** - - ; You must not remove this notice, or any other, from this software. - - (ns ^{:doc "The core Clojure language." - :author "Rich Hickey"} - clojure.core) - - (def unquote) - - (def - ^{:macro true - :added "1.0"} - let (fn* let [&form &env & decl] (cons 'let* decl))) - - (def - - defn (fn defn [&form &env name & fdecl] - (let [m (conj {:arglists (list 'quote (sigs fdecl))} m) - m (let [inline (:inline m) - ifn (first inline) - iname (second inline)] - ;; same as: (if (and (= 'fn ifn) (not (symbol? iname))) ...) - (if (if (clojure.lang.Util/equiv 'fn ifn) - (if (instance? clojure.lang.Symbol iname) false true)) - ;; inserts the same fn name to the inline fn if it does not have one - (assoc m :inline (cons ifn (cons (clojure.lang.Symbol/intern (.concat (.getName ^clojure.lang.Symbol name) "__inliner")) - (next inline)))) - m)) - m (conj (if (meta name) (meta name) {}) m)] - (list 'def (with-meta name m) - ;;todo - restore propagation of fn name - ;;must figure out how to convey primitive hints to self calls first - (cons `fn fdecl) )))) - - (. (var defn) (setMacro)) - -**Ini file** - - ;Settings relating to the location and loading of the database - [Database] - ProfileDir=. - ShowProfileMgr=smart - Profile1_Name[] = "\|/_-=MegaDestoyer=-_\|/" - DefaultProfile=True - AutoCreate = no - - [AutoExec] - use-prompt="prompt" - Glob=autoexec_*.ini - AskAboutIgnoredPlugins=0 - -**Apache** - - # rewrite`s rules for wordpress pretty url - LoadModule rewrite_module modules/mod_rewrite.so - RewriteCond %{REQUEST_FILENAME} !-f - RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule . index.php [NC,L] - - ExpiresActive On - ExpiresByType application/x-javascript "access plus 1 days" - - - RewriteMap map txt:map.txt - RewriteMap lower int:tolower - RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC] - RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND - RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L] - - -**nginx** - - user www www; - worker_processes 2; - pid /var/run/nginx.pid; - error_log /var/log/nginx.error_log debug | info | notice | warn | error | crit; - - events { - connections 2000; - use kqueue | rtsig | epoll | /dev/poll | select | poll; - } - - http { - log_format main '$remote_addr - $remote_user [$time_local] ' - '"$request" $status $bytes_sent ' - '"$http_referer" "$http_user_agent" ' - '"$gzip_ratio"'; - - send_timeout 3m; - client_header_buffer_size 1k; - - gzip on; - gzip_min_length 1100; - - #lingering_time 30; - - server { - server_name one.example.com www.one.example.com; - access_log /var/log/nginx.access_log main; - - rewrite (.*) /index.php?page=$1 break; - - location / { - proxy_pass http://127.0.0.1/; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - charset koi8-r; - } - - location /api/ { - fastcgi_pass 127.0.0.1:9000; - } - - location ~* \.(jpg|jpeg|gif)$ { - root /spool/www; - } - } - } - -**Diff** - - Index: languages/ini.js - =================================================================== - --- languages/ini.js (revision 199) - +++ languages/ini.js (revision 200) - @@ -1,8 +1,7 @@ - hljs.LANGUAGES.ini = - { - case_insensitive: true, - - defaultMode: - - { - + defaultMode: { - contains: ['comment', 'title', 'setting'], - illegal: '[^\\s]' - }, - - *** /path/to/original timestamp - --- /path/to/new timestamp - *************** - *** 1,3 **** - --- 1,9 ---- - + This is an important - + notice! It should - + therefore be located at - + the beginning of this - + document! - - ! compress the size of the - ! changes. - - It is important to spell - -**DOS batch files** - - cd \ - copy a b - ping 192.168.0.1 - @rem ping 192.168.0.1 - net stop sharedaccess - del %tmp% /f /s /q - del %temp% /f /s /q - ipconfig /flushdns - taskkill /F /IM JAVA.EXE /T - - cd Photoshop/Adobe Photoshop CS3/AMT/ - if exist application.sif ( - ren application.sif _application.sif - ) else ( - ren _application.sif application.sif - ) - - taskkill /F /IM proquota.exe /T - - sfc /SCANNOW - - set path = test - - xcopy %1\*.* %2 - -**Bash** - - #!/bin/bash - - ###### BEGIN CONFIG - ACCEPTED_HOSTS="/root/.hag_accepted.conf" - BE_VERBOSE=false - ###### END CONFIG - - if [ "$UID" -ne 0 ] - then - echo "Superuser rights is required" - echo 'Printing the # sign' - exit 2 - fi - - if test $# -eq 0 - then - elif test [ $1 == 'start' ] - else - fi - - genApacheConf(){ - if [[ "$2" = "www" ]] - then - full_domain=$1 - else - full_domain=$2.$1 - fi - host_root="${APACHE_HOME_DIR}$1/$2/$(title)" - echo -e "# Host $1/$2 :" - } - -**CMake** - - project(test) - cmake_minimum_required(VERSION 2.6) - - # IF LINUX - if (${CMAKE_SYSTEM_NAME} MATCHES Linux) - message("\nOS:\t\tLinux") - endif() - - # IF WINDOWS - if (${CMAKE_SYSTEM_NAME} MATCHES Windows) - message("\nOS:\t\tWindows") - endif() - - set(test test0.cpp test1.cpp test2.cpp) - - include_directories(./) - - set(EXECUTABLE_OUTPUT_PATH ../bin) - - add_subdirectory(src) - - add_executable(test WIN32 ${test}) - - target_link_libraries(test msimg32) - -**Axapta** - - class ExchRateLoadBatch extends RunBaseBatch { - ExchRateLoad rbc; - container currencies; - boolean actual; - boolean overwrite; - date beg; - date end; - - #define.CurrentVersion(5) - - #localmacro.CurrentList - currencies, - actual, - beg, - end - #endmacro - } - - public boolean unpack(container packedClass) { - container base; - boolean ret; - Integer version = runbase::getVersion(packedClass); - - switch (version) { - case #CurrentVersion: - [version, #CurrentList] = packedClass; - return true; - default: - return false; - } - return ret; - } - -**Oracle Rules Language** - - //This is a comment - ABORT "You experienced an abort."; - WARN "THIS IS A WARNING"; - CALL "RIDER_X"; - DONE; - FOR EACH X IN CSV_FILE "d:\lodestar\user\d377.lse" - LEAVE FOR; - END FOR; - IF ((BILL_KW = 0) AND (KW > 0)) THEN - END IF; - INCLUDE "R1"; - LEAVE RIDER; - SELECT BILL_PERIOD - WHEN "WINTER" - BLOCK KWH - FROM 0 TO 400 CHARGE $0.03709 - FROM 400 CHARGE $0.03000 - TOTAL $ENERGY_CHARGE_WIN; - WHEN "SUMMER" - $VOLTAGE_DISCOUNT_SUM = $0.00 - OTHERWISE - $VOLTAGE_DISCOUNT_SUM = $1.00 - END SELECT; - /* Report top five peaks */ - LABEL PK.NM "Peak Number"; - SAVE_UPDATE MV TO TABLE "METERVALUE"; - - FOR EACH INX IN ARRAYUPPERBOUND(#MYARRAY[]) - #MYARRAY[INX].VALUE = 2; - CLEAR #MYARRAY[]; - END FOR - - //Interval Data - HNDL_1_ADD_EDI = INTDADDATTRIBUTE(HNDL_1, "EDI_TRANSACTION", EDI_ID); - HNDL_1_ADD_VAL_MSG = INTDADDVMSG(HNDL_1,"Missing (Status Code 9) values found"); - EMPTY_HNDL = INTDCREATEHANDLE('05/03/2006 00:00:00', '05/03/2006 23:59:59', 3600, "Y", "0", " "); - -**1С** - - #Если Клиент Тогда - Перем СимвольныйКодКаталога = "ля-ля-ля"; //комментарий - Функция Сообщить(Знач ТекстСообщения, ТекстСообщения2) Экспорт //комментарий к функции - x=ТекстСообщения+ТекстСообщения2+" - |строка1 - |строка2 - |строка3"; - КонецФункции - #КонецЕсли - - // Процедура ПриНачалеРаботыСистемы - // - Процедура ПриНачалеРаботыСистемы() - Обработки.Помощник.ПолучитьФорму("Форма").Открыть(); - d = '21.01.2008' - КонецПроцедуры - -**AVR Assembler** - - ;* Title: Block Copy Routines - ;* Version: 1.1 - - .include "8515def.inc" - - rjmp RESET ;reset handle - - .def flashsize=r16 ;size of block to be copied - - flash2ram: - lpm ;get constant - st Y+,r0 ;store in SRAM and increment Y-pointer - adiw ZL,1 ;increment Z-pointer - dec flashsize - brne flash2ram ;if not end of table, loop more - ret - - .def ramtemp =r1 ;temporary storage register - .def ramsize =r16 ;size of block to be copied - -**VHDL** - - /* - * RS-trigger with assynch. reset - */ - - library ieee; - use ieee.std_logic_1164.all; - - entity RS_trigger is - generic (T: Time := 0ns); - port ( R, S : in std_logic; - Q, nQ : out std_logic; - reset, clock : in std_logic ); - end RS_trigger; - - architecture behaviour of RS_trigger is - signal QT: std_logic; -- Q(t) - begin - process(clock, reset) is - subtype RS is std_logic_vector (1 downto 0); - begin - if reset = '0' then - QT <= '0'; - else - if rising_edge(C) then - if not (R'stable(T) and S'stable(T)) then - QT <= 'X'; - else - case RS'(R&S) is - when "01" => QT <= '1'; - when "10" => QT <= '0'; - when "11" => QT <= 'X'; - when others => null; - end case; - end if; - end if; - end if; - end process; - - Q <= QT; - nQ <= not QT; - end architecture behaviour; - -**Parser 3** - - @CLASS - base - - @USE - module.p - - @BASE - class - - # Comment for code - @create[aParam1;aParam2][local1;local2] - ^connect[mysql://host/database?ClientCharset=windows-1251] - ^for[i](1;10){ -

^eval($i+10)

- ^connect[mysql://host/database]{ - $tab[^table::sql{select * from `table` where a='1'}] - $var_Name[some${value}] - } - } - - ^rem{ - Multiline comment with code: $var - ^while(true){ - ^for[i](1;10){ - ^sleep[] - } - } - } - ^taint[^#0A] - - @GET_base[] - ## Comment for code - # Isn't comment - $result[$.hash_item1[one] $.hash_item2[two]] - -**TeX** - - \documentclass{article} - \usepackage[koi8-r]{inputenc} - \hoffset=0pt - \voffset=.3em - \tolerance=400 - \newcommand{\eTiX}{\TeX} - \begin{document} - \section*{Highlight.js} - \begin{table}[c|c] - $\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $ - \end{table} - Ch\'erie, \c{c}a ne me pla\^\i t pas! % comment \b - G\"otterd\"ammerung~45\%=34. - $$ - \int\limits_{0}^{\pi}\frac{4}{x-7}=3 - $$ - \end{document} - -**Haskell** - - {-# LANGUAGE TypeSynonymInstances #-} - module Network.UDP - ( DataPacket(..) - , openBoundUDPPort - , openListeningUDPPort - , pingUDPPort - , sendUDPPacketTo - , recvUDPPacket - , recvUDPPacketFrom - ) where - - {- this is a {- nested -} comment -} - - import qualified Data.ByteString as Strict (ByteString, concat, singleton) - import qualified Data.ByteString.Lazy as Lazy (ByteString, toChunks, fromChunks) - import Data.ByteString.Char8 (pack, unpack) - import Network.Socket hiding (sendTo, recv, recvFrom) - import Network.Socket.ByteString (sendTo, recv, recvFrom) - - -- Type class for converting StringLike types to and from strict ByteStrings - class DataPacket a where - toStrictBS :: a -> Strict.ByteString - fromStrictBS :: Strict.ByteString -> a - - instance DataPacket Strict.ByteString where - toStrictBS = id - {-# INLINE toStrictBS #-} - fromStrictBS = id - {-# INLINE fromStrictBS #-} - - openBoundUDPPort :: String -> Int -> IO Socket - openBoundUDPPort uri port = do - s <- getUDPSocket - bindAddr <- inet_addr uri - let a = SockAddrInet (toEnum port) bindAddr - bindSocket s a - return s - - pingUDPPort :: Socket -> SockAddr -> IO () - pingUDPPort s a = sendTo s (Strict.singleton 0) a >> return () - -**Erlang** - - -module(ssh_cli). - - -behaviour(ssh_channel). - - -include("ssh.hrl"). - %% backwards compatibility - -export([listen/1, listen/2, listen/3, listen/4, stop/1]). - - %% state - -record(state, { - cm, - channel - }). - - test(Foo)->Foo. - - init([Shell, Exec]) -> - {ok, #state{shell = Shell, exec = Exec}}; - init([Shell]) -> - false = not true, - io:format("Hello, \"~p!~n", [atom_to_list('World')]), - {ok, #state{shell = Shell}}. - - concat([Single]) -> Single; - concat(RList) -> - EpsilonFree = lists:filter( - fun (Element) -> - case Element of - epsilon -> false; - _ -> true - end - end, - RList), - case EpsilonFree of - [Single] -> Single; - Other -> {concat, Other} - end. - - union_dot_union({union, _}=U1, {union, _}=U2) -> - union(lists:flatten( - lists:map( - fun (X1) -> - lists:map( - fun (X2) -> - concat([X1, X2]) - end, - union_to_list(U2) - ) - end, - union_to_list(U1) - ))). - - -**Erlang REPL** - - 1> Str = "abcd". - "abcd" - 2> L = test:length(Str). - 4 - 3> Descriptor = {L, list_to_atom(Str)}. - {4,abcd} - 4> L. - 4 - 5> b(). - Descriptor = {4,abcd} - L = 4 - Str = "abcd" - ok - 6> f(L). - ok - 7> b(). - Descriptor = {4,abcd} - Str = "abcd" - ok - 8> {L, _} = Descriptor. - {4,abcd} - 9> L. - 4 - 10> 2#101. - 5 - 11> 1.85e+3. - 1850 - -**Rust** - - use std; - - import std::io; - export fac, test1; - - 123; // type int - 123u; // type uint - 123_u; // type uint - 0xff00; // type int - 0xff_u8; // type u8 - 0b1111_1111_1001_0000_i32; // type i32 - 123.0; // type float - 0.1; // type float - 3f; // type float - 0.1f32; // type f32 - 12E+99_f64; // type f64 - - /* Factorial */ - fn fac(n: int) -> int { - let s: str = "This is - a multi-line string. - - It ends with an unescaped '\"'."; - let c: char = 'Ф'; - - let result = 1, i = 1; - while i <= n { // No parens around the condition - result *= i; - i += 1; - } - ret result; - } - - pure fn pure_length(ls: list) -> uint { /* ... */ } - - type t = map::hashtbl; - let x = id::(10); - - // Define some modules. - #[path = "foo.rs"] - mod foo; - - iface seq { - fn len() -> uint; - } - - impl of seq for [T] { - fn len() -> uint { vec::len(self) } - fn iter(b: fn(T)) { - for elt in self { b(elt); } - } - } - - enum list { - nil; - cons(T, @list); - } - - let a: list = cons(7, @cons(13, @nil)); - -**Matlab** - - n = 20; % number of points - points = [random('unid', 100, n, 1), random('unid', 100, n, 1)]; - len = zeros(1, n - 1); - points = sortrows(points); - %% Initial set of points - plot(points(:,1),points(:,2)); - for i = 1: n-1 - len(i) = points(i + 1, 1) - points(i, 1); - end - while(max(len) > 2 * min(len)) - [d, i] = max(len); - k = on_margin(points, i, d, -1); - m = on_margin(points, i + 1, d, 1); - xm = 0; ym = 0; - %% New point - if(i == 1 || i + 1 == n) - xm = mean(points([i,i+1],1)) - ym = mean(points([i,i+1],2)) - else - [xm, ym] = dlg1(points([k, i, i + 1, m], 1), ... - points([k, i, i + 1, m], 2)) - end - - points = [ points(1:i, :); [xm, ym]; points(i + 1:end, :)]; - end - - function [net] = get_fit_network(inputs, targets) - % Create Network - numHiddenNeurons = 20; % Adjust as desired - net = newfit(inputs,targets,numHiddenNeurons); - net.trainParam.goal = 0.01; - net.trainParam.epochs = 1000; - % Train and Apply Network - [net,tr] = train(net,inputs,targets); - end - - foo_matrix = [1, 2, 3; 4, 5, 6]'''; - foo_cell = {1, 2, 3; 4, 5, 6}''.'.'; - -**R** - - library(ggplot2) - - centre <- function(x, type, ...) { - switch(type, - mean = mean(x), - median = median(x), - trimmed = mean(x, trim = .1)) - } - - myVar1 - myVar.2 - data$x - foo "bar" baz - # test "test" - "test # test" - - (123) (1) (10) (0.1) (.2) (1e-7) - (1.2e+7) (2e) (3e+10) (0x0) (0xa) - (0xabcdef1234567890) (123L) (1L) - (0x10L) (10000000L) (1e6L) (1.1L) - (1e-3L) (4123.381E-10i) - (3.) (3.E10) # BUG: .E10 should be part of number - - # Numbers in some different contexts - 1L - 0x40 - .234 - 3. - 1L + 30 - plot(cars, xlim=20) - plot(cars, xlim=0x20) - foo<-30 - my.data.3 <- read() # not a number - c(1,2,3) - 1%%2 - - "this is a quote that spans - multiple lines - \" - - is this still a quote? it should be. - # even still! - - " # now we're done. - - 'same for - single quotes #' - - # keywords - NULL, NA, TRUE, FALSE, Inf, NaN, NA_integer_, - NA_real_, NA_character_, NA_complex_, function, - while, repeat, for, if, in, else, next, break, - ..., ..1, ..2 - - # not keywords - the quick brown fox jumped over the lazy dogs - null na true false inf nan na_integer_ na_real_ - na_character_ na_complex_ Function While Repeat - For If In Else Next Break .. .... "NULL" `NULL` 'NULL' - - # operators - +, -, *, /, %%, ^, >, >=, <, <=, ==, !=, !, &, |, ~, - ->, <-, <<-, $, :, :: - - # infix operator - foo %union% bar - %"test"% - `"test"` - -**Mizar** - - ::: ## Lambda calculus - - environ - - vocabularies LAMBDA, - NUMBERS, - NAT_1, XBOOLE_0, SUBSET_1, FINSEQ_1, XXREAL_0, CARD_1, - ARYTM_1, ARYTM_3, TARSKI, RELAT_1, ORDINAL4, FUNCOP_1; - - :: etc... - - begin - - reserve D for DecoratedTree, - p,q,r for FinSequence of NAT, - x for set; - - definition - let D; - - attr D is LambdaTerm-like means - (dom D qua Tree) is finite & - ::> *143,306 - for r st r in dom D holds - r is FinSequence of {0,1} & - r^<*0*> in dom D implies D.r = 0; - end; - - registration - cluster LambdaTerm-like for DecoratedTree of NAT; - existence; - ::> *4 - end; - - definition - mode LambdaTerm is LambdaTerm-like DecoratedTree of NAT; - end; - - ::: Then we extend this ordinary one-step beta reduction, that is, - ::: any subterm is also allowed to reduce. - definition - let M,N; - - pred M beta N means - ex p st - M|p beta_shallow N|p & - for q st not p is_a_prefix_of q holds - [r,x] in M iff [r,x] in N; - end; - - theorem Th4: - ProperPrefixes (v^<*x*>) = ProperPrefixes v \/ {v} - proof - thus ProperPrefixes (v^<*x*>) c= ProperPrefixes v \/ {v} - proof - let y; - assume y in ProperPrefixes (v^<*x*>); - then consider v1 such that - A1: y = v1 and - A2: v1 is_a_proper_prefix_of v^<*x*> by TREES_1:def 2; - v1 is_a_prefix_of v & v1 <> v or v1 = v by A2,TREES_1:9; - then - v1 is_a_proper_prefix_of v or v1 in {v} by TARSKI:def 1,XBOOLE_0:def 8; - then y in ProperPrefixes v or y in {v} by A1,TREES_1:def 2; - hence thesis by XBOOLE_0:def 3; - end; - let y; - assume y in ProperPrefixes v \/ {v}; - then A3: y in ProperPrefixes v or y in {v} by XBOOLE_0:def 3; - A4: now - assume y in ProperPrefixes v; - then consider v1 such that - A5: y = v1 and - A6: v1 is_a_proper_prefix_of v by TREES_1:def 2; - v is_a_prefix_of v^<*x*> by TREES_1:1; - then v1 is_a_proper_prefix_of v^<*x*> by A6,XBOOLE_1:58; - hence thesis by A5,TREES_1:def 2; - end; - v^{} = v by FINSEQ_1:34; - then - v is_a_prefix_of v^<*x*> & v <> v^<*x*> by FINSEQ_1:33,TREES_1:1; - then v is_a_proper_prefix_of v^<*x*> by XBOOLE_0:def 8; - then y in ProperPrefixes v or y = v & v in ProperPrefixes (v^<*x*>) - by A3,TARSKI:def 1,TREES_1:def 2; - hence thesis by A4; - end; + ReadArchive "Lamp.002_Light/instance.rib" + Surface "plastic" + ReadArchive "Cube.004_Mesh/instance.rib" + # ReadArchive "Sphere.010_Mesh/instance.rib" + # ReadArchive "Sphere.009_Mesh/instance.rib" + ReadArchive "Sphere.006_Mesh/instance.rib" + + WorldEnd + FrameEnd + +## MEL (Maya Embedded Language) + + proc string[] getSelectedLights() + + { + string $selectedLights[]; + + string $select[] = `ls -sl -dag -leaf`; + + for ( $shape in $select ) + { + // Determine if this is a light. + // + string $class[] = getClassification( `nodeType $shape` ); + + + if ( ( `size $class` ) > 0 && ( "light" == $class[0] ) ) + { + $selectedLights[ `size $selectedLights` ] = $shape; + } + } + + // Result is an array of all lights included in + + // current selection list. + return $selectedLights; + } + +## GLSL + + // vertex shader + #version 150 + in vec2 in_Position; + in vec3 in_Color; + + out vec3 ex_Color; + void main(void) { + gl_Position = vec4(in_Position.x, in_Position.y, 0.0, 1.0); + ex_Color = in_Color; + } + + + // geometry shader + #version 150 + + layout(triangles) in; + layout(triangle_strip, max_vertices = 3) out; + + void main() { + for(int i = 0; i < gl_in.length(); i++) { + gl_Position = gl_in[i].gl_Position; + EmitVertex(); + } + EndPrimitive(); + } + + + // fragment shader + #version 150 + precision highp float; + + in vec3 ex_Color; + out vec4 gl_FragColor; + + void main(void) { + gl_FragColor = vec4(ex_Color, 1.0); + } + +## SQL + + BEGIN; + CREATE TABLE "topic" ( + "id" serial NOT NULL PRIMARY KEY, + "forum_id" integer NOT NULL, + "subject" varchar(255) NOT NULL + ); + ALTER TABLE "topic" ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id") REFERENCES "forum" ("id"); + + -- Initials + insert into "topic" ("forum_id", "subject") values (2, 'D''artagnian'); + + select count(*) from cicero_forum; + + -- this line lacks ; at the end to allow people to be sloppy and omit it in one-liners + COMMIT + +## SmallTalk + + Object>>method: num + "comment 123" + | var1 var2 | + (1 to: num) do: [:i | |var| ^i]. + Klass with: var1. + Klass new. + arr := #('123' 123.345 #hello Transcript var $@). + arr := #(). + var2 = arr at: 3. + ^ self abc + + heapExample + "HeapTest new heapExample" + "Multiline + decription" + | n rnd array time sorted | + n := 5000. + "# of elements to sort" + rnd := Random new. + array := (1 to: n) + collect: [:i | rnd next]. + "First, the heap version" + time := Time + millisecondsToRun: [sorted := Heap withAll: array. + 1 + to: n + do: [:i | + sorted removeFirst. + sorted add: rnd next]]. + Transcript cr; show: 'Time for Heap: ' , time printString , ' msecs'. + "The quicksort version" + time := Time + millisecondsToRun: [sorted := SortedCollection withAll: array. + 1 + to: n + do: [:i | + sorted removeFirst. + sorted add: rnd next]]. + Transcript cr; show: 'Time for SortedCollection: ' , time printString , ' msecs' + +## Lisp + + #!/usr/bin/env csi + + (defun prompt-for-cd () + "Prompts + for CD" + (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6)) + (prompt-read "Artist" &rest) + (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0) + (if x (format t "yes") (format t "no" nil) ;and here comment + ) + ;; second line comment + '(+ 1 2) + (defvar *lines*) ; list of all lines + (position-if-not #'sys::whitespacep line :start beg)) + (quote (privet 1 2 3)) + '(hello world) + (* 5 7) + (1 2 34 5) + (:use "aaaa") + (let ((x 10) (y 20)) + (print (+ x y)) + ) + +## Clojure + + ; You must not remove this notice, or any other, from this software. + + (ns ^{:doc "The core Clojure language." + :author "Rich Hickey"} + clojure.core) + + (def unquote) + + (def + ^{:macro true + :added "1.0"} + let (fn* let [&form &env & decl] (cons 'let* decl))) + + (def + + defn (fn defn [&form &env name & fdecl] + (let [m (conj {:arglists (list 'quote (sigs fdecl))} m) + m (let [inline (:inline m) + ifn (first inline) + iname (second inline)] + ;; same as: (if (and (= 'fn ifn) (not (symbol? iname))) ...) + (if (if (clojure.lang.Util/equiv 'fn ifn) + (if (instance? clojure.lang.Symbol iname) false true)) + ;; inserts the same fn name to the inline fn if it does not have one + (assoc m :inline (cons ifn (cons (clojure.lang.Symbol/intern (.concat (.getName ^clojure.lang.Symbol name) "__inliner")) + (next inline)))) + m)) + m (conj (if (meta name) (meta name) {}) m)] + (list 'def (with-meta name m) + ;;todo - restore propagation of fn name + ;;must figure out how to convey primitive hints to self calls first + (cons `fn fdecl) )))) + + (. (var defn) (setMacro)) + +## Ini file + + ;Settings relating to the location and loading of the database + [Database] + ProfileDir=. + ShowProfileMgr=smart + Profile1_Name[] = "\|/_-=MegaDestoyer=-_\|/" + DefaultProfile=True + AutoCreate = no + + [AutoExec] + use-prompt="prompt" + Glob=autoexec_*.ini + AskAboutIgnoredPlugins=0 + +## Apache + + # rewrite`s rules for wordpress pretty url + LoadModule rewrite_module modules/mod_rewrite.so + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . index.php [NC,L] + + ExpiresActive On + ExpiresByType application/x-javascript "access plus 1 days" + + + RewriteMap map txt:map.txt + RewriteMap lower int:tolower + RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC] + RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND + RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L] + + +## nginx + + user www www; + worker_processes 2; + pid /var/run/nginx.pid; + error_log /var/log/nginx.error_log debug | info | notice | warn | error | crit; + + events { + connections 2000; + use kqueue | rtsig | epoll | /dev/poll | select | poll; + } + + http { + log_format main '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $bytes_sent ' + '"$http_referer" "$http_user_agent" ' + '"$gzip_ratio"'; + + send_timeout 3m; + client_header_buffer_size 1k; + + gzip on; + gzip_min_length 1100; + + #lingering_time 30; + + server { + server_name one.example.com www.one.example.com; + access_log /var/log/nginx.access_log main; + + rewrite (.*) /index.php?page=$1 break; + + location / { + proxy_pass http://127.0.0.1/; + proxy_redirect off; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + charset koi8-r; + } + + location /api/ { + fastcgi_pass 127.0.0.1:9000; + } + + location ~* \.(jpg|jpeg|gif)$ { + root /spool/www; + } + } + } + +## Diff + + Index: languages/ini.js + =================================================================== + --- languages/ini.js (revision 199) + +++ languages/ini.js (revision 200) + @@ -1,8 +1,7 @@ + hljs.LANGUAGES.ini = + { + case_insensitive: true, + - defaultMode: + - { + + defaultMode: { + contains: ['comment', 'title', 'setting'], + illegal: '[^\\s]' + }, + + *** /path/to/original timestamp + --- /path/to/new timestamp + *************** + *** 1,3 **** + --- 1,9 ---- + + This is an important + + notice! It should + + therefore be located at + + the beginning of this + + document! + + ! compress the size of the + ! changes. + + It is important to spell + +## DOS batch files + + cd \ + copy a b + ping 192.168.0.1 + @rem ping 192.168.0.1 + net stop sharedaccess + del %tmp% /f /s /q + del %temp% /f /s /q + ipconfig /flushdns + taskkill /F /IM JAVA.EXE /T + + cd Photoshop/Adobe Photoshop CS3/AMT/ + if exist application.sif ( + ren application.sif _application.sif + ) else ( + ren _application.sif application.sif + ) + + taskkill /F /IM proquota.exe /T + + sfc /SCANNOW + + set path = test + + xcopy %1\*.* %2 + +## Bash + + #!/bin/bash + + ###### BEGIN CONFIG + ACCEPTED_HOSTS="/root/.hag_accepted.conf" + BE_VERBOSE=false + ###### END CONFIG + + if [ "$UID" -ne 0 ] + then + echo "Superuser rights is required" + echo 'Printing the # sign' + exit 2 + fi + + if test $# -eq 0 + then + elif test [ $1 == 'start' ] + else + fi + + genApacheConf(){ + if [[ "$2" = "www" ]] + then + full_domain=$1 + else + full_domain=$2.$1 + fi + host_root="${APACHE_HOME_DIR}$1/$2/$(title)" + echo -e "# Host $1/$2 :" + } + +## CMake + + project(test) + cmake_minimum_required(VERSION 2.6) + + # IF LINUX + if (${CMAKE_SYSTEM_NAME} MATCHES Linux) + message("\nOS:\t\tLinux") + endif() + + # IF WINDOWS + if (${CMAKE_SYSTEM_NAME} MATCHES Windows) + message("\nOS:\t\tWindows") + endif() + + set(test test0.cpp test1.cpp test2.cpp) + + include_directories(./) + + set(EXECUTABLE_OUTPUT_PATH ../bin) + + add_subdirectory(src) + + add_executable(test WIN32 ${test}) + + target_link_libraries(test msimg32) + +## Axapta + + class ExchRateLoadBatch extends RunBaseBatch { + ExchRateLoad rbc; + container currencies; + boolean actual; + boolean overwrite; + date beg; + date end; + + #define.CurrentVersion(5) + + #localmacro.CurrentList + currencies, + actual, + beg, + end + #endmacro + } + + public boolean unpack(container packedClass) { + container base; + boolean ret; + Integer version = runbase::getVersion(packedClass); + + switch (version) { + case #CurrentVersion: + [version, #CurrentList] = packedClass; + return true; + default: + return false; + } + return ret; + } + +## Oracle Rules Language + + //This is a comment + ABORT "You experienced an abort."; + WARN "THIS IS A WARNING"; + CALL "RIDER_X"; + DONE; + FOR EACH X IN CSV_FILE "d:\lodestar\user\d377.lse" + LEAVE FOR; + END FOR; + IF ((BILL_KW = 0) AND (KW > 0)) THEN + END IF; + INCLUDE "R1"; + LEAVE RIDER; + SELECT BILL_PERIOD + WHEN "WINTER" + BLOCK KWH + FROM 0 TO 400 CHARGE $0.03709 + FROM 400 CHARGE $0.03000 + TOTAL $ENERGY_CHARGE_WIN; + WHEN "SUMMER" + $VOLTAGE_DISCOUNT_SUM = $0.00 + OTHERWISE + $VOLTAGE_DISCOUNT_SUM = $1.00 + END SELECT; + /* Report top five peaks */ + LABEL PK.NM "Peak Number"; + SAVE_UPDATE MV TO TABLE "METERVALUE"; + + FOR EACH INX IN ARRAYUPPERBOUND(#MYARRAY[]) + #MYARRAY[INX].VALUE = 2; + CLEAR #MYARRAY[]; + END FOR + + //Interval Data + HNDL_1_ADD_EDI = INTDADDATTRIBUTE(HNDL_1, "EDI_TRANSACTION", EDI_ID); + HNDL_1_ADD_VAL_MSG = INTDADDVMSG(HNDL_1,"Missing (Status Code 9) values found"); + EMPTY_HNDL = INTDCREATEHANDLE('05/03/2006 00:00:00', '05/03/2006 23:59:59', 3600, "Y", "0", " "); + +## 1С + + #Если Клиент Тогда + Перем СимвольныйКодКаталога = "ля-ля-ля"; //комментарий + Функция Сообщить(Знач ТекстСообщения, ТекстСообщения2) Экспорт //комментарий к функции + x=ТекстСообщения+ТекстСообщения2+" + |строка1 + |строка2 + |строка3"; + КонецФункции + #КонецЕсли + + // Процедура ПриНачалеРаботыСистемы + // + Процедура ПриНачалеРаботыСистемы() + Обработки.Помощник.ПолучитьФорму("Форма").Открыть(); + d = '21.01.2008' + КонецПроцедуры + +## AVR Assembler + + ;* Title: Block Copy Routines + ;* Version: 1.1 + + .include "8515def.inc" + + rjmp RESET ;reset handle + + .def flashsize=r16 ;size of block to be copied + + flash2ram: + lpm ;get constant + st Y+,r0 ;store in SRAM and increment Y-pointer + adiw ZL,1 ;increment Z-pointer + dec flashsize + brne flash2ram ;if not end of table, loop more + ret + + .def ramtemp =r1 ;temporary storage register + .def ramsize =r16 ;size of block to be copied + +## VHDL + + /* + * RS-trigger with assynch. reset + */ + + library ieee; + use ieee.std_logic_1164.all; + + entity RS_trigger is + generic (T: Time := 0ns); + port ( R, S : in std_logic; + Q, nQ : out std_logic; + reset, clock : in std_logic ); + end RS_trigger; + + architecture behaviour of RS_trigger is + signal QT: std_logic; -- Q(t) + begin + process(clock, reset) is + subtype RS is std_logic_vector (1 downto 0); + begin + if reset = '0' then + QT <= '0'; + else + if rising_edge(C) then + if not (R'stable(T) and S'stable(T)) then + QT <= 'X'; + else + case RS'(R&S) is + when "01" => QT <= '1'; + when "10" => QT <= '0'; + when "11" => QT <= 'X'; + when others => null; + end case; + end if; + end if; + end if; + end process; + + Q <= QT; + nQ <= not QT; + end architecture behaviour; + +## Parser 3 + + @CLASS + base + + @USE + module.p + + @BASE + class + + # Comment for code + @create[aParam1;aParam2][local1;local2] + ^connect[mysql://host/database?ClientCharset=windows-1251] + ^for[i](1;10){ +

^eval($i+10)

+ ^connect[mysql://host/database]{ + $tab[^table::sql{select * from `table` where a='1'}] + $var_Name[some${value}] + } + } + + ^rem{ + Multiline comment with code: $var + ^while(true){ + ^for[i](1;10){ + ^sleep[] + } + } + } + ^taint[^#0A] + + @GET_base[] + ## Comment for code + # Isn't comment + $result[$.hash_item1[one] $.hash_item2[two]] + +## TeX + + \documentclass{article} + \usepackage[koi8-r]{inputenc} + \hoffset=0pt + \voffset=.3em + \tolerance=400 + \newcommand{\eTiX}{\TeX} + \begin{document} + \section*{Highlight.js} + \begin{table}[c|c] + $\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $ + \end{table} + Ch\'erie, \c{c}a ne me pla\^\i t pas! % comment \b + G\"otterd\"ammerung~45\%=34. + $$ + \int\limits_{0}^{\pi}\frac{4}{x-7}=3 + $$ + \end{document} + +## Haskell + + {-# LANGUAGE TypeSynonymInstances #-} + module Network.UDP + ( DataPacket(..) + , openBoundUDPPort + , openListeningUDPPort + , pingUDPPort + , sendUDPPacketTo + , recvUDPPacket + , recvUDPPacketFrom + ) where + + {- this is a {- nested -} comment -} + + import qualified Data.ByteString as Strict (ByteString, concat, singleton) + import qualified Data.ByteString.Lazy as Lazy (ByteString, toChunks, fromChunks) + import Data.ByteString.Char8 (pack, unpack) + import Network.Socket hiding (sendTo, recv, recvFrom) + import Network.Socket.ByteString (sendTo, recv, recvFrom) + + -- Type class for converting StringLike types to and from strict ByteStrings + class DataPacket a where + toStrictBS :: a -> Strict.ByteString + fromStrictBS :: Strict.ByteString -> a + + instance DataPacket Strict.ByteString where + toStrictBS = id + {-# INLINE toStrictBS #-} + fromStrictBS = id + {-# INLINE fromStrictBS #-} + + openBoundUDPPort :: String -> Int -> IO Socket + openBoundUDPPort uri port = do + s <- getUDPSocket + bindAddr <- inet_addr uri + let a = SockAddrInet (toEnum port) bindAddr + bindSocket s a + return s + + pingUDPPort :: Socket -> SockAddr -> IO () + pingUDPPort s a = sendTo s (Strict.singleton 0) a >> return () + +## Erlang + + -module(ssh_cli). + + -behaviour(ssh_channel). + + -include("ssh.hrl"). + %% backwards compatibility + -export([listen/1, listen/2, listen/3, listen/4, stop/1]). + + %% state + -record(state, { + cm, + channel + }). + + test(Foo)->Foo. + + init([Shell, Exec]) -> + {ok, #state{shell = Shell, exec = Exec}}; + init([Shell]) -> + false = not true, + io:format("Hello, \"~p!~n", [atom_to_list('World')]), + {ok, #state{shell = Shell}}. + + concat([Single]) -> Single; + concat(RList) -> + EpsilonFree = lists:filter( + fun (Element) -> + case Element of + epsilon -> false; + _ -> true + end + end, + RList), + case EpsilonFree of + [Single] -> Single; + Other -> {concat, Other} + end. + + union_dot_union({union, _}=U1, {union, _}=U2) -> + union(lists:flatten( + lists:map( + fun (X1) -> + lists:map( + fun (X2) -> + concat([X1, X2]) + end, + union_to_list(U2) + ) + end, + union_to_list(U1) + ))). + +## Erlang REPL + + 1> Str = "abcd". + "abcd" + 2> L = test:length(Str). + 4 + 3> Descriptor = {L, list_to_atom(Str)}. + {4,abcd} + 4> L. + 4 + 5> b(). + Descriptor = {4,abcd} + L = 4 + Str = "abcd" + ok + 6> f(L). + ok + 7> b(). + Descriptor = {4,abcd} + Str = "abcd" + ok + 8> {L, _} = Descriptor. + {4,abcd} + 9> L. + 4 + 10> 2#101. + 5 + 11> 1.85e+3. + 1850 + +## Rust + + use std; + + import std::io; + export fac, test1; + + 123; // type int + 123u; // type uint + 123_u; // type uint + 0xff00; // type int + 0xff_u8; // type u8 + 0b1111_1111_1001_0000_i32; // type i32 + 123.0; // type float + 0.1; // type float + 3f; // type float + 0.1f32; // type f32 + 12E+99_f64; // type f64 + + /* Factorial */ + fn fac(n: int) -> int { + let s: str = "This is + a multi-line string. + + It ends with an unescaped '\"'."; + let c: char = 'Ф'; + + let result = 1, i = 1; + while i <= n { // No parens around the condition + result *= i; + i += 1; + } + ret result; + } + + pure fn pure_length(ls: list) -> uint { /* ... */ } + + type t = map::hashtbl; + let x = id::(10); + + // Define some modules. + #[path = "foo.rs"] + mod foo; + + iface seq { + fn len() -> uint; + } + + impl of seq for [T] { + fn len() -> uint { vec::len(self) } + fn iter(b: fn(T)) { + for elt in self { b(elt); } + } + } + + enum list { + nil; + cons(T, @list); + } + + let a: list = cons(7, @cons(13, @nil)); + +## Matlab + + n = 20; % number of points + points = [random('unid', 100, n, 1), random('unid', 100, n, 1)]; + len = zeros(1, n - 1); + points = sortrows(points); + %% Initial set of points + plot(points(:,1),points(:,2)); + for i = 1: n-1 + len(i) = points(i + 1, 1) - points(i, 1); + end + while(max(len) > 2 * min(len)) + [d, i] = max(len); + k = on_margin(points, i, d, -1); + m = on_margin(points, i + 1, d, 1); + xm = 0; ym = 0; + %% New point + if(i == 1 || i + 1 == n) + xm = mean(points([i,i+1],1)) + ym = mean(points([i,i+1],2)) + else + [xm, ym] = dlg1(points([k, i, i + 1, m], 1), ... + points([k, i, i + 1, m], 2)) + end + + points = [ points(1:i, :); [xm, ym]; points(i + 1:end, :)]; + end + + function [net] = get_fit_network(inputs, targets) + % Create Network + numHiddenNeurons = 20; % Adjust as desired + net = newfit(inputs,targets,numHiddenNeurons); + net.trainParam.goal = 0.01; + net.trainParam.epochs = 1000; + % Train and Apply Network + [net,tr] = train(net,inputs,targets); + end + + foo_matrix = [1, 2, 3; 4, 5, 6]'''; + foo_cell = {1, 2, 3; 4, 5, 6}''.'.'; + +## R + + library(ggplot2) + + centre <- function(x, type, ...) { + switch(type, + mean = mean(x), + median = median(x), + trimmed = mean(x, trim = .1)) + } + + myVar1 + myVar.2 + data$x + foo "bar" baz + # test "test" + "test # test" + + (123) (1) (10) (0.1) (.2) (1e-7) + (1.2e+7) (2e) (3e+10) (0x0) (0xa) + (0xabcdef1234567890) (123L) (1L) + (0x10L) (10000000L) (1e6L) (1.1L) + (1e-3L) (4123.381E-10i) + (3.) (3.E10) # BUG: .E10 should be part of number + + # Numbers in some different contexts + 1L + 0x40 + .234 + 3. + 1L + 30 + plot(cars, xlim=20) + plot(cars, xlim=0x20) + foo<-30 + my.data.3 <- read() # not a number + c(1,2,3) + 1%%2 + + "this is a quote that spans + multiple lines + \" + + is this still a quote? it should be. + # even still! + + " # now we're done. + + 'same for + single quotes #' + + # keywords + NULL, NA, TRUE, FALSE, Inf, NaN, NA_integer_, + NA_real_, NA_character_, NA_complex_, function, + while, repeat, for, if, in, else, next, break, + ..., ..1, ..2 + + # not keywords + the quick brown fox jumped over the lazy dogs + null na true false inf nan na_integer_ na_real_ + na_character_ na_complex_ Function While Repeat + For If In Else Next Break .. .... "NULL" `NULL` 'NULL' + + # operators + +, -, *, /, %%, ^, >, >=, <, <=, ==, !=, !, &, |, ~, + ->, <-, <<-, $, :, :: + + # infix operator + foo %union% bar + %"test"% + `"test"` + +## Mizar + + ::: ## Lambda calculus + + environ + + vocabularies LAMBDA, + NUMBERS, + NAT_1, XBOOLE_0, SUBSET_1, FINSEQ_1, XXREAL_0, CARD_1, + ARYTM_1, ARYTM_3, TARSKI, RELAT_1, ORDINAL4, FUNCOP_1; + + :: etc... + + begin + + reserve D for DecoratedTree, + p,q,r for FinSequence of NAT, + x for set; + + definition + let D; + + attr D is LambdaTerm-like means + (dom D qua Tree) is finite & + ::> *143,306 + for r st r in dom D holds + r is FinSequence of {0,1} & + r^<*0*> in dom D implies D.r = 0; + end; + + registration + cluster LambdaTerm-like for DecoratedTree of NAT; + existence; + ::> *4 + end; + + definition + mode LambdaTerm is LambdaTerm-like DecoratedTree of NAT; + end; + + ::: Then we extend this ordinary one-step beta reduction, that is, + ::: any subterm is also allowed to reduce. + definition + let M,N; + + pred M beta N means + ex p st + M|p beta_shallow N|p & + for q st not p is_a_prefix_of q holds + [r,x] in M iff [r,x] in N; + end; + + theorem Th4: + ProperPrefixes (v^<*x*>) = ProperPrefixes v \/ {v} + proof + thus ProperPrefixes (v^<*x*>) c= ProperPrefixes v \/ {v} + proof + let y; + assume y in ProperPrefixes (v^<*x*>); + then consider v1 such that + A1: y = v1 and + A2: v1 is_a_proper_prefix_of v^<*x*> by TREES_1:def 2; + v1 is_a_prefix_of v & v1 <> v or v1 = v by A2,TREES_1:9; + then + v1 is_a_proper_prefix_of v or v1 in {v} by TARSKI:def 1,XBOOLE_0:def 8; + then y in ProperPrefixes v or y in {v} by A1,TREES_1:def 2; + hence thesis by XBOOLE_0:def 3; + end; + let y; + assume y in ProperPrefixes v \/ {v}; + then A3: y in ProperPrefixes v or y in {v} by XBOOLE_0:def 3; + A4: now + assume y in ProperPrefixes v; + then consider v1 such that + A5: y = v1 and + A6: v1 is_a_proper_prefix_of v by TREES_1:def 2; + v is_a_prefix_of v^<*x*> by TREES_1:1; + then v1 is_a_proper_prefix_of v^<*x*> by A6,XBOOLE_1:58; + hence thesis by A5,TREES_1:def 2; + end; + v^{} = v by FINSEQ_1:34; + then + v is_a_prefix_of v^<*x*> & v <> v^<*x*> by FINSEQ_1:33,TREES_1:1; + then v is_a_proper_prefix_of v^<*x*> by XBOOLE_0:def 8; + then y in ProperPrefixes v or y = v & v in ProperPrefixes (v^<*x*>) + by A3,TARSKI:def 1,TREES_1:def 2; + hence thesis by A4; + end; diff --git a/docs/02_Examples/index.md b/docs/02_Examples/index.md index b6889cb..18ad171 100644 --- a/docs/02_Examples/index.md +++ b/docs/02_Examples/index.md @@ -1,2 +1,3 @@ ### This is a landing page for the Examples section -Adding a landing page is pretty simple, all you need to do is add an "index.md" file to the related folder. \ No newline at end of file + +Adding a landing page is pretty simple, all you need to do is add an "index.md" file to the related folder. diff --git a/docs/05_Configuration/Confluence_upload.md b/docs/05_Configuration/Confluence_upload.md index 99e0168..81035a5 100644 --- a/docs/05_Configuration/Confluence_upload.md +++ b/docs/05_Configuration/Confluence_upload.md @@ -1,21 +1,23 @@ -__Table of contents__ +**Table of contents** [TOC] ## Configuring the connection + The connection requires three parameters `base_url`, `user` and `pass`. While `user` and `pass` don't really need an explanation, for `base_url` you need to set the path to the server without `rest/api`, this will be added automatically. ```json { - "confluence": { - "base_url": "http://my_confluence_server.com/", - "user" : "my_username", - "pass" : "my_password" - } + "confluence": { + "base_url": "http://my_confluence_server.com/", + "user": "my_username", + "pass": "my_password" + } } ``` ## Where to upload + Now that the connection is defined, you need to tell it where you want your documentation to be uploaded. For that you need a `space_id` (name that appears at the beginning of the urls) and an `ancestor_id`; the id of the page that will be the parent of the documentation's homepage. @@ -24,10 +26,10 @@ You can obtain the `ancestor_id` id by editing the page you want to define as a ```json { - "confluence": { - "space_id": "my_space", - "ancestor_id": 50370632 - } + "confluence": { + "space_id": "my_space", + "ancestor_id": 50370632 + } } ``` @@ -36,20 +38,22 @@ You can also provide a `root_id` instead of an `ancestor_id` in this case, you s You can use that when you're uploading your documentation to the root of a Confluence Space or if your page already exists. ## Prefix + Because confluence can't have two pages with the same name in a space, I recommend you define a prefix for your pages. ```json { - "confluence": { "prefix": "DAUX -" } + "confluence": { "prefix": "DAUX -" } } ``` ## Update threshold + To make the upload quicker, we try to determine if a page changed or not, first with a strict comparison and if it's not completely identical, we compute the difference. ```json { - "confluence": { "update_threshold": 1 } + "confluence": { "update_threshold": 1 } } ``` @@ -59,22 +63,22 @@ By default the threshold is 2%. Setting the value to `0` disables the feature altogether. - ## Delete old pages + When a page is renamed, there is no way to tell it was renamed, so when uploading to Confluence, the page will be uploaded and the old page will stay here. By default, it will inform you that some pages aren't needed anymore and you can delete them by hand. ```json { - "confluence": { "delete": true } + "confluence": { "delete": true } } ``` By setting `delete` to `true` (or running `daux` with the `--delete` flag) you tell the generator that it can safely delete the pages. - ## Information message + When you create your page. there is no indication that the upload process will override the content of the pages. It happens sometimes that users edit the pages to add / fix an information. @@ -83,9 +87,9 @@ You can add a text in a "information" macro on top of the document by setting th ```json { - "confluence": { - "header": "These pages are updated automatically, your changes will be overriden." - } + "confluence": { + "header": "These pages are updated automatically, your changes will be overriden." + } } ``` diff --git a/docs/05_Configuration/Html_export.md b/docs/05_Configuration/Html_export.md index 48c868c..abdfaa3 100644 --- a/docs/05_Configuration/Html_export.md +++ b/docs/05_Configuration/Html_export.md @@ -1,24 +1,26 @@ -__Table of contents__ +**Table of contents** [TOC] ## Analytics ### Google Analytics + This will embed the google analytics tracking code. ```json { - "html": { "google_analytics": "UA-XXXXXXXXX-XX" } + "html": { "google_analytics": "UA-XXXXXXXXX-XX" } } ``` ### Piwik Analytics + This will embed the piwik tracking code. ```json { - "html": { "piwik_analytics": "my-url-for-piwik.com" } + "html": { "piwik_analytics": "my-url-for-piwik.com" } } ``` @@ -26,119 +28,130 @@ You can Also give a specific Piwik ID as well. ```json { - "html": { "piwik_analytics_id": "43" } + "html": { "piwik_analytics_id": "43" } } ``` ### Plausible Analytics + This will embed the https://plausible.io/ tracking code. ```json { - "html": { "plausible_domain": "daux.io" } + "html": { "plausible_domain": "daux.io" } } ``` ## Automatic Table of Contents + You can add a table of contents on each page automatically, read about it [here](../01_Features/Table_of_contents.md) - ## Buttons + You can add buttons to the landing page. ```json { - "html": { - "buttons": { - "My Website": "http://example.com" + "html": { + "buttons": { + "My Website": "http://example.com" + } } - } } ``` ## Breadcrumb titles -Daux.io provides the option to present page titles as breadcrumb navigation. -You can *optionally* specify the separator used for breadcrumbs. + +Daux.io provides the option to present page titles as breadcrumb navigation. +You can _optionally_ specify the separator used for breadcrumbs. ```json { - "html": { - "breadcrumbs": true, - "breadcrumb_separator" : " > " - } + "html": { + "breadcrumbs": true, + "breadcrumb_separator": " > " + } } ``` ## Date Modified -By default, daux.io will display the last modified time as reported by the system underneath the title for each document. + +By default, daux.io will display the last modified time as reported by the system underneath the title for each document. To disable this, change the option in your config.json to `false`. ```json { - "html": { "date_modified": false } + "html": { "date_modified": false } } ``` ## GitHub Repo + Add a 'Fork me on GitHub' ribbon. ```json { - "html": { "repo": "dauxio/daux.io" } + "html": { "repo": "dauxio/daux.io" } } ``` ## Inherit Index + This feature will instructs the navigation generator to seek the first available file to use when there is no index in a folder. ```json { - "html": { "inherit_index": true } + "html": { "inherit_index": true } } ``` ## Jump buttons + You can have previous/next buttons on each page. They can be disabled by setting `jump_buttons` to `false`. ```json { - "html": { "jump_buttons": false } + "html": { "jump_buttons": false } } ``` ## Landing page -The automatic landing page can be disabled through the `auto_landing` option, read about it [here](../01_Features/Landing_page.md) + +The automatic landing page can be disabled through the `auto_landing` option, read about it [here](../01_Features/Landing_page.md) ## Links + Include custom links in the sidebar. ```json { - "html": { - "links": { - "GitHub Repo": "https://github.com/dauxio/daux.io", - "Help/Support/Bugs": "https://github.com/dauxio/daux.io/issues", - "Made by Todaymade": "http://todaymade.com" + "html": { + "links": { + "GitHub Repo": "https://github.com/dauxio/daux.io", + "Help/Support/Bugs": "https://github.com/dauxio/daux.io/issues", + "Made by Todaymade": "http://todaymade.com" + } } - } } ``` ## Search + Daux has an embedded search engine read all about it [here](../01_Features/Search.md) ## Themes + We have 4 built-in Bootstrap themes. To use one of the themes, just set the `theme` option to one of the following: -* daux-blue -* daux-green -* daux-navy -* daux-red +- daux-blue +- daux-green +- daux-navy +- daux-red ```json { - "html": { "theme": "daux-blue" } + "html": { "theme": "daux-blue" } } ``` @@ -146,25 +159,27 @@ To use a custom theme, just copy over the theme folder into the `themes` directo ```json { - "html": { "theme": "new-theme" } + "html": { "theme": "new-theme" } } ``` ## Toggling Code Blocks -Some users might wish to hide the code blocks & view just the documentation. + +Some users might wish to hide the code blocks & view just the documentation. By setting the `toggle_code` property to `true`, you can offer a toggle button on the page. ```json { - "html": { "toggle_code": true } + "html": { "toggle_code": true } } ``` ## Twitter + Include twitter follow buttons in the sidebar. ```json { - "html": { "twitter": ["justin_walsh", "todaymade"] } + "html": { "twitter": ["justin_walsh", "todaymade"] } } ``` diff --git a/docs/05_Configuration/_index.md b/docs/05_Configuration/_index.md index 9b56f01..b0f97fc 100644 --- a/docs/05_Configuration/_index.md +++ b/docs/05_Configuration/_index.md @@ -1,91 +1,100 @@ To customize the look and feel of your documentation, you can create a `config.json` file in the of the `/docs` folder. The `config.json` file is a JSON object that you can use to change some of the basic settings of the documentation. -__Table of contents__ +**Table of contents** [TOC] ### Title + Change the title bar in the docs ```json { - "title": "Daux.io" + "title": "Daux.io" } ``` ### Tagline + Change the tagline bar in the docs ```json { - "tagline": "The Easiest Way To Document Your Project" + "tagline": "The Easiest Way To Document Your Project" } ``` ### Author + Change the documentation's author ```json { - "author": "Stéphane Goetz" + "author": "Stéphane Goetz" } ``` ### Image + An image to show on the landing page. A relative path from the documentation root. ```json { - "image": "image.png" + "image": "image.png" } ``` ### Format + Change the output format. It is recommended you set only formats that support the live mode as this will also be read by the integrated web server. And you set the other formats (like confluence) only by command line ```json { - "format": "html" + "format": "html" } ``` -- __html__ with [its options](./Html_export.md) -- __confluence__ with [its options](./Confluence_upload.md) +- **html** with [its options](./Html_export.md) +- **confluence** with [its options](./Confluence_upload.md) -Available formats are __HTML__ and __Confluence__ +Available formats are **HTML** and **Confluence** ### Ignore + Set custom files and entire folders to ignore within your `/docs` folder. For files make sure to include the file extension in the name. For both files and folders, names are case-sensitive. ```json { - "ignore": { - "files": ["Work_In_Progress.md"], - "folders": ["99_Not_Ready"] - } + "ignore": { + "files": ["Work_In_Progress.md"], + "folders": ["99_Not_Ready"] + } } ``` ### Timezone + If your server does not have a default timezone set in php.ini, it may return errors when it tries to generate the last modified date/time for docs. To fix these errors, specify a timezone in your config file. Valid options are available in the [PHP Manual](http://php.net/manual/en/timezones.php). ```json { - "timezone": "America/Los_Angeles" + "timezone": "America/Los_Angeles" } ``` ### Multi-language + Enables multi-language support which needs separate directories for each language in `docs/` folder. ```json { - "languages": {"en": "English", "de": "German"} + "languages": { "en": "English", "de": "German" } } ``` Directory structure: + ``` ├── docs/ │ ├── _index.md @@ -113,7 +122,7 @@ You can change the default language with the `language` option. ```json { - "language": "fr" + "language": "fr" } ``` @@ -124,27 +133,28 @@ A string that isn't found will fall back to english. ```json { - "strings": { - "fr": { - "CodeBlocks_show": "Afficher le code", - "Search_placeholder": "Rechercher...", - "Link_previous": "Précédent", - "Link_next": "Suivant", - "Edit_on": "Editer sur :name:", - "View_on_github": "Voir sur GitHub", - "View_documentation": "Voir la Documentation" + "strings": { + "fr": { + "CodeBlocks_show": "Afficher le code", + "Search_placeholder": "Rechercher...", + "Link_previous": "Précédent", + "Link_next": "Suivant", + "Edit_on": "Editer sur :name:", + "View_on_github": "Voir sur GitHub", + "View_documentation": "Voir la Documentation" + } } - } } ``` ### Processor + You can set the processor in the documentation or as an option to the command line. If you need it when running the server, you should add it to the configuration. More information on how to create a Processor can be found [here](!For_Developers/Creating_a_Processor). - + ```json { - "processor": "MyProcessor" + "processor": "MyProcessor" } ``` diff --git a/docs/10_For_Developers/Creating_a_Processor.md b/docs/10_For_Developers/Creating_a_Processor.md index 2bf56c1..d5ecc79 100644 --- a/docs/10_For_Developers/Creating_a_Processor.md +++ b/docs/10_For_Developers/Creating_a_Processor.md @@ -7,7 +7,7 @@ The main advantage, is that you can run it with the source or with `daux` indepe Next to your `docs` directory, you can create a `daux` directory that can contain your Processor. The classes must respect the PSR-4 Naming convention. And have `\Todaymade\Daux\Extension` as a base namespace. - + By default, we created a `daux/Processor.php` file to get you started. ## A quick test ? @@ -40,7 +40,7 @@ There are a few methods that you can override to add some By default, Daux.io parses your directory to find pages. but, for a reason or another, you might want to programmatically add some pages. -This can be done with: +This can be done with: ```php public function manipulateTree(Root $root) @@ -65,7 +65,7 @@ Both methods `getOrCreateDir` and `getOrCreatePage` take two parameters : `paren The page will automatically be treated as markdown and converted like a normal page. If you create a new ContentType, like let's say LaTeX, you would set the title `My Page.tex` it will keep the title `My Page` and use your renderer. - + If the extension is not mapped to a Generator, it will simply create the file as-is without manipulation. ### Extend the Markdown Generator @@ -82,9 +82,9 @@ See the details on [CommonMark's website](http://commonmark.thephpleague.com/cus ### Add new generators -You can add new generators to Daux.io and use them right away, they must implement the -`\Todaymade\Daux\Format\Base\Generator` interface and if you want to use the live mode with your generator -you have to implement `\Todaymade\Daux\Format\Base\LiveGenerator`. +You can add new generators to Daux.io and use them right away, they must implement the +`\Todaymade\Daux\Format\Base\Generator` interface and if you want to use the live mode with your generator +you have to implement `\Todaymade\Daux\Format\Base\LiveGenerator`. ```php public function addGenerators() @@ -92,4 +92,3 @@ public function addGenerators() return ['custom_generator' => '\Todaymade\Daux\Extension\MyNewGenerator']; } ``` - diff --git a/docs/10_For_Developers/Creating_a_Theme.md b/docs/10_For_Developers/Creating_a_Theme.md index a8e50b4..09608f7 100644 --- a/docs/10_For_Developers/Creating_a_Theme.md +++ b/docs/10_For_Developers/Creating_a_Theme.md @@ -8,43 +8,45 @@ Here is an example `config.json` file : ```json { - "favicon": "img/favicon.png", - "css": ["css/theme.min.css"], - "js": [], - "fonts": ["https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700&subset=latin,cyrillic-ext,cyrillic"], - "variants": { - "blue": { - "favicon": "img/favicon-blue.png", - "css": ["css/theme-blue.min.css"] - }, - "green": { - "favicon": "img/favicon-green.png", - "css": ["css/theme-green.min.css"] + "favicon": "img/favicon.png", + "css": ["css/theme.min.css"], + "js": [], + "fonts": [ + "https://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700&subset=latin,cyrillic-ext,cyrillic" + ], + "variants": { + "blue": { + "favicon": "img/favicon-blue.png", + "css": ["css/theme-blue.min.css"] + }, + "green": { + "favicon": "img/favicon-green.png", + "css": ["css/theme-green.min.css"] + } } - } } ``` There are five options : -- __`favicon`__: The URL to your favicon -- __`css`__: An array of CSS Stylesheets to add to the page -- __`js`__: An array of JavaScript files to load -- __`fonts`__: An array of Font sources, these are added as stylesheets -- __`variants`__: An object containing sub-themes. Each sub theme, can provide the same configurations as the main theme (`favicon`, `css`, `js`, `fonts`) +- **`favicon`**: The URL to your favicon +- **`css`**: An array of CSS Stylesheets to add to the page +- **`js`**: An array of JavaScript files to load +- **`fonts`**: An array of Font sources, these are added as stylesheets +- **`variants`**: An object containing sub-themes. Each sub theme, can provide the same configurations as the main theme (`favicon`, `css`, `js`, `fonts`) - -You will also notice this `` in the url. +You will also notice this `` in the url. This is automatically substituted with the final url to the theme when generating the final page. There are two possible substitutions : - - __``__: The url to the current theme - - __``__: The url to the documentation root - + +- **``**: The url to the current theme +- **``**: The url to the documentation root + ## Theme variants - + Like the default Daux.io theme, you might want to provide variants of your theme. - + In the example before, there were two variants : blue and green. The configuration of a variant is added to the configuration of the main theme, it doesn't replace it. @@ -63,10 +65,10 @@ Change the `theme` option inside `html` ```json { - "themes_directory": "/home/user/themes", - "html": { - "theme": "{theme}-{variant}" - } + "themes_directory": "/home/user/themes", + "html": { + "theme": "{theme}-{variant}" + } } ``` @@ -85,11 +87,12 @@ You can create a folder named `templates` in your theme, copy-paste the original You can even do it one template at a time if you wish to do only small changes. By default, we have the following templates : -- `content.php`: The content page. -- `home.php`: The landing page. -- `error.php`: The page to show when a page is not found or some other error happened. -- `partials/navbar_content.php`: The content of the top navigation bar. -- `partials/google_analytics.php`: The script to load Google Analytics. -- `partials/piwik_analytics.php`: The script to load Piwik Analytics. -- `layout/00_layout.php`: The master template, containing the `` tag. -- `layout/05_page.php`: The page layout, with left navigation. + +- `content.php`: The content page. +- `home.php`: The landing page. +- `error.php`: The page to show when a page is not found or some other error happened. +- `partials/navbar_content.php`: The content of the top navigation bar. +- `partials/google_analytics.php`: The script to load Google Analytics. +- `partials/piwik_analytics.php`: The script to load Piwik Analytics. +- `layout/00_layout.php`: The master template, containing the `` tag. +- `layout/05_page.php`: The page layout, with left navigation. diff --git a/docs/_index.md b/docs/_index.md index 344331b..87a9ca7 100644 --- a/docs/_index.md +++ b/docs/_index.md @@ -13,37 +13,37 @@ #### For Authors -* [Auto Generated Navigation / Page sorting](01_Features/Navigation_and_Sorting.md) -* [Internal documentation links](01_Features/Internal_links.md) -* [CommonMark compliant](01_Features/CommonMark_compliant.md) -* [Auto created homepage/landing page](01_Features/Landing_page.md) -* [Multiple Output Formats](01_Features/Multiple_Output_Formats.md) -* [Multiple Languages Support](01_Features/Multilanguage.md) -* [No Build Step](01_Features/Live_mode.md) -* [Static Output Generation](01_Features/Static_Site_Generation.md) -* [Table of Contents](01_Features/Table_of_contents.md) +- [Auto Generated Navigation / Page sorting](01_Features/Navigation_and_Sorting.md) +- [Internal documentation links](01_Features/Internal_links.md) +- [CommonMark compliant](01_Features/CommonMark_compliant.md) +- [Auto created homepage/landing page](01_Features/Landing_page.md) +- [Multiple Output Formats](01_Features/Multiple_Output_Formats.md) +- [Multiple Languages Support](01_Features/Multilanguage.md) +- [No Build Step](01_Features/Live_mode.md) +- [Static Output Generation](01_Features/Static_Site_Generation.md) +- [Table of Contents](01_Features/Table_of_contents.md)
#### For Developers -* [Auto Syntax Highlighting](01_Features/Auto_Syntax_Highlight.md) -* [Extend Daux.io with Processors](01_For_Developers/Creating_a_Processor.md) -* Full access to the internal API to create new pages programatically -* Work with pages metadata +- [Auto Syntax Highlighting](01_Features/Auto_Syntax_Highlight.md) +- [Extend Daux.io with Processors](01_For_Developers/Creating_a_Processor.md) +- Full access to the internal API to create new pages programatically +- Work with pages metadata
#### For Marketing -* 100% Mobile Responsive -* 4 Built-In Themes or roll your own -* Functional, Flat Design Style -* Optional code float layout -* Shareable/Linkable SEO Friendly URLs -* Supports Google Analytics and Piwik Analytics +- 100% Mobile Responsive +- 4 Built-In Themes or roll your own +- Functional, Flat Design Style +- Optional code float layout +- Shareable/Linkable SEO Friendly URLs +- Supports Google Analytics and Piwik Analytics
@@ -52,7 +52,7 @@ ### Installation and usage -If you have __PHP__ and Composer installed +If you have **PHP** and Composer installed ```bash composer global require daux/daux.io @@ -61,7 +61,7 @@ composer global require daux/daux.io daux generate ``` -Or if you wish to use __Docker__ +Or if you wish to use **Docker** ```bash # Next to your `docs` folder, run