Skip to content

Commit

Permalink
#82 ModularParser-getLanguages()-returns-null (#276)
Browse files Browse the repository at this point in the history
- adjusts `ModularParser` to return empty instead of `null` in line 496ff to avoid NPEs
- adds new test to `ParsedPageTest` verifying a parse of plain/raw mediawiki articles as reported in #82
- fixes naming of misspelled method or field names
- fixes (many weird) typos
- adjusts JavaDoc along the path
- partially resolves #82
  • Loading branch information
mawiesne authored Nov 15, 2023
1 parent 3c4bc9c commit c7b843a
Show file tree
Hide file tree
Showing 9 changed files with 657 additions and 414 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import java.util.List;

/**
* This is the Simple implementation of the Content Inteface, and is used for nearly all content
* This is the Simple implementation of the Content Interface, and is used for nearly all content
* containing classes...
* <p>
* Be aware, that all retured Spans refer to the String returned by getText()<br>
* Be aware, that all returned Spans refer to the String returned by getText()<br>
*/
public class ContentElement
extends ParsedPageObject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public int getPageId()
* Sets the category element of a parsed page.
*
* @param categories
* A ContentElement containg the categories of a page.
* A ContentElement containing the categories of a page.
*/
public void setCategoryElement(ContentElement categories)
{
Expand All @@ -113,7 +113,7 @@ public ContentElement getCategoryElement()

/**
* Returns a list of category Link objects. This is a shortcut for writing
* getCategoryElemement.getLinks();
* getCategoryElement.getLinks();
*
* @return A list of category links.
*/
Expand Down Expand Up @@ -161,16 +161,14 @@ public Paragraph getFirstParagraph()
* Sets the language element of a parsed page.
*
* @param languages
* A ContentElement containg the languages of a page.
* A ContentElement containing the languages of a page.
*/
public void setLanguagesElement(ContentElement languages)
{
this.languages = languages;
}

/**
* Returns a ContentElement containing the languages that are linked inside the article.
*
* @return A ContentElement containing the languages that are linked inside the article.
*/
public ContentElement getLanguagesElement()
Expand All @@ -179,30 +177,14 @@ public ContentElement getLanguagesElement()
}

/**
* Returns a list of language Link objects. This is a shortcut for writing
* @return A list of language Link objects. This is a shortcut for writing
* getLanguagesElement().getLinks();
*/
public List<Link> getLanguages()
{
return languages.getLinks();
}

//// I do not think that this should be a core api method, as it is language and template
//// dependend. (TZ)
// /**
// * Returns a ContentElement with the Content of "Dieser Artikel" Template
// */
// public ContentElement aboutArticle(){
// return aboutArticle;
// }
//
// /**
// * See aboutArticle() for Details...
// */
// public void setAboutArticle(ContentElement aboutArticle){
// this.aboutArticle = aboutArticle;
// }

/**
* Sets the Sections of a ParsedPage.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public interface MediaWikiParser
ParsedPage parse(String src);

/**
* Retruns information abour the configuration of the parser.
* Retruns information about the configuration of the parser.
*/
String configurationInfo();

Expand Down
Loading

0 comments on commit c7b843a

Please sign in to comment.