Revert "New build system for documentation."
This reverts commit 178bba3b52
.
This commit is contained in:
parent
ab74074e3f
commit
ac92ade0dc
123
README.md
123
README.md
@ -1,7 +1,10 @@
|
||||
|
||||
# The Ardour Manual
|
||||
|
||||
This is the project that generates the static ardour manual website available at [manual.ardour.org](http://manual.ardour.org). The site is built using python 3.
|
||||
|
||||
This is the project that generates the static ardour manual website available at [manual.ardour.org](http://manual.ardour.org).
|
||||
|
||||
The site is built using ruby (I use 1.9[.3]) and [liquid](http://liquidmarkup.org/), a ruby gem.
|
||||
|
||||
### Get the code
|
||||
|
||||
@ -12,45 +15,80 @@ This is the project that generates the static ardour manual website available at
|
||||
|
||||
There are 2 different types of content:
|
||||
|
||||
- a master document which describes the overall structure of the manual
|
||||
- normal content, which is described in the master document
|
||||
- special `_manual` content
|
||||
- normal content
|
||||
|
||||
### The Master Document
|
||||
### Special `_manual` content
|
||||
|
||||
This is a text file (master-doc.txt) which describes the structure of the manual. It does this
|
||||
through headers which tell the build script where the content lives, what its
|
||||
relationship to the overall structure is, as well as a few other things.
|
||||
This is content that ends up as part of the tree on the left.
|
||||
|
||||
All headers have a similar structure, and have to have at least the following
|
||||
minimal structure:
|
||||
The _raw_ content is in `_manual/` directory and has a naming convention as follows:
|
||||
|
||||
---
|
||||
title: Some Wordy and Expressive Title
|
||||
part: part
|
||||
---
|
||||
# content for a page at http://manual.ardour.org/<slug>/
|
||||
|
||||
Keywords that go into the header are of the form:
|
||||
|
||||
keyword: value
|
||||
|
||||
Here are the keywords you can put in, and a brief description of what they do:
|
||||
<ordering>_<slug>.<html|md|textile>
|
||||
^ ^ ^
|
||||
| | |
|
||||
| | extension is removed later
|
||||
| |
|
||||
| ends up as part of URL
|
||||
|
|
||||
only used for ordering
|
||||
|
||||
|
||||
| Keyword | Meaning |
|
||||
| ------- | -------- |
|
||||
| title | Sets the title for the content that follows |
|
||||
| menu_title | Sets the title for the content that follows which will appear in the menu link sidebar. If this is not specified, it defaults to the value of the `title` keyword |
|
||||
| part | Sets the hierarchy for the content that follows. It must be one of the following (listed in order of lowering hierarchy): part, chapter, subchapter, section, subsection. |
|
||||
| link | Sets the unbreakable link to the content that follows. Links in the *content* should be prefixed with a double at-sign (@@) to tell the build system that the link is an internal one |
|
||||
| include | Tells the build system that the content lives in an external file; these normally live in the `include/` directory. Note that the filename should **not** be prefixed with `include/` |
|
||||
| exclude | Tells the `implode` and `explode` scripts that file referred to by the `include` keyword should be ignored. Note that the value of this keyword is ignored |
|
||||
| style | Sets an alternate CSS stylesheet; the name should match the one referred to (sans the `.css` suffix) in the `source/css` directory |
|
||||
# a folder for subcontent is like this
|
||||
|
||||
<ordering>_<slug>/
|
||||
|
||||
# more things can then go in here for http://manual.ardour.org/<slug>/<slug2>/
|
||||
|
||||
<ordering>_<slug>/<ordering2>_<slug2>.html
|
||||
|
||||
So, for example:
|
||||
|
||||
|
||||
| this file | appears at url |
|
||||
|--------------------------------------------------------|
|
||||
| _manual/01_main.html | /main/ |
|
||||
| _manual/01_main/01_subpage.html | /main/subpage/ |
|
||||
|
||||
|
||||
### Normal content
|
||||
|
||||
Manual content goes into the `include/` directory (or in the Master Document itself); and consists of normal HTML, sans the usual headers that is normally seen in regular HTML web pages. Any other content, such as css files, images, files and fixed pages goes into the `source/` directory.
|
||||
This is anything else, css files, images, fixed pages, layouts. This content lives in the `source` directory.
|
||||
|
||||
If you added `source/images/horse.png` is would be available at the url `/images/horse.png` after publishing it.
|
||||
|
||||
Content processing is applied to normal content if it has the correct header as described below.
|
||||
|
||||
|
||||
## Content processing
|
||||
|
||||
Three types of content can have special processing done.
|
||||
|
||||
- `.html` liquid/HTML files
|
||||
- `.md` markdown files
|
||||
- `.textile` textile files
|
||||
|
||||
All files to be processed should also have a special header at the top too:
|
||||
|
||||
---
|
||||
layout: default
|
||||
title: Some Very Wordy and Expressive Title
|
||||
menu_title: Some Title
|
||||
---
|
||||
|
||||
<p>My Actual Content</p>
|
||||
|
||||
The `title` field will end up as an `h1` in the right panel. The `menu_title` is what is used in the menu tree on the left (if not preset it will default to using `title`).
|
||||
|
||||
### `.html` files
|
||||
|
||||
These are almost normal html, but extended with [Liquid templates](http://liquidmarkup.org/). There are a couple of special tags created for this project.
|
||||
|
||||
- `{% tree %}` is what shows the manual structure in the left column
|
||||
- `{% children %}` shows the immediate list of children for a page
|
||||
|
||||
Adding `source/images/horse.png` makes it available at the url `/images/horse.png` after publishing it; things work similarly for `source/files/` and `source/css/`.
|
||||
|
||||
## More Advanced Stuff
|
||||
|
||||
@ -60,20 +98,21 @@ notes just in case you decide to anyway.
|
||||
### Run it locally
|
||||
|
||||
You may want the manual available on a machine that doesn't have constant
|
||||
internet access. You will need `git`, and `python` installed.
|
||||
internet access. You will need `git`, `ruby`, and the ruby gem `liquid` installed.
|
||||
|
||||
1. Download code and build manual
|
||||
|
||||
```
|
||||
git clone <repo-url> ardour-manual
|
||||
cd ardour-manual
|
||||
./build.py
|
||||
cp -r source _site
|
||||
ruby ./build.rb
|
||||
chmod -R a+rx _site
|
||||
```
|
||||
|
||||
2. open `ardour-manual/website/index.html` in your favorite web browser
|
||||
2. open `ardour-manual/_site/index.html` in your favorite web browser
|
||||
|
||||
If this page doesn't open and function correctly, follow these optional steps to serve up the page with nginx.
|
||||
N.B.: Step 2 will *never* work; you *must* install nginx if you want to see it!
|
||||
|
||||
3. Install [nginx](http://wiki.nginx.org/Install)
|
||||
4. Configure nginx server block in `/etc/nginx/sites-available/default`
|
||||
@ -83,7 +122,7 @@ internet access. You will need `git`, and `python` installed.
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
root ...path_to_.../ardour-manual/website;
|
||||
root ...path_to_.../ardour-manual/_site;
|
||||
index index.html;
|
||||
}
|
||||
```
|
||||
@ -94,8 +133,20 @@ internet access. You will need `git`, and `python` installed.
|
||||
|
||||
6. The manual will now be available at http://localhost
|
||||
|
||||
### Helper scripts: `implode` and `explode`
|
||||
### manual.rb plugin
|
||||
|
||||
Much of the functionality comes from `_plugins/manual.rb` - it takes the _manual format_ (contained in `_manual/`) and mushes it around a bit into a tmp directory.
|
||||
|
||||
This is to enable the directory tree to be understood, child page lists to be constructed, clean URLs, and the correct ordering of pages maintained.
|
||||
|
||||
### Clean URLs
|
||||
|
||||
To allow the clean URLs (no `.html` extension) _and_ to support simple hosting (no `.htaccess` or apache configuration required) each page ends up in it's own directory with an `index.html` page for the content.
|
||||
|
||||
E.g. `02_main/05_more/02_blah.html` after all processing is complete would end up in `_site/main/more/blah/index.html`.
|
||||
|
||||
The page format contained in the `_manual/` directory is different to the final rendered output (see special `_manual` content above) to make it simple to create content (you don't need to think about the `index.html` files).
|
||||
|
||||
|
||||
The `implode` and `explode` scripts exist in order to accomodate different working styles. `implode` takes all the files referenced by the `include` keywords in the headers in the Master Document and automagically puts them into the Master Document in their proper places. Note that any header that has an `exclude` keyword will remain in the `include/` directory. `explode` does the inverse of `implode`; it takes all the content in the Master Document and blows it into individual files in the `include/` directory. Filenames are automagically derived from the value of the `title` keyword.
|
||||
|
||||
|
||||
|
38
STYLE_GUIDE
38
STYLE_GUIDE
@ -114,9 +114,9 @@ is renamed or moved to another sub-directory, links should be ok.
|
||||
<dfn>
|
||||
encloses a newly introduced term that is being explained. Use for the first
|
||||
occurrence of the main concept of every manual page, or the first occurrence
|
||||
of a new concept after a sub-heading if necessary. Renders in bold face. Keep
|
||||
in mind that <dfn> tags might be used to generate an index of keywords--don't
|
||||
pollute it too much.
|
||||
of a new concept after a sub-heading if necessary. Renders in bold face.
|
||||
Keep in mind that <dfn> tags might be used to generate an index of keywords
|
||||
- don't pollute it too much.
|
||||
|
||||
<abbr>
|
||||
is used to explain an abbreviation such as <abbr title="Linux Audio
|
||||
@ -124,7 +124,7 @@ Developers Simple Plugin API">LADSPA</abbr>. Browsers will usually pop up the
|
||||
definition when the user hovers over the word. Renders as dotted underlined
|
||||
in most browsers.
|
||||
On each page, use only for the first occurrence of every abbreviation. Avoid
|
||||
a redundant explanation in the text--the expansion can easily be extracted
|
||||
a redundant explanation in the text - the expansion can easily be extracted
|
||||
via CSS for printing.
|
||||
Use only in the text body, not in headings.
|
||||
|
||||
@ -138,7 +138,6 @@ is used to strongly emphasize a word. Commonly rendered in bold.
|
||||
See above for usage.
|
||||
|
||||
<br />
|
||||
Most of the time, these should be avoided, and used very infrequently.
|
||||
A line-break can sometimes be used to structure a paragraph, or to split a
|
||||
longish heading. Never use spurious <br/>s at the end of paragraphs or to
|
||||
control the spacing of sections. If you're unhappy with those, fix the CSS
|
||||
@ -192,9 +191,6 @@ So if you want the user to press Ctrl-N on Linux, that's actually <kbd
|
||||
class="mod1">N</kbd>. It will render as "Ctrl N" for you, and as "Cmd N" for
|
||||
your Mac-using friend. Nice, uh?
|
||||
|
||||
N.B.: If you want to have just the name of the modifier key by itself, use
|
||||
<kbd class="mod1>‌</kbd> (zero-width non-joiner).
|
||||
|
||||
For anything you want the user to type, use <kbd> as a block-level element.
|
||||
See above for other <kbd> classes to denote menu items, selections, mouse
|
||||
events and controller actions.
|
||||
@ -231,8 +227,7 @@ descriptive 'alt="A short textual description of the image content"'
|
||||
element.
|
||||
Images are usually placed as block-level elements, i.e. outside of a
|
||||
paragraph, unless they are no higher than one row and make sense in the text
|
||||
flow. Aside from this exception, they should *always* be wrapped inside of a
|
||||
<p></p> block.
|
||||
flow.
|
||||
|
||||
5. Other conventions
|
||||
====================
|
||||
@ -245,27 +240,21 @@ flow. Aside from this exception, they should *always* be wrapped inside of a
|
||||
kind of subtle inflection, use semantic markup instead.
|
||||
* The hyphen is used to for compound words such as this well-advised example.
|
||||
* Do not hyphenate words at line breaks.
|
||||
* For breaks in thought—such as this splendid example—use
|
||||
the long em-dash. Note that the em-dash is snugged up against the text on both
|
||||
sides--this is the proper way to use them.
|
||||
* For ranges of values, use the en-dash: Monday–Friday, 0–11. Note
|
||||
again, the en-dash is snugged up to its surrounding elements.
|
||||
* For breaks in thought — such as this splendid example — use
|
||||
the long em-dash.
|
||||
* For ranges of values, use the en-dash: Monday – Friday, 0 –
|
||||
11.
|
||||
* Use a non-breaking space (" ") between a number and its unit.
|
||||
* Colons (":") always snug up to their text on the left: it is an error to add
|
||||
space between text on the left and the colon.
|
||||
|
||||
|
||||
5.2 Language
|
||||
------------
|
||||
|
||||
* The Ardour manual is written in American English spelling.
|
||||
* The Ardour manual is written in Americal English spelling.
|
||||
* Use SI units with standard abbreviations. Give imperial units only as
|
||||
additional information, if at all.
|
||||
* Do not use contractions like "it'll", always write full forms.
|
||||
* Do not over-use "You", write about the program, not the user. Avoid it if at
|
||||
all possible, it makes for tighter and better reading text.
|
||||
* Always write out numbers less than 11. E.g., "One or two ..." instead of
|
||||
"1 or 2 ...".
|
||||
* Do not use contractions like "you'll", always write full forms.
|
||||
* Do not over-use "You", write about the program, not the user.
|
||||
|
||||
|
||||
5.3 Chapter Headline Capitalization
|
||||
@ -308,8 +297,6 @@ content per heading and you do not expect the article to grow.
|
||||
* If pages grow long, consider splitting them into sub-chapters at their
|
||||
headings.
|
||||
* Nobody needs "the next paragraph is about the following" paragraphs.
|
||||
* When creating a <p class="note">NOTE</p>, *do not* put the word NOTE into
|
||||
the note, the styling tells the user that it is a note.
|
||||
|
||||
5.6. Encoding
|
||||
-------------
|
||||
@ -319,4 +306,3 @@ headings.
|
||||
HTML character entities instead, for example for cursor arrows: →
|
||||
← ↑ ↓. Diacriticals on vowels and other special letters are
|
||||
probably ok by now, so don't bother with é and friends, just type é.
|
||||
|
||||
|
1
_config.yml
Normal file
1
_config.yml
Normal file
@ -0,0 +1 @@
|
||||
source: source
|
95
_layouts/bootstrap.html
Normal file
95
_layouts/bootstrap.html
Normal file
@ -0,0 +1,95 @@
|
||||
---
|
||||
bootstrap_path: /bootstrap-2.2.2
|
||||
page_title: The Ardour Manual
|
||||
---
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<title>{{page.page_title}}</title>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link href="{{page.bootstrap_path}}/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="{{page.bootstrap_path}}/css/bootstrap-responsive.min.css" rel="stylesheet" />
|
||||
|
||||
<link href="/css/app.css" rel="stylesheet" />
|
||||
{% if page.style %}
|
||||
<link href="/css/{{page.style}}.css" rel="stylesheet" />
|
||||
{% endif %}
|
||||
|
||||
<link href='http://fonts.googleapis.com/css?family=Junge' rel='stylesheet' type='text/css' />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!--
|
||||
<div class="navbar">
|
||||
<div class="navbar-inner">
|
||||
<div class="container">
|
||||
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
|
||||
<a class="brand" href="#">The Ardour Manual</a>
|
||||
|
||||
<div class="nav-collapse collapse">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div id="tree">
|
||||
<div id="tree-inner">
|
||||
<h1 class="title"><a href="/"><img src="/images/logo.png" alt="The Ardour Manual" /></a></h1>
|
||||
{% tree %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="span12" id="content">
|
||||
<div id="search" class="gcse-search">
|
||||
</div>
|
||||
<div id="content-main">
|
||||
<h1 class="title">{{ page.title }}</h1>
|
||||
{{ content }}
|
||||
{% prevnext %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
|
||||
// I'll go to hell for this
|
||||
var isA = function(regex) { return navigator.userAgent.match(regex) };
|
||||
var isAbout = function(regex) { return document.getElementsByTagName('h1')[1].textContent.match(regex) };
|
||||
|
||||
if ( (isA(/Mac/) || isAbout(/OS X/)) && (!isAbout(/Linux/)) ) {
|
||||
var e = document.getElementsByTagName('body')[0];
|
||||
e.className += ' mac'; // class magic for Cmd vs. Ctrl keys.
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var cx = '011950134405426689607:2lg2y9xgf3a';
|
||||
var gcse = document.createElement('script'); gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
5
_layouts/default.html
Normal file
5
_layouts/default.html
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
layout: bootstrap
|
||||
---
|
||||
|
||||
{{content}}
|
495
build.py
495
build.py
@ -1,495 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# Script to take the master document and ancillary files and create the
|
||||
# finished manual/website.
|
||||
#
|
||||
# by James Hammons
|
||||
# (C) 2017 Underground Software
|
||||
#
|
||||
|
||||
# Remnants (could go into the master document as the first header)
|
||||
|
||||
#bootstrap_path: /bootstrap-2.2.2
|
||||
#page_title: The Ardour Manual
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import argparse
|
||||
|
||||
|
||||
#
|
||||
# Create an all lowercase filename without special characters and with spaces
|
||||
# replaced with dashes.
|
||||
#
|
||||
def MakeFilename(s):
|
||||
# Cleans up the file name, removing all non ASCII or .-_ chars
|
||||
fn = re.sub(r'[^.\-_a-zA-Z0-9 ]', '', s)
|
||||
fn = fn.lower()
|
||||
fn = fn.replace(' ', '-')
|
||||
return fn
|
||||
|
||||
|
||||
#
|
||||
# Parse headers into a dictionary
|
||||
#
|
||||
def ParseHeader(fileObj):
|
||||
header = {}
|
||||
|
||||
while (True):
|
||||
hdrLine = fileObj.readline().rstrip('\r\n')
|
||||
|
||||
# Break out of the loop if we hit the end of header marker
|
||||
if hdrLine.startswith('---'):
|
||||
break
|
||||
|
||||
# Check to see that we have a well-formed header construct
|
||||
match = re.findall(': ', hdrLine)
|
||||
|
||||
if match:
|
||||
# Parse out foo: bar pairs & put into header dictionary
|
||||
a = re.split(': ', hdrLine, 1)
|
||||
header[a[0]] = a[1]
|
||||
|
||||
return header
|
||||
|
||||
|
||||
#
|
||||
# Turn a "part" name into an int
|
||||
#
|
||||
def PartToLevel(s):
|
||||
level = -1
|
||||
|
||||
if s == 'part':
|
||||
level = 0
|
||||
elif s == 'chapter':
|
||||
level = 1
|
||||
elif s == 'subchapter':
|
||||
level = 2
|
||||
elif s == 'section':
|
||||
level = 3
|
||||
elif s == 'subsection':
|
||||
level = 4
|
||||
|
||||
return level
|
||||
|
||||
#
|
||||
# Converts a integer to a roman number
|
||||
#
|
||||
def num2roman(num):
|
||||
num_map = [(1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I')]
|
||||
roman = ''
|
||||
|
||||
while num > 0:
|
||||
for i, r in num_map:
|
||||
while num >= i:
|
||||
roman += r
|
||||
num -= i
|
||||
|
||||
return roman
|
||||
|
||||
#
|
||||
# Capture the master document's structure (and content, if any) in a list
|
||||
#
|
||||
def GetFileStructure():
|
||||
fs = []
|
||||
fnames = [None]*6
|
||||
content = ''
|
||||
grab = False
|
||||
mf = open('master-doc.txt')
|
||||
|
||||
for ln in mf:
|
||||
if ln.startswith('---'):
|
||||
# First, stuff any content that we may have read into the current
|
||||
# header's dictionary
|
||||
if grab:
|
||||
fs[-1]['content'] = content
|
||||
grab = False
|
||||
content = ''
|
||||
|
||||
# Then, get the new header and do things to it
|
||||
hdr = ParseHeader(mf)
|
||||
level = PartToLevel(hdr['part'])
|
||||
hdr['level'] = level
|
||||
fnames[level] = MakeFilename(hdr['title'])
|
||||
fullName = ''
|
||||
|
||||
for i in range(level + 1):
|
||||
fullName = fullName + fnames[i] + '/'
|
||||
|
||||
hdr['filename'] = fullName.rstrip('/')
|
||||
fs.append(hdr)
|
||||
|
||||
if ('include' not in hdr) and (level > 0):
|
||||
grab = True
|
||||
else:
|
||||
if grab:
|
||||
content = content + ln
|
||||
|
||||
# Catch the last file, since it would be missed above
|
||||
if grab:
|
||||
fs[-1]['content'] = content
|
||||
|
||||
mf.close()
|
||||
return fs
|
||||
|
||||
|
||||
#
|
||||
# Determine if a particular node has child nodes
|
||||
#
|
||||
def HaveChildren(fs, pos):
|
||||
# If we're at the end of the list, there can be no children
|
||||
if pos == len(fs) - 1:
|
||||
return False
|
||||
|
||||
# If the next node is at a lower level than the current node, we have
|
||||
# children.
|
||||
if fs[pos]['level'] < fs[pos + 1]['level']:
|
||||
return True
|
||||
|
||||
# Otherwise, no children at this node.
|
||||
return False
|
||||
|
||||
|
||||
#
|
||||
# Get the children at this level, and return them in a list
|
||||
#
|
||||
def GetChildren(fs, pos):
|
||||
children = []
|
||||
pos = pos + 1
|
||||
childLevel = fs[pos]['level']
|
||||
|
||||
while fs[pos]['level'] >= childLevel:
|
||||
if fs[pos]['level'] == childLevel:
|
||||
children.append(pos)
|
||||
|
||||
pos = pos + 1
|
||||
|
||||
# Sanity check
|
||||
if pos == len(fs):
|
||||
break
|
||||
|
||||
return children
|
||||
|
||||
|
||||
#
|
||||
# Make an array of children attached to each node in the file structure
|
||||
# (It's a quasi-tree structure, and can be traversed as such.)
|
||||
#
|
||||
def FindChildren(fs):
|
||||
childArray = []
|
||||
|
||||
for i in range(len(fs)):
|
||||
if HaveChildren(fs, i):
|
||||
childArray.append(GetChildren(fs, i))
|
||||
else:
|
||||
childArray.append([])
|
||||
|
||||
return childArray
|
||||
|
||||
|
||||
#
|
||||
# Make an array of the top level nodes in the file structure
|
||||
#
|
||||
def FindTopLevelNodes(fs):
|
||||
level0 = []
|
||||
|
||||
for i in range(len(fs)):
|
||||
if fs[i]['level'] == 0:
|
||||
level0.append(i)
|
||||
|
||||
return level0
|
||||
|
||||
|
||||
#
|
||||
# Find all header links and create a dictionary out of them
|
||||
#
|
||||
def FindInternalLinks(fs):
|
||||
linkDict = {}
|
||||
|
||||
for hdr in fs:
|
||||
if 'link' in hdr:
|
||||
linkDict['@@' + hdr['link']] = '/' + hdr['filename'] + '/'
|
||||
|
||||
return linkDict
|
||||
|
||||
|
||||
#
|
||||
# Internal links are of the form '@@link-name', which are references to the
|
||||
# 'link:' field in the part header. We have to find all occurances and replace
|
||||
# them with the appropriate link.
|
||||
#
|
||||
def FixInternalLinks(links, content, title):
|
||||
|
||||
# Make key1|key2|key3|... out of our links keys
|
||||
pattern = re.compile('|'.join(links.keys()))
|
||||
|
||||
# Use a lambda callback to substitute each occurance found
|
||||
result = pattern.sub(lambda x: links[x.group()], content)
|
||||
|
||||
# Check for missing link targets, and report them to the user
|
||||
match = re.findall('"@@.*"', result)
|
||||
|
||||
if len(match) > 0:
|
||||
print('\nMissing link target' + ('s' if len(match) > 1 else '') + ' in "' + title + '":')
|
||||
|
||||
for s in match:
|
||||
print(' ' + s[3:-1])
|
||||
|
||||
print()
|
||||
|
||||
return result
|
||||
|
||||
|
||||
#
|
||||
# Recursively build a list of links based on the location of the page we're
|
||||
# looking at currently
|
||||
#
|
||||
def BuildList(lst, fs, pagePos, cList):
|
||||
content = '\n\n<dl>\n'
|
||||
|
||||
for i in range(len(lst)):
|
||||
curPos = lst[i]
|
||||
nextPos = lst[i + 1] if i + 1 < len(lst) else len(fs)
|
||||
|
||||
active = ' class=active' if curPos == pagePos else ''
|
||||
content = content + '<dt' + active + '><a href="/' + fs[curPos]['filename'] + '/">' + fs[curPos]['title'] + '</a></dt><dd' + active + '>'
|
||||
|
||||
# If the current page is our page, and it has children, enumerate them
|
||||
if curPos == pagePos:
|
||||
if len(cList[curPos]) > 0:
|
||||
content = content + BuildList(cList[curPos], fs, -1, cList)
|
||||
|
||||
# Otherwise, if our page lies between the current one and the next,
|
||||
# build a list of links from those nodes one level down.
|
||||
elif (pagePos > curPos) and (pagePos < nextPos):
|
||||
content = content + BuildList(cList[curPos], fs, pagePos, cList)
|
||||
|
||||
content = content + '</dd>\n'
|
||||
|
||||
content = content + '</dl>\n'
|
||||
|
||||
return content
|
||||
|
||||
#
|
||||
# Create link sidebar given a position in the list.
|
||||
#
|
||||
def CreateLinkSidebar(fs, pos, childList):
|
||||
|
||||
# Build the list recursively from the top level nodes
|
||||
content = BuildList(FindTopLevelNodes(fs), fs, pos, childList)
|
||||
# Shove the TOC link in the top...
|
||||
content = content[:7] + '<dt><a href="/toc/">Table of Contents</a></dt><dd></dd>\n' + content[7:]
|
||||
|
||||
return content
|
||||
|
||||
|
||||
# Preliminaries
|
||||
|
||||
# We have command line arguments now, so deal with them
|
||||
parser = argparse.ArgumentParser(description='A build script for the Ardour Manual')
|
||||
parser.add_argument('-v', '--verbose', action='store_true', help='Display the high-level structure of the manual')
|
||||
parser.add_argument('-q', '--quiet', action='store_true', help='Suppress all output (overrides -v)')
|
||||
args = parser.parse_args()
|
||||
verbose = args.verbose
|
||||
quiet = args.quiet
|
||||
|
||||
if quiet:
|
||||
verbose = False
|
||||
|
||||
#verbose = False
|
||||
level = 0
|
||||
fileCount = 0
|
||||
levelNums = [0]*6
|
||||
lastFile = ''
|
||||
page = ''
|
||||
toc = ''
|
||||
pageNumber = 0
|
||||
|
||||
siteDir = './website/'
|
||||
|
||||
if os.access(siteDir, os.F_OK):
|
||||
if not quiet:
|
||||
print('Removing stale HTML data...')
|
||||
|
||||
shutil.rmtree(siteDir)
|
||||
|
||||
shutil.copytree('./source', siteDir)
|
||||
|
||||
# Yeah, need to make a symlink in include/ too :-P
|
||||
# [this will go away when the rewrite happens]
|
||||
if (os.access('include/_manual', os.F_OK) == False):
|
||||
os.symlink('../_manual/', 'include/_manual')
|
||||
|
||||
|
||||
# Read the template, and fix the stuff that's fixed for all pages
|
||||
temp = open('page-template.txt')
|
||||
template = temp.read()
|
||||
temp.close()
|
||||
|
||||
template = template.replace('{{page.bootstrap_path}}', '/bootstrap-2.2.2')
|
||||
template = template.replace('{{page.page_title}}', 'The Ardour Manual')
|
||||
|
||||
|
||||
# Parse out the master docuemnt's structure into a dictionary list
|
||||
fileStruct = GetFileStructure()
|
||||
|
||||
# Build a quasi-tree structure listing children at level + 1 for each node
|
||||
nodeChildren = FindChildren(fileStruct)
|
||||
|
||||
# Create a dictionary for translation of internal links to real links
|
||||
links = FindInternalLinks(fileStruct)
|
||||
|
||||
if not quiet:
|
||||
print('Found ' + str(len(links)) + ' internal link target', end='')
|
||||
print('.') if len(links) == 1 else print('s.')
|
||||
|
||||
if not quiet:
|
||||
master = open('master-doc.txt')
|
||||
firstLine = master.readline().rstrip('\r\n')
|
||||
master.close()
|
||||
|
||||
if firstLine == '<!-- exploded -->':
|
||||
print('Parsing exploded file...')
|
||||
elif firstLine == '<!-- imploded -->':
|
||||
print('Parsing imploded file...')
|
||||
else:
|
||||
print('Parsing unknown type...')
|
||||
|
||||
# Here we go!
|
||||
|
||||
for header in fileStruct:
|
||||
fileCount = fileCount + 1
|
||||
content = ''
|
||||
more = ''
|
||||
|
||||
lastLevel = level
|
||||
level = header['level']
|
||||
|
||||
# Handle Part/Chapter/subchapter/section/subsection numbering
|
||||
if level == 0:
|
||||
levelNums[2] = 0
|
||||
elif level == 1:
|
||||
levelNums[2] = 0
|
||||
elif level == 2:
|
||||
levelNums[3] = 0
|
||||
elif level == 3:
|
||||
levelNums[4] = 0
|
||||
|
||||
levelNums[level] = levelNums[level] + 1;
|
||||
|
||||
# This is totally unnecessary, but nice; besides which, you can capture
|
||||
# the output to a file to look at later if you like :-)
|
||||
if verbose:
|
||||
for i in range(level):
|
||||
print('\t', end='')
|
||||
|
||||
if (level == 0):
|
||||
print('\nPart ' + num2roman(levelNums[0]) + ': ', end='')
|
||||
elif (level == 1):
|
||||
print('\n\tChapter ' + str(levelNums[1]) + ': ', end='')
|
||||
|
||||
print(header['title'])
|
||||
|
||||
# Handle TOC scriblings...
|
||||
if level == 0:
|
||||
toc = toc + '<h2>Part ' + num2roman(levelNums[level]) + ': ' + header['title'] + '</h2>\n';
|
||||
elif level == 1:
|
||||
toc = toc + ' <p id=chapter>Ch. ' + str(levelNums[level]) + ': <a href="/' + header['filename'] + '/">' + header['title'] + '</a></p>\n'
|
||||
elif level == 2:
|
||||
toc = toc + ' <a id=subchapter href="/' + header['filename'] + '/">' + header['title'] + '</a><br>\n'
|
||||
elif level == 3:
|
||||
toc = toc + ' <a id=subchapter href="/' + header['filename'] + '/">' + header['title'] + '</a><br>\n'
|
||||
elif level == 4:
|
||||
toc = toc + ' <a id=subchapter href="/' + header['filename'] + '/">' + header['title'] + '</a><br>\n'
|
||||
|
||||
# Make the 'this thing contains...' stuff
|
||||
if HaveChildren(fileStruct, pageNumber):
|
||||
pages = GetChildren(fileStruct, pageNumber)
|
||||
|
||||
for pg in pages:
|
||||
more = more + '<li>' + '<a href="/' + fileStruct[pg]['filename'] + '/">' + fileStruct[pg]['title'] + '</a>' + '</li>\n'
|
||||
|
||||
more = '<div id=subtopics>\n' + '<h2>This section contains the following topics:</h2>\n' + '<ul>\n' + more + '</ul>\n' + '</div>\n'
|
||||
|
||||
# Make the 'Previous' & 'Next' content
|
||||
nLink = ''
|
||||
pLink = ''
|
||||
|
||||
if pageNumber > 0:
|
||||
pLink = '<li><a title="' + fileStruct[pageNumber - 1]['title'] + '" href="/' + fileStruct[pageNumber - 1]['filename'] + '/" class="previous"> < Previous </a></li>'
|
||||
|
||||
if pageNumber < len(fileStruct) - 1:
|
||||
nLink = '<li><a title="' + fileStruct[pageNumber + 1]['title'] + '" href="/' + fileStruct[pageNumber + 1]['filename'] + '/" class="next"> Next > </a></li>'
|
||||
|
||||
prevnext = '<ul class=pager>' + pLink + nLink + '</ul>'
|
||||
|
||||
# Create the link sidebar
|
||||
sidebar = CreateLinkSidebar(fileStruct, pageNumber, nodeChildren)
|
||||
|
||||
# Parts DO NOT have any content, they are ONLY an organizing construct!
|
||||
# Chapters, subchapters, sections & subsections can all have content,
|
||||
# but the basic fundamental organizing unit WRT content is still the
|
||||
# chapter.
|
||||
if level > 0:
|
||||
if 'include' in header:
|
||||
srcFile = open('include/' + header['include'])
|
||||
content = srcFile.read()
|
||||
srcFile.close()
|
||||
|
||||
# Get rid of any extant header in the include file
|
||||
# (once this is accepted, we can nuke this bit, as content files
|
||||
# will not have any headers or footers in them)
|
||||
content = re.sub('---.*\n(.*\n)*---.*\n', '', content)
|
||||
content = content.replace('{% children %}', '')
|
||||
|
||||
else:
|
||||
if 'content' in header:
|
||||
content = header['content']
|
||||
else:
|
||||
content = '[something went wrong]'
|
||||
|
||||
# Fix up any internal links
|
||||
content = FixInternalLinks(links, content, header['title'])
|
||||
|
||||
# Set up the actual page from the template
|
||||
if 'style' not in header:
|
||||
page = re.sub("{% if page.style %}.*\n.*\n{% endif %}.*\n", "", template)
|
||||
else:
|
||||
page = template.replace('{{page.style}}', header['style'])
|
||||
page = page.replace('{% if page.style %}', '')
|
||||
page = page.replace('{% endif %}', '')
|
||||
|
||||
page = page.replace('{{ page.title }}', header['title'])
|
||||
page = page.replace('{% tree %}', sidebar)
|
||||
page = page.replace('{% prevnext %}', prevnext)
|
||||
page = page.replace('{{ content }}', content + more)
|
||||
|
||||
# Create the directory for the index.html file to go into
|
||||
os.mkdir(siteDir + header['filename'], 0o775)
|
||||
|
||||
# Finally, write the file!
|
||||
destFile = open(siteDir + header['filename'] + '/index.html', 'w')
|
||||
destFile.write(page)
|
||||
destFile.close()
|
||||
|
||||
# Save filename for next header...
|
||||
lastFile = header['filename']
|
||||
pageNumber = pageNumber + 1
|
||||
|
||||
# Finally, create the TOC
|
||||
sidebar = CreateLinkSidebar(fileStruct, -1, nodeChildren)
|
||||
|
||||
page = re.sub("{% if page.style %}.*\n.*\n{% endif %}.*\n", "", template)
|
||||
page = page.replace('{{ page.title }}', 'Ardour Table of Contents')
|
||||
page = page.replace('{% tree %}', sidebar)
|
||||
page = page.replace('{{ content }}', toc)
|
||||
page = page.replace('{% prevnext %}', '')
|
||||
|
||||
os.mkdir(siteDir + 'toc', 0o775)
|
||||
tocFile = open(siteDir + 'toc/index.html', 'w')
|
||||
tocFile.write(page)
|
||||
tocFile.close()
|
||||
|
||||
if not quiet:
|
||||
print('Processed ' + str(fileCount) + ' files.')
|
285
build.rb
Executable file
285
build.rb
Executable file
@ -0,0 +1,285 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'pathname'
|
||||
require 'yaml'
|
||||
require 'optparse'
|
||||
|
||||
begin require 'liquid'
|
||||
rescue LoadError
|
||||
puts "Please install the 'liquid' Ruby gem (available in Debian/Ubuntu as 'ruby-liquid')"
|
||||
exit 1
|
||||
end
|
||||
|
||||
CONFIG = {
|
||||
pages_dir: '_manual',
|
||||
layouts_dir: '_layouts',
|
||||
static_dir: 'source',
|
||||
output_dir: '_site'
|
||||
}
|
||||
|
||||
def child_url?(a, b)
|
||||
a.start_with?(b) && b.count('/') + 1 == a.count('/')
|
||||
end
|
||||
|
||||
class Site
|
||||
attr_reader :pages, :layouts
|
||||
|
||||
def initialize()
|
||||
@pages = []
|
||||
@layouts = {}
|
||||
end
|
||||
|
||||
def build()
|
||||
print "Building... "
|
||||
|
||||
read_layouts()
|
||||
read_pages()
|
||||
copy_static()
|
||||
process_pages()
|
||||
|
||||
puts "done."
|
||||
end
|
||||
|
||||
def read_layouts()
|
||||
Pathname.glob(layouts_dir + Pathname('*.html')) do |path|
|
||||
next if !path.file?
|
||||
layout = Layout.new(self, path)
|
||||
layout.read
|
||||
@layouts[path.basename('.html').to_s] = layout
|
||||
end
|
||||
end
|
||||
|
||||
def read_pages()
|
||||
pages_dir.find do |path|
|
||||
if path.file? && path.extname == '.html'
|
||||
page = Page.new(self, path)
|
||||
page.read
|
||||
@pages << page
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def process_pages()
|
||||
@pages.each {|page| page.process}
|
||||
end
|
||||
|
||||
def copy_static()
|
||||
unless system("rsync -a --delete --exclude='*~' #{static_dir}/. #{output_dir}")
|
||||
puts "Couldn't copy static files, is rsync installed?"
|
||||
end
|
||||
end
|
||||
|
||||
def find_children(url)
|
||||
sorted_pages.select { |p| child_url?(p.url, url) }
|
||||
end
|
||||
|
||||
def toplevel() @toplevel_memo ||= find_children('/') end
|
||||
def sorted_pages() @sorted_pages_memo ||= @pages.sort_by{ |p| p.sort_url } end
|
||||
|
||||
def pages_dir() @pages_dir_memo ||= Pathname(CONFIG[:pages_dir]) end
|
||||
def layouts_dir() @layouts_dir_memo ||= Pathname(CONFIG[:layouts_dir]) end
|
||||
def static_dir() @static_dir_memo ||= Pathname(CONFIG[:static_dir]) end
|
||||
def output_dir() @output_dir_memo ||= Pathname(CONFIG[:output_dir]) end
|
||||
end
|
||||
|
||||
class Page
|
||||
attr_reader :path, :out_path, :url, :sort_url
|
||||
|
||||
def initialize(site, path)
|
||||
@site = site
|
||||
@path = path
|
||||
|
||||
relative_path = @path.relative_path_from(@site.pages_dir);
|
||||
a = relative_path.each_filename.map do |x|
|
||||
x.sub(/^[0-9]*[-_]/, '')
|
||||
end
|
||||
a[-1].sub!(/\.html$/, '')
|
||||
s = a.join('/')
|
||||
|
||||
@out_path = @site.output_dir + Pathname(s) + Pathname("index.html")
|
||||
@url = "/#{s}/"
|
||||
@sort_url = @path.to_s.sub(/\.html$/, '')
|
||||
end
|
||||
|
||||
def related_to?(p)
|
||||
# should we show p in the index on selfs page?
|
||||
url.start_with?(p.url) || child_url?(url, p.url)
|
||||
end
|
||||
|
||||
def title()
|
||||
@page_context['title'] || ""
|
||||
end
|
||||
|
||||
def menu_title()
|
||||
@page_context['menu_title'] || title
|
||||
end
|
||||
|
||||
def read()
|
||||
content = @path.read
|
||||
frontmatter, @content = split_frontmatter(content) || abort("File not well-formatted: #{@path}")
|
||||
@page_context = YAML.load(frontmatter)
|
||||
@template = Liquid::Template.parse(@content)
|
||||
end
|
||||
|
||||
def split_frontmatter(txt)
|
||||
@split_regex ||= /\A---[ \t\r]*\n(?<frontmatter>.*?)^---[ \t\r]*\n(?<content>.*)\z/m
|
||||
match = @split_regex.match txt
|
||||
match ? [match['frontmatter'], match['content']] : nil
|
||||
end
|
||||
|
||||
def find_layout()
|
||||
@site.layouts[@page_context['layout'] || 'default']
|
||||
end
|
||||
|
||||
def children()
|
||||
@children ||= @site.find_children(@url)
|
||||
end
|
||||
|
||||
def render()
|
||||
registers = {page: self, site: @site}
|
||||
context = {'page' => @page_context}
|
||||
content = @template.render!(context, registers: registers)
|
||||
find_layout.render(context.merge({'content' => content}), registers)
|
||||
end
|
||||
|
||||
def process()
|
||||
path = out_path
|
||||
path.dirname.mkpath
|
||||
path.open('w') { |f| f.write(render) }
|
||||
end
|
||||
end
|
||||
|
||||
class Layout < Page
|
||||
def render(context, registers)
|
||||
context = context.dup
|
||||
context['page'] = @page_context.merge(context['page'])
|
||||
content = @template.render!(context, registers: registers)
|
||||
if @page_context.has_key?('layout')
|
||||
find_layout.render(context.merge({'content' => content}), registers)
|
||||
else
|
||||
content
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Tag_tree < Liquid::Tag
|
||||
def join(children_html)
|
||||
children_html.empty? ? "" : "<dl>\n" + children_html.join + "</dl>\n"
|
||||
end
|
||||
|
||||
def render(context)
|
||||
current = context.registers[:page]
|
||||
site = context.registers[:site]
|
||||
|
||||
format_entry = lambda do |page|
|
||||
children = page.children
|
||||
|
||||
css = (page == current) ? ' class="active"' : ""
|
||||
children_html = current.related_to?(page) ? join(children.map(&format_entry)) : ""
|
||||
|
||||
%{
|
||||
<dt#{css}>
|
||||
<a href='#{page.url}'>#{page.menu_title}</a>
|
||||
</dt>
|
||||
<dd#{css}>
|
||||
#{children_html}
|
||||
</dd>
|
||||
}
|
||||
end
|
||||
|
||||
join(site.toplevel.map(&format_entry))
|
||||
end
|
||||
end
|
||||
|
||||
class Tag_children < Liquid::Tag
|
||||
def render(context)
|
||||
children = context.registers[:page].children
|
||||
entries = children.map {|p| "<li><a href='#{p.url}'>#{p.title}</a></li>" }
|
||||
|
||||
"<div id='subtopics'>
|
||||
<h2>This chapter covers the following topics:</h2>
|
||||
<ul>
|
||||
#{entries.join}
|
||||
</ul>
|
||||
</div>
|
||||
"
|
||||
end
|
||||
end
|
||||
|
||||
class Tag_prevnext < Liquid::Tag
|
||||
def render(context)
|
||||
current = context.registers[:page]
|
||||
pages = context.registers[:site].sorted_pages
|
||||
|
||||
index = pages.index { |page| page == current }
|
||||
return '' if !index
|
||||
|
||||
link = lambda do |p, cls, txt|
|
||||
"<li><a title='#{p.title}' href='#{p.url}' class='#{cls}'>#{txt}</a></li>"
|
||||
end
|
||||
prev_link = index > 0 ? link.call(pages[index-1], "previous", " < Previous ") : ""
|
||||
next_link = index < pages.length-1 ? link.call(pages[index+1], "next", " Next > ") : ""
|
||||
|
||||
"<ul class='pager'>#{prev_link}#{next_link}</ul>"
|
||||
end
|
||||
end
|
||||
|
||||
class Server
|
||||
def start_watcher()
|
||||
begin require 'listen'
|
||||
rescue LoadError
|
||||
puts "To use the --watch function, please install the 'listen' Ruby gem"
|
||||
puts "(available in Debian/Ubuntu as 'ruby-listen')"
|
||||
return nil
|
||||
end
|
||||
|
||||
listener = Listen.to(CONFIG[:pages_dir], wait_for_delay: 1.0, only: /.html$/) do |modified, added, removed|
|
||||
Site.new.build
|
||||
end
|
||||
listener.start
|
||||
listener
|
||||
end
|
||||
|
||||
def run(options)
|
||||
require 'webrick'
|
||||
listener = options[:watch] && start_watcher
|
||||
port = options[:port] || 8000
|
||||
|
||||
puts "Serving at http://localhost:#{port}/ ..."
|
||||
server = WEBrick::HTTPServer.new :Port => port, :DocumentRoot => CONFIG[:output_dir]
|
||||
trap 'INT' do
|
||||
server.shutdown
|
||||
end
|
||||
server.start
|
||||
listener.stop if listener
|
||||
end
|
||||
end
|
||||
|
||||
def main
|
||||
Liquid::Template.register_tag('tree', Tag_tree)
|
||||
Liquid::Template.register_tag('children', Tag_children)
|
||||
Liquid::Template.register_tag('prevnext', Tag_prevnext)
|
||||
|
||||
if defined? Liquid::Template.error_mode
|
||||
Liquid::Template.error_mode = :strict
|
||||
end
|
||||
|
||||
options = {}
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = %{Usage: build.rb <command> [options]
|
||||
|
||||
Use 'build.rb' to build the manual. Use 'build.rb serve' to also
|
||||
start a web server; setting any web server options implies "serve".
|
||||
}
|
||||
opts.on("-w", "--watch", "Watch for changes") { options[:watch] = true }
|
||||
opts.on("-p", "--port N", Integer, "Specify port for web server") { |p| options[:port] = p }
|
||||
end.parse!
|
||||
|
||||
Site.new.build
|
||||
|
||||
if options[:watch] || options[:port] || (ARGV.length > 0 && "serve".start_with?(ARGV[0]))
|
||||
Server.new.run(options)
|
||||
end
|
||||
end
|
||||
|
||||
main
|
152
explode.py
152
explode.py
@ -1,152 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Small program to 'explode' the master document automagically into separate
|
||||
# files in the include/ directory.
|
||||
#
|
||||
# by James Hammons
|
||||
# (C) 2017 Underground Software
|
||||
#
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
lineCount = 0
|
||||
|
||||
|
||||
#
|
||||
# Create an all lowercase filename without special characters and with spaces
|
||||
# replaced with dashes.
|
||||
#
|
||||
def MakeFilename(s):
|
||||
# Cleans up the file name, removing all non ASCII or .-_ chars
|
||||
fn = re.sub(r'[^.\-_a-zA-Z0-9 ]', '', s)
|
||||
fn = fn.lower()
|
||||
fn = fn.replace(' ', '-')
|
||||
return fn
|
||||
|
||||
|
||||
#
|
||||
# Parse headers into a dictionary
|
||||
#
|
||||
def ParseHeader(fileObj):
|
||||
global lineCount
|
||||
header = {}
|
||||
|
||||
while (True):
|
||||
hdrLine = fileObj.readline().rstrip('\r\n')
|
||||
lineCount = lineCount + 1
|
||||
|
||||
# Break out of the loop if we hit the end of header marker
|
||||
if hdrLine.startswith('---'):
|
||||
break
|
||||
|
||||
# Check to see that we have a well-formed header construct
|
||||
match = re.findall(': ', hdrLine)
|
||||
|
||||
if match:
|
||||
# Parse out foo: bar pairs & put into header dictionary
|
||||
a = re.split(': ', hdrLine, 1)
|
||||
header[a[0]] = a[1]
|
||||
|
||||
return header
|
||||
|
||||
|
||||
fileCount = 0
|
||||
writingFile = False
|
||||
toFile = open('master-doc.txt')
|
||||
toFile.close()
|
||||
filenames = []
|
||||
|
||||
|
||||
master = open('master-doc.txt')
|
||||
firstLine = master.readline().rstrip('\r\n')
|
||||
master.close()
|
||||
|
||||
if firstLine == '<!-- exploded -->':
|
||||
print('Master file has already been exploded.')
|
||||
exit(0)
|
||||
|
||||
if os.rename('master-doc.txt', 'master-doc.bak') == False:
|
||||
print('Could not rename master-doc.txt!')
|
||||
exit(-1)
|
||||
|
||||
master = open('master-doc.bak', 'r')
|
||||
explode = open('master-doc.txt', 'w')
|
||||
|
||||
explode.write('<!-- exploded -->\n')
|
||||
|
||||
for line in master:
|
||||
lineCount = lineCount + 1
|
||||
|
||||
# Do any header parsing if needed...
|
||||
if line.startswith('---'):
|
||||
|
||||
# Close any open file from the previous header
|
||||
if (writingFile):
|
||||
toFile.close()
|
||||
writingFile = False
|
||||
|
||||
noMove = False
|
||||
header = ParseHeader(master)
|
||||
|
||||
# Make sure the filename we're making is unique...
|
||||
basename = MakeFilename(header['title'])
|
||||
inclFile = basename + '.html'
|
||||
|
||||
if 'file' in header:
|
||||
inclFile = header['file']
|
||||
else:
|
||||
suffix = 1
|
||||
|
||||
while inclFile in filenames:
|
||||
suffix = suffix + 1
|
||||
inclFile = basename + '_' + str(suffix) + '.html'
|
||||
|
||||
# Find all files in the master file and write them out to include/,
|
||||
# while removing it from the master file.
|
||||
explode.write('\n---\n' + 'title: ' + header['title'] + '\n')
|
||||
|
||||
if header['part'] != 'part':
|
||||
if 'menu_title' in header:
|
||||
explode.write('menu_title: ' + header['menu_title'] + '\n')
|
||||
|
||||
if 'link' in header:
|
||||
explode.write('link: ' + header['link'] + '\n')
|
||||
|
||||
if 'style' in header:
|
||||
explode.write('style: ' + header['style'] + '\n')
|
||||
|
||||
if 'include' in header:
|
||||
noMove = True
|
||||
explode.write('include: ' + header['include'] + '\n')
|
||||
explode.write('exclude: yes\n')
|
||||
filenames.append(header['include'])
|
||||
else:
|
||||
explode.write('include: ' + inclFile + '\n')
|
||||
filenames.append(inclFile)
|
||||
|
||||
explode.write('part: ' + header['part'] + '\n' + '---\n')
|
||||
|
||||
# Only parts have no content...
|
||||
if header['part'] != 'part':
|
||||
if noMove:
|
||||
explode.write('\n')
|
||||
else:
|
||||
fileCount = fileCount + 1
|
||||
|
||||
toFile = open('include/' + inclFile, 'w')
|
||||
writingFile = True
|
||||
|
||||
else:
|
||||
if writingFile:
|
||||
toFile.write(line)
|
||||
|
||||
master.close()
|
||||
explode.close()
|
||||
|
||||
print('Processed ' + str(lineCount) + ' lines.')
|
||||
print('Exploded master document into ' + str(fileCount) + ' files.')
|
||||
|
||||
os.remove('master-doc.bak')
|
||||
|
152
implode.py
152
implode.py
@ -1,152 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
#
|
||||
# Small program to 'implode' the master document automagically from separate
|
||||
# files in the include/ directory.
|
||||
#
|
||||
# by James Hammons
|
||||
# (C) 2017 Underground Software
|
||||
#
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
lineCount = 0
|
||||
|
||||
|
||||
#
|
||||
# Parse headers into a dictionary
|
||||
#
|
||||
def ParseHeader(fileObj):
|
||||
global lineCount
|
||||
header = {}
|
||||
|
||||
while (True):
|
||||
hdrLine = fileObj.readline().rstrip('\r\n')
|
||||
lineCount = lineCount + 1
|
||||
|
||||
# Break out of the loop if we hit the end of header marker
|
||||
if hdrLine.startswith('---'):
|
||||
break
|
||||
|
||||
# Check to see that we have a well-formed header construct
|
||||
match = re.findall(': ', hdrLine)
|
||||
|
||||
if match:
|
||||
# Parse out foo: bar pairs & put into header dictionary
|
||||
a = re.split(': ', hdrLine, 1)
|
||||
header[a[0]] = a[1]
|
||||
|
||||
return header
|
||||
|
||||
|
||||
#
|
||||
# Check to see if a given file has a header (it shouldn't)
|
||||
#
|
||||
def CheckForHeader(fn):
|
||||
check = open(fn)
|
||||
|
||||
for line in check:
|
||||
if line.startswith('---'):
|
||||
check.close()
|
||||
return True
|
||||
|
||||
check.close()
|
||||
return False
|
||||
|
||||
|
||||
fileCount = 0
|
||||
delList = []
|
||||
|
||||
master = open('master-doc.txt')
|
||||
firstLine = master.readline().rstrip('\r\n')
|
||||
master.close()
|
||||
|
||||
if firstLine == '<!-- imploded -->':
|
||||
print('Master file has already been imploded.')
|
||||
exit(0)
|
||||
|
||||
if os.rename('master-doc.txt', 'master-doc.bak') == False:
|
||||
print('Could not rename master-doc.txt!')
|
||||
exit(-1)
|
||||
|
||||
master = open('master-doc.bak', 'r')
|
||||
implode = open('master-doc.txt', 'w')
|
||||
|
||||
implode.write('<!-- imploded -->\n')
|
||||
|
||||
for line in master:
|
||||
lineCount = lineCount + 1
|
||||
|
||||
# Do any header parsing if needed...
|
||||
if line.startswith('---'):
|
||||
|
||||
noMove = False
|
||||
header = ParseHeader(master)
|
||||
|
||||
# Pull in files and write the result to the master file
|
||||
implode.write('\n---\n' + 'title: ' + header['title'] + '\n')
|
||||
|
||||
if header['part'] != 'part':
|
||||
if 'menu_title' in header:
|
||||
implode.write('menu_title: ' + header['menu_title'] + '\n')
|
||||
|
||||
if 'link' in header:
|
||||
implode.write('link: ' + header['link'] + '\n')
|
||||
|
||||
if 'style' in header:
|
||||
implode.write('style: ' + header['style'] + '\n')
|
||||
|
||||
implode.write('file: ' + header['include'] + '\n')
|
||||
|
||||
if ('exclude' in header) and ('include' in header):
|
||||
noMove = True
|
||||
implode.write('include: ' + header['include'] + '\n')
|
||||
implode.write('exclude: yes\n')
|
||||
|
||||
implode.write('part: ' + header['part'] + '\n' + '---\n')
|
||||
|
||||
# Only parts have no content...
|
||||
if header['part'] != 'part':
|
||||
if noMove:
|
||||
implode.write('\n')
|
||||
else:
|
||||
fileCount = fileCount + 1
|
||||
inclFile = 'include/' + header['include']
|
||||
|
||||
try:
|
||||
fromFile = open(inclFile)
|
||||
except (FileNotFoundError):
|
||||
print('Could not find include file "include/' + header['include'] + '"; aborting!')
|
||||
os.remove('master-doc.txt')
|
||||
os.rename('master-doc.bak', 'master-doc.txt')
|
||||
exit(-1)
|
||||
|
||||
#eventually this will go away, as this will never happen again...
|
||||
if CheckForHeader(inclFile) == True:
|
||||
|
||||
# Skip the header
|
||||
while fromFile.readline().startswith('---') == False:
|
||||
pass
|
||||
|
||||
ln = fromFile.readline()
|
||||
|
||||
while fromFile.readline().startswith('---') == False:
|
||||
pass
|
||||
|
||||
shutil.copyfileobj(fromFile, implode)
|
||||
fromFile.close()
|
||||
delList.append(inclFile)
|
||||
|
||||
master.close()
|
||||
implode.close()
|
||||
|
||||
print('Processed ' + str(lineCount) + ' lines.')
|
||||
print('Imploded master document from ' + str(fileCount) + ' files.')
|
||||
|
||||
# Cleanup after successful implode
|
||||
os.remove('master-doc.bak')
|
||||
|
||||
for name in delList:
|
||||
os.remove(name)
|
||||
|
229
import.rb
Normal file
229
import.rb
Normal file
@ -0,0 +1,229 @@
|
||||
require 'nokogiri'
|
||||
require 'fileutils'
|
||||
require 'open-uri'
|
||||
|
||||
URL = 'http://ardour.org/book/export/html/5848'
|
||||
FILENAME = 'drupal-export.html'
|
||||
|
||||
WRITE = true
|
||||
DOWNLOAD_FILES = false
|
||||
GET_ARDOUR_ORG_IMAGES = false
|
||||
HANDLE_OTHER_IMAGES = false
|
||||
|
||||
OUTPUT_DIR = '_manual'
|
||||
|
||||
FILES_DIR = 'source'
|
||||
|
||||
SLUG_MAPPINGS = {
|
||||
'working_with_sessions' => 'sessions',
|
||||
'export_stem' => 'export',
|
||||
'track_groups' => 'track_bus_groups',
|
||||
'vst_support' => 'windows_vst',
|
||||
'kbd_default' => 'default_bindings',
|
||||
'midistep_entry' => 'midi_step_entry',
|
||||
'midi_stepentry' => 'midi_step_entry'
|
||||
}
|
||||
|
||||
MISSING_SLUGS = %w(
|
||||
range_selection
|
||||
track_templates
|
||||
track_template
|
||||
color_dialog
|
||||
region_layering
|
||||
round_robin_inputs
|
||||
mcp_osx
|
||||
mcp_new_device
|
||||
)
|
||||
|
||||
FILES_MAPPINGS = {
|
||||
'/files/a3_mnemonic_cheatsheet.pdf' => '/files/ardour-2.8.3-bindings-x.pdf',
|
||||
'/files/a3_mnemonic_cheat_sheet_osx.pdf' => '/files/ardour-2.8.3-bindings-osx-a4.pdf'
|
||||
}
|
||||
|
||||
LINK_SLUG_TO_NODE_ID = {}
|
||||
|
||||
def link_slug_to_node_id(slug)
|
||||
|
||||
slug = SLUG_MAPPINGS[slug] || slug
|
||||
|
||||
return nil if MISSING_SLUGS.include? slug
|
||||
|
||||
LINK_SLUG_TO_NODE_ID[slug] ||= begin
|
||||
filename = "tmp/slug-to-node/#{slug}"
|
||||
|
||||
if File.exists? filename
|
||||
File.read(filename).to_i
|
||||
else
|
||||
url = "http://ardour.org/manual/#{slug}"
|
||||
puts "opening #{url}"
|
||||
node_id = Nokogiri(open(url)).at('#content .node')['id'].sub(/^node\-/,'').to_i
|
||||
File.open(filename,'w+') { |f| f << node_id }
|
||||
node_id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def register_node(node_id, path)
|
||||
filename = "tmp/node-to-path/#{node_id}"
|
||||
File.open(filename,'w+') { |f| f << path } unless File.exists? filename
|
||||
end
|
||||
|
||||
def node_id_to_path!(node_id)
|
||||
filename = "tmp/node-to-path/#{node_id}"
|
||||
return '' unless File.exists? filename
|
||||
#raise "no path for node-id #{node_id}" unless File.exists? filename
|
||||
File.read(filename)
|
||||
end
|
||||
|
||||
def process(html, level = 1, path = [], numbered_path = [])
|
||||
html.search("div.section-#{level}").each_with_index do |child, i|
|
||||
|
||||
title = child.at('h1.book-heading').inner_text
|
||||
|
||||
node_id = child['id'].sub(/^node\-/,'')
|
||||
|
||||
|
||||
slug = title.downcase.gsub(' ','-').gsub(/[^a-z0-9\-]/, '')
|
||||
|
||||
root = slug == 'the-ardour3-manual'
|
||||
|
||||
if root
|
||||
|
||||
# top level
|
||||
|
||||
this_path = []
|
||||
this_numbered_path = []
|
||||
else
|
||||
numbered_slug = "%02d_%s" % [i + 1, slug, node_id]
|
||||
|
||||
this_path = path + [slug]
|
||||
this_numbered_path = numbered_path + [numbered_slug]
|
||||
end
|
||||
|
||||
register_node node_id, this_path.join('/')
|
||||
|
||||
indent = ' ' * level * 3
|
||||
|
||||
has_children = child.search("div.section-#{level + 1}").length > 0 #&& possible_children.any? { |child| child.search('div').length > 0 }
|
||||
|
||||
output_dir = "#{OUTPUT_DIR}/#{this_numbered_path.join('/')}"
|
||||
|
||||
output_file = case
|
||||
when root
|
||||
"#{OUTPUT_DIR}/blah.html"
|
||||
#when has_children
|
||||
# "#{output_dir}/index.html"
|
||||
else
|
||||
"#{output_dir}.html"
|
||||
end
|
||||
|
||||
content = child.dup
|
||||
|
||||
content.search('h1.book-heading').remove
|
||||
content.search("div.section-#{level + 1}").remove
|
||||
|
||||
if heading = content.at('h2') and heading.inner_text == title
|
||||
heading.remove
|
||||
end
|
||||
|
||||
#puts "processing links in [#{this_path.join('/')}]"
|
||||
|
||||
content.search('a').each do |a|
|
||||
href = a['href']
|
||||
case href
|
||||
when /^\/manual\/(.*)/
|
||||
slug = $1
|
||||
if node_id = link_slug_to_node_id(slug)
|
||||
link_path = node_id_to_path! node_id
|
||||
#puts " link slug [#{slug}] -> #{node_id} -> #{link_path}"
|
||||
a['href'] = "/#{link_path}"
|
||||
else
|
||||
a['href'] = "/missing"
|
||||
end
|
||||
|
||||
when /^(\/files\/.*)/
|
||||
|
||||
if DOWNLOAD_FILES
|
||||
file_path = $1
|
||||
|
||||
|
||||
if FILES_MAPPINGS[file_path]
|
||||
file_path = FILES_MAPPINGS[file_path]
|
||||
a['href'] = file_path
|
||||
end
|
||||
|
||||
puts "downloading [#{file_path}] (for #{this_path.join('/')})"
|
||||
|
||||
filename = "#{FILES_DIR}/#{file_path}"
|
||||
FileUtils.mkdir_p File.dirname(filename)
|
||||
File.open(filename,'w+') { |f| f << open("http://ardour.org/#{file_path}").read }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
content.search('img').each do |img|
|
||||
|
||||
src = img['src']
|
||||
|
||||
case src
|
||||
when /^\//
|
||||
if GET_ARDOUR_ORG_IMAGES
|
||||
url = "http://ardour.org#{src}"
|
||||
puts "getting #{url}"
|
||||
img_path = "#{FILES_DIR}#{src}"
|
||||
FileUtils.mkdir_p File.dirname(img_path)
|
||||
File.open(img_path, 'w+') { |f| f << open(url).read }
|
||||
end
|
||||
when /^http/
|
||||
new_src = '/' + src.sub(/^http:\/\/[^\/]+\//,'')
|
||||
img['src'] = new_src
|
||||
|
||||
if HANDLE_OTHER_IMAGES
|
||||
puts "new_src: #{new_src}"
|
||||
img_path = "#{FILES_DIR}#{new_src}"
|
||||
FileUtils.mkdir_p File.dirname(img_path)
|
||||
puts "getting #{src}"
|
||||
File.open(img_path, 'w+') { |f| f << open(src).read }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if WRITE
|
||||
FileUtils.mkdir_p output_dir if has_children
|
||||
File.open(output_file, 'w:UTF-8') do |f|
|
||||
f << <<-HTML
|
||||
---
|
||||
layout: default
|
||||
title: #{title}
|
||||
---
|
||||
|
||||
#{content.inner_html}
|
||||
HTML
|
||||
|
||||
if has_children
|
||||
f << <<-HTML
|
||||
{% children %}
|
||||
HTML
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
process(child, level + 1, this_path, this_numbered_path)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
unless File.exists?(FILENAME)
|
||||
puts "downloading #{URL} to #{FILENAME}"
|
||||
File.open(FILENAME,'w+') { |f| f << open(URL).read }
|
||||
end
|
||||
|
||||
FileUtils.mkdir_p('tmp/node-to-path')
|
||||
FileUtils.mkdir_p('tmp/slug-to-node')
|
||||
|
||||
process Nokogiri(File.read(FILENAME))
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Ardour Concepts
|
||||
---
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Ardour Setup for Surround
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Ardour Systems
|
||||
---
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Arranging Regions
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Audio Recording
|
||||
---
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Automation
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Basic Mixing
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Clocks
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Configuring MIDI
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Controls
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Edit Mode and Tools
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Editing Basics
|
||||
---
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
title: Editing Regions and Selections
|
||||
---
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Fades and Crossfades
|
||||
---
|
||||
|
||||
|
@ -1,35 +0,0 @@
|
||||
---
|
||||
title: Favorite Plugins Window
|
||||
---
|
||||
|
||||
<img class="right" src="/images/favorite-plugins.png" alt="Favorite Plugins wind
|
||||
ow">
|
||||
|
||||
<p>
|
||||
The <dfn>Favorite Plugins</dfn> window is on the top-left side of the <dfn>Mixer Window</dfn>. Like other elements in that window it has variable height and can be hidden by dragging it to zero-height. If it is not visible, the top-handle can be grabbed and dragged down to reveal it.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Plugin names that have a right facing triangle next to them have presets associated with them; clicking on the triangle will cause all presets associated with the plugin to show in the list.
|
||||
</p>
|
||||
|
||||
<h2>Features</h2>
|
||||
|
||||
<img class="right" src="/images/mixer-to-fav-dnd.png" alt="Dragging plugin to Favorites window">
|
||||
<p>
|
||||
The Favorite Plugins window provides easy access to frequently used plugins:
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<li>Plugins can be dragged from the window to any track or bus <a href="@@processor-box"><dfn>processor box</dfn></a>, which will add the plugin to that track or bus at the given position.</li>
|
||||
<li>The list includes user-presets for the plugins. Dragging a preset to a given track or bus will load that preset after adding the plugin.</li>
|
||||
<li>Double-clicking on a plugin or preset adds the given plugin to all selected tracks/busses pre-fader. Other insert positions are available from the context menu (right click).</li>
|
||||
<li>Dragging a plugin from a track into the window will add it to the list and optionally create a new preset from the current settings. The horizontal line in the list shows the spot where the plugin will land.</li>
|
||||
<li>The context-menu allows the deletion of presets or removal of the plugin from the list.</li>
|
||||
<li>Plugins in the list can be re-ordered using drag & drop. The custom order is saved.</li>
|
||||
</ul>
|
||||
|
||||
<p class="note">
|
||||
When favorites are added with the <a href="@@plugin-manager">Plugin Manager</a>, they are appended to the bottom of the list.
|
||||
</p>
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: File and Session Management and Compatibility
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Grouping Tracks
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: I/O Setup
|
||||
---
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Importing and Exporting Session Data
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,61 +0,0 @@
|
||||
---
|
||||
title: KDE Plasma 5
|
||||
---
|
||||
|
||||
<p>
|
||||
Under <dfn>KDE Plasma 5</dfn>, plugin and various other windows will not stay
|
||||
on top of any main window; therefore a workaround is required.
|
||||
</p>
|
||||
|
||||
<h2>Workaround for ancillary windows not staying on top in KDE Plasma 5</h2>
|
||||
|
||||
<p>
|
||||
In order to force ancillary windows in Ardour to stay on top, the following
|
||||
steps are necessary:
|
||||
</p>
|
||||
|
||||
<ol>
|
||||
<li>Launch the <kbd class="menu">System Settings</kbd> application.</li>
|
||||
<li>Open <kbd class="menu">Workspace > Window Managment</kbd>.</li>
|
||||
<li>Select <kbd class="menu">Window Rules</kbd> in the left-hand sidebar. It
|
||||
should default to the <kbd class="menu">Window matching</kbd> tab.</li>
|
||||
<li>Click on the <kbd class="menu">New...</kbd> button.</li>
|
||||
<li>On the line that says <kbd class="menu">Window class (application)</kbd>,
|
||||
set the combo box to <kbd class="menu">Substring Match</kbd> and type <kbd
|
||||
class="user">ardour</kbd> in the text entry field.</li>
|
||||
<li>In the list box that is labeled <kbd class="menu">Window types:</kbd>,
|
||||
click on the option <kbd class="menu">Dialog Window</kbd>, then press and
|
||||
hold <kbd>Ctrl</kbd> while clicking on the second option <kbd
|
||||
class="menu">Utility Window</kbd>.</li>
|
||||
<li>Select the <kbd class="menu">Arrangement & Access</kbd> tab.</li>
|
||||
<li>Check the box next to the <kbd class="menu">Keep above</kbd> option. On
|
||||
the same line, select <kbd class="menu">Force</kbd> from the combo box, then
|
||||
click on the <kbd class="menu">Yes</kbd> radio button for that line.</li>
|
||||
<li>Click on the <kbd class="menu">OK</kbd> button to dismiss the dialog.
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<p>
|
||||
At this point you can close the <kbd class="menu">System Settings</kbd>
|
||||
application.
|
||||
</p>
|
||||
|
||||
<h3>Background Info</h3>
|
||||
|
||||
<p>
|
||||
<a href="https://bugs.kde.org/show_bug.cgi?id=172615#c26">According to one of
|
||||
the lead KDE developers</a>, they are not willing to follow the <abbr
|
||||
title="Inter-Client Communication Conventions Manual">ICCCM</abbr> standard
|
||||
for utility windows. Apparently they are alone in this understanding, as
|
||||
plugin windows on Ardour under Linux work out of the box on every other <abbr
|
||||
title="Window Manager">WM</abbr> out there.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Under KDE 4, there was a workaround in Ardour (<kbd class="menu">Preferences
|
||||
> Theme > All floating windows are dialogs</kbd>) that would "trick"
|
||||
KDE into forcing certain window types to be on top of their parent windows,
|
||||
but this no longer works under KDE Plasma 5.
|
||||
</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Keyboard and Mouse Shortcuts
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Lua Scripting in Ardour
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Making Selections
|
||||
---
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Memory Locations
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: MIDI Editing
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: MIDI Editors
|
||||
---
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
---
|
||||
title: MIDI Event List
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: MIDI Recording
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Mixdown
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Mixer Strips
|
||||
---
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Multichannel Tracks and Signal Routing
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Playing Back Track Material
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Playlists
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Plugin and Hardware Inserts
|
||||
---
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
---
|
||||
title: Plugins Bundled With Ardour
|
||||
---
|
||||
|
||||
<p>
|
||||
Ardour now comes with the following plugins as part of a standard installation:
|
||||
</p>
|
||||
|
||||
<dl class="narrower-table">
|
||||
<dt>a-Amplifier</dt>
|
||||
<dd>A versatile ±20dB multichannel amplifier</dd>
|
||||
<dt>a-Compressor</dt>
|
||||
<dd>A side-chain enabled compressor with the usual controls. Comes in stereo and mono versions</dd>
|
||||
<dt>a-Delay</dt>
|
||||
<dd>A basic single-tap delay line, with tempo sync</dd>
|
||||
<dt>a-EQ</dt>
|
||||
<dd>A nice sounding 4-band parametric EQ with shelves</dd>
|
||||
<dt>a-Fluid Synth</dt>
|
||||
<dd>Wraps the Fluidsynth SoundFont2 synthesis engine as a new sample player</dd>
|
||||
<dt>a-High/Low Pass Filter</dt>
|
||||
<dd>Independent high and low pass filters with steepness up to 48dB/octave</dd>
|
||||
<dt>a-Inline Scope</dt>
|
||||
<dd>A mixer strip inline waveform display</dd>
|
||||
<dt>a-Inline Spectrogram</dt>
|
||||
<dd>A mixer strip inline specturm display</dd>
|
||||
<dt>a-MIDI Monitor</dt>
|
||||
<dd>A mixer strip inline display to show recent <abbr title="Musical Instrument Digital Interface">MIDI</abbr> events</dd>
|
||||
<dt>a-Reverb</dt>
|
||||
<dd>A reverb that finds a balance between sounding good, using a lot of CPU and having too many controls</dd>
|
||||
</dl>
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Preferences
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Punch Recording Modes
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Record Setup
|
||||
---
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Region Loops and Groups
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,7 +0,0 @@
|
||||
---
|
||||
title: Rhythm Ferret
|
||||
---
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Score Editor
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Sessions
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Surround Panning and Mixing
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: System Setup
|
||||
---
|
||||
|
||||
|
@ -1,88 +0,0 @@
|
||||
---
|
||||
title: Techniques for Working with Tempo and Meter
|
||||
---
|
||||
|
||||
<h3>Techniques </h3>
|
||||
|
||||
<p>
|
||||
As a general approach, the best way to control tempo ramps is to use them in pairs.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Lets imagine we want to match the click to a drum performance recorded in 'free time'.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The first thing we need to do is determine where the first beat is. Drag the first meter to that position.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now the first click will be in time with the first beat. To get all the other beats to align, we listen to the drums and visually locate the position of bar 4. You may wish to place the playhead here.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We then locate bar 4 in the BBT ruler and while holding the constraint modifier, drag it to bar 4 in the drum performance.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We notice that the click now matches the first 4 bars, but after that it wanders off. You will see this reflected in the tempo lines.. they won't quite match the drum hits. We now locate the earliest position where the click doesn't match, and place a new tempo just before this. Two bars later, place another new tempo.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Now while dragging any beat <strong>after</strong> the second new tempo, watch the drum audio and tempo lines until they align.
|
||||
</p>
|
||||
|
||||
<p class="note">
|
||||
Notice what is happening here: the tempo previous to your mouse pointer is being changed so that the beat you grabbed aligns with the pointer. Notice that the tempo lines previous to the changed one also move. This is because the previous tempo is ramping <strong>to</strong> the tempo you are changing. Look further to the left. The tempo lines in the first four bars do not move.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Again, some time later the click will not align. I didn't say this was easy.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Repeat the same technique: add two new tempos and drag the BBT ruler <strong>after</strong> the newest tempo so that the beats align with the audio again.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In a general sense, adding tempo markers in pairs allows you to 'pin' your previous work while you move further to the right.
|
||||
</p>
|
||||
|
||||
<h3>Another use case: matching accelerando</h3>
|
||||
|
||||
<p>
|
||||
Imagine you have some video and have located where your music cue begins. Move the first meter to that frame (you may snap to TC frames, but not music with an audio locked meter).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Find a starting tempo by listening to the click while you drag the meter's tempo vertically using the constraint modifier.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
You have the playhead at point where the dude slams the phone down, and your idea was that 4|1|0 would be good for this, but you want an accelerando to that point.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Add a tempo at bar 4.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Holding down the constraint modifier, and with snap set to 'TC Frames', grab the BBT ruler just <strong>after</strong> 4|1|0. Drag the ruler so that 4|1|0 snaps to the 'phone' frame.
|
||||
</p>
|
||||
|
||||
<p class="note">
|
||||
Notice what happened: The second tempo was changed.<br />
|
||||
You had set a musical position for the second tempo marker. It was not aligned with the frame you wanted, so you dragged the BBT ruler, making the second tempo provide enough pulses over the ramp for 4|1|0 to align with the desired frame.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If the ramp doesn't feel right, you may add more points within it and keep adjusting beat positions in a similar manner.
|
||||
</p>
|
||||
|
||||
<h3>General</h3>
|
||||
|
||||
<p>
|
||||
Audio locked meters can be useful when composing, as they allow a continuous piece of music to be worked on in isolated segments, preventing the listening fatigue of a fixed form. Reassembly is left as an excercise for the reader.
|
||||
</p>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Time, Tempo and Meter
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Tracks
|
||||
---
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
---
|
||||
title: Using Key Bindings
|
||||
---
|
||||
|
||||
<p>
|
||||
Ardour has many available commands for playback control that can be bound
|
||||
to keys. Many of them have default bindings, some do not, so the list below
|
||||
shows both the default bindings and internal command names.
|
||||
</p>
|
||||
|
||||
<dl class="wide-table">
|
||||
<dt><kbd>Space</kbd></dt>
|
||||
<dd>switch between playback and stop.</dd>
|
||||
<dt><kbd>Home</kbd></dt>
|
||||
<dd>Move playhead to session start marker</dd>
|
||||
<dt><kbd>End</kbd></dt>
|
||||
<dd>Move playhead to session end marker</dd>
|
||||
<dt><kbd>→</kbd></dt>
|
||||
<dd></dd>
|
||||
<dt><kbd>←</kbd></dt>
|
||||
<dd></dd>
|
||||
<dt><kbd>0</kbd></dt>
|
||||
<dd>Move playhead to start of the timeline</dd>
|
||||
</dl>
|
||||
|
||||
<p>Commands without default bindings include:</p>
|
||||
|
||||
<p class="fixme">Add content</p>
|
||||
|
||||
|
||||
|
@ -1,4 +0,0 @@
|
||||
---
|
||||
title: Welcome to Ardour
|
||||
---
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Working with Field Recorders in Ardour
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Working with Synchronization
|
||||
---
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
---
|
||||
title: Working with Video in Ardour
|
||||
---
|
||||
|
||||
|
1932
master-doc.txt
1932
master-doc.txt
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
|
||||
<head>
|
||||
<title>{{page.page_title}}</title>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link href="{{page.bootstrap_path}}/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="{{page.bootstrap_path}}/css/bootstrap-responsive.min.css" rel="stylesheet" />
|
||||
|
||||
<link href="/css/app.css" rel="stylesheet" />
|
||||
{% if page.style %}
|
||||
<link href="/css/{{page.style}}.css" rel="stylesheet" />
|
||||
{% endif %}
|
||||
|
||||
<link href='http://fonts.googleapis.com/css?family=Junge' rel='stylesheet' type='text/css' />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container-fluid"><div class="row-fluid">
|
||||
<div id="tree"><div id="tree-inner">
|
||||
<h1 class="title"><a href="/"><img src="/images/logo.png" alt="The Ardour Manual" /></a></h1>
|
||||
{% tree %}
|
||||
</div></div>
|
||||
<div class="span12" id="content">
|
||||
<div id="search" class="gcse-search"></div>
|
||||
<div id="content-main">
|
||||
<h1 class="title">{{ page.title }}</h1>
|
||||
{{ content }}
|
||||
{% prevnext %}
|
||||
</div>
|
||||
</div>
|
||||
</div></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
// I'll go to hell for this
|
||||
var isA = function(regex) { return navigator.userAgent.match(regex) };
|
||||
var isAbout = function(regex) { return document.getElementsByTagName('h1')[1].textContent.match(regex) };
|
||||
|
||||
if ( (isA(/Mac/) || isAbout(/OS X/)) && (!isAbout(/Linux/)) ) {
|
||||
var e = document.getElementsByTagName('body')[0];
|
||||
e.className += ' mac'; // class magic for Cmd vs. Ctrl keys.
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Google search bar == failure -->
|
||||
<script type="text/javascript">
|
||||
(function()
|
||||
{
|
||||
var cx = '011950134405426689607:2lg2y9xgf3a';
|
||||
var gcse = document.createElement('script'); gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
|
||||
'//www.google.com/cse/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
Binary file not shown.
Before Width: | Height: | Size: 20 KiB |
@ -1,6 +1,6 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; url=/toc/"/>
|
||||
<meta http-equiv="refresh" content="0; url=/welcome-to-ardour/"/>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user