Template for standard road lock schemes

Moderator: Unholy

Re: Template for standard road lock schemes

Postby qwaletee » Thu Jan 08, 2015 7:44 pm

Hmm, I guess we have different definitions of clever.

Even getting the first one right will be fairly obtuse, and not a priority for me. If you would like to take a crack at it, go ahead and expand on what I did. Use a test page please (user, template, or other space). Good luck.
US Champ / Country Manager | State Manager NY, NJ, PA, CT, MA, RI, VT, ME, NH | Northeast ARC | Mentor | Responding to Map Issues
qwaletee
US Waze Champs
US Waze Champs
 
Posts: 2936
Joined: Wed Feb 13, 2013 1:42 am
Location: NYC Metro - Active throughout NE^2 (Northeast & New England)
Has thanked: 235 times
Been thanked: 1134 times

Re: Template for standard road lock schemes

Postby PesachZ » Thu Jan 08, 2015 7:49 pm

qwaletee wrote:Hmm, I guess we have different definitions of clever.

Even getting the first one right will be fairly obtuse, and not a priority for me. If you would like to take a crack at it, go ahead and expand on what I did. Use a test page please (user, template, or other space). Good luck.

If I get bored or intrigued enough I'll make an attempt in {{Locking Standard/Sandbox}}

Sent using Tapatalk for Android 4.4.2
PesachZ
Wiki Master
Wiki Master
 
Posts: 4507
Joined: Mon Jul 01, 2013 12:51 am
Location: NY, USA (also NJ sometimes) {GC}
Has thanked: 1997 times
Been thanked: 2352 times

Re: Template for standard road lock schemes

Postby PesachZ » Thu Jan 08, 2015 10:29 pm

while taking a peek at this code I found what I think is a bug. If you have 3 regions, and use the default value for fwy on all of them the third region gets locked at 3 instead of 4.
current code:
Code: Select all
| {{{Fwy|4}}}{{#if:{{{title2|}}}|{{!}}{{!}}{{{Fwy2|{{{Fwy|4}}}}}}}}{{#if:{{{title3|}}}|{{!}}{{!}}{{{Fwy3|{{{Fwy|3}}}}}}}}

I believe the last "3" at the end of the string should be a 4.
PesachZ
Wiki Master
Wiki Master
 
Posts: 4507
Joined: Mon Jul 01, 2013 12:51 am
Location: NY, USA (also NJ sometimes) {GC}
Has thanked: 1997 times
Been thanked: 2352 times

Re: Template for standard road lock schemes

Postby PesachZ » Fri Jan 09, 2015 12:21 am

qwaletee wrote:For documentation, I provided the rough information. It could definitely use some work. I'm not too worried about the core template (Locking Standard) because I think its doc is OK AND I think in most cases this template would not be used by end users. The Lock Standard State "shell" template would be used instead, because less-technical editors can simply hand off the hard work to someone who knows how to deal with templates. The Lock Standard State documentation needs a lot of work. All the parameters to the core template are fully and clearly documented, though they are pain to use if you have many deviations from the default lock levels. Using the State shell template is comparatively simple: If your area is already defined, just pass the area name as a parameter, e.g., {{Lock Standard State|NORTHEAST}}. If your area is not already defined, then someone who understands the core template has to develop the correct call to the core template, and stuff it in to the shell template with the area name. Ask your wife - stuffing shels takes effort, consuming them is easy and pleasant.

Colspans - complex topic, see below.

As to Ferry and RR, I thought we set a national standard on that. If not, it isn't that hard to swap the fixed values there now for a variable option, with the same three columns as the other types.

Back to colspan, in all its hoary:

This is tougher than you might think, Pesach. It doesn't require any cleverness, just a lot of extra code. Wiki template logic is quite awkward. You don't have any variables (other than the passed parameters), so you have to repeat your full logic statement every time you use it. In this case, you have to play two sets of logic - does the column exist at all, and if so, does it repeat (and how)

For example, this is the existing freeway line definition:

Code: Select all
| {{Freeway}}
| {{{Fwy|4}}}{{#if:{{{title2|}}}|{{!}}{{!}}{{{Fwy2|{{{Fwy|4}}}}}}}}{{#if:{{{title3|}}}|{{!}}{{!}}{{{Fwy3|{{{Fwy|3}}}}}}}}


Let's say to simplify it, we would reduce functionality to 2 columns before implementing automatic column spanning:

Code: Select all
| {{Freeway}}
| {{{Fwy|4}}}{{#if:{{{title2|}}}|{{!}}{{!}}{{{Fwy2|{{{Fwy|4}}}}}}}}


This is how it MIGHT work then (untested, probably not complete and buggy, and does not support 3 columns without lots more code):

Code: Select all
| {{Freeway}}
| {{#if:{{{title2|}}}|{{#ifeq:{{{Fwy|4}}}|{{{Fwy2|{{{Fwy|4}}}}}}|colspan=2}}{{{Fwy|4}}}{{#if:{{{title2|}}}|{{#ifeq:{{{Fwy|4}}}|{{{Fwy2|{{{Fwy|4}}}}}}||{{!}}{{!}}{{{Fwy2|{{{Fwy|4}}}}}}}}}}


That unreadable glob has to be tested, fixed, repeated across all 6 driveable road types, modified for the defaults of each type (which is repeated about five times each), and for the specific variables for each of those types (repeated about 10 times each). That's about 300% of the prior code to do so.

Now, if we wanted to add the third column back, we would have to be repeated that type of code extension, except that logic is even more tortured due to the fact that all three could be the same, or the first and third could be the same, or the second and third. I'd estimate about 25x the current code to complete that.

Right now, I'm not ambitious enough to fix that for the sake of an appearance improvement that is a nice-to-have, not a "need," and could be added in later without breaking anything.

You might be thinking, OK, so go for two columns with a better appearance first, third column later. I don't want to do that, because I think the common use case will be urban/suburban/rural, which requires three columns. In NY, you already have NYC and elsewhere for two columns, and i suspect at some point, we're going to be gracious enough to allow northern and western NY to have New England's even lower level locks, because of the paucity of senior editors and the immaturity of the map.

If we had Lua added to the Wiki, more normal programming could be done, and I could spin this out in a jiffy. Readable code, reuse of code for each row.

I believe I have successfully completed the code for the freeway row using this code:
Code: Select all
|{{#if:{{{title2|}}}|{{#if:{{{title3|}}}|{{#ifeq:{{{Fwy|4}}}|{{{Fwy2|4}}}|{{#ifeq:{{{Fwy2|4}}}|{{{Fwy3|4}}}|colspan=3{{!}}{{{Fwy|4}}}|colspan=2{{!}}{{{Fwy|4}}}{{!}}{{!}}{{{Fwy3|4}}}}}|{{#ifeq:{{{Fwy2|4}}}|{{{Fwy3|4}}}|{{{Fwy|4}}}{{!}}{{!}}colspan=2{{!}}{{{Fwy2|4}}}|{{{Fwy|4}}}{{!}}{{!}}{{{Fwy2|4}}}{{!}}{{!}}{{{Fwy3|4}}}}}}}|{{#ifeq:{{{Fwy|4}}}|{{{Fwy2|4}}}|colspan=2{{!}}{{{Fwy|4}}}|{{{Fwy|4}}}{{!}}{{!}}{{{Fwy2|4}}}}}}}|{{{Fwy|4}}}}}

It handles up to 3 columns, and spans any matches of 2 or more adjacent columns. I ran a series of tests on the doc page with the specific variations of each test listed in the table caption. Please have a look at the sandbox version of the template, and let me know what you think of it.
PesachZ
Wiki Master
Wiki Master
 
Posts: 4507
Joined: Mon Jul 01, 2013 12:51 am
Location: NY, USA (also NJ sometimes) {GC}
Has thanked: 1997 times
Been thanked: 2352 times

Re: Template for standard road lock schemes

Postby qwaletee » Fri Jan 09, 2015 12:44 am

PesachZ wrote:while taking a peek at this code I found what I think is a bug. If you have 3 regions, and use the default value for fwy on all of them the third region gets locked at 3 instead of 4.
current code:
Code: Select all
| {{{Fwy|4}}}{{#if:{{{title2|}}}|{{!}}{{!}}{{{Fwy2|{{{Fwy|4}}}}}}}}{{#if:{{{title3|}}}|{{!}}{{!}}{{{Fwy3|{{{Fwy|3}}}}}}}}

I believe the last "3" at the end of the string should be a 4.


Good catch
US Champ / Country Manager | State Manager NY, NJ, PA, CT, MA, RI, VT, ME, NH | Northeast ARC | Mentor | Responding to Map Issues
qwaletee
US Waze Champs
US Waze Champs
 
Posts: 2936
Joined: Wed Feb 13, 2013 1:42 am
Location: NYC Metro - Active throughout NE^2 (Northeast & New England)
Has thanked: 235 times
Been thanked: 1134 times

Re: Template for standard road lock schemes

Postby qwaletee » Tue Jan 13, 2015 5:34 am

Update, everyone.

The two templates are now published. Many state pages now use the {{Lock Standard State|XX}} template, as well as the Texas MapRaid.

The underlying {{Locking Standard}} template is primarily used only by the State Locking Standard.

The system now combines adjacent values with the same value, so you won't see three separate columns containing the number 1 in the Street row, etc. PesachZ did much of the work to improve the formatting. There is a bug where the combined columns do not work for Freeway right now, which we'll probably solve after catching up on some things that have been slipping due to Houston.

There is also a Google Spreadsheet that documents many states together (original concept by Fredo-p). It has a different but similar format.

I did note that the LA MapRaid page lists a CA locking standard that is not quite the same as the one developed through the forums. That should be rationalized. Right now, {{Lock Standard State|CA}} uses the forum parameters, but I have not inserted it into any live page. Once it is rationalized, I can make the template match the consensus, and it can be placed on the CA page.
US Champ / Country Manager | State Manager NY, NJ, PA, CT, MA, RI, VT, ME, NH | Northeast ARC | Mentor | Responding to Map Issues
qwaletee
US Waze Champs
US Waze Champs
 
Posts: 2936
Joined: Wed Feb 13, 2013 1:42 am
Location: NYC Metro - Active throughout NE^2 (Northeast & New England)
Has thanked: 235 times
Been thanked: 1134 times

Re: Template for standard road lock schemes

Postby PesachZ » Fri Jan 16, 2015 6:53 pm

I added functionality in the sandbox for two additional optional rows at the bottom of the template (only displayed if at least one column has a parameter specified for that row) to list locks on Private and PLR.

This has been requested by Texas for private road locks.
PA has a standard for PLRs in their wiki.


I see no reason the template can't include locks for private and PLR if specified by a state/region, the default display will hide those rows. This is functioning well in the sandbox.

Can I have support to move it to the live template, or if there's objections please explain.

Sent using Tapatalk for Android 4.4.2
PesachZ
Wiki Master
Wiki Master
 
Posts: 4507
Joined: Mon Jul 01, 2013 12:51 am
Location: NY, USA (also NJ sometimes) {GC}
Has thanked: 1997 times
Been thanked: 2352 times

Re: Template for standard road lock schemes

Postby Fredo-p » Fri Jan 16, 2015 8:41 pm

I'm happy with that idea. If other states decide to move to having locking standards for PLRs and PVs then it would only make sense to have that option available.
Fredo-p
Beta tester
Beta tester
 
Posts: 1998
Joined: Mon Aug 05, 2013 4:35 am
Location: AZ, NJ, NY, ND, CA
Has thanked: 269 times
Been thanked: 639 times

Re: Template for standard road lock schemes

Postby orbitc » Fri Jan 16, 2015 9:17 pm

I'm OK with it. There is no harm in adding those fields.
Regional Coordinator for Northeast (DE, NJ, NY, PA) & New England (CT, ME, MA, NH, RI, VT)
• ßeta Tester
• iOS ßeta: Always the latest version
• WME ßeta

[ img ][ img ][ img ][ img ]
WME | USA | MapRaid!
orbitc
Master Raider
Master Raider
 
Posts: 6473
Joined: Mon Jun 25, 2012 1:51 pm
Location: USA
Has thanked: 2573 times
Been thanked: 6540 times

Re: Template for standard road lock schemes

Postby PesachZ » Sun Jan 18, 2015 7:06 am

I think I found the bug causing freeway not to colspan, I fixed {{{Fwy2|4}}} in the two column logic to say {{{Fwy2|{{{Fwy|4}}} which now seems to work. Have to check for similar issues in the rest of the code.

Sent using Tapatalk for Android 4.4.2
PesachZ
Wiki Master
Wiki Master
 
Posts: 4507
Joined: Mon Jul 01, 2013 12:51 am
Location: NY, USA (also NJ sometimes) {GC}
Has thanked: 1997 times
Been thanked: 2352 times

PreviousNext

Return to Wiki Updates and Discussion

Who is online

Users browsing this forum: No registered users