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

Documented default SA:MP includes. #4

Open
Y-Less opened this issue Feb 2, 2018 · 3 comments
Open

Documented default SA:MP includes. #4

Y-Less opened this issue Feb 2, 2018 · 3 comments

Comments

@Y-Less
Copy link
Member

Y-Less commented Feb 2, 2018

Basically combine this, with permission:

http://forum.sa-mp.com/showthread.php?t=649045

@Southclaws
Copy link
Collaborator

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)

@Dayvison
Copy link

Dayvison commented Feb 2, 2018

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

@Southclaws
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants