5. Testing downloadable files

Download img.png here. Download this there. Don’t download this.

6. Test file and literal inclusion

../_images/img2.png ../_images/img2.png
# Literally included file using Python highlighting
# -*- coding: utf-8 -*-

foo = "Including Unicode characters: üöä"

class Foo:
    pass

class Bar:
    def baz():
        pass

def bar(): pass

System Message: WARNING/2 (/Users/tkomiya/work/sphinx/tests/build/日本語/includes.txt, line 9)

Encoding ‘utf-8-sig’ used for reading included file u’/Users/tkomiya/work/sphinx/tests/build/\u65e5\u672c\u8a9e/wrongenc.inc’ seems to be wrong, try giving an :encoding: option
This file is encoded in latin-1 but at first read as utf-8.

Max Strauß aß in München eine Leberkässemmel.

This file is encoded in latin-1 but at first read as utf-8.

Max Strauß aß in München eine Leberkässemmel.

7. Literalinclude options

class Foo:
    pass
    def baz():
        pass
6
7
8
class Foo:
    pass
class Bar:
foo = "Including Unicode characters: üöä"
START CODE
# Literally included file using Python highlighting
# -*- coding: utf-8 -*-

foo = "Including Unicode characters: üöä"

class Foo:
    pass

class Bar:
    def baz():
        pass

def bar(): pass
END CODE
foo = "Including Unicode characters: üöä"

class Foo:
    pass

class Bar:
    def baz():
        pass

def bar(): pass
# Literally included file using Python highlighting
# -*- coding: utf-8 -*-

foo = "Including Unicode characters: üöä"
--- literal_orig.inc
+++ literal.inc
@@ -1,12 +1,12 @@
 # Literally included file using Python highlighting
 # -*- coding: utf-8 -*-
 
-foo = "Including Unicode characters: üöä"  # This will be changed
+foo = "Including Unicode characters: üöä"
 
-class FooOrig:
+class Foo:
     pass
 
-class BarOrig:
+class Bar:
     def baz():
         pass
 
Tabs include file test
----------------------

The next line has a tab:
-| |-
Tabs include file test
----------------------

The next line has a tab:
-|      |-
6
7
class Foo:
    pass
6
7
class Foo:
    pass
3
foo = "Including Unicode characters: üöä"

Test if dedenting before parsing works.

    def baz():
        pass

8. Docutils include with “literal”

While not recommended, it should work (and leave quotes alone).

Testing "quotes" in literal 'included' text.