Template talk:BookCat

From Wikibooks, open books for an open world
Latest comment: 6 years ago by Pi zero in topic Rearranging parameters
Jump to navigation Jump to search

Missing close brace

[edit source]

{{Editprotected}} The last, i.e. second, time FULLCHAPTERNAME appears in the code, it is followed by only four close braces, but to match all the open braces, there should be five. I found this because I was trying to figure out why pages categorized using {{BookCat}} are listed on the category pages as being alphabetically under "{" — for example, here.

(I also couldn't help noticing that the noinclude text says "its" where it means contraction "it's".)

Pi zero (talk) 15:24, 12 November 2008 (UTC)Reply

Done — Mike.lifeguard | talk 02:49, 22 November 2008 (UTC)Reply

No include

[edit source]

{{editprotected}} Please replace the line [[ms:Templat:MukaDepan]] with <noinclude>[[ms:Templat:MukaDepan]]</noinclude> to stop the interwiki link being added to all books using this template. Thanks, Anonymous101 (talk) 17:26, 7 January 2009 (UTC)Reply

Done — Mike.lifeguard | talk 19:43, 10 January 2009 (UTC)Reply
Thanks. Anonymous101 (talk) 18:34, 11 January 2009 (UTC)Reply

Subcategories

[edit source]

A "nice-to-have" woud be, to extend the template with some sub-categories.

example
{{BookCat|Irish-Folk|Songs in English|Folk Songs}}

That would create in the Songbook:

[[categorie:Songbook]] [[categorie:Songbook/Irish-Folk]] [[categorie:Songbook/Irish-Folk]] [[categorie:Songbook/Irish-Folk]]
Maybe a single parameter would be sufficient
{{BookCat|Subcategory=Irish-Folk}}

the rest could be completed by an outer template

{{Subcategory|Irish-Folk|Songs in English|Folk Songs}}

each parameter expand the output with "/parameter value"

{{BookCat|{{{1}}}}}}{{
#if: {{{2|}}}|{{BookCat|{{{2}}}}}}}{{
#if: {{{3|}}}|{{BookCat|{{{3}}}}}}}{{
...

Unfortunately in English I am not fit enough, to make the programming by myself. --Mjchael (talk) 20:26, 10 August 2009 (UTC)Reply

interwiki

[edit source]

{{Editprotected}} Please add a link to pt:Template:AutoCat. Helder 17:22, 3 September 2009 (UTC)Reply

Done. -- Adrignola talk contribs 16:04, 17 April 2010 (UTC)Reply

template-filing=deep

[edit source]

The parameter }template-filing=deep does not seem to be working. Liam987 12:39, 12 April 2012 (UTC)Reply

It looks to me as if it's doing just what the documentation says it does. According to the documentation, deep filing would send
Template:Geography of France/Index chapters   to   Category:Geography of France/Templates
Template:Geography of France/Index/chapters   to   Category:Geography of France/Templates/Index
This seemed to me to be the most useful deep-filing behavior on templates, but I provided deep template filing on speculation since I had no examples on hand that called for it. The two templates you've deep-filed in that one book are, if I'm not mistaken, the only deep-filed templates on the entire project; we can tell that because, to aid in situations just like this one, {{BookCat}} automatically populates Category:Pages with deep filing. --Pi zero (discusscontribs) 14:00, 12 April 2012 (UTC)Reply
Oh. I wasn't thinking, for some reason I forgot that the pages aren't third-level subpages. I have moved them. Thanks! Liam987 14:33, 13 April 2012 (UTC)Reply

Why do we need the template-filing parameter?

[edit source]

What is the use of having a separate template-filing parameter? Couldn't the filing parameter just be used? Liam987 12:57, 28 April 2012 (UTC)Reply

They seem to be potentially separate decisions, whether to deep-file book pages and whether to deep-file templates. It was a guess, how the controls for them ought to be set up; I can think of several other ways to arrange the controls, but given we have something, we'd want to have high confidence before changing it that the change would then be getting it right. --Pi zero (discusscontribs) 14:20, 29 April 2012 (UTC)Reply

Bug of the book references in a category

[edit source]

Since December, when the book TOC contains some references without any <references/>, {{BookCat}} displays them into the book category. For example I've just fixed it here after having seen Category:Oberon. JackPotte (discusscontribs) 18:54, 19 June 2017 (UTC)Reply

The footnotes thing? I consider it a massive misdesign of the wiki software, symptomatic of the Foundation's failure to take wiki markup seriously. In some book categories where I've noticed, I fixed the problem by inserting markup on the book main page, something like {{#ifeq:{{NAMESPACE}}|Category||...}}. Sometimes I've done that around individual footnotes, which is a pain; sometimes I've done it around whole sections of the book main page.

I've considered putting the {{subjects}} information on a separate page somewhere rather than on the book main page; the book category could then transclude this other page without the wiki software forcing any footnotes on it. That however is a major organizational shift, since meta information has traditionally been on the book main page; something to do only after a great deal of careful planning. Navlists are an example of meta-information on a separate page, already, and I'd no sooner done that than I started thinking about revising how I was doing it. --Pi zero (discusscontribs) 19:22, 19 June 2017 (UTC)Reply

Wrong sort keys

[edit source]

{{editprotected}}

Pages are assigned to sort keys of level-2 subpages instead of their own. For example, level-3 pages are assigned to the subpage name of level-2 pages:

Category:Book:C Programming/math.h
Category:Book:Software Engineers Handbook/Language Dictionary
Category:Book:LibreOffice/Writer


--Strange quark (discusscontribs) 08:25, 14 September 2017 (UTC)Reply

@Strange quark: This is how it has "always" been done in most books, i.e., since before I came here (how did I get to be an "old timer" here? I was just passing through, like James Garner's character in Support Your Local Sheriff! who insisted he was just passing through town on his way to Australia). Recently I isolated the behavior in {{BOOKSORTKEY}}. I believe (but would have to check) the deepest-level name is used when filing=deep. It's possible we would want to provide a separate mechanism for changing the sort key from one scheme to the other without deep filing, but that in turn would raise some other design issues.
  • A very few books use deep filing, and I've observed two problems with it. First, every call to {{BookCat}} on every page of the book has to remember to specify deep filing, or that page gets misfiled. Second, when deep-filing a book, there is often a top-level page for a subsection, and that page gets automatically filed in its parent instead of in the subcategory with its subpages; it usually makes more sense to file that top-level page either in the subcat (just as the main page of a book appears in the same cat as its subpages), or in both the subcat and the supercat. The trouble with filing in the subcat is that not all pages of the book will have such a subcat, and the template can't tell whether there is such a subcat without looking outside the page itself; that is information about the book as a whole rather than about the individual page in itself. We do have {{BOOKCATEGORY}} already looking outside the current page to see whether the associated book uses the old or new book-category naming scheme, but that is meant to be a temporary measure while we're transitioning from old to new scheme; I would expect to remove that external check when we're done with the transition.
  • Possibly both of these issues — sort-key level with flat filing, and parent-versus-child deep filing for head-pages — should be decided at some central location for the book as a whole (subject, probably, to being overridden by parameters specified at the particular page). This however would be subject to the usual controversies of centralized control; it would create a single-point-of-failure, and ought to be carefully planned to preserve local flexibility.
  • It might make sense to integrate such a centralized device with an upgraded {{navlist}} facility, using the navlist as the central point for all these things. However, the navlist needs to be redesigned to use a more friendly format, and the centralization issues are particularly prominent for navlist. If we're going to go with that, we might want to set up a general facility for any page associated with a book to extract book-wide parameters from the navlist without having to know about the format used by the navlist.
A likely path forward on this, I suggest, would be to add a parameter now for locally switching to the other style of sort key, so one can move forward with that while considering what to do with navlist. --Pi zero (discusscontribs) 12:36, 14 September 2017 (UTC)Reply
@Pi zero: The filing=deep parameter doesn't fix the sort keys, as in the C Programming example above. {{BookCat|{{SUBPAGENAME}}}} doesn't seems to work either. --Strange quark (discusscontribs)
Ah, now that is clearly a bug to fix. --Pi zero (discusscontribs) 15:09, 14 September 2017 (UTC)Reply
The code to fix would be in {{BookCat/default}}. --Pi zero (discusscontribs) 16:03, 14 September 2017 (UTC)Reply
@Strange quark: It looks as if I introduced a bug when I edited that template early this year. Hopefully fixed now. --Pi zero (discusscontribs) 18:51, 14 September 2017 (UTC)Reply
Individual pages won't immediately be resorted within their categories unless one does a null edit on them. I did that for one of the above-listed categories, to confirm the problem was fixed. But I'm not even sure they'd ever get resorted if not edited. --Pi zero (discusscontribs) 21:03, 14 September 2017 (UTC)Reply

Rearranging parameters

[edit source]

I'm about to rearrange the parameters of this template for consistency with our magic word templates. Those templates take as their first unnamed parameter an alternative to the current page; BookCat is peculiar in taking a sort-key as its first unnamed parameter. Therefore, I propose to use parameter name sortkey for the sort key, and use the first unnamed parameter for the same purpose that most of our magic word templates do. Steps of the process:

  1. Find any passing of an unnamed parameter to this template.
    Requires a single edit to master template {{BookCat}}. (At this writing, underway via Category:Pages passing sort key to BookCat.)
  2. Modify the master template to extract the namespace from the unnamed parameter if supplied, determine pagename likewise, and pass pagename and sortkey to subtemplates appropriately.
    Requires a single edit to the master template.
  3. Modify subtemplates to use the new parameters.
    Requires one edit to each involved subtemplate.
  4. Update the documentation.

--Pi zero (discusscontribs) 15:44, 28 January 2018 (UTC)Reply

Alternative name for sortkey: sort. --Pi zero (discusscontribs) 17:01, 28 January 2018 (UTC)Reply
Step two has been done, major upgrade to the master template. --Pi zero (discusscontribs) 14:27, 29 January 2018 (UTC)Reply
(Alas, a second edit.) --Pi zero (discusscontribs) 14:59, 29 January 2018 (UTC)Reply
As usual, things are not going well. After two additional bug fixes to the master template, several pages are in the (singularly useless) Category:Pages with script errors, and at this point the only way I'll know whether that's related to this upgrade is to undo the upgrade and see if the problem goes away. --Pi zero (discusscontribs) 16:48, 29 January 2018 (UTC)Reply
Afaik this rearrangement is completed. --Pi zero (discusscontribs) 13:17, 30 January 2018 (UTC)Reply