How to debug Octopress markdown source files? - debugging

I use Octopress for blogging. Generally it works well except one occassion -- after typing rake generate, I got depressing output which says something like:
psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 3 column 6 (Psych::SyntaxError)
I can't remember how many times I've encounterd this situation. Every time I google the key words above, but got nothing help.
What I can do is to exclude all the source files (*.mkd) from _posts, and add them one by one to check which one goes wrong. I keep checking, and finally it turns out that a minor grammer mistake makes octopress angry.
Life should NOT be that hard. So is it possible to debug a octopress source file to show which line of file is incorrect in grammer? The outputs from rake generate don't make sense at all.

The reason could be wrong JAML in the top part of the post (e.g. ':' in the title), see https://github.com/jekyll/jekyll/issues/549 for more info.

I've seen a similar error ("mapping values are not allowed in this context") when I try to convert markdown files, using Pandoc. Perhaps your error message is coming from pandoc somehow?

Don't bother to debug Octopress. Please migrate to Pelican -- a Python-powered static site generator. It is full-featured, easy to use, and no doubt, generating useful debug information.

Related

Validating YAML file in PhpStorm

I'm working on a project where YAMLs are used (among other use cases) for storing synonym lists. A file may look a little like this:
- "streifen,gestreift"
- "fleeceoverall,fleeceanzug"- "federball,badminton"
- "hochgarage,parkgarage"
In this case - "federball,badminton" is on the same row as - "fleeceoverall,fleeceanzug" which causes the build of the application to fail with an error stating
Unexpected characters near "- "federball,badminton".
I tried to configure a code style profile for code inspections as mentioned here in the PhpStorm documentation:
https://www.jetbrains.com/help/phpstorm/customizing-profiles.html?keymap=secondary_default_for_macos
But I don't know what to adjust here. I using the IDE-Standard which looks like this for wrapping and braces (which I guess is what I'm looking for ;) :
I also took a look at validating my YAML against a JSON file as mentioned here: https://www.jetbrains.com/help/phpstorm/yaml.html# but ultimately I don't understand how this works :/
So I guess I'm a little lost on how to avoid the errors at build time beforehand and would love some advice!

SublimeLinter User Config parse error (pep8)

I've just installed SublimeLinter to help me manage my Python code. Currently it is flagging up blank lines as errors which is annoying so I wanted to disable that by writing some ignore settings in the user config file.
The config file is located in ~./config/sublime-test-2/Packages/User/SublimeLinter.sublime-settings
{
"pep8_ignore":
[
"W239"
]
}
If I try to add a comma after the square brackets I get "Trailing comma before closing brackets" when saving
If I try to add a comma after the curly brackets I get "unexpected trailing characters" when saving
If I leave it as it is above and close and reopen sublime I get the error message:
"Error trying to parse settings: Unexpected character, expected a
comma or closing bracket in
~/.config/sublime-text-2/Packages/SublimeLinter/SublimeLinter.sublime-settings:194:9
(despite the file only being a few lines long.
I've looked on here and other places to look for examples and it seems I'm doing it exactly as others have done. Any advice would be much appreciated. Sorry if my formatting isn't great, I'm getting use to the stackoverflow way of doing things.
From the error you're getting, you cut something out of the original settings file (~/.config/sublime-text-2/Packages/SublimeLinter/SublimeLinter.sublime-settings) when you made your Packages/User/SublimeLinter.sublime-settings file. Head over to the SublimeLinter GitHub site and download the original version.
Next, save that original version both in the Packages/SublimeLinter directory and and your Packages/User directory. The User one will override the other, but you need to remember that any keys you make changes to need to be replicated in full (please read the README in full to understand) in order for everything to work properly. Now, you can scroll down in the User copy to the "pep8_ignore": section and add "W239" on its own line, with commas , separating lines. So, the full section should look like this:
"pep8_ignore":
[
"E501",
"W239"
],
Feel free to add new errors/warnings as you want, but remember that others in the community will likely look more favorably on your code the more closely you follow PEP8. That being said, some of the warnings are rather silly, but over time I've found myself coding closer to the guidelines, and it really does result in cleaner, more easily-read code, especially if you come back to something after a while.

make error latex

make -C doc html latexpdf
yields this:
Package hyperref Message: Driver (autodetected): hpdftex.
(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty))
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/hypcap.sty))
(/usr/share/texlive/texmf-dist/tex/latex/multirow/multirow.sty)
Writing index file Arakoon.idx
(./Arakoon.aux)
Runaway argument?
{{1.10.3}{9}{Client side support\relax }{subsection.1.10.
! File ended while scanning use of \#newl#bel.
<inserted text>
\par
l.113 \begin{document}
?
If someone is still looking for this: For me usually, when a prior build had failed due to an error, subsequent builds would fail with this error. Solved it by deleting the main .aux file and building it again.
It is impossible to say with any confidence, but it looks like a fragile (non-robust) command in a subsubsection heading or a maths label (would be label 10.1.3), because:
It occurs at \begin{document}, when the .aux files are loaded,
The error indicates a malformed directive in the .aux file, and the presence of a \relax there - typically what command reduce to after having performed their side effect.
Two suggestions:
Generate an MWE by making a new document from this with all the body of your document except that heading/ equation (and perhaps the sentence following) deleted. Does this create the same error? If so, post it here. You might need some trial and error to find out which Lat3ex command is responsible, but it should contain the text Client side support.
Do read https://tex.stackexchange.com/questions/4736/what-is-the-difference-between-fragile-and-robust-commands - if I am right, you have a fragile command where it shouldn't be. Figure out what should be there instead.

Adding Bootstrap Less to Sinatra

I have a Modular Sinatra app and I'm trying to add the Bootstrap less to the application.
get '/bootstrap/application.css' do
less :"bootstrap/bootstrap"
end
I have all less files in views/bootstrap, including bootstrap.less.
I get this error:
Less::ParseError at /bootstrap/application.css 'reset.less' wasn't found.
The first real line of Bootstrap.less is:
// CSS Reset
#import "reset.less";
I've tried all different path formats, but it never finds the files it's looking to import. Any idea how to make this work?
Have you tried passing the :paths config option?
get '/bootstrap/application.css' do
less :"bootstrap/bootstrap", :paths => ["views/bootstrap"]
end
I've had problems with this option in the past but it may work for you.
I found a solution that worked for me here: Parsing LESS options in a Sinatra app
Since this question was the one I found first on Google, I thought I'd leave the link here so that others can find it.

Ruby feed parsing: "Input is not proper UTF-8, indicate encoding!"

I am trying to parse RSS feeds using Feedzirra.
Some of them are ok, but others return the error:
Error while parsing. Input is not proper UTF-8, indicate encoding !
How do I fix it?
This does not seem to be a Feedzirra issue, IMO.
Your libxml or nokigiri dependencies may not be up-to-date. Update these gems and try again.
Like mentioned here, encoding detection is not 100% accurate.
If you'd like to ignore the ones which give you errors,
Feedzirra has callback functions
Another feature present in Feedzirra is the ability to create callback
functions that get called “on success” and “on failure” when getting a
feed. This makes it easy to do things like log errors or update data
stores.
Also, please give us more context on what code gives you the error or which file are you trying to parse.

Resources