cfpb / regulations-site

(DEPRECATED) Web interface for viewing U.S. federal regulations and other regulatory information
Other
28 stars 43 forks source link

Subterp Re-engineering #548

Closed cmc333333 closed 10 years ago

cmc333333 commented 10 years ago

In the previous attempt at subterps, the system looked at the TOC to determine which sections/appendices were in a subterp, compiling a list which were then fetched individually.

This is not an efficient approach (as it leads to multiple calls to generate a subterp) and is also not accurate. Not all interpretations fit into this model (e.g. interpretations of multiple appendices).

To solve these problems, we now take a "subtractive" approach, fetching the whole interpretation and ripping out parts we don't want.

We continue to use the TOC to help determine the subterp associated with an individual comment (needed for citations,) but have modified the method to not use the TOC layer applier. Using the TOC layer applier means we'd need to know the urls, but to know the urls, we need to know the subterps (oh, the cycles). Now, the lets-build-subparts-and-subterps-from-toc-data is its own module. Many other areas of the application (including the toc layer applier, navigation, and internal citations) make use of that module.

khandelwal commented 10 years ago

All of this looks fine to me. Will merge after travis runs.

cmc333333 commented 10 years ago

Added the missing tests.