Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Use css classes properly #1476

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 8 comments
Closed

Use css classes properly #1476

openstreetmap-trac opened this issue Jul 23, 2021 · 8 comments

Comments

@openstreetmap-trac
Copy link

Reporter: bob[at]cakebox.net
[Submitted to the original trac issue database at 1.03pm, Sunday, 11th January 2009]

Something that could, if it's possible, help us simplify the stylesheets a bit:

<rule ...>

<rule ...>


Possible implementation: Have the rule engine picks up the commands and trickle the classes down through the template calls.

I don't have time to do this now, but may do so in the future. If anybody else wants to, then feel free.

@openstreetmap-trac
Copy link
Author

Author: dev.osm[at]hughbris.com
[Added to the original trac issue at 8.48pm, Sunday, 11th January 2009]

If we are talking about the same thing, I was just working at this last night. Have been stewing on it for ages!

I have, for example, in z17:

.gate {
  fill: none;
  stroke: red;
  stroke-width: 1px;
  stroke-opacity: 0;                        
}

.gate.locked {
  marker-mid: url(#marker-gate-locked);
}

and have changed its rule invocation to, e.g.:

<else>
  <rule e="node" k="status" v="locked">
    <wayMarker k="highway" class="gate locked"/>
  </rule>

Is this what you're talking about?

@openstreetmap-trac
Copy link
Author

Author: bob[at]cakebox.net
[Added to the original trac issue at 9.00pm, Sunday, 11th January 2009]

Replying to [comment:1 dev.osm[at]hughbris.com]:

If we are talking about the same thing, I was just working at this last night. Have been stewing on it for ages!

I have, for example, in z17:

.gate {
  fill: none;
  stroke: red;
  stroke-width: 1px;
  stroke-opacity: 0;                        
}

.gate.locked {
  marker-mid: url(#marker-gate-locked);
}

and have changed its rule invocation to, e.g.:

<else>
  <rule e="node" k="status" v="locked">
    <wayMarker k="highway" class="gate locked"/>
  </rule>

Is this what you're talking about?

I'm not quite sure, but I have a feeling it's a different thing.

If you show me some of your implementation I could probably make a better guess...

@openstreetmap-trac
Copy link
Author

Author: dev.osm[at]hughbris.com
[Added to the original trac issue at 1.07pm, Tuesday, 13th January 2009]

I'm not quite sure, but I have a feeling it's a different thing.

I think so too now. I think we may be trying to solve the same problem in incompatible ways. We probably both grimaced at those hiphenated classnames.

If you show me some of your implementation I could probably make a better guess...

I thought I did that with the code snippets I provided. It's taking quite some time to come up with just one file for zoom17, but I'll put it in a branch when ready for you to see. About 2/3 through now. It's very tedious. It will need very careful testing (hence http://trac.openstreetmap.org/ticket/1481) before I'd be merging it into the main branch.

My edit began before your patch for TimBL, so it will need trivial merging.

Back to what I'm doing: I'm using classes like tags or properties, exploiting the possibilities of applying more than one (classes are defined in the DTD as NMTOKENS - a list of tokens). This is the way class combinations should be implemented.

I think your solution, if I follow it, may not scale as well (only two levels) and will (perhaps) be less readable. It's also a kind of new solution where well-planned multiple classes already do it fine.

Anyway, will let you know. If you think your idea is better, I'll start a new ticket.

@openstreetmap-trac
Copy link
Author

Author: dev.osm[at]hughbris.com
[Added to the original trac issue at 2.18am, Sunday, 18th January 2009]

I don't know what I was looking at by saying I was 2/3 through level 17. Not really.

It's going to take a long time to do what I was going to do. I think it has less structural effect than your implementation, though. So while I will put up something to demonstrate the idea, I am wondering whether to hand back this ticket and start my own, take it over, or mark it wontfix. I am pretty sure both implementations can't happen.

Here, while you think about it, is another example of style madness:

class="highway-casing highway-bridleway-casing highway-bridleway-area-casing no-bezier"

.. which could be expressed as class="highway bridleway area casing no-bezier" and the CSS would contain a lot less redundancy, too (e.g. styles that apply to all highways).

Can we go on expecting developers to work with this?

Sorry, I'm being obstinate. Would be keen to hear your thoughts. I am going to first distract myself by adding rendering for a few new features :~)

@openstreetmap-trac
Copy link
Author

Author: bob[at]cakebox.net
[Added to the original trac issue at 1.29pm, Sunday, 18th January 2009]

Replying to [comment:4 dev.osm[at]hughbris.com]:

I don't know what I was looking at by saying I was 2/3 through level 17. Not really.

It's going to take a long time to do what I was going to do. I think it has less structural effect than your implementation, though. So while I will put up something to demonstrate the idea, I am wondering whether to hand back this ticket and start my own, take it over, or mark it wontfix. I am pretty sure both implementations can't happen.

This sounds like something that could very well be done a little bit at a time, that would help make sure you don't get into merging hell too.

I don't see anything to indicate both ideas couldn't co-exist.

Maybe you should just take over this ticket (since this is where we have discussed this) and my idea can be moved to another.

Here, while you think about it, is another example of style madness:

class="highway-casing highway-bridleway-casing highway-bridleway-area-casing no-bezier"

.. which could be expressed as class="highway bridleway area casing no-bezier" and the CSS would contain a lot less redundancy, too (e.g. styles that apply to all highways).

That would be a lot better. I think my idea will coexist well with this though, since that would result in that line being only class="bridleway", since highway, area and casing are shared with many rules in the same area of the stylesheet.

@openstreetmap-trac
Copy link
Author

Author: bob[at]cakebox.net
[Added to the original trac issue at 7.25pm, Wednesday, 11th February 2009]

I'm letting this ticket be about your idea, I'll open a new one about mine.

@openstreetmap-trac
Copy link
Author

Author: dev.osm[at]hughbris.com
[Added to the original trac issue at 11.41pm, Wednesday, 11th February 2009]

Replying to [comment:6 bob[at]cakebox.net]:

I'm letting this ticket be about your idea, I'll open a new one about mine.

Thanks - just to provide a progress report on this one, I have a difference in the bitmaps converted from the renderings for the comprehensive.osm test data. It's not as trivial to track down as I hoped. Probably a copy-paste error. :~)

On the positive side, I can see how I might be able to write a simple test script in bash or python, which will hopefully speed me up to more regular commits. ATM it's a series of hardcoded commands with filename arguments, but I should be able to change this to loop through the testdata directory.

@openstreetmap-trac
Copy link
Author

Author: iandees
[Added to the original trac issue at 9.09pm, Monday, 9th September 2013]

Cleaning aging tickets.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant