Skip to content

Simple Value-Matching #2

@eob

Description

@eob

Given a content map like this:

"name":"Test map. Just to load some URLs",
"domain":"groups.csail.mit.edu",
"pages":[
  {
    "name":"index",
    "path":"/en"
    "data": {
      "blog": {
        "title": "Haystack Blog",
        "link": "http://groups.csail.mit.edu/haystack/blog"
        "subtitle": 'MIT CSAIL Research (<a href="http://haystack.csail.mit.edu/">Group Website</a>)'
      }
    },
    "cts": {
    }
  }
 ]
}

Create a pipeline stage (before output-files) that goes over every file in sources and:

  1. Walks through each node and attribute in the DOM and, for example, if it finds Haystack Blog then applies the class title. The data section in the ContentMap will be used for this.
  2. Saves this modified HTML (with the classes added) to a new slot in the theme object. E.g, before it was at this.data.sources[name] and we'll save this new one to this.data.mockups[name]. The reason is because with these annotations the page can be used as a mockup.
  3. For every class we added, keep a data structure (your choice) on theme.data that records we've done this and whether it was an attribute or the innerHTML. This structure can be converted directly into a CTS sheet for each page.. e.g, " .title { value: title }" or ".link { value(@href): link }"
  4. In the output-file.js stage, create a CTS sheet for every page in data.mockups and write to it every relevant CTS rule from the data structure that you created in step 3 above.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions