=============== Layout Includes =============== Some applications can benefit from using includes or merge tags to share common templates. Nested includes are also supported. Method ====== .. code-block:: :emphasize-lines: 3,24 android.setViewModelByProject( { variable: [{ name: "exampleData", type: "com.example.ExampleData" }] }, "project-1" ); squared.parseDocument({ element: document.body, projectId: "project-1", // Affects all layouts in same project enabledIncludes: true, includableElements: [ { selectorStart: "#item2", selectorEnd: "#item4", pathname: "app/src/main/res/layout-land", filename: "filename1.xml", merge: true // Multiple elements will auto-merge }, { selectorStart: "#item5", selectorEnd: "#item5", filename: "filename2", // Uses default layout file extension ".xml" viewModel: "exampleData" // One element only when "merge = false" } ] }); .. note:: By *sessionId* has precedence when associating a view model. Inline ====== .. code-block:: html :emphasize-lines: 6
Item 1
Item 2
Item 3
Item 4
Item 5
.. tip:: ``data-pathname-android`` AND ``data-filename-android`` can also be used with any :func:`parseDocument` root element. The ``-android`` suffix is optional when using only one framework. .. code-block:: xml :caption: Output :emphasize-lines: 5,18 Item 1 Item 2 Item 3 Item 4 Item 5 The attributes ``data-android-include-start`` and ``data-android-include-end`` can only be applied to elements which share the same parent container. .. seealso:: Demo page using `squared-express `_ [#]_ for an actual implementation. .. [#] https://github.com/anpham6/squared/blob/master/html/demos/gradient.html