Disallowing inline content in <li>
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Disallowing inline content in <li>
Post by chrispitude »
In DITA, the <li> element allows both block and inline content:
I would like to disallow inline content in <li> elements, and allow only block elements. In cc_config_ext.xml, I can reject inline elements as follows:
but I can't seem to find the right keyword that rejects plaintext itself. I tried text(), \text, and \\text, but none of these prevent plaintext from being typed in an <li> element.
Is there a magic rejectElements keyword that applies to non-whitespace plaintext, or is this list for elements only?
Thanks!
Code: Select all
<ol>
<li>Do this step first.
<li>
<p>Do this step second:</p>
<fig><image href="second_step.png"/></fig>
</li>
</ol>
Code: Select all
<elementProposals path="li" rejectElements="sup sub codeph [and so on]"/>
Is there a magic rejectElements keyword that applies to non-whitespace plaintext, or is this list for elements only?
Thanks!
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: Disallowing inline content in <li>
Post by adrian_sorop »
Hi Chris,
Unfotunatelly, the magic method doesn't exist...yet
I've added an internal issue to allow this behaviour.
The second best thing you could do is to create a schematron that signals when text is inserted in that list item.
Also, a quick fix that proposes wrapping the plain text in an element would also be usefull.
Regards,
Adrian S.
Unfotunatelly, the magic method doesn't exist...yet

I've added an internal issue to allow this behaviour.
The second best thing you could do is to create a schematron that signals when text is inserted in that list item.
Also, a quick fix that proposes wrapping the plain text in an element would also be usefull.
Regards,
Adrian S.
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Disallowing inline content in <li>
Post by chrispitude »
Thanks Adrian!
That's similar to what we're doing right now, a Schematron check to catch the issue, and a refactoring operation to wrap inline content in <li> in <p>. (I used refactoring because sometimes there is a mix of inline and block content in an <li>, and I wanted to handle it robustly.)
The strange thing is, our cc_config_ext.xml is configured to auto-insert a <p> in new <li> elements, and yet this still happens. I guess it won't be foolproof until I update the schema to do it the right way.
That's similar to what we're doing right now, a Schematron check to catch the issue, and a refactoring operation to wrap inline content in <li> in <p>. (I used refactoring because sometimes there is a mix of inline and block content in an <li>, and I wanted to handle it robustly.)
The strange thing is, our cc_config_ext.xml is configured to auto-insert a <p> in new <li> elements, and yet this still happens. I guess it won't be foolproof until I update the schema to do it the right way.
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: Disallowing inline content in <li>
Post by adrian_sorop »
Hi Chris,
This
This is what I've tested: added the in the cc_config xml.
Every time I inseted a li from Content Completion, the paragraph was also added.
Indeed, if the insert list item toolbar action was used, the list item is inserted without the p. For this to also work, the listitem Author action should also be modified.
Regards,
Adrian S.
This
made me think a bit...cc_config_ext.xml is configured to auto-insert a <p> in new <li> elements, and yet this still happens
This is what I've tested: added the
Code: Select all
<elementProposals path="li" insertElements="p"/>
Every time I inseted a li from Content Completion, the paragraph was also added.
Indeed, if the insert list item toolbar action was used, the list item is inserted without the p. For this to also work, the listitem Author action should also be modified.
Regards,
Adrian S.
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Disallowing inline content in <li>
Post by chrispitude »
Ah ha! I bet this is how the inline text is sneaking into <li> elements.adrian_sorop wrote: ↑Tue Jan 18, 2022 9:29 pmIndeed, if the insert list item toolbar action was used, the list item is inserted without the p. For this to also work, the listitem Author action should also be modified.
Adrian, can I ask you to file an enhancement for elements inserted though such actions to consider the <elementProposals> settings? Otherwise, it's going to become very complex (and not worth the trouble) to edit framework actions every time simple changes are made to the cc_config_ext.xml file.
This also ensures that the user experience is consistent, regardless of how the element is inserted.
Thanks!
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: Disallowing inline content in <li>
Post by adrian_sorop »
I've logged the feature request with internal id EXM-49754.
I'll update this thread once the issue is fixed.
Thanks,
Adrian S.
I'll update this thread once the issue is fixed.
Thanks,
Adrian S.
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 922
- Joined: Thu May 02, 2019 2:32 pm
Re: Disallowing inline content in <li>
Post by chrispitude »
Hi Adrian,Hi Chris,
Unfortunately, the magic method doesn't exist...yet![]()
I've added an internal issue to allow this behaviour.
Can you let me know the issue ID of supporting text() (or something equivalent) in rejectElements specifications?
Thanks!
- Chris
-
- Posts: 78
- Joined: Wed Jun 22, 2016 2:48 pm
Re: Disallowing inline content in <li>
Post by adrian_sorop »
Hi Chris,
My bad, I forgot to mention it.
Here it is
EXM-49670 - As a user, I want to restrict element content type from mixed to element only through "cc_config.xml", so that my user don't write content in an element
Have a nice day,
Adrian S.
My bad, I forgot to mention it.
Here it is
EXM-49670 - As a user, I want to restrict element content type from mixed to element only through "cc_config.xml", so that my user don't write content in an element
Have a nice day,
Adrian S.
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service