User:Spinningspark/Coding and formatting
Categories
Don't CAT the Sandbox!!!!
[[Category:Puzzles]]
To reference a category without adding to page
[[:Category:Automotive technologies]]
To force a sort order
[[Category:Mechanical puzzles|Puzzles, Mechanical]]
To force to top of list (Space is lower in ASCII)
[[Category:Rubik's Cube| ]]
Locator Maps
Locator template (example):
How to do stuff: part 106
Actual Signature for 4 tildes: SpinningSpark 19:45, 4 January 2008 (UTC)
SpinningSpark more text more text
SpinningSpark text text text text
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
SpinningSpark
Edit help: How to put paragraphs within a single bulleted item?
This is an editing-style question. Some editors like bulleted lists for long lists with short descriptions. However, when the material for a bullet gets to be lengthy the bullet text becomes a huge tedious run-on, and the text can be hard to follow without paragraph breaks:
- Item 1
- Item 2
- Item 3 with a really long boring block of text that really should be broken into two or more paragraphs but there's no apparant way to do it. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- Item 4
I want it to break that into two or more paragraphs, except with the second paragraph indented to be part of the paragraph above it:
- Item 1
- Item 2
- Item 3 with a really long boring block of text that really should be broken into two or more paragraphs but there's no apparant way to do it. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- Item 4
Embedding text within single-cell tables can be a workaround to formatting problems. But a wikitable is incompatible with a wiki-bullet list. This attempt fails miserably:
- Item 1
- Item 2
- {|width="100%"
|- |Item 3 with a really long boring block of text that really should be broken into two or more paragraphs but there's no apparant way to do it. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. |}
- Item 4
I can FORCE this into working by using raw HTML markup like this: <ul> <li> <table width="100%"> <tr> <td> . . </td> </tr> </table> </li> </ul> and it does work correctly, but now I've contravened wiki conventions by not using the wiki's markup language and is not likely to sit well with other editors..
- Item 1
- Item 2
Item 3 with a really long boring block of text that really should be broken into two or more paragraphs but there's no apparant way to do it. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Raw HTML works! This is all part of one giant cell within a table. But alas the bullet doesn't align with the first paragraph. Oh well.
- Item 4
What can be done to do this "properly" using wiki markup? Or is it not possible to do what I want here with pure wiki markup? DMahalko (talk) 02:04, 2 January 2008 (UTC)
- You could probably put a colon : to indent the text. jj137 ♠ 02:07, 2 January 2008 (UTC)
- Testing 1
- Testing 2
- Testing 3
- Testing 4
- Alas this does not work under FireFox 2.0.0.11 and Internet Explorer 7 -- the indent for a colon is different from the bullet-item ident. :-/ DMahalko (talk) 02:14, 2 January 2008 (UTC)
- I'd say the best option to use is partial HTML. Have a standard bulleted list, but use <p> tags on the long item. Example:
- Item 1
- Item 2
Item 3 with a really long boring block of text that really should be broken into two or more paragraphs but there's no apparant way to do it. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
- Item 4
- This method keeps the bulleted list while allowing for paragraph breaks. Pyrospirit (talk · contribs) 02:40, 2 January 2008 (UTC)
- I'd say the best option to use is partial HTML. Have a standard bulleted list, but use <p> tags on the long item. Example:
Wikiblame
Here's a hack to find who put some nefarious text into an article. Please let me know if you have any comments or suggestions. (Stolen from TotoBaggins user page)
#!/usr/bin/perl -w
# FILE: wiki-blame.pl
# AUTHOR: TotoBaggins on en.wikipedia.org
#
# LICENSE: GPL
#
# DESCRIPTION: This program outputs a URL of the first revision of an article
# to contain a particular bit of text. We only download log_2 N articles,
# so it's reasonably fast and kind to the servers.
#
# USAGE:
#
# ./wiki-blame.pl {article or history URL} {offending text}
#
# The URL must be url-encoded.
# The offending text should be quoted as a single argument.
#
# EXAMPLES:
#
# Find which revision inserted some text at or before an old revision
# of the C++ article:
#
# ./wiki-blame.pl 'http://en.wikipedia.org/w/index.php?title=C%2B%2B&oldid=101608911' 'Evil Text'
#
#
# Find which revision inserted some text at or before the current revision
# of the C++ article:
#
# ./wiki-blame.pl 'http://en.wikipedia.org/wiki/C%2B%2B' 'Evil Text'
#
#
# BUGS:
#
# -- We only look back 2000 edits worth.
# -- We could be politer and faster if we stepped back through
# history exponentially.
# -- We are too dependent on wikipedia.org's URL layout.
#
use strict;
use LWP::UserAgent;
use HTML::Parser;
use HTML::LinkExtor;
use Carp;
use Data::Dumper;
my $WebAgent = LWP::UserAgent->new(keep_alive => 1);
sub get_page
{
my $url = shift;
my $response = $WebAgent->get($url);
$response->is_success() or croak $response->status_line();
return $response->content();
}
sub get_links
{
my $url = shift;
my $url_front = $url;
$url_front =~ s,^([^/]+//[^/]+)/.*,$1,;
my $page = get_page($url);
my $linky = HTML::LinkExtor->new();
$linky->utf8_mode(1);
$linky->parse($page) or croak "Can't parse: $page";
my @urls;
foreach my $link ($linky->links())
{
my ($tag, %links) = @$link;
my $url = $links{href} or next;
push @urls, "$url_front$url";
}
return @urls;
}
use constant YES_MARKER => 100;
use constant NO_MARKER => 0;
{
my %MarkerCache;
sub url_has_text
{
my ($url, $text) = @_;
unless (defined $MarkerCache{$url})
{
my $page = get_page($url);
use File::Slurp;
$url =~ /oldid=(\d+)/;
write_file("oldid-$1.html", $page);
$MarkerCache{$url} = index($page, $text) >= 0
? YES_MARKER : NO_MARKER;
}
return $MarkerCache{$url};
}
}
# This is from List::Search, which had a bug. It can be
# removed when "List::Search::nlist_search(2, [2, 2, 2])" returns 0 and not 1
sub custom_list_search
{
my ($cmp_code, $key, $array_ref) = @_;
my $max_index = scalar(@$array_ref) - 1;
my $low = 0;
my $mid = undef;
my $high = $max_index;
my $lowest_match = undef;
while ($low <= $high)
{
$mid = int($low + (($high - $low) / 2));
my $mid_val = $array_ref->[$mid];
my $cmp_result = $cmp_code->($key, $mid_val);
if ($cmp_result > 0)
{
$low = $mid + 1;
}
else
{
if ($cmp_result == 0
&& (!defined($lowest_match) || $lowest_match > $mid))
{
$lowest_match = $mid;
}
$high = $mid - 1;
}
}
# Look at the values here and work out what to return.
# Perhaps there are no matches in the array
return -1 if $cmp_code->($key, $array_ref->[-1]) == 1;
# Perhaps $mid is just before the best match
return $mid + 1 if $cmp_code->($key, $array_ref->[$mid]) == 1;
# $mid is correct
return $mid;
}
sub snarf_history_urls
{
my ($article_url, $limit) = @_;
my $idx_url = $article_url;
$idx_url =~ s/\&oldid=(\d+)$/\&action=history&limit=$limit/
||
$idx_url =~ s,/wiki/(.+),/w/index.php?title=$1&limit=$limit&action=history,
or die $idx_url;
my @all_urls = get_links($idx_url);
my @history_urls;
foreach my $url (@all_urls)
{
# only old article urls
next unless $url =~ m,/index.php\?title=[^&]+&oldid=\d+$,;
push @history_urls, $url;
}
# make chronological
@history_urls = reverse @history_urls;
return @history_urls;
}
sub get_first_history_url
{
my $url = shift;
return $url if $url =~ /&oldid=\d/;
my @history_urls = snarf_history_urls($url, 1);
return $history_urls[0];
}
sub find_rev_that_added
{
my ($offending_history_url, $offending_text) = @_;
my $history_index_url = $offending_history_url;
# FIXME: we limit it to 2000 urls to be kind to the wikiservers
# We should really bite off pieces of history stepwise.
my $max_urls = 2000;
my @history_urls = snarf_history_urls($offending_history_url, $max_urls);
$offending_history_url =~ /\&oldid=(\d+)/ or die $offending_history_url;
my $offending_id = $1;
# my %url2index;
my $saw_offender;
my @before_offender_urls;
foreach my $url (@history_urls)
{
# $url2index{$url} = @before_offender_urls;
push @before_offender_urls, $url;
last if $url =~ /\&oldid=$offending_id\b/;
}
my $url2marker = sub {
my ($key, $url) = @_;
my $has_it = url_has_text($url, $offending_text);
my $ret = $key <=> $has_it;
# warn "has($has_it), ret($ret), u2i($url2index{$url}), $url\n";
return $key <=> $has_it;
};
my $first_with = custom_list_search($url2marker, YES_MARKER,
\@before_offender_urls);
return unless $first_with >= 0;
if ($first_with == $max_urls)
{
warn "Warning: It looks like that edit occurred further in "
. "the past than I feel comfortable looking (beyond "
. "$max_urls edits).\n";
return;
}
return $before_offender_urls[$first_with];
}
@ARGV == 2 or die "usage: $0 {article or history URL} {offending text}\n";
my $url = shift;
my $offending_text = shift;
my $offending_history_url = get_first_history_url($url);
if (my $found_url = find_rev_that_added($offending_history_url,
$offending_text))
{
if ($found_url eq $offending_history_url)
{
print "No earlier revisions found.\n";
}
else
{
print "Earliest revision: $found_url\n";
}
}
else
{
print "Not found\n";
}
Heading 1
Heading 2
- Bullet
- Bullet
- Bullet
- Bullet
- Number
- Number
- Number
- Number
- Indent
- Indent
- Indent
- Indent
Heading 3
Heading 4
Heading 5
Heading 6
=Heading 7=
text text[1] text[2] text[3] text text text. Now is the time for all good men to come to the aid of the party. Now is [3] the time for all good men to come to the aid of the party.[4]
How do you make notes [3] and [4] link to the same reference? I am sure I have seen this done in some articles.
Yipee!!!! done it! That was hard work.
References
More References
What happens if you put another Reflist after you have alredy inserted one?[1]
- ^ Another Reference