XML Transformation Script (PowerShell)
New version as of August 14th
Version: 1.6 Fixes: • Changed the method of loading the XML data so it allows for loading larger files. • Fixed an issue with smart images where the script generated an error if the image was revealed, nothing was unmasked, and the export included only revealed content. Now, instead of generating an error, the script ignores the lack of image data. • Fixed an issue with the GUI script where the Destination file dialog was not filtering for the proper extensions according to the selected output format (Word vs. HTML). Please read the release notes. https://github.com/EightBitz/RWExport |
We are going to need a new sticky somewhere or an entirely new sub forum with user-donated tools, as I am sure this is just the first of the useful things that folks will generate to handle morphing exports.
Eightbitz, congrats on paving the way, and I pray you find a job. |
Absolutely stick with Compact format. That's exactly what you should be using for stuff like this.
And I echo @Bidmaron's sentiments about best wishes for finding gainful employment quickly! I'll need to talk to BJ about what we're going to do about user-created tools. That's something that I'd always expected once we got the export/import stuff into place, but it's also something I neglected give any serious thought to how we can facilitate. <sigh> |
I love that you are choosing to share this with the community and appreciate the time and knowledge you spent coming up with a solution, thanks so much Eightbitz!
If you'd like a hand with the HTML and CSS portion, I'm willing to give it a go. Mind you, I'm out of practice, it's been about 5'ish years since I last did anything with HTML/CSS, so if you'd rather take up someone else's offer or do it yourself, I completely understand :) I second Bidmaron's suggestion of a repository for these type of posts, I'm sure there will be plenty of users that come up with clever solutions for doing different things with our newly found powers ;) Github would be a fantastic way for users to contribute under the Lone Wolf umbrella, would allow for versioning control, not to mention a way to review and approve submissions. Just a suggestion, of course, I'm sure you guys will come up with a solution that works :) |
Eventually... Does the content market have a category for things like this? Keep the forums clean.
|
I think we'll need a forum for general user reviews. While I think the Grey Whatsits will be helpful, they could be overwhelmed. And it would be nice to have Grey Whatsits and community reviews all collected in the same place so we don't run all over looking for information. It may be that reviews and tools can live happily together to reduce the number of forums? And I could be totally offbase and the ability to do reviews will be tied directly to the files in the Marketplace. I'm just throwing noodles at the fridge to see what might stick.... ;)
|
Quote:
|
Quote:
Also, no offense, but I'm taking your name in vain while improving my PowerShell script. The fact that a plain-text snippet can have multiple ordered lists, multiple unordered lists, multiple tables, and multiple instances of unformatted text, in any order, has made my life difficult. :-p As a user, of course, I love that flexibility. But dealing with that with the script has been challenging. I think I'm there, though. I've been able to parse out all the different blocks, in order, and now I'm parsing the blocks themselves. I'm done with the plain text, the ordered lists, and the unordered lists, and just have to deal with the tables. Mind you, this is all for the plain text transformation. When I'm done with that, I'll work on an HTML one which, I gather, would be easier in this regard as I can leave more of the HTML tags in place instead of tearing it apart like I am now for plain text. Now YOU can laugh at MY pain. Seriously and sincerely, though, thank you for this. And don't forget to take care of yourself! You're going to need your strength to deal with the angry mob outside who are just waiting to bust your chops about custom calendars. ;-D |
Quote:
The only slight gotcha is that we use encoding of the contents so that it isn't interpreted as XML tags, but that should be straight-forward to deal with. |
@EightBitz:
Notice how we have been civil and not turned into an angry mob complete with touches and pitchforks - yet... Nah, just kidding. :-) |
Quote:
|
OK, I'm not going to keep cluttering up the forum, but here's a much better version of the plain text export. No HTML or anything yet, just plain text.
I'll set up a DropBox or something soon. I sorted out a few bugs and oversights, and added some functionality: Version 0.5a Added a -Prefix switch to optionally include a topic's prefix. Added a -Suffix switch to optionally include a topic's suffix. Added a -Sort option to sort topics by: 1 = Name 2 = Prefix, Name **Default** 3 = Category, Name 4 = Category, Prefix, Name Choosing options 2 or 4 will sort by prefix, regardless of whether or not the -Prefix switch is specified. Likewise, choosing options 1 or 3 will sort by name, regardless of whether or not the -Prefix switch is specified. Added parentage for topics. Made the topic suffix parenthetical so it's consistent with the display in RW. Better (I hope) parsing of snippets, and support for more types. Supported snippet types include: Text (Including lists and tables, but NOT including any formatting such as bold, italic, highlights, etc.) GM Directions Labeled Text Tags Calendar Date Calendar Date Range Numeric Value Tags (MultiDomain) Unsupported snippet types include: Picture (Simple) Smart Image (Map) Statblock Hero Lab Portfolio Foreign Object Any snippet types listed under "Documents and Media" It now responds to the Get-Help cmdlet. Get-Help RWExport-To-Text.ps1 Have fun! Code:
# RWExport-To-Text.ps1 (formerly Format-RWExport.ps1) |
You aren't cluttering. This is really interesting to see the project develop and it's a critical need for the community. Thank you for tackling this huge need.
And all the best in your job searching. |
As far as a place to store code, github or gitlab could be good options. You can create free accounts on either and then check in code, getting versioning as part of it. git client is free. If someone wants to grab code but not install git, they can do so from the web interface. Anyone who wants to contribute to it can also submit changes that you could review and incorporate into your code base pretty easily.
|
Quote:
|
I'm way too old school D&D for simple pitchforks. Guisarmes and Glaives for the peasants or there will be no mob.
|
Quote:
|
My only suggestion would be to keep the "First" page updated with the latest script. As this thread grows it can be hard for someone new to find the "latest" script. :)
This forum lets you edit any post you have ever done no matter how long ago. |
Quote:
|
Put the script in a GitHub. It's worth it as you can track changes and people can submit bug reports etc. Update the front page with a link to the GitHub.
|
Hey! I had a pitchfork LAST time. You promised me I could have a torch!!!
Oh, and github is beautiful. Even for us non-coders. The 5e HL community stuff is there and it's easy to download and provide edits. |
Quote:
I'm adding an option to indent nested topics and sections. And it works great for everything except tables. Mind you, I'm still very much an amateur coder, but here's basically what's happening. In order to indent blocks of text, and not just the first line, I'm using margin-left. For pre-formatted HTML text in the contents node, I'm inserting it right after the "<p " tag. And I add it to every instance, otherwise only some parts of some snippets will indent, and the rest will not. Adding it to every instance of <p means it's also adding the margin to the table cells. I could just write code that says if this snippet includes a table tag, then don't insert a margin, but if I have a combo snippet with text and lists and tables, that's not going to work. So I have to divide things up into components again so I can have better control of where I insert the margins. The GOOD news is that I already have that code. :-) The bad news is that I've been up all night, and I'm tired. But the GOOD news is that everything else is looking good, and this is hopefully the last thing I have to tackle. The bad news is that I can't do it right now. But the GOOD news is that ... uhhh ... oh, never mind. |
Quote:
|
New version up. Handles HTML. See the first message in this thread or go here:
https://gist.github.com/EightBitz/c2...52ba593a9735a1 |
Bloody nice work EightBitz! I tried it tonight and managed it with little to no issues. Had to modify the security settings on my PC to enable the script to run and I had removed the full stop from the start of the script thinking that was just to break any auto-formatting (I do that in Excel alot).
To make this a bit easier for new users to pick up here's a video on the process of setting up and running the script. Realm Works - How To Print Your Realm |
Doh! I forgot about the security issue.
The Powershell command you need is: Set-ExecutionPolicy RemoteSigned That SHOULD do the trick. |
Quote:
There's a file called "main.css" that should have been included in the zip download. Put the HTML file in the same folder as the main.css file, and you will see a world of difference. |
And if you want nested topics and sections indented, you can add -Indent to the end of the command line.
If you type: Get-Help .\RWExport-To-HTML.ps1 -full You will see all the options available, with examples of how to use them on the command line. |
2 Attachment(s)
I just wanted to show people what the output SHOULD look like in your web browser, if you have the html and css files together, and if you use the -Indent option.
Playground1.pdf is the way I have things setup by default. In Playground2.pdf, I just made a few changes to the css file to change the formatting, but it's the exact same HTML file. EDIT: Note this is also from a newer version of the script that now displays images inline, and has links for statblocks. I want to smooth a few things out before I put this new version up, but the key here is to showcase the formatting. |
Excellent! Have to admit... I was excited that I figured out how to get it working at all.... Will put a full video together showing this next step.
|
Nice EightBitz. Very nice! :)
|
First of all, thank you EightBitz, for the great script.
I figure you would want a report of any errors, so here goes. I've done some testing and believe I have it narrowed down to it choking on bullet lists (which I use heavily, unfortunately). Interestingly, it works fine if I change the Snippet Type to Labeled Text and leave the bullet lists as-is. It also seems to work if I use the bullet list under "Styles" rather than under "Paragraphs". (Does anyone know why we have two sets of bullets, and other, lists?) Code:
New-Object : Cannot find type [â€TypeName PSObject â€Prop]: verify that the assembly containing this type is loaded. |
Quote:
|
Email sent.
|
Quote:
|
To Rob, Davidp, daplunk, ShadowChemosh, and everyone else, I want to thank you for the kind words and moral support.
And daplunk, thank you for a mostly awesome video ... until the very end where you pulled up the unformatted HTML and said, "Well that's it!" And my jaw dropped with incredulity as I mentally screamed, "No, that is certainly NOT it!" But still, you seem to have a very good method in making your videos. When I gear up to start entering my own data, I plan to watch more of them. Right now, though, yes I am still updating the script. As you've seen in the PDF files that I posted, I'm adding support for stat blocks and images, and I've going to see what I can do with other snippet types. No guarantees on anything at this point. |
:D Will update it tonight.
|
New version up. See the first post in this thread.
|
Just thinking out loud here...
Powershell scripts can be run via .net applications right? Which means it should be relatively simple to build a UI into this thing... |
Quote:
Can be and relatively simple not same thing. |
All times are GMT -8. The time now is 04:42 PM. |
Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.