From: Thomas Walker Lynch Date: Fri, 6 Mar 2026 14:00:18 +0000 (+0000) Subject: Adding a README.md X-Git-Url: https://git.reasoningtechnology.com/sitemap.xml?a=commitdiff_plain;h=94d3db9586baefd1824bb5ae9913dcc932144c49;p=RT-style-JS_public Adding a README.md --- diff --git a/README.md b/README.md index 273c496..07a4dcd 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,55 @@ # RT-style-JS_public -A JavaScript based layout, themes, and elements semantic HTML documents. Used for documents on RT projects. +A JavaScript based layout, themes, and semantic elements for HTML documents. Used for documents on RT projects. ## To build the library -This project is based on RT's **Harmony** project skeleton. Hence there are role directroies. After clocing the repo, go to the top of the project and type: +This project is based on RT's **Harmony** project skeleton. Hence there are role directories. After cloning the repo, go to the top of the project and type: ```bash . setup developer make -./developer/tool/release write +release write ``` -The resulting JavaScript library will be located in the `consumer/release/RT` +The resulting JavaScript library will be located in `consumer/release/RT`. ## To use the library -Here is an example document using the library. +Using the library requires creating two files, and then including one of them in the document. +One file is a js dictionary that maps names to style directory paths. The other does some setup and loads the dictionary. + +### 1. The Style Dictionary + +First, create a `style_directory_dict.js` file at a central location in the project. We will refer to this location as ``. This dictionary tells the inclusion engine where the named style directories are located. Suppose that a style directory is located at ``, the dictionary will appear as: + +```javascript +window.StyleRT_namespaces = { + "RT": window.RT_REPO_ROOT + "/consumer/release/RT" +}; +``` + +In the Harmony skeleton, there is a good example of a style dictionary located at `shared/style_directory_dict.js`. The style dictionary in this project is probably not a good example, because, for practical reasons, it points back into the developer's code. + +### 2. The Document Setup Script + +Next, create a `setup.js` script in the same directory with the HTML document. In our projects, this is typically a general document directory that can have many documents. This `setup.js` script sets the relative path back to the project root, loads the `style_directory_dict.js` file, and pulls in the core js code needed for all documents. + +Here is an example `setup.js`. Find other examples in the document directories in this project and other RT projects, such as the Harmony project. + +```javascript +window.RT_REPO_ROOT = ""; +document.write(''); +document.write(''); +document.write(''); +``` + +### 3. The HTML Document + +Typically the `style_directory_dict.js` and `setup.js` files are created by an administrator in advance. The same person who creates the `document` directory that the documents live in. + +With the bootstrap script in place alongside the HTML file, the document authoring using the style library requires only that `setup.js` is included, as shown in the example code below. ```html @@ -26,12 +58,7 @@ Here is an example document using the library. Example Document - '); - document.write(''); - document.write(''); - +