{"action":"opened","issue":{"url":"https://api.github.com/repos/patriciogonzalezvivo/thebookofshaders/issues/12","labels_url":"https://api.github.com/repos/patriciogonzalezvivo/thebookofshaders/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/patriciogonzalezvivo/thebookofshaders/issues/12/comments","events_url":"https://api.github.com/repos/patriciogonzalezvivo/thebookofshaders/issues/12/events","html_url":"https://github.com/patriciogonzalezvivo/thebookofshaders/issues/12","id":97736388,"number":12,"title":"PDF build fails with IOError","user":{"login":"cansik","id":5220162,"avatar_url":"https://avatars.githubusercontent.com/u/5220162?v=3","gravatar_id":"","url":"https://api.github.com/users/cansik","html_url":"https://github.com/cansik","followers_url":"https://api.github.com/users/cansik/followers","following_url":"https://api.github.com/users/cansik/following{/other_user}","gists_url":"https://api.github.com/users/cansik/gists{/gist_id}","starred_url":"https://api.github.com/users/cansik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cansik/subscriptions","organizations_url":"https://api.github.com/users/cansik/orgs","repos_url":"https://api.github.com/users/cansik/repos","events_url":"https://api.github.com/users/cansik/events{/privacy}","received_events_url":"https://api.github.com/users/cansik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-28T15:32:46Z","updated_at":"2015-07-28T15:32:46Z","closed_at":null,"body":"I tried to create the pdf but make does always fail with this error:\r\n\r\n### Error\r\n```\r\nTraceback (most recent call last):\r\n  File \"src/parseBook.py\", line 49, in <module>\r\n    modifiedChapterString = injectShaderBlocks(folder,modifiedChapterString)\r\n  File \"src/parseBook.py\", line 26, in injectShaderBlocks\r\n    shaderString = open(shaderPath, 'r').read()\r\nIOError: [Errno 2] No such file or directory: './14/texture.frag\" data-imgs=\"hokusai.jpg'\r\nmake: *** [all] Error 1\r\n```\r\n### Research\r\nIt looks like the script takes a bit too much from the html. In this case it would be a parsing error, so i checked your regex:\r\n```python\r\nshaderFile = re.sub(r'<div class=\\\"codeAndCanvas\\\" data=\\\"(.*)\\\"></div>', r'\\1', line.rstrip())\r\n```\r\nThis regex should filter out the **.frag** in this line:\r\n\r\n```html\r\n<div class=\"codeAndCanvas\" data=\"texture-resolution.frag\" data-imgs=\"nicephore.jpg\"></div>\r\n```\r\n\r\n### Problem\r\nNow the problem is:\r\n1. There is an unescaped `/` at the end of the query.\r\n2. The `(.*)` is too greedy. It does not care about other attributes in the html div.\r\n\r\nSo the result of the first group is:\r\n```texture-resolution.frag\" data-imgs=\"nicephore.jpg```\r\n\r\n### Fix\r\nWe could try make a stronger regex if we know how the files are named. They just contain `-`, `A-Za-z`, `.` and end with a `frag`  so why don't we just try to match them and leave everything else away?\r\n\r\n```regex\r\ndata=\\\"([\\w\\-\\.]+frag)\\\"\r\n```\r\n\r\nNow we can replace the line in the script with a simple regex search and get the filename in the first group value:\r\n\r\n```python\r\nshaderFile = re.findall('data=\\\"([\\w\\-\\.]+frag)\\\"', line)[0]\r\n```\r\n\r\nFinally it works!...ehm...the generation of the frag's works. I have a .tex file now, but the pdf generation still does not work. If I find the solution I will open another issue.\r\n\r\n### As a help for other Mac users want to build it themselfs\r\nIf you try to **make** the glslViewer on MacOSX and it does not find the **glfw3** library, you have to export the path to it after install (maybe the path is different on your system):\r\n```export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/```\r\n\r\n~~And you have to install [xelatex](http://www.texts.io/support/0001/)!~~"}}