Package org.openstreetmap.josm.gui.help
Class HelpContentReader
- java.lang.Object
-
- org.openstreetmap.josm.tools.WikiReader
-
- org.openstreetmap.josm.gui.help.HelpContentReader
-
public class HelpContentReader extends WikiReader
Reads help content from the JOSM Wiki and prepares it for rendering in the internal help browser. The help content has to be filtered because only the main content<div>
of a Wiki help page is displayed in the internal help browser. It also has to be transformed because the internal help browser required slightly different HTML than what is provided by the Wiki.
-
-
Constructor Summary
Constructors Constructor Description HelpContentReader(String baseUrl)
Constructs a newHelpContentReader
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
fetchHelpTopicContent(String helpTopicUrl, boolean dotest)
Fetches the content of a help topic from the JOSM wiki.protected String
prepareHelpContent(BufferedReader in, boolean dotest, URL url)
Reads help content from the input stream and prepares it to be rendered later in the internal help browser.-
Methods inherited from class org.openstreetmap.josm.tools.WikiReader
getBaseUrlWiki, read, readFromTrac, readLang
-
-
-
-
Constructor Detail
-
HelpContentReader
public HelpContentReader(String baseUrl)
Constructs a newHelpContentReader
.- Parameters:
baseUrl
- the base url of the JOSM help wiki, i.e. https://josm.openstreetmap.org
-
-
Method Detail
-
fetchHelpTopicContent
public String fetchHelpTopicContent(String helpTopicUrl, boolean dotest) throws HelpContentReaderException
Fetches the content of a help topic from the JOSM wiki.- Parameters:
helpTopicUrl
- the absolute help topic URLdotest
- iftrue
, checks if help content is empty- Returns:
- the content, filtered and transformed for being displayed in the internal help browser
- Throws:
HelpContentReaderException
- if problem occursMissingHelpContentException
- if this helpTopicUrl doesn't point to an existing Wiki help page
-
prepareHelpContent
protected String prepareHelpContent(BufferedReader in, boolean dotest, URL url) throws HelpContentReaderException
Reads help content from the input stream and prepares it to be rendered later in the internal help browser. Throws aMissingHelpContentException
if the content read from the stream most likely represents a stub help page.- Parameters:
in
- the input streamdotest
- iftrue
, checks if help content is emptyurl
- help topic URL- Returns:
- the content
- Throws:
HelpContentReaderException
- if an exception occursMissingHelpContentException
- if the content read isn't a help page- Since:
- 5936
-
-