mirror of
https://github.com/PeridexisErrant/DF-Walkthrough.git
synced 2025-09-22 05:40:49 +02:00
Check that all images are used (lint.py)
This caught a markup error, an unused image, and case-sensitivity (which Sphinx doesn't mind, but still). Now a standard test function.
This commit is contained in:
parent
fb2f942313
commit
3b5d55fa6e
4 changed files with 32 additions and 8 deletions
|
@ -52,7 +52,7 @@ movie. Well done! I can tell you’ll go far! Next step is to hit
|
||||||
:kbd:`Enter` on :guilabel:`Continue Playing`, which should be
|
:kbd:`Enter` on :guilabel:`Continue Playing`, which should be
|
||||||
highlighted. You’ll then be presented with this screen.
|
highlighted. You’ll then be presented with this screen.
|
||||||
|
|
||||||
.. image: images/01-save-list.png
|
.. image:: images/01-save-list.png
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
This is the save game list, which gets cluttered very quickly as
|
This is the save game list, which gets cluttered very quickly as
|
||||||
|
|
30
misc/lint.py
30
misc/lint.py
|
@ -4,6 +4,7 @@
|
||||||
Any other automatic checks should be in this file too.
|
Any other automatic checks should be in this file too.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from glob import glob
|
||||||
from io import open
|
from io import open
|
||||||
import os
|
import os
|
||||||
from os.path import *
|
from os.path import *
|
||||||
|
@ -40,11 +41,34 @@ def lint(path):
|
||||||
if failed:
|
if failed:
|
||||||
print('Use your text editor to convert tabs to spaces, wrap lines '
|
print('Use your text editor to convert tabs to spaces, wrap lines '
|
||||||
'or trim trailing whitespace with minimal effort.')
|
'or trim trailing whitespace with minimal effort.')
|
||||||
sys.exit(failed)
|
return failed
|
||||||
print('All files are OK')
|
|
||||||
|
|
||||||
|
def unused_images(path):
|
||||||
|
"""Check that all files in image subdirs are references in the text."""
|
||||||
|
print('Checking for unused images...')
|
||||||
|
failed = False
|
||||||
|
dirs = ['chapters', 'tutorials']
|
||||||
|
for d in dirs:
|
||||||
|
text = ''
|
||||||
|
for fname in glob(os.path.join(d, '*.rst')):
|
||||||
|
with open(fname, encoding='utf-8') as f:
|
||||||
|
text += f.read()
|
||||||
|
for img in glob(os.path.join(d, 'images', '*.*')):
|
||||||
|
img = os.path.basename(img)
|
||||||
|
if img == 'Thumbs.db':
|
||||||
|
continue
|
||||||
|
markup = '.. image:: images/{}'.format(img)
|
||||||
|
if markup not in text:
|
||||||
|
failed = True
|
||||||
|
print('Error: image not referenced, {}/{}/{}'.format(
|
||||||
|
d, 'images', img))
|
||||||
|
if failed:
|
||||||
|
print('Use or or delete these images.')
|
||||||
|
return failed
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# lint everything in the parent directory, wherever the script is run from.
|
# lint everything in the parent directory, wherever the script is run from.
|
||||||
p = relpath(join(dirname(__file__), '..'))
|
p = relpath(join(dirname(__file__), '..'))
|
||||||
lint(p)
|
sys.exit(lint(p) or unused_images(p))
|
||||||
|
|
|
@ -16,7 +16,7 @@ now is selecting :guilabel:`Prepare for your journey carefully` from
|
||||||
the embark menu. You will now be presented with your list of dwarfs
|
the embark menu. You will now be presented with your list of dwarfs
|
||||||
and the skills they can access.
|
and the skills they can access.
|
||||||
|
|
||||||
.. image:: images/14_Dwarf_Fortress_Embark_01.png
|
.. image:: images/14_dwarf_fortress_embark_01.png
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
Have a fiddle with your controls. The left-right arrows move between
|
Have a fiddle with your controls. The left-right arrows move between
|
||||||
|
@ -52,7 +52,7 @@ When you’re done, (you may have to hit :kbd:`Esc` to head back out of
|
||||||
the menu), hit :kbd:`Tab` to go to the item list. Many items will be
|
the menu), hit :kbd:`Tab` to go to the item list. Many items will be
|
||||||
on your list already, on the left, with animal options on the right.
|
on your list already, on the left, with animal options on the right.
|
||||||
|
|
||||||
.. image:: images/14_Dwarf_Fortress_Embark_02.png
|
.. image:: images/14_dwarf_fortress_embark_02.png
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
As in the last menu, use the arrows to move left and right and the up
|
As in the last menu, use the arrows to move left and right and the up
|
||||||
|
@ -70,7 +70,7 @@ for the rest of the items, that depends on your strategy. For now, hit
|
||||||
:kbd:`n` for :guilabel:`New`. You’ll be taken to a huge menu of
|
:kbd:`n` for :guilabel:`New`. You’ll be taken to a huge menu of
|
||||||
purchasable items.
|
purchasable items.
|
||||||
|
|
||||||
.. image:: images/14_Dwarf_Fortress_Embark_03.png
|
.. image:: images/14_dwarf_fortress_embark_03.png
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
Lets add some turtles to the list of stuff we’re going to take. Scroll
|
Lets add some turtles to the list of stuff we’re going to take. Scroll
|
||||||
|
@ -88,7 +88,7 @@ only one option, :guilabel:`Dwarven Wine`. You’ll note that the
|
||||||
:guilabel:`Drinks` part of the menu is highlighted, you’ll need scroll
|
:guilabel:`Drinks` part of the menu is highlighted, you’ll need scroll
|
||||||
across :guilabel:`Dwarven Wine`, then hit :kbd:`Enter`.
|
across :guilabel:`Dwarven Wine`, then hit :kbd:`Enter`.
|
||||||
|
|
||||||
.. image:: images/14_Dwarf_Fortress_Embark_04.png
|
.. image:: images/14_dwarf_fortress_embark_04.png
|
||||||
:align: center
|
:align: center
|
||||||
|
|
||||||
You can now increase and decrease the number in the usual fashion.
|
You can now increase and decrease the number in the usual fashion.
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 69 KiB |
Loading…
Add table
Add a link
Reference in a new issue