When using Groovy MarkupBuilder, I have places where I need to output text to a document or call a function that outputs text to a document. I am currently using the undefined "text" tag for output. Is there a better way to write this code?
MarkupBuilder
li { text("${type.getAlias()} blah blah ") function1(type.getXYZ()) if (type instanceof Class1) { text(" implements ") ft.getList().each { if (it == '') return text(it) if (!function2(type, it)) text(", ") } } }
In fact, it is recommended to use mkp.yield, for example,
mkp.yield
src.p { mkp.yield 'Some element that has a ' strong 'child element' mkp.yield ' which seems pretty basic.' }
for creating
<p>Some element that has a <strong>child element</strong> which seems pretty basic.</p>
Enable Method:
void text(n){ builder.yield n }
, (I) -, , . MarkupBuilder , , .
Source: https://habr.com/ru/post/1696501/More articles:Is GDI + a βusableβ technology? - .nethttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1696497/csv-or-sheet-in-xls-to-sql-create-and-insert-statements-with-net&usg=ALkJrhj9lllxaGFcJN9piW-KR767JXnwjwDoes anyone know of existing code for reading a mork file (Thunderbird address book)? - .netHow to process Excel files stored in image data type column using SSIS package? - ssisHow to solve single step problem with VS2008 SP1 - c #MD5Crypt Algorithm - .nethttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1696503/syncing-libraryproject-subversion-respositories&usg=ALkJrhgJbAozqF2hilfqxUjw5cs3U87mdwWhich Javascript text editor will not violate browser spell checking? - javascriptFree or open source collaboration / e-learning software - productRunning Apache with another web server? - linuxAll Articles