-
-
Notifications
You must be signed in to change notification settings - Fork 36
Getting Started
Some tips to help find your way around the code.
-
content/
Just thenewStyle.csl
template at present. -
css/
The .css style files. -
docs/
A submodule containing this wiki documentation. -
exampleCitationsGenerator/
A node.js script for generating example citations using all the styles in the csl-styles repository. -
external/
All external dependencies go here. -
generated/
All files generated fromconfigure.sh
, including the CSL schema in.rng
format and example formatted citations in every style. -
html/
Html content (all retreived using AJAX calls at present). -
pages/
To open in your browser. Example bare-bones versions of the four pages, a settings page, and test pages. -
src/
The javascript source files.
This needs to be done if you update the external/csl-styles
or external/csl-schema
submodules or any code affecting the example citation generation.
- Run
configure.sh
This does the following:
- Converts the CSL schema files in
cslEditorLib/external/csl-schema
to.rng
format. - Generates example citations and bibliographies for all the styles in
cslEditorLib/external/csl-styles
using the reference metadata incslEditorLib/src/exampleData.js
All output goes into the generated/
directory, which is checked in to the repository for convenience.
The code uses jQuery extensively and RequireJS for module dependencies. The code will make a lot more sense if you familiarise yourself with these.
-
Each
.js
file exceptconfig.js
contains a RequireJS module definition. -
When requiring a module with filename
FILENAME
, it's always given the variable nameCSLEDIT_$FILENAME
. e.g. in the following module definition,src/controller.js
is loaded as variableCSLEDIT_controller
:
require(['src/controller'], function (CSLEDIT_controller) {
// Add an empty 'macro' node
CSLEDIT_controller.exec("addNode", [0, "last", {name: macro, attributes: [], children: []} ]);
});
- Modules starting with a capital letter are constructor functions, modules starting with a lower case letter are global instances. e.g.:
define(['src/storage', 'src/VisualEditor'], function (CSLEDIT_storage, CSLEDIT_VisualEditor) {
// CSLEDIT_storage is a global instance
CSLEDIT_storage.clear();
// CSLEDIT_VisualEditor is a constructor function which requires instantiation
var visualEditor = new CSLEDIT_VisualEditor(new CSLEDIT_VisualEditor('#visualEditorContainer', {
onLoaded : function () {
alert("Loaded visualEditor. Current style id is " + visualEditor.getStyleId());
}
});
});
- node-jshint is used to ensure a reasonably consistent coding style, there's a .jshintrc with the options.