User:DaxServer/BooksToSfn

{{Infobox user script

| screenshot = Screenshot of DaxServer's BooksToSfn script being used.png

| author = DaxServer

| updated = {{start date and age|2021|10|28}}

| status = Release candidate

| source = User:DaxServer/BooksToSfn.js

| skins = Vector

| browsers = Brave, Google Chrome, Firefox

| released = {{start date and age|2021|10|25}}

| desc = Converts a {{tlx|cite book}} to use {{tlx|Sfn}}

}}

The script will add a "Books to Sfn" portlet link in Visual Editor's source mode editing, in main namespace articles or in the user's Sandbox. When clicked, it converts one {{tlx|cite book}} inside a ... tag block into an {{tlx|Sfn}}.

The script looks for a level-2/3 "Bibliography" section with a {{tlx|Refbegin}}–{{tlx|Refend}} block and appends the {{tlx|cite book}} inside the block. If not, it will look for a level-2 "References" section and create a level-3 "Bibliography" section. After the conversion, a success message or a failure message (with more details in the browser console) would be displayed. Verify the conversion and make any changes necessary. It's recommended to save one change at a time so as to have a good page history.

Capabilities

The script is capable of identifying the last names required by {{tlx|Sfn}} in this order:

  • last
  • last1 ... lastn
  • author
  • author1 ... authorn
  • editor
  • editor1 ... editorn

The script is capable of identifying year from the parameters year or date. It is capable of identifying page numbers from the parameters page or pages.

{{User:Enterprisey/USinstall}}