Open juanitogan opened 1 year ago
The web citation command is curious.
The source code of the command Web Citation actually comes from #12, It would be great if you could provide help with the relevant code. The execution logic for this command is located here.
Here is my snippets file for anyone who might find it as useful I do.
For code snippets, one of my ideas is to provide separate extensions for different languages of Wikipedia and other Wiki-related projects that users can install on demand. Because templates with the same template name in different languages do not necessarily have the same functionality, the templates commonly used in many wikis are also very different.
However, this plan has been delayed because I have accumulated too many todos, just like the issues in this repo.😥
First off, awesome work! I haven't tried any of the custom Wikipedia editors but, after this plugin, I really don't think I need to.
Second, the web citation command is curious, but not useful to me if it treats WaybackMachine links the same as non-archived links. (Also noting that WaybackMachine [web.archive.org] is different than the archive.org library.) Note how I handle this with regex in my snippets below. Personally, I rarely use title as reported by the web page and may never use this command over snippets... but it still might useful it on occasion if the archive stuff is worked out.
Third, a big hint on how to build more citation commands like the web one (ISBN being much desired) is the Citation bot: https://en.wikipedia.org/wiki/User:Citation_bot
Finally, here is my snippets file for anyone who might find it as useful I do (I just tested it on writing a few articles amounting to ~225 citations). I included both vertical and horizontal citation formats (vertical being the default--comment out and uncomment as you like--but I highly recommend using vertical with list-defined refs {{reflist|refs=...}}). I also included regex code in the comments of the JSON file (and below) for cleaning out all unused citation fields when you are done (do a search for the regex code [enabling the regex search option
.*
and replace with nothing]).I included most citation templates (but not all) and included what most templates indicated as the most common fields (with some normalizing of fields across templates done by myself--it's a mess on wiki). Modify the snippet fields as your work dictates. I expect these snippets to just be a starting point for many users.
Note that the real time-saver of the snippets are the archive ones that take a single valid WaybackMachine URL (web.archive.org/web/...) and parses it into url, archive-url, and archive-date for you. It takes some getting used to, tabbing through the snippet fields without falling out of snippet mode before getting to the URL, but it's not too hard either. When I biff it, I often just start a second snippet, skip to the URL, fill it, then edit the two snippets back into one with a simple delete of the middle redundant lines. I tried putting URL first in order, but that was weird.
[[ Also note the VSCode currently has trouble with shift-tabbing through the url-status choice field (drop-down). I reported this as bug with choice fields to VSCode but they closed it without even testing the example code I sent with it. So... good luck getting that one fixed. ]]
The snippet descriptions are a bit wordy because I tried to make it clear to novices that the archive.org Library (which is an archive, maybe... but its works are not "archived") and the WaybackMachine should be handled differently in citations. Again, change descriptions as you like.
Most snippets have two forms. For example, web has:
citeweb
andaciteweb
.aciteweb
means ARCHIVED web citation.aciteweb
also has an alias,citeweb-wb
, in case you don't like typingacite...
(but it actually exists to help users understand things when browsing the list of snippets during autocomplete).wikitext.json.TXT
To use, put this JSON file in your Code/User/snippets folder (wherever that is for you) and remove the TXT filename extension (added so I could upload it here).