From 12e2e49c7983c9409522f2679e88481dd798db04 Mon Sep 17 00:00:00 2001 From: annprog Date: Mon, 10 Jun 2019 19:18:48 +0800 Subject: [PATCH] code highlight style wip #26 --- crs/zh-CN.yaml | 3 +-- extensions/listings/listings.sh | 10 +++++++++- panbook | 1 - 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/crs/zh-CN.yaml b/crs/zh-CN.yaml index b2114e6..6dcfc47 100644 --- a/crs/zh-CN.yaml +++ b/crs/zh-CN.yaml @@ -9,5 +9,4 @@ figPrefix: "图" eqnPrefix: "公式" tblPrefix: "表" secPrefix: "章节" -linkReferences: true -listings: true \ No newline at end of file +linkReferences: true \ No newline at end of file diff --git a/extensions/listings/listings.sh b/extensions/listings/listings.sh index 9f3a813..e2b48cd 100644 --- a/extensions/listings/listings.sh +++ b/extensions/listings/listings.sh @@ -2,11 +2,19 @@ regext listings getArrayVar _G "ext-listings" true getArrayVar _G "ext-listings-lstset" "$SCRIPTDIR/${_G[extdir]}/listings/listings-set.tex" +function listings() { + for i in `echo ${!_P[@]}`;do + [ $i == "listings" ] && echo true && return 0 + done + echo false +} + function ext_listings() { # 依赖add header功能 - if [ "${_G[ext-listings]}"x == "true"x -a "${_G[ext-header]}"x == "true"x ];then + if [ `listings` == "true" -a "${_G[ext-listings]}"x == "true"x -a "${_G[ext-header]}"x == "true"x ];then writeHeader ${_G[ext-listings-lstset]} _P[listings]="" + _M[listings]=true fi } diff --git a/panbook b/panbook index 06ffc73..89a471c 100644 --- a/panbook +++ b/panbook @@ -72,7 +72,6 @@ _G=( _P=( [toc]="" - [listings]="" [csl]=$SCRIPTDIR/csl/chinese-gb7714-2005-numeric.csl # 默认cls文件路径(需要在获取参数后重置) [bibliography]=$CWD/src/bibliography.bib # 默认bibliography路径(需要在获取参数后删除) [metadata-file]=$CWD/src/metadata.yaml # 默认metadata.yaml(需要在获取参数后重置)