samp-stdlib
samp-stdlib copied to clipboard
Documented default SA:MP includes.
Basically combine this, with permission:
http://forum.sa-mp.com/showthread.php?t=649045
I actually noticed this when checking packages.sampctl.com and was going to contact the author.
It would be useful, and when the docgen tool mentioned in Southclaws/sampctl#106 is introduced, it could be updated to use the newer syntax (or I could implement XML parsing into the docgen for XML style docs)
This can be done using this and this code:
import requests
from bs4 import BeautifulSoup
check = True;
wikiurl = "http://wiki.sa-mp.com/wiki/";
function_name = "";
while check == True:
print("\nInput function name to search in wiki ");
function_name = input();
r = requests.get(wikiurl + function_name);
s = r.content;
soup = BeautifulSoup(s,"html.parser");
try:
description = soup.find_all("div",{"class":"description"});
print("\nDescription\n");
print(description[0].text);
try:
params = soup.find_all("div",{"class":"parameters"});
print("\nParameters\n");
print(params[0].text);
except IndexError:
print("\nInvalid Function specified");
try:
example_code = soup.find_all("pre",{"class":"pawn"});
print("Example code\n");
print(example_code[0].text);
except IndexError:
print("There is no example code available for this function");
except IndexError:
print("No results found check your function name (case sensitive)");
print("\n\n\nDo you want to search more?(Y/N)");
t = input();
if t == "n" or t == "N":
check = False;
I really don't remember who did this
Thanks! That will definitely come in handy.
Side note: I've just updated the repo with tagged releases dating back to 0.3z libraries. Master branch will contain RCs so I encourage sampctl users to adopt version tags to future-proof themselves.