openSUSE / suse-xsl

DocBook XSL Stylesheets for SUSE branding
Other
11 stars 10 forks source link

Add option to remove "COPY CODE" for examples #476

Open mfriesenegger opened 2 years ago

mfriesenegger commented 2 years ago

Problem Description

I am writing SUSE Best Practice documents. I show example output using . This will show a "COPY CODE" link but the reader does not need to copy the example output.

Expected Behaviour

Provide a method to disable "COPY CODE".

tomschr commented 1 year ago

Thanks Mike for your idea.

From what I see, it needs the following considerations:

  1. Markup (XML): A way to express to suppress the "copy code" for each screen. In most cases an attribute or a processing instruction should be fine. This part is done by our writers. However, the default action is to add these icons to every screen element in HTML.
  2. Documentation: Document how to do it in our styleguide.
  3. Transformation (XSLT): Convert the special markup from (1) with the XSLT stylehsheet into a specific class (for example, class="nocopy").
  4. Layout (JavaScript/CSS): Pick every verbatim element (in HTML, usually <pre>) except the one with the class from (2). Only insert icons for those who have NOT this class.