Jump to content

Module talk:TrainingPages

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Sage Ross (WMF) (talk | contribs) at 15:22, 25 April 2013 (add test cases, report regression). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Wikipedia:Training/For students/Editing topics

Wikipedia:Training/For students/Getting started 1

Wikipedia:Training/For students/Citing sources 2

---

Wikipedia:Training/header

Wikipedia:Training/For students/Text editing

Wikipedia:Training/For students/Discussion

---

Wikipedia:Training/For students/Sandbox edits for new articles


---


Module:TrainingPages error (index parameter):failed to access mw.title.new(Wikipedia:Training/For students/Nonexistent index):getContent() to load the index data

--

Wikipedia:Training/For students/valuable contribution

--

14


script error on template page

I've started using this for an updated navigation framing for the trainings. It's working on the pages themselves, but it gives script errors on the template page: Wikipedia:Training/header/draft. It seems to be related to how the module treats "index=[nothing]".--Sage Ross (WMF) (talk) 15:31, 8 April 2013 (UTC)[reply]

Sorry, I wasn't paying attention to this page! The problem right now is that the module is trying to look up an index file [[Wikipedia:Training/header/{{{topic}}} index]], and it doesn't exist. I've modified the message slightly, but I don't see a way to avoid having some kind of error if the module doesn't know what to use for an index page. Wnt (talk) 03:31, 25 April 2013 (UTC)[reply]
OK, I've made it so that it returns a text-based message which is hopefully a little bit comprehensible. Or you can set noerr = (nonblank value) to have it return nothing if there's an error, for neatness. Wnt (talk) 03:51, 25 April 2013 (UTC)[reply]
Excellent.--Sage Ross (WMF) (talk) 15:22, 25 April 2013 (UTC)[reply]

feature request: get_page by number

It'd be handy if this had a function to return the name of page X (eg, the first page) given an index.--Sage Ross (WMF) (talk) 22:39, 8 April 2013 (UTC)[reply]

OK, I've jury-rigged it so that if "page" is a number (i.e. tonumber() gives a true result) it is interpreted directly as a page number. Used with function main this returns the name of the page with a given number. It also stacks with next_page or displacement to return other pages or the default page as appropriate for the displacement. Wnt (talk) 04:13, 25 April 2013 (UTC)[reply]

new bug: total_pages not working correctly

Now total_pages is working incorrectly. For example:

{{#invoke:TrainingPages|total_pages|index=Wikipedia:Training/For students/The Core index }}

yields: 14

The expected value is 15: Wikipedia:Training/For students/The Core index.

When used in the context of a page on that index, it is now returning the same value as page_number rather than the actual total pages. See Wikipedia:Training/For students/No original research.--Sage Ross (WMF) (talk) 15:22, 25 April 2013 (UTC)[reply]