Merge pull request #8969 from overleaf/bg-issue8967

Apply draft mode to graphics package as well (in addition to graphicx)

GitOrigin-RevId: 6137f90ef9d579f0e6554801e8f2e0f5dee2aa83
This commit is contained in:
Brian Gough 2022-07-22 09:12:18 +01:00 committed by Copybot
parent d99be63877
commit 9ea1226460
12 changed files with 481 additions and 2 deletions

View file

@ -4,7 +4,9 @@ const logger = require('@overleaf/logger')
async function injectDraftMode(filename) {
const content = await fsPromises.readFile(filename, { encoding: 'utf8' })
const modifiedContent = '\\PassOptionsToPackage{draft}{graphicx}' + content
const modifiedContent =
'\\PassOptionsToPackage{draft}{graphicx}\\PassOptionsToPackage{draft}{graphics}' +
content
logger.debug(
{
content: content.slice(0, 1024), // \documentclass is normally v near the top

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View file

@ -0,0 +1,25 @@
\documentclass{article}
\usepackage{graphics}
\title{Your Paper}
\author{You}
\begin{document}
\maketitle
\begin{abstract}
Your abstract.
\end{abstract}
\section{Introduction}
This is the start of the document.
\begin{figure}[ht]
\includegraphics[0,0][100,100]{frog.jpg}
\end{figure}
This is the end of the document.
\end{document}

View file

@ -0,0 +1,3 @@
{
"draft": true
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View file

@ -0,0 +1,37 @@
\documentclass{article}
% Language setting
% Replace `english' with e.g. `spanish' to change the document language
\usepackage[english]{babel}
% Set page size and margins
% Replace `letterpaper' with `a4paper' for UK/EU standard size
\usepackage[letterpaper,top=2cm,bottom=2cm,left=3cm,right=3cm,marginparwidth=1.75cm]{geometry}
% Useful packages
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
\title{Your Paper}
\author{You}
\begin{document}
\maketitle
\begin{abstract}
Your abstract.
\end{abstract}
\section{Introduction}
This is the start of the document.
\begin{figure}[h]
\centering
\includegraphics[width=0.3\textwidth]{frog.jpg}
\caption{\label{fig:frog}This frog was uploaded via the file-tree menu.}
\end{figure}
This is the end of the document.
\end{document}

View file

@ -0,0 +1,3 @@
{
"draft": true
}

View file

@ -36,7 +36,8 @@ Hello world
encoding: 'utf8',
})
expect(contents).to.equal(
'\\PassOptionsToPackage{draft}{graphicx}' + this.contents
'\\PassOptionsToPackage{draft}{graphicx}\\PassOptionsToPackage{draft}{graphics}' +
this.contents
)
})
})

View file

@ -0,0 +1,182 @@
{
"xRefEntries": [
{
"offset": 0,
"gen": 0,
"free": true
},
{
"offset": 67338,
"gen": 0,
"uncompressed": true
},
{
"offset": 67606,
"gen": 0,
"uncompressed": true
},
{
"offset": 15,
"gen": 0,
"uncompressed": true
},
{
"offset": 216,
"gen": 0,
"uncompressed": true
},
{
"offset": 790,
"gen": 0,
"uncompressed": true
},
{
"offset": 840,
"gen": 0,
"uncompressed": true
},
{
"offset": 975,
"gen": 0,
"uncompressed": true
},
{
"offset": 1083,
"gen": 0,
"uncompressed": true
},
{
"offset": 1578,
"gen": 0,
"uncompressed": true
},
{
"offset": 9881,
"gen": 0,
"uncompressed": true
},
{
"offset": 17868,
"gen": 0,
"uncompressed": true
},
{
"offset": 29906,
"gen": 0,
"uncompressed": true
},
{
"offset": 38400,
"gen": 0,
"uncompressed": true
},
{
"offset": 46656,
"gen": 0,
"uncompressed": true
},
{
"offset": 56198,
"gen": 0,
"uncompressed": true
},
{
"offset": 65682,
"gen": 0,
"uncompressed": true
},
{
"offset": 16,
"gen": 0
},
{
"offset": 16,
"gen": 1
},
{
"offset": 16,
"gen": 2
},
{
"offset": 16,
"gen": 3
},
{
"offset": 16,
"gen": 4
},
{
"offset": 16,
"gen": 5
},
{
"offset": 16,
"gen": 6
},
{
"offset": 16,
"gen": 7
},
{
"offset": 16,
"gen": 8
},
{
"offset": 16,
"gen": 9
},
{
"offset": 16,
"gen": 10
},
{
"offset": 16,
"gen": 11
},
{
"offset": 16,
"gen": 12
},
{
"offset": 16,
"gen": 13
},
{
"offset": 16,
"gen": 14
},
{
"offset": 16,
"gen": 15
},
{
"offset": 16,
"gen": 16
},
{
"offset": 16,
"gen": 17
},
{
"offset": 16,
"gen": 18
},
{
"offset": 16,
"gen": 19
},
{
"offset": 16,
"gen": 20
},
{
"offset": 16,
"gen": 21
},
{
"offset": 16,
"gen": 22
}
],
"startXRefTable": 67606
}

View file

@ -0,0 +1,226 @@
{
"xRefEntries": [
{
"offset": 0,
"gen": 0,
"free": true
},
{
"offset": 69708,
"gen": 0,
"uncompressed": true
},
{
"offset": 70038,
"gen": 0,
"uncompressed": true
},
{
"offset": 15,
"gen": 0,
"uncompressed": true
},
{
"offset": 216,
"gen": 0,
"uncompressed": true
},
{
"offset": 867,
"gen": 0,
"uncompressed": true
},
{
"offset": 990,
"gen": 0,
"uncompressed": true
},
{
"offset": 1143,
"gen": 0,
"uncompressed": true
},
{
"offset": 1251,
"gen": 0,
"uncompressed": true
},
{
"offset": 1834,
"gen": 0,
"uncompressed": true
},
{
"offset": 10137,
"gen": 0,
"uncompressed": true
},
{
"offset": 18124,
"gen": 0,
"uncompressed": true
},
{
"offset": 31939,
"gen": 0,
"uncompressed": true
},
{
"offset": 40433,
"gen": 0,
"uncompressed": true
},
{
"offset": 48689,
"gen": 0,
"uncompressed": true
},
{
"offset": 58231,
"gen": 0,
"uncompressed": true
},
{
"offset": 67715,
"gen": 0,
"uncompressed": true
},
{
"offset": 16,
"gen": 0
},
{
"offset": 16,
"gen": 1
},
{
"offset": 16,
"gen": 2
},
{
"offset": 16,
"gen": 3
},
{
"offset": 16,
"gen": 4
},
{
"offset": 16,
"gen": 5
},
{
"offset": 16,
"gen": 6
},
{
"offset": 16,
"gen": 7
},
{
"offset": 16,
"gen": 8
},
{
"offset": 16,
"gen": 9
},
{
"offset": 16,
"gen": 10
},
{
"offset": 16,
"gen": 11
},
{
"offset": 16,
"gen": 12
},
{
"offset": 16,
"gen": 13
},
{
"offset": 16,
"gen": 14
},
{
"offset": 16,
"gen": 15
},
{
"offset": 16,
"gen": 16
},
{
"offset": 16,
"gen": 17
},
{
"offset": 16,
"gen": 18
},
{
"offset": 16,
"gen": 19
},
{
"offset": 16,
"gen": 20
},
{
"offset": 16,
"gen": 21
},
{
"offset": 16,
"gen": 22
},
{
"offset": 16,
"gen": 23
},
{
"offset": 16,
"gen": 24
},
{
"offset": 16,
"gen": 25
},
{
"offset": 16,
"gen": 26
},
{
"offset": 16,
"gen": 27
},
{
"offset": 16,
"gen": 28
},
{
"offset": 16,
"gen": 29
},
{
"offset": 16,
"gen": 30
},
{
"offset": 16,
"gen": 31
},
{
"offset": 16,
"gen": 32
},
{
"offset": 16,
"gen": 33
}
],
"startXRefTable": 70038
}