Page MenuHomePhabricator

Feature Request: Support CSS Annotations in HTML
Closed, DeclinedPublic

Description

Author: jgreen24

Description:
This is a request to include CSS markup in the HTML output of property-tagged text.

The are many implementation possibilities. I propose the following.

Let's keep it simple and assume a 1:1 relationship between each property and its resulting CSS class.

Introduce a flag on property pages to enable this functionality on a property-by-property basis.

The following, for example, would appear on a property page called "SomeProperty".

CSS="p" [*]

SMW would process the following...

[[SomeProperty::This text is tagged with the "SomeProperty" property.]]

And would output...

<p class="SomeProperty">This text is tagged with the "SomeProperty" property.</p>
  • Another Example for Clarification -----------

On a property page titled "AnotherProperty"

CSS="h1"

SMW would process the following...

[[AnotherProperty::Important Heading Information]]

And would output...

<h1 class="AnotherProperty">Important Heading Information</h1>

A user could then update the CSS appropriately and invoke style information as desired on all SMW content.

  • I realize some HTM/CSS purists may cringe at the nomenclature, but it is succinct and the resulting HTML is clean.

Thanks!


Version: unspecified
Severity: enhancement

Details

Reference
bz16336

Event Timeline

bzimport raised the priority of this task from to Lowest.Nov 21 2014, 10:27 PM
bzimport set Reference to bz16336.

Aha, so you refer to CSS tags on wiki pages (as opposed to having them on Special:Browse or the like). It seems that this feature could already be realized using templates rather easily, e.g. one could have a template containing

<p class="{{{1}}}">[[{{{1}}}::{{{2}}}]]</p>

which is used like {{p-smw|SomeProperty|This text is tagged with the "SomeProperty" property.}}

This would give you full control over the markup without any extension to SMW. Making this a built-in feature of SMW would be much more complicated. You would need a dedicated way for determining when to use p, h1 or whatever, and you would need to have a way of escaping symbols that are allowed in property names but not in CSS classes. I am much in favor of the manual solution unless there are strong arguments against it.

jgreen24 wrote:

Markus, that looks like a fine solution. Thank you!

Great, then I will just close this bug.