jwulf / press-star

A node-based implementation of the popular Death Star authoring environment for PressGang / Docbook
4 stars 1 forks source link

Conditional support in editor preview / livepatching #24

Closed jwulf closed 8 years ago

jwulf commented 11 years ago

jwulf: 1. implement conditionalization in the HTML preview in the editor [10:25am] jwulf: a. Scan the topic for conditions [10:25am] jwulf: b. present a drop-down with the conditions [10:25am] jwulf: c. when the user selects one, apply it to the text [10:26am] jwulf: so you can preview the topic in each conditionalized state

Live patching should also use the condition to apply the patch.

jwulf commented 11 years ago

Checkboxes to allow multiple conditions.

jwulf commented 11 years ago

Underway. Conditions are now detected on the server, and piped back to the client. The client now displays checkboxes if the server reports conditions.

When the client requests the preview, it can specify conditions. On the server these conditions are used to remove non-conformant conditionalized elements from the XML DOM.

To do: pass the raw XML plus conditions to the live patcher, then get the conditions from the content spec before rendering, then applying the patch

jwulf commented 11 years ago

http://skynet-dev.usersys.redhat.com:8080/pressgang-ccms/rest/1/contentspecnodes/get/json/query;csNodeEntityId=3737?expand=%7B%22branches%22%3A%5B%7B%22trunk%22%3A%7B%22name%22%3A+%22nodes%22%7D%2C+%22branches%22%3A%5B%7B%22trunk%22%3A%7B%22name%22%3A+%22inheritedCondition%22%7D%7D%2C+%7B%22trunk%22%3A%7B%22name%22%3A+%22contentSpec%22%7D%2C+%22branches%22%3A%5B%7B%22trunk%22%3A%7B%22name%22%3A+%22children_OTM%22%7D%7D%5D%7D%5D%7D%5D%7D

expand:{"branches":[{"trunk":{"name": "nodes"}, "branches":[{"trunk":{"name": "inheritedCondition"}}, {"trunk":{"name": "contentSpec"}, "branches":[{"trunk":{"name": "children_OTM"}}]}]}]}

that query will get all the csNodes that relat to topic 3737

each item will also have the "inheritedCondition" property expanded inheritedCondition is the condition on the topic from the content spec, taking into account any overrides at the chapter/spec/topic level
jwulf commented 11 years ago

Here is where it is now:

When the topic XML is sent to the server for preview generation, the server:

(a) scans the topic and builds a profile of conditions in it. The server passes an array of conditions present in the topic back to the client. The client then uses this to display checkboxes for each condition present in the topic.

(b) applies any conditions specified by the client. On the client, the user is presented with a checkbox for each condition detected in the topic. If no checkboxes are selected, no conditions are applied (ie: the user sees all the text, regardless of any condition attributes). If one or more checkboxes are selected, then any conditions that are not selected are removed from the preview.

When the user saves the topic, the current HTML preview is used to patch the book.

Be aware that live patching does not yet have intelligent support for conditions in content specs. If you are editing, for example, the MRG 3 Installation Guide, and save a topic with MRG 3 / MRG 2 conditionals in it, then you would save it with the MRG 3 condition selected in the editor. The MRG 3 book will be patched as expected, with the MRG 3 conditions applied. However, the MRG 2 book will also be patched with the MRG 3 conditions applied.

This will be remedied post-September 8, when the new release of Press Gang is deployed. The new release of Press Gang has functionality that allows the live patcher to request the conditions for a given content spec, and to apply the appropriate conditions before patching the HTML.

jwulf commented 8 years ago

Closing.