使用这样的语法......
[[File:foo.pdf]]
...可以引用MediaWiki页面中的文件。在这种情况下,将从第一个PDF页面生成缩略图,并在页面的渲染视图中显示。
我的问题是:如何阻止生成此缩略图并显示一些PDF特定图标? (所有PDF文件的单个图标?)
答案 0 :(得分:1)
您可以通过添加冒号来阻止显示缩略图,只需将其作为文件的链接:
[[:File:foo.pdf]]
然而,你不会得到任何图标。
要用图标替换它,您需要指定要使用的图标。例如,如果您启用了Instant Commons:
[[File:Document-pdf.svg|25px|link=foo.pdf]]
要将其用于所有文件,我建议将其包装在模板中,以便您可以使用{{PDF|foo.pdf}}
进行调用。创建包含以下内容的Template:PDF
:
[[File:Document-pdf.svg|25px|link={[[File:Document-pdf.svg|25px|link={N = input("How many inputs: ")
a = []
for _ in xrange(N):
a.append(input("Enter value for flux: "))
}]] [[:File:{ByteBuffer
}|{package nl.owlstead.stackoverflow;
import java.nio.BufferOverflowException;
import java.nio.ByteBuffer;
/**
* Helper class to create telephone numbers with headers for Java card using
* reverse packed BCD format.
*
* @param buffer
* a buffer with enough space for the 3 byte header
*/
public final class OverlyDesignedTelephoneNumberHelper {
private static final int TELEPHONE_NUMBER_SIZE = 10;
private static final int NIBBLE_SIZE = 4;
private static final byte[] HEADER = { (byte) 0x0C, (byte) 0x91,
(byte) 0x19 };
/**
* Adds the header for the telephone number to the given buffer.
*
* @param buffer
* a buffer with enough space for the 3 byte header
* @throws NullPointerException
* if the buffer is null
* @throws BufferOverflowException
* if the buffer doesn't have enough space for the header
*/
private static void addTelephoneNumberHeader(final ByteBuffer buffer) {
buffer.put(HEADER);
}
/**
* Adds the telephone number to the given buffer.
*
* @param buffer
* a buffer with enough space for the 3 byte header
* @param number
* the number in BCD format, should be 10 bytes in size
* @throws IllegalArgumentException
* if the number is null or doesn't contain 10 BCD digits
* @throws NullPointerException
* if the buffer is null
* @throws BufferOverflowException
* if the buffer doesn't have enough space for the telephone
* number
*/
private static void addTelephoneNumber(final ByteBuffer buffer,
final byte[] number) {
if (number == null || number.length != TELEPHONE_NUMBER_SIZE) {
throw new IllegalArgumentException("Expecting 10 digit number");
}
for (int i = 0; i < number.length; i += 2) {
final byte lowDigit = number[i];
validateUnpackedBCDDigit(lowDigit);
final byte highDigit = number[i + 1];
validateUnpackedBCDDigit(highDigit);
buffer.put((byte) ((highDigit << NIBBLE_SIZE) | lowDigit));
}
}
/**
* Tests if the given unpacked BCD digit is within range.
*
* @param b
* the byte to test
* @throws IllegalArgumentException
* if it isn't
*/
private static void validateUnpackedBCDDigit(final byte b) {
if (b < 0 || b > 9) {
throw new IllegalArgumentException(
"Telefonenumber isn't all bytes representing digits in BCD");
}
}
public static void main(final String... args) {
final byte[] number = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 5 };
final ByteBuffer buf = ByteBuffer.allocate(HEADER.length
+ TELEPHONE_NUMBER_SIZE);
addTelephoneNumberHeader(buf);
addTelephoneNumber(buf, number);
buf.flip();
while (buf.hasRemaining()) {
System.out.printf("%02X", buf.get());
}
System.out.println();
}
private OverlyDesignedTelephoneNumberHelper() {
// avoid instantiation
}
}
}]]
}]]
这样,如果你想要,你也可以显示文件名:
import { Response, ResponseOptions, ResponseType, Request } from '@angular/http';
import { MockConnection } from '@angular/http/testing';
class MockError extends Response implements Error {
name:any
message:any
}
...
handleConnection(connection:MockConnection) {
let body = JSON.stringify({key:'val'});
let opts = {type:ResponseType.Error, status:404, body: body};
let responseOpts = new ResponseOptions(opts);
connection.mockError(new MockError(responseOpts));
}