update from master
[fanfix.git] / supported / BasicSupportPara.java
index ef4d7d778f192ed10335366886768517399d9f3a..e550d82ee0257ffb84bd8a9aee0eddf044d3c55e 100644 (file)
@@ -26,19 +26,26 @@ import be.nikiroo.utils.StringUtils;
  */
 public class BasicSupportPara {
        // quote chars
-       private static char openQuote = Instance.getTrans().getCharacter(
-                       StringId.OPEN_SINGLE_QUOTE);
-       private static char closeQuote = Instance.getTrans().getCharacter(
-                       StringId.CLOSE_SINGLE_QUOTE);
-       private static char openDoubleQuote = Instance.getTrans().getCharacter(
-                       StringId.OPEN_DOUBLE_QUOTE);
-       private static char closeDoubleQuote = Instance.getTrans().getCharacter(
-                       StringId.CLOSE_DOUBLE_QUOTE);
+       private static char openQuote = Instance.getInstance().getTrans().getCharacter(StringId.OPEN_SINGLE_QUOTE);
+       private static char closeQuote = Instance.getInstance().getTrans().getCharacter(StringId.CLOSE_SINGLE_QUOTE);
+       private static char openDoubleQuote = Instance.getInstance().getTrans().getCharacter(StringId.OPEN_DOUBLE_QUOTE);
+       private static char closeDoubleQuote = Instance.getInstance().getTrans().getCharacter(StringId.CLOSE_DOUBLE_QUOTE);
 
        // used by this class:
        BasicSupportHelper bsHelper;
        BasicSupportImages bsImages;
        
+       /**
+        * Create a new {@link BasicSupportPara}.
+        * <p>
+        * Note that you need an instance of both {@link BasicSupportHelper} and
+        * {@link BasicSupportImages} for it to work.
+        * 
+        * @param bsHelper
+        *            the required {@link BasicSupportHelper}
+        * @param bsImages
+        *            the required {@link BasicSupportImages}
+        */
        public BasicSupportPara(BasicSupportHelper bsHelper, BasicSupportImages bsImages) {
                this.bsHelper = bsHelper;
                this.bsImages = bsImages;
@@ -49,7 +56,7 @@ public class BasicSupportPara {
         * the content as it should be.
         * 
         * @param support
-        *            the linked {@link BasicSupport}
+        *            the linked {@link BasicSupport} (can be NULL)
         * @param source
         *            the source of the story (for image lookup in the same path if
         *            the source is a file, can be NULL)
@@ -64,7 +71,7 @@ public class BasicSupportPara {
         * @param html
         *            TRUE if the input content is in HTML mode
         * 
-        * @return the {@link Chapter}
+        * @return the {@link Chapter}, never NULL
         * 
         * @throws IOException
         *             in case of I/O error
@@ -77,9 +84,8 @@ public class BasicSupportPara {
                // "Chapter 5: - Fun!" after the ": " was automatically added)
                String chapterName = processPara(name, false)
                                .getContent().trim();
-               for (String lang : Instance.getConfig().getList(Config.CONF_CHAPTER)) {
-                       String chapterWord = Instance.getConfig().getStringX(
-                                       Config.CONF_CHAPTER, lang);
+               for (String lang : Instance.getInstance().getConfig().getList(Config.CONF_CHAPTER)) {
+                       String chapterWord = Instance.getInstance().getConfig().getStringX(Config.CONF_CHAPTER, lang);
                        if (chapterName.startsWith(chapterWord)) {
                                chapterName = chapterName.substring(chapterWord.length())
                                                .trim();
@@ -207,7 +213,7 @@ public class BasicSupportPara {
         * @param html
         *            TRUE if the input content is in HTML mode
         * 
-        * @return the processed {@link Paragraph}
+        * @return the processed {@link Paragraph}, never NULL
         */
        protected Paragraph processPara(String line, boolean html) {
                if (html) {
@@ -428,7 +434,7 @@ public class BasicSupportPara {
         * @param pg
         *            the optional progress reporter
         * 
-        * @return the {@link Paragraph}s
+        * @return the {@link Paragraph}s (can be empty but never NULL)
         * 
         * @throws IOException
         *             in case of I/O error
@@ -519,7 +525,7 @@ public class BasicSupportPara {
         * @param html
         *            TRUE if the input content is in HTML mode
         * 
-        * @return the {@link Paragraph}
+        * @return the {@link Paragraph}, never NULL
         */
        protected Paragraph makeParagraph(BasicSupport support, URL source,
                        String line, boolean html) {