/* * [ProofreadInserts.java] * * Summary: Proofread Insert macros. Find dups on page. Find orphan Books/electronics/DVDs. Ensure ascending price. * * Copyright: (c) 2012-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2012-03-17 initial version */ package com.mindprod.stores; import com.mindprod.common18.Misc; import com.mindprod.filter.ExtensionListFilter; import com.mindprod.htmlmacros.macro.Global; import com.mindprod.htmlmacros.support.ConfigurationForMindprod; import com.mindprod.hunkio.HunkIO; import java.io.File; import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import static java.lang.System.*; /** * Proofread Insert macros. Find dups on page. Find orphan Books/electronics/DVDs. Ensure ascending price. *

* All Insert and Cite macros must be expanded first. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2012-03-17 initial version * @since 2012-03-17 */ public class ProofreadInserts { // TidyBookMacros: reflow Book macros. Update BookHead with recent title and published. Add missing published to BookHead. // RefreshInserts: refresh data on Insert macros from book page. Add missing published to book Insert. // InsertBookMarkers: put between books to make it easier to sort. One shot. // SortBooks: sort book Inserts on page so most recently published are first. // ProofreadInserts: check that sort worked. /** * format for non-display of price */ private static final DecimalFormat DOLLAR_FORMAT = new DecimalFormat( "'$'###,##0.00" ); /** * name of file e.g. book/9789506710118.html referenced by the insert */ private static final HashSet insertsFound = new HashSet<>( 1000 ); /** * regex to look for hand coded */ private static final Pattern CITE_PATTERN = Pattern.compile( "" ); private static List dirsToProcess; /** * dir where Book macros are kept. */ private static File bookDir; /** * dir where DVD macros are kept. */ private static File dvdDir; /** * dir where electronic macros are kept in files of form B0057A5RA6.html */ private static File electronicDir; /** * webrootDir directory of website */ private static File webrootDir; /** * scan file contents for