Skip to content

Commit e61d336

Browse files
committed
🎨 Consolidate examples files
1 parent 762b0a1 commit e61d336

File tree

6 files changed

+22
-35
lines changed

6 files changed

+22
-35
lines changed

examples/asciidoctor_example.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<!DOCTYPE html>
2-
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
2+
<html lang="en">
33
<head>
4-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4+
<meta charset="utf-8">
55
<title>Asciidoctor in JavaScript powered by Opal</title>
66
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
77
<link rel="stylesheet" href="../css/asciidoctor.css">
88
</head>
99
<body>
1010
<div id="content"></div>
11-
<script src="../asciidoctor.js"></script>
11+
<script src="../asciidoctor-browser.js"></script>
1212
<script>
13-
// Instantiate Asciidoctor.js
14-
Asciidoctor();
13+
var asciidoctor = Asciidoctor()
14+
var timings = asciidoctor.Timings.create()
15+
var html = asciidoctor.convert('include::README.adoc[]', {safe: 'safe', attributes: ['showtitle', 'icons!', 'toc!', 'sectanchors', 'imagesdir=images'], 'timings': timings})
16+
timings.printReport()
17+
document.getElementById('content').innerHTML = html
1518
</script>
16-
<script src="asciidoctor_example.js"></script>
1719
</body>
1820
</html>

examples/asciidoctor_example.rb

Lines changed: 0 additions & 13 deletions
This file was deleted.

examples/basic.html

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
<html>
1+
<!DOCTYPE html>
2+
<html lang="en">
23
<head>
3-
<script src="../asciidoctor.js"></script>
4+
<meta charset="utf-8">
5+
<title>Asciidoctor in JavaScript powered by Opal</title>
6+
<script src="../asciidoctor-browser.js"></script>
47
</head>
5-
68
<body>
79
<h2>Raw content</h2>
810
<code id="raw">http://asciidoctor.org[*Asciidoctor*] running on http://opalrb.org[_Opal_] brings AsciiDoc to the browser!</code>
911
<h2>Rendered content</h2>
1012
<div id="target"></div>
1113
<script>
12-
var content = document.getElementById('raw').textContent;
13-
var asciidoctor = Asciidoctor();
14-
var html = asciidoctor.convert(content, {doctype: 'inline'});
15-
document.getElementById('target').innerHTML = html;
14+
var content = document.getElementById('raw').textContent
15+
var asciidoctor = Asciidoctor()
16+
var html = asciidoctor.convert(content, { doctype: 'inline' })
17+
document.getElementById('target').innerHTML = html
1618
</script>
1719
</body>
1820
</html>

examples/userguide_test.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
<!DOCTYPE html>
2-
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
2+
<html lang="en">
33
<head>
4-
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4+
<meta charset="utf-8">
55
<title>Asciidoctor in JavaScript powered by Opal</title>
66
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
77
<link rel="stylesheet" href="../css/asciidoctor.css">
88
</head>
99
<body>
1010
<div id="content"></div>
11-
<script src="../asciidoctor.js"></script>
11+
<script src="../asciidoctor-browser.js"></script>
1212
<script>
13-
// Instantiate Asciidoctor.js
14-
Asciidoctor();
13+
Asciidoctor()
1514
</script>
1615
<script src="userguide_test.js"></script>
1716
</body>

examples/userguide_test.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
$global.addEventListener 'DOMContentLoaded', proc {
77
base_dir = File.dirname $global.window.location.href
88
ENV['HOME'] = base_dir
9-
timings = Asciidoctor::Timings.new
10-
html = Asciidoctor.convert data, :safe => :safe, :attributes => %w(showtitle icons! toc! sectanchors imagesdir=images), :timings => timings
11-
timings.print_report
9+
html = Asciidoctor.convert data, :safe => :safe, :attributes => %w(showtitle icons! toc! sectanchors imagesdir=images)
1210
$global.document.getElementById('content').innerHTML = html
1311
}, false

tasks/examples.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const compileExamples = () => {
1818
opalBuilder.appendPaths('node_modules/opal-compiler/src/stdlib')
1919
opalBuilder.appendPaths('lib')
2020

21-
fs.writeFileSync(path.join(builder.examplesBuildDir, 'asciidoctor_example.js'), opalBuilder.build('examples/asciidoctor_example.rb').toString(), 'utf8')
2221
fs.writeFileSync(path.join(builder.examplesBuildDir, 'userguide_test.js'), opalBuilder.build('examples/userguide_test.rb').toString(), 'utf8')
2322
}
2423

0 commit comments

Comments
 (0)