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

panic: runtime error: index out of range #32

Closed
strow opened this issue Mar 8, 2017 · 15 comments
Closed

panic: runtime error: index out of range #32

strow opened this issue Mar 8, 2017 · 15 comments
Assignees

Comments

@strow
Copy link

strow commented Mar 8, 2017

There are probably many good reasons for this error. But I wanted to introduce my use of hugo and ormode so I can understand how to port to goorgeous. I have been using hugo for 2 years with only org-mode source files. How? I just create the .html directly (yes, by hand) in emacs from the .org source file using the orgmode html exporter. It works very well, but, it is a pain in that orgmode has a different concept of "/" than hugo for the underlying filesystem. That forced me to often use absolute rather than relative links for images, etc. My guess is that most of my issues with this error is my use of embedded HTML exports in some org files, I can' imagine goorgeous will parse them. So, I am not really asking for specific help.

What I am wondering, I assume Hugo will now see an .org file and create .html. If the .html already exists (from me exporting it directly from emacs using the orgmode exporter), will hugo overwrite that file? I'm sure I can experiment with that.

I am excited to try goorgeous, and I hope it solves problems I have using ormode with Hugo, but it does make it impossible for me to use V0.19! My punishment for not doing things the "hugo" way.

@strow
Copy link
Author

strow commented Mar 8, 2017

I forgot to point out that most hugo error messages were indeed referring to goorgeous

@curiouslychase
Copy link
Owner

Can you share a snippet of a panic you get? If your html files are in your output folder those will get overwritten but it won't be overwritten if it's in your content folder.

@curiouslychase
Copy link
Owner

Also, is your Hugo source a public repo? I'm happy to help debug it so we can help others port or work around it who did the same thing.

@strow
Copy link
Author

strow commented Mar 9, 2017 via email

@strow
Copy link
Author

strow commented Mar 12, 2017 via email

@curiouslychase
Copy link
Owner

curiouslychase commented Mar 13, 2017

Are your .org files in your content directory? Since they're not truly being used by Hugo and you're already doing them by hand, if you put them in another directory that Hugo doesn't watch, it won't attempt to render your org files and overwrite your intermediate or your resulting HTML. An example:

org-content/
-- *.org # files
content/
-- *.html # emacs generated html files
public/
-- *.html # final html file

This way you can generate your org-content org files to content intermediate files and hugo will process them to the public directory (or whatever your public directory is called).

Anything that goes in the contents directory of a hugo project should be considered a file that is a src file.

@strow
Copy link
Author

strow commented Mar 13, 2017 via email

@strow
Copy link
Author

strow commented Mar 13, 2017 via email

@curiouslychase
Copy link
Owner

Hey Larrabee,

So this one thread has had me reconsidering attempting to stay in parity with org mode and instead to work on using Emacs as an exec command. I've got a working branch that I think I can PR in the next few days here: https://github.com/chaseadamsio/hugo/tree/fix-useEmacsForOrg

This will allow you to use emacs as a part of Hugo rather than a go Org port, but it won't fix the issue you're having where your .org files are getting overwritten without a config change, so I can work on that.

Best case scenario here is that you find that the new Emacs implementation fits your needs and makes it better than the workflow you have now by automating the export dispatcher you're running and potentially removing some friction from those who are struggling with hugo + org in your group.

I'd like to help you figure out a good workflow so that if you decide not to use the Emacs route that I end up requesting (I'll cc you on the PR too so you can give any feedback or concerns you have and worst case scenario we remove emacs from master and I'll just maintain my own fork because I don't like doing anything manually).

Worst case scenario, with the workflow I'm suggesting, you should only need to move files once: from content to org-content and then update your html export path to export to content. Hugo will build your public from there, so you shouldn't need to do anything.

@curiouslychase
Copy link
Owner

Also, if you let me know which release type you install from if you're not comfortable installing from source, I'd be happy to generate the relevant binary/executable and put it in the releases of my hugo fork so you can test it out before I PR.

@strow
Copy link
Author

strow commented Mar 14, 2017

Wow, looking at this thread via github shows me my mu4e emacs-based emailer is buggering up CR/LF. Oh well.

My reaction to using Emacs as an exec is fine, it it works. But that is a tricky integration that is bound to cause issues. I am a strong believer in keeping things as simple as possible. There is nothing easer than what I do now, "C-e C-b h h" in emacs and I am done. Not sexy, but very easy. I'd be very happy to test, though.

I'm not sure of this, but updating my html export to path might also be a pain? Don't I have to do that on a directory-by-directory basis (I'm on thin ground here, need to research).

This is all great, but wouldn't a simple config to tell hugo to not use your org converter solve everything? 99.9% of users would know about it, just the few (or only) user who has been using hugo with org for years. (FYI, my web site is a lot bigger than it appears, most is hidden.)

I usually just download the hugo binary. But, I have brew set up if that is usuable? I could try to install from source (Mac OS sierra with X-code, etc.). I'm slightly competent at UNIX like installs (./configure make, finding missing libs, etc.).

@curiouslychase curiouslychase self-assigned this Apr 12, 2017
@strow
Copy link
Author

strow commented Apr 25, 2017 via email

@curiouslychase
Copy link
Owner

@strow I'll take a stab at it Friday (first PTO in a while) and cc you on the PR.

@curiouslychase
Copy link
Owner

@strow sorry for the VERY long delay, but I've overhauled Goorgeous to lex > parse > transform and I think you'll find that you won't run into these out of range issues anymore. I'm going to leave this issue open and I'll add another comment once the update is merged into Hugo, maybe you can let me know if it's working for you as it should.

@curiouslychase
Copy link
Owner

So it turned out that I had a branch I was getting ready to PR into Hugo this week that fixed this, but it looks like @niklasfasching PR'ed a new org parser, so I'm closing all the issues here, deprecating and archiving goorgeous.

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

2 participants