Skip to content

Commit ada89a3

Browse files
jpschorrrchowell
authored andcommitted
Convert specification to AsciiDoc format (from LaTeX) (#30)
- Mostly a straight conversion (typos, phrasings, bugs, and all) - Some minor re-arrangement in order to regularize the presentation of examples, and specify the grammars in actual EBNF - There are almost certainly transcription errors... - Builds both PDF and HTML output - PDF theming has had a bit of work on it - HTML theme/style is the AsciiDoc default; could use work
1 parent 644cb32 commit ada89a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+4647
-4415
lines changed

.gitignore

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/.vscode/
22

3-
*.tex-e
4-
*.log
5-
*.pdf
6-
*.aux
7-
*.out
8-
*.gz
9-
*.fls
10-
*.toc
11-
*.fdb_latexmk
3+
# build
4+
build
5+
6+
# environment assets
7+
fonts
8+
9+
# ruby stuff
10+
.ruby-version
11+
.ruby-gemset
12+
Gemfile.lock

Gemfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'rake'
4+
5+
gem 'asciidoctor'
6+
gem 'asciidoctor-pdf'
7+
gem 'asciidoctor-mathematical'
8+
gem 'prawn'
9+
gem 'prawn-table', github: 'prawnpdf/prawn-table'
10+
gem 'prawn-svg'
11+
12+
gem 'pygments.rb'
13+
14+
gem 'rghost'
15+
16+
gem 'guard'
17+
gem 'guard-shell'
18+
19+
gem 'pry'
20+
gem 'pry-byebug'

Guardfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://asciidoctor.org/docs/editing-asciidoc-with-live-preview/
2+
3+
Bundler.require :default
4+
5+
guard 'shell' do
6+
watch(/^.*\.adoc$/) {|m|
7+
`bundle exec rake spec:build`
8+
}
9+
watch(/^images\/.*$/) {|m|
10+
`bundle exec rake spec:build`
11+
}
12+
watch(/^hello-aws\/.*\.adoc$/) {|m|
13+
`bundle exec rake spec:build`
14+
}
15+
watch(/^.*\.yml$/) {|m|
16+
`bundle exec rake spec:build`
17+
}
18+
watch(/^themes\/.*\.yml$/) {|m|
19+
`bundle exec rake spec:build`
20+
}
21+
end

Makefile

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

README.adoc

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
= PartiQL Language Specification
2+
3+
This is the link:https://asciidoc.org/[AsciiDoc] source for the link:https://partiql.org/[PartiQL] specification.
4+
5+
== Editing
6+
7+
AsciiDoc is supported by link:https://docs.asciidoctor.org/asciidoctor/latest/tooling[major repository hosting providers and many IDEs].
8+
9+
== How to Build the Spec
10+
11+
=== Pre-requisites
12+
13+
1. Install link:https://github.com/rbenv/rbenv#installation[rbenv]
14+
+
15+
[source, shell]
16+
.terminal
17+
```
18+
brew install rbenv
19+
rbenv init
20+
```
21+
22+
2. Install the latest version of ruby
23+
+
24+
[source, shell]
25+
.terminal
26+
```
27+
rbenv install $(rbenv install -l | grep -v - | tail -1)
28+
```
29+
30+
3. Install rbenv shell integration (replace .zshrc with .bash_profile if you use bash)
31+
+
32+
[source,shell]
33+
.terminal
34+
```
35+
echo "\n# rbenv integration" >> ~/.zshrc
36+
echo "eval \"\$(rbenv init -)\"" >> ~/.zshrc
37+
source ~/.zshrc
38+
```
39+
40+
4. Install Vollkorn & Iosevka fonts (Open Font License)
41+
+
42+
[source,shell]
43+
.terminal
44+
```
45+
mkdir fonts
46+
curl -L -o fonts/vollkorn.zip http://vollkorn-typeface.com/download/vollkorn-4-105.zip
47+
unzip fonts/vollkorn.zip -d fonts/vollkorn
48+
curl -L -o fonts/iosevka.zip https://github.com/be5invis/Iosevka/releases/download/v16.0.2/ttf-iosevka-term-slab-16.0.2.zip
49+
unzip fonts/iosevka.zip -d fonts/iosevka
50+
51+
```
52+
53+
5. Install fonts and such needed by AsciiMath
54+
+
55+
[source,shell]
56+
.terminal
57+
```
58+
brew tap homebrew/cask-fonts
59+
brew install glib gdk-pixbuf cairo pango cmake font-computer-modern
60+
61+
cd ~/Library/Fonts
62+
curl -LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmex10.ttf \
63+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmmi10.ttf \
64+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmr10.ttf \
65+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/cmsy10.ttf \
66+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/esint10.ttf \
67+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/eufm10.ttf \
68+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msam10.ttf \
69+
-LO http://mirrors.ctan.org/fonts/cm/ps-type1/bakoma/ttf/msbm10.ttf
70+
71+
```
72+
73+
=== Setup
74+
75+
Set the spec to use the latest ruby, and install required gems
76+
77+
[source, shell]
78+
.terminal
79+
```
80+
cd <spec>
81+
rbenv local $(rbenv install -l | grep -v - | tail -1)
82+
bundle install
83+
```
84+
85+
=== Building
86+
87+
Output will be built to
88+
- build/PartiQL-Specification.html
89+
- build/PartiQL-Specification.pdf
90+
91+
To watch sources for changes and auto-rebuild `HTML` and quick `PDF`
92+
[sourc,shell]
93+
.terminal
94+
```
95+
bundle exec rake spec:watch
96+
```
97+
98+
99+
To build `HTML` and optimized `PDF`
100+
[sourc,shell]
101+
.terminal
102+
```
103+
bundle exec rake
104+
```
105+
106+
107+
108+
109+
= License
110+
111+
This library is licensed under the link:LICENSE[PartiQL Specification License].

Rakefile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version_string = `git describe --tag | cut -d "-" -f 1,2 | tr - .`.chomp
2+
if version_string.empty?
3+
version_string = '0'
4+
end
5+
date_string = Time.now.strftime("%Y-%m-%d")
6+
params = "--attribute revnumber='#{version_string}' --attribute revdate='#{date_string}'"
7+
8+
image_files = Rake::FileList.new("src/images/*.png", "src/images/*.svg") do |fl|
9+
fl.exclude("~*")
10+
fl.exclude(/^scratch\//)
11+
end
12+
13+
namespace :spec do
14+
directory 'build/images'
15+
16+
desc 'copy images to build dir'
17+
task :images => 'build/images'
18+
19+
image_files.each do |source|
20+
target = source.sub(/^src\/images/, 'build/images')
21+
file target => source do
22+
cp source, target, :verbose => true
23+
`pngquant -f #{target}`
24+
end
25+
desc "copies all data files"
26+
task :images => target
27+
end
28+
29+
task :prereqs => [:images]
30+
31+
desc 'build basic spec formats'
32+
task :html => :prereqs do
33+
begin
34+
puts "Converting to HTML..."
35+
`bundle exec asciidoctor -b html5 #{params} src/main.adoc -o build/PartiQL-Specification.html`
36+
end
37+
end
38+
39+
task :pdf => :prereqs do
40+
begin
41+
theming = "-a pdf-themesdir=src/themes -a pdf-theme=basic -a pdf-fontsdir=fonts"
42+
stem = "-r asciidoctor-mathematical -a mathematical-format=svg"
43+
pdf_params = "-a compress"
44+
puts "Converting to PDF..."
45+
`bundle exec asciidoctor-pdf -v #{params} #{theming} #{stem} #{pdf_params} src/main.adoc -o build/PartiQL-Specification.pdf --trace`
46+
end
47+
end
48+
49+
task :build => [:html, :pdf]
50+
51+
task :watch do
52+
begin
53+
`bundle exec guard`
54+
end
55+
end
56+
57+
require 'rake/clean'
58+
CLEAN.include('build/*')
59+
CLOBBER.include('build/*')
60+
end
61+
62+
task :default => "spec:build"

0 commit comments

Comments
 (0)