Jump to content

Documentation XML raw data


Josh
 Share

Recommended Posts

If you want to experiment with auto-generated HTML, PDFs, eBooks, or whatever, here are some raw data files I am working with for the new documentation system:

http://www.leadwerks.com/documentation/toc.xml

http://www.leadwerks.com/documentation/API-Reference_Object_Entity_SetPosition.xml

 

The structure of these will probably not change much. Let me know if you come up with anything cool.

  • Upvote 2

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I'd recommend you split up parameters like this.

<parameters>
<x>
 X component of the specified position.
</x>
<y>
 Y component of the specified position.
</y>
<z>
 Z component of the specified position.
</z>
<position>
 the position to set.
</position>
<global>
 indicates whether the position should be set in global or local space.
</global>
</parameters>

 

Would allow for more flexible documentation. If I have some pare time I'll try to throw together a simple Bootstrap/Angular Material example together.

  • Upvote 1
Link to comment
Share on other sites

Does the PHP XML loader guarantee that the contents of <parameters> will be returned in their original order, and not alphabetized or something?

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I still have a lot more work to do on this, but here is what I have so far on a documentation app.

 

http://martyj.net/LEDocs/

 

I'm planning on making it fully offline as I've wanted offline docs since forever.

 

Things left to do:

  • Style page better
  • Parse XML to Javascript Objects
  • Generate NAV based upon XML
  • Support Page Changing with Nav
  • Load XML when you change the page

Link to comment
Share on other sites

I would think this might be a good case for nw.js? Store the information locally but do a check for update process with it to call an API to get the updated data? Controlled web environment so you know it'll look the same for everyone vs browser of the week. Just a thought.

Link to comment
Share on other sites

I have updated the link again. It will allow you to navigate to the SetPosition page. This parses the toc.xml to generate the navigation menu and parses API-Reference_Object_Entity_SetPosition.xml for the specific page.

 

The downsides:

 

Due to CORS issues, all the XML files have to be on the same host (or localhost). So to update it, I'll have to download the XML files.

  • Upvote 1
Link to comment
Share on other sites

What's the problem? I load XML files from the Steam servers all the time in PHP.

 

  function LoadXML($path)

{

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $path);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$content = @curl_exec($ch);

curl_close($ch);

 

//$content = @file_get_contents($path);

if ($content==NULL)

{

if ($_GET['debug']==1) { echo('Error: Load XML failed.'); }

return NULL;

}

$content = utf8_encode($content);

$content = str_replace(chr(11),'',$content);

$content = str_replace(chr(28),'',$content);

$content = str_replace(chr(25),'',$content);

if (trim($content=='')) return NULL;

return simplexml_load_string($content);

}

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

What's the problem? I load XML files from the Steam servers all the time in PHP.

 

The difference is that martyj uses js for loading and parsing the XML-files client-side, while PHP does that server-side.

CORS is a security mechanism implemented by browsers to prevent cross-origin-XSS.

  • Upvote 1
Link to comment
Share on other sites

What Ma-Shell said.

 

The nice aspect about this application is it can be deployed separately for 100% offline documentation.

 

Another nice aspect is that if you deploy the application say with version 4.4 of Leadwerks, the documentation matches the code. Kind of self-versioning.

 

I could try a JSONP request to pull down the documentation, the downside is it removes offline capabilities. We could also maybe use local storage to help with this as well.

Link to comment
Share on other sites

I could try a JSONP request to pull down the documentation, the downside is it removes offline capabilities. We could also maybe use local storage to help with this as well.

 

Hence why I said maybe nw.js could be used for this. Still used offline with the ability to check if it can refresh it's data if online and download and save the updated files locally. Something plain html/css/js couldn't do very well. Using local storage wouldn't be ideal for this.

 

Not to mention that your environment is now stable and known for documentation. No screwing around coding for every web browser under the sun. You know how it looks on nw.js is how it'll look for everyone always. It's basically a better chm system because it allows you do code to pull changes when online but be able to still view it when offline.

  • Upvote 1
Link to comment
Share on other sites

  • 1 month later...

It's far from perfect but I wrote a simple Python 3 - script which parses "API-Reference_Object_Entity_SetPosition.xml" (which has to be in the current directory) and exports it as HTML ("out.html") and LaTex ("out.tex"). You will need a LaTex-Compiler (e.g. https://miktex.org/download) to generate a pdf out of this LaTex-file.

generate_docu.py.txt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...