jluc / scribus-project-manager Goto Github PK
View Code? Open in Web Editor NEWShell scripts for scribus project management
Shell scripts for scribus project management
as for now, text comments (texts with AAA, XXX, YYY or PPP) are listed while compiling the book
provide an command line option to NOT list these.
or a book config to set default.
When creating the map of the document's chapter, use a defined alternate title style when the defined main title style is not used in a chapter.
makebook -noimages
creates all chapter's PDF anew, each time it's launched, even for chapters that have not changed.
Ensure makebook -noimages
only creates required PDFs (whose SLA has been updated).
See also #16
So as to export to PDF in case the SLA is newer than the existing PDF
use
Before launching work, first check scribus exec, xmllint
and xmlstarlet
are installed.
scribuscommand
variable in slacheck
script. Check it's possible to set it in slacheck.config
.When using -xmlfind
option with -replace
specifying an empty string, the test issues a "missing parameter" error : -replace option must have additionnal parameter = replacement string
.
Example : makebook -find '<ITEXT FONT="Liberation" FCOLOR="Vert" CH="remember the milk"/>' -replace ''
In makebook, test is : if [ "$1" = "" ]
with vecto
-vecto should
ATTENTION BUG à vérifier :
La production de PDF en ligne de commande par scribus ne permet PAS de créer des PDF vectorisés
Issue with command line PDF exports is :
When i set options to "outline all" when exporting to PDF and later save the SLA,
and later again export it to PDF through the commande line option, using :
filename = os.path.splitext(scribus.getDocName())[0]
pdf = scribus.PDFfile()
pdf.file = filename+".pdf"
pdf.version = 15
pdf.save()
then the created PDF has all fonts embeded or subset,
when it should have none, but vectors instead.
William Bader : To see the list of options, on the Scribus menu bar, use Help -> Scribus Manual, and then in the manual, open the Contents tab and navigate to For Developers -> Scripter API -> PDF Export.
PDFFile has a fontEmbedding property that you can set to 1 to request conversion to vectors.
Can you try adding a line pdf.fontEmbedding = 1
Fonts used in unused styles definition should not be reported as not embeded.
Enable to use both -nobleeds and -noimages simultaneously : concat suffixes.
Some PPP or AAA comments are not found as comments, but are found with -find
option.
That is verrrrry strange.
todo : Check that all included images files really exist
ale : « it would be nice to have a more formal definition of what your project manager does and what an improved version should / could do.
Having a "dtd" for the config files and for the output would be -- as an example -- be helpful. »
(ale didnt say whether he tried it)
Remove special glyphs in textes before using them to create the PDF bookmarks
Eg «
and »
, emojis...
slacheckimage should also check if declared image file really do exist
Scribus's search tool is useless since it does not show the result (see mantis).
Todo : create a script that searches for a string and outputs context of each occurences :
Options :
There is allready a search option now but it doesnt output page number. This could be very difficult to do.
AAA, XXX and PPP are markers in text to mention there is something to check / do / insert
Slacheck should
Some comments are not found as comments, but -find
option finds them. Fix regexp ?
Both AAAs and PPPs
Eg
<PAGEOBJECT XPOS="691.538636995078" YPOS="391.347826086957" OwnPage="-1" ItemID="1505579706" PTYPE="4" WIDTH="156.819875776397" HEIGHT="117.465838509317" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="22.6771653543307" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="0" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L156.82 0 L156.82 117.466 L0 117.466 L0 0 Z" copath="M0 0 L156.82 0 L156.82 117.466 L0 117.466 L0 0 Z" ImageRes="0" gXpos="691.538636995078" gYpos="391.347826086957" gWidth="0" gHeight="0" LAYER="0" NEXTITEM="-1" BACKITEM="-1">
<StoryText>
<DefaultStyle/>
<ITEXT CPARENT="Default Character Style" CH="[AAA gnagna]"/>
<trail/>
</StoryText>
</PAGEOBJECT>
Mais pareil sans les crochets.
Also :
<PAGEOBJECT XPOS="901.470472440951" YPOS="225.529348733981" OwnPage="0" ItemID="1489022282" PTYPE="4" WIDTH="266.852362204721" HEIGHT="55.164906759196" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="22.6771653543307" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="0" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L266.852 0 L266.852 55.1649 L0 55.1649 L0 0 Z" copath="M0 0 L266.852 0 L266.852 55.1649 L0 55.1649 L0 0 Z" ImageRes="0" gXpos="-1099.3937007874" gYpos="-2626.18763427061" gWidth="89.6870078740174" gHeight="107.087598425196" ALIGN="0" LAYER="1" NEXTITEM="-1" BACKITEM="-1">
<StoryText>
<DefaultStyle ALIGN="0" FCOLOR="Brun feuillemorte foncée" BGCOLOR="None"/>
<ITEXT FONT="Life Savers Bold" FONTSIZE="11" FEATURES="inherit outline shadowed" FCOLOR="Brun feuillemorte foncée" SCOLOR="orangeoyant" BGCOLOR="None" BGSHADE="20" TXTSHX="4" TXTSHY="-3" TXTOUT="0.5" SCALEV="100" KERN="0" LANGUAGE="fr" CH="É..."/>
<breakline/>
<ITEXT FONT="Life Savers ExtraBold" FONTSIZE="15" FEATURES="inherit outline shadowed" FCOLOR="Brun feuillemorte foncée" SCOLOR="orangeoyant" BGCOLOR="None" BGSHADE="20" TXTSHX="4" TXTSHY="-3" TXTOUT="0.5" SCALEV="100" KERN="0" LANGUAGE="fr" CH=" AAA é "/>
<trail ALIGN="0" LINESPMode="0" LINESP="19"/>
</StoryText>
</PAGEOBJECT>
and
<PAGEOBJECT XPOS="877.037892436666" YPOS="638.56089797286" OwnPage="0" ItemID="1489162618" PTYPE="4" WIDTH="379.234042553191" HEIGHT="59.2340425531914" FRTYPE="0" CLIPEDIT="0" PWIDTH="1" PLINEART="1" LOCALSCX="1" LOCALSCY="1" LOCALX="0" LOCALY="0" LOCALROT="0" PICART="1" SCALETYPE="1" RATIO="1" COLUMNS="1" COLGAP="22.6771653543307" AUTOTEXT="0" EXTRA="0" TEXTRA="0" BEXTRA="0" REXTRA="0" VAlign="0" FLOP="0" PLTSHOW="0" BASEOF="0" textPathType="0" textPathFlipped="0" path="M0 0 L379.234 0 L379.234 59.234 L0 59.234 L0 0 Z" copath="M0 0 L379.234 0 L379.234 59.234 L0 59.234 L0 0 Z" ImageRes="0" gXpos="877.037892436666" gYpos="-523.643826436589" gWidth="0" gHeight="0" LAYER="1" NEXTITEM="-1" BACKITEM="-1">
<StoryText>
<DefaultStyle/>
<ITEXT FONT="Life Savers Bold" FONTSIZE="11" FEATURES="inherit" FCOLOR="Magenta foncé" SCOLOR="Yellow" BGCOLOR="None" BGSHADE="20" TXTSHX="4" TXTSHY="-3" TXTOUT="0.5" SCALEV="100" KERN="0" LANGUAGE="fr" CH=" "/>
<breakline/>
<ITEXT FONT="Life Savers Bold" FONTSIZE="11" FEATURES="inherit" FCOLOR="Magenta foncé" SCOLOR="Yellow" BGCOLOR="None" BGSHADE="20" TXTSHX="4" TXTSHY="-3" TXTOUT="0.5" SCALEV="100" KERN="0" LANGUAGE="fr" CH="AAA"/>
<ITEXT FONT="Life Savers ExtraBold" FONTSIZE="14" FEATURES="inherit" FCOLOR="Magenta foncé" SCOLOR="Yellow" BGCOLOR="None" BGSHADE="20" TXTSHX="4" TXTSHY="-3" TXTOUT="0.5" SCALEV="100" KERN="0" LANGUAGE="fr" CH="... "/>
<trail ALIGN="0" LINESPMode="0" LINESP="19"/>
</StoryText>
</PAGEOBJECT>
todo : detect text with no style applied
Plutôt que la bidouille actuelle qui renomme temporairement les répertoires d'images et regénére le PDF (Cf #35), utiliser les outils PDFs permettant d'enlever les images ou les vecteurs d'un PDF , et sauvegarder sous un autre nom.
Il semble qu'il n'y a pas d'option scribus pour générer le PDF sans image. Vérifier.
ghostscript : (Cf stackoverflow )
gs -o noIMG.pdf -sDEVICE=pdfwrite -dFILTERIMAGE input.pdf
gs -o noTXT.pdf -sDEVICE=pdfwrite -dFILTERTEXT input.pdf
gs -o noVCT.pdf -sDEVICE=pdfwrite -dFILTERVECTOR input.pdf
gs -o onlyTXT.pdf -sDEVICE=pdfwrite -dFILTERVECTOR -dFILTERIMAGE input.pdf
gs -o onlyIMG.pdf -sDEVICE=pdfwrite -dFILTERVECTOR -dFILTERTEXT input.pdf
gs -o onlyVCT.pdf -sDEVICE=pdfwrite -dFILTERIMAGE -dFILTERTEXT input.pdf
cpdf -draft original.pdf -o version_without_images.pdf
(Cf askubuntu )It is not in the repositories but you can find a download (pre-compiled or source) on their website.
Manual: 15.1 Draft Documents
The -draft option removes bitmap (photographic) images from a file, so that it can be printed with less ink. Optionally, the -boxes option can be added, filling the spaces left blank with a crossed box denoting where the image was. This is not guaranteed to be fully visible in all cases (the bitmap may be have been partially covered by vector objects or clipped in the original).
For example: cpdf -draft -boxes in.pdf -o out.pdf
slasync doesnt work for masterpages :
-noimage uses a prehistoric technic like temporarily renaming image folder
instead : use dedicated xml attributes
Permettre d'associer plusieurs configs pour un même projet / un même chapitre
Ainsi on pourrait définir une config pour le PDF et une pour chaque sorte de caractéristiques des pages.
En les combinant à volonté, on pourrait les réutiliser d'un projet à l'autre.
Définir les config principales :
etc
Use configuration file rather than inline definition
Basic config code :
7 #Initialisation des variables
8 if [ ! -f "${VARIABLES_FILE:=variables.conf}" ]; then
9 echo "Le fichier ${VARIABLES_FILE:=variables.conf} manquant"
10 exit 1
11 fi
12
13 . "${VARIABLES_FILE:=variables.conf}"
14
and variables.conf is made of :
1 #Initialisation des variables
2 SVN_REPOSITORY="svn.spip.org/spip-zone/"
3 SVN_DIRECTORY="/var/svn-repos/spip-zone/"
4 SVN_ROOTS=('plugins' 'outils' 'dev');
5 SVN_PROJECTS_SUBGIT=()
etc
Conditional hyphens prevent to -find
searched string
Remove all of them out of the SLA file before search (with tr ... | grep
)
sla_icon now uses absolute local file !
Create book_images.md with all images listed by chapter (as with comments)
scripts to easyer get and set <Section ... Start="xxx"...> in a sla
calls slasetattre
will enable to later automatically adjust page numbers inside global project
Owen :
Sometimes we make mistakes, like install Docbook, and end up getting 2000+ unwanted fonts being recognized by Scribus.
After you have unticked the first hundred and realize that you have another two hours to go, you ask, is there a better way?
Go to your .scribus
directory and run;
sed 's/<Font\ Use="1"/<Font\ Use="0"/'scribus150.rc > new_rc_file
and then (after inspection of new_rc_file) move the new_rc_file
to scribus150.rc
Now you problem has been changed to going through fonts and selecting
maybe the 20 or 30 you want to use.
-replace option for search and replace is broken in the makbook
script
command is sed -i -- "s/$xmlsearched/$replaced/g" "$fic.sla"
and errors with sed: -e expression n°1, caractère 43: option inconnue pour
s'`
Ah.
It bugs when replaced expression contains a slash / (or a " also ?) : for example <COLOR NAME="Yellow" CMYK="#0000ff00"/>
Got to escape first, or use some other tool :
xmlstarlet ed -u "//$2/@$3" -v "$4" "$1.sla" > ".$1.sla.tmp"
Instead of copying a whole list of <DOCUMENT>
attributes as variable initiatializations into a shell configuration script (as now), use a config_document.sla
file as a master for desired <DOCUMENT>
attributes.
This document is then parsed so as to extract desired attributes. There must be a list of attributes to be checked (whitelist or blacklist)... in a simplified config file !
les notes sont et contiennent un morceau de texte encodé : Text="<?xml version="1.0" encoding="UTF-8"?><SCRIBUSTEXT ><defaultstyle parent="Notes" /><p ><style /><span ><charstyle Features="inherit " />des fermes vivrières ou de moins de 20</span><span ><charstyle Features="inherit " Font="Arimo Regular" /> </span><span ><charstyle Features="inherit " />ha ('</span><span ><charstyle Features="inherit " Font="Montserrat Light Italic" />smallholding</span><span ><charstyle Features="inherit " />s' dans le texte anglais) </span></p></SCRIBUSTEXT> "
It's handy when the book's PDF features a bookmark for each chapter
Add options
Make it easy to command-line change the left/right start of a chapter
When -set
option changes the start page, change the masterpage for all pages accordingly : odd=right default masterpage, even=left default masterpage -- unless the masterpage isn't the default one.
And change the UI setting that says "it begins left/right" (even if it has no effect on PDF)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.