Wikibooks:Reading room/Technical Assistance

Replacement filing cabinet.svgArchivesWikibooks Discussion Rooms
Discussions Assistance Requests
General | Proposals | Projects | Featured books General | Technical | Administrative Deletion | Undeletion | Import | Permissions

Welcome to the Technical Assistance reading room. Get assistance on questions related to MediaWiki markup, CSS, JavaScript, and such as they relate to Wikibooks. This is not a general-purpose technical support room.

To submit a bug notice or feature request for the MediaWiki software, visit Phabricator.

To get more information about the MediaWiki software, or to download your own copy, visit MediaWiki

There are also two IRC channels for technical help: #mediawiki for issues about the software, and #wikimedia-tech for WMF server or configuration issues.

Renaming Book PagesEdit

How do I rename a Book Page? When I change the name of the Book Page, it seems that the link to the old page is broken and I have copy the old content to the new page that was created as a result of renaming. TIA!

--Rjbfigueroa (discusscontribs)

@Rjbfigueroa: Can you give an example of a page you wanted to move, and where you wanted to move it to, so we can see what happened?

Fwiw, here's how to move a page, if you're using Vector skin (in the desktop interface, rather than the mobile one): View the page you want to move (not its talk page). There should be a control bar at the top of the browser, and way over on the far right of it there should be a dropdown menu. The only option on that menu should be either "rename" or "move"; use that. --Pi zero (discusscontribs)

Some CSS for Vector has been simplifiedEdit


I'd like to make a double-check about a change that was announced in Tech/News/2020/21.

Over-qualified CSS selectors have been changed. div#p-personal, div#p-navigation, div#p-interaction, div#p-tb, div#p-lang, div#p-namespaces or div#p-variants are now all removed of the div qualifier, as in for example it is #p-personal, #p-navigation …. This is so the skins can use HTML5 elements. If your gadgets or user styles used them you will have to update them. This only impacts the Vector skin.

On this wiki, this impacted or still impacts the following pages:

How to proceed now? Just visit all these pages and remove div# before these CSS selectors if it hasn't been removed so far.

Thank you! SGrabarczuk (WMF) (discusscontribs) 13:01, 25 May 2020 (UTC)

🎨 Styling catlinks (category links at bottom of each page) for all readers of a book as an author-side customisation (rather than as a reader-side customisation)Edit

The category links at the bottom of each page com under the <div id="catlinks" class="catlinks" data-mw="interface"> element. Have been trying to figure out how to style the contents for all users of a book (at least as the default skin for users, something like a 'book skin') but have had no success in figuring out how to do it, and not sure whether it is even possible.

Things tried (but were not successful):

  • templates styled with CSS file styles.
  • removing the default catlinks so new ones could be drawn-up.

Anyone have any ideas or comments on solving this?

     MarkJFernandes (discusscontribs) 14:37, 28 May 2020 (UTC)

What sort of customization are you trying for? The cat list at the bottom of the page is, after all, part of the site customization, so I'm dubious whether it ought to be customizable per book; but I'm open to being persuaded. --Pi zero (discusscontribs) 17:21, 28 May 2020 (UTC)
@Pi zero: for what it's worth, I'm also dubious. 😕
I would like each category to be on a separate line. A bullet-pointed vertical list would be acceptable, and I think one of the skins does this already. But the skins are set-up as user skins rather than book skins—I was hoping to use something like a book skin. Also, I do not want the text 'Book:End-user Computer Security' to appear at the beginning of each item, as it makes the category links difficult to read. If it were '📘' instead, that would be okay.
I have similar issues with the category pages. I'm thinking perhaps it might be best to create a user skin, that also has the meaning of being a particular skin for the book, and then somehow advertise or advise to users, that the book is best used with the particular book skin developed for the book. What do you think about that? As you imply, overriding the controls that prevent author-side customisation of the links is perhaps not a good idea.

thanks     MarkJFernandes (discusscontribs) 16:58, 1 June 2020 (UTC)

I never tinker with skins, myself.

It occurs to me to mention, iirc we have a provision in our infrastructure for book-specific css. Possibly something could be done with that. (I don't often tinker with css, either, but have occasionally done so.) --Pi zero (discusscontribs) 17:47, 1 June 2020 (UTC)

@Pi zero: that sounds like it might be a good idea. I've already looked at how CSS (including CSS files) can be used on the author-side (i.e. on a book-specific basis), but couldn't get it to work, as the styling was unable to style that part of the page (the part that required styling was outside the scope). Just so that I can be clear about what you mean by Wikibook's provision for book-specific css, can you please post a link to the documentation for it?

thanks     MarkJFernandes (discusscontribs) 07:28, 2 June 2020 (UTC)

@MarkJFernandes: I'm not sure there is any documentation. I know about it because of my work on the dilaog tools, which depend on a related device (per-page javascript, originally a Wikinews thing); along the way I discovered Wikibooks has per-book css, supported by MediaWiki:Common.js/Perbook.js. --Pi zero (discusscontribs) 14:59, 2 June 2020 (UTC)
@Pi zero: that's looking like what I'm after. So if I create a file at '', will that CSS file automatically be used in the End-user_Computer_Security book? Currently, it's saying I don't have permission to create the page at that address. Any idea what I should do?

thanks     MarkJFernandes (discusscontribs) 15:39, 2 June 2020 (UTC)

@MarkJFernandes: I think I have the requisite priv to do that. If you set up the content you want in a page in, say, your userspace, and tell me where it is, I can look it over and (if it looks okay, of course) I can set it up for you. --Pi zero (discusscontribs) 15:47, 2 June 2020 (UTC)
@Pi zero: any chance you could set-up a SANDBOX where I can experiment with such code (presumably with a SANDBOX book)? The reason I ask, is that as mentioned before, I'm not able to style the CATLINKs section otherwise (as far as I can tell); so it's a bit difficult to develop the needed CSS code without using the specific book-skin resource (with which I hope to be able to style the CATLINKs).

thanks     MarkJFernandes (discusscontribs) 15:54, 2 June 2020 (UTC)

A sandbook? :p  Hopefully I can try to set something up later today (though I can't guarantee, as my plate is pretty full atm). --Pi zero (discusscontribs) 16:05, 2 June 2020 (UTC)

How to create a side bar or other bordered box?Edit

What is the markup for putting a section inside a box with a border and a shaded background? If you look at the Table of Contents at the top of this page, that is the kind of layout I am looking for but for custom content and lower down in the page where ever I decide to place it in the chapter. Bonus if there is a way to make it float on the right or left of the page and let the rest of the text flow around it. Larsnooden (discusscontribs) 07:32, 29 May 2020 (UTC)

Hi the easiest way is to use a template: see Wikibooks:Templates/General for various box templates. I have posted an example, take a look at this message source.
Example using Template:SideBox.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
. --Jules (Mrjulesd) 11:44, 29 May 2020 (UTC)
Thanks! That is perfect! I am looking at the other templates now, too. Larsnooden (discusscontribs) 12:02, 29 May 2020 (UTC)

Trying to replace <H6> tags with <H7> tags, <H5> with <H6>,... and so on....Edit

I want to do this so that the transcluded headings in a transcluded text, are all dropped down by one level, such that the table of contents then appears correctly structured.

Found the {{#invoke:string|replace... function, but just can't get it to replace particular digits. Have a feeling that perhaps I need to do some character escaping to communicate string literals, but have tried all kinds of things for this with no success.     Anyone have any ideas/advice?

thanks     MarkJFernandes (discusscontribs) 11:16, 3 June 2020 (UTC)

@MarkJFernandes: Not sure concretely what you're trying to do. Is there a specific example one can look at? --Pi zero (discusscontribs) 12:16, 3 June 2020 (UTC)
@Pi zero: have a look at the table of contents at Category:TODO/End-user_Computer_Security_book. That page uses transclusion, and I wanted the heading levels for the headings in the transcluded text to be demoted by one, so that I could add some more intervening parent headings. The way I figured out for doing this, was to replace '== ' with '=== ' and ' ==' with ' ==='. But then it seemed that after transclusion, the equals notation was converted into HTML notation for headings (i.e. <h1>, <h2>, etc.) So then I was looking at replacing the text 'h1' with 'h2', but I couldn't get it to work with the aforementioned function. I managed to replace just the 'h' character, but I also need to replace the digit character as well. If you could give me one example of how to use the function to replace digits, that would probably be a step in the right direction.

thanks     MarkJFernandes (discusscontribs) 14:42, 3 June 2020 (UTC)

@MarkJFernandes: I'm not a believer in lots of non-wiki-markup tools for specialized purposes, which tend to multiply as one finds new tasks one wants to perform. Basically the only purpose for which I use Lua/javascript is (by preference) to provide highly general tools that enable everything else to be done in wiki markup. In this case, I would go about what you're describing using {{evalx}}, my general "glue" tool for doing things that fill in awkward gaps in what can be done without them. No doubt this is less efficient than using the highly specialized Lua tool you're describing. I'd probably write a little book-specific template, something like this (supposing one only had to replace headings down to h4):
  (join (split
    (join (split
      (join (split
        (join (split
          (get-arg 2)
          "h4{{\)}}") "h5{{\)}}")
        "h3{{\)}}") "h4{{\)}}")
      "h2{{\)}}") "h3{{\)}}")
    "h1{{\)}}") "h1{{\)}}")
Does this actually work, since I wrote it freehand? I'd probably test it on the Wikibooks:Breadboard (being careful to pass in, as the value of parameter 1, expanded html rather than raw wiki markup); apologies that I haven't done so, 'fraid I'm kind of strapped for time just atm. --Pi zero (discusscontribs) 17:01, 3 June 2020 (UTC)
@Pi zero: thanks for this possible solution. My priorities have changed now such that I'm not going to bother trying to solve this problem for the time being. I don't know how Wikibooks archives such reading-room issues, but it would be good if this question-answer, problem-solution topic was archived in the collective Wikibooks knowledge-base, for easy retrieval by ppl later on.

Collapsible block:     just some thoughts of MarkJFernandes concerning best coding practices for Wikibooks

Understand where you're coming from when you talk about many '...non-wiki-markup tools for specialized purposes...'. Being a Wikibooks newbie, I tend to follow the philosophy that newbies should learn as they go along. This might mean overly using CSS and HTML, and gradually transitioning more and more to pure wikitext. I would apply this also to the use of non-wiki-markup tools for specialized purposes. I think along the lines that it is better resource management than delaying contributions until you are proficient in Wikibooks technology; others can always help you along the way, and in terms of the totality of resources consumed (by the whole community together), I believe it leads to less resource consumption.

thank you     MarkJFernandes (discusscontribs) 08:15, 4 June 2020 (UTC)

Trouble adding book images to BOOK SUBCATEGORYEdit

Can't figure out how to CATEGORISE my book images in my images BOOK-CATEGORY SUBCATEGORY.

Can someone please direct me as to how I can get this image, to be CATEGORISED in my images BOOK CATEGORY? I tried to do such CATEGORISATION in the edit shown here, but it didn't work.

thanks     MarkJFernandes (discusscontribs) 08:25, 4 June 2020 (UTC)

@MarkJFernandes: Nothing you do to the page on Commons will affect categorization on Wikibooks. I think you can create a local description page on Wikibooks containing nothing but the requisite book category, and that'll do it. If I'm remembering rightly (someone on Wikinews discovered this a bunch of years ago and was quite charmed by it), and if it still works now (if it ever did). --Pi zero (discusscontribs) 09:08, 4 June 2020 (UTC)
Nope, it doesn't want to allow that; if it ever did work, it seems not to anymore. Or maybe I'm just not doing it right. --Pi zero (discusscontribs) 09:12, 4 June 2020 (UTC)
Hm. It looks like it should work. Cf. n:File:Ellie Cole.jpg. --Pi zero (discusscontribs) 09:19, 4 June 2020 (UTC)
Okay, I think I've got it now. The trick is to avoid the "do what somebody else thinks you should want to do" interface. Viewing the local page, I edited the url in the browser tab and added ?action=edit to the end of it, then hit <enter>, and put in the page
[[Category:Book:End-user Computer Security/Images]]
--Pi zero (discusscontribs) 09:35, 4 June 2020 (UTC)

@Pi zero: superb! Just read this. Someone probably should report this bug somewhere?

thanks     MarkJFernandes (discusscontribs) 16:42, 8 June 2020 (UTC)

I would be concerned, pessimistically, that if their attention were drawn to it they'd "fix" it in a way that would only make it harder (or impossible) for us to accomplish what we want to do. --Pi zero (discusscontribs) 17:59, 8 June 2020 (UTC)

Changing a "directory"Edit

In the Oberon book, I've been advised to change "Oberon/S3/" to "Oberon/ETH Oberon/". This is more than one change. There is at least one directory and several pages under Oberon/S3/. Most of these pages are original as created by me or have been revised once or twice by me. Few or none have been changed by another editor. I understand how to move a page to a new location. Alternatively I can create a new page and mark the old one for deletion. Pertinent question: is a deleted page archived or deleted absolutely? Deletion would avoid the clutter of links from moving. Which is preferable in this case: move or recreate and delete? Thanks, ... PeterEasthope (discusscontribs) 14:16, 25 June 2020 (UTC)

@PeterEasthope: A few miscellaneous technical points, fwiw.
  • An admin can move a page and all its subpages, and can do it without leaving redirects behind.
  • We ordinarily prefer to move pages, to keep the edit history; partly for copyright purposes, but also as, really, historical record of the evolution of the page.
  • Deleted pages remain in the wiki database; they're visible to admins, and can be undeleted.
--Pi zero (discusscontribs) 15:27, 25 June 2020 (UTC)
Thanks Pi zero.
"An admin can move a page and all its subpages, and can do it without leaving redirects behind."
A third possibility I had failed to notice.
"We ordinarily prefer to move pages, to keep the edit history; partly for copyright purposes, but also as, really, historical record of the evolution of the page."
OK; to respect advised name usage, please move Oberon/S3 and everything below that to Oberon/ETH_Oberon. (Or "Oberon/ETH Oberon" if the underscore is implicit.) After the move I can search out links to S3/* and fix them. Earlier today I should have requested such a move for the sitemap page rather than recreate the page and request deletion. Similarly in earlier cases.
"Deleted pages remain in the wiki database; they're visible to admins, and can be undeleted."
Absolutely appropriate. Thanks, ... PeterEasthope (discusscontribs) 16:31, 25 June 2020 (UTC)
@PeterEasthope: Done. --Pi zero (discusscontribs) 17:12, 25 June 2020 (UTC)