forked from ltearno/formations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
293 changed files
with
30,542 additions
and
8 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# top-most editorconfig file | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
indent_size = 2 | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
test/*.html | ||
test/reveal.js/ |
130 changes: 130 additions & 0 deletions
130
formation-kubernetes/asciidoctor-reveal.js/HACKING.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
= HACKING asciidoctor-reveal.js | ||
:toc: preamble | ||
:toclevels: 2 | ||
|
||
Short instructions that aim to help potential contributors. | ||
|
||
== Inspect the template system | ||
|
||
|
||
To understand what you have access to in templates you can inject some ruby. | ||
With the slim templating system, this is done by prepending the lines with a dash (`-`) and inserting a ruby statement. | ||
Two complementary approaches can be used to explore the context offered by asciidoctor through the template system: | ||
|
||
* logging on the command line via print-like statements | ||
* jump into the context through an interactive debugger | ||
|
||
=== Print debugging information | ||
|
||
For example to see which attributes are available, you can print them by adding these lines in the `.slim` file of interest: | ||
|
||
---- | ||
- puts @document.attributes.inspect | ||
- puts @attributes.inspect | ||
- puts @document.methods | ||
---- | ||
|
||
Other generally useful ruby specific introspection: | ||
|
||
---- | ||
- puts instance_variables | ||
- puts local_variables | ||
---- | ||
|
||
One might find `pp` to produce better output (and in some cases not): | ||
|
||
---- | ||
- require 'pp' | ||
- pp @document.attributes | ||
---- | ||
|
||
=== Interactively debug a template | ||
|
||
Pry is a powerful debugger for ruby that features tab-completion. | ||
It is very useful to discover a complex object hierarchy like what asciidoctor offers. | ||
|
||
==== Initial Setup | ||
|
||
gem install pry | ||
|
||
==== Usage | ||
|
||
In order to be dropped into the debugger at a specific point in a template simply add the following two lines in the relevant `.slim` template file: | ||
|
||
---- | ||
- require 'pry' | ||
- binding.pry | ||
---- | ||
|
||
Then run asciidoctor from the command-line to generate your document and you'll be dropped in the debugger: | ||
|
||
---- | ||
$ make | ||
asciidoctor -T templates/slim -b revealjs test/level-sections.adoc | ||
asciidoctor: WARNING: level-sections.adoc: line 29: section title out of sequence: expected level 2, got level 3 | ||
From: /home/olivier/src/asciidoc/asciidoctor-reveal.js/templates/slim/section.html.slim @ line 3 : | ||
1: - hide_title = (title = self.title) == '!' | ||
2: - require 'pry' | ||
=> 3: - binding.pry | ||
4: / parent section of vertical slides set | ||
5: - if @level == 1 && !(subsections = sections).empty? | ||
6: section | ||
7: section id=(hide_title ? nil : @id) data-transition=(attr 'data-transition') data-transition-speed=(attr 'data-transition-speed') data-background=(attr 'data-background') data-background-size=(attr 'data-background-size') data-background-repeat=(attr 'data-background-repeat') data-background-transition=(attr 'data-background-transition') | ||
8: - unless hide_title | ||
[1] pry(#<Asciidoctor::Section>)> | ||
---- | ||
|
||
Then using commands like the following allows you to explore interactively asciidoctor's API and object model with syntax highlighting: | ||
|
||
[1] pry(#<Asciidoctor::Section>)> @document | ||
|
||
You can also query asciidoctor's documentation: | ||
|
||
[4] pry(#<Asciidoctor::Section>)> ? find_by | ||
|
||
=== References | ||
|
||
* https://github.com/asciidoctor/asciidoctor.org/issues/80#issuecomment-145698579 | ||
* http://pryrepl.org/ | ||
* http://discuss.asciidoctor.org/Interactively-debugging-a-template-with-a-REPL-td4498.html | ||
|
||
== Tests | ||
|
||
In order to help troubleshoot issues and test syntax improvements, some minimalist asciidoc test files are provided. | ||
You can render the tests files and then load them in a browser and check if `asciidoctor-reveal.js` behaves as expected. | ||
|
||
=== Initial Setup | ||
|
||
cd test/ | ||
git clone https://github.com/hakimel/reveal.js.git | ||
|
||
=== Render tests into .html | ||
|
||
From the project's root directory: | ||
|
||
make | ||
|
||
=== Open rendered files | ||
|
||
You can open the generated `.html` in a Web browser. | ||
For convenience the following command will open the last modified file: | ||
|
||
make open | ||
|
||
Additionally, if you want to test with a minimalist web server: | ||
|
||
make serve | ||
|
||
The server is running in the foreground and needs `Ctrl-C` to be killed. | ||
|
||
== Jade templates | ||
|
||
Jade templates are used by AsciidocFX. Since they are separate they might be | ||
out of sync with our asciidoctor's slim templates. | ||
|
||
To test the jade templates, install AsciidocFX and copy the jade templates | ||
over to AsciidocFX's `conf/slide/templates/revealjs/` directory. Then use | ||
AsciidocFX to render the slides. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.The MIT License | ||
.... | ||
Copyright (C) 2012-2016 Olivier Bilodeau, Charles Moulliard, Dan Allen and the Asciidoctor Project | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Makefile for asciidoc based presentation | ||
|
||
TESTS=$(wildcard test/*.adoc) | ||
MOST_RECENT=$(shell ls -t test/*.html | head -1) | ||
|
||
default: $(patsubst %.adoc,%.html,$(TESTS)) | ||
|
||
%.html: %.adoc | ||
asciidoctor -T templates/slim -b revealjs $< | ||
|
||
open: | ||
"$(shell which xdg-open || which open || which x-www-browser)" $(MOST_RECENT) | ||
|
||
clean: | ||
rm -f test/*.html | ||
|
||
serve: | ||
"$(shell which xdg-open || which open || which x-www-browser)" \ | ||
http://localhost:8000/$(MOST_RECENT) | ||
python2 -m SimpleHTTPServer 8000 |
Oops, something went wrong.