Go Back   Smogon Community > Contributions & Corrections > Projects
Register FAQ Social Groups Calendar Search Today's Posts Mark Forums Read

Reply
Categories: HTML, Programming, Other
 
Thread Tools
Old Aug 23rd, 2008, 4:04:27 AM   #1
ryubahamut
is a Programmer Alumnusis a Contributor Alumnus
 
ryubahamut's Avatar
 
Join Date: Jan 2007
Posts: 999
Default General HTMLizing tools

http://ryubahamut.googlepages.com/row_alternator.py

Figured this might be useful to people while HTMLizing something with a lot of tables, like http://www.smogon.com/dp/articles/breeding_guide_part3. It's a Python script that takes a file as input, identifies tables in it and row-alternating them, and then outputs the row-alternated file on stdout. I have tried it on a few table-intensive pages, and it has worked pretty fine.

Quote:
Usage: row_alternator.py <file>
row_alternator.py <file> > <output>

Simple HTML row alternation script.

Arguments:
<file> The file to be processed.
<output> The file in which the processed data is to be written.

Omitting '> <output>' outputs the processed data to stdout.
<output> will be overwritten without warning.
Just be careful not to send in a file with any row-alternated table -- the results will be an ugly table with re-alternated rows (instead of ABABAB you'll probably see something like ABBAABABBAAB).
ryubahamut is offline   Reply With Quote
Old Aug 23rd, 2008, 7:30:08 AM   #2
X-Act
np: Biffy Clyro - Shock Shock
is a Researcher Alumnusis a Tiering Contributor Alumnusis a Contributor Alumnusis an Administrator Alumnus
 
X-Act's Avatar
 
Join Date: Feb 2006
Posts: 4,679
Malta
Default

I knew you'd write something like this. :) Excellent!
__________________
http://users.smogon.com/X-Act

For all your Pokemon needs (and more!) including: the Defensive EVs applet, the Probabilities of Breeding IVs in Pokemon applet, and the Ratings of Pokemon Base Stats applet (now Version 2.0!). And also the IV to PID applet!
X-Act is offline   Reply With Quote
Old Jul 8th, 2009, 11:56:08 PM   #3
Blue Kirby
Keep your hands off my stack.
is a Tutor Alumnusis a Site Staff Alumnusis a Battle Server Admin Alumnusis a Smogon IRC SOp Alumnusis a Contributor Alumnusis an Administrator Alumnusis a past WCoP and SPL champion
 
Blue Kirby's Avatar
 
Join Date: Nov 2007
Posts: 2,813
Default Checking Your HTML

The W3 XHTML Validator is a nice and easy tool that you can use to check the validity of your HTML, and it's been around for quite some time. All you have to do is enter your HTML to be checked, and it will report on whether there are any discrepancies or not. This can be something as simple as using & when you should have used &amp; to display it, so it's really quite a handy tool for finding errors that you might overlook normally.

You can't just paste the HTML you're going to be using at Smogon, however. This validator works by checking an entire page, not just portions of HTML. Therefore, if the display elements of the page aren't set up correctly, your HTML won't validate even if it is correct. Smogon obviously handles this when you add your code to the site, but that isn't much good if you want to check before you get somebody to cache your entry for you. With that in mind, I've thrown together a makeshift template for you to paste your work into.

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Article Test</title>
<link rel="stylesheet" type="text/css" href="http://www.smogon.com/media/global.css" />
<link rel="stylesheet" type="text/css" href="http://www.smogon.com/media/page.css" />
</head>

<body>

<!-- YOUR HTML CODE GOES HERE -->

</body>

</html>
It's pretty straightforward to use. Basically, you finish your HTML code as per usual, and paste it inside the <body> tags, or over the top of my "YOUR HTML CODE GOES HERE" comment. Note that the validator is only interested in your raw HTML, so if the standard header to Smogon documents (as below)

Code:
[title]
Blah Blah
[head]
<meta name="description" content="Blah blah blah" />
[page]
it's going to fail. So, while validating, either comment that bit out or remove it altogether. Just remember to add it in once the rest of your document validates.

Then it's just a matter of actually validating your document. You can either upload it directly or simply copy and paste your code directly. Note that if you validate by direct input, you'll receive a single warning even if the code is all correct which is to do with assumed character encoding. As long as the code actually passes in this case, you're fine since Smogon handles all of that anyway.



If you're Site Staff, you can actually just paste your HTML code as normal (ie. without using my template) and validate your page directly, so that's worth keeping in mind too.

Hopefully this will help some of you out - it's always good to be able to check your code instead of flying blind. Post any comments, questions or problems here please. :)
__________________
Blue Kirby is offline   Reply With Quote
Old Feb 20th, 2010, 8:14:42 PM   #4
eric the espeon
maybe I just misunderstood
is a Pokémon Researcheris a Contributor to Smogonis a Forum Moderator Alumnusis a Tiering Contributor Alumnus
 
Join Date: Aug 2007
Posts: 3,695
Default

Couple of things I have found handy:

BBCode to HTML converter
Remember to make the BBtags visible on posts before copying it over by clicking the A/A button in the upper right of a post while quoting or editing.

W3 "try it" thing
Allows you to quickly see how most HTML with turn out (don't try to put whole documents into it, it only likes snippets).
__________________
For people who like storing things: The Box
Reading and LC? LCF, LC Guide, LC Analyses
Good channels: #littlecup, #C&C, #1v1, others
And for SCMS editors: SCMS group
ete on IRC. Goodbye Smogon. Good luck, was fun while it lasted.
eric the espeon is online now   Reply With Quote
Reply Smogon Community > Contributions & Corrections > Projects

« Previous Thread | Next Thread »
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 7:09:57 PM.