Talk:List of books about mushrooms

Latest comment: 6 years ago by Laelius Linguae in topic See also section

See also section edit

Why some mushroom books are in "See also" section and not in the section according to book type? Staszek Lem (talk) 18:59, 8 September 2017 (UTC)Reply

Hey Staszek Lem, I wanted to link to authors' specific pages on Wikipedia (and their books) since I don't see a way to do that using the {{cite}} macro. If there is a way to link those pages from their references in their respective sections, that would be preferred - I just don't know of a way to do that. Many thanks! Laelius Linguae (talk) 19:28, 8 September 2017 (UTC)Reply
There is a parameter "authorlink=" in {{cite}} . And you cat put double square brackets around book title (or part of it, if a short title is used for the title of article about the book. Since I see the books were already in the list, I fixed this for you. Staszek Lem (talk) 23:08, 8 September 2017 (UTC)Reply
Thank you, you are awesome. TIL how to link within citations! I am a novice at writing Wikipedia articles, however I try to make up for that with enthusiasm. :-) Laelius Linguae (talk) 15:51, 9 September 2017 (UTC)Reply

Staszek Lem, as a reward for helping me learn, I offer you a bookmarklet I wrote that converts the titles in cite macros into proper Title Case:

(function() {
	var textareaVal = $('textarea').val(),
			newTextareaVal = '';
	String.prototype.toTitleCase = function(){
		var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;

		return this.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title){
			if (index > 0 && index + match.length !== title.length &&
				match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" &&
				(title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') &&
				title.charAt(index - 1).search(/[^\s-]/) < 0) {
				return match.toLowerCase();
			}

			if (match.substr(1).search(/[A-Z]|\../) > -1) {
				return match;
			}

			return match.charAt(0).toUpperCase() + match.substr(1);
		});
	};

	function titleCaseTextarea() {
		console.log('arguments length: ', arguments.length);
		for (var i = 0; i < arguments.length; i++) {
			var arg = arguments[i];
			console.log('argument ', i, ': ', arg);
		}
		console.log('returning: ', 'title = ' + arguments[1].toTitleCase() + '|');
		return 'title = ' + arguments[1].toTitleCase() + '|';
	}
	
	newTextareaVal = textareaVal.replace(/title = ([^\|]*)\|/gi, titleCaseTextarea);	
	console.log('newTextareaVal: ', newTextareaVal);
	$('textarea').val(newTextareaVal);
	
})();

// bookmarklet (make a new Bookmark, in the location bar copy and paste the following):

// javascript:(function()%20{%20%20%20var%20textareaVal%20=%20$('textarea').val(),%20%20%20%20%20%20%20newTextareaVal%20=%20'';%20%20%20String.prototype.toTitleCase%20=%20function(){%20%20%20%20%20var%20smallWords%20=%20/^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i;%20%20%20%20%20%20return%20this.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g,%20function(match,%20index,%20title){%20%20%20%20%20%20%20if%20(index%20>%200%20&&%20index%20+%20match.length%20!==%20title.length%20&&%20%20%20%20%20%20%20%20%20match.search(smallWords)%20>%20-1%20&&%20title.charAt(index%20-%202)%20!==%20":"%20&&%20%20%20%20%20%20%20%20%20(title.charAt(index%20+%20match.length)%20!==%20'-'%20||%20title.charAt(index%20-%201)%20===%20'-')%20&&%20%20%20%20%20%20%20%20%20title.charAt(index%20-%201).search(/[^\s-]/)%20<%200)%20{%20%20%20%20%20%20%20%20%20return%20match.toLowerCase();%20%20%20%20%20%20%20}%20%20%20%20%20%20%20%20if%20(match.substr(1).search(/[A-Z]|\../)%20>%20-1)%20{%20%20%20%20%20%20%20%20%20return%20match;%20%20%20%20%20%20%20}%20%20%20%20%20%20%20%20return%20match.charAt(0).toUpperCase()%20+%20match.substr(1);%20%20%20%20%20});%20%20%20};%20%20%20%20function%20titleCaseTextarea()%20{%20%20%20%20%20console.log('arguments%20length:%20',%20arguments.length);%20%20%20%20%20for%20(var%20i%20=%200;%20i%20<%20arguments.length;%20i++)%20{%20%20%20%20%20%20%20var%20arg%20=%20arguments[i];%20%20%20%20%20%20%20console.log('argument%20',%20i,%20':%20',%20arg);%20%20%20%20%20}%20%20%20%20%20console.log('returning:%20',%20'title%20=%20'%20+%20arguments[1].toTitleCase()%20+%20'|');%20%20%20%20%20return%20'title%20=%20'%20+%20arguments[1].toTitleCase()%20+%20'|';%20%20%20}%20%20%20%20newTextareaVal%20=%20textareaVal.replace(/title%20=%20([^\|]*)\|/gi,%20titleCaseTextarea);%20%20%20console.log('newTextareaVal:%20',%20newTextareaVal);%20%20%20$('textarea').val(newTextareaVal);%20%20})();

// then, when you have the edit page open where there are titles you want to conform - click on the bookmark to run the javascript to change the titles to proper Title Case. Note, this only works with English...

Sincerely,

Laelius Linguae (talk) 16:00, 9 September 2017 (UTC)Reply