-
-
Notifications
You must be signed in to change notification settings - Fork 36
Getting Started
SteveRidout edited this page Sep 5, 2012
·
10 revisions
Some tips to help find your way around the code.
-
content/Just thenewStyle.csltemplate at present. -
css/The .css style files. -
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.rngformat 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.
-
The code uses RequireJS for module dependencies.
-
Each
.jsfile exceptconfig.jscontains a RequireJS module definition. -
When used, modules are always given the variable name
CSLEDIT_$FILENAME. e.g. in the following module definition,src/controller.jsis 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.
This only needs to be done if you change 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-schemato.rngformat. - Generates example citations and bibliographies for all the styles in
cslEditorLib/external/csl-stylesusing the reference metadata incslEditorLib/src/exampleData.js
All output goes into the generated/ directory, which is checked in to the repository for convenience.