Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Citation Snippets for free! #77

Open
juanitogan opened this issue May 5, 2023 · 1 comment
Open

Citation Snippets for free! #77

juanitogan opened this issue May 5, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@juanitogan
Copy link

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 and aciteweb. aciteweb means ARCHIVED web citation. aciteweb also has an alias, citeweb-wb, in case you don't like typing acite... (but it actually exists to help users understand things when browsing the list of snippets during autocomplete).

wikitext.json.TXT

// Maybe write a cleaner (cleaning script) to go with it all.
// Well, don't really need a script with regex search/replace:
// To find empty parameters (search for the code between the `backticks`):
//   Vertical format (strict): `^\| [a-z0-9-]+ += \n`
//   Vertical format (broad) : `^ *\| *[a-z0-9-]+ *= *\n`
//   Horizontal format (strict): ` \|[a-z0-9-]+=((?= \|)|(?= ?\}\}))`
//   Horizontal format (broad) : ` *\| *[a-z0-9-]+ *=((?= *\|)|(?= *\}\}))`
// Strict: strictly limited to the exact formatting used by these snippets.
// Broad:  broadly allows for imprecise editing and various standards.

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).

@Frederisk
Copy link
Owner

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.😥

@Frederisk Frederisk added the enhancement New feature or request label May 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants