Skip to content

Inliner seems to create paragraphs for javascript #1

@cefn

Description

@cefn

I ran the inliner cloned from the github repo using the content of the Micropython WebREPL from https://github.com/micropython/webrepl served using python's SimpleHTTPServer by...

cd webrepl; python -m SimpleHTTPServer

The invocation was as follows

python inliner.py --dir tmp --uri http://localhost:8000/webrepl.html --verbose > result.html

However, it created a file in which Javascript was inlined as paragraphs! Here's a sample of the first few lines to give the idea...

<html>
 <body>
  <p>
   /**
 * term.js - an xterm emulator
 * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
 * https://github.com/chjj/term.js
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:

Here's how the tool ran in verbose mode, and attached is the resulting html file.
result.zip

All content will be deleted. Do you want to continue? [y/n]
y

Now downloading files. Please wait...
--2016-12-04 20:06:03--  http://localhost:8000/webrepl.html
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:8000... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11884 (12K) [text/html]
Saving to: ‘tmp/webrepl.html’

     0K .......... .                                          100% 23.8M=0s

2016-12-04 20:06:03 (23.8 MB/s) - ‘tmp/webrepl.html’ saved [11884/11884]

Loading robots.txt; please ignore errors.
--2016-12-04 20:06:03--  http://localhost:8000/robots.txt
Connecting to localhost (localhost)|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response... 404 File not found
2016-12-04 20:06:03 ERROR 404: File not found.

--2016-12-04 20:06:03--  http://localhost:8000/term.js
Connecting to localhost (localhost)|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 157214 (154K) [application/javascript]
Saving to: ‘tmp/term.js’

     0K .......... .......... .......... .......... .......... 32%  148M 0s
    50K .......... .......... .......... .......... .......... 65%  183M 0s
   100K .......... .......... .......... .......... .......... 97% 25.3M 0s
   150K ...                                                   100% 52.2M=0.003s

2016-12-04 20:06:03 (57.8 MB/s) - ‘tmp/term.js’ saved [157214/157214]

--2016-12-04 20:06:03--  http://localhost:8000/FileSaver.js
Connecting to localhost (localhost)|127.0.0.1|:8000... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5938 (5.8K) [application/javascript]
Saving to: ‘tmp/FileSaver.js’

     0K .....                                                 100%  319K=0.02s

2016-12-04 20:06:03 (319 KB/s) - ‘tmp/FileSaver.js’ saved [5938/5938]

FINISHED --2016-12-04 20:06:03--
Total wall clock time: 0.09s
Downloaded: 3 files, 171K in 0.02s (7.86 MB/s)
Converting tmp/webrepl.html... 2-0
Converted 1 files in 0.02 seconds.

Building resource map...
==========================================
- term.js [text/javascript]
/usr/local/lib/python2.7/dist-packages/bs4/__init__.py:181: UserWarning: No parser was explicitly specified, so I'm using the best available HTML parser for this system ("lxml"). This usually isn't a problem, but if you run this code on another system, or in a different virtual environment, it may use a different parser and behave differently.

The code that caused this warning is on line 365 of the file inliner.py. To get rid of this warning, change code that looks like this:

 BeautifulSoup([your markup])

to this:

 BeautifulSoup([your markup], "lxml")

  markup_type=markup_type))
- webrepl.html [text/html]
- FileSaver.js [text/javascript]

Using term.js

Expanding stylesheets...

Inlining resources...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions