Modified files (php, css, etc.) from WordPress's “Twenty Sixteen” theme for phesoca.com, my personal website.
Filename | Path |
---|---|
additional.css | [“Additional CSS” in “Customize”] |
functions.php | wp-content/themes/twentysixteen/functions.php [only supplement at the end of the file] |
create-templates.py | wp-content/themes/twentysixteen/ (run here) |
Following punctuation marks are considered Chinese (East Asian) punctuation by default, and will be set to full-width:
- Apostrophes (“”‘’)
- Ellipsis (…)
- Em dash (—)
- Middot (·)
To use these punctuation marks in half-width (e.g. in English or Math), put a backslash (\) before them. For example: An \‘apostrophe\’ in English
.
For the middot before syllables with neutral tone (轻声) in pinyin, use “ꞏ” (U+A78F
modifier letter middot) instead.
If the interior character next to an apostrophe is a less- or greater-than sign (“<
or >”
), the class="non-breaking"
tag will not be added. Please manually add under this circumstance.
Chinese punctuation is set to full-width by using classes cn
, cn-quot
, and full-width-char
.
Class hori-scroll
adds horizontal scrolling to its content, which is often a wide table. Usage:
<div class="hori-scroll">
<table>...</table>
</div>
Uses text-autospace.js (see my fork) to automatically insert spacing between East Asian characters and European alphabets.
To prevent spacing, add <span hidden> </span>
between East Asian characters and European alphabets.
Format for number in the body: ^[noted text|anchor|note text|link]
. The 2nd argument must start with either flags: pn
for footnote, or pr
for reference. The 1st, 3rd, and 4th arguments can be omitted. For example:
^[pn1]
and^[|pn1]
both produces “footnoted text*1” with anchor idpn1
and a link to#n1
.^[footnoted text|pn1|note text|link]
produces “footnoted text*note text” with anchor idpn2
and a link to#link
.
Format for number at the end: ^[anchor|note text|link]
. The 1st argument must start with either flags: n
for footnote, or r
for reference. The 2nd and 3rd arguments can be omitted. For example:
^[n1]
produces “*1” with anchor idn1
and a link to#pn1
.^[n2|note text|link]
produces “*note text” with anchor idn2
and a link to#link
.
Visible on hover. Usage:
<span class="hint" data-tooltip="hUNTun">馄饨</span>
inline-note
: Main classphono-term
: For Historical Chinese phonology terms like those in 麻二 and 脂合, but not for notes like 去声 or 文读er
: For er (儿) suffixweakened
: For unt-defined weakened form (inspired from writing er suffix as inline note)
When an article/passage uses unt-defined inline note for weakened form, both weakened
and er
should be given to er suffixes.
Use '
instead of '
for years before 2011 (e.g. 0'11.21
(0'11.21) meaning Nov 21, 2010), since '
will be converted into ’
.
Note: This is temporarily (maybe permenantly) abandoned since it will disable adding TOC anchors during generating the content.
// apply_filters()@wp-includes/plugin.php:205
// From
$filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args );
// To
static $filtered_content = '';
if ( $hook_name == 'the_content' && $filtered_content && is_singular() && get_the_ID() != 99 ) {
$filtered = $filtered_content;
} else {
$filtered = $wp_filter[ $hook_name ]->apply_filters( $value, $args );
if ( $hook_name == 'the_content' ) {
$filtered_content = $filtered;
}
}
// wp_trim_excerpt()@wp-includes/formatting.php:3974
// Make sure the content passed into `apply_filters()` in `get_the_excerpt()` is the same as that in `the_content()`
// From
$text = strip_shortcodes( $text );
$text = excerpt_remove_blocks( $text );
$text = excerpt_remove_footnotes( $text );
$filter_image_removed = remove_filter( 'the_content', 'wp_filter_content_tags', 12 );
$filter_block_removed = remove_filter( 'the_content', 'do_blocks', 9 );
// To
if ( !is_singular() ) {
$text = strip_shortcodes( $text );
$text = excerpt_remove_blocks( $text );
$text = excerpt_remove_footnotes( $text );
}
$filter_image_removed = !is_singular() && remove_filter( 'the_content', 'wp_filter_content_tags', 12 );
$filter_block_removed = !is_singular() && remove_filter( 'the_content', 'do_blocks', 9 );