Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple Value-Matching #2

Open
eob opened this issue Feb 21, 2013 · 0 comments
Open

Simple Value-Matching #2

eob opened this issue Feb 21, 2013 · 0 comments
Assignees

Comments

@eob
Copy link
Member

eob commented Feb 21, 2013

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants